@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 14 | +if (!defined('ABSPATH')) exit; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Recursive array class to allow multidimensional array access. |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param array $data |
| 41 | 41 | */ |
| 42 | - protected function __construct( $data = array() ) { |
|
| 43 | - foreach ( $data as $key => $value ) { |
|
| 44 | - $this[ $key ] = $value; |
|
| 42 | + protected function __construct($data = array()) { |
|
| 43 | + foreach ($data as $key => $value) { |
|
| 44 | + $this[$key] = $value; |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * Allow deep copies of objects |
| 50 | 50 | */ |
| 51 | 51 | public function __clone() { |
| 52 | - foreach ( $this->container as $key => $value ) { |
|
| 53 | - if ( $value instanceof self ) { |
|
| 54 | - $this[ $key ] = clone $value; |
|
| 52 | + foreach ($this->container as $key => $value) { |
|
| 53 | + if ($value instanceof self) { |
|
| 54 | + $this[$key] = clone $value; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function toArray() { |
| 65 | 65 | $data = $this->container; |
| 66 | - foreach ( $data as $key => $value ) { |
|
| 67 | - if ( $value instanceof self ) { |
|
| 68 | - $data[ $key ] = $value->toArray(); |
|
| 66 | + foreach ($data as $key => $value) { |
|
| 67 | + if ($value instanceof self) { |
|
| 68 | + $data[$key] = $value->toArray(); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | return $data; |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return boolean true on success or false on failure. |
| 86 | 86 | */ |
| 87 | - public function offsetExists( $offset ) { |
|
| 88 | - return isset( $this->container[ $offset ]) ; |
|
| 87 | + public function offsetExists($offset) { |
|
| 88 | + return isset($this->container[$offset]); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return mixed Can return all value types. |
| 99 | 99 | */ |
| 100 | - public function offsetGet( $offset ) { |
|
| 101 | - return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null; |
|
| 100 | + public function offsetGet($offset) { |
|
| 101 | + return isset($this->container[$offset]) ? $this->container[$offset] : null; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return void |
| 113 | 113 | */ |
| 114 | - public function offsetSet( $offset, $data ) { |
|
| 115 | - if ( is_array( $data ) ) { |
|
| 116 | - $data = new self( $data ); |
|
| 114 | + public function offsetSet($offset, $data) { |
|
| 115 | + if (is_array($data)) { |
|
| 116 | + $data = new self($data); |
|
| 117 | 117 | } |
| 118 | - if ( $offset === null ) { // don't forget this! |
|
| 118 | + if ($offset === null) { // don't forget this! |
|
| 119 | 119 | $this->container[] = $data; |
| 120 | 120 | } else { |
| 121 | - $this->container[ $offset ] = $data; |
|
| 121 | + $this->container[$offset] = $data; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $this->dirty = true; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | - public function offsetUnset( $offset ) { |
|
| 137 | - unset( $this->container[ $offset ] ); |
|
| 136 | + public function offsetUnset($offset) { |
|
| 137 | + unset($this->container[$offset]); |
|
| 138 | 138 | } |
| 139 | 139 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 14 | +if (!defined('ABSPATH')) exit; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Return the current cache expire setting. |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param string $data |
| 38 | 38 | */ |
| 39 | -function wp_session_decode( $data ) { |
|
| 39 | +function wp_session_decode($data) { |
|
| 40 | 40 | $wp_session = WP_Session::get_instance(); |
| 41 | 41 | |
| 42 | - return $wp_session->json_in( $data ); |
|
| 42 | + return $wp_session->json_in($data); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | -function wp_session_regenerate_id( $delete_old_session = false ) { |
|
| 63 | +function wp_session_regenerate_id($delete_old_session = false) { |
|
| 64 | 64 | $wp_session = WP_Session::get_instance(); |
| 65 | 65 | |
| 66 | - $wp_session->regenerate_id( $delete_old_session ); |
|
| 66 | + $wp_session->regenerate_id($delete_old_session); |
|
| 67 | 67 | |
| 68 | 68 | return true; |
| 69 | 69 | } |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function wp_session_start() { |
| 79 | 79 | $wp_session = WP_Session::get_instance(); |
| 80 | - do_action( 'wp_session_start' ); |
|
| 80 | + do_action('wp_session_start'); |
|
| 81 | 81 | |
| 82 | 82 | return $wp_session->session_started(); |
| 83 | 83 | } |
| 84 | -add_action( 'plugins_loaded', 'wp_session_start' ); |
|
| 84 | +add_action('plugins_loaded', 'wp_session_start'); |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Return the current session status. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | function wp_session_status() { |
| 92 | 92 | $wp_session = WP_Session::get_instance(); |
| 93 | 93 | |
| 94 | - if ( $wp_session->session_started() ) { |
|
| 94 | + if ($wp_session->session_started()) { |
|
| 95 | 95 | return PHP_SESSION_ACTIVE; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $wp_session = WP_Session::get_instance(); |
| 115 | 115 | |
| 116 | 116 | $wp_session->write_data(); |
| 117 | - do_action( 'wp_session_commit' ); |
|
| 117 | + do_action('wp_session_commit'); |
|
| 118 | 118 | } |
| 119 | -add_action( 'shutdown', 'wp_session_write_close' ); |
|
| 119 | +add_action('shutdown', 'wp_session_write_close'); |
|
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Clean up expired sessions by removing data and their expiration entries from |
@@ -128,51 +128,51 @@ discard block |
||
| 128 | 128 | function wp_session_cleanup() { |
| 129 | 129 | global $wpdb; |
| 130 | 130 | |
| 131 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
| 131 | + if (defined('WP_SETUP_CONFIG')) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( ! defined( 'WP_INSTALLING' ) ) { |
|
| 136 | - $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" ); |
|
| 135 | + if (!defined('WP_INSTALLING')) { |
|
| 136 | + $expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'"); |
|
| 137 | 137 | |
| 138 | - $now = current_time( 'timestamp' ); |
|
| 138 | + $now = current_time('timestamp'); |
|
| 139 | 139 | $expired_sessions = array(); |
| 140 | 140 | |
| 141 | - foreach( $expiration_keys as $expiration ) { |
|
| 141 | + foreach ($expiration_keys as $expiration) { |
|
| 142 | 142 | |
| 143 | 143 | // If the session has expired |
| 144 | - if ( $now > intval( $expiration->option_value ) ) { |
|
| 144 | + if ($now > intval($expiration->option_value)) { |
|
| 145 | 145 | |
| 146 | 146 | // Get the session ID by parsing the option_name |
| 147 | - $session_id = substr( $expiration->option_name, 20 ); |
|
| 147 | + $session_id = substr($expiration->option_name, 20); |
|
| 148 | 148 | |
| 149 | - if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) { |
|
| 149 | + if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) { |
|
| 150 | 150 | continue; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $expired_sessions[] = $expiration->option_name; |
| 154 | - $expired_sessions[] = esc_sql( "_wp_session_$session_id" ); |
|
| 154 | + $expired_sessions[] = esc_sql("_wp_session_$session_id"); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Delete all expired sessions in a single query |
| 159 | - if ( ! empty( $expired_sessions ) ) { |
|
| 160 | - $option_names = implode( "','", $expired_sessions ); |
|
| 161 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" ); |
|
| 159 | + if (!empty($expired_sessions)) { |
|
| 160 | + $option_names = implode("','", $expired_sessions); |
|
| 161 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Allow other plugins to hook in to the garbage collection process. |
| 166 | - do_action( 'wp_session_cleanup' ); |
|
| 166 | + do_action('wp_session_cleanup'); |
|
| 167 | 167 | } |
| 168 | -add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' ); |
|
| 168 | +add_action('wp_session_garbage_collection', 'wp_session_cleanup'); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Register the garbage collector as a twice daily event. |
| 172 | 172 | */ |
| 173 | 173 | function wp_session_register_garbage_collection() { |
| 174 | - if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { |
|
| 175 | - wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' ); |
|
| 174 | + if (!wp_next_scheduled('wp_session_garbage_collection')) { |
|
| 175 | + wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection'); |
|
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | -add_action( 'wp', 'wp_session_register_garbage_collection' ); |
|
| 178 | +add_action('wp', 'wp_session_register_garbage_collection'); |
|
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | public function form($instance) |
| 138 | 138 | { |
| 139 | 139 | //widgetform in backend |
| 140 | - $instance = wp_parse_args((array)$instance, |
|
| 140 | + $instance = wp_parse_args((array) $instance, |
|
| 141 | 141 | array('title' => '', |
| 142 | 142 | 'list_sort' => '', |
| 143 | 143 | 'list_order' => '', |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | ?> |
| 171 | 171 | <p> |
| 172 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
| 172 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
| 173 | 173 | |
| 174 | 174 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
| 175 | 175 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | </p> |
| 179 | 179 | <p> |
| 180 | 180 | <label |
| 181 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
| 181 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
| 182 | 182 | |
| 183 | 183 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
| 184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | </p> |
| 209 | 209 | <p> |
| 210 | 210 | <label |
| 211 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
| 211 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
| 212 | 212 | |
| 213 | 213 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
| 214 | 214 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | </p> |
| 218 | 218 | <p> |
| 219 | 219 | <label for="<?php echo $this->get_field_id('relate_to'); ?>"> |
| 220 | - <?php _e('Relate to:', 'geodirectory');?> |
|
| 220 | + <?php _e('Relate to:', 'geodirectory'); ?> |
|
| 221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
| 222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
| 223 | 223 | <option <?php if ($relate_to == 'category') { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | <p> |
| 233 | 233 | <p> |
| 234 | 234 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
| 235 | - <?php _e('Layout:', 'geodirectory');?> |
|
| 235 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
| 236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
| 237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
| 238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | </p> |
| 261 | 261 | <p> |
| 262 | 262 | <label |
| 263 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
| 263 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
| 264 | 264 | |
| 265 | 265 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
| 266 | 266 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | </p> |
| 270 | 270 | <p> |
| 271 | 271 | <label |
| 272 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
| 272 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
| 273 | 273 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
| 274 | 274 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
| 275 | 275 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -277,9 +277,9 @@ discard block |
||
| 277 | 277 | </p> |
| 278 | 278 | <p> |
| 279 | 279 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
| 280 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
| 280 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
| 281 | 281 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
| 282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
| 282 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
| 283 | 283 | value="1"/> |
| 284 | 284 | </label> |
| 285 | 285 | </p> |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | 'posts_per_page' => 1, |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | - $all_posts = new WP_Query( $query_args ); |
|
| 17 | + $all_posts = new WP_Query($query_args); |
|
| 18 | 18 | $post_id = null; |
| 19 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 19 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 20 | 20 | $post_id = get_the_ID(); |
| 21 | 21 | endwhile; |
| 22 | 22 | |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | 'posts_per_page' => 1, |
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | - $all_posts = new WP_Query( $query_args ); |
|
| 48 | + $all_posts = new WP_Query($query_args); |
|
| 49 | 49 | $post_id = null; |
| 50 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 50 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 51 | 51 | $post_id = get_the_ID(); |
| 52 | 52 | endwhile; |
| 53 | 53 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | 'posts_per_page' => 1, |
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - $all_posts = new WP_Query( $query_args ); |
|
| 81 | + $all_posts = new WP_Query($query_args); |
|
| 82 | 82 | $post_id = null; |
| 83 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 83 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 84 | 84 | $post_id = get_the_ID(); |
| 85 | 85 | endwhile; |
| 86 | 86 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | ob_start(); |
| 104 | 104 | geodir_send_friend($data); |
| 105 | 105 | $output = ob_get_clean(); |
| 106 | - $this->assertContains( 'Email from GeoDirectory failed to send', $output ); |
|
| 106 | + $this->assertContains('Email from GeoDirectory failed to send', $output); |
|
| 107 | 107 | remove_filter('wp_mail', 'print_mail'); |
| 108 | 108 | remove_filter('wp_redirect', '__return_false'); |
| 109 | 109 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | // reset the wpdb queries log, storing it on the profile stack if necessary |
| 41 | 41 | global $wpdb; |
| 42 | 42 | if ($this->stack) { |
| 43 | - $this->stack[count($this->stack)-1]['queries'] = $wpdb->queries; |
|
| 43 | + $this->stack[count($this->stack) - 1]['queries'] = $wpdb->queries; |
|
| 44 | 44 | } |
| 45 | 45 | $wpdb->queries = array(); |
| 46 | 46 | |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if (isset($this->profile[$name])) { |
| 76 | 76 | $this->profile[$name]['time'] += $time; |
| 77 | - $this->profile[$name]['calls'] ++; |
|
| 77 | + $this->profile[$name]['calls']++; |
|
| 78 | 78 | $this->profile[$name]['cache_cold_hits'] += ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']); |
| 79 | 79 | $this->profile[$name]['cache_warm_hits'] += ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']); |
| 80 | 80 | $this->profile[$name]['cache_misses'] += ($wp_object_cache->cache_misses - $item['cache_misses']); |
| 81 | - $this->profile[$name]['cache_dirty_objects'] = array_add( $this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta) ; |
|
| 82 | - $this->profile[$name]['actions'] = array_add( $this->profile[$name]['actions'], $item['actions'] ); |
|
| 83 | - $this->profile[$name]['filters'] = array_add( $this->profile[$name]['filters'], $item['filters'] ); |
|
| 84 | - $this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] ); |
|
| 81 | + $this->profile[$name]['cache_dirty_objects'] = array_add($this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta); |
|
| 82 | + $this->profile[$name]['actions'] = array_add($this->profile[$name]['actions'], $item['actions']); |
|
| 83 | + $this->profile[$name]['filters'] = array_add($this->profile[$name]['filters'], $item['filters']); |
|
| 84 | + $this->profile[$name]['queries'] = array_add($this->profile[$name]['queries'], $item['queries']); |
|
| 85 | 85 | #$this->_query_summary($item['queries'], $this->profile[$name]['queries']); |
| 86 | 86 | |
| 87 | 87 | } |
@@ -109,28 +109,28 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | function microtime($since = 0.0) { |
| 111 | 111 | list($usec, $sec) = explode(' ', microtime()); |
| 112 | - return (float)$sec + (float)$usec - $since; |
|
| 112 | + return (float) $sec + (float) $usec - $since; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | function log_filter($tag) { |
| 116 | 116 | if ($this->stack) { |
| 117 | 117 | global $wp_actions; |
| 118 | 118 | if ($tag == end($wp_actions)) |
| 119 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
| 119 | + @$this->stack[count($this->stack) - 1]['actions'][$tag]++; |
|
| 120 | 120 | else |
| 121 | - @$this->stack[count($this->stack)-1]['filters'][$tag] ++; |
|
| 121 | + @$this->stack[count($this->stack) - 1]['filters'][$tag]++; |
|
| 122 | 122 | } |
| 123 | 123 | return $arg; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | function log_action($tag) { |
| 127 | 127 | if ($this->stack) |
| 128 | - @$this->stack[count($this->stack)-1]['actions'][$tag] ++; |
|
| 128 | + @$this->stack[count($this->stack) - 1]['actions'][$tag]++; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | function _current_action() { |
| 132 | 132 | global $wp_actions; |
| 133 | - return $wp_actions[count($wp_actions)-1]; |
|
| 133 | + return $wp_actions[count($wp_actions) - 1]; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | function results() { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $sql = preg_replace('/(WHERE \w+ =) \d+/', '$1 x', $sql); |
| 144 | 144 | $sql = preg_replace('/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql); |
| 145 | 145 | |
| 146 | - @$out[$sql] ++; |
|
| 146 | + @$out[$sql]++; |
|
| 147 | 147 | } |
| 148 | 148 | asort($out); |
| 149 | 149 | return; |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | $out = array(); |
| 155 | 155 | foreach ($queries as $q) { |
| 156 | 156 | if (empty($q[2])) |
| 157 | - @$out['unknown'] ++; |
|
| 157 | + @$out['unknown']++; |
|
| 158 | 158 | else |
| 159 | - @$out[$q[2]] ++; |
|
| 159 | + @$out[$q[2]]++; |
|
| 160 | 160 | } |
| 161 | 161 | return $out; |
| 162 | 162 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (class_exists( 'WP_Image_Editor' ) ) : |
|
| 3 | +if (class_exists('WP_Image_Editor')) : |
|
| 4 | 4 | |
| 5 | 5 | class WP_Image_Editor_Mock extends WP_Image_Editor { |
| 6 | 6 | |
@@ -9,38 +9,38 @@ discard block |
||
| 9 | 9 | public static $save_return = array(); |
| 10 | 10 | |
| 11 | 11 | // Allow testing of jpeg_quality filter. |
| 12 | - public function set_mime_type( $mime_type = null ) { |
|
| 12 | + public function set_mime_type($mime_type = null) { |
|
| 13 | 13 | $this->mime_type = $mime_type; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function load() { |
| 17 | 17 | return self::$load_return; |
| 18 | 18 | } |
| 19 | - public static function test( $args = array() ) { |
|
| 19 | + public static function test($args = array()) { |
|
| 20 | 20 | return self::$test_return; |
| 21 | 21 | } |
| 22 | - public static function supports_mime_type( $mime_type ) { |
|
| 22 | + public static function supports_mime_type($mime_type) { |
|
| 23 | 23 | return true; |
| 24 | 24 | } |
| 25 | - public function resize( $max_w, $max_h, $crop = false ) { |
|
| 25 | + public function resize($max_w, $max_h, $crop = false) { |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | - public function multi_resize( $sizes ) { |
|
| 28 | + public function multi_resize($sizes) { |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | - public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) { |
|
| 31 | + public function crop($src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false) { |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | - public function rotate( $angle ) { |
|
| 34 | + public function rotate($angle) { |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | - public function flip( $horz, $vert ) { |
|
| 37 | + public function flip($horz, $vert) { |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | - public function save( $destfilename = null, $mime_type = null ) { |
|
| 40 | + public function save($destfilename = null, $mime_type = null) { |
|
| 41 | 41 | return self::$save_return; |
| 42 | 42 | } |
| 43 | - public function stream( $mime_type = null ) { |
|
| 43 | + public function stream($mime_type = null) { |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | abstract class WP_Test_REST_TestCase extends WP_UnitTestCase { |
| 4 | - protected function assertErrorResponse( $code, $response, $status = null ) { |
|
| 4 | + protected function assertErrorResponse($code, $response, $status = null) { |
|
| 5 | 5 | |
| 6 | - if ( is_a( $response, 'WP_REST_Response' ) ) { |
|
| 6 | + if (is_a($response, 'WP_REST_Response')) { |
|
| 7 | 7 | $response = $response->as_error(); |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - $this->assertInstanceOf( 'WP_Error', $response ); |
|
| 11 | - $this->assertEquals( $code, $response->get_error_code() ); |
|
| 10 | + $this->assertInstanceOf('WP_Error', $response); |
|
| 11 | + $this->assertEquals($code, $response->get_error_code()); |
|
| 12 | 12 | |
| 13 | - if ( null !== $status ) { |
|
| 13 | + if (null !== $status) { |
|
| 14 | 14 | $data = $response->get_error_data(); |
| 15 | - $this->assertArrayHasKey( 'status', $data ); |
|
| 16 | - $this->assertEquals( $status, $data['status'] ); |
|
| 15 | + $this->assertArrayHasKey('status', $data); |
|
| 16 | + $this->assertEquals($status, $data['status']); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | } |
@@ -21,18 +21,18 @@ |
||
| 21 | 21 | * @param array $args Arguments to pass to the method |
| 22 | 22 | * @return mixed |
| 23 | 23 | */ |
| 24 | - public function __call( $method, $args ) { |
|
| 25 | - return call_user_func_array( array( $this, $method ), $args ); |
|
| 24 | + public function __call($method, $args) { |
|
| 25 | + return call_user_func_array(array($this, $method), $args); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function send_header( $header, $value ) { |
|
| 29 | - $this->sent_headers[ $header ] = $value; |
|
| 28 | + public function send_header($header, $value) { |
|
| 29 | + $this->sent_headers[$header] = $value; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function serve_request( $path = null ) { |
|
| 32 | + public function serve_request($path = null) { |
|
| 33 | 33 | |
| 34 | 34 | ob_start(); |
| 35 | - $result = parent::serve_request( $path ); |
|
| 35 | + $result = parent::serve_request($path); |
|
| 36 | 36 | $this->sent_body = ob_get_clean(); |
| 37 | 37 | return $result; |
| 38 | 38 | } |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | 's' => 'Longwood Gardens' |
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | - $all_posts = new WP_Query( $query_args ); |
|
| 19 | + $all_posts = new WP_Query($query_args); |
|
| 20 | 20 | |
| 21 | 21 | $total_posts = $all_posts->found_posts; |
| 22 | 22 | |
| 23 | 23 | $this->assertTrue(is_int((int) $total_posts)); |
| 24 | 24 | |
| 25 | 25 | $title = null; |
| 26 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 26 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 27 | 27 | $title = get_the_title(); |
| 28 | 28 | endwhile; |
| 29 | 29 | |