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 | |
| /** | |
| * Plugin Name: Robots Crawl Delay | |
| */ | |
| function prefix_robots_crawl_delay( $output, $public ) { | |
| $output .= "Crawl-delay: 8\n"; | |
| return $output; | |
| } | |
| add_filter( 'robots_txt', 'prefix_robots_crawl_delay', 10, 2 ); |
| <?php | |
| // Reduced to the minimum | |
| class ThumbnailFilter extends FilterIterator | |
| { | |
| private $wp_query; | |
| public function __construct( Iterator $iterator, WP_Query $wp_query ) | |
| { | |
| NULL === $this->wp_query AND $this->wp_query = $wp_query; | |
| parent::__construct( $iterator ); |
| ( function( $, plugin ) { | |
| "use strict"; | |
| // Working with promises to bubble event later than core. | |
| $.when( someObjectWithEvents ).done( function() { | |
| console.log( 'AJAX request done.' ); | |
| } ) | |
| .then( function() { | |
| setTimeout( function() { | |
| console.log( 'AJAX requests resolved.' ); |