Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/18/2018 in Posts

  1. https://github.com/thuijzer/processwire-FieldtypeBusinessHours Fieldtype Business Hours ProcessWire Fieldtype for entering business hours (opening hours) Input format Leave a day empty when closed on that day Times are in 24 hour format. 9:00-12:00 9:00-12:00, 13:00-17:30 16:00-2:00 Usage in templates Days are from 1 to 7 where 1 is Monday and 7 is Sunday (ISO-8601) echo $page->field_name->isNowOpen() ? 'Now open' : 'Now closed'; if($page->field_name[1] == null) { echo 'Closed on Monday'; } if($page->field_name[2]->inRange('11:00')) { echo 'Tuesday at 11:00 open'; } echo $page->field_name[1]; echo $page->field_name[1]->getEntries()->getFrom()->format('H:i');
    11 points
  2. hi thuijzer, would you mind adding a screenshot to get an instant first impression of how it looks like?
    3 points
  3. I am highly interested to see how in term of code you manage this. Did you hardcoded the login name in a hook or something like that ? As you say that you are monitoring a login for a specific username, you could prevent a login by hiding deeper the admin by naming the page with something complex you only know, eg. an url based on a HASH.
    3 points
  4. Just in case you guys haven't come across it, I have been using https://www.gitkraken.com/ but maybe I should give Tower a go one of these days.
    2 points
  5. great idea, thx! needed that several times and maxLength=>... was a pain would it be hard to have the shortcut bdb() for bd($page, [6,999]) ? i think it would totally be fine to have that shortcut with fixed values since we have the other option of defining it manually like you showed above. but i think in 99% of the cases the bdb() would work just well and it is less to write and a lot easier to remember
    2 points
  6. +1 for Tower! Switched away from Sourcetree because it requires an account now. For now, Tower/Sourcetree/... are easier for me to handle all kinds of git-things apart from simple commit/push/pull like for example: rebase, stash, squash, ... and it is visually nice. I also use vs code. It is still nice to browse diffs in it or just to have a convenient second place to commit/push.
    2 points
  7. Stoked about the new documentation site! I love it even more with the text size zoomed to 125% In due course it would be great to add a section about barDumpLive() / bdl() - I've never been clear on when it's okay to use this and when it should be avoided due to the dumped variable getting mixed up. I use it from time to time and when there is a variable mix-up it's usually pretty obvious, in which case I switch to bd() with max depth and max length options included. Although I still worry there might be situations where the mix-up is more subtle and could lead to confusion. Related to this: what do you think about adding a new shortcut method for "big" bardumps? This could have options in the module config for max depth and max length. Just so there's a quick way to do a bardump where you need greater nesting depth and string length than with the standard bd(). I have added a custom shortcut in my IDE for inserting a bd() with max depth and length options, but it would be cool to have something like a "bdb()" method in Tracy (until the barDumpLive thing is resolved anyway).
    2 points
  8. Hi everyone, This new video fieldtype extends FieldtypeFile. Video is available via: $page->video_field->url Module automatically creates a poster image of the video on upload and makes this available via: $page->video_field->poster Shows the duration of the video on the title bar, next to the filesize Stores SRT files for subtitles accessed via: $page->video_field->subtitles Formats a transcript from the subtitles, accessed via: $page->video_field->transcript I am using mediaelementjs to display the videos, so editing users can easily upload videos and enter SRT files. The following code is used in the template file. You can adjust this if you'd prefer using VideoJS or some other HTML5 player. <video src='{$page->video_field->eq(1)->url}' poster='{$page->video_field->eq(1)->poster}' width='720' height='408' ><track kind='subtitles' src='{$page->video_field->eq(1)->subtitles}' srclang='en' /></video> Additional Settings You can additionally set a few different options in the field's Input tab: Number of poster images to generate - if you change from the default of 1, the editing user will be able to select which image they want to use for the poster image Copy poster image to dedicated image field - not necessary but gives you more options of interacting with the poster image(s) Field that you want poster images copied into - only relevant if the option above is checked Try it out (NB: the code is rough - it works, but needs cleaning up. Github: https://github.com/adrianbj/FieldtypeVideo NB: Requirements The module requires ffmpeg and ffmpeg-php, although I can make the latter optional fairly easily. I don't have any requirement checking implemented yet, so if you don't have these, you'll get php errors. Possible future enhancements Ability to specify what frame is used for the poster - either by number, and/or by offering several options to choose from Done! Push poster image to a dedicated image field Done, although could be improved Field for pasting in or uploading closed captions Done, but need to look into multi-language options etc Support for uploading multiple formats of the same video (mp4, webm, etc) and/or automated video format conversion Integrate mediaelementjs into the module so users can enter shortcodes in RTE fields to display videos where they want My biggest concern, is how useful this will be to people - how many hosts actually have ffmpeg setup? Do any have ffmpeg-php? Anyone have any ideas for features they'd like to see?
    1 point
  9. It's the WireData::and() method. Was a new one to me too.
    1 point
  10. Thank you Robin - will try asap! [ot]At the moment i'm a little but lethal snuffy...and could not think clearly (i think it is deadly man-flu). So don't think i'm to lazy to search a solution...i'm not...i've read your code and it was clear for me that my question was silly...i'm just standing a little beside me but i think that the peak of my desease is done. [/ot] Best regards mr-fan
    1 point
  11. You can search for the text string that makes up the start of the tag (to allow for varying attributes). // Get fields with TextformatterHannaCode applied $hanna_fields = array(); foreach($fields as $field) if(is_array($field->textformatters) && in_array('TextformatterHannaCode', $field->textformatters)) $hanna_fields[] = $field->name; // Implode for use in selector string $hanna_fields = implode('|', $hanna_fields); // Find pages with a given Hanna tag $has_hanna = $pages->find("$hanna_fields*=[[your_tag");
    1 point
  12. Hi anyway, I think I read your post in the other thread but didn't get your point. The problem you are describing here is not processwire specific - it's a general problem related to touch and non touch devices. you can find some possibilities here (and in the linked thread):
    1 point
  13. So I've been monitoring one of my sites' login sessions and noticed visits to the backend login page. While I believe having the session throttle module installed does its' magic, I was still concerned about any login attempts. So I decided to create add a honey pot into the admin login process since no one should be trying to login except me under a specific username. Before even the session login occurs in the module, if the username doesn't match, it Logs the attempt Saves the ip to a list on an admin page Redirects the user to the 404 page Site immediately checks if ip address exists in the banned list. Throws error on all pages thereafter for that ip address. This may be going a bit overboard but after seeing constant visits to the backend login page that I believe only I should be visiting, it peaked interest as to what ways I could further protect the back end. As long as I'm careful not to ban myself, should take care of those attempts. I know I may have a chance of banning an IP shared by many such as a cafe or cell phone network, let alone having ips cycle around, but we'll see how it goes. Anyone else have any thoughts on methods of protecting the backend of processwire? (Aside from https://processwire.com/docs/security/admin/)
    1 point
  14. It's nothing fancy, but I currently don't have it tied to a hook yet. It's a scrap job as I was just exploring ideas to monitor login attempts to the backend. I've placed it where the login occurs for the backend in the \wire\modules\Process\ProcessLogin\ProcessLogin.module if($name != "admin" // Or whatever username){ // Log Attempt $this->wire('log')->save('attempts', long2ip($this->wire('session')->getIP(true)).':'.$name.':'.$pass); // Get Honeypot Page that contains textarea of banned ips $honeypot = $this->pages->get("/processwire/honeypot/"); // Get IP Address $ip = long2ip($this->wire('session')->getIP(true)); // Concatenate to textarea and Save Page $honeypot->of(false); $honeypot->banned = ($honeypot->banned != "")?($honeypot->banned.','.$ip):($ip);; $honeypot->save(); $honeypot->of(true); // Redirect to 404 $this->wire('session')->redirect('/404/'); } // The rest of the login occurs below: if($this->wire('session')->login($name, $pass)) { //.... } I'm sure you can hook it before the session login but I didn't bother looking into it so I'm going to just leave it in the process module for now and see what gets captured. It might just be google previewing the url before I visit it or something. We'll see.
    1 point
  15. It looks like you never specify the name of the Options field. You probably want: foreach($page->children as $item) { foreach($item->optionsfield as $option) { echo '<p>'.$option.'</p>'; } }
    1 point
  16. Like @Klenkes said. I'm usually quite strict about template relationships and establish them both ways. After that when you try to move a page out of where it's supposed to be, PW complains.
    1 point
  17. If you set the correct family settings to the parent and child template, then the children can only be placed as a child of template for pageA, pageB, pageC, ... but as I read your post again... I guess you don't want them to change parents as well?
    1 point
  18. What kind of cache are you talking about? Some released this module a while ago:
    1 point
  19. Good solution, thanks.
    1 point
  20. Taken care of that here - will push with the next update. Agreed - it will be in there with details and warnings. I am sure if it will ever be 100% reliable because of the way it works, but from my experience it only ever seems to be an problem when used within hooks. I see two possibilities here : a bdb() with some config settings to determine what the depth and length will be - I think the defaults should probably be 6 and 999 - any thoughts? or a simplified syntax for bd(), eg bd($page, [6, 999]) so you don't have to do bd($page, ['maxDepth' => 6, 'maxLength' => 999]) which is painful The problem with a fixed dbd() is that in the case of PW objects, anything more than 6 can results in out of memory errors (at least with my dev machine setup), but working with smaller objects/arrays, I often want 6 or 7. I have decided to go with this for now, which sets the maxDepth to 6. Obviously pre PHP 5.4 you will still need: array(6) bd($page, [6]); You still need to make the depth and length settings an array - this is because the second argument in the array can either be the "title" or the options array. It's get too confusing to take it any further away from that default. You can also do: bd($page, [6,999]); or: bd($page, 'Dump Title', [6,999]); How does that look to you? I'll post this to the closed beta version shortly.
    1 point
  21. I use Atlassians' Sourcetree if people wanted an alternative. https://www.sourcetreeapp.com/
    1 point
  22. As a quick patch this fixes the error: Change this: $a[trim($cropItems[1])] = trim($cropItems[0]); To this: if(count($cropItems) > 1){ $a[trim($cropItems[1])] = trim($cropItems[0]); }
    1 point
  23. New dedicated documentation website is up at https://adrianbj.github.io/TracyDebugger It's very early days still, but finally there is a home for doing a good job on the docs. It's easy to navigate with a top navbar and sidebar menu and a search term option. Once I get the key Debug Bar and Configuration settings added, I really want to do a good job on the "Tips" section because I there are a lot of users out there who are a little lost on all the things that can be achieved. Hopefully lots of updates coming in the next few days! PS - if you're more artistic than I am and you hate the logo, please let me know
    1 point
  24. In the upcoming 1.7.4 version there will be a new tweak for the Logs page. The helpers field on top can be expanded by default, and the select box of Actions replaced with radios. I don't really get why the actions are in a select, radios are easier to use. I've requested this change in the core on GitHub (and got a few likes there too) but so far there's no response.
    1 point
  25. Sorry, I totally missed it ! Will try to find the time asap
    1 point
  26. Making future website upgrades more error prone and time consuming, I agree. I don't have this feeling. One of the things I like most about PW is that I don't really have to care about updates. But I agree that it would be better to have less new features pushed out every week and have a little more conversation upfront to make the result as good as possible. Yes, we should get more organized somehow. yep, my vote for better community managment here I'd be happy to help in this regard as much as I can.
    1 point
  27. I would like to add something else to this already great discussion, and this is about the rate of new features and changes introduced in ProcessWire. While the last few year's new features are impressive, they keep introducing so many minor issues that – while they are truly minor – they have already accumulated to the point where I cannot see how each of them will get sorted out in the future. Leaving these issues behind in the dust will make ProcessWire less robust in the long run. Do not get me wrong, I do no think ProcessWire is in any sort of trouble just yet but recently I stopped updating to new dev versions fearing that I might break a site. The last stable is v3.0.62 from May 5, 2017. I would love to see a feature freeze so that a new stable and somewhat tested version can be released.
    1 point
  28. Hi guys, here is our most recent website http://patina-store.de/ Patina is a really nice vintage objects and furniture store here in Wuppertal. Pay a visit if you pass by We are aware of some flickering and strange scrolling (seems to happen with Safari on desktop and iOS) on the homepage initial transition. I'm looking into it, but if you guys could report how it's behaving with you, it would be a great help! A point of interest is the Lookbook page. For this we used the Image Marker module by @kongondo and @heldercervantes, which worked flawlessly. Thanks guys! Although the site is very simple, PW has a very important role, since we transitioned all the shop organization (mainly the products) from excel spreadsheets to it. We could say PW is acting as a small CRM, and Lister Pro is doing a great job at it.
    1 point
  29. If you're interested in running ProcessWire using PHP's built in Webserver this one's for you: <?php /***************************************************************************** * Router script for emulating Apache's "mod_rewrite" functionality. * This router script is designed for testing ProcessWire instances quickly. * Don't use this script and/or PHP's built in Webserver in production. * * Usage: php -S localhost:8000 -t /ProcessWire /ProcessWire/routing.php *****************************************************************************/ $uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); if ($uri !== '/' && file_exists(__DIR__ . $uri)) return false; $_GET['it'] = $uri; // emulate index.php?it=$1 require_once __DIR__.'/index.php'; Enjoy!
    1 point
×
×
  • Create New...