@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $setting_tabs = parent::get_app_settings_tabs(); |
| 119 | 119 | |
| 120 | 120 | foreach ( $setting_tabs as &$tab ) { |
| 121 | - if ( 'uninstall' !== $tab['name'] ) { |
|
| 121 | + if ( 'uninstall' !== $tab[ 'name' ] ) { |
|
| 122 | 122 | continue; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Add trash can icon to resemble the look and feel of the GF Settings page |
| 132 | - $tab['icon'] = 'dashicons-trash'; |
|
| 132 | + $tab[ 'icon' ] = 'dashicons-trash'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | return array_filter( $setting_tabs ); |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function register_no_conflict( $items ) { |
| 146 | 146 | |
| 147 | - $items[] = 'gform_settings'; |
|
| 148 | - $items[] = 'gv-admin-edd-license'; |
|
| 147 | + $items[ ] = 'gform_settings'; |
|
| 148 | + $items[ ] = 'gv-admin-edd-license'; |
|
| 149 | 149 | |
| 150 | 150 | return $items; |
| 151 | 151 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) ); |
| 198 | 198 | |
| 199 | - $uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>'; |
|
| 199 | + $uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>'; |
|
| 200 | 200 | |
| 201 | 201 | $html .= $uninstall_button; |
| 202 | 202 | |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function settings_save( $field, $echo = true ) { |
| 217 | 217 | |
| 218 | - $field['type'] = 'submit'; |
|
| 219 | - $field['name'] = 'gform-settings-save'; |
|
| 220 | - $field['class'] = 'button button-primary primary button-hero'; |
|
| 221 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
| 218 | + $field[ 'type' ] = 'submit'; |
|
| 219 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 220 | + $field[ 'class' ] = 'button button-primary primary button-hero'; |
|
| 221 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
| 222 | 222 | |
| 223 | 223 | $html = $this->as_html( $field, false ); |
| 224 | 224 | |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 242 | 242 | |
| 243 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
| 244 | - $setting_tabs[0]['icon'] = 'dashicons-admin-settings'; |
|
| 243 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 244 | + $setting_tabs[ 0 ][ 'icon' ] = 'dashicons-admin-settings'; |
|
| 245 | 245 | |
| 246 | 246 | return $setting_tabs; |
| 247 | 247 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $i = 0; |
| 490 | 490 | while ( $i < 11 ) { |
| 491 | 491 | echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
| 492 | - $i ++; |
|
| 492 | + $i++; |
|
| 493 | 493 | } |
| 494 | 494 | ?> |
| 495 | 495 | </ul> |
@@ -695,14 +695,14 @@ discard block |
||
| 695 | 695 | */ |
| 696 | 696 | public function as_html( $field, $echo = true ) { |
| 697 | 697 | |
| 698 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit'; |
|
| 698 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 699 | 699 | |
| 700 | 700 | $attributes = $this->get_field_attributes( $field ); |
| 701 | 701 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
| 702 | - $value = $this->get( $field['name'], $default_value ); |
|
| 702 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
| 703 | 703 | |
| 704 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton'; |
|
| 705 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
| 704 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton'; |
|
| 705 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 706 | 706 | |
| 707 | 707 | if ( empty( $value ) ) { |
| 708 | 708 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | $attributes = $this->get_field_attributes( $field ); |
| 712 | 712 | |
| 713 | 713 | $html = '<input |
| 714 | - type="' . $field['type'] . '" |
|
| 714 | + type="' . $field[ 'type' ] . '" |
|
| 715 | 715 | name="' . esc_attr( $name ) . '" |
| 716 | 716 | value="' . $value . '" ' . |
| 717 | 717 | implode( ' ', $attributes ) . |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | */ |
| 746 | 746 | public function is_save_postback() { |
| 747 | 747 | |
| 748 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
| 748 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | /** |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | |
| 863 | 863 | $scripts = parent::scripts(); |
| 864 | 864 | |
| 865 | - $scripts[] = array( |
|
| 865 | + $scripts[ ] = array( |
|
| 866 | 866 | 'handle' => 'gform_tooltip_init', |
| 867 | 867 | 'enqueue' => array( |
| 868 | 868 | array( |
@@ -890,11 +890,11 @@ discard block |
||
| 890 | 890 | ); |
| 891 | 891 | |
| 892 | 892 | // This file was removed from 2.5 |
| 893 | - if( ! gravityview()->plugin->is_GF_25() ) { |
|
| 894 | - $deps[] = 'gform_tooltip'; |
|
| 893 | + if ( ! gravityview()->plugin->is_GF_25() ) { |
|
| 894 | + $deps[ ] = 'gform_tooltip'; |
|
| 895 | 895 | } |
| 896 | 896 | |
| 897 | - $styles[] = array( |
|
| 897 | + $styles[ ] = array( |
|
| 898 | 898 | 'handle' => 'gravityview_settings', |
| 899 | 899 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 900 | 900 | 'version' => Plugin::$version, |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | 'name' => 'support-email', |
| 982 | 982 | 'type' => 'text', |
| 983 | 983 | 'validate' => 'email', |
| 984 | - 'default_value' => $default_settings['support-email'], |
|
| 984 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 985 | 985 | 'label' => __( 'Support Email', 'gravityview' ), |
| 986 | 986 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 987 | 987 | 'class' => 'code regular-text', |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | 'name' => 'support_port', |
| 994 | 994 | 'type' => 'radio', |
| 995 | 995 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 996 | - 'default_value' => $default_settings['support_port'], |
|
| 996 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 997 | 997 | 'horizontal' => 1, |
| 998 | 998 | 'choices' => array( |
| 999 | 999 | array( |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | 'name' => 'no-conflict-mode', |
| 1013 | 1013 | 'type' => 'radio', |
| 1014 | 1014 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 1015 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 1015 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 1016 | 1016 | 'horizontal' => 1, |
| 1017 | 1017 | 'choices' => array( |
| 1018 | 1018 | array( |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | 'name' => 'public-approval-link', |
| 1031 | 1031 | 'type' => 'radio', |
| 1032 | 1032 | 'label' => __( 'Public Approval Link', 'gravityview' ), |
| 1033 | - 'default_value' => $default_settings['public-approval-link'], |
|
| 1033 | + 'default_value' => $default_settings[ 'public-approval-link' ], |
|
| 1034 | 1034 | 'horizontal' => 1, |
| 1035 | 1035 | 'choices' => array( |
| 1036 | 1036 | array( |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | 'name' => 'rest_api', |
| 1053 | 1053 | 'type' => 'radio', |
| 1054 | 1054 | 'label' => __( 'REST API', 'gravityview' ), |
| 1055 | - 'default_value' => $default_settings['rest_api'], |
|
| 1055 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
| 1056 | 1056 | 'horizontal' => 1, |
| 1057 | 1057 | 'choices' => array( |
| 1058 | 1058 | array( |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | 'name' => 'powered_by', |
| 1072 | 1072 | 'type' => 'checkbox', |
| 1073 | 1073 | 'label' => __( 'Display "Powered By" Link', 'gravityview' ), |
| 1074 | - 'default_value' => $default_settings['powered_by'], |
|
| 1074 | + 'default_value' => $default_settings[ 'powered_by' ], |
|
| 1075 | 1075 | 'choices' => array( |
| 1076 | 1076 | array( |
| 1077 | 1077 | 'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ), |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | 'name' => 'beta', |
| 1097 | 1097 | 'type' => 'checkbox', |
| 1098 | 1098 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
| 1099 | - 'default_value' => $default_settings['beta'], |
|
| 1099 | + 'default_value' => $default_settings[ 'beta' ], |
|
| 1100 | 1100 | 'horizontal' => 1, |
| 1101 | 1101 | 'choices' => array( |
| 1102 | 1102 | array( |
@@ -1130,17 +1130,17 @@ discard block |
||
| 1130 | 1130 | * @since 1.7.4 |
| 1131 | 1131 | */ |
| 1132 | 1132 | foreach ( $fields as &$field ) { |
| 1133 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
| 1134 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
| 1135 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
| 1136 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
| 1133 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
| 1134 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
| 1135 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
| 1136 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
| 1137 | 1137 | |
| 1138 | 1138 | if ( $disabled_attribute ) { |
| 1139 | - $field['disabled'] = $disabled_attribute; |
|
| 1139 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | - if ( empty( $field['disabled'] ) ) { |
|
| 1143 | - unset( $field['disabled'] ); |
|
| 1142 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
| 1143 | + unset( $field[ 'disabled' ] ); |
|
| 1144 | 1144 | } |
| 1145 | 1145 | } |
| 1146 | 1146 | |
@@ -1152,23 +1152,23 @@ discard block |
||
| 1152 | 1152 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
| 1153 | 1153 | 'type' => 'edd_license', |
| 1154 | 1154 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
| 1155 | - 'default_value' => $default_settings['license_key'], |
|
| 1155 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 1156 | 1156 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 1157 | 1157 | ), |
| 1158 | 1158 | array( |
| 1159 | 1159 | 'name' => 'license_key_response', |
| 1160 | - 'default_value' => $default_settings['license_key_response'], |
|
| 1160 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 1161 | 1161 | 'type' => 'hidden', |
| 1162 | 1162 | ), |
| 1163 | 1163 | array( |
| 1164 | 1164 | 'name' => 'license_key_status', |
| 1165 | - 'default_value' => $default_settings['license_key_status'], |
|
| 1165 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 1166 | 1166 | 'type' => 'hidden', |
| 1167 | 1167 | ), |
| 1168 | 1168 | ); |
| 1169 | 1169 | |
| 1170 | 1170 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
| 1171 | - $license_fields[0] = array_merge( $license_fields[0], array( |
|
| 1171 | + $license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array( |
|
| 1172 | 1172 | 'disabled' => true, |
| 1173 | 1173 | 'title' => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ), |
| 1174 | 1174 | ) ); |
@@ -1179,7 +1179,7 @@ discard block |
||
| 1179 | 1179 | |
| 1180 | 1180 | if ( \gravityview()->plugin->is_GF_25() ) { |
| 1181 | 1181 | |
| 1182 | - $sections[] = array( |
|
| 1182 | + $sections[ ] = array( |
|
| 1183 | 1183 | 'title' => __( 'GravityView License', 'gravityview' ), |
| 1184 | 1184 | 'class' => 'gform-settings-panel--full gv-settings-panel--license', |
| 1185 | 1185 | 'description' => $version_info, |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | ) ); |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | - $sections[] = array( |
|
| 1200 | + $sections[ ] = array( |
|
| 1201 | 1201 | 'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ), |
| 1202 | 1202 | 'class' => 'gform-settings-panel--full gv-settings-panel--core', |
| 1203 | 1203 | 'fields' => $fields, |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | |
| 1222 | 1222 | if ( $disabled_attribute ) { |
| 1223 | 1223 | foreach ( $extension_sections as &$section ) { |
| 1224 | - foreach ( $section['fields'] as &$field ) { |
|
| 1225 | - $field['disabled'] = $disabled_attribute; |
|
| 1224 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 1225 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 1226 | 1226 | } |
| 1227 | 1227 | } |
| 1228 | 1228 | } |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | public function settings_edd_license( $field, $echo = true ) { |
| 1289 | 1289 | |
| 1290 | 1290 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
| 1291 | - $field['input_type'] = 'password'; |
|
| 1291 | + $field[ 'input_type' ] = 'password'; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | $text = $this->settings_text( $field, false ); |
@@ -1340,7 +1340,7 @@ discard block |
||
| 1340 | 1340 | |
| 1341 | 1341 | ?> |
| 1342 | 1342 | |
| 1343 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
| 1343 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
| 1344 | 1344 | <td colspan="2"> |
| 1345 | 1345 | <?php $this->single_setting( $field ); ?> |
| 1346 | 1346 | </td> |
@@ -1366,8 +1366,8 @@ discard block |
||
| 1366 | 1366 | */ |
| 1367 | 1367 | public function single_setting_row( $field ) { |
| 1368 | 1368 | |
| 1369 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
| 1370 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
| 1369 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
| 1370 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
| 1371 | 1371 | parent::single_setting_row( $field ); |
| 1372 | 1372 | } |
| 1373 | 1373 | |
@@ -1428,8 +1428,8 @@ discard block |
||
| 1428 | 1428 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 1429 | 1429 | if ( ! $added_message && ( $local_key !== $response_key ) ) { |
| 1430 | 1430 | |
| 1431 | - unset( $posted_settings['license_key_response'] ); |
|
| 1432 | - unset( $posted_settings['license_key_status'] ); |
|
| 1431 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 1432 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 1433 | 1433 | |
| 1434 | 1434 | \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
| 1435 | 1435 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
| 104 | 104 | */ |
| 105 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 105 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 106 | 106 | |
| 107 | 107 | $matches = array(); |
| 108 | 108 | preg_match_all( '/{gv_(.+)_entry:?([0-9]+)?:?(.+)?}/', $text, $matches, PREG_SET_ORDER ); |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | protected function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 133 | 133 | |
| 134 | - foreach( $matches as $match ) { |
|
| 134 | + foreach ( $matches as $match ) { |
|
| 135 | 135 | |
| 136 | 136 | list( $full_tag, $action, $expiration_hours, $privacy ) = $match; |
| 137 | 137 | |
| 138 | - if ( false === (bool) gravityview()->plugin->settings->get( 'public-approval-link' ) ) { |
|
| 138 | + if ( false === (bool)gravityview()->plugin->settings->get( 'public-approval-link' ) ) { |
|
| 139 | 139 | $privacy = 'private'; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $link_url = $this->get_link_url( $token, $privacy ); |
| 149 | 149 | |
| 150 | 150 | |
| 151 | - if ( 24 > (int) $expiration_hours ) { |
|
| 151 | + if ( 24 > (int)$expiration_hours ) { |
|
| 152 | 152 | $link_url = add_query_arg( array( 'nonce' => wp_create_nonce( 'gv_token' ) ), $link_url ); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | protected function get_token( $action = false, $expiration_hours = 24, $privacy = 'private', $entry = array() ) { |
| 176 | 176 | |
| 177 | - if ( ! $action || ! $entry['id'] ) { |
|
| 177 | + if ( ! $action || ! $entry[ 'id' ] ) { |
|
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -193,14 +193,14 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | $scopes = array( |
| 196 | - 'entry_id' => $entry['id'], |
|
| 196 | + 'entry_id' => $entry[ 'id' ], |
|
| 197 | 197 | 'approval_status' => $approval_status, |
| 198 | 198 | 'expiration_hours' => $expiration_hours, |
| 199 | 199 | 'privacy' => $privacy, |
| 200 | 200 | ); |
| 201 | 201 | |
| 202 | 202 | $jti = uniqid(); |
| 203 | - $expiration_timestamp = strtotime( '+' . (int) $expiration_hours . ' hours' ); |
|
| 203 | + $expiration_timestamp = strtotime( '+' . (int)$expiration_hours . ' hours' ); |
|
| 204 | 204 | |
| 205 | 205 | $token_array = array( |
| 206 | 206 | 'iat' => time(), |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if ( ! empty( $token ) ) { |
| 267 | - $query_args['gv_token'] = $token; |
|
| 267 | + $query_args[ 'gv_token' ] = $token; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $url = add_query_arg( $query_args, $base_url ); |
@@ -292,27 +292,27 @@ discard block |
||
| 292 | 292 | $token_array = $this->decode_token( GV\Utils::_GET( 'gv_token' ) ); |
| 293 | 293 | |
| 294 | 294 | if ( is_wp_error( $token_array ) ) { |
| 295 | - GVCommon::generate_notice( $token_array->get_error_messages() , 'gv-error' ); |
|
| 295 | + GVCommon::generate_notice( $token_array->get_error_messages(), 'gv-error' ); |
|
| 296 | 296 | |
| 297 | 297 | return; |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | if ( empty( $token_array ) ) { |
| 301 | - GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ) , 'gv-error' ); |
|
| 301 | + GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ), 'gv-error' ); |
|
| 302 | 302 | |
| 303 | 303 | return false; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - $scopes = $token_array['scopes']; |
|
| 306 | + $scopes = $token_array[ 'scopes' ]; |
|
| 307 | 307 | |
| 308 | - if ( empty( $scopes['entry_id'] ) || empty( $scopes['approval_status'] ) || empty( $scopes['privacy'] ) ) { |
|
| 309 | - GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ) , 'gv-error' ); |
|
| 308 | + if ( empty( $scopes[ 'entry_id' ] ) || empty( $scopes[ 'approval_status' ] ) || empty( $scopes[ 'privacy' ] ) ) { |
|
| 309 | + GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ), 'gv-error' ); |
|
| 310 | 310 | |
| 311 | 311 | return false; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if ( 'private' === $scopes['privacy'] && ! is_user_logged_in() ) { |
|
| 315 | - GVCommon::generate_notice( __( 'You are not allowed to perform this operation.', 'gravityview' ) , 'gv-error' ); |
|
| 314 | + if ( 'private' === $scopes[ 'privacy' ] && ! is_user_logged_in() ) { |
|
| 315 | + GVCommon::generate_notice( __( 'You are not allowed to perform this operation.', 'gravityview' ), 'gv-error' ); |
|
| 316 | 316 | |
| 317 | 317 | return false; |
| 318 | 318 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $body_64 = $parts[0]; |
|
| 363 | + $body_64 = $parts[ 0 ]; |
|
| 364 | 364 | |
| 365 | 365 | $body_json = base64_decode( $body_64 ); |
| 366 | 366 | if ( empty( $body_json ) ) { |
@@ -423,29 +423,29 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | $token = json_decode( $body_json, true ); |
| 425 | 425 | |
| 426 | - if ( ! isset( $token['jti'] ) ) { |
|
| 426 | + if ( ! isset( $token[ 'jti' ] ) ) { |
|
| 427 | 427 | return false; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - if ( ! isset( $token['exp'] ) || $token['exp'] < time() ) { |
|
| 430 | + if ( ! isset( $token[ 'exp' ] ) || $token[ 'exp' ] < time() ) { |
|
| 431 | 431 | return false; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - if ( ! isset( $token['scopes'] ) ) { |
|
| 434 | + if ( ! isset( $token[ 'scopes' ] ) ) { |
|
| 435 | 435 | return false; |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - if ( ! isset( $token['scopes']['expiration_hours'] ) ) { |
|
| 438 | + if ( ! isset( $token[ 'scopes' ][ 'expiration_hours' ] ) ) { |
|
| 439 | 439 | return false; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - if ( 24 > $token['scopes']['expiration_hours'] ) { |
|
| 442 | + if ( 24 > $token[ 'scopes' ][ 'expiration_hours' ] ) { |
|
| 443 | 443 | |
| 444 | - if ( ! isset( $_GET['nonce'] ) ) { |
|
| 444 | + if ( ! isset( $_GET[ 'nonce' ] ) ) { |
|
| 445 | 445 | return false; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if ( ! wp_verify_nonce( $_GET['nonce'], 'gv_token' ) ) { |
|
| 448 | + if ( ! wp_verify_nonce( $_GET[ 'nonce' ], 'gv_token' ) ) { |
|
| 449 | 449 | return false; |
| 450 | 450 | } |
| 451 | 451 | } |
@@ -468,11 +468,11 @@ discard block |
||
| 468 | 468 | return false; |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - $entry_id = $scopes['entry_id']; |
|
| 472 | - $approval_status = $scopes['approval_status']; |
|
| 471 | + $entry_id = $scopes[ 'entry_id' ]; |
|
| 472 | + $approval_status = $scopes[ 'approval_status' ]; |
|
| 473 | 473 | |
| 474 | 474 | $entry = GFAPI::get_entry( $entry_id ); |
| 475 | - $form_id = $entry['form_id']; |
|
| 475 | + $form_id = $entry[ 'form_id' ]; |
|
| 476 | 476 | |
| 477 | 477 | // Valid status |
| 478 | 478 | if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
@@ -493,11 +493,11 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // Has capability |
| 496 | - elseif ( 'private' === $scopes['privacy'] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) { |
|
| 496 | + elseif ( 'private' === $scopes[ 'privacy' ] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) { |
|
| 497 | 497 | |
| 498 | 498 | gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' ); |
| 499 | 499 | |
| 500 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
| 500 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
| 501 | 501 | |
| 502 | 502 | } |
| 503 | 503 | |
@@ -325,9 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | if ( 'success' === $result ) { |
| 327 | 327 | GVCommon::generate_notice( __( 'Entry approval updated!', 'gravityview' ), 'gv-success' ); |
| 328 | - } |
|
| 329 | - |
|
| 330 | - elseif ( 'error' === $result ) { |
|
| 328 | + } elseif ( 'error' === $result ) { |
|
| 331 | 329 | GVCommon::generate_notice( __( 'Error updating approval.', 'gravityview' ), 'gv-error' ); |
| 332 | 330 | } |
| 333 | 331 | } |
@@ -499,9 +497,7 @@ discard block |
||
| 499 | 497 | |
| 500 | 498 | $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
| 501 | 499 | |
| 502 | - } |
|
| 503 | - |
|
| 504 | - else { |
|
| 500 | + } else { |
|
| 505 | 501 | |
| 506 | 502 | $result = GravityView_Entry_Approval::update_approved( $entry_id, $approval_status, $form_id ); |
| 507 | 503 | |