PhpStorm now bundles WordPress coding style natively, starting from version 8.
- Go to
Project Settings>Code Style>PHP. - Select
Set From...(top right of window) >Predefined Style>WordPress.
No longer need to muck with this import! :)
| <?php # -*- coding: utf-8 -*- | |
| declare( encoding = 'UTF-8' ); | |
| class Autohook_Demo | |
| { | |
| public static function init() | |
| { | |
| new self; | |
| } |
| <?php # -*- coding: utf-8 -*- | |
| /** | |
| * Plugin Name: Plugin Class Demo | |
| * Description: How I am using the base class in plugins. | |
| * Plugin URI: | |
| * Version: 2012.09.29 | |
| * Author: Fuxia Scholz | |
| * License: GPL | |
| * Text Domain: plugin_unique_name | |
| * Domain Path: /languages |
| /** | |
| * Add dataset support to elements | |
| * No globals, no overriding prototype with non-standard methods, | |
| * handles CamelCase properly, attempts to use standard | |
| * Object.defineProperty() (and Function bind()) methods, | |
| * falls back to native implementation when existing | |
| * Inspired by http://code.eligrey.com/html5/dataset/ | |
| * (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js ) | |
| * Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (polyfills below) | |
| * All code below is Licensed under the X11/MIT License |
| Index: domain_mapping.php | |
| =================================================================== | |
| --- domain_mapping.php (revision 694026) | |
| +++ domain_mapping.php (working copy) | |
| @@ -695,7 +695,7 @@ | |
| return; | |
| // don't redirect theme customizer (WP 3.4) | |
| - if ( isset( $_POST['customize'] ) && isset( $_POST['theme'] ) && $_POST['customize'] == 'on' ) | |
| + if ( isset( $_POST['wp_customize'], $_POST['theme'] ) && $_POST['wp_customize'] == 'on' ) |
| Index: domain_mapping.php | |
| =================================================================== | |
| --- domain_mapping.php (revision 694026) | |
| +++ domain_mapping.php (working copy) | |
| @@ -370,7 +370,7 @@ | |
| exit; | |
| break; | |
| } | |
| - } elseif( $_GET[ 'action' ] == 'delete' ) { | |
| + } elseif ( isset( $_GET['action'] ) && $_GET['action'] == 'delete' ) { |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteCond %{HTTP_ACCEPT} image/webp | |
| RewriteCond %{DOCUMENT_ROOT}/$1.webp -f | |
| RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1] | |
| </IfModule> | |
| <IfModule mod_headers.c> | |
| Header append Vary Accept env=REDIRECT_accept | |
| </IfModule> |
| <?php | |
| /** | |
| * Plugin Name: WooCommerce Subscriptions Date Sync | |
| * Plugin URI: | |
| * Description: Sets the start date of a subscription to September 13, 2013 | |
| * Author: Peter Wilson | |
| * Author URI: http://peterwilson.cc/ | |
| * Version: 1.0.0 | |
| */ |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"