@@ -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 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
| 117 | 117 | */ |
| 118 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 118 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
| 119 | 119 | |
| 120 | 120 | $matches = array(); |
| 121 | 121 | preg_match_all( '/{gv_(.+)_entry:?([0-9]+)?:?(.+)?}/', $text, $matches, PREG_SET_ORDER ); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 146 | 146 | |
| 147 | - foreach( $matches as $match ) { |
|
| 147 | + foreach ( $matches as $match ) { |
|
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * @param string $full_tag $match[0] |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | list( $full_tag, $action, $expiration_hours, $privacy ) = $match; |
| 156 | 156 | |
| 157 | - if ( false === (bool) gravityview()->plugin->settings->get( 'public-approval-link' ) ) { |
|
| 157 | + if ( false === (bool)gravityview()->plugin->settings->get( 'public-approval-link' ) ) { |
|
| 158 | 158 | $privacy = 'private'; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $link_url = $this->get_link_url( $token, $privacy ); |
| 168 | 168 | |
| 169 | 169 | |
| 170 | - if ( self::EXPIRATION_HOURS > (int) $expiration_hours ) { |
|
| 170 | + if ( self::EXPIRATION_HOURS > (int)$expiration_hours ) { |
|
| 171 | 171 | $link_url = add_query_arg( array( 'nonce' => wp_create_nonce( 'gv_token' ) ), $link_url ); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | protected function get_token( $action = false, $expiration_hours = 24, $privacy = 'private', $entry = array() ) { |
| 201 | 201 | |
| 202 | - if ( ! $action || ! $entry['id'] ) { |
|
| 202 | + if ( ! $action || ! $entry[ 'id' ] ) { |
|
| 203 | 203 | return false; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $scopes = array( |
| 221 | - 'entry_id' => $entry['id'], |
|
| 221 | + 'entry_id' => $entry[ 'id' ], |
|
| 222 | 222 | 'approval_status' => $approval_status, |
| 223 | 223 | 'expiration_hours' => $expiration_hours, |
| 224 | 224 | 'privacy' => $privacy, |
| 225 | 225 | ); |
| 226 | 226 | |
| 227 | 227 | $jti = uniqid(); |
| 228 | - $expiration_timestamp = strtotime( '+' . (int) $expiration_hours . ' hours' ); |
|
| 228 | + $expiration_timestamp = strtotime( '+' . (int)$expiration_hours . ' hours' ); |
|
| 229 | 229 | |
| 230 | 230 | $token_array = array( |
| 231 | 231 | 'iat' => time(), |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $query_args = array(); |
| 314 | 314 | |
| 315 | 315 | if ( ! empty( $token ) ) { |
| 316 | - $query_args['gv_token'] = $token; |
|
| 316 | + $query_args[ 'gv_token' ] = $token; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | $url = add_query_arg( $query_args, $base_url ); |
@@ -365,27 +365,27 @@ discard block |
||
| 365 | 365 | $token_array = $this->decode_token( GV\Utils::_GET( 'gv_token' ) ); |
| 366 | 366 | |
| 367 | 367 | if ( is_wp_error( $token_array ) ) { |
| 368 | - GVCommon::generate_notice( $token_array->get_error_messages() , 'gv-error' ); |
|
| 368 | + GVCommon::generate_notice( $token_array->get_error_messages(), 'gv-error' ); |
|
| 369 | 369 | |
| 370 | 370 | return; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | if ( empty( $token_array ) ) { |
| 374 | - GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ) , 'gv-error' ); |
|
| 374 | + GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ), 'gv-error' ); |
|
| 375 | 375 | |
| 376 | 376 | return; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - $scopes = $token_array['scopes']; |
|
| 379 | + $scopes = $token_array[ 'scopes' ]; |
|
| 380 | 380 | |
| 381 | - if ( empty( $scopes['entry_id'] ) || empty( $scopes['approval_status'] ) || empty( $scopes['privacy'] ) ) { |
|
| 382 | - GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ) , 'gv-error' ); |
|
| 381 | + if ( empty( $scopes[ 'entry_id' ] ) || empty( $scopes[ 'approval_status' ] ) || empty( $scopes[ 'privacy' ] ) ) { |
|
| 382 | + GVCommon::generate_notice( __( 'Invalid request.', 'gravityview' ), 'gv-error' ); |
|
| 383 | 383 | |
| 384 | 384 | return; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if ( self::PRIVACY === $scopes['privacy'] && ! is_user_logged_in() ) { |
|
| 388 | - GVCommon::generate_notice( __( 'You are not allowed to perform this operation.', 'gravityview' ) , 'gv-error' ); |
|
| 387 | + if ( self::PRIVACY === $scopes[ 'privacy' ] && ! is_user_logged_in() ) { |
|
| 388 | + GVCommon::generate_notice( __( 'You are not allowed to perform this operation.', 'gravityview' ), 'gv-error' ); |
|
| 389 | 389 | |
| 390 | 390 | return; |
| 391 | 391 | } |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | return false; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - $body_64 = $parts[0]; |
|
| 452 | + $body_64 = $parts[ 0 ]; |
|
| 453 | 453 | |
| 454 | 454 | $body_json = base64_decode( $body_64 ); |
| 455 | 455 | if ( empty( $body_json ) ) { |
@@ -516,25 +516,25 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | $token = json_decode( $body_json, true ); |
| 518 | 518 | |
| 519 | - if ( ! isset( $token['jti'] ) ) { |
|
| 519 | + if ( ! isset( $token[ 'jti' ] ) ) { |
|
| 520 | 520 | return false; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if ( ! isset( $token['exp'] ) || $token['exp'] < time() ) { |
|
| 523 | + if ( ! isset( $token[ 'exp' ] ) || $token[ 'exp' ] < time() ) { |
|
| 524 | 524 | return false; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - if ( ! isset( $token['scopes'] ) ) { |
|
| 527 | + if ( ! isset( $token[ 'scopes' ] ) ) { |
|
| 528 | 528 | return false; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - if ( ! isset( $token['scopes']['expiration_hours'] ) ) { |
|
| 531 | + if ( ! isset( $token[ 'scopes' ][ 'expiration_hours' ] ) ) { |
|
| 532 | 532 | return false; |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - if ( self::EXPIRATION_HOURS > $token['scopes']['expiration_hours'] ) { |
|
| 535 | + if ( self::EXPIRATION_HOURS > $token[ 'scopes' ][ 'expiration_hours' ] ) { |
|
| 536 | 536 | |
| 537 | - if ( ! isset( $_GET['nonce'] ) ) { |
|
| 537 | + if ( ! isset( $_GET[ 'nonce' ] ) ) { |
|
| 538 | 538 | return false; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -561,11 +561,11 @@ discard block |
||
| 561 | 561 | return false; |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - $entry_id = $scopes['entry_id']; |
|
| 565 | - $approval_status = $scopes['approval_status']; |
|
| 564 | + $entry_id = $scopes[ 'entry_id' ]; |
|
| 565 | + $approval_status = $scopes[ 'approval_status' ]; |
|
| 566 | 566 | |
| 567 | 567 | $entry = GFAPI::get_entry( $entry_id ); |
| 568 | - $form_id = $entry['form_id']; |
|
| 568 | + $form_id = $entry[ 'form_id' ]; |
|
| 569 | 569 | $return_url = admin_url( '/admin.php?page=gf_entries&id=' . $form_id ); |
| 570 | 570 | |
| 571 | 571 | // Valid status |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | // Has capability |
| 592 | - elseif ( self::PRIVACY === $scopes['privacy'] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) { |
|
| 592 | + elseif ( self::PRIVACY === $scopes[ 'privacy' ] && ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry_id ) ) { |
|
| 593 | 593 | |
| 594 | 594 | gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' ); |
| 595 | 595 | |
@@ -414,9 +414,7 @@ |
||
| 414 | 414 | |
| 415 | 415 | if ( 'success' === $result ) { |
| 416 | 416 | GVCommon::generate_notice( __( 'Entry approval updated!', 'gravityview' ), 'gv-success' ); |
| 417 | - } |
|
| 418 | - |
|
| 419 | - elseif ( 'error' === $result ) { |
|
| 417 | + } elseif ( 'error' === $result ) { |
|
| 420 | 418 | GVCommon::generate_notice( __( 'Error updating approval.', 'gravityview' ), 'gv-error' ); |
| 421 | 419 | } |
| 422 | 420 | } |