Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/22/2012 in all areas

  1. Coming in a bit late to the party, but I think I found this on StackOverflow and modified it for my needs - matches most if not all of YT's many URLs: preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $page->video, $match); In fact, here's the solution (second post) with all the URLs it matches: http://stackoverflow...sing-preg-match Matches the following: https://youtu.be/dQw4w9WgXcQ ... https://www.youtube.com/embed/dQw4w9WgXcQ ... https://www.youtube.com/watch?v=dQw4w9WgXcQ ... https://www.youtube.com/?v=dQw4w9WgXcQ ... https://www.youtube.com/v/dQw4w9WgXcQ ... https://www.youtube.com/e/dQw4w9WgXcQ ... https://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ ... https://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/0/dQw4w9WgXcQ ... https://www.youtube.com/watch?feature=player_embedded&v=dQw4w9WgXcQ ... https://www.youtube.com/?feature=player_embedded&v=dQw4w9WgXcQ ...
    3 points
  2. Despite that number being typecast to a string, it looks like PHP actually typecasts it back to an integer if the string contains only digits, when creating an array index. I found that I could get PHP to keep it as a string if I appended a non-digit character to the end of it (space). I just committed the update, so this issue should be fixed. Since this PHP typecasting behavior is a little unexpected, I'm just hoping the behavior is the same across PHP versions. Let me know if you find there is still an issue.
    2 points
  3. Today I needed to install the latest Textile on an older site for a client, and figured I would go ahead and make a PW2 module out of it at the same time. Textile is the markdown language included with Textpattern CMS and apparently also used by Basecamp and Google+ to some extent. More information about Textile and syntax here: http://en.wikipedia....kup_language%29 Textile is very similar to Markdown (already included with PW), though now that I've spent some time with the syntax, I think I might like Textile a little more. To Install Download or clone from GitHub at: https://github.com/r...ormatterTextile Place files in /site/modules/TextformatterTextile/. Go to Modules in the admin, 'Check for new modules' and click install for Textile under the Textformatter section. You'll also see 'Textile Restricted' and that is a separate version of the module that may be used with untrusted input like user-supplied input or blog comments. The regular Textile should only be used with trusted input. To use Add this to any textarea (or text) field, and that field will interpret Textile codes and output XHTML markup on the front end of your site. Note that Textformatters appear on the 'Details' tab of the field editor when editing a text or textarea field. Use the regular 'Textile' unless the field in question may contain untrusted user input, in which case you should use 'Textile Restricted'. Please note Don't use this in combination with other text formatters like Markdown. Don't use with TinyMCE (there would be no point). This module may be used with any version of ProcessWire: 2.0, 2.1 or 2.2+.
    1 point
  4. Not sure if I am dreaming here, but was'n page creating in API working with just title at some point (it created name automatically from title). I just updated one project to latest and my "used to work nicely" code now cries: Error Uncaught exception 'WireException' with message 'Can't save page 0: /asiasanat//: It has an empty 'name' field' in /data/www/testi.potilaanlaakarilehti.fi/doc/wire/core/Pages.php:463 Code that used to work and now doesn't is: $t = new Page(); $t->template = $templates->get("tag"); $t->parent = $pages->get(1011); // 1011 => /asiasanat/ $t->title = $tag; $t->save(); Fix is of course simple, but I used to like this shorter way to create pages... EDIT: Never mind, it does work. It doesn't work if your $tag is actually empty string...
    1 point
  5. You could easily make something like this with using urlsSegment on templates. $action = $input->urlSegment1; $method = "_$action"; if(function_exists($method)) echo $method(); function _addItem(){ return "Item added"; }; Then you can use something like /mypage/addItem/
    1 point
  6. Ryan, just tested it and it seems like I found a bug, though I'm not sure. Maybe it's just me doing something wrong) Cloning is working fine, but when I add new repeater item, then, for example, select image file and fill other fields, after I hit save I can't see my just added unit untill I click "Add item". I have ready-to-edit (unpublished) items set to 1. Then if I add second item, after saving I see only my second item. Haven't tested it further, don't have much time right now. Is it a bug? Can you reproduce this, guys?
    1 point
  7. Just tested on my local install. Cloning nested pages with repeater now work. So far nothing get's added or deleted. Thanks Ryan!
    1 point
  8. I didn't test a lot. I really didn't do more than described on my post. But yes, with this limited test, It's working as it should.
    1 point
  9. @Diogo: Thanks for testing! Just to confirm, it's working how it should? It sounds to me like it is, but let me know if any of the behavior was unexpected. @Pete: I've updated the API for adding repeater items so that it is now simpler. Lets say that you've got a repeater field called 'buildings', and you want to add a new building. Here's how you can do it now: $building = $page->buildings->addNew(); $building->title = 'Sears Tower'; $building->height = 1400; $page->save(); That addNew() method can now be called on any repeater value. If there is a ready page waiting to be populated it returns that. If not, it will create a new page right there. It will be saved when you save your main $page. This hopefully makes the repeaters API a lot simpler.
    1 point
  10. I never install a new one, Just move and change the config.
    1 point
×
×
  • Create New...