Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/01/2018 in all areas

  1. For once, a joke about programming that actually made me laugh.
    11 points
  2. Hello, to identify current page at admin side, there is problem using hooks inside "Page::render" process. There is option to use "wire('input')" to get current page and it's properties (id, template...). All that can be done inside simple module, but also inside site/ready.php (need to create ready.php). Here is example of module (CustomScripts.module) <?php namespace ProcessWire; // CustomScripts.module class CustomScripts extends WireData implements Module{ public static function getModuleInfo(){ return array( 'title' => 'CustomScripts', 'version' => 1, 'summary' => 'Module to append custom CSS and/or JS files inside admin pages.', 'singular' => true, 'autoload' => true ); } public function ready(){ // check if admin side if ($this->wire('page')->template == 'admin') { // check if it is page (and not admin page list etc.) if (!is_null($this->wire('input')->id)) { // get page object $page = $this->wire('pages')->get($this->wire('input')->id); // check if it is a page with desired template if (!($page instanceof NullPage) && $page->template->name == 'basic-page') { // check if current user has desired role if ($this->wire('user')->hasRole('superuser')) { // all checks are ok, now we can append desired stylesheet $this->wire('config')->styles->add($this->wire('config')->urls->templates . "styles/my_custom.css"); } } } } } } If you don't want to use module, take part from ready() method and place it inside ready.php (but without $this->). Third option can be to do "fake invisible inputfield" and with that get more "power" (options)... "place field on desired templates, set desired CSS, JS files, set permissions, etc." Regards. EDIT: added one more check inside if statement !($page instanceof NullPage)
    3 points
  3. 50% off for the next 38 hours. I'm on my 3rd year now with JetBrains but it's the first time I've seen them gone on sale. Best value for buck IMHO in the market for dev tools, especially if you use a variety of languages and environments. https://www.jetbrains.com/store/?fromMenu#edition=personal
    2 points
  4. Interesting, I use it very rarely. I remember using it only once when I copied many badly formatted articles with random title cases, and it was a great help. I've modified this feature so it works now on text(language) fields and file/image description fields as well, even after uploading new items. Plus it works with ajax loaded fields and repeaters too. It's also new that on case change an input change is also triggered so you'll get a confirmation alert to save on leaving the page. I've also fixed some positioning issues, eg with expanded language tabs. I'll upload the new version tomorrow if everything goes well.
    2 points
  5. If I understand right you want to get all the pages that are selected in a given Page Reference field, site-wide. To do this efficiently you do need to use a SQL query - Ryan has shared a code snippet:
    2 points
  6. You can use AdminOnSteroids to load a CSS. The module adds classes to the body, eg user-john, ProcessPageEdit-template-basic-page, role-superuser so you can add rules to target a specific page and user, eg body.user-john.ProcessPageEdit-template-basic-page p { color: red; }.
    2 points
  7. Hi Steve, Thanks for the suggestion. I have added it to the just released version. Please let me know if you have any issues with it. PS - I am curious what you are using this panel for - I haven't had much feedback on it thus far.
    2 points
  8. Hi all, I've had a request from a client (that I built a multi language PW site for) to change the text colours in the language tabs when they are not completed. Essentially they were having difficulty detecting which languages had content and which didn't when scanning the page in admin. Now I know this means changing Admin template files which I hate doing but the client was insistent. Looking through I found this in the module CSS and changed the colour for empty content to red thus: wire/modules/LanguageSupport/LanguageTabs.css - line 61 .langTabEmpty a { opacity: 0.7; font-weight: normal !important; color: #ff0000 !important; /* I changed the colour here */ } Now we get this when editing, the red indicating no translated text has been added: I think is a better UX. However, when adding alt text to images in an image field the same CSS colour change doesn't apply. Looking at the CSS the .langTabEmpty class isn't added to these tabs on the image field. Could this be considered as an improvement at next module upgrade time please? Thanks as always!
    1 point
  9. Ok, now the tables render correctly with Github's MD parser. Take a look and let me know if you have any suggestions.
    1 point
  10. Except I didn't check the output in Github - I was using another Markdown editor which was rendering the tables correctly, but Github isn't - working on fixing it now.
    1 point
  11. @adrian That's more like it! Thank you.
    1 point
  12. Agreed, that does look nice. I have committed a new version with the following changes. Now we just need to get people using it more regularly ? Each section is structured as a table and with the Server Details not collapsed. The plain text version is basically the same, just with section titles added for clarity. SERVER DETAILS ProcessWire: 3.0.108 PHP: 7.2.6 Webserver: Apache/2.4.33 (Unix) MySQL: 8.0.11 SERVER SETTINGS allow_url_fopen: 1 max_execution_time: 120 (changeable) max_input_nesting_level: 64 max_input_time: 60 max_input_vars: 1000 memory_limit: 128M post_max_size: 8M upload_max_filesize: 50M xdebug: xdebug.max_nesting_level: GD: bundled (2.1.0 compatible) GIF: 1 JPG: 1 PNG: 1 EXIF Support: 1 FreeType: 1 Imagick Extension: MODULE DETAILS AdminOnSteroids: 1.9.8 BatchChildEditor: 1.8.12 BreadcrumbDropdowns: 0.1.0 CookieManagementBanner: 0.2.1 FieldtypeStreetAddress: 0.5.1 FormBuilder: 0.3.4 InputfieldFormBuilderFile: 0.0.2 InputfieldStreetAddress: 0.5.1 JquerySelectize: 1.0.4 MarkupSEO: 0.8.7 MarkupSitemap: 0.4.1 ModuleReleaseNotes: 0.10.7 ModuleSettingsImportExport: 0.2.9 PageRenameOptions: 1.0.4 ProcessAdminActions: 0.6.12 ProcessChildrenCsvExport: 1.7.0 ProcessFormBuilder: 0.3.4 ProcessWireUpgrade: 0.0.7 ProcessWireUpgradeCheck: 0.0.7 RestrictTabView: 1.1.3 TextformatterTagParser: 2.2.0 TracyDebugger: 4.10.25
    1 point
  13. Personally, I think a table would really help the clarity of the server details. | Server | Version | | ------:|:------- | | PW | $pw_version | | PHP | $php_version | | ... Edited to add: At least to my eye, it's hard to tell that the "Server Details", "Server Settings" and "Module Details" lines are actually click targets that open up a hidden list. Yeah, I know there are triangle markers as visual clues, but I mistook those simply as list-item markers the first couple of times I saw these in issues. I'm more used to click targets being styled as links or saying something like (more...) or something like that.
    1 point
  14. I think that makes most sense. Just like this or do you think that a table layout would help with clarity?
    1 point
  15. @adrian Fantastic! Thank-you, that works great. Regarding the "Lite" reporting button idea; I'd gather a few more opinions on this before doing anything. For example, another alternative is to just keep the existing button but make the basics a non-collapsed table with all the additional details in the collapsed sections following it. That would make the basics stand out pretty well in the issue reports.
    1 point
  16. Check out the latest version - I think it works pretty nicely! Happy to implement, but not sure the best interface - are you thinking about maybe splitting the the button into two: 1) Copy Simple for Github 2) Copy Detailed for Github Or do you have other ideas?
    1 point
  17. Hi @tpr - as always thanks for this module. I wanted to add a feature request, which is to make the case changer something that could be used on other text fields (not sure how feasible that is); using that one a lot and is really helpful; i hacked my own 'other field' usage for the moment.. (using AdminCustomFiles)
    1 point
  18. Everything looks good. Please can you try the following code snippets in a template file: $imgPath = $config->paths->files . '1/animated.gif'; // add the full path to an original animated gif here!! $ii = new ImageInspector(); $info = $ii->inspect($imgPath, true); var_dump($info); $is = new ImageSizer($imgPath); var_dump($is->getEngines()); $shortInfo = $is->getImageInfo(); var_dump($shortInfo); and check the output? The first var_dump() should have a true under "info"->"animated", and the second one only should have one array item named "ImageSizerEngineAnimatedGif". If this is the case, we need to check further.
    1 point
  19. @adrian Thanks, that's fixed it, and nothing lost. While you have this feature in your working memory, another request: could you have the config scroll to the custom PHP field if it were changed on the last save? That would allow a smoother flow of iterations using the field, and shouldn't interfere with anyone else's use of the config area. That would be the icing on the cake, but I'm totally happy with the cake the way it is at the moment ? --- With regard to the Version List functionality, if anything, I think a "lite" version for initial reporting of just the PW, PHP, Webserver & MySQL versions as a markdown table would be useful. One thing that's struck me reading through the issues is that clarity matters. I really like the comprehensive data you've made available with the existing feature - but I completely missed the data, tucked away at the bottom of a couple of issues. It was only when I found the feature in Tracy that I had a lightbulb moment and realised that's where those three lines in the issue reports came from. (I like to follow the KISBIS rule where possible: Keep It Simple, Because I'm Stupid)
    1 point
  20. Ar the fields set to save single pages?
    1 point
  21. Glad you found the "Version's List" functionality - pretty handy isn't it ? Let me know if you think of any other info that should be added to it. Sorry about the code saving bug - hope you didn't lose too much! It is fixed in the latest commit.
    1 point
  22. Here it's possible find the Italian version: https://github.com/MarcooRo/IT-it-processwire (If need I can add the zip file here.) I have also translated some moduels like the languagesupport module. I miss only two modules to translate, if not need now I'll do them in September. They are the comment module and AdminThemeUiKit. I think to have translate all files, but If I miss something let me know. Cheers!
    1 point
  23. @adrian Thanks for the update - just tried it - but the value of the field no longer seems to save. Whatever I enter into the custom PHP code editor is lost on submit of the module settings.
    1 point
  24. Good to know I'm on the right track... and it's doing what I need ? I think I definitely need to learn more about having output formatting though... always confuses me.
    1 point
  25. I agree that the description is a bit ambiguous, I've been also wondering how to properly interpret it but I came to a similar conclusion, ie. this option is for "front-end API calls only" meaning where output formatting is ON by default: Quote: "pages on the front-end of your site always have output formatting on, unless you've turned it off, with $page->of(false)." Output formatting is always off in a module by default, and the explanation in your screenshot has examples with $page and not $this->page. Also, it is talking about front-end API access checks only. As a result, if it does not affect backend (ie. admin) access checks, then you can use this option for what you are describing, At least I use it that way too ? However, maybe others can put together a better explanation than this one of mine ?
    1 point
  26. Well, one is an IDE and the other is a code editor .... it's like comparing apples & oranges ...
    1 point
  27. @adrian Thank you. I was putting together a version-gathering script to collect the data to paste, as Markdown, into GitHub issues - then guess what I found elsewhere in TD ?
    1 point
  28. Hi @prestoav have you considered opening this as an issue, either of consistency in the processwire-issues repository, or a feature request on the processwire-requests repository?
    1 point
  29. @teppo and @LostKobrakai Thanks for the pointers, that helps clarify things for me. I was under the mistaken impression that anyone adding a comment to a closed issue re-opened it. @gmclelland Ouch - let's hope we never reach those dizzy heights. @matjazp Thank you. Many thanks to everyone who responded to my promptings via github or PM here on the forum - really happy to see there have been 51 fixed or duplicate issues closed in the last week. We're still awaiting resolution on about another 15 that I've posted on, but I hope some of those will be closed this week. I've been working through some older issues, trying to reproduce them - and I think that we can all help Ryan by trying to do describe the reproduction pathway as clearly as possible (there are issues that are somewhat ambiguous,) and considering if a little screen capture might help. Also, Tracy has a feature that allows versions, modules and the like all to be dumped in a Markdown-friendly format that can be pasted right into issue reports. Once the "Copy for Github" button has been pressed, you can simply paste it in at the end of your issue report. Very helpful - and I only found out about it yesterday ?.
    1 point
  30. @netcarver, re-opening issues depends on who closed them. Here's the key part, borrowed from this StackOverflow answer: you can re-open your own issues *if you closed them yourself. you cannot close or re-open issues opened by someone else. you cannot re-open your own issues if a repo collaborator closed them Also: thanks for your work there – the issues repository is looking much better already ?
    1 point
  31. Steve, I would like to thank you for your effort on closing stale issues and especially bringing back to life (and to Ryan's attention) those forgotten, but still valid issues, affecting multiple people. Keep up good work!
    1 point
  32. Hi @adrian A feature request for your consideration: please could you apply the lovely code editor to the custom PHP textarea in the module settings? Would make editing custom PHP much easier. Many thanks for your consideration! Steve
    1 point
  33. Actually over five years old, but may contain some useful snippets:
    1 point
  34. Hello, Here come a few pointers: payment integration: http://omnipay.thephpleague.com https://www.payrexx.com/en/pricing/pricing/ https://processwire.com/talk/topic/14808-now-my-client-wants-to-add-ecommerce/ https://processwire.com/talk/topic/14511-e-commerce-tutorial-with-processwire-snipcart-your-thoughts/ member restriction: for backend: https://processwire.com/talk/topic/11499-admin-restrict-branch/ https://modules.processwire.com/modules/textformatter-soundmanager/ Subscription management https://processwire.com/talk/topic/16363-recurme-–-processwire-recurring-dates-field-custom-calendar-module/ AJAX front end editing for building playlists & "likes" while PW has frontend editing support: https://processwire.com/blog/posts/front-end-editing-now-in-processwire-3.0-alpha-4/ you might find that rolling out your on frontend solution is more versatile in your case so maybe you want to take a look at this one http://intercoolerjs.org/ or you might want to do it all in the admin: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ or both frontend AND admin ? related: https://processwire.com/talk/topic/7913-podcast-profile/ https://processwire.com/talk/topic/12752-pw-podcast-theme-for-podcasts/ Hope this helps.
    1 point
  35. server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; root /home/forge/example.com/public; index index.html index.htm index.php; charset utf-8; # ----------------------------------------------------------------------------------------------- # Access Restrictions: Protect ProcessWire system files # ----------------------------------------------------------------------------------------------- # Block access to ProcessWire system files location ~ \.(inc|info|module|sh|sql)$ { deny all; } # Block access to any file or directory that begins with a period location ~ /\. { deny all; } # Block access to protected assets directories location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) { deny all; } # Block acceess to the /site/install/ directory location ~ ^/(site|site-[^/]+)/install($|/.*$) { deny all; } # Block dirs in /site/assets/ dirs that start with a hyphen location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* { deny all; } # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ { deny all; } # Block access to any PHP-based files in /templates-admin/ location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP or markup files in /site/templates/ location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP files in /site/assets/ location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ { deny all; } # Block access to any PHP files in core or core module directories location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any PHP files in /site/modules/ location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any software identifying txt files location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ { deny all; } # Block all http access to the default/uninstalled site-default directory location ~ ^/site-default/ { deny all; } #Amplify dashboard location /nginx_status { stub_status on; allow 127.0.0.1; deny all; } # ----------------------------------------------------------------------------------------------- # If the request is for a static file, then set expires header and disable logging. # Give control to ProcessWire if the requested file or directory is non-existing. # ----------------------------------------------------------------------------------------------- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|eot|woff|ttf)$ { expires 15d; log_not_found off; access_log off; try_files $uri $uri/ /index.php?it=$uri&$query_string; } # ----------------------------------------------------------------------------------------------- # ProCache Rules # ----------------------------------------------------------------------------------------------- set $cache_uri $request_uri; if ($request_method = POST) { set $cache_uri 'nocache'; } if ($http_cookie ~* "wires_challenge") { set $cache_uri 'nocache'; } if ($http_cookie ~* "persist") { set $cache_uri 'nocache'; } # ----------------------------------------------------------------------------------------------- # This location processes all other requests. If the request is for a file or directory that # physically exists on the server, then load the file. Else give control to ProcessWire. # ----------------------------------------------------------------------------------------------- location / { expires -1; try_files /site/assets/ProCache-b3d534d...d/$cache_uri/index.html $uri $uri/ /index.php?it=$uri&$args; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/example.com-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } }
    1 point
  36. If you are using cloudflare.com you might also want to create a page rule like: *mydomain.com/processwire/* Security Level = High Cache Level = Bypass Disable Apps Disable Performance This should prevent any of the Processwire admin from being proxied by cloudflare.
    1 point
×
×
  • Create New...