@@ -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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | foreach ( $points_hooks as $context => $slugs ) { |
38 | 38 | foreach ( $slugs as $slug ) { |
39 | - $options[ $context ][] = 'wordpoints_hook-' . $slug; |
|
39 | + $options[$context][] = 'wordpoints_hook-' . $slug; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | foreach ( array( 'all', $log->log_type ) as $slug ) { |
43 | 43 | |
44 | - if ( isset( $this->classes[ $slug ] ) ) { |
|
44 | + if ( isset( $this->classes[$slug] ) ) { |
|
45 | 45 | |
46 | 46 | $restrictions = array_merge( |
47 | 47 | $restrictions |
@@ -82,7 +82,7 @@ |
||
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
85 | - $this->restrictions[ $entity_slug ] = $restriction; |
|
85 | + $this->restrictions[$entity_slug] = $restriction; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | foreach ( $classes as $class_name ) { |
135 | 135 | |
136 | 136 | $hook_type = new $class_name(); |
137 | - self::$hook_types[ $hook_type->get_id_base() ] = $hook_type; |
|
137 | + self::$hook_types[$hook_type->get_id_base()] = $hook_type; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | $instances = $hook_type->get_instances( $type ); |
182 | 182 | |
183 | - if ( ! isset( $instances[ $id_number ] ) ) { |
|
183 | + if ( ! isset( $instances[$id_number] ) ) { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function get_handler_by_id_base( $id_base ) { |
205 | 205 | |
206 | - if ( ! isset( self::$hook_types[ $id_base ] ) ) { |
|
206 | + if ( ! isset( self::$hook_types[$id_base] ) ) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | |
210 | - return self::$hook_types[ $id_base ]; |
|
210 | + return self::$hook_types[$id_base]; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | // Display a representative for each hook type. |
279 | 279 | foreach ( $hook_types as $id_base => $hook_type ) { |
280 | 280 | |
281 | - if ( isset( $disabled_hooks[ $id_base ] ) ) { |
|
281 | + if ( isset( $disabled_hooks[$id_base] ) ) { |
|
282 | 282 | continue; |
283 | 283 | } |
284 | 284 | |
@@ -412,8 +412,8 @@ discard block |
||
412 | 412 | |
413 | 413 | $points_types_hooks = self::get_points_types_hooks(); |
414 | 414 | |
415 | - if ( isset( $points_types_hooks[ $slug ] ) && is_array( $points_types_hooks[ $slug ] ) ) { |
|
416 | - $points_type_hooks = $points_types_hooks[ $slug ]; |
|
415 | + if ( isset( $points_types_hooks[$slug] ) && is_array( $points_types_hooks[$slug] ) ) { |
|
416 | + $points_type_hooks = $points_types_hooks[$slug]; |
|
417 | 417 | } else { |
418 | 418 | $points_type_hooks = array(); |
419 | 419 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | |
472 | 472 | foreach ( wordpoints_get_points_types() as $slug => $settings ) { |
473 | 473 | |
474 | - $defaults[ $slug ] = array(); |
|
474 | + $defaults[$slug] = array(); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | return $defaults; |
@@ -255,7 +255,7 @@ |
||
255 | 255 | |
256 | 256 | foreach ( wordpoints_get_points_types() as $slug => $settings ) { |
257 | 257 | |
258 | - $points_types[ $slug ] = $settings['name']; |
|
258 | + $points_types[$slug] = $settings['name']; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | if ( isset( $args['options'] ) && is_array( $args['options'] ) ) { |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | if ( |
87 | - ! isset( $last_visit[ $points_type ] ) |
|
88 | - || (int) ( $last_visit[ $points_type ] / $instance['period'] ) < (int) ( $now / $instance['period'] ) |
|
87 | + ! isset( $last_visit[$points_type] ) |
|
88 | + || (int) ( $last_visit[$points_type] / $instance['period'] ) < (int) ( $now / $instance['period'] ) |
|
89 | 89 | ) { |
90 | 90 | |
91 | 91 | wordpoints_add_points( |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | , array( 'period' => $instance['period'] ) |
97 | 97 | ); |
98 | 98 | |
99 | - $last_visit[ $points_type ] = $now; |
|
99 | + $last_visit[$points_type] = $now; |
|
100 | 100 | |
101 | 101 | $awarded_points = true; |
102 | 102 | } |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | protected function get_periods() { |
262 | 262 | |
263 | 263 | $periods = array( |
264 | - HOUR_IN_SECONDS => __( 'hourly' , 'wordpoints' ), |
|
265 | - DAY_IN_SECONDS => __( 'daily' , 'wordpoints' ), |
|
266 | - WEEK_IN_SECONDS => __( 'weekly' , 'wordpoints' ), |
|
264 | + HOUR_IN_SECONDS => __( 'hourly', 'wordpoints' ), |
|
265 | + DAY_IN_SECONDS => __( 'daily', 'wordpoints' ), |
|
266 | + WEEK_IN_SECONDS => __( 'weekly', 'wordpoints' ), |
|
267 | 267 | 30 * DAY_IN_SECONDS => __( 'monthly', 'wordpoints' ), |
268 | 268 | ); |
269 | 269 |