Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/29/2016 in all areas

  1. I agree. And I'd like to suggest "Publish + Add new" to "Publish + Add Another" as it is a bit more clear in suggesting: "Another of the same template". One more thing, maybe it's a good thing to change the button to be like this example attached. Not advanced users may find it easier to understand.
    4 points
  2. Ok, the PHP 5.3 issue should be fixed in TracyDebugger and a PR has been submitted for Performance panel as well.
    2 points
  3. Is the server running php 5.4? This does suspiciously look like a 5.3 install, which doesn't support short array notation with [].
    2 points
  4. I just added the stripTags and also the other missing option: newlineReplacement, to the docs: https://processwire.com/api/variables/sanitizer/#options-that-may-be-provided-to-the-text-and-textarea-functions
    2 points
  5. +1 for split button. @Ryan - they have those in getuikit
    2 points
  6. This is quite a change to current implementation, but I'll have to agree. A split button is widely used and well known pattern, while the delayed dropdown we've got now is pretty much unknown, at least to me.. and probably most regular users.
    2 points
  7. Sneak peek : https://github.com/plauclair/WireMailMailgun I've started implementing Mailgun. It's mostly working except for some stuff. Look at the tags for 0.1 prerelease.
    2 points
  8. Tracy Debugger for ProcessWire The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger Modules Directory: http://modules.processwire.com/modules/tracy-debugger/ Github: https://github.com/adrianbj/TracyDebugger A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
    1 point
  9. Updated 2018-05-06: Version 2.0.0 released Updated 2017-03-27: Version 1.1.3 released Updated 2016-04-11: Version 1.1.2 released Updated 2016-02-26: Officially in the module directory! http://modules.processwire.com/modules/webmention/ Updated 2016-02-25: Version 1.1.0 is now released. It's been submitted to the module directory so should appear there soon. In the meantime, it's available on GitHub: https://github.com/gRegorLove/ProcessWire-Webmention. Please refer to the updated README there and let me know if you have any questions! ------------ Original post: This is now out of date. I recommend reading the official README. I've been working on this one for a while. It's not 100%, but it is to the point I'm using it on my own site, so it's time for me to release it in beta. Once I finish up some of the features described below, I will submit it to the modules directory as a stable plugin. For now, you can install from Github. It works on PW2.5. I haven't tested on PW2.6, but it should work there. Feedback and questions are welcome. I'm in the IRC channel #processwire as well as #indiewebcamp if you have any questions about this module, webmention, or microformats. Thanks to Ryan for the Comments Fieldtype which helped me a lot in the handling of webmentions in the admin area. ProcessWire Webmention Module Webmention is a simple way to automatically notify any URL when you link to it on your site. From the receiver's perspective, it is a way to request notification when other sites link to it. Version 1.0.0 is a stable beta that covers webmention sending, receiving, parsing, and display. An easy admin interface for received webmentions is under development, as well as support for the Webmention Vouch extension. Features * Webmention endpoint discovery * Automatically send webmentions asynchronously * Automatically receive webmentions * Process webmentions to extract microformats Requirements * php-mf2 and php-mf2-cleaner libraries; bundled with this package and may optionally be updated using Composer. * This module hooks into the LazyCron module. Installation Github: https://github.com/gRegorLove/ProcessWire-Webmention Installing the core module named "Webmention" will automatically install the Fieldtype and Inputfield modules included in this package. This module will attempt to add a template and page named "Webmention Endpoint" if the template does not exist already. The default location of this endpoint is http://example.com/webmention-endpoint After installing the module, create a new field of type "Webmentions" and add it to the template(s) you want to be able to support webmentions. Sending Webmentions When creating or editing a page that has the Webmentions field, a checkbox "Send Webmentions" will appear at the bottom. Check this box and any URLs linked in the page body will be queued up for sending webmentions. Note: you should only check the "Send Webmentions" box if the page status is "published." Receiving Webmentions This module enables receiving webmentions on any pages that have have "Webmentions" field, by adding the webmention endpoint as an HTTP Link header. If you would like to specify a custom webmention endpoint URL, you can do so in the admin area, Modules > Webmention. Processing Webmentions (beta) Currently no webmentions are automatically processed. You will need to browse to the page in the backend, click "Edit," and scroll to the Webmentions field. There is a dropdown for "Visibility" and "Action" beside each webmention. Select "Process" to parse the webmention for microformats. A better interface for viewing/processing all received webmentions in one place is under development. Displaying Webmentions (beta) Within your template file, you can use `$page->Webmentions->render()` [where "Webmentions" is the name you used creating the field] to display a list of approved webmentions. As with the Comments Fieldtype, you can also generate your own output. The display functionality is also under development. Logs This module writes two logs: webmentions-sent and webmentions-received. Vouch The Vouch anti-spam extension is still under development. IndieWeb The IndieWeb movement is about owning your data. It encourages you to create and publish on your own site and optionally syndicate to third-party sites. Webmention is one of the core building blocks of this movement. Learn more and get involved by visiting http://indiewebcamp.com. Further Reading * http://indiewebcamp.com/webmention * http://indiewebcamp.com/comments-presentation * http://indiewebcamp.com/reply
    1 point
  10. Fixed as of v1.1.1: I caught (and filed) a bug to be fixed: if you use the Webmentions Manager to try to manually process/delete a received webmention, it does not work currently. This doesn't affect the automatic processing, if you have that enabled, or manually processing from the page that received the webmention. Do feel free to try it out by sending a webmention to this post on my site: http://gregorlove.com/2016/02/quite-pleased-to-officially-release/
    1 point
  11. Vagrant and Virtualbox on windows would make sense: using both windows and linux on your laptop on the same boot partition and sharing files on a second data partition. For example, you would have the ease of windows and the sudo and ssh command line of linux.
    1 point
  12. Sorry about that - I already adjusted one short array syntax issue with the Performance panel plugin. I'll take care of that one too - update coming shortly.
    1 point
  13. https://processwire.com/talk/topic/12147-continuous-prevnext-links/
    1 point
  14. Forgot to mention it, was too late. I tried the option already, but I want tags to be stripped, so right now the purifier ($sanitizer->purify) seems to be the best option right now. Thanks for mentioning bbcode textformatter mr-fan, but for now I stick to plain text for mails and comments. URLs are auto linkified on output anyways.. I got the whole processwire of the project opened in sublime, so cmd+t and the desired class, module, whatever brings me straight to what I want to know, still the fastest way.
    1 point
  15. Agree, the API is unbeatable. I haven't tried every CMS but at least the ones I have tried, everytime it was time for "Hey Mr.CMS, could you please get me this content from over there?". Either there was no clear answer or a solution that wasn't really up to my liking. For example, in Perch, there is perch_custom_content that returns an array with the data which I instantly started hating. Call me lazy, I just don't like how you have to iterate over array within array. You could imagine my shock when I saw Page and PageArray objects working with chained methods and the beautiful one liners you can do with PW. The closest I have experienced to PW somewhere else is with Kirby's own $pages and $page variables that also work much like PW's I think. But, what eventually moved me away from Kirby was discovering PW page and its page tree that just looked like the answer to all my data organization/displaying/retrieving problems. Had never really though about this. My first site with Processwire had to had an ajax and cached Instagram feed. It was implemented horribly, with the libraries in template dir and a php file for ajax right outside site folder, but IT JUST WORKED. No new things to learn, no weird tricks, just plain PHP working as it is intended. I think that's very helpful for people still in the process of learning backend techonolgies, but that can be proficient doing the front end. In Perch they also have a kind of template tags, which I was never really convinced of using.
    1 point
  16. My bad. Would you believe I totally missed that! The 'problem/challenge' with ASM select (to organise the other settings in the backend GUI) is you won't be able to add notes, instructions, etc next to each option (not without a hook), so I see your point @adrian about it not being a better option compared to checkboxes. I agree that this is an admin page so, @adrian, don't spend more time than you should on it . Having said that, a small confession (not a criticism in any way!!!), I get 'bothered' by grid/columns, that don't balance ...In a single table/grid, I like all 'rows' to have the same number of columns if possible. In this case, I would have used collapsible fieldsets, with similar features grouped together under one fieldset, each single featere in its own row. Don't mind me, it's just me being weird. . I spent too much time getting bothered by Menu Builder and Matrix settings not 'balancing'
    1 point
  17. Just a bit of a followup here. Have you tried the stripTags option for the textarea sanitizer? echo $sanitizer->textarea('I <span style="color:red"><3</span> ProcessWire', array('stripTags' => false)); That will allow all tags, including <3 to be submitted. Of course I still think the purifier might be a better/safer option, but thought I'd mention in case you didn't know about it. It's actually not listed on the $sanitizer docs page, but you can see it here in the source code: https://github.com/ryancramerdesign/ProcessWire/blob/b95e36a8d3071139bea5ed72b8b5025b876df976/wire/core/Sanitizer.php#L430
    1 point
  18. PW = Framework + a CMS as a little bonus
    1 point
  19. 1. Relatively easy, yes, as in no harder than dealing with them if you build a full solution from scratch. 2. No, there isn't. A fieldtype for that would need to be tailored to a certain implementation logic. 3. There's nothing specific in the api, no, but if you build a field type for it, you can use all the field selectors together with a few lines of PHP to set headers, etag etc. based on the field value to output an image and hook into the existing logic of pagefile/pageimage to add your db inserts on top of PW's builtin upload logic. 4. You can either use PW's database interface (class Database, which is just a small wrapper around mysqli), use plain PDO or include your own database access class. PW has a few reasons for adding images to pages, one of the being security - if you have $config->pagefileSecure enabled and define access restrictions to a page/template, you implicitly limit access to its files too. Any option to store files completely outside PW's page structure will break that relationship and require you to limit access rights on a per-image basis (or to implement your own permissions logic that checks access rights with the pages the images are used in, meaning you still need to "assign" images to pages somehow). I do understand the wish to provide some kind of "image pool" though - it's, in fact, one of the next things I have to tackle for our company's intranet, as we have a lot of repeating images and documents in the technical manuals section there that need to be kept in sync. I'll probably introduce some kind of "files library" template, add library pages in places in the tree wherever security settings change and extend the pwlink and pwimage plugins for CKEditor to allow easy picking and inline uploading. You'd need to do something similar to be able to pick your external images. As for outputting files/images not stored in the usual location under the page's directory in assets/files, the code for FieldtypeSecureFile (which stores page files outside of the web root) is worth looking at.
    1 point
  20. Thanks for your thoughts @tpr - I am going to take a look at the settings in the next couple of days and clean them up a little. In the meantime, the latest version has some enhancements to the PW Info Panel. In particular, the "Fields List" section has been extended to be "Fields List & Values". It now additionally shows: some key Settings (at the moment just the maxFiles value, but might add some other key ones at some point) the type of value that is returned: object, string, integer, etc the value of the field - which is really nice for easily seeing what properties are available - see the phone_number in the screenshot for a useful example.
    1 point
  21. Hola qué talYou could simple run this textformatter on the textarea that replacw html strings like & and < and > and " get replaced with HTML-safe equivalents. You have smilysupport and much more options to go... https://processwire.com/talk/topic/1542-module-bbcode-text-formatter/ Best regards mr-fan
    1 point
  22. And now have a 0.2 that implements everything from the basic wireMail() plus a few goodies.
    1 point
  23. Just wanted to say that's working for me as well. I'm familiar with the wire( ) syntax but have not noticed wire('all') and wire('*') before. Thanks. Edit: Starting to make some progress with PW3 now. This Namespace FAQ (php.net) is helpful.
    1 point
  24. Nice update, Ryan! My only suggestion would be to change "Publish + Exit" to "Publish + Close" as "Exit" seems a little much, if you know what I mean...
    1 point
  25. // so we only initiate plupload if a form with id fileUploadForm is present on the page // you can change it to look for a class name if you prefer.. var filesUpload = document.getElementById("fileUploadForm"); if (typeof fileUploadForm !== 'undefined') { // this is the part of the form where people can drag and drop files into // if it should be the whole form you can strip the next line and change all dropArea vars to filesUpload var dropArea = document.getElementById("dropArea"); // the next 3 events are only to visualize drag and drop // they're basically just adding/removing the dragOver class to dropArea dropArea.addEventListener('dragover', function(e) { this.classList.add("dragOver"); e.preventDefault(); e.stopPropagation(); }, false); dropArea.addEventListener('dragleave', function(e) { this.classList.remove("dragOver"); e.preventDefault(); e.stopPropagation(); }, false); dropArea.addEventListener("drop", function(e) { this.classList.remove("dragOver"); e.preventDefault(); e.stopPropagation(); }, false); // here we actually initiate pluploader var uploader = new plupload.Uploader({ browse_button: dropArea, // this can be an id of a DOM element or the DOM element itself drop_element: dropArea, url: './', resize: {width: 3000, height: 3000}, headers: { "X-Requested-With": "XMLHttpRequest" // without this Processwire's $config->ajax won't work }, filters: { mime_types : [ { title : "Image files", extensions : "jpg,jpeg,gif,png" }, { title : "Video files", extensions : "mpg,mpeg,mp4,mov,avi,wmv" }, { title : "Zip files", extensions : "zip" } ] }, runtimes: 'html5,flash,silverlight,html4', flash_swf_url: 'plupload/Moxie.swf', required_features: true }); uploader.init(); // here you can show a preview of each file (before actual upload) uploader.bind('FilesAdded', function(up, files) { var html = ''; plupload.each(files, function(file) { /* check file.size, remove if exceeds limit */ html += '<li id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></li>'; }); document.getElementById('fileList').innerHTML += html; uploader.start(); }); // this one handles the actual progress, I'm currently just showing in percents (without progress bar) // but you can use file.percent for whatever you like (e.g. changing the width of an element with it) uploader.bind('UploadProgress', function(up, file) { if(file.percent == 100 && file.status != plupload.DONE) { file.percent = 99; } document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>"; }); // after a file is ready, my PHP script is responding with the pageimage file, so I'm swapping the preview with the response uploader.bind('FileUploaded', function(up, file, result) { // remove upload progress for this file var progressElement = document.getElementById(file.id); progressElement.parentNode.remove(progressElement); // prepend uploaded files to gallery var gallery = document.getElementById('groupGallery'); gallery.insertAdjacentHTML('afterbegin', result.response); }); // error handler.. uploader.bind('Error', function(up, err) { // document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message; console.log("Error #" + err.code + ": " + err.message); }); } So this is exactly what I use right now. Added only a few more comments. Hope it helps to get you started. You can customize plupload for your needs and as far as I remember there is somewhere documentation on how to strip unneded runtimes, like flash or silverlight. But that depends on your needs ;-)
    1 point
  26. Hi pwFoo, I think I have discovered a small part for improvement towards the user. Currently, when a user chooses a username containing umlauts and/or mixed case (like: MötörCode), the first email will display the username as given, since it was sanitized by "text" only. in the next step, the username in the session (which still has umlauts and mixed case chars) will be put inside the username field. If the user now chooses a password and submits, this name will be sanitized by "pageName" - which in the above example will result in "mtrcode". This username is correctly displayed in the second and final E-Mail. Since PW stores username as a page pagename is correct, but I think it should be displayed as such in the first email as well. And I would propose to use sanitizer "pageNameTranslate", since then the above would result in "moetoercode". Regarding the first email, I think FrontendUserRegisterEmailValidation.module line 90: wire('session')->set('registerUsername', $form->fhValue('username', 'text')); changed to wire('session')->set('registerUsername', $form->fhValue('username', 'pageNameTranslate')); would do. For the second part, I've hooked into before save, $fu->addHookBefore('save',function($event){ $event->object->userObj->name = $event->object->form->fhValue('username','pageNameTranslate'); }); but I'm not sure where this would be covered best in the module's process. Let me know what you think, unsure about the "username" part, since maybe it would be of greater flexibility to have a "nickname" field (which can keep up and lowercase and umlauts), independently from the "name" field - but even then "pageNameTranslate" would make for better page names in the backend for umlauterists. EDIT ah, I just re-read the documentation on bitbucket, and in the plugin section I see you have covered the nick name case. Nice! Cheers, Tom
    1 point
  27. A module is needed doing this. How to build a module: http://wiki.processwire.com/index.php/Module_Creation Get informed about hooks here: https://processwire.com/api/hooks/ This one should do the job <?php /** * ProcessWire Module Modify View Url * * @version 100 * @copyright 2016 Christoph Thelen * @author kixe (Christoph Thelen note@qualyweb.com) * */ class ProcessModifyViewUrl extends Process implements Module, ConfigurableModule { static public function getModuleInfo() { return array( 'title' => 'Modify View Url', 'summary' => 'Provide alternative url for the action button \'view\' and the view tab under /page/edit/', 'author' => 'kixe', 'version' => 100, 'singular' => true, 'autoload' => true, 'icon' => 'mail-forward' ); } static public function getDefaultConfig() { return array( 'url' => 'http://example.org' ); } public function __construct() { foreach(self::getDefaultConfig() as $key => $value) { $this->$key = $value; } } public function init() { $this->addHookBefore('ProcessPageEdit::buildFormView', function($event) { $event->arguments(0, $this->url); }); $this->addHookAfter('ProcessPageListActions::getActions', function($event) { $actions = $event->return; $actions['view'] = array( 'cn' => $actions['view']['cn'], 'name' => $actions['view']['name'], 'url' => $this->url ); $event->return = $actions; }); } public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $defaults = self::getDefaultConfig(); $data = array_merge($defaults, $data); $f = wire('modules')->get("InputfieldText"); $f->attr('name+id', 'url'); $f->label = __("Alternative Url"); $f->value = $data['url']; $inputfields->add($f); return $inputfields; } }
    1 point
  28. Yes helper functions like this can be included using a separate php like in the head.inc and used throughout your templates. I extracted this function from a module I have for a project. This module has various helper function and then I load it in the templates. It's much the same as if I would include a php with functions and just personal preference. For example: $helpers = $modules->get("TemplateHelpers"); then use it like this where I need it. echo $helpers->wordLimiter($page->body); I'm not sure what you mean by applying the function to the body. I use this function to create teaser texts that are limited, and show the complete body only on the detail page. Of course you could modify the body output, that every time you do an echo $page->body, it will run it through a function, but I'm not sure this is a good practice. This using a hook on the formatValue of textfields would do it: (directly in template like a include, or by making it a module) function wordLimiter(HookEvent $event){ $field = $event->argumentsByName('field'); if($field->name != 'body') return; $str = $event->return; $limit = 150; $endstr = ' …'; $str = strip_tags($str); if(strlen($str) <= $limit) return; $out = substr($str, 0, $limit); $pos = strrpos($out, " "); if ($pos>0) { $out = substr($out, 0, $pos); } return $event->return = $out .= $endstr; } wire()->addHookAfter("FieldtypeTextarea::formatValue", null, "wordLimiter"); // now this will trigger the above hook echo $page->body; But it's a little cumbersome, as you can't set the limit. Also this strips tags and on HTML text you'll lose formatting. But just to show adn example what is possible. From your post I guess you like to do something like: echo $page->body->limit(150); // not possible It's not possible to do this, because the $page->body, body is just a string and not an object you could add methods to it. But something like the following would be possible using hooks. echo $page->wordLimiter("body", 120); You can use addHook to add a method wordLimiter to page: function wordLimiter(HookEvent $event){ $field = $event->arguments[0]; // first argument $limit = $event->arguments[1]; $endstr = isset($event->arguments[2]) ? $event->arguments[2] : ' …'; $page = $event->object; // the page $str = $page->get($field); $str = strip_tags($str); if(strlen($str) <= $limit) return; $out = substr($str, 0, $limit); $pos = strrpos($out, " "); if ($pos>0) { $out = substr($out, 0, $pos); } return $event->return = $out .= $endstr; } // this will add a custom method to Page object wire()->addHook("Page::wordLimiter", null, "wordLimiter"); // now you can do this echo $page->wordLimiter("body", 100); // or this echo $page->wordLimiter("summary", 100);
    1 point
×
×
  • Create New...