Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by bernhard

  1. totally agree! right now it sometimes seems that the interest is measured by "who shouts loudest"... but we had several examples where users didn't show their interest because the feature has been on the roadmap for a while so nobody said anything about it and waited for a surprise in the next blogpost. just if it was requested this is great example of what robin is talking about. informations about upcoming features are spread over the forum (wishlist) and github... so i want to support robins request and maybe extend it a little bit towards "better community management". we had one occasion where @ryan implemented something that was already available as a module (image tagging). don't get me wrong, of course i prefer solid solutions built into the core over 3rd party modules (i was voting for the predefined-crop-in-the-core-feature for a long time), but i would love to see a little more discussion and community involvment here. i can imagine that this can eat up a lot of time if done wrong - but i think it can also save time if done right. for example the community could do some research (like in the github link above), bring in ideas or point ryan to already existing solutions like it was the case with image tagging. finally i want to thank everybody contributing to this project and helping me out in the forum. i had a great 2017 and it would not have been possible without this awesome product and community! happy and successful 2018 to everybody
  2. @SamC don't know if you just put a quick example here but in your case the checker class does not do anything more then the valitron class so it is nice for testing but actually quite useless do i miss anything? btw: I don't know valitron, I only used https://doc.nette.org/en/2.4/forms#toc-standalone-forms since this is the only library I know that does client-side and server-side validaton in one go. maybe you want to have a look...
  3. one way (maybe the best?) is to extend the class: https://stackoverflow.com/a/8089092/6370411 another way is to store the other class as property of your new class: <?php class Checker { private $validator; public function __construct($validator) { $this->validator = $validator; } public function doSomethingWithValidator($name) { return $this->validator->errors($name); } } require_once('Yourvalidator.php'); $validator = new Yourvalidator(); $checker = new Checker($validator); $checker->doSomethingWithValidator($input->post->name);
  4. that's why you should start playing around with classes <?php class Formchecker { public $errors = []; public function checkemail($email) { if(!$email) { // or any other great check $this->errors[] = 'Please provide an email'; return false; } return true; } public function checkname($name) { if(!$name) { // or any other great check $this->errors[] = 'Please provide a name'; return false; } return true; } } $checker = new Formchecker(); $mail = $checker->checkemail($input->post->email); $name = $checker->checkname($input->post->name); // if($mail AND $name) { if(!count($checker->errors)) { // create new page and send email } else { echo 'Please correct the following...<br>'; foreach($checker->errors as $error) echo "$error<br>"; }
  5. sorry, took the wrong code snippet, but totally agree on that
  6. maybe something like this? // early exits if(!$input->post('register')) return; if(!$session->CSRF->hasValidToken()) { header("Status: 401", true, 401); return; } // define variables $errors = []; $regEmail = $input->post->email( 'regEmail' ); // check for errors if(!$input->post->text('g-recaptcha-response')) $errors[] = "Invalid Captcha response."; if( $users->get( "email=$regEmail" )->id ) $errors[] = "You cannot register more than one account with the same email address."; // return error-array or true if(count($errors)) return $errors return true; nice read @FrancisChung reminds me a little bit of this section in my new kickstart installer: https://gitlab.com/baumrock/kickstart/blob/master/kickstart.php#L139-146 Maybe I'm just too lazy for learning new things but I don't really think that the pipeline is that much better than using ifs and separate methods in a regular class...
  7. Thanks kongondo and robin, I also thought the hook was wrong and learned something from the docs @adrian maybe for the hook recorder it would be possible to see somehow if the hook is one that actually does anything (so before and after do matter) or that does nothing (like saveReady. Just thinking loud - no idea how complicated that would be. Don't think it would really be important - but if it was easy it could be a nice addition. @joe_g don't know what could be the problem (dates are always confusing), but maybe the execution of the hook fails sometimes because you get a php error (like cannot call property of undefined etc...). maybe you can install tracy and make sure you define your email adress then tracy will send you all errors that occur on your site. maybe you can also find some helpful information in your site's error logs.
  8. Hm... thanks for that hint. I'm not sure if I like the idea of adding a password. It would break the functionality - at least I would have to put in more work. I didn't think of password protecting it, because that's the same with the regular installer (it is also visible to the public as long as the installation did not finish). The only difference at PW Kickstart is that it enables you uploading files, that's true... But still i don't think that it is necessary to password protect the directory. The goal of this installer to make the process of creating new pw websites as easy and as fast as possible and to eliminate all of the repetitive tasks that one has to do on every new pw installation. Ok I just got an idea: The downloader at baumrock.com/kickstart.php actually grabs the file from the gitlab repo and replaces the namespace ProcessWire on the first line with namespace Kickstart. This is do make sure the installer works both as an installer and as a helper for the Recipe Processmodule. I could easily add some lines of code to that service that adds the IP of the requesting client to the kickstart.php file and blocks all requests that do not come from that IP. What do you guys think?
  9. nope, this was a pr for another thing and is already merged
  10. Seems that this pub is a little boring But I can live with the <ironic> tags
  11. DEPRECATED - USE ROCKMIGRATIONS INSTEAD I'm very happy to share my newest module called "ProcessWire Kickstart" that I developed during the holidays Maybe some of you already saw the preview thread about this... What it does: This module makes it possible to install ProcessWire in a fully automated process. You can define all necessary settings in one single php file and you can even define "recipes" that get executed after installation. This means you can install modules, adopt settings and do whatever you want with your new site using the PW API (like creating pages and so on). You could also place a kind of frontend boilerplate on your git account and grab that after installation and place it in your templates folder. I ran out of time so maybe someone could try that out and show how he did it Additional to that there is a ProcessModule to install in your ProcessWire admin which makes creating and testing recipes super easy. Note: Alpha realese until this module gets some more testing. Please be careful with this tool since it does some heavy file system manipulations (unzipping, moving and DELETING whole directories...). Use at your own risk. Usage: Just grab a copy of the kickstarter, place it on your server, visit yournewsite.com/kickstart.php, adjust settings (like username+password) as needed and hit "install". If your mysql user does not have the rights to create a new database then you have to create a database before running the installer! Download: via SSH: cd /var/www/yournewsitedirectory wget baumrock.com/kickstart.php // or using curl curl baumrock.com/kickstart.php -L --output kickstart.php Manually: Klick baumrock.com/kickstart.php and upload the file to your server Note: baumrock.com/kickstart.php returns the current master file from the gitlab repo and changes the namespace of the script so that it can install itself via recipe. If you don't need to install the kickstart processmodule via recipe you could also download the kickstart.php file from gitlab. Screenshots/Walkthrough: The initial Screen: You can either upload a file via the left panel or take my example file from the gitlab repo: This way you can create your own kickstartfiles and host it on your own accounts. When the file is loaded you can easily edit all necessary informations, like username, password and the url where to grab ProcessWire from. I just tried it with an old version as well... 2.7 worked just fine (having the old installer that recently was updated) but an ancient 2.2.4 version failed. I don't think anybody will ever need to install lots of old versions of pw with this tool but I wanted to mention it here. Hit "install" and lean back - on my VPS it takes 15 seconds to install my very own custom version of processwire with all modules that i need After logging into your admin you'll see that all modules from your recipe are installed: Recipe Editor: As recipes are executed after processwire was installed you have all your API magic available there. Running this scripts is only possible inside of a working processwire installation, so I created a module to help you with that task. See the comments of the sample recipe for more information! I hope this tool helps you to save lots of time and create lots of awesome ProcessWire websites I would be happy to see how you use this and please share useful recipes here in the thread so that everybody can profit. Maybe you just want to throw in an idea what could be done (for example I can imagine a recipe that checks file permissions on the system after installation)... Some parts of the code and maybe also part of the idea are taken from @Soma 's old and still great online installer, thx for that!
  12. If you haven't heard about it yet you should read about these new vulnerabilities that affect almost any computer built since 1995 https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability) https://en.wikipedia.org/wiki/Spectre_(security_vulnerability) https://insights.ubuntu.com/2018/01/04/ubuntu-updates-for-the-meltdown-spectre-vulnerabilities/
  13. Nice idea! I have no need for it, but if i had, it would be great to have such a feature! And I can think of lots of usecases where someone could need this... [offtopic] I'm out
  14. thanks @SamC that brings some light into the dark of customizing the admin, at least for me can you please elaborate how you created this theme's less file? did you just copy&paste&modify it from the original theme? I haven't had a look into the theme's less yet, but regarding the template designer module i have some nice news: I'm just working on the PW Kickstart module and creating a processmodule which makes it very easy to modify the code of the recipes and run it. That's a perfect fit for modifying LESS files of your theme, compile them on save and instantly show the new theme. I'll try to put something together in the next few days with the help of your tutorial
  15. still i find chromes search shortcuts the best option - at least if you know where you want to search for your term... custom search for "custom admin"... lots of annoying ads (yes, i know you can "turn them off"...) search "pw custom admin" and finally searching in the blog: "blog custom admin" But maybe for newcomers such a search can be helpful (though I think someone already built one some time ago...)
  16. hi @owzim me again with a more important request i opened a PR on github to trigger an "loaded" event after acefy() is done. would be great to include this in your module, thanks
  17. hi @owzim i want to include your module in my kickstart module and found this issue on the uikit admin theme (full width font size input), would be great to get a fix for it thanks
  18. Ok just checked ASM inside an ajax loaded repeater with ajax loaded repeater items and this also works. Thanks for your example. That makes sense... Shouldn't it be possible to hook the buildForm method, check for your field and add scripts depending on the field settings there? A little This works: $wire->addHookAfter('ProcessPageEdit::buildForm', function($event) { $form = $event->arguments(0); foreach($form->fields as $field) { if($field->name != 'testasm') continue; if($field->inputfield == 'InputfieldAsmSelect') $this->config->scripts->add('/site/templates/scripts/alert.js'); else $this->config->scripts->add('/site/templates/scripts/otheralert.js'); } }); But I agree it would be nice to have this built into the inputfield somehow...
  19. true... though I had no problem with that so far and I can't really imagine a situation where this would be a problem? do you have an example? regarding the initial question: just tried an ASM loaded by ajax on a fresh DEV and it worked without any issues.
  20. Don't know about the core Inputfields but this can easily be done by adding scripts in the init() method of the module, not the render method.
  21. Credits to Ryan - I didn't know about that detail and he added it to the blogpost while proofreading it Sorry I think I misunderstood you try $headline = 'Happy ' . date('Y'); $this->headline($headline); $this->wire('processBrowserTitle', $headline);
  22. bernhard

    Fields

    There are several links inside this thread. Using google to search the forum works really well, see the link in my signature
×
×
  • Create New...