@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public static function register_query( $slug, array $args, array $data = array() ) { |
| 93 | 93 | |
| 94 | - if ( empty( $slug ) || isset( self::$queries[ $slug ] ) ) { |
|
| 94 | + if ( empty( $slug ) || isset( self::$queries[$slug] ) ) { |
|
| 95 | 95 | return false; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | 'network_wide' => false, |
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - self::$queries[ $slug ] = array_merge( $defaults, $data ); |
|
| 105 | - self::$queries[ $slug ]['args'] = $args; |
|
| 104 | + self::$queries[$slug] = array_merge( $defaults, $data ); |
|
| 105 | + self::$queries[$slug]['args'] = $args; |
|
| 106 | 106 | |
| 107 | 107 | return true; |
| 108 | 108 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | self::init(); |
| 122 | 122 | |
| 123 | - return isset( self::$queries[ $slug ] ); |
|
| 123 | + return isset( self::$queries[$slug] ); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | self::init(); |
| 168 | 168 | |
| 169 | - if ( isset( self::$queries[ $query_slug ] ) ) { |
|
| 169 | + if ( isset( self::$queries[$query_slug] ) ) { |
|
| 170 | 170 | |
| 171 | 171 | if ( empty( $data ) ) { |
| 172 | - return self::$queries[ $query_slug ]; |
|
| 173 | - } elseif ( isset( self::$queries[ $query_slug ][ $data ] ) ) { |
|
| 174 | - return self::$queries[ $query_slug ][ $data ]; |
|
| 172 | + return self::$queries[$query_slug]; |
|
| 173 | + } elseif ( isset( self::$queries[$query_slug][$data] ) ) { |
|
| 174 | + return self::$queries[$query_slug][$data]; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $option = 'wordpoints_legacy_points_hooks_disabled'; |
| 239 | 239 | |
| 240 | 240 | $disabled = $this->get_array_option( $option ); |
| 241 | - $disabled[ $this->legacy_id_base ] = true; |
|
| 241 | + $disabled[$this->legacy_id_base] = true; |
|
| 242 | 242 | |
| 243 | 243 | $this->update_option( $option, $disabled ); |
| 244 | 244 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $order = array_search( |
| 287 | 287 | $this->legacy_handler->get_id() |
| 288 | - , $this->points_types_hooks[ $points_type ] |
|
| 288 | + , $this->points_types_hooks[$points_type] |
|
| 289 | 289 | , true |
| 290 | 290 | ); |
| 291 | 291 | |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | $this->legacy_handler->delete_callback( $number ); |
| 308 | 308 | |
| 309 | 309 | unset( |
| 310 | - $this->points_types_hooks[ $points_type ][ $order ] |
|
| 311 | - , $this->legacy_instances[ $number ] |
|
| 310 | + $this->points_types_hooks[$points_type][$order] |
|
| 311 | + , $this->legacy_instances[$number] |
|
| 312 | 312 | ); |
| 313 | 313 | |
| 314 | 314 | return true; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if ( $this->instance && isset( $this->instance['columns'] ) ) { |
| 131 | 131 | foreach ( $this->defaults['columns'] as $column => $unused ) { |
| 132 | - if ( empty( $this->instance['columns'][ $column ] ) ) { |
|
| 132 | + if ( empty( $this->instance['columns'][$column] ) ) { |
|
| 133 | 133 | $classes[] = "wordpoints-hide-{$column}-column"; |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | foreach ( $this->instance['columns'] as $column => $value ) { |
| 169 | 169 | |
| 170 | - if ( ! isset( $this->defaults['columns'][ $column ] ) ) { |
|
| 171 | - unset( $this->instance['columns'][ $column ] ); |
|
| 170 | + if ( ! isset( $this->defaults['columns'][$column] ) ) { |
|
| 171 | + unset( $this->instance['columns'][$column] ); |
|
| 172 | 172 | } elseif ( $value ) { |
| 173 | - $this->instance['columns'][ $column ] = '1'; |
|
| 173 | + $this->instance['columns'][$column] = '1'; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if ( ! isset( $points_types[ $points_type ] ) ) { |
|
| 44 | + if ( ! isset( $points_types[$points_type] ) ) { |
|
| 45 | 45 | $reaction_store->delete_reaction( $reaction->get_id() ); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | foreach ( $conditions as $action_type => $args ) { |
| 55 | - $conditions[ $action_type ] = $this->walk_args( $args ); |
|
| 55 | + $conditions[$action_type] = $this->walk_args( $args ); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if ( $this->changed ) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $args[ $arg_slug ] = $this->walk_args( $sub_args ); |
|
| 89 | + $args[$arg_slug] = $this->walk_args( $sub_args ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $args; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $conditions[ $index ] = $condition; |
|
| 114 | + $conditions[$index] = $condition; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | return $conditions; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $post_publish_log_id = min( array_keys( $original_log_ids ) ); |
| 52 | 52 | $post_update_log_id = max( array_keys( $original_log_ids ) ); |
| 53 | - $post_publish_reverse_log_id = $original_log_ids[ $post_publish_log_id ]; |
|
| 54 | - $post_update_reverse_log_id = $original_log_ids[ $post_update_log_id ]; |
|
| 53 | + $post_publish_reverse_log_id = $original_log_ids[$post_publish_log_id]; |
|
| 54 | + $post_update_reverse_log_id = $original_log_ids[$post_update_log_id]; |
|
| 55 | 55 | |
| 56 | 56 | $query = new WordPoints_Points_Logs_Query( |
| 57 | 57 | array( 'id__in' => array( $post_publish_reverse_log_id ) ) |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | foreach ( $post_ids as $post_id ) { |
| 107 | 107 | |
| 108 | - if ( ! isset( $legacy_logs[ $post_id ] ) ) { |
|
| 108 | + if ( ! isset( $legacy_logs[$post_id] ) ) { |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - array_map( array( $this, 'revert_log' ), $legacy_logs[ $post_id ] ); |
|
| 112 | + array_map( array( $this, 'revert_log' ), $legacy_logs[$post_id] ); |
|
| 113 | 113 | |
| 114 | 114 | $logs_to_delete = array_merge( |
| 115 | 115 | $logs_to_delete |
| 116 | - , wp_list_pluck( $legacy_logs[ $post_id ], 'id' ) |
|
| 116 | + , wp_list_pluck( $legacy_logs[$post_id], 'id' ) |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - unset( $legacy_logs[ $post_id ] ); |
|
| 119 | + unset( $legacy_logs[$post_id] ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | foreach ( $legacy_logs as $logs ) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $event_slugs = array(); |
| 179 | 179 | |
| 180 | 180 | foreach ( $post_types as $slug ) { |
| 181 | - $event_slugs[ "reverse-post_publish\\{$slug}" ] = true; |
|
| 181 | + $event_slugs["reverse-post_publish\\{$slug}"] = true; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | return $event_slugs; |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | , true |
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | - $original_log_ids[ $original_log_id ] = $log_id; |
|
| 237 | + $original_log_ids[$original_log_id] = $log_id; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $original_log_ids; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | , true |
| 373 | 373 | ); |
| 374 | 374 | |
| 375 | - $reversal_logs[ $original_log_id ] = $log; |
|
| 375 | + $reversal_logs[$original_log_id] = $log; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | foreach ( $other_logs as $index => $log ) { |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | // of its occurrence, it is almost certainly the result of another |
| 382 | 382 | // update, and it is just cluttering things up. |
| 383 | 383 | if ( |
| 384 | - isset( $reversal_logs[ $log->id ] ) |
|
| 385 | - && strtotime( $reversal_logs[ $log->id ]->date ) - strtotime( $log->date ) < 2 |
|
| 384 | + isset( $reversal_logs[$log->id] ) |
|
| 385 | + && strtotime( $reversal_logs[$log->id]->date ) - strtotime( $log->date ) < 2 |
|
| 386 | 386 | ) { |
| 387 | 387 | $logs_to_delete[] = $log->id; |
| 388 | - $logs_to_delete[] = $reversal_logs[ $log->id ]->id; |
|
| 388 | + $logs_to_delete[] = $reversal_logs[$log->id]->id; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | , true |
| 467 | 467 | ); |
| 468 | 468 | |
| 469 | - $legacy_logs[ $post_id ][] = $legacy_log; |
|
| 469 | + $legacy_logs[$post_id][] = $legacy_log; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | return $legacy_logs; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | foreach ( $instances as $number => $settings ) { |
| 104 | 104 | |
| 105 | 105 | // Don't split the hook if it is just a placeholder, or it's already split. |
| 106 | - if ( 0 === (int) $number || ! isset( $settings[ $key ], $settings[ $split_key ] ) ) { |
|
| 106 | + if ( 0 === (int) $number || ! isset( $settings[$key], $settings[$split_key] ) ) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // If the trash points are set, create a post delete points hook instead. |
| 115 | - if ( isset( $settings[ $split_key ] ) && wordpoints_posint( $settings[ $split_key ] ) ) { |
|
| 115 | + if ( isset( $settings[$split_key] ) && wordpoints_posint( $settings[$split_key] ) ) { |
|
| 116 | 116 | |
| 117 | 117 | $new_hook->update_callback( |
| 118 | 118 | array( |
| 119 | - 'points' => $settings[ $split_key ], |
|
| 119 | + 'points' => $settings[$split_key], |
|
| 120 | 120 | 'post_type' => $settings['post_type'], |
| 121 | 121 | ) |
| 122 | 122 | , $new_hook->next_hook_id_number() |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | $points_type = $hook->points_type( $network_ . $number ); |
| 127 | 127 | |
| 128 | 128 | // Add this instance to the points-types-hooks list. |
| 129 | - $points_types_hooks[ $points_type ][] = $new_hook->get_id( $number ); |
|
| 129 | + $points_types_hooks[$points_type][] = $new_hook->get_id( $number ); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // If the publish points are set, update the settings of the hook. |
| 133 | - if ( isset( $settings[ $key ] ) && wordpoints_posint( $settings[ $key ] ) ) { |
|
| 133 | + if ( isset( $settings[$key] ) && wordpoints_posint( $settings[$key] ) ) { |
|
| 134 | 134 | |
| 135 | - $settings['points'] = $settings[ $key ]; |
|
| 135 | + $settings['points'] = $settings[$key]; |
|
| 136 | 136 | |
| 137 | 137 | $hook->update_callback( $settings, $number ); |
| 138 | 138 | |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | $instance = array_merge( $defaults, $instance ); |
| 103 | 103 | |
| 104 | 104 | $hook_instances_indexed |
| 105 | - [ $hook->points_type( $network_ . $number ) ] |
|
| 106 | - [ $instance['post_type'] ] |
|
| 107 | - [ $instance['points'] ] |
|
| 105 | + [$hook->points_type( $network_ . $number )] |
|
| 106 | + [$instance['post_type']] |
|
| 107 | + [$instance['points']] |
|
| 108 | 108 | [] = $number; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -116,19 +116,19 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // We use empty() instead of isset() because array_pop() below may leave |
| 118 | 118 | // us with an empty array as the value. |
| 119 | - if ( empty( $hook_instances_indexed[ $points_type ][ $instance['post_type'] ][ $instance['points'] ] ) ) { |
|
| 119 | + if ( empty( $hook_instances_indexed[$points_type][$instance['post_type']][$instance['points']] ) ) { |
|
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $comment_instance_number = array_pop( |
| 124 | - $hook_instances_indexed[ $points_type ][ $instance['post_type'] ][ $instance['points'] ] |
|
| 124 | + $hook_instances_indexed[$points_type][$instance['post_type']][$instance['points']] |
|
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | // We need to unset this instance from the list of hook instances. It |
| 128 | 128 | // is expected for it to be automatically reversed, and that is the |
| 129 | 129 | // default setting. If we don't unset it here it will get auto-reversal |
| 130 | 130 | // turned off below, which isn't what we want. |
| 131 | - unset( $hook_instances[ $comment_instance_number ] ); |
|
| 131 | + unset( $hook_instances[$comment_instance_number] ); |
|
| 132 | 132 | |
| 133 | 133 | // Now we can just delete this reverse hook instance. |
| 134 | 134 | $reverse_hook->delete_callback( |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $points_types = wordpoints_get_points_types(); |
| 43 | 43 | |
| 44 | - if ( ! isset( $points_types[ $this->slug ] ) ) { |
|
| 44 | + if ( ! isset( $points_types[$this->slug] ) ) { |
|
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param string $slug The slug of the points type being deleted. |
| 54 | 54 | * @param array $settings The settings of the points type being deleted. |
| 55 | 55 | */ |
| 56 | - do_action( 'wordpoints_delete_points_type', $this->slug, $points_types[ $this->slug ] ); |
|
| 56 | + do_action( 'wordpoints_delete_points_type', $this->slug, $points_types[$this->slug] ); |
|
| 57 | 57 | |
| 58 | 58 | $meta_key = wordpoints_get_points_user_meta_key( $this->slug ); |
| 59 | 59 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | parent::run(); |
| 82 | 82 | |
| 83 | - unset( $points_types[ $this->slug ] ); |
|
| 83 | + unset( $points_types[$this->slug] ); |
|
| 84 | 84 | |
| 85 | 85 | wordpoints_update_maybe_network_option( |
| 86 | 86 | 'wordpoints_points_types' |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | // Delete hooks associated with this points type. |
| 124 | 124 | $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks(); |
| 125 | 125 | |
| 126 | - unset( $points_types_hooks[ $this->slug ] ); |
|
| 126 | + unset( $points_types_hooks[$this->slug] ); |
|
| 127 | 127 | |
| 128 | 128 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); |
| 129 | 129 | |