@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function run() {
|
| 19 | 19 | |
| 20 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 21 | - add_filter( 'update_blocker_blocked', array( $this, 'update_blocker_blocked' ) ); |
|
| 20 | + add_action( 'init', array($this, 'init') ); |
|
| 21 | + add_filter( 'update_blocker_blocked', array($this, 'update_blocker_blocked') ); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | if ( |
| 30 | 30 | 'on' === filter_input( INPUT_POST, 'wp_customize' ) |
| 31 | - && empty( filter_input( INPUT_POST, 'action' ) ) |
|
| 31 | + && empty(filter_input( INPUT_POST, 'action' )) |
|
| 32 | 32 | && current_user_can( 'customize' ) |
| 33 | 33 | ) {
|
| 34 | 34 | return; // We don’t want cache running in Customizer previews. |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | foreach ( $this->handlers as $key => $type ) {
|
| 38 | - if ( isset( $this[ $type ] ) ) {
|
|
| 38 | + if ( isset($this[$type]) ) {
|
|
| 39 | 39 | /** @var Fragment_Cache $handler */ |
| 40 | - $handler = $this[ $type ]; |
|
| 40 | + $handler = $this[$type]; |
|
| 41 | 41 | $handler->enable(); |
| 42 | 42 | } else {
|
| 43 | - unset( $this->handlers[ $key ] ); |
|
| 43 | + unset($this->handlers[$key]); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function add_fragment_handler( $type, $class_name ) {
|
| 69 | 69 | |
| 70 | - if ( isset( $this[ $type ] ) ) {
|
|
| 70 | + if ( isset($this[$type]) ) {
|
|
| 71 | 71 | /** @var Fragment_Cache $handler */ |
| 72 | - $handler = $this[ $type ]; |
|
| 72 | + $handler = $this[$type]; |
|
| 73 | 73 | $handler->disable(); |
| 74 | - unset( $this[ $type ] ); |
|
| 74 | + unset($this[$type]); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $this[ $type ] = function ( $plugin ) use ( $type, $class_name ) {
|
|
| 78 | - return new $class_name( array( 'type' => $type, 'timeout' => $plugin['timeout'] ) ); |
|
| 77 | + $this[$type] = function( $plugin ) use ($type, $class_name) {
|
|
| 78 | + return new $class_name( array('type' => $type, 'timeout' => $plugin['timeout']) );
|
|
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | 81 | if ( ! in_array( $type, $this->handlers, true ) ) {
|
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | global $shortcode_tags; |
| 19 | 19 | |
| 20 | - if ( isset( $shortcode_tags['gallery'] ) ) {
|
|
| 20 | + if ( isset($shortcode_tags['gallery']) ) {
|
|
| 21 | 21 | $this->original_shortcode = $shortcode_tags['gallery']; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - add_shortcode( 'gallery', array( $this, 'gallery_shortcode' ) ); |
|
| 24 | + add_shortcode( 'gallery', array($this, 'gallery_shortcode') ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function disable() {
|
| 31 | 31 | |
| 32 | - if ( ! empty( $this->original_shortcode ) ) {
|
|
| 32 | + if ( ! empty($this->original_shortcode) ) {
|
|
| 33 | 33 | add_shortcode( 'gallery', $this->original_shortcode ); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function gallery_shortcode( $args ) {
|
| 45 | 45 | |
| 46 | - if ( empty( $args ) ) {
|
|
| 46 | + if ( empty($args) ) {
|
|
| 47 | 47 | $args = array(); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $post_id = get_the_ID(); |
| 70 | 70 | |
| 71 | - if ( ! isset( $attachments[ $post_id ] ) ) {
|
|
| 71 | + if ( ! isset($attachments[$post_id]) ) {
|
|
| 72 | 72 | |
| 73 | - $attachments[ $post_id ] = get_posts( array( |
|
| 73 | + $attachments[$post_id] = get_posts( array( |
|
| 74 | 74 | 'post_type' => 'attachment', |
| 75 | 75 | 'post_parent' => $post_id, |
| 76 | 76 | 'orderby' => 'ID', |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | ) ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - return $attachments[ $post_id ]; |
|
| 81 | + return $attachments[$post_id]; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $post = get_post( $args['post_id'] ); |
| 97 | 97 | setup_postdata( $post ); |
| 98 | - $shortcode = isset( $this->original_shortcode ) ? $this->original_shortcode : 'gallery_shortcode'; |
|
| 98 | + $shortcode = isset($this->original_shortcode) ? $this->original_shortcode : 'gallery_shortcode'; |
|
| 99 | 99 | $output = call_user_func( $shortcode, $args['args'] ) . $this->get_comment( $name ); |
| 100 | 100 | wp_reset_postdata(); |
| 101 | 101 | |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | public function enable() {
|
| 14 | 14 | |
| 15 | 15 | if ( is_admin() ) {
|
| 16 | - add_filter( 'widget_update_callback', array( $this, 'widget_update_callback' ) ); |
|
| 17 | - add_action( 'wp_ajax_update-widget', array( $this, 'update_widget' ), 0 ); |
|
| 16 | + add_filter( 'widget_update_callback', array($this, 'widget_update_callback') ); |
|
| 17 | + add_action( 'wp_ajax_update-widget', array($this, 'update_widget'), 0 ); |
|
| 18 | 18 | } else {
|
| 19 | - add_filter( 'widget_display_callback', array( $this, 'widget_display_callback' ), 10, 3 ); |
|
| 19 | + add_filter( 'widget_display_callback', array($this, 'widget_display_callback'), 10, 3 ); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | public function disable() {
|
| 27 | 27 | |
| 28 | 28 | if ( is_admin() ) {
|
| 29 | - remove_filter( 'widget_update_callback', array( $this, 'widget_update_callback' ) ); |
|
| 30 | - remove_action( 'wp_ajax_update-widget', array( $this, 'update_widget' ), 0 ); |
|
| 29 | + remove_filter( 'widget_update_callback', array($this, 'widget_update_callback') ); |
|
| 30 | + remove_action( 'wp_ajax_update-widget', array($this, 'update_widget'), 0 ); |
|
| 31 | 31 | } else {
|
| 32 | - remove_filter( 'widget_display_callback', array( $this, 'widget_display_callback' ), 10 ); |
|
| 32 | + remove_filter( 'widget_display_callback', array($this, 'widget_display_callback'), 10 ); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $customized = filter_input( INPUT_POST, 'customized' ); |
| 58 | 58 | |
| 59 | - if ( empty( $customized ) ) {
|
|
| 59 | + if ( empty($customized) ) {
|
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | foreach ( $customized as $key => $data ) {
|
| 67 | 67 | |
| 68 | - if ( ! isset( $data['encoded_serialized_instance'] ) || 0 !== stripos( $key, 'widget' ) ) {
|
|
| 68 | + if ( ! isset($data['encoded_serialized_instance']) || 0 !== stripos( $key, 'widget' ) ) {
|
|
| 69 | 69 | continue; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $data['encoded_serialized_instance'] = $instance; |
| 77 | 77 | $data['instance_hash_key'] = wp_hash( $instance ); |
| 78 | - $customized[ $key ] = $data; |
|
| 78 | + $customized[$key] = $data; |
|
| 79 | 79 | |
| 80 | 80 | $changed = true; |
| 81 | 81 | } |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function widget_display_callback( $instance, $widget, $args ) {
|
| 98 | 98 | |
| 99 | - $edited = isset( $instance['fc_widget_edited'] ) ? $instance['fc_widget_edited'] : ''; |
|
| 99 | + $edited = isset($instance['fc_widget_edited']) ? $instance['fc_widget_edited'] : ''; |
|
| 100 | 100 | |
| 101 | 101 | echo $this->fetch( |
| 102 | 102 | $widget->id, |
| 103 | 103 | array( |
| 104 | - 'callback' => array( $widget, 'widget' ), |
|
| 105 | - 'args' => array( $args, $instance ), |
|
| 104 | + 'callback' => array($widget, 'widget'), |
|
| 105 | + 'args' => array($args, $instance), |
|
| 106 | 106 | ), |
| 107 | 107 | $edited |
| 108 | 108 | ); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // Anonymize front-end run for consistency. |
| 60 | 60 | if ( is_user_logged_in() ) {
|
| 61 | 61 | |
| 62 | - if ( empty( $empty_user ) ) {
|
|
| 62 | + if ( empty($empty_user) ) {
|
|
| 63 | 63 | $empty_user = new \WP_User( 0 ); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $salt = maybe_serialize( $salt ); |
| 71 | 71 | $output = tlc_transient( 'fragment-cache-' . $this->type . '-' . $name . $salt ) |
| 72 | - ->updates_with( array( $this, 'wrap_callback' ), array( $name, $args ) ) |
|
| 72 | + ->updates_with( array($this, 'wrap_callback'), array($name, $args) ) |
|
| 73 | 73 | ->expires_in( $this->timeout ) |
| 74 | 74 | ->get(); |
| 75 | 75 | |
| 76 | - if ( ! empty( $stored_user ) ) {
|
|
| 76 | + if ( ! empty($stored_user) ) {
|
|
| 77 | 77 | $current_user = $stored_user; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -15,18 +15,18 @@ discard block |
||
| 15 | 15 | global $wp_version; |
| 16 | 16 | |
| 17 | 17 | if ( is_admin() ) {
|
| 18 | - add_action( 'admin_footer-nav-menus.php', array( $this, 'update_menus_edited' ) ); |
|
| 19 | - add_action( 'wp_ajax_menu-locations-save', array( $this, 'update_menus_edited' ), 0 ); |
|
| 20 | - add_action( 'wp_ajax_customize_save', array( $this, 'customize_save' ), 0 ); |
|
| 18 | + add_action( 'admin_footer-nav-menus.php', array($this, 'update_menus_edited') ); |
|
| 19 | + add_action( 'wp_ajax_menu-locations-save', array($this, 'update_menus_edited'), 0 ); |
|
| 20 | + add_action( 'wp_ajax_customize_save', array($this, 'customize_save'), 0 ); |
|
| 21 | 21 | |
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - add_filter( 'pre_wp_nav_menu', array( $this, 'pre_wp_nav_menu' ), 10, 2 ); |
|
| 26 | - add_filter( 'wp_nav_menu_objects', array( $this, 'wp_nav_menu_objects' ) ); |
|
| 25 | + add_filter( 'pre_wp_nav_menu', array($this, 'pre_wp_nav_menu'), 10, 2 ); |
|
| 26 | + add_filter( 'wp_nav_menu_objects', array($this, 'wp_nav_menu_objects') ); |
|
| 27 | 27 | |
| 28 | 28 | if ( version_compare( $wp_version, '3.9', '<' ) ) {
|
| 29 | - add_filter( 'wp_nav_menu_args', array( $this, 'wp_nav_menu_args' ), 20 ); |
|
| 29 | + add_filter( 'wp_nav_menu_args', array($this, 'wp_nav_menu_args'), 20 ); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | public function disable() {
|
| 37 | 37 | |
| 38 | 38 | if ( is_admin() ) {
|
| 39 | - remove_action( 'admin_footer-nav-menus.php', array( $this, 'update_menus_edited' ) ); |
|
| 40 | - remove_action( 'wp_ajax_menu-locations-save', array( $this, 'update_menus_edited' ), 0 ); |
|
| 41 | - remove_action( 'wp_ajax_customize_save', array( $this, 'customize_save' ), 0 ); |
|
| 39 | + remove_action( 'admin_footer-nav-menus.php', array($this, 'update_menus_edited') ); |
|
| 40 | + remove_action( 'wp_ajax_menu-locations-save', array($this, 'update_menus_edited'), 0 ); |
|
| 41 | + remove_action( 'wp_ajax_customize_save', array($this, 'customize_save'), 0 ); |
|
| 42 | 42 | |
| 43 | 43 | return; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - remove_filter( 'pre_wp_nav_menu', array( $this, 'pre_wp_nav_menu' ), 10 ); |
|
| 47 | - remove_filter( 'wp_nav_menu_objects', array( $this, 'wp_nav_menu_objects' ) ); |
|
| 48 | - remove_filter( 'wp_nav_menu_args', array( $this, 'wp_nav_menu_args' ), 20 ); |
|
| 46 | + remove_filter( 'pre_wp_nav_menu', array($this, 'pre_wp_nav_menu'), 10 ); |
|
| 47 | + remove_filter( 'wp_nav_menu_objects', array($this, 'wp_nav_menu_objects') ); |
|
| 48 | + remove_filter( 'wp_nav_menu_args', array($this, 'wp_nav_menu_args'), 20 ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $args['fc_menus_edited'] = get_option( 'fc_menus_edited' ); |
| 64 | 64 | $name = is_object( $args['menu'] ) ? $args['menu']->slug : $args['menu']; |
| 65 | 65 | |
| 66 | - if ( empty( $name ) && ! empty( $args['theme_location'] ) ) {
|
|
| 66 | + if ( empty($name) && ! empty($args['theme_location']) ) {
|
|
| 67 | 67 | $name = $args['theme_location']; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | _deprecated_function( __FUNCTION__, '1.3', 'Menu cache with arguments override unnecessary on WP >= 3.9.' ); |
| 85 | 85 | |
| 86 | - if ( empty( $args['kessel_run'] ) ) {
|
|
| 86 | + if ( empty($args['kessel_run']) ) {
|
|
| 87 | 87 | |
| 88 | 88 | add_filter( 'wp_get_nav_menus', '__return_empty_array' ); // These are not the droids you are looking for. |
| 89 | 89 | |
| 90 | 90 | $args = array( |
| 91 | 91 | 'menu' => '', |
| 92 | 92 | 'theme_location' => '', |
| 93 | - 'fallback_cb' => array( $this, 'fallback_cb' ), |
|
| 93 | + 'fallback_cb' => array($this, 'fallback_cb'), |
|
| 94 | 94 | 'original_args' => $args, |
| 95 | 95 | ); |
| 96 | 96 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | foreach ( $menu_items as $item_key => $item ) {
|
| 111 | 111 | foreach ( $item->classes as $class_key => $class ) {
|
| 112 | 112 | if ( 0 === stripos( $class, 'current' ) ) {
|
| 113 | - unset( $menu_items[ $item_key ]->classes[ $class_key ] ); |
|
| 113 | + unset($menu_items[$item_key]->classes[$class_key]); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function update_menus_edited() {
|
| 125 | 125 | |
| 126 | - if ( ! empty( $_POST ) ) {
|
|
| 126 | + if ( ! empty($_POST) ) {
|
|
| 127 | 127 | update_option( 'fc_menus_edited', time() ); |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $customized = filter_input( INPUT_POST, 'customized' ); |
| 137 | 137 | |
| 138 | - if ( empty( $customized ) ) {
|
|
| 138 | + if ( empty($customized) ) {
|
|
| 139 | 139 | return; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | remove_filter( 'wp_get_nav_menus', '__return_empty_array' ); |
| 170 | 170 | |
| 171 | 171 | $args = $args['original_args']; |
| 172 | - unset( $args['original_args'] ); |
|
| 172 | + unset($args['original_args']); |
|
| 173 | 173 | $echo = $args['echo']; |
| 174 | 174 | $args['echo'] = false; |
| 175 | 175 | $args['kessel_run'] = true; |
| 176 | 176 | $args['fc_menus_edited'] = get_option( 'fc_menus_edited' ); |
| 177 | 177 | $name = is_object( $args['menu'] ) ? $args['menu']->slug : $args['menu']; |
| 178 | 178 | |
| 179 | - if ( empty( $name ) && ! empty( $args['theme_location'] ) ) {
|
|
| 179 | + if ( empty($name) && ! empty($args['theme_location']) ) {
|
|
| 180 | 180 | $name = $args['theme_location']; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | protected function callback( $name, $args ) {
|
| 201 | 201 | |
| 202 | - remove_filter( 'pre_wp_nav_menu', array( $this, 'pre_wp_nav_menu' ), 10 ); |
|
| 202 | + remove_filter( 'pre_wp_nav_menu', array($this, 'pre_wp_nav_menu'), 10 ); |
|
| 203 | 203 | $output = wp_nav_menu( $args ) . $this->get_comment( $name ); |
| 204 | - add_filter( 'pre_wp_nav_menu', array( $this, 'pre_wp_nav_menu' ), 10, 2 ); |
|
| 204 | + add_filter( 'pre_wp_nav_menu', array($this, 'pre_wp_nav_menu'), 10, 2 ); |
|
| 205 | 205 | |
| 206 | 206 | return $output; |
| 207 | 207 | } |