@@ -27,24 +27,24 @@ |
||
| 27 | 27 | // Uninstall the components. |
| 28 | 28 | foreach ( $components->get() as $component => $data ) { |
| 29 | 29 | |
| 30 | - if ( isset( $data['installable'] ) ) { |
|
| 30 | + if ( isset( $data[ 'installable' ] ) ) { |
|
| 31 | 31 | |
| 32 | 32 | WordPoints_Class_Autoloader::register_dir( |
| 33 | 33 | WORDPOINTS_DIR . "components/{$component}/classes" |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | - $installable = $data['installable']; |
|
| 36 | + $installable = $data[ 'installable' ]; |
|
| 37 | 37 | |
| 38 | 38 | $installer = new WordPoints_Uninstaller( new $installable( $component ) ); |
| 39 | 39 | $installer->run(); |
| 40 | 40 | |
| 41 | - } elseif ( isset( $data['un_installer'] ) ) { |
|
| 41 | + } elseif ( isset( $data[ 'un_installer' ] ) ) { |
|
| 42 | 42 | |
| 43 | 43 | WordPoints_Installables::get_installer( |
| 44 | 44 | 'component' |
| 45 | 45 | , $component |
| 46 | 46 | , 'uninstall' // Required, but not used. |
| 47 | - , $data['un_installer'] |
|
| 47 | + , $data[ 'un_installer' ] |
|
| 48 | 48 | ) |
| 49 | 49 | ->uninstall(); |
| 50 | 50 | } |
@@ -138,22 +138,22 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | foreach ( $this->get() as $component ) { |
| 140 | 140 | |
| 141 | - if ( ! $this->is_active( $component['slug'] ) ) { |
|
| 141 | + if ( ! $this->is_active( $component[ 'slug' ] ) ) { |
|
| 142 | 142 | continue; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if ( isset( $component['installable'] ) ) { |
|
| 145 | + if ( isset( $component[ 'installable' ] ) ) { |
|
| 146 | 146 | |
| 147 | 147 | $installables->register( |
| 148 | 148 | 'component' |
| 149 | - , $component['slug'] |
|
| 150 | - , $component['installable'] |
|
| 151 | - , $component['version'] |
|
| 149 | + , $component[ 'slug' ] |
|
| 150 | + , $component[ 'installable' ] |
|
| 151 | + , $component[ 'version' ] |
|
| 152 | 152 | , is_wordpoints_network_active() |
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - include_once $component['file']; |
|
| 156 | + include_once $component[ 'file' ]; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -276,27 +276,27 @@ discard block |
||
| 276 | 276 | $component = array_merge( $defaults, $args ); |
| 277 | 277 | |
| 278 | 278 | if ( |
| 279 | - empty( $component['name'] ) |
|
| 280 | - || empty( $component['file'] ) |
|
| 281 | - || empty( $component['slug'] ) |
|
| 282 | - || $this->is_registered( $component['slug'] ) |
|
| 279 | + empty( $component[ 'name' ] ) |
|
| 280 | + || empty( $component[ 'file' ] ) |
|
| 281 | + || empty( $component[ 'slug' ] ) |
|
| 282 | + || $this->is_registered( $component[ 'slug' ] ) |
|
| 283 | 283 | ) { |
| 284 | 284 | return false; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $this->registered[ $component['slug'] ] = array_intersect_key( $component, $defaults ); |
|
| 287 | + $this->registered[ $component[ 'slug' ] ] = array_intersect_key( $component, $defaults ); |
|
| 288 | 288 | |
| 289 | 289 | if ( |
| 290 | - ! isset( $component['installable'] ) |
|
| 291 | - && isset( $component['un_installer'] ) |
|
| 290 | + ! isset( $component[ 'installable' ] ) |
|
| 291 | + && isset( $component[ 'un_installer' ] ) |
|
| 292 | 292 | ) { |
| 293 | 293 | |
| 294 | 294 | WordPoints_Installables::register( |
| 295 | 295 | 'component' |
| 296 | - , $component['slug'] |
|
| 296 | + , $component[ 'slug' ] |
|
| 297 | 297 | , array( |
| 298 | - 'version' => $component['version'], |
|
| 299 | - 'un_installer' => $component['un_installer'], |
|
| 298 | + 'version' => $component[ 'version' ], |
|
| 299 | + 'un_installer' => $component[ 'un_installer' ], |
|
| 300 | 300 | ) |
| 301 | 301 | ); |
| 302 | 302 | } |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | return false; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - require_once $this->registered[ $slug ]['file']; |
|
| 365 | + require_once $this->registered[ $slug ][ 'file' ]; |
|
| 366 | 366 | |
| 367 | - if ( isset( $this->registered[ $slug ]['installable'] ) ) { |
|
| 367 | + if ( isset( $this->registered[ $slug ][ 'installable' ] ) ) { |
|
| 368 | 368 | |
| 369 | - $installable = $this->registered[ $slug ]['installable']; |
|
| 369 | + $installable = $this->registered[ $slug ][ 'installable' ]; |
|
| 370 | 370 | $installable = new $installable( $slug ); |
| 371 | 371 | |
| 372 | 372 | $installer = new WordPoints_Installer( |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | WordPoints_Installables::get_installer( |
| 382 | 382 | 'component' |
| 383 | 383 | , $slug |
| 384 | - , $this->registered[ $slug ]['version'] |
|
| 385 | - , $this->registered[ $slug ]['un_installer'] |
|
| 384 | + , $this->registered[ $slug ][ 'version' ] |
|
| 385 | + , $this->registered[ $slug ][ 'un_installer' ] |
|
| 386 | 386 | ) |
| 387 | 387 | ->install( is_wordpoints_network_active() ); |
| 388 | 388 | } |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | $period_units = array( |
| 42 | 42 | 1 => __( 'Seconds', 'wordpoints' ), |
| 43 | 43 | MINUTE_IN_SECONDS => __( 'Minutes', 'wordpoints' ), |
| 44 | - HOUR_IN_SECONDS => __( 'Hours' , 'wordpoints' ), |
|
| 45 | - DAY_IN_SECONDS => __( 'Days' , 'wordpoints' ), |
|
| 46 | - WEEK_IN_SECONDS => __( 'Weeks' , 'wordpoints' ), |
|
| 47 | - 30 * DAY_IN_SECONDS => __( 'Months' , 'wordpoints' ), |
|
| 44 | + HOUR_IN_SECONDS => __( 'Hours', 'wordpoints' ), |
|
| 45 | + DAY_IN_SECONDS => __( 'Days', 'wordpoints' ), |
|
| 46 | + WEEK_IN_SECONDS => __( 'Weeks', 'wordpoints' ), |
|
| 47 | + 30 * DAY_IN_SECONDS => __( 'Months', 'wordpoints' ), |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -122,17 +122,17 @@ discard block |
||
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if ( isset( $period['args'] ) ) { |
|
| 126 | - $this->validate_period_args( $period['args'] ); |
|
| 125 | + if ( isset( $period[ 'args' ] ) ) { |
|
| 126 | + $this->validate_period_args( $period[ 'args' ] ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if ( ! isset( $period['length'] ) ) { |
|
| 129 | + if ( ! isset( $period[ 'length' ] ) ) { |
|
| 130 | 130 | |
| 131 | 131 | $this->validator->add_error( |
| 132 | 132 | __( 'Period length setting is missing.', 'wordpoints' ) |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | - } elseif ( false === wordpoints_posint( $period['length'] ) ) { |
|
| 135 | + } elseif ( false === wordpoints_posint( $period[ 'length' ] ) ) { |
|
| 136 | 136 | |
| 137 | 137 | $this->validator->add_error( |
| 138 | 138 | __( 'Period length must be a positive integer.', 'wordpoints' ) |
@@ -237,17 +237,17 @@ discard block |
||
| 237 | 237 | $now = current_time( 'timestamp', true ); |
| 238 | 238 | $hit_time = strtotime( $period->date, $now ); |
| 239 | 239 | |
| 240 | - if ( ! empty( $settings['relative'] ) ) { |
|
| 240 | + if ( ! empty( $settings[ 'relative' ] ) ) { |
|
| 241 | 241 | |
| 242 | - return ( $now > $hit_time + $settings['length'] ); |
|
| 242 | + return ( $now > $hit_time + $settings[ 'length' ] ); |
|
| 243 | 243 | |
| 244 | 244 | } else { |
| 245 | 245 | |
| 246 | 246 | $offset = get_option( 'gmt_offset' ) * HOUR_IN_SECONDS; |
| 247 | 247 | |
| 248 | 248 | return ( |
| 249 | - (int) ( ( $hit_time + $offset ) / $settings['length'] ) |
|
| 250 | - < (int) ( ( $now + $offset ) / $settings['length'] ) |
|
| 249 | + (int) ( ( $hit_time + $offset ) / $settings[ 'length' ] ) |
|
| 250 | + < (int) ( ( $now + $offset ) / $settings[ 'length' ] ) |
|
| 251 | 251 | ); |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -371,10 +371,10 @@ discard block |
||
| 371 | 371 | LIMIT 1 |
| 372 | 372 | " |
| 373 | 373 | , $signature |
| 374 | - , $reaction_guid['mode'] |
|
| 375 | - , $reaction_guid['store'] |
|
| 376 | - , wp_json_encode( $reaction_guid['context_id'] ) |
|
| 377 | - , $reaction_guid['id'] |
|
| 374 | + , $reaction_guid[ 'mode' ] |
|
| 375 | + , $reaction_guid[ 'store' ] |
|
| 376 | + , wp_json_encode( $reaction_guid[ 'context_id' ] ) |
|
| 377 | + , $reaction_guid[ 'id' ] |
|
| 378 | 378 | , $this->action_type |
| 379 | 379 | ) |
| 380 | 380 | ); |
@@ -431,8 +431,8 @@ discard block |
||
| 431 | 431 | WordPoints_Hook_ReactionI $reaction |
| 432 | 432 | ) { |
| 433 | 433 | |
| 434 | - if ( isset( $settings['args'] ) ) { |
|
| 435 | - $period_args = $settings['args']; |
|
| 434 | + if ( isset( $settings[ 'args' ] ) ) { |
|
| 435 | + $period_args = $settings[ 'args' ]; |
|
| 436 | 436 | } else { |
| 437 | 437 | $period_args = array( $reaction->get_meta( 'target' ) ); |
| 438 | 438 | } |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | self::$registered[ $slug ] = self::parse_headers( $data ); |
| 152 | 152 | |
| 153 | - self::$registered[ $slug ]['raw'] = $data; |
|
| 154 | - self::$registered[ $slug ]['raw_file'] = wp_normalize_path( $file ); |
|
| 153 | + self::$registered[ $slug ][ 'raw' ] = $data; |
|
| 154 | + self::$registered[ $slug ][ 'raw_file' ] = wp_normalize_path( $file ); |
|
| 155 | 155 | |
| 156 | 156 | self::register_installable( $slug, $file ); |
| 157 | 157 | self::maybe_load_textdomain( $slug, $file ); |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $parts = explode( ':', $line, 2 ); |
| 186 | 186 | |
| 187 | - $data_slug = trim( $parts[0] ); |
|
| 187 | + $data_slug = trim( $parts[ 0 ] ); |
|
| 188 | 188 | |
| 189 | - if ( isset( self::$default_headers[ $parts[0] ] ) ) { |
|
| 190 | - $data_slug = self::$default_headers[ $parts[0] ]; |
|
| 189 | + if ( isset( self::$default_headers[ $parts[ 0 ] ] ) ) { |
|
| 190 | + $data_slug = self::$default_headers[ $parts[ 0 ] ]; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $parsed[ $data_slug ] = trim( $parts[1] ); |
|
| 193 | + $parsed[ $data_slug ] = trim( $parts[ 1 ] ); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | return $parsed + array_fill_keys( self::$default_headers, '' ); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | 'extension' |
| 211 | 211 | , $slug |
| 212 | 212 | , 'WordPoints_Modules::get_installable' |
| 213 | - , self::$registered[ $slug ]['version'] |
|
| 213 | + , self::$registered[ $slug ][ 'version' ] |
|
| 214 | 214 | , is_wordpoints_module_active_for_network( $file ) |
| 215 | 215 | ); |
| 216 | 216 | } |
@@ -225,18 +225,18 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | private static function maybe_load_textdomain( $slug, $file ) { |
| 227 | 227 | |
| 228 | - if ( empty( self::$registered[ $slug ]['text_domain'] ) ) { |
|
| 228 | + if ( empty( self::$registered[ $slug ][ 'text_domain' ] ) ) { |
|
| 229 | 229 | return; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $path = false; |
| 233 | 233 | |
| 234 | - if ( ! empty( self::$registered[ $slug ]['domain_path'] ) ) { |
|
| 235 | - $path = wordpoints_module_basename( $file ) . self::$registered[ $slug ]['domain_path']; |
|
| 234 | + if ( ! empty( self::$registered[ $slug ][ 'domain_path' ] ) ) { |
|
| 235 | + $path = wordpoints_module_basename( $file ) . self::$registered[ $slug ][ 'domain_path' ]; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | wordpoints_load_module_textdomain( |
| 239 | - self::$registered[ $slug ]['text_domain'] |
|
| 239 | + self::$registered[ $slug ][ 'text_domain' ] |
|
| 240 | 240 | , $path |
| 241 | 241 | ); |
| 242 | 242 | } |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | WordPoints_Installables::get_installer( |
| 265 | 265 | 'module' |
| 266 | 266 | , $slug |
| 267 | - , self::$registered[ $slug ]['version'] |
|
| 268 | - , dirname( self::$registered[ $slug ]['raw_file'] ) . '/includes/class-un-installer.php' |
|
| 267 | + , self::$registered[ $slug ][ 'version' ] |
|
| 268 | + , dirname( self::$registered[ $slug ][ 'raw_file' ] ) . '/includes/class-un-installer.php' |
|
| 269 | 269 | ) |
| 270 | 270 | ->install( $network_wide ); |
| 271 | 271 | |
@@ -296,14 +296,14 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $module = self::$registered[ $slug ]; |
| 298 | 298 | |
| 299 | - $uninstaller = dirname( $module['raw_file'] ) . '/includes/class-un-installer.php'; |
|
| 299 | + $uninstaller = dirname( $module[ 'raw_file' ] ) . '/includes/class-un-installer.php'; |
|
| 300 | 300 | |
| 301 | 301 | if ( |
| 302 | - $module['namespace'] |
|
| 303 | - && class_exists( "WordPoints_{$module['namespace']}_Installable" ) |
|
| 302 | + $module[ 'namespace' ] |
|
| 303 | + && class_exists( "WordPoints_{$module[ 'namespace' ]}_Installable" ) |
|
| 304 | 304 | ) { |
| 305 | 305 | |
| 306 | - $class = "WordPoints_{$module['namespace']}_Installable"; |
|
| 306 | + $class = "WordPoints_{$module[ 'namespace' ]}_Installable"; |
|
| 307 | 307 | $installable = new $class( $slug ); |
| 308 | 308 | |
| 309 | 309 | } elseif ( file_exists( $uninstaller ) ) { |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $installable = new WordPoints_Installable_Legacy( |
| 312 | 312 | 'module' |
| 313 | 313 | , $slug |
| 314 | - , $module['version'] |
|
| 314 | + , $module[ 'version' ] |
|
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | 317 | |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | if ( |
| 87 | 87 | ! isset( $last_visit[ $points_type ] ) |
| 88 | - || (int) ( $last_visit[ $points_type ] / $instance['period'] ) < (int) ( $now / $instance['period'] ) |
|
| 88 | + || (int) ( $last_visit[ $points_type ] / $instance[ 'period' ] ) < (int) ( $now / $instance[ 'period' ] ) |
|
| 89 | 89 | ) { |
| 90 | 90 | |
| 91 | 91 | wordpoints_add_points( |
| 92 | 92 | $user_id |
| 93 | - , $instance['points'] |
|
| 93 | + , $instance[ 'points' ] |
|
| 94 | 94 | , $points_type |
| 95 | 95 | , 'periodic' |
| 96 | - , array( 'period' => $instance['period'] ) |
|
| 96 | + , array( 'period' => $instance[ 'period' ] ) |
|
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | 99 | $last_visit[ $points_type ] = $now; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function logs( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
| 135 | 135 | |
| 136 | - switch ( $meta['period'] ) { |
|
| 136 | + switch ( $meta[ 'period' ] ) { |
|
| 137 | 137 | |
| 138 | 138 | case HOUR_IN_SECONDS: |
| 139 | 139 | $message = _x( 'Hourly points.', 'points log description', 'wordpoints' ); |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | protected function generate_description( $instance = array() ) { |
| 171 | 171 | |
| 172 | - if ( ! empty( $instance['period'] ) ) { |
|
| 172 | + if ( ! empty( $instance[ 'period' ] ) ) { |
|
| 173 | 173 | |
| 174 | - switch ( $instance['period'] ) { |
|
| 174 | + switch ( $instance[ 'period' ] ) { |
|
| 175 | 175 | |
| 176 | 176 | case HOUR_IN_SECONDS: |
| 177 | 177 | return __( 'Visiting the site at least once in an hour.', 'wordpoints' ); |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $new_instance = array_merge( $this->defaults, $old_instance, $new_instance ); |
| 209 | 209 | |
| 210 | - wordpoints_posint( $new_instance['points'] ); |
|
| 211 | - wordpoints_posint( $new_instance['period'] ); |
|
| 210 | + wordpoints_posint( $new_instance[ 'points' ] ); |
|
| 211 | + wordpoints_posint( $new_instance[ 'period' ] ); |
|
| 212 | 212 | |
| 213 | 213 | return $new_instance; |
| 214 | 214 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $instance = array_merge( $this->defaults, $instance ); |
| 228 | 228 | |
| 229 | 229 | $dropdown_args = array( |
| 230 | - 'selected' => $instance['period'], |
|
| 230 | + 'selected' => $instance[ 'period' ], |
|
| 231 | 231 | 'id' => $this->get_field_id( 'period' ), |
| 232 | 232 | 'name' => $this->get_field_name( 'period' ), |
| 233 | 233 | 'class' => 'widefat wordpoints-append-to-hook-title', |
@@ -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 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | parent::__construct( |
| 50 | 50 | array( |
| 51 | 51 | 'plural' => 'wordpoints-extensions', |
| 52 | - 'screen' => ( isset( $args['screen'] ) ) ? $args['screen'] : null, |
|
| 52 | + 'screen' => ( isset( $args[ 'screen' ] ) ) ? $args[ 'screen' ] : null, |
|
| 53 | 53 | ) |
| 54 | 54 | ); |
| 55 | 55 | |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
| 78 | 78 | |
| 79 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
| 80 | - $status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK. |
|
| 79 | + if ( isset( $_REQUEST[ 'module_status' ] ) && in_array( wp_unslash( $_REQUEST[ 'module_status' ] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
| 80 | + $status = sanitize_key( $_REQUEST[ 'module_status' ] ); // WPCS: CSRF OK. |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
| 84 | - $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK. |
|
| 83 | + if ( isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK. |
|
| 84 | + $_SERVER[ 'REQUEST_URI' ] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) ); // WPCS: CSRF OK. |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $page = $this->get_pagenum(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function get_table_classes() { |
| 98 | 98 | |
| 99 | - return array( 'widefat', $this->_args['plural'], 'modules', 'plugins' ); |
|
| 99 | + return array( 'widefat', $this->_args[ 'plural' ], 'modules', 'plugins' ); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | } // End if ( not network admin ). |
| 204 | 204 | |
| 205 | - foreach ( (array) $modules['all'] as $module_file => $module_data ) { |
|
| 205 | + foreach ( (array) $modules[ 'all' ] as $module_file => $module_data ) { |
|
| 206 | 206 | |
| 207 | 207 | // Filter into individual sections. |
| 208 | 208 | if ( |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | ) { |
| 213 | 213 | |
| 214 | 214 | if ( $show_network_active ) { |
| 215 | - $modules['inactive'][ $module_file ] = $module_data; |
|
| 215 | + $modules[ 'inactive' ][ $module_file ] = $module_data; |
|
| 216 | 216 | } else { |
| 217 | - unset( $modules['all'][ $module_file ] ); |
|
| 217 | + unset( $modules[ 'all' ][ $module_file ] ); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | } elseif ( |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | ) { |
| 224 | 224 | |
| 225 | 225 | if ( $show_network_active ) { |
| 226 | - $modules['active'][ $module_file ] = $module_data; |
|
| 226 | + $modules[ 'active' ][ $module_file ] = $module_data; |
|
| 227 | 227 | } else { |
| 228 | - unset( $modules['all'][ $module_file ] ); |
|
| 228 | + unset( $modules[ 'all' ][ $module_file ] ); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | } elseif ( |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | ) |
| 239 | 239 | ) { |
| 240 | 240 | |
| 241 | - $modules['active'][ $module_file ] = $module_data; |
|
| 241 | + $modules[ 'active' ][ $module_file ] = $module_data; |
|
| 242 | 242 | |
| 243 | 243 | } else { |
| 244 | 244 | |
| 245 | 245 | // Was the module recently activated? |
| 246 | 246 | if ( ! $this->screen->in_admin( 'network' ) && isset( $recently_activated[ $module_file ] ) ) { |
| 247 | - $modules['recently_activated'][ $module_file ] = $module_data; |
|
| 247 | + $modules[ 'recently_activated' ][ $module_file ] = $module_data; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $modules['inactive'][ $module_file ] = $module_data; |
|
| 250 | + $modules[ 'inactive' ][ $module_file ] = $module_data; |
|
| 251 | 251 | |
| 252 | 252 | } // End if (). |
| 253 | 253 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * for modules that have an available update. |
| 257 | 257 | */ |
| 258 | 258 | if ( $user_can_update && $updates->has_update( $module_file ) ) { |
| 259 | - $modules['upgrade'][ $module_file ] = $modules['all'][ $module_file ]; |
|
| 259 | + $modules[ 'upgrade' ][ $module_file ] = $modules[ 'all' ][ $module_file ]; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | } // End foreach ( modules ). |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | if ( $s ) { |
| 265 | 265 | |
| 266 | 266 | $status = 'search'; |
| 267 | - $modules['search'] = array_filter( $modules['all'], array( $this, 'search_callback' ) ); |
|
| 267 | + $modules[ 'search' ] = array_filter( $modules[ 'all' ], array( $this, 'search_callback' ) ); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | static $term; |
| 344 | 344 | |
| 345 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
| 346 | - $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK. |
|
| 345 | + if ( is_null( $term ) && isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK. |
|
| 346 | + $term = sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ); // WPCS: CSRF OK. |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | foreach ( $module_data as $value ) { |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | |
| 396 | 396 | global $modules; |
| 397 | 397 | |
| 398 | - if ( ! empty( $modules['all'] ) ) { |
|
| 398 | + if ( ! empty( $modules[ 'all' ] ) ) { |
|
| 399 | 399 | esc_html_e( 'No extensions found.', 'wordpoints' ); |
| 400 | 400 | } else { |
| 401 | 401 | esc_html_e( 'There are not any extensions installed.', 'wordpoints' ); |
@@ -514,11 +514,11 @@ discard block |
||
| 514 | 514 | $actions = array(); |
| 515 | 515 | |
| 516 | 516 | if ( 'active' !== $status ) { |
| 517 | - $actions['activate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
| 517 | + $actions[ 'activate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | if ( 'inactive' !== $status && 'recent' !== $status ) { |
| 521 | - $actions['deactivate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
| 521 | + $actions[ 'deactivate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | if ( |
@@ -526,14 +526,14 @@ discard block |
||
| 526 | 526 | && current_user_can( 'delete_wordpoints_extensions' ) |
| 527 | 527 | && 'active' !== $status |
| 528 | 528 | ) { |
| 529 | - $actions['delete-selected'] = esc_html__( 'Delete', 'wordpoints' ); |
|
| 529 | + $actions[ 'delete-selected' ] = esc_html__( 'Delete', 'wordpoints' ); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | if ( |
| 533 | 533 | ( ! is_multisite() || is_network_admin() ) |
| 534 | 534 | && current_user_can( 'update_wordpoints_extensions' ) |
| 535 | 535 | ) { |
| 536 | - $actions['update-selected'] = esc_html__( 'Update', 'wordpoints' ); |
|
| 536 | + $actions[ 'update-selected' ] = esc_html__( 'Update', 'wordpoints' ); |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | /** |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | protected function display_tablenav( $which ) { |
| 556 | 556 | |
| 557 | 557 | // Back-compat for the old nonce name. |
| 558 | - $this->_args['plural'] = 'modules'; |
|
| 558 | + $this->_args[ 'plural' ] = 'modules'; |
|
| 559 | 559 | |
| 560 | 560 | parent::display_tablenav( $which ); |
| 561 | 561 | |
| 562 | - $this->_args['plural'] = 'wordpoints-extensions'; |
|
| 562 | + $this->_args[ 'plural' ] = 'wordpoints-extensions'; |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | $class = apply_filters( 'wordpoints_module_list_row_class', $class, $module_file, $module_data, $context ); |
| 644 | 644 | |
| 645 | 645 | ?> |
| 646 | - <tr id="<?php echo esc_attr( sanitize_title( $module_data['name'] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
| 646 | + <tr id="<?php echo esc_attr( sanitize_title( $module_data[ 'name' ] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
| 647 | 647 | <?php $this->single_row_columns( $item, $class, $is_active ); ?> |
| 648 | 648 | </tr> |
| 649 | 649 | <?php |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | list( $module_file, $module_data ) = $item; |
| 685 | 685 | |
| 686 | - $module_data['extra']['module_file'] = $module_file; |
|
| 686 | + $module_data[ 'extra' ][ 'module_file' ] = $module_file; |
|
| 687 | 687 | |
| 688 | 688 | if ( $this->screen->in_admin( 'network' ) ) { |
| 689 | 689 | |
@@ -696,11 +696,11 @@ discard block |
||
| 696 | 696 | $restricted_network_only = ( is_multisite() && is_network_only_wordpoints_module( $module_file ) && ! $is_active ); |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - $module_data['extra']['is_active'] = $is_active; |
|
| 700 | - $module_data['extra']['restricted_network_active'] = $restricted_network_active; |
|
| 701 | - $module_data['extra']['restricted_network_only'] = $restricted_network_only; |
|
| 699 | + $module_data[ 'extra' ][ 'is_active' ] = $is_active; |
|
| 700 | + $module_data[ 'extra' ][ 'restricted_network_active' ] = $restricted_network_active; |
|
| 701 | + $module_data[ 'extra' ][ 'restricted_network_only' ] = $restricted_network_only; |
|
| 702 | 702 | |
| 703 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
| 703 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
| 704 | 704 | |
| 705 | 705 | foreach ( $columns as $column_name => $column_display_name ) { |
| 706 | 706 | |
@@ -737,11 +737,11 @@ discard block |
||
| 737 | 737 | */ |
| 738 | 738 | protected function column_cb( $module_data ) { |
| 739 | 739 | |
| 740 | - $checkbox_id = 'checkbox_' . sanitize_key( $module_data['extra']['module_file'] ); |
|
| 740 | + $checkbox_id = 'checkbox_' . sanitize_key( $module_data[ 'extra' ][ 'module_file' ] ); |
|
| 741 | 741 | |
| 742 | 742 | ?> |
| 743 | 743 | <th scope="row" class="check-column"> |
| 744 | - <?php if ( ! $module_data['extra']['restricted_network_active'] && ! $module_data['extra']['restricted_network_only'] ) : ?> |
|
| 744 | + <?php if ( ! $module_data[ 'extra' ][ 'restricted_network_active' ] && ! $module_data[ 'extra' ][ 'restricted_network_only' ] ) : ?> |
|
| 745 | 745 | <label class="screen-reader-text" for="<?php echo esc_attr( $checkbox_id ); ?>"> |
| 746 | 746 | <?php |
| 747 | 747 | |
@@ -749,13 +749,13 @@ discard block |
||
| 749 | 749 | sprintf( |
| 750 | 750 | // translators: Extension name. |
| 751 | 751 | __( 'Select %s', 'wordpoints' ) |
| 752 | - , $module_data['name'] |
|
| 752 | + , $module_data[ 'name' ] |
|
| 753 | 753 | ) |
| 754 | 754 | ); |
| 755 | 755 | |
| 756 | 756 | ?> |
| 757 | 757 | </label> |
| 758 | - <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data['extra']['module_file'] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
| 758 | + <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data[ 'extra' ][ 'module_file' ] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
| 759 | 759 | <?php endif; ?> |
| 760 | 760 | </th> |
| 761 | 761 | <?php |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | ?> |
| 776 | 776 | <td class="module-title<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>"> |
| 777 | - <strong><?php echo esc_html( $module_data['name'] ); ?></strong> |
|
| 777 | + <strong><?php echo esc_html( $module_data[ 'name' ] ); ?></strong> |
|
| 778 | 778 | <?php if ( $is_primary ) : ?> |
| 779 | 779 | <?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); /* WPCS XSS OK. */ ?> |
| 780 | 780 | <?php endif; ?> |
@@ -800,8 +800,8 @@ discard block |
||
| 800 | 800 | <td class="column-description desc<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>"> |
| 801 | 801 | <div class="module-description"> |
| 802 | 802 | <p> |
| 803 | - <?php if ( ! empty( $module_data['description'] ) ) : ?> |
|
| 804 | - <?php echo wp_kses( $module_data['description'], 'wordpoints_module_description' ); ?> |
|
| 803 | + <?php if ( ! empty( $module_data[ 'description' ] ) ) : ?> |
|
| 804 | + <?php echo wp_kses( $module_data[ 'description' ], 'wordpoints_module_description' ); ?> |
|
| 805 | 805 | <?php else : ?> |
| 806 | 806 | |
| 807 | 807 | <?php endif; ?> |
@@ -812,25 +812,25 @@ discard block |
||
| 812 | 812 | |
| 813 | 813 | $module_meta = array(); |
| 814 | 814 | |
| 815 | - if ( ! empty( $module_data['version'] ) ) { |
|
| 815 | + if ( ! empty( $module_data[ 'version' ] ) ) { |
|
| 816 | 816 | // translators: Extension version. |
| 817 | - $module_meta[] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data['version'] ); |
|
| 817 | + $module_meta[ ] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data[ 'version' ] ); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | - if ( ! empty( $module_data['author'] ) ) { |
|
| 820 | + if ( ! empty( $module_data[ 'author' ] ) ) { |
|
| 821 | 821 | |
| 822 | - $author = $module_data['author']; |
|
| 822 | + $author = $module_data[ 'author' ]; |
|
| 823 | 823 | |
| 824 | - if ( ! empty( $module_data['author_uri'] ) ) { |
|
| 825 | - $author = '<a href="' . esc_url( $module_data['author_uri'] ) . '">' . esc_html( $module_data['author'] ) . '</a>'; |
|
| 824 | + if ( ! empty( $module_data[ 'author_uri' ] ) ) { |
|
| 825 | + $author = '<a href="' . esc_url( $module_data[ 'author_uri' ] ) . '">' . esc_html( $module_data[ 'author' ] ) . '</a>'; |
|
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | // translators: Author name. |
| 829 | - $module_meta[] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
| 829 | + $module_meta[ ] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - if ( ! empty( $module_data['uri'] ) ) { |
|
| 833 | - $module_meta[] = '<a href="' . esc_url( $module_data['uri'] ) . '">' . esc_html__( 'Visit extension site', 'wordpoints' ) . '</a>'; |
|
| 832 | + if ( ! empty( $module_data[ 'uri' ] ) ) { |
|
| 833 | + $module_meta[ ] = '<a href="' . esc_url( $module_data[ 'uri' ] ) . '">' . esc_html__( 'Visit extension site', 'wordpoints' ) . '</a>'; |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | /** |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | * @param array $module_data The info about the module. |
| 847 | 847 | * @param string $status The module status being displayed. |
| 848 | 848 | */ |
| 849 | - $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data['extra']['module_file'], $module_data, $status ); |
|
| 849 | + $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data[ 'extra' ][ 'module_file' ], $module_data, $status ); |
|
| 850 | 850 | |
| 851 | 851 | echo wp_kses( implode( ' | ', $module_meta ), 'data' ); |
| 852 | 852 | |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | * @param string $module_file The main file of the current module. |
| 884 | 884 | * @param array $module_data The module's info. |
| 885 | 885 | */ |
| 886 | - do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data['module_file'], $module_data ); |
|
| 886 | + do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data[ 'module_file' ], $module_data ); |
|
| 887 | 887 | ?> |
| 888 | 888 | <?php if ( $is_primary ) : ?> |
| 889 | 889 | <?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); /* WPCS XSS OK. */ ?> |
@@ -912,8 +912,8 @@ discard block |
||
| 912 | 912 | |
| 913 | 913 | $context = $status; |
| 914 | 914 | |
| 915 | - $module_file = $module_data['extra']['module_file']; |
|
| 916 | - $args = $module_data['extra']; |
|
| 915 | + $module_file = $module_data[ 'extra' ][ 'module_file' ]; |
|
| 916 | + $args = $module_data[ 'extra' ]; |
|
| 917 | 917 | |
| 918 | 918 | // Pre-order. |
| 919 | 919 | $actions = array( |
@@ -926,49 +926,49 @@ discard block |
||
| 926 | 926 | |
| 927 | 927 | if ( $this->screen->in_admin( 'network' ) ) { |
| 928 | 928 | |
| 929 | - if ( $args['is_active'] ) { |
|
| 929 | + if ( $args[ 'is_active' ] ) { |
|
| 930 | 930 | |
| 931 | 931 | if ( current_user_can( 'manage_network_wordpoints_extensions' ) ) { |
| 932 | 932 | // translators: Extension name. |
| 933 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
| 933 | + $actions[ 'deactivate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | } else { |
| 937 | 937 | |
| 938 | 938 | if ( current_user_can( 'manage_network_wordpoints_extensions' ) ) { |
| 939 | 939 | // translators: Extension name. |
| 940 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
| 940 | + $actions[ 'activate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | if ( current_user_can( 'delete_wordpoints_extensions' ) && ! is_wordpoints_module_active( $module_file ) ) { |
| 944 | 944 | // translators: Extension name. |
| 945 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
| 945 | + $actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
| 946 | 946 | } |
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | } else { |
| 950 | 950 | |
| 951 | - if ( $args['restricted_network_active'] ) { |
|
| 951 | + if ( $args[ 'restricted_network_active' ] ) { |
|
| 952 | 952 | |
| 953 | 953 | $actions = array( 'network_active' => __( 'Network Active', 'wordpoints' ) ); |
| 954 | 954 | |
| 955 | - } elseif ( $args['restricted_network_only'] ) { |
|
| 955 | + } elseif ( $args[ 'restricted_network_only' ] ) { |
|
| 956 | 956 | |
| 957 | 957 | $actions = array( 'network_only' => __( 'Network Only', 'wordpoints' ) ); |
| 958 | 958 | |
| 959 | - } elseif ( $args['is_active'] ) { |
|
| 959 | + } elseif ( $args[ 'is_active' ] ) { |
|
| 960 | 960 | |
| 961 | 961 | // translators: Extension name. |
| 962 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
| 962 | + $actions[ 'deactivate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
| 963 | 963 | |
| 964 | 964 | } else { |
| 965 | 965 | |
| 966 | 966 | // translators: Extension name. |
| 967 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
| 967 | + $actions[ 'activate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
| 968 | 968 | |
| 969 | 969 | if ( ! is_multisite() && current_user_can( 'delete_wordpoints_extensions' ) ) { |
| 970 | 970 | // translators: Extension name. |
| 971 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
| 971 | + $actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
| 972 | 972 | } |
| 973 | 973 | } |
| 974 | 974 | |
@@ -76,11 +76,13 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
| 78 | 78 | |
| 79 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
| 79 | + if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { |
|
| 80 | +// WPCS: CSRF OK. |
|
| 80 | 81 | $status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK. |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | - if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
| 84 | + if ( isset( $_REQUEST['s'] ) ) { |
|
| 85 | +// WPCS: CSRF OK. |
|
| 84 | 86 | $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK. |
| 85 | 87 | } |
| 86 | 88 | |
@@ -342,7 +344,8 @@ discard block |
||
| 342 | 344 | |
| 343 | 345 | static $term; |
| 344 | 346 | |
| 345 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
| 347 | + if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { |
|
| 348 | +// WPCS: CSRF OK. |
|
| 346 | 349 | $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK. |
| 347 | 350 | } |
| 348 | 351 | |
@@ -802,9 +805,12 @@ discard block |
||
| 802 | 805 | <p> |
| 803 | 806 | <?php if ( ! empty( $module_data['description'] ) ) : ?> |
| 804 | 807 | <?php echo wp_kses( $module_data['description'], 'wordpoints_module_description' ); ?> |
| 805 | - <?php else : ?> |
|
| 808 | + <?php else { |
|
| 809 | + : ?> |
|
| 806 | 810 | |
| 807 | - <?php endif; ?> |
|
| 811 | + <?php endif; |
|
| 812 | +} |
|
| 813 | +?> |
|
| 808 | 814 | </p> |
| 809 | 815 | </div> |
| 810 | 816 | <div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri"> |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $module_data = wordpoints_get_module_data( wordpoints_extensions_dir() . '/' . $module ); |
| 90 | 90 | |
| 91 | - return $module_data['network']; |
|
| 91 | + return $module_data[ 'network' ]; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | if ( |
| 210 | 210 | get_site_option( 'wordpoints_legacy_extensions_dir' ) |
| 211 | 211 | || ( |
| 212 | - isset( $wordpoints_data['version'] ) |
|
| 213 | - && version_compare( $wordpoints_data['version'], '2.4.0-alpha-3', '<' ) |
|
| 212 | + isset( $wordpoints_data[ 'version' ] ) |
|
| 213 | + && version_compare( $wordpoints_data[ 'version' ], '2.4.0-alpha-3', '<' ) |
|
| 214 | 214 | ) |
| 215 | 215 | ) { |
| 216 | 216 | $path = str_replace( |
@@ -430,36 +430,36 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | $module_data = WordPoints_Modules::get_data( $module_file ); |
| 432 | 432 | |
| 433 | - if ( $module_data && wp_normalize_path( $module_file ) === $module_data['raw_file'] ) { |
|
| 434 | - unset( $module_data['raw'], $module_data['raw_file'] ); |
|
| 433 | + if ( $module_data && wp_normalize_path( $module_file ) === $module_data[ 'raw_file' ] ) { |
|
| 434 | + unset( $module_data[ 'raw' ], $module_data[ 'raw_file' ] ); |
|
| 435 | 435 | } else { |
| 436 | 436 | $module_data = get_file_data( $module_file, $default_headers, 'wordpoints_module' ); |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if ( ! empty( $module_data['update_api'] ) ) { |
|
| 439 | + if ( ! empty( $module_data[ 'update_api' ] ) ) { |
|
| 440 | 440 | _deprecated_argument( __FUNCTION__, '1.10.0', 'The "Update API" module header has been deprecated in favor of "Server".' ); |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - if ( ! empty( $module_data['channel'] ) ) { |
|
| 443 | + if ( ! empty( $module_data[ 'channel' ] ) ) { |
|
| 444 | 444 | _deprecated_argument( __FUNCTION__, '2.4.0', 'The "Channel" extension header has been deprecated in favor of "Server".' ); |
| 445 | - $module_data['server'] = $module_data['channel']; |
|
| 445 | + $module_data[ 'server' ] = $module_data[ 'channel' ]; |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if ( ! empty( $module_data['module_name'] ) ) { |
|
| 448 | + if ( ! empty( $module_data[ 'module_name' ] ) ) { |
|
| 449 | 449 | _deprecated_argument( __FUNCTION__, '2.4.0', 'The "Module Name" extension header has been deprecated in favor of "Extension Name".' ); |
| 450 | - $module_data['name'] = $module_data['module_name']; |
|
| 450 | + $module_data[ 'name' ] = $module_data[ 'module_name' ]; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - unset( $module_data['module_name'] ); |
|
| 453 | + unset( $module_data[ 'module_name' ] ); |
|
| 454 | 454 | |
| 455 | - if ( ! empty( $module_data['module_uri'] ) ) { |
|
| 455 | + if ( ! empty( $module_data[ 'module_uri' ] ) ) { |
|
| 456 | 456 | _deprecated_argument( __FUNCTION__, '2.4.0', 'The "Module URI" extension header has been deprecated in favor of "Extension URI".' ); |
| 457 | - $module_data['uri'] = $module_data['module_uri']; |
|
| 457 | + $module_data[ 'uri' ] = $module_data[ 'module_uri' ]; |
|
| 458 | 458 | } else { |
| 459 | - $module_data['module_uri'] = $module_data['uri']; |
|
| 459 | + $module_data[ 'module_uri' ] = $module_data[ 'uri' ]; |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - $module_data['network'] = ( 'true' === strtolower( $module_data['network'] ) ); |
|
| 462 | + $module_data[ 'network' ] = ( 'true' === strtolower( $module_data[ 'network' ] ) ); |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Filters the header data for an extension. |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | // Translate fields |
| 480 | 480 | if ( $translate ) { |
| 481 | 481 | |
| 482 | - $textdomain = $module_data['text_domain']; |
|
| 482 | + $textdomain = $module_data[ 'text_domain' ]; |
|
| 483 | 483 | |
| 484 | 484 | if ( $textdomain ) { |
| 485 | 485 | |
@@ -487,8 +487,8 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | $domain_path = dirname( $module_file ); |
| 489 | 489 | |
| 490 | - if ( $module_data['domain_path'] ) { |
|
| 491 | - $domain_path .= $module_data['domain_path']; |
|
| 490 | + if ( $module_data[ 'domain_path' ] ) { |
|
| 491 | + $domain_path .= $module_data[ 'domain_path' ]; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | wordpoints_load_module_textdomain( $textdomain, $domain_path ); |
@@ -511,49 +511,49 @@ discard block |
||
| 511 | 511 | ); |
| 512 | 512 | |
| 513 | 513 | $allowed_tags = $allowed_tags_in_links; |
| 514 | - $allowed_tags['a'] = array( 'href' => true, 'title' => true ); |
|
| 514 | + $allowed_tags[ 'a' ] = array( 'href' => true, 'title' => true ); |
|
| 515 | 515 | |
| 516 | 516 | // Name and author ar marked up inside <a> tags. Don't allow these. |
| 517 | - $module_data['name'] = wp_kses( $module_data['name'] , $allowed_tags_in_links ); |
|
| 518 | - $module_data['author'] = wp_kses( $module_data['author'], $allowed_tags_in_links ); |
|
| 517 | + $module_data[ 'name' ] = wp_kses( $module_data[ 'name' ], $allowed_tags_in_links ); |
|
| 518 | + $module_data[ 'author' ] = wp_kses( $module_data[ 'author' ], $allowed_tags_in_links ); |
|
| 519 | 519 | |
| 520 | - $module_data['description'] = wp_kses( $module_data['description'], $allowed_tags ); |
|
| 521 | - $module_data['version'] = wp_kses( $module_data['version'] , $allowed_tags ); |
|
| 520 | + $module_data[ 'description' ] = wp_kses( $module_data[ 'description' ], $allowed_tags ); |
|
| 521 | + $module_data[ 'version' ] = wp_kses( $module_data[ 'version' ], $allowed_tags ); |
|
| 522 | 522 | |
| 523 | - $module_data['uri'] = esc_url( $module_data['uri'] ); |
|
| 524 | - $module_data['module_uri'] = esc_url( $module_data['module_uri'] ); |
|
| 525 | - $module_data['author_uri'] = esc_url( $module_data['author_uri'] ); |
|
| 523 | + $module_data[ 'uri' ] = esc_url( $module_data[ 'uri' ] ); |
|
| 524 | + $module_data[ 'module_uri' ] = esc_url( $module_data[ 'module_uri' ] ); |
|
| 525 | + $module_data[ 'author_uri' ] = esc_url( $module_data[ 'author_uri' ] ); |
|
| 526 | 526 | |
| 527 | - $module_data['title'] = $module_data['name']; |
|
| 528 | - $module_data['author_name'] = $module_data['author']; |
|
| 527 | + $module_data[ 'title' ] = $module_data[ 'name' ]; |
|
| 528 | + $module_data[ 'author_name' ] = $module_data[ 'author' ]; |
|
| 529 | 529 | |
| 530 | 530 | // Apply markup. |
| 531 | 531 | if ( $markup ) { |
| 532 | 532 | |
| 533 | - if ( $module_data['uri'] && $module_data['name'] ) { |
|
| 534 | - $module_data['title'] = '<a href="' . $module_data['uri'] |
|
| 535 | - . '">' . $module_data['name'] . '</a>'; |
|
| 533 | + if ( $module_data[ 'uri' ] && $module_data[ 'name' ] ) { |
|
| 534 | + $module_data[ 'title' ] = '<a href="' . $module_data[ 'uri' ] |
|
| 535 | + . '">' . $module_data[ 'name' ] . '</a>'; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | - if ( $module_data['author_uri'] && $module_data['author'] ) { |
|
| 539 | - $module_data['author'] = '<a href="' . $module_data['author_uri'] |
|
| 540 | - . '">' . $module_data['author'] . '</a>'; |
|
| 538 | + if ( $module_data[ 'author_uri' ] && $module_data[ 'author' ] ) { |
|
| 539 | + $module_data[ 'author' ] = '<a href="' . $module_data[ 'author_uri' ] |
|
| 540 | + . '">' . $module_data[ 'author' ] . '</a>'; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - $module_data['description'] = wptexturize( $module_data['description'] ); |
|
| 543 | + $module_data[ 'description' ] = wptexturize( $module_data[ 'description' ] ); |
|
| 544 | 544 | |
| 545 | - if ( $module_data['author'] ) { |
|
| 546 | - $module_data['description'] .= ' <cite>' |
|
| 545 | + if ( $module_data[ 'author' ] ) { |
|
| 546 | + $module_data[ 'description' ] .= ' <cite>' |
|
| 547 | 547 | // translators: Author name. |
| 548 | - . sprintf( __( 'By %s.', 'wordpoints' ), $module_data['author'] ) |
|
| 548 | + . sprintf( __( 'By %s.', 'wordpoints' ), $module_data[ 'author' ] ) |
|
| 549 | 549 | . '</cite>'; |
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | } else { |
| 554 | 554 | |
| 555 | - $module_data['title'] = $module_data['name']; |
|
| 556 | - $module_data['author_name'] = $module_data['author']; |
|
| 555 | + $module_data[ 'title' ] = $module_data[ 'name' ]; |
|
| 556 | + $module_data[ 'author_name' ] = $module_data[ 'author' ]; |
|
| 557 | 557 | |
| 558 | 558 | } // End if ( $markup || $translate ) else. |
| 559 | 559 | |
@@ -574,8 +574,8 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | $server = false; |
| 576 | 576 | |
| 577 | - if ( isset( $extension['server'] ) ) { |
|
| 578 | - $server = $extension['server']; |
|
| 577 | + if ( isset( $extension[ 'server' ] ) ) { |
|
| 578 | + $server = $extension[ 'server' ]; |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | |
| 729 | 729 | $module_data = wordpoints_get_module_data( $module_file, $markup, $translate ); |
| 730 | 730 | |
| 731 | - if ( empty( $module_data['name'] ) ) { |
|
| 731 | + if ( empty( $module_data[ 'name' ] ) ) { |
|
| 732 | 732 | continue; |
| 733 | 733 | } |
| 734 | 734 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | */ |
| 828 | 828 | function _wordpoints_sort_uname_callback( $a, $b ) { |
| 829 | 829 | |
| 830 | - return strnatcasecmp( $a['name'], $b['name'] ); |
|
| 830 | + return strnatcasecmp( $a[ 'name' ], $b[ 'name' ] ); |
|
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | /** |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | |
| 952 | 952 | } else { |
| 953 | 953 | |
| 954 | - $current[] = $module; |
|
| 954 | + $current[ ] = $module; |
|
| 955 | 955 | sort( $current ); |
| 956 | 956 | update_option( 'wordpoints_active_modules', $current ); |
| 957 | 957 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | $checked = array(); |
| 1118 | 1118 | |
| 1119 | 1119 | foreach ( $modules as $module ) { |
| 1120 | - $checked[] = 'checked[]=' . $module; |
|
| 1120 | + $checked[ ] = 'checked[]=' . $module; |
|
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | ob_start(); |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | $validate = wordpoints_validate_module( $module_file ); |
| 1183 | 1183 | |
| 1184 | 1184 | if ( is_wp_error( $validate ) ) { |
| 1185 | - $errors[] = $module_file; |
|
| 1185 | + $errors[ ] = $module_file; |
|
| 1186 | 1186 | continue; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | if ( ! $deleted ) { |
| 1204 | - $errors[] = $module_file; |
|
| 1204 | + $errors[ ] = $module_file; |
|
| 1205 | 1205 | } |
| 1206 | 1206 | } |
| 1207 | 1207 | |
@@ -1265,7 +1265,7 @@ discard block |
||
| 1265 | 1265 | $slug = WordPoints_Modules::get_slug( $module ); |
| 1266 | 1266 | $data = wordpoints_get_module_data( $module_file, false, false ); |
| 1267 | 1267 | |
| 1268 | - $class = "WordPoints_{$data['namespace']}_Installable"; |
|
| 1268 | + $class = "WordPoints_{$data[ 'namespace' ]}_Installable"; |
|
| 1269 | 1269 | |
| 1270 | 1270 | $uninstaller = new WordPoints_Uninstaller( new $class( $slug ) ); |
| 1271 | 1271 | $uninstaller->run(); |
@@ -1499,7 +1499,7 @@ discard block |
||
| 1499 | 1499 | */ |
| 1500 | 1500 | function wordpoints_recheck_for_extension_updates_after_upgrade( $upgrader, $data ) { |
| 1501 | 1501 | |
| 1502 | - if ( isset( $data['type'] ) && 'translation' === $data['type'] ) { |
|
| 1502 | + if ( isset( $data[ 'type' ] ) && 'translation' === $data[ 'type' ] ) { |
|
| 1503 | 1503 | return; |
| 1504 | 1504 | } |
| 1505 | 1505 | |
@@ -1555,34 +1555,34 @@ discard block |
||
| 1555 | 1555 | */ |
| 1556 | 1556 | function wordpoints_extension_update_counts( $update_data ) { |
| 1557 | 1557 | |
| 1558 | - $update_data['counts']['wordpoints_extensions'] = 0; |
|
| 1558 | + $update_data[ 'counts' ][ 'wordpoints_extensions' ] = 0; |
|
| 1559 | 1559 | |
| 1560 | 1560 | if ( current_user_can( 'update_wordpoints_extensions' ) ) { |
| 1561 | 1561 | $extension_updates = wordpoints_get_extension_updates()->get_new_versions(); |
| 1562 | 1562 | |
| 1563 | 1563 | if ( ! empty( $extension_updates ) ) { |
| 1564 | - $update_data['counts']['wordpoints_extensions'] = count( $extension_updates ); |
|
| 1564 | + $update_data[ 'counts' ][ 'wordpoints_extensions' ] = count( $extension_updates ); |
|
| 1565 | 1565 | |
| 1566 | 1566 | $title = sprintf( |
| 1567 | 1567 | // translators: Number of updates. |
| 1568 | 1568 | _n( |
| 1569 | 1569 | '%d WordPoints Extension Update' |
| 1570 | 1570 | , '%d WordPoints Extension Updates' |
| 1571 | - , $update_data['counts']['wordpoints_extensions'] |
|
| 1571 | + , $update_data[ 'counts' ][ 'wordpoints_extensions' ] |
|
| 1572 | 1572 | , 'wordpoints' |
| 1573 | 1573 | ) |
| 1574 | - , $update_data['counts']['wordpoints_extensions'] |
|
| 1574 | + , $update_data[ 'counts' ][ 'wordpoints_extensions' ] |
|
| 1575 | 1575 | ); |
| 1576 | 1576 | |
| 1577 | - if ( ! empty( $update_data['title'] ) ) { |
|
| 1578 | - $update_data['title'] .= ', '; |
|
| 1577 | + if ( ! empty( $update_data[ 'title' ] ) ) { |
|
| 1578 | + $update_data[ 'title' ] .= ', '; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | - $update_data['title'] .= esc_attr( $title ); |
|
| 1581 | + $update_data[ 'title' ] .= esc_attr( $title ); |
|
| 1582 | 1582 | } |
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | - $update_data['counts']['total'] += $update_data['counts']['wordpoints_extensions']; |
|
| 1585 | + $update_data[ 'counts' ][ 'total' ] += $update_data[ 'counts' ][ 'wordpoints_extensions' ]; |
|
| 1586 | 1586 | |
| 1587 | 1587 | return $update_data; |
| 1588 | 1588 | } |
@@ -1614,12 +1614,12 @@ discard block |
||
| 1614 | 1614 | ); |
| 1615 | 1615 | |
| 1616 | 1616 | if ( |
| 1617 | - empty( $data['ID'] ) |
|
| 1618 | - && ( 'J.D. Grimes' === $data['author'] || 'WordPoints' === $data['author'] ) |
|
| 1619 | - && isset( $missing_headers[ $data['name'] ] ) |
|
| 1617 | + empty( $data[ 'ID' ] ) |
|
| 1618 | + && ( 'J.D. Grimes' === $data[ 'author' ] || 'WordPoints' === $data[ 'author' ] ) |
|
| 1619 | + && isset( $missing_headers[ $data[ 'name' ] ] ) |
|
| 1620 | 1620 | ) { |
| 1621 | - $data['server'] = 'wordpoints.org'; |
|
| 1622 | - $data['ID'] = $missing_headers[ $data['name'] ]; |
|
| 1621 | + $data[ 'server' ] = 'wordpoints.org'; |
|
| 1622 | + $data[ 'ID' ] = $missing_headers[ $data[ 'name' ] ]; |
|
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | 1625 | return $data; |