Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/01/2016 in all areas

  1. It appears that the last commits were quite incomplete, though the newer versions on my dev drive also had a few issues of their own. That's what you get when you replace sleeping with coding once too often I've updated both client and server module to 0.0.7 now, with partially re-written handshaking logic and a more detailed remote module list feature. I'll be quite busy the rest of the week (including the weekend), but if time allows, I want to tackle two issues in the first half of November: a cryptographic handshake - don't like really plaintext passwords going over the wire - and a documentation and an example module for the remote actions system. The latter will no bring up some more issues that needs fixing/tweaking along the way. My priority will be on my DatetimeAdvanced and JsonNativeField modules though, as I'll be using these in a production system in the near future, so I wouldn't ask anybody to hold their breath yet.
    5 points
  2. Done! Please let me know if you have any problems and also be sure to "Like" @Can's post over here: https://processwire.com/talk/topic/5825-multi-language-support-for-module-config-fields/?do=findComment&comment=131595 because he showed me how to add ML module config settings.
    4 points
  3. https://github.com/CanRau/MarkupCookieConsent/ is already doing this and Ryan fixed some missing parts some month ago..
    4 points
  4. This week has been busy! We've got updates to our demo site, a new functions API, and other core additions that you may find useful in template files. https://processwire.com/blog/posts/processwire-3.0.39-core-updates/
    3 points
  5. findMany() behaves like find() in that it does hide unpublished/hidden or otherwise inaccessable pages from non-privileged users. Try include=hidden or check_access=0 if you need to alter that behaviour.
    3 points
  6. It is always important to eat your own dog food. It is interesting how coming to site design with PHPStorm at hands can change the whole API paradigm at once) As now we have at least 3 ways to call an API variable it would be incredibly important to have a detailed explanation about how to take a decision what to choose. Most of us used to use $page, but newcomers starting with demo profile will be using page(), and we are not even touching on wire() and $wire. It seems like @ryan is more into the function interface (you wouldn't be inventing it other way, would you). Please consider making an article about when to choose what, if you got time. I really like the regions functionality, but the + at the beginning and at the end seems magical and probably goes against the initial functional interface intention to have closer IDE integration. I do not think this could be advised by IDE (or am I missing something?) Is there or should there be other more convenient way to append and prepend to regions?
    3 points
  7. Great! BitPoet thank you very much, for your time and your effort, this is an incredible community! I'm so glad I found this place. I'm a graphic designer with a lot experience making Web/UI/UX designs, but always associated with programmers who build the business and data access layer, I just make the design and layout with html, css and some javascript, mainly jquery. But finding Processwire and see the ease of use, at least for small business marketing sites, gave me the courage to make complete projects for myself, and although I fully understand the whole concept of working with Processwire, in these initial steps I stuck a little on small details and decision making in which is the best way to go, for example: using some templates system or not, etc. But I'm motivated to continue (sorry for my programmers hehe) now I'm starting to prepare an starting site profile with everything prepared for this kind of webs, that help me to start new projects quickly from it.. bye wp! So again thank you very much for your help and everyone here.
    3 points
  8. Thanks - try v099, the lister type is determined by url instead id.
    2 points
  9. Sorry I missed this post, but I am hoping by now you have realized that this is an issue with your wireMail setup and not this module. Just an oversight on my part - thanks for the heads up and the solution - much appreciated. It is fixed now!
    2 points
  10. I completely agree with @szabesz here - the PW Upgrades modules is great! I used to be all about updates via git, but this module makes it so easy. And, if you have Tracy installed you can instantly switch between any of the versions of PW that you ever installed via the upgrades module: http://processwire.com/blog/posts/introducing-tracy-debugger/#processwire-version-panel - great if you are not sure if a problem is due to a specific PW version or not.
    2 points
  11. A cheap rip-off of LanguageSupportPageNames that adds support for prefixed urls, localUrl and localHttpUrl: <?php /** * Adds simple support for URL paths prefixed by language name. * * Proof-of-concept. * * Most of the actual code is stolen from LanguageSupportPageNames. * Adds the same localUrl and localHttpUrl methods to page objects. * */ class LanguageSupportPath extends Wire implements Module { public static function getModuleInfo() { return array( "title" => __("Support for Language Path"), "summary" => __("Adds simple support for URL paths prefixed by language name"), "version" => "0.0.3", "autoload" => true, "requires" => array( "LanguageSupport" ) ); } public function init() { $this->addHookBefore("ProcessPageView::execute", $this, "hookProcessPageViewExecute"); } public function ready() { $this->addHook('Page::localUrl', $this, 'hookPageLocalUrl'); $this->addHook('Page::localHttpUrl', $this, 'hookPageLocalHttpUrl'); } /** * Hook in before ProcesssPageView::execute to capture and modify $_GET[it] as needed * */ public function hookProcessPageViewExecute(HookEvent $event) { $event->object->setDelayRedirects(true); // save now, since ProcessPageView removes $_GET['it'] when it executes $it = isset($_GET['it']) ? $_GET['it'] : ''; if(!$this->isAssetPath($it)) { if(strpos($it, "processwire/") !== 0) $this->log->message("Original path: $it"); $it = $this->updatePath($it); if(strpos($it, "processwire/") !== 0) $this->log->message("Updated path: $it"); $_GET['it'] = $it; } } /** * Is the given path a site assets path? (i.e. /site/) * * Determines whether this is a path we should attempt to perform any language processing on. * * @param string $path * @return bool * */ protected function isAssetPath($path) { $config = $this->wire('config'); // determine if this is a asset request, for compatibility with pagefileSecure $segments = explode('/', trim($config->urls->assets, '/')); // start with [subdir]/site/assets array_pop($segments); // pop off /assets, reduce to [subdir]/site $sitePath = '/' . implode('/', $segments) . '/'; // combine to [/subdir]/site/ $sitePath = str_replace($config->urls->root, '', $sitePath); // remove possible subdir, reduce to: site/ // if it is a request to assets, then don't attempt to modify it return strpos($path, $sitePath) === 0; } /** * Given a page path, return an updated version that lacks the language segment * * It extracts the language segment and uses that to later set the language * */ public function updatePath($path) { if($path === '/' || !strlen($path)) { $this->user->language = $this->wire('languages')->getDefault(); return $path; } $trailingSlash = substr($path, -1) == '/'; $testPath = trim($path, '/') . '/'; $home = $this->wire('pages')->get(1); $found = false; foreach($this->wire('languages') as $language) { if($language->isDefault()) continue; $name = $language->name . "/"; if(strpos($testPath, $name) === 0) { $found = true; $this->user->language = $language; $path = substr($testPath, strlen($name)); break; } } if(!$found) $this->user->language = $this->wire('languages')->getDefault(); if(!$trailingSlash && $path != '/') $path = rtrim($path, '/'); return $path; } public function hookPageLocalUrl(HookEvent $event) { $lang = $this->getLanguage($event->arguments(0)); $event->return = $this->wire('config')->urls->root . ltrim(($lang->isDefault() ? "" : $lang->name) . $event->object->path, "/"); } public function hookPageLocalHttpUrl(HookEvent $event) { $this->hookPageLocalUrl($event); $url = $event->return; $event->return = $this->wire('input')->scheme() . "://" . $this->wire('config')->httpHost . $url; } /** * Given an object, integer or string, return the Language object instance * * @param int|string|Language * @return Language * */ protected function getLanguage($language) { if(is_object($language)) { if($language instanceof Language) return $language; $language = ''; } if($language && (is_string($language) || is_int($language))) { if(ctype_digit("$language")) $language = (int) $language; else $language = $this->wire('sanitizer')->pageNameUTF8($language); $language = $this->wire("languages")->get($language); } if(!$language || !$language->id || !$language instanceof Language) { $language = $this->wire('languages')->get('default'); } return $language; } public function ___install() { if($this->modules->isInstalled("LanguageSupportPageNames")) { throw new WireException($this->_("LanguageSupportPath and LanguageSupportPageNames cannot be active at the same time")); } } } This way, of course, the page paths after the prefix are identical for all languages, which might not be desired for SEO reasons. The module also may have side effects from setting the language that I didn't consider, so use at your own risk
    2 points
  12. AvbFastCache Module Github repoModule Authorİskender TOTOĞLUBig Thanks to phpFastCache authorsphpfastcacheUsage Almost Like original phpfastcache library : I made some modification on original phpfastcache library for use it with ProcessWire. On my side i tested files and sqlite its look working well. You can set default settings from module setting panel or you can use it like original library with custom settings for each call, from module setting panel you can set storage type, cache path, security key, fallback and also you can delete cached data from module settings panel. Modified set function, working like core $cache->get function this function will check a cached data exist ? if not save cache data and return cached data back. Here is some example usages : // Load Module $AvbFastCache = $modules->AvbFastCache; // Set cache settings from module $_c = phpFastCache($AvbFastCache->storage, $AvbFastCache->getConfig(), $AvbFastCache->expire); $output = $_c->set("cacheKeyword", function($page)) { $output = '<h1>{$page->title}</h1>'; $output .= "<div class='body'>{$page->body}</div>"; return $output; }); //=> OR // Do MemCache $_c2 = phpFastCache("memcached"); // Write to Cache Save API Calls and Return Cache Data echo $_c2->set("identity_keyword", function()) { $results = cURL->get("http://www.youtube.com/api/json/url/keyword/page"); $output = ""; foreach($results as $video) { $output .= $vieo->title; // Output Your Contents HERE } return $output; }, 3600*24); // This will check id=1 or parent_id=1 and will return last modified page UNIX_TIMESTAMP as result echo $AvbFastCache->getLastModified(1); // This will check id=1 or parent_id=1 and template=basic-page and will return last modified page UNIX_TIMESTAMP as result echo $AvbFastCache->getLastModified(1, 'basic-page'); // What can you do with last modified dates ? Let me show you an example // Think you are in news page, $page->id is news page id we are using $user->language->id because if we have multi language website // Here getLastModified() function will get last modified date for us, if news page or children pages have any update new cache data will be created automatically // Like this you can set expire time 0 unlimited from module panel ! // Think we are in "new-list" template and listing children pages $keyword = "newsPage" . $page->id . $user->language->id . $AvbFastCache->getLastModified($page->id, 'news-single'); // Load library with your settings $_c3 = phpFastCache($AvbFastCache->storage, $AvbFastCache->getConfig(), $AvbFastCache->expire); // Write to Cache and Display Result echo $_c3->set($keyword, function($page)) { $output = ""; foreach($page->children as $p) $output .= "<h2>{$p->title}</h2>"; return $output; }); You can check phpfastcache usage from phpfastcache wiki or phpfastcache offical website Note : I didn't tested this module with older ProcessWire versions, tested with 2.6.1 or newer versions. Module not have core dependency, it could work also older versions but need to check for be sure !
    1 point
  13. Thanks, just uploaded a fix to GitHub and the Modules directory (no version change). I haven't noticed this because I had Tooltips turned on.
    1 point
  14. Hello Jozsef, for the generation of many large image variations, ImageMagick comes in handy. Of course you have to enable it first on your webspace, but most hosters have an manual for the activation, if they support it. Usually I visit the page I added images in to generate the variations. You could probably achieve this also by an hook. But for me it seems more natural to check the changes I made after saving a page. For the lazy loading of images in the front end, I can highly recommend using the plugin lazysizes. It is easy to setup, supports responsive images, background images and so on. There is also the module Markup SrcSet, which uses lazysizes. Regards, Andreas
    1 point
  15. Off hand, I would say use something like mpdf and use the customer's logo (either by a simple form upload or via a page in the backend) to export to the pdf. I have done something similar in the past using the last method I suggested. Is this something that they will download to give out, or is it also hosted on the site with just a link the customers give out etc?
    1 point
  16. I have, but it should've been fixed. I'll reopen my issue here: https://github.com/processwire/processwire-issues/issues/44
    1 point
  17. @arjen - check out the User Switcher in Tracy or ALIF - both of these do what you are looking for. Btw, not dissing what Pete has done here - his is the most secure option, but I think the other two manage the security implications.
    1 point
  18. I just used this, just that i used Ryan's suggestion for the random string $rand = new Password(); $hash = $rand->randomBase64String(100); and there is a problem with the second check here: if(strcmp(wire("users")->get($activate_username)->user_activation, $activate_hash) == 0 || wire("users")->get($activate_username)->user_activation == 0) If wire("users")->get($activate_username)->user_activation is a string starting with a letter it will be converted to integer 0 so the if statement is true, if the string starts with a number that number will be converted to an integer. To solve this use === in that comparison, or put 0 in quotes "0", or omit it altogether (if it's already 0 no need to set it again to 0). This is how i handle the activation: $username = $sanitizer->pageName($_GET["user"]); $hash = $sanitizer->text($_GET['hash']); // get the user $u = $pages->get("template=user, name={$username}"); // user exists if($u->id) { // check if user is activated if($u->user_activation === "active") { echo "Account is already active."; } // not activated compare hash from $_GET with hash from db // http://php.net/manual/en/function.strcmp.php else if(strcmp($u->user_activation, $hash) == 0) { // hashes are the same activate user echo "Your account has been activated!<br>"; $u->of(false); $u->user_activation = "active"; $u->save(); } // hashes don't match else { echo "There was an error activating your account! Please contact us!<br><br>"; } }
    1 point
  19. Wow ! Thanks adrian. Exactly what I mean. I will try it and if there are problems I will post it here.
    1 point
  20. Fixed by Ryan https://github.com/processwire/processwire-issues/issues/59
    1 point
  21. That's because I stole the relevant bits from your code
    1 point
  22. Fantastic work! I thought camera gear was expensive. Yikes.
    1 point
  23. Thanks for the welcoming, nice to see so many MODx devs here :). I wish I had embraced ProcessWire sooner, as after leaving MODx 4 years ago I have forked MODx Evo with other devs, then tried several other CMSs...but only in ProcessWire I find the closest resemblance of MODx Evo functionality (I hate Revo ), obviously ProcessWire is way way way more powerful.
    1 point
  24. +1 Almost nothing is automated in our case, no need for that in ProcessWire world anyway. The only optional automation is the upgrade check, but it only happens when you log in and only if you enable it (off by default).
    1 point
  25. hi @szabesz thanks, the database backup modules is one of my default modules (probably should be in the core), but I've never tried the upgrade module - maybe I have a strong resistance to any kind of automatic update systems which goes back to some nightmare OS "automatic" upgrades on Windows and Mac Usually I have some sort of git workflow for updates, but on sites that I don't have access to the server (like shared hosting) this upgrade module might be a better and safer option than my manual upgrade process. And the module is built by Ryan then I am sure it is pretty solid and well tested. Thanks for the suggestion! thanks @adrian I have been recently using the tracy debugger and finding it very useful. That is a pretty cool integration for switching between versions, will give it a try!
    1 point
  26. @Michael Murphy Have already tried this one? http://modules.processwire.com/modules/process-wire-upgrade/ It does what you described but automatically. If you also have this one installed...: http://modules.processwire.com/modules/process-database-backups/ ...then the upgrade module can optionally create a db backup for you, which is recommended anyway. I recently had an issue though, but it was not the module's fault, it was a GitHub issue when github.com failed to deliver the archive of ProcessWire so the update failed too but the site was intact so no harm was done. After GitHub had come back I could upgrade without issues.
    1 point
  27. This function here listens for repeater's events and initialize jQuery Magnific inside a repeater. Tested on my site only though. EDIT: Also need to check if repeater is being used or not. // magnific $(document).ready(function(){ // If repeater field if ( $('.InputfieldRepeaterAddItem').length ) { //console.log('Repeater is being used'); $(document).on('click opened openReady repeateradd', function(){ initMagnificPopup(); }); } else { //console.log('Repeater is NOT being used'); initMagnificPopup(); } });//end jquery // Initialize Magnific function initMagnificPopup() { $('a.add_media').magnificPopup({ type:'iframe', callbacks: { close: function() { // will fire when popup is closed window.location.reload(true);// force parent page refresh on modal close } } }); }
    1 point
  28. @EyeDentify, also without any asperger, it is sometimes hard to grasp things. (the forums are full of examples, ) But yep, with PW it is really nice to work. You can start with simple things and then go deeper and deeper. Every step gives you a bit more learning and understanding. And that's why you want to go deeper again. (but caution: it can be a bit addictive!)
    1 point
  29. I think the answer to it is yes: https://en.wikipedia.org/wiki/ASCII#Character_order Historically, numbers are listed first in dictionaries (real books) as well, at least in Hungarian books
    1 point
  30. I am getting this console error and missing content in the side scrollable box on Chrome MacOS
    1 point
  31. https://github.com/ryancramerdesign/ProcessWire/issues/2017 Even though I mention that I know why it was set to 11, now I can't remember, but if you go to Modules > Core > SystemUpdater and change it to 15 (assuming you are on a recent version of PW 3), I think that should get you back to normal.
    1 point
  32. If you only want to sort in-memory, getting the pages as a plain array and using a custom sort function should do the trick: <?php $ps = $pages->find('yourselector')->getArray(); usort($ps, function($a, $b) { $na = $a->name; $nb = $b->name; if(!ctype_digit($na) && !ctype_digit($nb)) return strcmp($na, $nb); if(ctype_digit($na) && ctype_digit($nb)) return strcmp($na, $nb); return (ctype_digit($na)) ? 1 : -1; }); foreach($ps as $p) echo $p->name . PHP_EOL;
    1 point
  33. @oma I assume you want them ordered ascending and the ones starting with a number at the end. You could do this by storing the numerical names in a variable and echoing that variable after the "normal" names. $numericalNames = ""; $normalNames = ""; $names = $pages->find("template=template_name"); foreach($names as $n) { /* get the first letter of the current name */ $firstLetter = substr($n->name, 0, 1); $regexPattern = "/[0-9]/"; // if first letter is a number if(preg_match($regexPattern, $firstLetter)) { $numericalNames .= $n->name; } else { $normalNames .= $n->name; } } echo $normalNames; echo $numericalNames;
    1 point
  34. Looks like you're running PHP 5.3 on the live system. You could fix this error by replacing the short array notation [...] used throughout the module with its verbose notation as array(...), but you should really think of switching to a more current PHP release.
    1 point
  35. Under pressure from a client, I had to launch a PW front end user membership site 2 months earlier than the agreed schedule. Never an ideal situ and no time to fully test everything. The client web admin and I were able to monitor the logs, esp the session logs to see who'd logged in and who'd had trouble. We immediately emailed those who'd lost/forgotten/did-not-receive-the-email-with their username. Every single one of those new members emailed back their appreciation for the proactive customer support. What could have been disastrous turned those subscribers into site fans. PW logs are your friends! Thank you Ryan, the PW dev team and every forum/module contributor for delivering such a solid product.
    1 point
  36. As discussed on Github, AOS will probably have a submodule that will load CKEditor plugins automatically, so you don't have to manually configure each field. I use the following plugins by default: autogrow keystrokes justify Let me know if you have such "basic" plugins you would like to see here. Obviously complex plugins that need more configuration will be not included here. Plus I don't know whether AOS should mess with CKE toolbar buttons, or leave it to the user to enter buttons to the field's settings in the admin.
    1 point
  37. v059 is available with the features and fixes mentioned above. The 'Submodules' section in the admin has also got a minor redesign.
    1 point
  38. Thought it was high time I released this one into the wild after sitting on it for a year or more - oops!
    1 point
  39. Tested: ImageAnimatedGif works well with PW 3.0+.
    1 point
×
×
  • Create New...