Leaderboard
Popular Content
Showing content with the highest reputation on 07/31/2018 in all areas
-
@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 ?.5 points
-
Hey there, All in all this sounds like a editor issue, not a ProcessWire issue per se – i.e. for some reason your code editor crashed and emptied the main.inc file, and perhaps deleted / emptied other files as well. Do you have any backups of the site files? It's a bit late to say this, but you should make regular backups of your work. Using a version control system like Git or SVN is preferable, but manual or automatic backups will do as well. If you're using ProcessWire 3.0+ you could take a look at /site/assets/cache/FileCompiler/ – if you're really lucky, you might have a compiled version of your main.inc in there. Although since you're having issues with the site, this seems unlikely. Sorry for not being able to help more here. The thing is that sometimes editors and such mess up, and the best protection you can employ is a version control system, or at least those regular backups. Hope you get this sorted out!5 points
-
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!3 points
-
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=personal3 points
-
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?3 points
-
@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 ?3 points
-
Thanks for removing the branding. I bought a drink for you. Cheers ?2 points
-
No idea. What module and version are you using? And btw /xxx is not a page name. Also PW uses trailing slash (default).2 points
-
For this to happen you must be using somewhere the $user variable which is the one that refers to the user in session. I'm thinking this is what you are looking for, so when Bob is logged in, $user will refer to Bob, and when Amy is logged in, it will refer to her user: $current = $pages->find("template=secondary, page_author=$user");2 points
-
Hello, interesting topic. Here is one example (please read comments inside script): // !!! configuration $desired_templates = array('basic-page'); $desired_fields = array('body', 'summary'); $stop_words = array('and', 'is', 'for', 'a', 'the', 'to', 'of'); $limit_list = 10; // most used words list $words = array(); // target templates where we search $selector = implode("|", $desired_templates); // get all desired pages $content = $pages->find("template=$selector"); // fill words array foreach($content as $item){ foreach($desired_fields as $f){ $words[] = $item->{$f}; } } // https://stackoverflow.com/questions/3175390/most-used-words-in-text-with-php function most_frequent_words($string, $stop_words = [], $limit = 5) { $string = strtolower($string); // Make string lowercase $words = str_word_count($string, 1); // Returns an array containing all the words found inside the string $words = array_diff($words, $stop_words); // Remove black-list words from the array $words = array_count_values($words); // Count the number of occurrence arsort($words); // Sort based on count return array_slice($words, 0, $limit); // Limit the number of words and returns the word array } // output var_dump(most_frequent_words(implode(' ', $words), $stop_words, $limit_list)); Bad thing in this example is if you do this query in fronted runtime, better place this in some specific template and use PW cache. Also, maybe the best option is to create some Ajax driven module in backend and generate there words list. Regards.2 points
-
I have had this module sitting in a 95% complete state for a while now and have finally made the push to get it out there. Thanks to @teppo for his Hanna Code Helper module which I referred to and borrowed from during development. http://modules.processwire.com/modules/hanna-code-dialog/ https://github.com/Toutouwai/HannaCodeDialog HannaCodeDialog Provides a number of enhancements for working with Hanna Code tags in CKEditor. The main enhancement is that Hanna tags in a CKEditor field may be double-clicked to edit their attributes using core ProcessWire inputfields in a modal dialog. Requires the Hanna Code module and >= ProcessWire v3.0.0. Installation Install the HannaCodeDialog module using any of the normal methods. For any CKEditor field where you want the "Insert Hanna tag" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "HannaDropdown" to the "CKEditor Toolbar" settings field. Module configuration Visit the module configuration screen to set any of the following: Exclude prefix: Hanna tags named with this prefix will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Exclude Hanna tags: Hanna tags selected here will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Background colour of tag widgets: you can customise the background colour used for Hanna tags in CKEditor if you like. Dialog width: in pixels Dialog height: in pixels Features Insert tag from toolbar dropdown menu Place the cursor in the CKEditor window where you want to insert your Hanna tag, then select the tag from the "Insert Hanna tag" dropdown. Advanced: if you want to control which tags appear in the dropdown on particular pages or templates you can hook HannaCodeDialog::getDropdownTags. See the forum support thread for examples . Edit tag attributes in modal dialog Insert a tag using the dropdown or double-click an existing tag in the CKEditor window to edit the tag attributes in a modal dialog. Tags are widgets Hanna tags that have been inserted in a CKEditor window are "widgets" - they have a background colour for easy identification, are protected from accidental editing, and can be moved within the text by drag-and-drop. Options for tag attributes may be defined You can define options for a tag attribute so that editors must choose an option rather than type text. This is useful for when only certain strings are valid for an attribute and also has the benefit of avoiding typos. Add a new attribute for the Hanna tag, named the same as the existing attribute you want to add options for, followed by "__options". The options themselves are defined as a string, using a pipe character as a delimiter between options. Example for an existing attribute named "vegetables": vegetables__options=Spinach|Pumpkin|Celery|Tomato|Brussels Sprout|Potato You can define a default for an attribute as normal. Use a pipe delimiter if defining multiple options as the default, for example: vegetables=Tomato|Potato Dynamic options Besides defining static options as above, you can use one Hanna tag to dynamically generate options for another. For instance, you could create a Hanna tag that generates options based on images that have been uploaded to the page, or the titles of children of the page. Your Hanna tag that generates the options should echo a string of options delimited by pipe characters (i.e. the same format as a static options string). You will probably want to name the Hanna tag that generates the options so that it starts with an underscore (or whatever prefix you have configured as the "exclude" prefix in the module config), to avoid it appearing as an insertable tag in the HannaCodeDialog dropdown menu. Example for an existing attribute named "image": image__options=[[_images_on_page]] And the code for the _images_on_page tag: <?php $image_names = array(); $image_fields = $page->fields->find('type=FieldtypeImage')->explode('name'); foreach($image_fields as $image_field) { $image_names = array_unique( array_merge($image_names, $page->$image_field->explode('name') ) ); } echo implode('|', $image_names); Choice of inputfield for attribute You can choose the inputfield that is used for an attribute in the dialog. For text attributes the supported inputfields are text (this is the default inputfield for text attributes so it isn't necessary to specify it if you want it) and textarea. Note: any manual line breaks inside a textarea are removed because these will break the CKEditor tag widget. Inputfields that support the selection of a single option are select (this is the default inputfield for attributes with options so it isn't necessary to specify it if you want it) and radios. Inputfields that support the selection of multiple options are selectmultiple, asmselect and checkboxes. You can also specify a checkbox inputfield - this is not for attributes with defined options but will limit an attribute to an integer value of 1 or 0. The names of the inputfield types are case-insensitive. Example for an existing attribute named "vegetables": vegetables__type=asmselect Descriptions and notes for inputfields You can add a description or notes to an attribute and these will be displayed in the dialog. Example for an existing attribute named "vegetables": vegetables__description=Please select vegetables for your soup. vegetables__notes=Pumpkin and celery is a delicious combination. Notes When creating or editing a Hanna tag you can view a basic cheatsheet outlining the HannaCodeDialog features relating to attributes below the "Attributes" config inputfield. Advanced Define or manipulate options in a hook You can hook HannaCodeDialog::prepareOptions to define or manipulate options for a Hanna tag attribute. Your Hanna tag must include a someattribute__options attribute in order for the hook to fire. The prepareOptions method receives the following arguments that can be used in your hook: options_string Any existing string of options you have set for the attribute attribute_name The name of the attribute the options are for tag_name The name of the Hanna tag page The page being edited If you hook after HannaCodeDialog::prepareOptions then your hook should set $event->return to an array of option values, or an associative array in the form of $value => $label. Build entire dialog form in a hook You can hook after HannaCodeDialog::buildForm to add inputfields to the dialog form. You can define options for the inputfields when you add them. Using a hook like this can be useful if you prefer to configure inputfield type/options/descriptions/notes in your IDE rather than as extra attributes in the Hanna tag settings. It's also useful if you want to use inputfield settings such as showIf. When you add the inputfields you must set both the name and the id of the inputfield to match the attribute name. You only need to set an inputfield value in the hook if you want to force the value - otherwise the current values from the tag are automatically applied. To use this hook you only have to define the essential attributes (the "fields" for the tag) in the Hanna Code settings and then all the other inputfield settings can be set in the hook. Example buildForm() hook The Hanna Code attributes defined for tag "meal" (a default value is defined for "vegetables"): vegetables=Carrot meat cooking_style comments The hook code in /site/ready.php: $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // Other arguments if you need them /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The page open in Page Edit $current_attributes = $event->arguments(2); // The current attribute values $default_attributes = $event->arguments(3); // The default attribute values // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'meal') { $modules = $event->wire('modules'); /* @var InputfieldCheckboxes $f */ $f = $modules->InputfieldCheckboxes; $f->name = 'vegetables'; // Set name to match attribute $f->id = 'vegetables'; // Set id to match attribute $f->label = 'Vegetables'; $f->description = 'Please select some vegetables.'; $f->notes = "If you don't eat your vegetables you can't have any pudding."; $f->addOptions(['Carrot', 'Cabbage', 'Celery'], false); $form->add($f); /* @var InputfieldRadios $f */ $f = $modules->InputfieldRadios; $f->name = 'meat'; $f->id = 'meat'; $f->label = 'Meat'; $f->addOptions(['Pork', 'Beef', 'Chicken', 'Lamb'], false); $form->add($f); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'cooking_style'; $f->id = 'cooking_style'; $f->label = 'How would you like it cooked?'; $f->addOptions(['Fried', 'Boiled', 'Baked'], false); $form->add($f); /* @var InputfieldText $f */ $f = $modules->InputfieldText; $f->name = 'comments'; $f->id = 'comments'; $f->label = 'Comments for the chef'; $f->showIf = 'cooking_style=Fried'; $form->add($f); } }); Troubleshooting HannaCodeDialog includes and automatically loads the third-party CKEditor plugins Line Utilities and Widget. If you have added these plugins to your CKEditor field already for some purpose and experience problems with HannaCodeDialog try deactivating those plugins from the CKEditor field settings.1 point
-
Hi all. For a while now been wondering how many would be interested in a backend and frontend shop catalogue built on top of PadLoper? I've previously spoken to @apeisa about this and his take is that there are no plans to develop PadLoper in this direction but he's happy to support such efforts. The gist of the backend shop catalogue is to provide one place (think ProcessModule) where you can manage your PadLoper products - add, edit, delete, track sales, etc without having to set up the underlying structure yourself. The frontend would be like a shop/webstore profile, a frontend cart basically, that's customisable. The shop would be 100% powered by PadLoper. This means that to use the 'shop catalogue' would require that PadLoper is installed. These are just loose ideas at the moment for a pro module. This might or might not see the light of day depending on feedback. Anyway, would love to hear thoughts, thanks.1 point
-
Thank you @hheyne and @jmartsch I've merged that fix ?1 point
-
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
-
That would be difficult to do as it goes against the way ProcessPageEdit works normally - when PPE loads, the values shown in the inputfields are the values stored in the database. So it also raises the question of even if you could do it (maybe save the $input->post data to $session and then hook the inputfield render to load custom content to the inputs) whether it would be a good idea given that it goes against what PW editors will be used to. You might be better to disable the save button with Javascript if the required fields are not filled out. Note also that for text fields there is a setting to use the HTML5 required attribute which has the effect of preventing a page save when the required field is not filled out. With either of these approaches though you should consider how you will handle an attempted save from a PPE tab other than Content (e.g. an attempted save from the Settings tab).1 point
-
Apologies - you are indeed correct. I can't imagine why it would actually have been changed - not sure why you'd need uppercase chars in a field name, but the description of what is allowed certainly has changed. https://github.com/ryancramerdesign/ProcessWire/blob/a210ba0b5ea67e56fef8a27a620bcfa6f96ca0b8/wire/modules/Process/ProcessField/ProcessField.module#L949 https://github.com/processwire/processwire/blob/48fe0769a4eb3d0f5b4732fd01b4b4ed8262d952/wire/modules/Process/ProcessField/ProcessField.module#L11961 point
-
Thanks @elabx.. I did not initially realize that $user already had that information "saved". Works like a charm.1 point
-
Thanks Adrian. This got me more curious because I vaguely remember having a talk about lower case vs upper case. So, I went back and checked, all the way from 2.2 up to and including 2.7.3. It was only lower case in those versions. So, this must be a 3.x introduction.1 point
-
I think it has always said this: "Use only ASCII letters (a-z A-Z), numbers (0-9) or underscores." I think it's likely we've just always assumed lowercase only because names suggest lowercase vs labels/titles which is where you expect difference cases, spaces, special chars etc.1 point
-
Thank you for replying... we've identified the issue occurs when we create a Media Manager field with mixed case. When we create a field that is all lower case the error does not occur and the media manager functions normally. Everything about the templates function normally, and we can make the media manager field function correctly f it is all lower case. We've tried different templates and repeaters and the issue always occurs if the field is mixed case. Our environment is running PHP 7.1.17 and MariaDB 5.6.10. We had been using mixed case fields as it made it easier to read. The error occurs whether or not the Manager Manager field has been added to a template or not. I'm attaching a couple screenshots. Thank you!1 point
-
1 point
-
Hello, here is simplified version of icons font fieldtype module: https://github.com/OLSA/FieldtypeFontIcon This module use the same icons css file like your template (set path relative to template folder, eg. styles/fontawesome5/all.css ). After module install and created field go to field Input tab to set path (and in some cases prefix classes). Examples: Font Awesome 5 IcoMoon If everything is ok you will get something like this: NOTE: "Regular expression pattern parser" input field is not required because it will be set by default (by module itself). Regards.1 point
-
1 point
-
Thanks netcarver! Coming from a Drupal background... If an issue has been fixed by the module maintainer, then he/she marks it with a status of "Fixed" see https://www.drupal.org/issue-queue/status#fixed. After two weeks the issue automatically changes to "Closed (Fixed)" see https://www.drupal.org/issue-queue/status#closed. Drupal's issue queues are different than Processwire's. On drupal.org, anybody can change an issue status at anytime. On github/processwire, only the issue creator or admins can the issue status. Although 200 open issues seems like a big number, check out https://www.drupal.org/project/drupal ? Although with Wordpress it's hard to tell what the number is https://core.trac.wordpress.org/tickets/latest1 point
-
Ok, I got some updates on this module. I wanted to implement support of multiple forms on one page because I need to add a newsletter subscription form on one page using my module and right now this is not possible. Unfortunately this task is not trivial and I hope to get some help by you guys ? maybe @tpr @Robin S or @gebeer have already done something similar? Please see the explanation of the issue in the Nette Forum: https://forum.nette.org/en/30969-multiple-forms-on-one-page-standalone-version Edit: seems to be solved - got a reply instantly in the nett forum ? BTW: I decided to remove the branding from the module ?1 point
-
Each year we cycle 1000km with our company to fight against cancer. To participate with 4 teams we have to collect 20.000 euros. Our graphic designers made some goodies en we also organise a spaghetti fundraiser. To help the sales we decided to make a webshop with our webteam. And of course we used our favourite CMS for the job! ? https://shop.typografics.be/ At this moment we raised more than 20.000 euros, so all our teams can participate. This is a very special project for us, unfortunately one of our colleagues has been diagnosed with cancer and currently is fighting against this terrible disease. Premium PW modules used in this project: PadLoper FormBuilder ProFields Variations With a few hooks here and there we managed to make it work. To handle the payments we made use of Mollie, we created our own payment module and will opensource this soon. You can read more about this project in our blog (in dutch) Unfortunately we're currently only shipping to Belgium We’re already brainstorming to make a 2.0 version of this webshop, so all your feedback is more than welcome.1 point
-
Sorry for the delay, we had some busy weeks. But we found the time to put the files on github. https://github.com/Typografics/PaymentMollie-PW3 I also made a topic on the modules forum:1 point
-
Hi @adrian, I just pushed an update that makes those strings translatable within the module file. As for the other issue, if your tag name is long it can overflow the standard width that CKEditor applies to combo panels (I don't set any explicit width in this module). I could make a config field for panel width but I'd rather not because I think the default width is suitable in most cases and to get a dynamic value from PHP it would mean putting the CSS inline which is kinda ugly. Maybe you could just set your own width for the panel in some custom admin CSS? .cke_combopanel__hannadropdown { width:300px !important; }1 point
-
Thanks for this great tutorial! I am impressed by your PW admin UI manipulation skill all time. This tutorial could definitely get someone's hands dirty. Yes it is really quite hard imo because the related information is not easy to find. They do exist but always sit inside various post replies. It just looks like a missing piece to beginners. I long for a more in-depth version of this tutorial, or a complete guide precisely, that shows how to accurately use wiretab, pw-modal, panel, buttons etc. and layout all of them properly. I discovered a bit from reading through the core files and modules by trial and error but I believe I still have a long long way to go. I believe many people, like me a while ago, stuck in the layout phase and then give up their modules development.1 point
-
Done did it: public function init() { $this->addHookAfter('Page::render', $this, 'styling'); $this->addHookAfter('Page::render', $this, 'filterFieldFields'); } protected function styling(HookEvent $event) { $page = $event->object; $edid = $this->pages->get($this->input->get->id); if(!($page->process = 'ProcessPageEdit' && $edid->template = 'importupdate')) return; $css = wire('config')->urls->ImportUpdateUltimate . 'ass/edit_importupdate.css'; $event->return = str_replace("</head>", "<link rel='stylesheet' type='text/css' href='{$css}'/>\n</head>", $event->return); } protected function filterFieldFields(Hookevent $event) { $page = $event->object; $edid = $this->pages->get($this->input->get->id); if(!($page->process = 'ProcessPageEdit' && $edid->template = 'importupdate')) return; if($edid->iu_template) $tpl = wire('templates')->get((int) $edid->iu_template[0]); else $tpl = null; $fields = []; if($tpl != null) { foreach ($tpl->fields as $f) { $fields[] = $f->id; } $fstring = '[' . implode(',',$fields) . ']'; } else $fstring = '[]'; $js = <<<EOT <script> $(document).ready(function(){ var arr = $fstring; var def = '<option value=""></option>'; if (arr.length) { $('#Inputfield_iu_match option').each(templateFieldOptions); $('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); $('#_Inputfield_iu_maptab').click(function() { $('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); }); } else { clearFieldOptions(); } $('#wrap_Inputfield_iu_template .asmListItemRemove').click(clearFieldOptions); function templateFieldOptions() { var val = parseInt(this.value); //console.log(typeof(val)); if (!arr.includes(val) && val>0) { //console.log(val); $(this).prop('selected',false); $(this).prop('disabled',true).remove(); } } function clearFieldOptions() { $('#Inputfield_iu_match').html(def); $('#wrap_Inputfield_iu_fieldmap select').each(function() { $(this).html(def); }); } }); </script> EOT; $event->return = str_replace("</body>", "{$js}</body>", $event->return); }1 point
-
Hi, I have a custom built module that auto-generates a number of pages (translations) on creation of a master page (English version) and saves them as subpages of their respective languages. Home - Articles (English) -- Article title - French -- Articles --- Article title (unpublished) - German -- Articles --- Article title (unpublished) etc The pages that are created are unpublished and I'd like if possible to be able to pull content for the English version until a translated version is published. Sometimes no translated version will be available so the English content is seen as a 'fallback' here. Currently to a logged out user trying to view an unpublished translation page will see a 404. Could there be a a way to override this behaviour? I'd only want it to be limited to the translations, so template or parent specific. Extra info... Every translated version has a pagefield storing the master English version, so that info is available for pulling out into a template or module. Each article and it's translations have the same name but is / a country code, such as /fr/ or /de/ etc Any help much appreciated!1 point
-
Hey all, I've converted the ProcessWire 2.3 rules to Nginx. Hope this will help some people Greetings, Niek server { listen 80; listen 443 ssl; root /var/www/example.com/public_html; server_name example.com www.example.com; ssl_certificate /etc/pki/tls/certs/example.com.crt; ssl_certificate_key /etc/pki/tls/private/example.com.key; client_max_body_size 50m; access_log /var/www/example.com/_logs/access.log; error_log /var/www/example.com/_logs/error.log; # ----------------------------------------------------------------------------------------------- # Set default directory index files # ----------------------------------------------------------------------------------------------- index index.php index.html index.htm; # ----------------------------------------------------------------------------------------------- # Optional: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://processwire.com/ would be redirected to http://www.processwire.com/ # ----------------------------------------------------------------------------------------------- if ($host !~* ^www\.) { rewrite ^(.*)$ $scheme://www.$host$1 permanent; } # ----------------------------------------------------------------------------------------------- # 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; } # ----------------------------------------------------------------------------------------------- # 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 24h; log_not_found off; access_log off; try_files $uri $uri/ /index.php?it=$uri&$args; } # ----------------------------------------------------------------------------------------------- # 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 / { try_files $uri $uri/ /index.php?it=$uri&$args; } # ----------------------------------------------------------------------------------------------- # Pass .php requests to fastcgi socket # ----------------------------------------------------------------------------------------------- location ~ \.php$ { # Check if the requested PHP file actually exists for security try_files $uri =404; # Fix for server variables that behave differently under nginx/php-fpm than typically expected fastcgi_split_path_info ^(.+\.php)(/.+)$; # Set environment variables include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Pass request to php-fpm fastcgi socket fastcgi_pass unix:/var/run/example.com_fpm.sock; } }1 point