@@ -853,7 +853,8 @@ discard block |
||
| 853 | 853 | |
| 854 | 854 | $tab = ''; |
| 855 | 855 | |
| 856 | - if ( isset( $_GET['tab'] ) ) { // WPCS: CSRF OK. |
|
| 856 | + if ( isset( $_GET['tab'] ) ) { |
|
| 857 | +// WPCS: CSRF OK. |
|
| 857 | 858 | |
| 858 | 859 | $tab = sanitize_key( $_GET['tab'] ); // WPCS: CSRF OK. |
| 859 | 860 | } |
@@ -892,7 +893,8 @@ discard block |
||
| 892 | 893 | |
| 893 | 894 | $page = ''; |
| 894 | 895 | |
| 895 | - if ( isset( $_GET['page'] ) ) { // WPCS: CSRF OK. |
|
| 896 | + if ( isset( $_GET['page'] ) ) { |
|
| 897 | +// WPCS: CSRF OK. |
|
| 896 | 898 | $page = sanitize_key( $_GET['page'] ); // WPCS: CSRF OK. |
| 897 | 899 | } |
| 898 | 900 | |
@@ -1231,7 +1233,8 @@ discard block |
||
| 1231 | 1233 | */ |
| 1232 | 1234 | function wordpoints_admin_ajax_breaking_module_check() { |
| 1233 | 1235 | |
| 1234 | - if ( ! isset( $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
| 1236 | + if ( ! isset( $_GET['wordpoints_module_check'] ) ) { |
|
| 1237 | +// WPCS: CSRF OK. |
|
| 1235 | 1238 | wp_die( '', 400 ); |
| 1236 | 1239 | } |
| 1237 | 1240 | |
@@ -1241,7 +1244,8 @@ discard block |
||
| 1241 | 1244 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
| 1242 | 1245 | } |
| 1243 | 1246 | |
| 1244 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
| 1247 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { |
|
| 1248 | +// WPCS: CSRF OK. |
|
| 1245 | 1249 | wp_die( '', 403 ); |
| 1246 | 1250 | } |
| 1247 | 1251 | |
@@ -644,14 +644,14 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | if ( $child instanceof WordPoints_Entity_Attr ) { |
| 646 | 646 | |
| 647 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
| 648 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
| 647 | + $child_data[ $child_slug ][ '_type' ] = 'attr'; |
|
| 648 | + $child_data[ $child_slug ][ 'data_type' ] = $child->get_data_type(); |
|
| 649 | 649 | |
| 650 | 650 | } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
| 651 | 651 | |
| 652 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
| 653 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
| 654 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
| 652 | + $child_data[ $child_slug ][ '_type' ] = 'relationship'; |
|
| 653 | + $child_data[ $child_slug ][ 'primary' ] = $child->get_primary_entity_slug(); |
|
| 654 | + $child_data[ $child_slug ][ 'secondary' ] = $child->get_related_entity_slug(); |
|
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | /** |
@@ -683,14 +683,14 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | foreach ( $entity->get_enumerated_values() as $value ) { |
| 685 | 685 | if ( $entity->set_the_value( $value ) ) { |
| 686 | - $values[] = array( |
|
| 686 | + $values[ ] = array( |
|
| 687 | 687 | 'value' => $entity->get_the_id(), |
| 688 | 688 | 'label' => $entity->get_the_human_id(), |
| 689 | 689 | ); |
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - $entities_data[ $slug ]['values'] = $values; |
|
| 693 | + $entities_data[ $slug ][ 'values' ] = $values; |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | /** |
@@ -822,9 +822,9 @@ discard block |
||
| 822 | 822 | |
| 823 | 823 | $args = array_merge( $defaults, $args ); |
| 824 | 824 | |
| 825 | - if ( isset( $args['dismissable'] ) ) { |
|
| 825 | + if ( isset( $args[ 'dismissable' ] ) ) { |
|
| 826 | 826 | |
| 827 | - $args['dismissible'] = $args['dismissable']; |
|
| 827 | + $args[ 'dismissible' ] = $args[ 'dismissable' ]; |
|
| 828 | 828 | |
| 829 | 829 | _deprecated_argument( |
| 830 | 830 | __FUNCTION__ |
@@ -844,26 +844,26 @@ discard block |
||
| 844 | 844 | ); |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - if ( $args['dismissible'] && $args['option'] ) { |
|
| 847 | + if ( $args[ 'dismissible' ] && $args[ 'option' ] ) { |
|
| 848 | 848 | wp_enqueue_script( 'wordpoints-admin-dismiss-notice' ); |
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | ?> |
| 852 | 852 | |
| 853 | 853 | <div |
| 854 | - class="notice notice-<?php echo sanitize_html_class( $type, 'success' ); ?><?php echo ( $args['dismissible'] ) ? ' is-dismissible' : ''; ?>" |
|
| 855 | - <?php if ( $args['dismissible'] && $args['option'] ) : ?> |
|
| 856 | - data-nonce="<?php echo esc_attr( wp_create_nonce( "wordpoints_dismiss_notice-{$args['option']}" ) ); ?>" |
|
| 857 | - data-option="<?php echo esc_attr( $args['option'] ); ?>" |
|
| 854 | + class="notice notice-<?php echo sanitize_html_class( $type, 'success' ); ?><?php echo ( $args[ 'dismissible' ] ) ? ' is-dismissible' : ''; ?>" |
|
| 855 | + <?php if ( $args[ 'dismissible' ] && $args[ 'option' ] ) : ?> |
|
| 856 | + data-nonce="<?php echo esc_attr( wp_create_nonce( "wordpoints_dismiss_notice-{$args[ 'option' ]}" ) ); ?>" |
|
| 857 | + data-option="<?php echo esc_attr( $args[ 'option' ] ); ?>" |
|
| 858 | 858 | <?php endif; ?> |
| 859 | 859 | > |
| 860 | 860 | <p> |
| 861 | 861 | <?php echo wp_kses( $message, 'wordpoints_admin_message' ); ?> |
| 862 | 862 | </p> |
| 863 | - <?php if ( $args['dismissible'] && $args['option'] ) : ?> |
|
| 863 | + <?php if ( $args[ 'dismissible' ] && $args[ 'option' ] ) : ?> |
|
| 864 | 864 | <form method="post" class="wordpoints-notice-dismiss-form" style="padding-bottom: 5px;"> |
| 865 | - <input type="hidden" name="wordpoints_notice" value="<?php echo esc_html( $args['option'] ); ?>" /> |
|
| 866 | - <?php wp_nonce_field( "wordpoints_dismiss_notice-{$args['option']}" ); ?> |
|
| 865 | + <input type="hidden" name="wordpoints_notice" value="<?php echo esc_html( $args[ 'option' ] ); ?>" /> |
|
| 866 | + <?php wp_nonce_field( "wordpoints_dismiss_notice-{$args[ 'option' ]}" ); ?> |
|
| 867 | 867 | <?php submit_button( __( 'Hide This Notice', 'wordpoints' ), 'secondary', 'wordpoints_dismiss_notice', false ); ?> |
| 868 | 868 | </form> |
| 869 | 869 | <?php endif; ?> |
@@ -886,9 +886,9 @@ discard block |
||
| 886 | 886 | |
| 887 | 887 | $tab = ''; |
| 888 | 888 | |
| 889 | - if ( isset( $_GET['tab'] ) ) { // WPCS: CSRF OK. |
|
| 889 | + if ( isset( $_GET[ 'tab' ] ) ) { // WPCS: CSRF OK. |
|
| 890 | 890 | |
| 891 | - $tab = sanitize_key( $_GET['tab'] ); // WPCS: CSRF OK. |
|
| 891 | + $tab = sanitize_key( $_GET[ 'tab' ] ); // WPCS: CSRF OK. |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if ( isset( $tabs ) && ! isset( $tabs[ $tab ] ) ) { |
@@ -925,8 +925,8 @@ discard block |
||
| 925 | 925 | |
| 926 | 926 | $page = ''; |
| 927 | 927 | |
| 928 | - if ( isset( $_GET['page'] ) ) { // WPCS: CSRF OK. |
|
| 929 | - $page = sanitize_key( $_GET['page'] ); // WPCS: CSRF OK. |
|
| 928 | + if ( isset( $_GET[ 'page' ] ) ) { // WPCS: CSRF OK. |
|
| 929 | + $page = sanitize_key( $_GET[ 'page' ] ); // WPCS: CSRF OK. |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | foreach ( $tabs as $tab => $name ) { |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | |
| 1068 | 1068 | $info = wordpoints_get_module_data( $file, false, false ); |
| 1069 | 1069 | |
| 1070 | - if ( ! empty( $info['name'] ) ) { |
|
| 1070 | + if ( ! empty( $info[ 'name' ] ) ) { |
|
| 1071 | 1071 | $source = new WP_Error( |
| 1072 | 1072 | 'wordpoints_module_archive_not_plugin' |
| 1073 | 1073 | , $source->get_error_message() |
@@ -1207,9 +1207,9 @@ discard block |
||
| 1207 | 1207 | , 'post' |
| 1208 | 1208 | ); |
| 1209 | 1209 | |
| 1210 | - if ( $is_notice_dismissed && isset( $_POST['wordpoints_notice'] ) ) { |
|
| 1210 | + if ( $is_notice_dismissed && isset( $_POST[ 'wordpoints_notice' ] ) ) { |
|
| 1211 | 1211 | |
| 1212 | - $option = sanitize_key( $_POST['wordpoints_notice'] ); |
|
| 1212 | + $option = sanitize_key( $_POST[ 'wordpoints_notice' ] ); |
|
| 1213 | 1213 | |
| 1214 | 1214 | if ( ! is_network_admin() && 'wordpoints_incompatible_modules' === $option ) { |
| 1215 | 1215 | delete_option( $option ); |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | */ |
| 1265 | 1265 | function wordpoints_admin_ajax_breaking_module_check() { |
| 1266 | 1266 | |
| 1267 | - if ( ! isset( $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
| 1267 | + if ( ! isset( $_GET[ 'wordpoints_module_check' ] ) ) { // WPCS: CSRF OK. |
|
| 1268 | 1268 | wp_die( '', 400 ); |
| 1269 | 1269 | } |
| 1270 | 1270 | |
@@ -1274,12 +1274,12 @@ discard block |
||
| 1274 | 1274 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
| 1277 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET[ 'wordpoints_module_check' ] ) ) ) { // WPCS: CSRF OK. |
|
| 1278 | 1278 | wp_die( '', 403 ); |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | 1281 | // The list table constructor calls WP_Screen::get(), which expects this. |
| 1282 | - $GLOBALS['hook_suffix'] = null; |
|
| 1282 | + $GLOBALS[ 'hook_suffix' ] = null; |
|
| 1283 | 1283 | |
| 1284 | 1284 | wordpoints_admin_screen_modules(); |
| 1285 | 1285 | |
@@ -1346,14 +1346,14 @@ discard block |
||
| 1346 | 1346 | |
| 1347 | 1347 | preg_match( |
| 1348 | 1348 | '/requires php (\d+\.\d+(?:\.\d)?)/i' |
| 1349 | - , $info->sections['description'] |
|
| 1349 | + , $info->sections[ 'description' ] |
|
| 1350 | 1350 | , $matches |
| 1351 | 1351 | ); |
| 1352 | 1352 | |
| 1353 | 1353 | $version = false; |
| 1354 | 1354 | |
| 1355 | - if ( ! empty( $matches[1] ) ) { |
|
| 1356 | - $version = $matches[1]; |
|
| 1355 | + if ( ! empty( $matches[ 1 ] ) ) { |
|
| 1356 | + $version = $matches[ 1 ]; |
|
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | $updates->response[ $plugin_basename ]->wordpoints_required_php = $version; |
@@ -1494,7 +1494,7 @@ discard block |
||
| 1494 | 1494 | |
| 1495 | 1495 | // JavaScript to disable the bulk upgrade checkbox. |
| 1496 | 1496 | // See WP_Plugins_List_Table::single_row(). |
| 1497 | - $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] ); |
|
| 1497 | + $checkbox_id = 'checkbox_' . md5( $plugin_data[ 'Name' ] ); |
|
| 1498 | 1498 | |
| 1499 | 1499 | ?> |
| 1500 | 1500 | |
@@ -13,15 +13,15 @@ |
||
| 13 | 13 | |
| 14 | 14 | if ( |
| 15 | 15 | 'components' !== wordpoints_admin_get_current_tab() |
| 16 | - || ! isset( $_POST['wordpoints_component'], $_POST['wordpoints_component_action'], $_POST['_wpnonce'] ) |
|
| 16 | + || ! isset( $_POST[ 'wordpoints_component' ], $_POST[ 'wordpoints_component_action' ], $_POST[ '_wpnonce' ] ) |
|
| 17 | 17 | ) { |
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $components = WordPoints_Components::instance(); |
| 22 | -$component = sanitize_key( $_POST['wordpoints_component'] ); |
|
| 22 | +$component = sanitize_key( $_POST[ 'wordpoints_component' ] ); |
|
| 23 | 23 | |
| 24 | -$action = sanitize_key( $_POST['wordpoints_component_action'] ); |
|
| 24 | +$action = sanitize_key( $_POST[ 'wordpoints_component_action' ] ); |
|
| 25 | 25 | |
| 26 | 26 | check_admin_referer( "wordpoints_{$action}_component-{$component}" ); |
| 27 | 27 | |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( |
| 15 | - isset( $_POST['wordpoints_settings_nonce'], $_POST['excluded_users'] ) |
|
| 15 | + isset( $_POST[ 'wordpoints_settings_nonce' ], $_POST[ 'excluded_users' ] ) |
|
| 16 | 16 | && wordpoints_verify_nonce( 'wordpoints_settings_nonce', 'wordpoints_settings_submit', null, 'post' ) |
| 17 | 17 | ) { |
| 18 | 18 | |
| 19 | 19 | // - The form has been submitted. |
| 20 | 20 | |
| 21 | - $excluded_users = preg_replace( '/\s/', '', sanitize_text_field( wp_unslash( $_POST['excluded_users'] ) ) ); |
|
| 21 | + $excluded_users = preg_replace( '/\s/', '', sanitize_text_field( wp_unslash( $_POST[ 'excluded_users' ] ) ) ); |
|
| 22 | 22 | |
| 23 | 23 | if ( ! empty( $excluded_users ) ) { |
| 24 | 24 | |
@@ -25,22 +25,22 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -if ( isset( $_GET['error'] ) ) { |
|
| 28 | +if ( isset( $_GET[ 'error' ] ) ) { |
|
| 29 | 29 | |
| 30 | - if ( isset( $_GET['main'] ) ) { |
|
| 30 | + if ( isset( $_GET[ 'main' ] ) ) { |
|
| 31 | 31 | |
| 32 | 32 | wordpoints_show_admin_error( |
| 33 | 33 | esc_html__( 'You cannot delete a module while it is active on the main site.', 'wordpoints' ) |
| 34 | 34 | , array( 'dismissible' => true ) |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - } elseif ( isset( $_GET['charsout'] ) ) { |
|
| 37 | + } elseif ( isset( $_GET[ 'charsout' ] ) ) { |
|
| 38 | 38 | |
| 39 | 39 | wordpoints_show_admin_message( |
| 40 | 40 | sprintf( |
| 41 | 41 | // translators: Number of characters. |
| 42 | 42 | __( 'The module generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this module.', 'wordpoints' ) |
| 43 | - , (int) $_GET['charsout'] // WPCS: CSRF OK. |
|
| 43 | + , (int) $_GET[ 'charsout' ] // WPCS: CSRF OK. |
|
| 44 | 44 | ) |
| 45 | 45 | , 'warning' |
| 46 | 46 | , array( 'dismissible' => true ) |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | $error_message = __( 'Module could not be activated because it triggered a <strong>fatal error</strong>.', 'wordpoints' ); |
| 52 | 52 | |
| 53 | 53 | if ( |
| 54 | - isset( $_GET['_error_nonce'], $_GET['module'] ) |
|
| 54 | + isset( $_GET[ '_error_nonce' ], $_GET[ 'module' ] ) |
|
| 55 | 55 | && wordpoints_verify_nonce( '_error_nonce', 'module-activation-error_%s', array( 'module' ) ) |
| 56 | 56 | ) { |
| 57 | 57 | |
| 58 | 58 | $url = self_admin_url( |
| 59 | 59 | 'admin.php?page=wordpoints_modules&action=error_scrape&module=' |
| 60 | - . sanitize_text_field( wp_unslash( $_GET['module'] ) ) |
|
| 61 | - . '&_wpnonce=' . sanitize_key( $_GET['_error_nonce'] ) |
|
| 60 | + . sanitize_text_field( wp_unslash( $_GET[ 'module' ] ) ) |
|
| 61 | + . '&_wpnonce=' . sanitize_key( $_GET[ '_error_nonce' ] ) |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | ?> |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | } // End if ( main error ) elseif ( unexpected output error ) else. |
| 84 | 84 | |
| 85 | -} elseif ( isset( $_GET['deleted'] ) ) { |
|
| 85 | +} elseif ( isset( $_GET[ 'deleted' ] ) ) { |
|
| 86 | 86 | |
| 87 | 87 | $user_id = get_current_user_id(); |
| 88 | 88 | $delete_result = get_transient( 'wordpoints_modules_delete_result_' . $user_id ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | -} elseif ( isset( $_GET['activate'] ) ) { |
|
| 113 | +} elseif ( isset( $_GET[ 'activate' ] ) ) { |
|
| 114 | 114 | |
| 115 | 115 | wordpoints_show_admin_message( |
| 116 | 116 | __( 'Module <strong>activated</strong>.', 'wordpoints' ) |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | , array( 'dismissible' => true ) |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | -} elseif ( isset( $_GET['activate-multi'] ) ) { |
|
| 121 | +} elseif ( isset( $_GET[ 'activate-multi' ] ) ) { |
|
| 122 | 122 | |
| 123 | 123 | wordpoints_show_admin_message( |
| 124 | 124 | __( 'Selected modules <strong>activated</strong>.', 'wordpoints' ) |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | , array( 'dismissible' => true ) |
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | -} elseif ( isset( $_GET['deactivate'] ) ) { |
|
| 129 | +} elseif ( isset( $_GET[ 'deactivate' ] ) ) { |
|
| 130 | 130 | |
| 131 | 131 | wordpoints_show_admin_message( |
| 132 | 132 | __( 'Module <strong>deactivated</strong>.', 'wordpoints' ) |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | , array( 'dismissible' => true ) |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | -} elseif ( isset( $_GET['deactivate-multi'] ) ) { |
|
| 137 | +} elseif ( isset( $_GET[ 'deactivate-multi' ] ) ) { |
|
| 138 | 138 | |
| 139 | 139 | wordpoints_show_admin_message( |
| 140 | 140 | __( 'Selected modules <strong>deactivated</strong>.', 'wordpoints' ) |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | , array( 'dismissible' => true ) |
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | -} elseif ( isset( $_REQUEST['action'] ) && 'update-selected' === sanitize_key( $_REQUEST['action'] ) ) { |
|
| 145 | +} elseif ( isset( $_REQUEST[ 'action' ] ) && 'update-selected' === sanitize_key( $_REQUEST[ 'action' ] ) ) { |
|
| 146 | 146 | |
| 147 | 147 | wordpoints_show_admin_message( |
| 148 | 148 | esc_html__( 'No out of date modules were selected.', 'wordpoints' ) |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_install_modules' ) ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'module', 'wordpoints' ); ?></a> |
| 163 | 163 | <?php endif; ?> |
| 164 | 164 | |
| 165 | - <?php if ( ! empty( $_REQUEST['s'] ) ) : ?> |
|
| 165 | + <?php if ( ! empty( $_REQUEST[ 's' ] ) ) : ?> |
|
| 166 | 166 | <span class="subtitle"> |
| 167 | 167 | <?php |
| 168 | 168 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | sprintf( |
| 171 | 171 | // translators: Search term. |
| 172 | 172 | __( 'Search results for “%s”', 'wordpoints' ) |
| 173 | - , sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) |
|
| 173 | + , sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) |
|
| 174 | 174 | ) |
| 175 | 175 | ); |
| 176 | 176 | |
@@ -9,22 +9,22 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | global $status, $wp_version; |
| 11 | 11 | |
| 12 | -if ( isset( $_POST['clear-recent-list'] ) ) { |
|
| 12 | +if ( isset( $_POST[ 'clear-recent-list' ] ) ) { |
|
| 13 | 13 | $action = 'clear-recent-list'; |
| 14 | -} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { // WPCS: CSRF OK. |
|
| 15 | - $action = sanitize_key( $_REQUEST['action'] ); |
|
| 16 | -} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { // WPCS: CSRF OK. |
|
| 17 | - $action = sanitize_key( $_REQUEST['action2'] ); |
|
| 14 | +} elseif ( isset( $_REQUEST[ 'action' ] ) && -1 !== (int) $_REQUEST[ 'action' ] ) { // WPCS: CSRF OK. |
|
| 15 | + $action = sanitize_key( $_REQUEST[ 'action' ] ); |
|
| 16 | +} elseif ( isset( $_REQUEST[ 'action2' ] ) && -1 !== (int) $_REQUEST[ 'action2' ] ) { // WPCS: CSRF OK. |
|
| 17 | + $action = sanitize_key( $_REQUEST[ 'action2' ] ); |
|
| 18 | 18 | } else { |
| 19 | 19 | $action = ''; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -$page = ( isset( $_REQUEST['paged'] ) ) ? max( 1, absint( $_REQUEST['paged'] ) ) : 1; // WPCS: CSRF OK. |
|
| 23 | -$module = ( isset( $_REQUEST['module'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['module'] ) ) : ''; // WPCS: CSRF OK. |
|
| 24 | -$s = ( isset( $_REQUEST['s'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : ''; // WPCS: CSRF OK. |
|
| 22 | +$page = ( isset( $_REQUEST[ 'paged' ] ) ) ? max( 1, absint( $_REQUEST[ 'paged' ] ) ) : 1; // WPCS: CSRF OK. |
|
| 23 | +$module = ( isset( $_REQUEST[ 'module' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 'module' ] ) ) : ''; // WPCS: CSRF OK. |
|
| 24 | +$s = ( isset( $_REQUEST[ 's' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) : ''; // WPCS: CSRF OK. |
|
| 25 | 25 | |
| 26 | 26 | // Clean up request URI from temporary args for screen options/paging URI's to work as expected. |
| 27 | -$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) ); |
|
| 27 | +$_SERVER[ 'REQUEST_URI' ] = remove_query_arg( array( 'error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce' ) ); |
|
| 28 | 28 | |
| 29 | 29 | $redirect_url = self_admin_url( "admin.php?page=wordpoints_modules&module_status={$status}&paged={$page}&s={$s}" ); |
| 30 | 30 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | check_admin_referer( 'bulk-modules' ); |
| 92 | 92 | |
| 93 | - $modules = isset( $_POST['checked'] ) |
|
| 94 | - ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) ) |
|
| 93 | + $modules = isset( $_POST[ 'checked' ] ) |
|
| 94 | + ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST[ 'checked' ] ) ) |
|
| 95 | 95 | : array(); |
| 96 | 96 | |
| 97 | 97 | // Only activate modules which are not already active. |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | check_admin_referer( 'bulk-modules' ); |
| 220 | 220 | |
| 221 | - $modules = isset( $_POST['checked'] ) |
|
| 222 | - ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['checked'] ) ) |
|
| 221 | + $modules = isset( $_POST[ 'checked' ] ) |
|
| 222 | + ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST[ 'checked' ] ) ) |
|
| 223 | 223 | : array(); |
| 224 | 224 | |
| 225 | 225 | $network_modules = array_filter( $modules, 'is_wordpoints_module_active_for_network' ); |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | check_admin_referer( 'bulk-modules' ); |
| 262 | 262 | |
| 263 | 263 | // $_POST = from the module form; $_GET = from the FTP details screen. |
| 264 | - $modules = isset( $_REQUEST['checked'] ) |
|
| 265 | - ? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST['checked'] ) ) |
|
| 264 | + $modules = isset( $_REQUEST[ 'checked' ] ) |
|
| 265 | + ? array_map( 'sanitize_text_field', (array) wp_unslash( $_REQUEST[ 'checked' ] ) ) |
|
| 266 | 266 | : array(); |
| 267 | 267 | |
| 268 | 268 | if ( empty( $modules ) ) { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | $parent_file = 'admin.php'; |
| 289 | 289 | |
| 290 | - if ( ! isset( $_REQUEST['verify-delete'] ) ) { |
|
| 290 | + if ( ! isset( $_REQUEST[ 'verify-delete' ] ) ) { |
|
| 291 | 291 | |
| 292 | 292 | wp_enqueue_script( 'jquery' ); |
| 293 | 293 | require_once ABSPATH . 'wp-admin/admin-header.php'; |
@@ -307,15 +307,15 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | if ( '.' === dirname( $module ) ) { |
| 309 | 309 | |
| 310 | - $files_to_delete[] = $module_dir . '/' . $module; |
|
| 310 | + $files_to_delete[ ] = $module_dir . '/' . $module; |
|
| 311 | 311 | $data = wordpoints_get_module_data( $module_dir . '/' . $module ); |
| 312 | 312 | |
| 313 | 313 | if ( ! empty( $data ) ) { |
| 314 | 314 | |
| 315 | 315 | $module_info[ $module ] = $data; |
| 316 | - $module_info[ $module ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module ); |
|
| 316 | + $module_info[ $module ][ 'is_uninstallable' ] = is_uninstallable_wordpoints_module( $module ); |
|
| 317 | 317 | |
| 318 | - if ( ! $module_info[ $module ]['network'] ) { |
|
| 318 | + if ( ! $module_info[ $module ][ 'network' ] ) { |
|
| 319 | 319 | $have_non_network_modules = true; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -335,9 +335,9 @@ discard block |
||
| 335 | 335 | foreach ( $folder_modules as $module_file => $data ) { |
| 336 | 336 | |
| 337 | 337 | $module_info[ $module_file ] = $data; |
| 338 | - $module_info[ $module_file ]['is_uninstallable'] = is_uninstallable_wordpoints_module( $module ); |
|
| 338 | + $module_info[ $module_file ][ 'is_uninstallable' ] = is_uninstallable_wordpoints_module( $module ); |
|
| 339 | 339 | |
| 340 | - if ( ! $module_info[ $module_file ]['network'] ) { |
|
| 340 | + if ( ! $module_info[ $module_file ][ 'network' ] ) { |
|
| 341 | 341 | $have_non_network_modules = true; |
| 342 | 342 | } |
| 343 | 343 | } |
@@ -376,16 +376,16 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | foreach ( $module_info as $module ) { |
| 378 | 378 | |
| 379 | - if ( $module['is_uninstallable'] ) { |
|
| 379 | + if ( $module[ 'is_uninstallable' ] ) { |
|
| 380 | 380 | |
| 381 | 381 | // translators: 1. Module name; 2. Module author. |
| 382 | - echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 382 | + echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)', 'wordpoints' ), esc_html( $module[ 'name' ] ), esc_html( $module[ 'author_name' ] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 383 | 383 | $data_to_delete = true; |
| 384 | 384 | |
| 385 | 385 | } else { |
| 386 | 386 | |
| 387 | 387 | // translators: 1. Module name; 2. Module author. |
| 388 | - echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module['name'] ), esc_html( $module['author_name'] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 388 | + echo '<li>', wp_kses( sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em>', 'wordpoints' ), esc_html( $module[ 'name' ] ), esc_html( $module[ 'author_name' ] ) ), array( 'strong' => array(), 'em' => array() ) ), '</li>'; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
@@ -11,9 +11,11 @@ |
||
| 11 | 11 | |
| 12 | 12 | if ( isset( $_POST['clear-recent-list'] ) ) { |
| 13 | 13 | $action = 'clear-recent-list'; |
| 14 | -} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { // WPCS: CSRF OK. |
|
| 14 | +} elseif ( isset( $_REQUEST['action'] ) && -1 !== (int) $_REQUEST['action'] ) { |
|
| 15 | +// WPCS: CSRF OK. |
|
| 15 | 16 | $action = sanitize_key( $_REQUEST['action'] ); |
| 16 | -} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { // WPCS: CSRF OK. |
|
| 17 | +} elseif ( isset( $_REQUEST['action2'] ) && -1 !== (int) $_REQUEST['action2'] ) { |
|
| 18 | +// WPCS: CSRF OK. |
|
| 17 | 19 | $action = sanitize_key( $_REQUEST['action2'] ); |
| 18 | 20 | } else { |
| 19 | 21 | $action = ''; |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | // Show messages and errors. |
| 18 | 18 | // |
| 19 | 19 | |
| 20 | -if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) { // WPCS: CSRF OK. |
|
| 20 | +if ( isset( $_GET[ 'wordpoints_component' ], $_GET[ '_wpnonce' ] ) && $wordpoints_components->is_registered( sanitize_key( $_GET[ 'wordpoints_component' ] ) ) ) { // WPCS: CSRF OK. |
|
| 21 | 21 | |
| 22 | - $component = sanitize_key( $_GET['wordpoints_component'] ); |
|
| 22 | + $component = sanitize_key( $_GET[ 'wordpoints_component' ] ); |
|
| 23 | 23 | |
| 24 | - if ( isset( $_GET['message'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) { |
|
| 24 | + if ( isset( $_GET[ 'message' ] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_message-{$component}" ) ) { |
|
| 25 | 25 | |
| 26 | - switch ( (int) $_GET['message'] ) { |
|
| 26 | + switch ( (int) $_GET[ 'message' ] ) { |
|
| 27 | 27 | |
| 28 | 28 | case 1: |
| 29 | 29 | if ( $wordpoints_components->is_active( $component ) ) { |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | if ( isset( $message ) ) { |
| 44 | 44 | |
| 45 | 45 | wordpoints_show_admin_message( |
| 46 | - esc_html( sprintf( $message, $components[ $component ]['name'] ) ) |
|
| 46 | + esc_html( sprintf( $message, $components[ $component ][ 'name' ] ) ) |
|
| 47 | 47 | , 'success' |
| 48 | 48 | , array( 'dismissible' => true ) |
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - } elseif ( isset( $_GET['error'] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) { |
|
| 52 | + } elseif ( isset( $_GET[ 'error' ] ) && wordpoints_verify_nonce( '_wpnonce', "wordpoints_component_error-{$component}" ) ) { |
|
| 53 | 53 | |
| 54 | - switch ( (int) $_GET['error'] ) { |
|
| 54 | + switch ( (int) $_GET[ 'error' ] ) { |
|
| 55 | 55 | |
| 56 | 56 | case 1: |
| 57 | 57 | if ( ! $wordpoints_components->is_active( $component ) ) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if ( isset( $error ) ) { |
| 72 | 72 | |
| 73 | 73 | wordpoints_show_admin_error( |
| 74 | - esc_html( sprintf( $error, $components[ $component ]['name'] ) ) |
|
| 74 | + esc_html( sprintf( $error, $components[ $component ][ 'name' ] ) ) |
|
| 75 | 75 | , array( 'dismissible' => true ) |
| 76 | 76 | ); |
| 77 | 77 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | <?php |
| 111 | 111 | |
| 112 | - if ( $wordpoints_components->is_active( $component['slug'] ) ) { |
|
| 112 | + if ( $wordpoints_components->is_active( $component[ 'slug' ] ) ) { |
|
| 113 | 113 | |
| 114 | 114 | $action = 'deactivate'; |
| 115 | 115 | $button = __( 'Deactivate', 'wordpoints' ); |
@@ -124,38 +124,38 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | <tr> |
| 126 | 126 | <td> |
| 127 | - <?php if ( '' !== $component['component_uri'] ) : ?> |
|
| 128 | - <a href="<?php echo esc_url( $component['component_uri'] ); ?>"> |
|
| 127 | + <?php if ( '' !== $component[ 'component_uri' ] ) : ?> |
|
| 128 | + <a href="<?php echo esc_url( $component[ 'component_uri' ] ); ?>"> |
|
| 129 | 129 | <?php endif; ?> |
| 130 | - <?php echo esc_html( $component['name'] ); ?> |
|
| 131 | - <?php if ( '' !== $component['component_uri'] ) : ?> |
|
| 130 | + <?php echo esc_html( $component[ 'name' ] ); ?> |
|
| 131 | + <?php if ( '' !== $component[ 'component_uri' ] ) : ?> |
|
| 132 | 132 | </a> |
| 133 | 133 | <?php endif; ?> |
| 134 | 134 | </td> |
| 135 | 135 | <td> |
| 136 | - <?php echo wp_kses( $component['description'], 'wordpoints_component_description' ); ?> |
|
| 137 | - <?php if ( '' !== $component['author'] ) : ?> |
|
| 136 | + <?php echo wp_kses( $component[ 'description' ], 'wordpoints_component_description' ); ?> |
|
| 137 | + <?php if ( '' !== $component[ 'author' ] ) : ?> |
|
| 138 | 138 | | |
| 139 | 139 | <?php |
| 140 | 140 | // translators: Author name. |
| 141 | 141 | echo esc_html( sprintf( __( 'By %s', 'wordpoints' ), '' /* This space intentionally left blank */ ) ); |
| 142 | 142 | ?> |
| 143 | - <?php if ( '' !== $component['author_uri'] ) : ?> |
|
| 144 | - <a href="<?php echo esc_url( $component['author_uri'] ); ?>"> |
|
| 143 | + <?php if ( '' !== $component[ 'author_uri' ] ) : ?> |
|
| 144 | + <a href="<?php echo esc_url( $component[ 'author_uri' ] ); ?>"> |
|
| 145 | 145 | <?php endif; ?> |
| 146 | - <?php echo esc_html( $component['author'] ); ?> |
|
| 147 | - <?php if ( '' !== $component['author_uri'] ) : ?> |
|
| 146 | + <?php echo esc_html( $component[ 'author' ] ); ?> |
|
| 147 | + <?php if ( '' !== $component[ 'author_uri' ] ) : ?> |
|
| 148 | 148 | </a> |
| 149 | 149 | <?php endif; ?> |
| 150 | 150 | <?php endif; ?> |
| 151 | 151 | </td> |
| 152 | - <td><?php echo esc_html( $component['version'] ); ?></td> |
|
| 152 | + <td><?php echo esc_html( $component[ 'version' ] ); ?></td> |
|
| 153 | 153 | <td> |
| 154 | - <form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component['slug'] ); ?>"> |
|
| 154 | + <form method="post" name="wordpoints_components_form_<?php echo esc_attr( $component[ 'slug' ] ); ?>"> |
|
| 155 | 155 | <input type="hidden" name="wordpoints_component_action" value="<?php echo esc_attr( $action ); ?>" /> |
| 156 | - <input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component['slug'] ); ?>" /> |
|
| 157 | - <?php wp_nonce_field( "wordpoints_{$action}_component-{$component['slug']}" ); ?> |
|
| 158 | - <?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component['slug']}", false ); ?> |
|
| 156 | + <input type="hidden" name="wordpoints_component" value="<?php echo esc_attr( $component[ 'slug' ] ); ?>" /> |
|
| 157 | + <?php wp_nonce_field( "wordpoints_{$action}_component-{$component[ 'slug' ]}" ); ?> |
|
| 158 | + <?php submit_button( $button, "secondary wordpoints-component-{$action}", "wordpoints-component-{$action}_{$component[ 'slug' ]}", false ); ?> |
|
| 159 | 159 | </form> |
| 160 | 160 | </td> |
| 161 | 161 | </tr> |
@@ -17,7 +17,8 @@ |
||
| 17 | 17 | // Show messages and errors. |
| 18 | 18 | // |
| 19 | 19 | |
| 20 | -if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) { // WPCS: CSRF OK. |
|
| 20 | +if ( isset( $_GET['wordpoints_component'], $_GET['_wpnonce'] ) && $wordpoints_components->is_registered( sanitize_key( $_GET['wordpoints_component'] ) ) ) { |
|
| 21 | +// WPCS: CSRF OK. |
|
| 21 | 22 | |
| 22 | 23 | $component = sanitize_key( $_GET['wordpoints_component'] ); |
| 23 | 24 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public static function register( $class_name ) { |
| 112 | 112 | |
| 113 | - self::$classes[] = $class_name; |
|
| 113 | + self::$classes[ ] = $class_name; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -286,10 +286,10 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | $args = $hook_type->get_options(); |
| 288 | 288 | |
| 289 | - $args['_add'] = 'multi'; |
|
| 290 | - $args['_display'] = 'template'; |
|
| 291 | - $args['_multi_num'] = $hook_type->next_hook_id_number(); |
|
| 292 | - $args['_id_slug'] = $i; |
|
| 289 | + $args[ '_add' ] = 'multi'; |
|
| 290 | + $args[ '_display' ] = 'template'; |
|
| 291 | + $args[ '_multi_num' ] = $hook_type->next_hook_id_number(); |
|
| 292 | + $args[ '_id_slug' ] = $i; |
|
| 293 | 293 | |
| 294 | 294 | $hook_type->set_options( $args ); |
| 295 | 295 | |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | $options = $hook_type->get_options(); |
| 340 | 340 | |
| 341 | - $options['_display'] = 'instance'; |
|
| 341 | + $options[ '_display' ] = 'instance'; |
|
| 342 | 342 | |
| 343 | - unset( $options['_add'] ); |
|
| 343 | + unset( $options[ '_add' ] ); |
|
| 344 | 344 | |
| 345 | - $options['_id_slug'] = $slug; |
|
| 345 | + $options[ '_id_slug' ] = $slug; |
|
| 346 | 346 | |
| 347 | 347 | $hook_type->set_options( $options ); |
| 348 | 348 | |
@@ -596,15 +596,15 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | <p> |
| 598 | 598 | <label for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
| 599 | - <input class="widefat" type="text" id="points-name-<?php echo esc_attr( $slug ); ?>" name="points-name" value="<?php echo esc_attr( $points_type['name'] ); ?>" /> |
|
| 599 | + <input class="widefat" type="text" id="points-name-<?php echo esc_attr( $slug ); ?>" name="points-name" value="<?php echo esc_attr( $points_type[ 'name' ] ); ?>" /> |
|
| 600 | 600 | </p> |
| 601 | 601 | <p> |
| 602 | 602 | <label for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
| 603 | - <input class="widefat" type="text" id="points-prefix-<?php echo esc_attr( $slug ); ?>" name="points-prefix" value="<?php echo esc_attr( $points_type['prefix'] ); ?>" /> |
|
| 603 | + <input class="widefat" type="text" id="points-prefix-<?php echo esc_attr( $slug ); ?>" name="points-prefix" value="<?php echo esc_attr( $points_type[ 'prefix' ] ); ?>" /> |
|
| 604 | 604 | </p> |
| 605 | 605 | <p> |
| 606 | 606 | <label for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
| 607 | - <input class="widefat" type="text" id="points-suffix-<?php echo esc_attr( $slug ); ?>" name="points-suffix" value="<?php echo esc_attr( $points_type['suffix'] ); ?>" /> |
|
| 607 | + <input class="widefat" type="text" id="points-suffix-<?php echo esc_attr( $slug ); ?>" name="points-suffix" value="<?php echo esc_attr( $points_type[ 'suffix' ] ); ?>" /> |
|
| 608 | 608 | </p> |
| 609 | 609 | |
| 610 | 610 | <?php |
@@ -677,28 +677,28 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | $id_format = $hook_id; |
| 679 | 679 | |
| 680 | - $multi_number = ( isset( $options['_multi_num'] ) ) ? $options['_multi_num'] : ''; |
|
| 681 | - $add_new = ( isset( $options['_add'] ) ) ? $options['_add'] : ''; |
|
| 680 | + $multi_number = ( isset( $options[ '_multi_num' ] ) ) ? $options[ '_multi_num' ] : ''; |
|
| 681 | + $add_new = ( isset( $options[ '_add' ] ) ) ? $options[ '_add' ] : ''; |
|
| 682 | 682 | |
| 683 | 683 | // Prepare the URL query string. |
| 684 | 684 | $query_arg = array( 'edithook' => $id_format ); |
| 685 | 685 | |
| 686 | 686 | if ( $add_new ) { |
| 687 | 687 | |
| 688 | - $query_arg['addnew'] = 1; |
|
| 688 | + $query_arg[ 'addnew' ] = 1; |
|
| 689 | 689 | |
| 690 | 690 | if ( $multi_number ) { |
| 691 | 691 | |
| 692 | - $query_arg['num'] = $multi_number; |
|
| 693 | - $query_arg['base'] = $id_base; |
|
| 692 | + $query_arg[ 'num' ] = $multi_number; |
|
| 693 | + $query_arg[ 'base' ] = $id_base; |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | } else { |
| 697 | 697 | |
| 698 | - $query_arg['points_type'] = $points_type; |
|
| 698 | + $query_arg[ 'points_type' ] = $points_type; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - if ( isset( $options['_display'] ) && 'template' === $options['_display'] ) { |
|
| 701 | + if ( isset( $options[ '_display' ] ) && 'template' === $options[ '_display' ] ) { |
|
| 702 | 702 | |
| 703 | 703 | /* |
| 704 | 704 | * We aren't outputting the form for a hook, but a template form for this |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | ?> |
| 716 | 716 | |
| 717 | - <div id="hook-<?php echo esc_html( $options['_id_slug'] ); ?>_<?php echo esc_attr( $id_format ); ?>" class="hook <?php echo esc_attr( $options['_classname'] ); ?>"> |
|
| 717 | + <div id="hook-<?php echo esc_html( $options[ '_id_slug' ] ); ?>_<?php echo esc_attr( $id_format ); ?>" class="hook <?php echo esc_attr( $options[ '_classname' ] ); ?>"> |
|
| 718 | 718 | <div class="hook-top"> |
| 719 | 719 | <div class="hook-title-action"> |
| 720 | 720 | <a class="hook-action hide-if-no-js" href="#available-hooks"></a> |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | |
| 740 | 740 | <input type="hidden" name="hook-id" class="hook-id" value="<?php echo esc_attr( $id_format ); ?>" /> |
| 741 | 741 | <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" /> |
| 742 | - <input type="hidden" name="hook-width" class="hook-width" value="<?php echo isset( $options['width'] ) ? esc_attr( $options['width'] ) : ''; ?>" /> |
|
| 743 | - <input type="hidden" name="hook-height" class="hook-height" value="<?php echo isset( $options['height'] ) ? esc_attr( $options['height'] ) : ''; ?>" /> |
|
| 742 | + <input type="hidden" name="hook-width" class="hook-width" value="<?php echo isset( $options[ 'width' ] ) ? esc_attr( $options[ 'width' ] ) : ''; ?>" /> |
|
| 743 | + <input type="hidden" name="hook-height" class="hook-height" value="<?php echo isset( $options[ 'height' ] ) ? esc_attr( $options[ 'height' ] ) : ''; ?>" /> |
|
| 744 | 744 | <input type="hidden" name="hook_number" class="hook_number" value="<?php echo esc_attr( $number ); ?>" /> |
| 745 | 745 | <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" /> |
| 746 | 746 | <input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr( $add_new ); ?>" /> |
@@ -760,8 +760,8 @@ discard block |
||
| 760 | 760 | </div> |
| 761 | 761 | |
| 762 | 762 | <div class="hook-description"> |
| 763 | - <?php if ( ! empty( $options['description'] ) ) : ?> |
|
| 764 | - <?php echo esc_html( $options['description'] ); ?> |
|
| 763 | + <?php if ( ! empty( $options[ 'description' ] ) ) : ?> |
|
| 764 | + <?php echo esc_html( $options[ 'description' ] ); ?> |
|
| 765 | 765 | <?php endif; ?> |
| 766 | 766 | </div> |
| 767 | 767 | </div> |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $instance = array_merge( $this->defaults, $instance ); |
| 186 | 186 | |
| 187 | - if ( ! $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) ) { |
|
| 187 | + if ( ! $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) ) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $points_type = $this->points_type( $number ); |
| 192 | 192 | |
| 193 | - wordpoints_subtract_points( $comment->user_id, $instance['points'], $points_type, 'comment_disapprove', array( 'status' => $new_status ) ); |
|
| 193 | + wordpoints_subtract_points( $comment->user_id, $instance[ 'points' ], $points_type, 'comment_disapprove', array( 'status' => $new_status ) ); |
|
| 194 | 194 | |
| 195 | 195 | update_comment_meta( |
| 196 | 196 | $comment->comment_ID |
@@ -375,14 +375,14 @@ discard block |
||
| 375 | 375 | $instance = array_merge( $this->defaults, $instance ); |
| 376 | 376 | |
| 377 | 377 | if ( |
| 378 | - $this->is_matching_post_type( $post->post_type, $instance['post_type'] ) |
|
| 378 | + $this->is_matching_post_type( $post->post_type, $instance[ 'post_type' ] ) |
|
| 379 | 379 | && 'auto-draft' !== $post->post_status |
| 380 | 380 | && __( 'Auto Draft', 'default' ) !== $post->post_title |
| 381 | 381 | ) { |
| 382 | 382 | |
| 383 | 383 | wordpoints_alter_points( |
| 384 | 384 | $post->post_author |
| 385 | - , -$instance['points'] |
|
| 385 | + , -$instance[ 'points' ] |
|
| 386 | 386 | , $this->points_type( $number ) |
| 387 | 387 | , 'post_delete' |
| 388 | 388 | , array( 'post_title' => $post->post_title, 'post_type' => $post->post_type ) |
@@ -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 | |