@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $points_types_hooks = WordPoints_Points_Hooks::get_defaults(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -if ( isset( $points_types_hooks[ $points_type_id ] ) ) { |
|
| 43 | - $points_type_hooks = $points_types_hooks[ $points_type_id ]; |
|
| 42 | +if ( isset( $points_types_hooks[$points_type_id] ) ) { |
|
| 43 | + $points_type_hooks = $points_types_hooks[$points_type_id]; |
|
| 44 | 44 | } else { |
| 45 | 45 | $points_type_hooks = array(); |
| 46 | 46 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Remove the hook from this points type. |
| 62 | - $points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) ); |
|
| 62 | + $points_types_hooks[$points_type_id] = array_diff( $points_type_hooks, array( $hook_id ) ); |
|
| 63 | 63 | |
| 64 | 64 | $hook->delete_callback( $hook_id ); |
| 65 | 65 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | } else { |
| 85 | 85 | |
| 86 | - if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) { |
|
| 87 | - $new_instance = wp_unslash( reset( $_POST[ 'hook-' . $id_base ] ) ); // WPCS sanitization OK. |
|
| 86 | + if ( isset( $_POST['hook-' . $id_base] ) && is_array( $_POST['hook-' . $id_base] ) ) { |
|
| 87 | + $new_instance = wp_unslash( reset( $_POST['hook-' . $id_base] ) ); // WPCS sanitization OK. |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $number = $hook->get_number_by_id( $hook_id ); |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | if ( ! in_array( $hook_id, $points_type_hooks, true ) ) { |
| 103 | 103 | |
| 104 | 104 | $points_type_hooks[] = $hook_id; |
| 105 | - $points_types_hooks[ $points_type_id ] = $points_type_hooks; |
|
| 105 | + $points_types_hooks[$points_type_id] = $points_type_hooks; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Remove from old points type if it has changed. |
| 109 | 109 | $old_points_type = WordPoints_Points_Hooks::get_points_type( $hook_id ); |
| 110 | 110 | |
| 111 | - if ( $old_points_type && $old_points_type !== $points_type_id && is_array( $points_types_hooks[ $old_points_type ] ) ) { |
|
| 111 | + if ( $old_points_type && $old_points_type !== $points_type_id && is_array( $points_types_hooks[$old_points_type] ) ) { |
|
| 112 | 112 | |
| 113 | - $points_types_hooks[ $old_points_type ] = array_diff( $points_types_hooks[ $old_points_type ], array( $hook_id ) ); |
|
| 113 | + $points_types_hooks[$old_points_type] = array_diff( $points_types_hooks[$old_points_type], array( $hook_id ) ); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | } else { |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | foreach ( $points_types as $slug => $settings ) { |
| 49 | 49 | |
| 50 | - $tabs[ $slug ] = $settings['name']; |
|
| 50 | + $tabs[$slug] = $settings['name']; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | wordpoints_admin_show_tabs( $tabs, false ); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | foreach ( array_keys( wordpoints_get_points_types() ) as $points_type ) { |
| 48 | 48 | |
| 49 | - if ( empty( $_POST['points_types'][ $points_type ] ) ) { |
|
| 49 | + if ( empty( $_POST['points_types'][$points_type] ) ) { |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][ $points_type ] ) ); |
|
| 53 | + $hooks = sanitize_text_field( wp_unslash( $_POST['points_types'][$points_type] ) ); |
|
| 54 | 54 | |
| 55 | 55 | $points_type_hooks = array(); |
| 56 | 56 | |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $points_type_hooks[ $order ] = substr( $hook_id, strpos( $hook_id, '_' ) + 1 ); |
|
| 65 | + $points_type_hooks[$order] = substr( $hook_id, strpos( $hook_id, '_' ) + 1 ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $points_types_hooks[ $points_type ] = $points_type_hooks; |
|
| 68 | + $points_types_hooks[$points_type] = $points_type_hooks; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $settings = false; |
| 191 | 191 | |
| 192 | - if ( isset( $_POST[ 'hook-' . $id_base ] ) && is_array( $_POST[ 'hook-' . $id_base ] ) ) { |
|
| 193 | - $settings = wp_unslash( $_POST[ 'hook-' . $id_base ] ); // WPCS: sanitization OK. |
|
| 192 | + if ( isset( $_POST['hook-' . $id_base] ) && is_array( $_POST['hook-' . $id_base] ) ) { |
|
| 193 | + $settings = wp_unslash( $_POST['hook-' . $id_base] ); // WPCS: sanitization OK. |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | $points_types_hooks = WordPoints_Points_Hooks::get_points_types_hooks(); |
| 197 | 197 | |
| 198 | 198 | // Get the hooks for this points type. |
| 199 | - $points_type_hooks = ( isset( $points_types_hooks[ $points_type_id ] ) ) ? $points_types_hooks[ $points_type_id ] : array(); |
|
| 199 | + $points_type_hooks = ( isset( $points_types_hooks[$points_type_id] ) ) ? $points_types_hooks[$points_type_id] : array(); |
|
| 200 | 200 | |
| 201 | 201 | if ( ! empty( $_POST['delete_hook'] ) ) { |
| 202 | 202 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $hook->delete_callback( $number ); |
| 210 | 210 | |
| 211 | 211 | // Remove this instance of the hook, and reset the positions (keys). |
| 212 | - $points_types_hooks[ $points_type_id ] = array_diff( $points_type_hooks, array( $hook_id ) ); |
|
| 212 | + $points_types_hooks[$points_type_id] = array_diff( $points_type_hooks, array( $hook_id ) ); |
|
| 213 | 213 | |
| 214 | 214 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); |
| 215 | 215 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | // Save the points types-hooks associations. |
| 232 | 232 | $points_type_hooks[] = $hook->get_id( $number ); |
| 233 | - $points_types_hooks[ $points_type_id ] = $points_type_hooks; |
|
| 233 | + $points_types_hooks[$points_type_id] = $points_type_hooks; |
|
| 234 | 234 | WordPoints_Points_Hooks::save_points_types_hooks( $points_types_hooks ); |
| 235 | 235 | |
| 236 | 236 | } else { |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function get_points_logs_to_be_reversed( WordPoints_Hook_Fire $fire ) { |
| 67 | 67 | |
| 68 | - if ( isset( $fire->data[ $this->slug ]['points_logs'] ) ) { |
|
| 69 | - return $fire->data[ $this->slug ]['points_logs']; |
|
| 68 | + if ( isset( $fire->data[$this->slug]['points_logs'] ) ) { |
|
| 69 | + return $fire->data[$this->slug]['points_logs']; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $meta_queries = array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $entities = $fire->event_args->get_signature_args(); |
| 86 | 86 | |
| 87 | 87 | if ( ! $entities ) { |
| 88 | - $fire->data[ $this->slug ]['points_logs'] = array(); |
|
| 88 | + $fire->data[$this->slug]['points_logs'] = array(); |
|
| 89 | 89 | return array(); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $logs = array(); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $fire->data[ $this->slug ]['points_logs'] = $logs; |
|
| 120 | + $fire->data[$this->slug]['points_logs'] = $logs; |
|
| 121 | 121 | |
| 122 | 122 | return $logs; |
| 123 | 123 | } |
@@ -145,8 +145,8 @@ |
||
| 145 | 145 | $meta = array( 'hook_hit_id' => $fire->hit_id ); |
| 146 | 146 | |
| 147 | 147 | foreach ( $fire->event_args->get_entities() as $entity ) { |
| 148 | - $meta[ $entity->get_slug() ] = $entity->get_the_id(); |
|
| 149 | - $meta[ $entity->get_slug() . '_guid' ] = $entity->get_the_guid(); |
|
| 148 | + $meta[$entity->get_slug()] = $entity->get_the_id(); |
|
| 149 | + $meta[$entity->get_slug() . '_guid'] = $entity->get_the_guid(); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | wordpoints_alter_points( |
@@ -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 | } |