Jump to content

adrian

PW-Moderators
  • Posts

    11,213
  • Joined

  • Last visited

  • Days Won

    373

Everything posted by adrian

  1. Nice little improvement to the ProcessWire Info panel. I have reduced the admin links section down to some basics: Admin Login / Logout Clear Session & Cookies Tracy Debugger Settings. The removed links can now be added as you wish via the "Custom Links" section. This is configurable in the module settings and lets you link to any page in the Page Tree. The two screenshots show the same custom links (with and without labels). You'll notice that I have added links to a few Process modules (Upgrades, Changelog, and Cache Admin), along with the links that used to be available by default, and then another link to "Add Page" and also to a plain page (My Special Page). Personally I am just going to remove many of these for my own setup so it's just down to those I use a lot. For example I will definitely delete the "Fields", "Templates", and "Roles" links because I rarely want to go to those parent pages anyway - I always want to go via the admin submenus to go to a specific template or field, etc. Anyway, hopefully you'll all find this a useful way to add shortcuts to regular admin tools from the frontend of your sites. On a minor technical note, the module settings for these custom links actually converts the page IDs to page paths so that you can use the Module Settings Import Export module to setup Tracy on other sites without having to redefine these links (because page IDs for non admin pages will be different).
  2. I haven't looked at the details here, but I wanted to mention that maybe you should be careful of the $parent_name in array check. Maybe parent->path would be safer. There is always the chance that you could end up with two pages on different branches with the same name. Also, remember that we have $input->url (instead of $_SERVER['REQUEST_URI']). What about this: if(strpos($input->url, page()->parent->path) !== false) throw new Wire404Exception();
  3. adrian

    Hanna Code

    Not sure I have tried to access a function inside a Hanna code before so defining in the code might make sense, or include() 'ing the file. Or in the Hanna code wrap the function definition in a if(function_exists()) wrapper so the function will only be defined once.
  4. adrian

    Hanna Code

    Might be a namespace issue - try calling it with: $summ = \wordLimiter($properties->body); or: $summ = \ProcessWire\wordLimiter($properties->body); Not sure what namespace your _func.php file is in.
  5. Just a quick update to let you all know that: 1) With lots of help from @gmclelland we have been ticking off a lot of PHP 7.2 errors. Not sure that we have discovered them all yet though, so please let me know if you come across any. 2) I just forced the Validator panel to use the HTML5 version all the time. I was finding the other version wasn't working for some sites. Hopefully this won't cause any problems, but please let me know if you find anything amiss.
  6. Firstly, sorry about the number of settings in Tracy - that isn't a sign of your lack of PHP knowledge, but rather a sign of my indecisiveness Really this is up to you. I leave it running - it's not accessible to regular users anyway. In production mode it can send you emails when it logs errors. But if you want you can uncheck the "Enable Tracy" option so there is no load at all from it, although it's not noticeable in production mode anyway.
  7. Actually @alan - I should note that in some instances using the Console panel for this purpose may not achieve what you are looking for. If your template had overridden $user somewhere you might be better off doing bd($user) or bd($user->name) just before that isLoggedin() check so you know you are getting the value that is being used right there in your code. You can do this in your code editor, or you can even do it in the Template Editor panel and use the "Test" button - that way no changes are even made to your template files, so no need to remove debug statements when you're done. Have a read here: https://processwire.com/blog/posts/introducing-tracy-debugger/#template-editor-panel
  8. @theoretic - have you had a look at @Macrura's new module: https://processwire.com/talk/topic/17458-settings-train-module-preview-all-aboard/? Maybe this will take care of your needs?
  9. Sorry if it seems like I am promoting Tracy here, but if you were using her, you could just do this in the Console panel and you'd instantly see if $user is an object and what the name of that user is.
  10. The video fieldtype can do autoplay and loop - take a look at the Mediaelement API (https://github.com/mediaelement/mediaelement/blob/master/docs/api.md). You can also completely replace the video rendering code in the settings of the module with another player if you'd prefer. Not to say that a normal files field isn't fine, the Video fieldtype just makes it easier to manage videos in the backed because it creates images, shows the length of videos, and a few other things. Really depends on your needs as to what will be best.
  11. Or if you want a solution for generating poster images and providing an easy play option, check out: https://github.com/adrianbj/FieldtypeVideo
  12. Any chance this is helpful: https://processwire.com/talk/topic/5658-alpha-release-usergroups-page-based-permissions/
  13. @Livius - welcome to the forums! If it's just one branch per user, then this will do what you need: http://modules.processwire.com/modules/admin-restrict-branch/
  14. http://caniuse.com/#search=mp4 But I am also using http://www.mediaelementjs.com/ as the default player in that module - it has a flash fallback for any browsers that don't support mp4
  15. Absolutely, although you need to consider if there are any resource issues with calling ffmpeg-php's getDimensions() at runtime - are you just processing one video at a time on the frontend? I worry that if you are processing many at a time that this might be an issue. Ideally it would be good to store width/height on upload, but there is no easy place to store these in the PW db structure. In the Video fieldtype module I actually rely on the dimensions of the created thumbnail so it's not an issue.
  16. It is currently designed as a video only fieldtype, but if you want to allow other files as well, it shouldn't be hard to implement that option. As for returning width and height - it determines them and uses them when using ->play() but yes it doesn't make them available via ->width() / ->height(). It would also be a pretty easy addition.
  17. Not meaning to hijack, so maybe any further conversation should be continued in its thread, but what aboutL https://processwire.com/talk/topic/11016-autocontent-generator/ If someone finds a better non-lorum text generator I'd be happy to integrate it into that module. What do you guys think of the approach used in that module vs the manual approach discussed here?
  18. Just add this to Tracy's Console panel: $selector = "template=basic-page, title=Contact 2"; d($pages->find($selector)->each("title")); d($pages->getPageFinder()->find(new Selectors($selector), array('returnQuery' => true))->getQuery(), array('maxLength' => 99999)); I save it as "Selector SQL Generator". This will return the results of the selector in the first dump and the SQL in the second. Let me know if you have any troubles with it.
  19. Which one - the one to generate an SQL query from a PW selector, or the actual SQL query itself?
  20. I haven't been following this closely for a while, but perhaps an SQL query would be helpful? SELECT COUNT(id) FROM `pages` WHERE (pages.templates_id=29) AND (pages.title='My Page') AND (pages.status<1024) GROUP BY pages.id You might find this snippet helpful. It will generate an SQL query from a find selector. I just modified the returned result to be a COUNT instead.
  21. Hi @ukyo - thanks for sharing this, but I must admit I am little confused. I am honestly not really sure what you are trying to achieve - no offense intended - I am probably just missing something here Can you please explain how: <?php $str = "You can visit our <a hre='{pages(1):url}'>{pages:get(1):title}</a>"; echo processString($str); ?> is any better than using the API variables in a string like this: <?php $str = "You can visit our <a hre='{$pages(1)->url}'>{$pages->get(1)->title}</a>"; echo $str; ?> BTW, pages(1) and pages->get(1) are the same thing. The other thing you might want to take a look at is the tag compiler: https://processwire.com/blog/posts/processwire-3.0-alpha-2-and-2.6.22-rc1/#new-module-file-compiler-tags which is not really what you are doing, but it's sort of related.
  22. Just a quick FYI - you can get Tracy's debug bar when logged out two different ways. If you are on a local dev machine, check the "Force Guest Users into Development Mode on Localhost" option. The other way if you are on a live server is to use the User Switcher to logout. Hope that helps you get data you may want while logged out.
  23. Good to hear it's working again. I hope that splitting up of that info across the PW Info panel and this new Request Info panel is proving ok for you. As I mentioned above, I wanted to make the relevant info also appear in the AJAX bar, but didn't want doubling up of links to the PW admin and other things that don't change, hence the need for this change.
  24. Thanks @mel47 - can you please test the latest version and let me know how it goes for you?
  25. Thanks @mel47 - that explains it - it's because you are running your site in a subdirectory: /24h/ Could you please confirm that: d($urls->root); in the Tracy Console panel returns: /24h/ Once I know that I'll be able to fix this.
×
×
  • Create New...