The setup installs the following software:
- Nginx
- MySQL
- PHP
- Node
- Composer
| <?php | |
| // This code is based in Mathew Horne blog post: https://matthewhorne.me/defer-async-wordpress-scripts/ | |
| //function to add async attribute | |
| function add_async_attribute($tag, $handle) { | |
| $scripts_to_async = array('my-js-handle-async', 'another-handle-async'); | |
| //check if this script is in the array | |
| if (in_array($handle, $scripts_to_async)){ | |
| //return with async | |
| return str_replace(' src', ' async="async" src', $tag); |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Which Browser?</title> | |
| </head> | |
| <body> | |
| <p>You are using <span id="browser"></span> <span id="version"></span> on <span id="os"></span></p> | |
| <script type="text/javascript" src="browserdetect.js"></script> | |
| <script type="text/javascript"> |
| <?php | |
| /** | |
| * Fixes issue where JS is halted on ACF admin pages when WP Media Folder is activated. | |
| * | |
| * These are the versions of the plugins I had when I tried | |
| * - WP Media Folder - 1.0.4 | |
| * - Advanced Custom Fields Pro - (5.1.8, 5.2.1) | |
| * | |
| * |
| <?php | |
| // Based on <https://github.com/mecha-cms/x.minify> | |
| namespace x\minify\_ { // start namespace | |
| $n = __NAMESPACE__; | |
| \define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
| \define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |
| server { | |
| ## Your website name goes here. | |
| server_name domainname.com www.domainname.com _; | |
| ## Your only path reference. | |
| root /var/www/; | |
| listen 8080; | |
| ## This should be in your http block and if it is, it's not needed here. | |
| index index.html index.htm index.php; | |
| include conf.d/drop; |
| <?php | |
| $file = '/path/to/file.png'; | |
| $filename = basename($file); | |
| $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
| if (!$upload_file['error']) { | |
| $wp_filetype = wp_check_filetype($filename, null ); | |
| $attachment = array( | |
| 'post_mime_type' => $wp_filetype['type'], | |
| 'post_parent' => $parent_post_id, |
| /** | |
| * $.unserialize | |
| * | |
| * Takes a string in format "param1=value1¶m2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array. | |
| * | |
| * Example: | |
| * | |
| * Input: param1=value1¶m2=value2 | |
| * Return: { param1 : value1, param2: value2 } | |
| * |
| <?php | |
| /* | |
| * Resize images dynamically using wp built in functions | |
| * Victor Teixeira | |
| * | |
| * php 5.2+ | |
| * | |
| * Exemplo de uso: | |
| * | |
| * <?php |
| <?php | |
| /* | |
| Plugin Name: Force SSL URL Scheme | |
| Plugin URI: https://gist.github.com/webaware/4688802 | |
| Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work | |
| Version: 1.0.0 | |
| Author: WebAware | |
| Author URI: http://webaware.com.au/ | |
| @ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility |