@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | parent::add_strings(); |
| 68 | 68 | |
| 69 | 69 | // translators: 1. Extension Name; 2. Count of update; 3. Total number of updates being installed. |
| 70 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Extension %1$s (%2$d/%3$d)', 'wordpoints' ); |
|
| 70 | + $this->upgrader->strings[ 'skin_before_update_header' ] = __( 'Updating Extension %1$s (%2$d/%3$d)', 'wordpoints' ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function before( $title = '' ) { |
| 97 | 97 | |
| 98 | - parent::before( $this->extension_info['name'] ); |
|
| 98 | + parent::before( $this->extension_info[ 'name' ] ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function after( $title = '' ) { |
| 105 | 105 | |
| 106 | - parent::after( $this->extension_info['name'] ); |
|
| 106 | + parent::after( $this->extension_info[ 'name' ] ); |
|
| 107 | 107 | |
| 108 | 108 | if ( ! empty( $this->extension ) && ! is_wp_error( $this->result ) && $this->extension_active ) { |
| 109 | 109 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | if ( ! current_user_can( 'activate_wordpoints_extensions' ) ) { |
| 142 | - unset( $update_actions['extensions_page'] ); |
|
| 142 | + unset( $update_actions[ 'extensions_page' ] ); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -147,20 +147,20 @@ |
||
| 147 | 147 | $cache = array(); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( isset( $cache['time_checked'] ) ) { |
|
| 151 | - $this->time = $cache['time_checked']; |
|
| 150 | + if ( isset( $cache[ 'time_checked' ] ) ) { |
|
| 151 | + $this->time = $cache[ 'time_checked' ]; |
|
| 152 | 152 | } else { |
| 153 | 153 | $this->time = 0; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( isset( $cache['checked_versions'] ) ) { |
|
| 157 | - $this->checked_versions = $cache['checked_versions']; |
|
| 156 | + if ( isset( $cache[ 'checked_versions' ] ) ) { |
|
| 157 | + $this->checked_versions = $cache[ 'checked_versions' ]; |
|
| 158 | 158 | } else { |
| 159 | 159 | $this->checked_versions = array(); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( isset( $cache['new_versions'] ) ) { |
|
| 163 | - $this->new_versions = $cache['new_versions']; |
|
| 162 | + if ( isset( $cache[ 'new_versions' ] ) ) { |
|
| 163 | + $this->new_versions = $cache[ 'new_versions' ]; |
|
| 164 | 164 | } else { |
| 165 | 165 | $this->new_versions = array(); |
| 166 | 166 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $extension_data = new WordPoints_Extension_Server_API_Extension_Data( |
| 234 | - $extension_data['ID'] |
|
| 234 | + $extension_data[ 'ID' ] |
|
| 235 | 235 | , $server |
| 236 | 236 | ); |
| 237 | 237 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Force refresh of extension update cache. |
| 275 | - wordpoints_clean_extensions_cache( $args['clear_update_cache'] ); |
|
| 275 | + wordpoints_clean_extensions_cache( $args[ 'clear_update_cache' ] ); |
|
| 276 | 276 | |
| 277 | 277 | $details = array( |
| 278 | 278 | 'action' => 'update', |
@@ -364,14 +364,14 @@ discard block |
||
| 364 | 364 | return $return; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( empty( $data['wordpoints_extension'] ) ) { |
|
| 368 | - return new WP_Error( 'bad_request', $this->strings['bad_request'] ); |
|
| 367 | + if ( empty( $data[ 'wordpoints_extension' ] ) ) { |
|
| 368 | + return new WP_Error( 'bad_request', $this->strings[ 'bad_request' ] ); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - if ( is_wordpoints_module_active( $data['wordpoints_extension'] ) ) { |
|
| 371 | + if ( is_wordpoints_module_active( $data[ 'wordpoints_extension' ] ) ) { |
|
| 372 | 372 | |
| 373 | 373 | // Deactivate the extension silently (the actions won't be fired). |
| 374 | - wordpoints_deactivate_modules( array( $data['wordpoints_extension'] ), true ); |
|
| 374 | + wordpoints_deactivate_modules( array( $data[ 'wordpoints_extension' ] ), true ); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | return $return; |
@@ -399,12 +399,12 @@ discard block |
||
| 399 | 399 | return $source; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if ( $upgrader !== $this || ! isset( $data['wordpoints_extension'] ) ) { |
|
| 402 | + if ( $upgrader !== $this || ! isset( $data[ 'wordpoints_extension' ] ) ) { |
|
| 403 | 403 | return $source; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $source_name = basename( $source ); |
| 407 | - $extension_name = dirname( $data['wordpoints_extension'] ); |
|
| 407 | + $extension_name = dirname( $data[ 'wordpoints_extension' ] ); |
|
| 408 | 408 | |
| 409 | 409 | if ( '.' === $extension_name || $source_name === $extension_name ) { |
| 410 | 410 | return $source; |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $moved = $wp_filesystem->move( $source, $correct_source ); |
| 416 | 416 | |
| 417 | 417 | if ( ! $moved ) { |
| 418 | - return new WP_Error( 'wordpoints_incorrect_source_name', $this->strings['incorrect_source_name'] ); |
|
| 418 | + return new WP_Error( 'wordpoints_incorrect_source_name', $this->strings[ 'incorrect_source_name' ] ); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return $correct_source; |
@@ -444,12 +444,12 @@ discard block |
||
| 444 | 444 | return $removed; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - if ( empty( $data['wordpoints_extension'] ) ) { |
|
| 448 | - return new WP_Error( 'bad_request', $this->strings['bad_request'] ); |
|
| 447 | + if ( empty( $data[ 'wordpoints_extension' ] ) ) { |
|
| 448 | + return new WP_Error( 'bad_request', $this->strings[ 'bad_request' ] ); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | $extensions_dir = $wp_filesystem->find_folder( wordpoints_extensions_dir() ); |
| 452 | - $this_extension_dir = trailingslashit( dirname( $extensions_dir . $data['wordpoints_extension'] ) ); |
|
| 452 | + $this_extension_dir = trailingslashit( dirname( $extensions_dir . $data[ 'wordpoints_extension' ] ) ); |
|
| 453 | 453 | |
| 454 | 454 | // Make sure it hasn't already been removed somehow. |
| 455 | 455 | if ( ! $wp_filesystem->exists( $this_extension_dir ) ) { |
@@ -461,14 +461,14 @@ discard block |
||
| 461 | 461 | * Do a base check on if the extension includes the directory separator AND that |
| 462 | 462 | * it's not the root extensions folder. If not, just delete the single file. |
| 463 | 463 | */ |
| 464 | - if ( strpos( $data['wordpoints_extension'], '/' ) && $this_extension_dir !== $extensions_dir ) { |
|
| 464 | + if ( strpos( $data[ 'wordpoints_extension' ], '/' ) && $this_extension_dir !== $extensions_dir ) { |
|
| 465 | 465 | $deleted = $wp_filesystem->delete( $this_extension_dir, true ); |
| 466 | 466 | } else { |
| 467 | - $deleted = $wp_filesystem->delete( $extensions_dir . $data['wordpoints_extension'] ); |
|
| 467 | + $deleted = $wp_filesystem->delete( $extensions_dir . $data[ 'wordpoints_extension' ] ); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | if ( ! $deleted ) { |
| 471 | - return new WP_Error( 'remove_old_failed', $this->strings['remove_old_failed'] ); |
|
| 471 | + return new WP_Error( 'remove_old_failed', $this->strings[ 'remove_old_failed' ] ); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | return true; |
@@ -159,8 +159,8 @@ |
||
| 159 | 159 | |
| 160 | 160 | $headers = wp_get_http_headers( $this->get_url() ); |
| 161 | 161 | |
| 162 | - if ( isset( $headers['x-wordpoints-extension-api'] ) ) { |
|
| 163 | - $api = str_replace( '-', '_', sanitize_key( $headers['x-wordpoints-extension-api'] ) ); |
|
| 162 | + if ( isset( $headers[ 'x-wordpoints-extension-api' ] ) ) { |
|
| 163 | + $api = str_replace( '-', '_', sanitize_key( $headers[ 'x-wordpoints-extension-api' ] ) ); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Save it as a string, so we can tell when it has expired. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $args = array_merge( $defaults, $args ); |
| 65 | 65 | |
| 66 | - $this->type = $args['type']; |
|
| 66 | + $this->type = $args[ 'type' ]; |
|
| 67 | 67 | |
| 68 | 68 | parent::__construct( $args ); |
| 69 | 69 | } |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | if ( is_multisite() && current_user_can( 'manage_network_wordpoints_extensions' ) ) { |
| 89 | 89 | |
| 90 | - $install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=activate&networkwide=1&module=' . rawurlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
| 90 | + $install_actions[ 'network_activate' ] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=activate&networkwide=1&module=' . rawurlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
| 91 | 91 | |
| 92 | 92 | } elseif ( current_user_can( 'activate_wordpoints_extensions' ) ) { |
| 93 | 93 | |
| 94 | - $install_actions['activate_module'] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=activate&module=' . rawurlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Activate Extension', 'wordpoints' ) . '</a>'; |
|
| 94 | + $install_actions[ 'activate_module' ] = '<a class="button button-primary" href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_extensions&action=activate&module=' . rawurlencode( $module_file ) ), "activate-module_{$module_file}" ) . '" target="_parent">' . esc_html__( 'Activate Extension', 'wordpoints' ) . '</a>'; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $install_actions['modules_page'] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_extensions' ) ) . '" target="_parent">' . esc_html__( 'Return to Extensions page', 'wordpoints' ) . '</a>'; |
|
| 99 | - $install_actions['install_page'] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_install_extensions' ) ) . '" target="_parent">' . esc_html__( 'Return to Extension Installer', 'wordpoints' ) . '</a>'; |
|
| 98 | + $install_actions[ 'modules_page' ] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_extensions' ) ) . '" target="_parent">' . esc_html__( 'Return to Extensions page', 'wordpoints' ) . '</a>'; |
|
| 99 | + $install_actions[ 'install_page' ] = '<a href="' . esc_url( self_admin_url( 'admin.php?page=wordpoints_install_extensions' ) ) . '" target="_parent">' . esc_html__( 'Return to Extension Installer', 'wordpoints' ) . '</a>'; |
|
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * The install module action links. |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | if ( $wp_filesystem->mkdir( $extensions_dir, FS_CHMOD_DIR ) ) { |
| 81 | 81 | $wp_filesystem->put_contents( $extensions_dir . '/index.php', '<?php // Gold is silent.' ); |
| 82 | 82 | } else { |
| 83 | - return new WP_Error( 'mkdir_failed_modules', $this->strings['mkdir_failed_modules'], $extensions_dir ); |
|
| 83 | + return new WP_Error( 'mkdir_failed_modules', $this->strings[ 'mkdir_failed_modules' ], $extensions_dir ); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $wp_theme_directories[] = $extensions_dir; |
|
| 87 | + $wp_theme_directories[ ] = $extensions_dir; |
|
| 88 | 88 | |
| 89 | 89 | $result = parent::install_package( $args ); |
| 90 | 90 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Force refresh of modules cache. |
| 147 | - wordpoints_clean_extensions_cache( $args['clear_update_cache'] ); |
|
| 147 | + wordpoints_clean_extensions_cache( $args[ 'clear_update_cache' ] ); |
|
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * This action is documented in /wp-admin/includes/class-wp-upgrader.php. |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $module_data = wordpoints_get_module_data( $file, false, false ); |
| 202 | 202 | |
| 203 | - if ( ! empty( $module_data['name'] ) ) { |
|
| 203 | + if ( ! empty( $module_data[ 'name' ] ) ) { |
|
| 204 | 204 | $modules_found = true; |
| 205 | 205 | break; |
| 206 | 206 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | return new WP_Error( |
| 212 | 212 | 'incompatible_archive_no_modules' |
| 213 | - , $this->strings['incompatible_archive'] |
|
| 213 | + , $this->strings[ 'incompatible_archive' ] |
|
| 214 | 214 | , esc_html__( 'No valid extensions were found.', 'wordpoints' ) |
| 215 | 215 | ); |
| 216 | 216 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function module_info() { |
| 231 | 231 | |
| 232 | - if ( ! is_array( $this->result ) || empty( $this->result['destination_name'] ) ) { |
|
| 232 | + if ( ! is_array( $this->result ) || empty( $this->result[ 'destination_name' ] ) ) { |
|
| 233 | 233 | return false; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - $module = wordpoints_get_modules( '/' . $this->result['destination_name'] ); |
|
| 236 | + $module = wordpoints_get_modules( '/' . $this->result[ 'destination_name' ] ); |
|
| 237 | 237 | |
| 238 | 238 | if ( empty( $module ) ) { |
| 239 | 239 | return false; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | // Assume the requested module is the first in the list. |
| 243 | 243 | $module_files = array_keys( $module ); |
| 244 | 244 | |
| 245 | - return $this->result['destination_name'] . '/' . $module_files[0]; |
|
| 245 | + return $this->result[ 'destination_name' ] . '/' . $module_files[ 0 ]; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | } // End class WordPoints_Module_Installer. |
@@ -94,8 +94,8 @@ |
||
| 94 | 94 | $entity = clone $this->entity_object; |
| 95 | 95 | |
| 96 | 96 | if ( $entity->set_the_value( $value ) ) { |
| 97 | - $this->the_entities[] = $entity; |
|
| 98 | - $this->the_value[] = $entity->get_the_id(); |
|
| 97 | + $this->the_entities[ ] = $entity; |
|
| 98 | + $this->the_value[ ] = $entity->get_the_id(); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | 'type' => 'db', |
| 53 | 53 | 'info' => array( |
| 54 | 54 | 'type' => 'table', |
| 55 | - 'table_name' => $GLOBALS['wpdb']->{$this->wpdb_table_name}, |
|
| 55 | + 'table_name' => $GLOBALS[ 'wpdb' ]->{$this->wpdb_table_name}, |
|
| 56 | 56 | 'attr_field' => $this->attr_field, |
| 57 | 57 | 'entity_id_field' => $this->entity_id_field, |
| 58 | 58 | ), |
@@ -89,11 +89,11 @@ |
||
| 89 | 89 | 'type' => 'db', |
| 90 | 90 | 'info' => array( |
| 91 | 91 | 'type' => 'table', |
| 92 | - 'table_name' => $GLOBALS['wpdb']->{$this->wpdb_table_name}, |
|
| 92 | + 'table_name' => $GLOBALS[ 'wpdb' ]->{$this->wpdb_table_name}, |
|
| 93 | 93 | 'conditions' => array( |
| 94 | 94 | array( |
| 95 | 95 | 'field' => array( |
| 96 | - 'table_name' => $GLOBALS['wpdb']->posts, |
|
| 96 | + 'table_name' => $GLOBALS[ 'wpdb' ]->posts, |
|
| 97 | 97 | 'on' => array( |
| 98 | 98 | 'primary_field' => 'comment_post_ID', |
| 99 | 99 | 'join_field' => 'ID', |