@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | $hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data ); |
55 | 55 | |
56 | - return (bool) $hide_coupon_fields; |
|
56 | + return (bool)$hide_coupon_fields; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function edit_entry_field_blocklist( $blocklist = array(), $entry = array() ) { |
79 | 79 | |
80 | 80 | if ( $this->should_hide_coupon_fields( $entry ) ) { |
81 | - $blocklist[] = 'coupon'; |
|
81 | + $blocklist[ ] = 'coupon'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $blocklist; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | // No coupons match the codes provided |
117 | 117 | $discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form ); |
118 | 118 | |
119 | - if( ! $discounts ) { |
|
119 | + if ( ! $discounts ) { |
|
120 | 120 | return $value; |
121 | 121 | } |
122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @see GF_Field_Coupon::get_field_input |
126 | 126 | */ |
127 | 127 | $_POST = ! isset( $_POST ) ? array() : $_POST; |
128 | - $_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts ); |
|
128 | + $_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts ); |
|
129 | 129 | $_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes ); |
130 | 130 | |
131 | 131 | return $value; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | $sidebars_widgets = wp_get_sidebars_widgets(); |
82 | - if ( empty( $sidebars_widgets[ $matches[1] ] ) ) { |
|
82 | + if ( empty( $sidebars_widgets[ $matches[ 1 ] ] ) ) { |
|
83 | 83 | return $shortcodes; |
84 | 84 | } |
85 | 85 | |
86 | - foreach ( $sidebars_widgets[ $matches[1] ] as $widgets ) { |
|
86 | + foreach ( $sidebars_widgets[ $matches[ 1 ] ] as $widgets ) { |
|
87 | 87 | if ( |
88 | 88 | /** |
89 | 89 | * Blocklisted widgets. |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | strpos( $widgets, 'gv_recent_entries' ) === 0 |
93 | 93 | ) { |
94 | 94 | |
95 | - $shortcodes []= 'et_pb_sidebar'; |
|
95 | + $shortcodes [ ] = 'et_pb_sidebar'; |
|
96 | 96 | break; |
97 | 97 | } |
98 | 98 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
86 | 86 | */ |
87 | - foreach( $this->lead_db_columns as $column ) { |
|
87 | + foreach ( $this->lead_db_columns as $column ) { |
|
88 | 88 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
89 | 89 | } |
90 | 90 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{lead_id} was deleted', array( 'form_id' => $entry['form_id'], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
118 | + gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{lead_id} was deleted', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) ); |
|
119 | 119 | |
120 | - $this->blocklist_add( $entry['form_id'] ); |
|
120 | + $this->blocklist_add( $entry[ 'form_id' ] ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function entry_updated( $form, $lead_id ) { |
132 | 132 | |
133 | - gravityview()->log->debug(' adding form {form_id} to blocklist because entry #{entry_id} was updated', array( 'form_id' => $form['id'], 'entry_id' => $lead_id ) ); |
|
133 | + gravityview()->log->debug( ' adding form {form_id} to blocklist because entry #{entry_id} was updated', array( 'form_id' => $form[ 'id' ], 'entry_id' => $lead_id ) ); |
|
134 | 134 | |
135 | - $this->blocklist_add( $form['id'] ); |
|
135 | + $this->blocklist_add( $form[ 'id' ] ); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function entry_created( $entry, $form ) { |
149 | 149 | |
150 | - gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was created', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
150 | + gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was created', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
151 | 151 | |
152 | - $this->blocklist_add( $form['id'] ); |
|
152 | + $this->blocklist_add( $form[ 'id' ] ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was added', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) ); |
|
168 | + gravityview()->log->debug( 'adding form {form_id} to blocklist because entry #{entry_id} was added', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) ); |
|
169 | 169 | |
170 | - $this->blocklist_add( $form['id'] ); |
|
170 | + $this->blocklist_add( $form[ 'id' ] ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | // Normally just one form, but supports multiple forms |
187 | 187 | // |
188 | 188 | // Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14` |
189 | - $forms = 'f:' . implode( '-f:', (array) $form_ids ); |
|
189 | + $forms = 'f:' . implode( '-f:', (array)$form_ids ); |
|
190 | 190 | |
191 | 191 | // Prefix for transient keys |
192 | 192 | // Now the prefix would be: `gv-cache-f:12-f:5-f:14-` |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $form_ids = is_array( $form_ids ) ? $form_ids : array( $form_ids ); |
237 | 237 | |
238 | 238 | // Add the passed form IDs |
239 | - $blocklist = array_merge( (array) $blocklist, $form_ids ); |
|
239 | + $blocklist = array_merge( (array)$blocklist, $form_ids ); |
|
240 | 240 | |
241 | 241 | // Don't duplicate |
242 | 242 | $blocklist = array_unique( $blocklist ); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | $blocklist = get_option( self::BLOCKLIST_OPTION_NAME, array() ); |
281 | 281 | |
282 | - $updated_list = array_diff( $blocklist, (array) $form_ids ); |
|
282 | + $updated_list = array_diff( $blocklist, (array)$form_ids ); |
|
283 | 283 | |
284 | 284 | gravityview()->log->debug( 'Removing form IDs from cache blocklist', array( 'data' => array( |
285 | 285 | '$form_ids' => $form_ids, |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | return false; |
338 | 338 | } |
339 | 339 | |
340 | - foreach ( (array) $form_ids as $form_id ) { |
|
340 | + foreach ( (array)$form_ids as $form_id ) { |
|
341 | 341 | |
342 | 342 | if ( in_array( $form_id, $blocklist ) ) { |
343 | 343 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
412 | 412 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
413 | 413 | */ |
414 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
414 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
415 | 415 | |
416 | 416 | gravityview()->log->debug( 'Setting cache with transient key {key} for {cache_time} seconds', array( 'key' => $this->key, 'cache_time' => $cache_time ) ); |
417 | 417 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | return; |
448 | 448 | } |
449 | 449 | |
450 | - foreach ( (array) $form_ids as $form_id ) { |
|
450 | + foreach ( (array)$form_ids as $form_id ) { |
|
451 | 451 | |
452 | 452 | $key = '_transient_gv-cache-'; |
453 | 453 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | public function use_cache() { |
559 | 559 | |
560 | 560 | // Exit early if debugging (unless running PHPUnit) |
561 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
561 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) { |
|
562 | 562 | return apply_filters( 'gravityview_use_cache', false, $this ); |
563 | 563 | } |
564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | |
567 | 567 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
568 | 568 | |
569 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
569 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
570 | 570 | |
571 | 571 | gravityview()->log->debug( 'Not using cache: ?cache or ?nocache is in the URL' ); |
572 | 572 | |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | */ |
594 | 594 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
595 | 595 | |
596 | - return (boolean) $use_cache; |
|
596 | + return (boolean)$use_cache; |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $signature_fields = GFAPI::get_fields_by_type( $form, 'signature' ); |
54 | 54 | |
55 | 55 | foreach ( $signature_fields as $field ) { |
56 | - unset( $_POST["input_{$field->id}"] ); |
|
56 | + unset( $_POST[ "input_{$field->id}" ] ); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function edit_entry_field_input( $field_content = '', $field = null, $value = '', $lead_id = 0, $form_id = 0 ) { |
74 | 74 | |
75 | - $context = function_exists('gravityview_get_context') ? gravityview_get_context() : ''; |
|
75 | + $context = function_exists( 'gravityview_get_context' ) ? gravityview_get_context() : ''; |
|
76 | 76 | |
77 | - if( 'signature' !== $field->type || 'edit' !== $context ) { |
|
77 | + if ( 'signature' !== $field->type || 'edit' !== $context ) { |
|
78 | 78 | return $field_content; |
79 | 79 | } |
80 | 80 | |
81 | 81 | // We need to fetch a fresh version of the entry, since the saved entry hasn't refreshed in GV yet. |
82 | 82 | $entry = GravityView_View::getInstance()->getCurrentEntry(); |
83 | - $entry = GFAPI::get_entry( $entry['id'] ); |
|
83 | + $entry = GFAPI::get_entry( $entry[ 'id' ] ); |
|
84 | 84 | $entry_value = \GV\Utils::get( $entry, $field->id ); |
85 | 85 | |
86 | - $_POST["input_{$field->id}"] = $entry_value; // Used when Edit Entry form *is* submitted |
|
87 | - $_POST["input_{$form_id}_{$field->id}_signature_filename"] = $entry_value; // Used when Edit Entry form *is not* submitted |
|
86 | + $_POST[ "input_{$field->id}" ] = $entry_value; // Used when Edit Entry form *is* submitted |
|
87 | + $_POST[ "input_{$form_id}_{$field->id}_signature_filename" ] = $entry_value; // Used when Edit Entry form *is not* submitted |
|
88 | 88 | |
89 | 89 | return ''; // Return empty string to force using $_POST values instead |
90 | 90 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | array( |
84 | 84 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
85 | 85 | 'action' => 'entry_creator_get_users', |
86 | - 'gf25' => (bool) gravityview()->plugin->is_GF_25(), |
|
86 | + 'gf25' => (bool)gravityview()->plugin->is_GF_25(), |
|
87 | 87 | 'language' => array( |
88 | 88 | 'search_placeholder' => esc_html__( 'Search by ID, login, email, or name.', 'gravityview' ), |
89 | 89 | ), |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | ) |
108 | 108 | ); |
109 | 109 | |
110 | - if ( ! wp_verify_nonce( $post_var['gv_nonce'], 'gv_entry_creator' ) ) { |
|
110 | + if ( ! wp_verify_nonce( $post_var[ 'gv_nonce' ], 'gv_entry_creator' ) ) { |
|
111 | 111 | die(); |
112 | 112 | } |
113 | 113 | |
114 | - $search_string = $post_var['q']; |
|
114 | + $search_string = $post_var[ 'q' ]; |
|
115 | 115 | |
116 | 116 | if ( is_numeric( $search_string ) ) { |
117 | 117 | $user_args = array( |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
161 | - $result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true ); |
|
161 | + $result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true ); |
|
162 | 162 | |
163 | 163 | if ( false === $result ) { |
164 | 164 | $status = __( 'Error', 'gravityview' ); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | - GravityView_Entry_Notes::add_note( $entry['id'], - 1, 'GravityView', $note, 'gravityview' ); |
|
183 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], - 1, 'GravityView', $note, 'gravityview' ); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | // If screen mode isn't set, then we're in the wrong place. |
218 | - if ( empty( $_REQUEST['screen_mode'] ) ) { |
|
218 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
219 | 219 | return; |
220 | 220 | } |
221 | 221 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
243 | 243 | if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) { |
244 | - $_POST["screen_mode"] = 'edit'; |
|
244 | + $_POST[ "screen_mode" ] = 'edit'; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | } |
@@ -283,16 +283,14 @@ discard block |
||
283 | 283 | $originally_created_by_user_data = get_userdata( $originally_created_by ); |
284 | 284 | |
285 | 285 | $original_name = ! empty( $originally_created_by_user_data ) ? |
286 | - sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ) : |
|
287 | - esc_attr_x( 'Deleted User', 'To show that the entry was created by a no longer existing user.', 'gravityview' ); |
|
286 | + sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ) : esc_attr_x( 'Deleted User', 'To show that the entry was created by a no longer existing user.', 'gravityview' ); |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | if ( ! empty( $created_by ) ) { |
291 | 290 | $created_by_user_data = get_userdata( $created_by ); |
292 | 291 | |
293 | 292 | $created_by_name = ! empty( $created_by_user_data ) ? |
294 | - sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ) : |
|
295 | - esc_attr_x( 'Deleted User', 'To show that the entry was created by a no longer existing user.', 'gravityview' ); |
|
293 | + sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ) : esc_attr_x( 'Deleted User', 'To show that the entry was created by a no longer existing user.', 'gravityview' ); |
|
296 | 294 | } |
297 | 295 | |
298 | 296 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
@@ -322,7 +320,7 @@ discard block |
||
322 | 320 | $entry_creator_user_id = \GV\Utils::get( $entry, 'created_by' ); |
323 | 321 | |
324 | 322 | $entry_creator_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $entry_creator_user_id ) ); |
325 | - $entry_creator_user = isset( $entry_creator_user[0] ) ? $entry_creator_user[0] : array(); |
|
323 | + $entry_creator_user = isset( $entry_creator_user[ 0 ] ) ? $entry_creator_user[ 0 ] : array(); |
|
326 | 324 | |
327 | 325 | $output .= '<option value="0" ' . selected( true, empty( $entry_creator_user_id ), false ) . '> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
328 | 326 | |
@@ -341,18 +339,18 @@ discard block |
||
341 | 339 | } |
342 | 340 | |
343 | 341 | $user_count = count_users(); |
344 | - $user_count = $user_count['total_users']; |
|
342 | + $user_count = $user_count[ 'total_users' ]; |
|
345 | 343 | $users_displayed = self::DEFAULT_NUMBER_OF_USERS + ( ! empty( $entry_creator_user ) ? 1 : 0 ); |
346 | 344 | if ( $user_count > $users_displayed ) { |
347 | 345 | $remaining_users = $user_count - $users_displayed; |
348 | - $user_users = _n( esc_html__('user', 'gravityview' ), esc_html__('users', 'gravityview' ), $remaining_users ); |
|
346 | + $user_users = _n( esc_html__( 'user', 'gravityview' ), esc_html__( 'users', 'gravityview' ), $remaining_users ); |
|
349 | 347 | $message = esc_html_x( 'Use the input above to search the remaining %d %s.', '%d is replaced with user count %s is replaced with "user" or "users"', 'gravityview' ); |
350 | 348 | $message = sprintf( $message, $remaining_users, $user_users ); |
351 | - $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
349 | + $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
352 | 350 | } |
353 | 351 | |
354 | 352 | $output .= '</select>'; |
355 | - $output .= '<input name="originally_created_by" value="' . esc_attr( $entry['created_by'] ) . '" type="hidden" />'; |
|
353 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
356 | 354 | $output .= wp_nonce_field( 'gv_entry_creator', 'gv_entry_creator_nonce', false, false ); |
357 | 355 | |
358 | 356 | echo $output; |
@@ -366,8 +364,8 @@ discard block |
||
366 | 364 | * @return array |
367 | 365 | */ |
368 | 366 | function register_gform_noconflict( $assets ) { |
369 | - $assets[] = 'gravityview_selectwoo'; |
|
370 | - $assets[] = 'gravityview_entry_creator'; |
|
367 | + $assets[ ] = 'gravityview_selectwoo'; |
|
368 | + $assets[ ] = 'gravityview_entry_creator'; |
|
371 | 369 | |
372 | 370 | return $assets; |
373 | 371 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $this->label = esc_attr__( 'Approve Entries', 'gravityview' ); |
28 | 28 | |
29 | - $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
29 | + $this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' ); |
|
30 | 30 | |
31 | 31 | $this->add_hooks(); |
32 | 32 | |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
50 | 50 | |
51 | - unset( $field_options['only_loggedin'] ); |
|
51 | + unset( $field_options[ 'only_loggedin' ] ); |
|
52 | 52 | |
53 | - unset( $field_options['new_window'] ); |
|
53 | + unset( $field_options[ 'new_window' ] ); |
|
54 | 54 | |
55 | - unset( $field_options['show_as_link'] ); |
|
55 | + unset( $field_options[ 'show_as_link' ] ); |
|
56 | 56 | |
57 | 57 | return $field_options; |
58 | 58 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) ); |
77 | 77 | |
78 | - add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
78 | + add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) ); |
|
79 | 79 | |
80 | 80 | add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 ); |
81 | 81 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function maybe_prevent_field_render( $html, $args ) { |
98 | 98 | |
99 | 99 | // If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render. |
100 | - if( $this->name === \GV\Utils::get( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
100 | + if ( $this->name === \GV\Utils::get( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
101 | 101 | return ''; |
102 | 102 | } |
103 | 103 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function modify_search_parameters( $parameters ) { |
128 | 128 | |
129 | 129 | if ( $this->name === \GV\Utils::get( $parameters, 'sorting/key' ) ) { |
130 | - $parameters['sorting']['key'] = 'is_approved'; |
|
130 | + $parameters[ 'sorting' ][ 'key' ] = 'is_approved'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | return $parameters; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
150 | 150 | |
151 | - wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
151 | + wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true ); |
|
152 | 152 | |
153 | 153 | wp_register_script( 'gravityview-field-approval-popper', GRAVITYVIEW_URL . 'assets/lib/tippy/popper.min.js', array(), GravityView_Plugin::version, true ); |
154 | 154 | wp_register_script( 'gravityview-field-approval-tippy', GRAVITYVIEW_URL . 'assets/lib/tippy/tippy.min.js', array(), GravityView_Plugin::version, true ); |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | |
157 | 157 | $style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css'; |
158 | 158 | |
159 | - if( class_exists( 'GravityView_View' ) ) { |
|
159 | + if ( class_exists( 'GravityView_View' ) ) { |
|
160 | 160 | /** |
161 | 161 | * Override CSS file by placing in your theme's /gravityview/css/ sub-directory. |
162 | 162 | */ |
163 | 163 | $style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false ); |
164 | 164 | } |
165 | 165 | |
166 | - $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
166 | + $style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) ); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file. |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | $style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url ); |
174 | 174 | |
175 | - if( ! empty( $style_url ) ) { |
|
175 | + if ( ! empty( $style_url ) ) { |
|
176 | 176 | wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' ); |
177 | 177 | } |
178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | public function enqueue_and_localize_script() { |
188 | 188 | |
189 | 189 | // The script is already registered and enqueued |
190 | - if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
190 | + if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | |
201 | 201 | wp_localize_script( 'gravityview-field-approval', 'gvApproval', array( |
202 | 202 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
203 | - 'nonce' => wp_create_nonce('gravityview_entry_approval'), |
|
203 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
204 | 204 | 'status' => GravityView_Entry_Approval_Status::get_all(), |
205 | 205 | 'status_popover_template' => GravityView_Entry_Approval::get_popover_template(), |
206 | 206 | 'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(), |
207 | - )); |
|
207 | + ) ); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) { |
223 | 223 | |
224 | - if ( ! isset( $entry_default_fields["{$this->name}"] ) && 'edit' !== $context ) { |
|
225 | - $entry_default_fields["{$this->name}"] = array( |
|
224 | + if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) && 'edit' !== $context ) { |
|
225 | + $entry_default_fields[ "{$this->name}" ] = array( |
|
226 | 226 | 'label' => $this->label, |
227 | 227 | 'desc' => $this->description, |
228 | 228 | 'type' => $this->name, |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | |
77 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
78 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
77 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
78 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
79 | 79 | $form = GravityView_View::getInstance()->getForm(); |
80 | 80 | |
81 | 81 | /** @type GF_Field_Address $address_field */ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $choices = array(); |
85 | 85 | |
86 | 86 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
87 | - if( method_exists( $this, $method_name ) ) { |
|
87 | + if ( method_exists( $this, $method_name ) ) { |
|
88 | 88 | /** |
89 | 89 | * @uses GravityView_Field_Address::get_choices_country() |
90 | 90 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | $choices = $this->{$method_name}( $address_field, $form ); |
93 | 93 | } |
94 | 94 | |
95 | - if( ! empty( $choices ) ) { |
|
96 | - $search_field['choices'] = $choices; |
|
97 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
95 | + if ( ! empty( $choices ) ) { |
|
96 | + $search_field[ 'choices' ] = $choices; |
|
97 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
98 | 98 | } else { |
99 | - $search_field['type'] = 'text'; |
|
100 | - $search_field['input'] = 'input_text'; |
|
99 | + $search_field[ 'type' ] = 'text'; |
|
100 | + $search_field[ 'input' ] = 'input_text'; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $country_choices = array(); |
123 | 123 | |
124 | 124 | foreach ( $countries as $key => $country ) { |
125 | - $country_choices[] = array( |
|
125 | + $country_choices[ ] = array( |
|
126 | 126 | 'value' => $country, |
127 | 127 | 'text' => $country, |
128 | 128 | ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | private function get_choices_state( $address_field, $form ) { |
149 | 149 | |
150 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
150 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
151 | 151 | |
152 | 152 | $state_choices = array(); |
153 | 153 | |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $states = GFCommon::get_canadian_provinces(); |
160 | 160 | break; |
161 | 161 | default: |
162 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
163 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
162 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
163 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
164 | 164 | break; |
165 | 165 | } |
166 | 166 | |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $state_subchoices = array(); |
170 | 170 | |
171 | 171 | foreach ( $state as $key => $substate ) { |
172 | - $state_subchoices[] = array( |
|
172 | + $state_subchoices[ ] = array( |
|
173 | 173 | 'value' => is_numeric( $key ) ? $substate : $key, |
174 | 174 | 'text' => $substate, |
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
178 | - $state_choices[] = array( |
|
178 | + $state_choices[ ] = array( |
|
179 | 179 | 'text' => $key, |
180 | 180 | 'value' => $state_subchoices, |
181 | 181 | ); |
182 | 182 | |
183 | 183 | } else { |
184 | - $state_choices[] = array( |
|
184 | + $state_choices[ ] = array( |
|
185 | 185 | 'value' => is_numeric( $key ) ? $state : $key, |
186 | 186 | 'text' => $state, |
187 | 187 | ); |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | // Use the same inputs as the "text" input type allows |
206 | 206 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
207 | 207 | |
208 | - $input_types['street'] = $text_inputs; |
|
209 | - $input_types['street2'] = $text_inputs; |
|
210 | - $input_types['city'] = $text_inputs; |
|
208 | + $input_types[ 'street' ] = $text_inputs; |
|
209 | + $input_types[ 'street2' ] = $text_inputs; |
|
210 | + $input_types[ 'city' ] = $text_inputs; |
|
211 | 211 | |
212 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
213 | - $input_types['zip'] = array( 'input_text' ); |
|
214 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
212 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
213 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
214 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
215 | 215 | |
216 | 216 | return $input_types; |
217 | 217 | } |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
233 | 233 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
234 | 234 | |
235 | - if( 'address' !== $field_type && $input_id ) { |
|
235 | + if ( 'address' !== $field_type && $input_id ) { |
|
236 | 236 | return $input_type; |
237 | 237 | } |
238 | 238 | |
239 | 239 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
240 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
240 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
241 | 241 | $input_type = $address_field_name; |
242 | 242 | } |
243 | 243 | |
@@ -284,17 +284,17 @@ discard block |
||
284 | 284 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
285 | 285 | |
286 | 286 | // If this is NOT the full address field, return default options. |
287 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
287 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
288 | 288 | return $field_options; |
289 | 289 | } |
290 | 290 | |
291 | - if( 'edit' === $context ) { |
|
291 | + if ( 'edit' === $context ) { |
|
292 | 292 | return $field_options; |
293 | 293 | } |
294 | 294 | |
295 | 295 | $add_options = array(); |
296 | 296 | |
297 | - $add_options['show_map_link'] = array( |
|
297 | + $add_options[ 'show_map_link' ] = array( |
|
298 | 298 | 'type' => 'checkbox', |
299 | 299 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
300 | 300 | 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | 'priority' => 98, |
305 | 305 | ); |
306 | 306 | |
307 | - $add_options['show_map_link_new_window'] = array( |
|
307 | + $add_options[ 'show_map_link_new_window' ] = array( |
|
308 | 308 | 'type' => 'checkbox', |
309 | 309 | 'label' => __( 'Open map link in a new tab or window?', 'gravityview' ), |
310 | 310 | 'value' => false, |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
48 | 48 | |
49 | 49 | // It's the parent field, not an input |
50 | - if( floor( $field_id ) === floatval( $field_id ) ) { |
|
50 | + if ( floor( $field_id ) === floatval( $field_id ) ) { |
|
51 | 51 | return $field_options; |
52 | 52 | } |
53 | 53 | |
54 | - if( $this->is_choice_value_enabled() ) { |
|
54 | + if ( $this->is_choice_value_enabled() ) { |
|
55 | 55 | |
56 | 56 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
57 | 57 | $default = 'value'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
72 | - $field_options['choice_display'] = array( |
|
72 | + $field_options[ 'choice_display' ] = array( |
|
73 | 73 | 'type' => 'radio', |
74 | 74 | 'class' => 'vertical', |
75 | 75 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $user_ids = get_users( $args ); |
131 | 131 | |
132 | - return empty( $user_ids ) ? false : (int) $user_ids[0]; |
|
132 | + return empty( $user_ids ) ? false : (int)$user_ids[ 0 ]; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
156 | - if ( time() > (int) $expiration ) { |
|
156 | + if ( time() > (int)$expiration ) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | |
380 | 380 | $user = get_users( $args ); |
381 | 381 | |
382 | - return empty( $user ) ? null : $user[0]; |
|
382 | + return empty( $user ) ? null : $user[ 0 ]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $support_users = $this->get_all(); |
438 | 438 | |
439 | 439 | if ( $support_users ) { |
440 | - return $support_users[0]; |
|
440 | + return $support_users[ 0 ]; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | return null; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | 'number' => 1, |
525 | 525 | ) ); |
526 | 526 | |
527 | - $reassign_id = empty( $admins ) ? null : $admins[0]->ID; |
|
527 | + $reassign_id = empty( $admins ) ? null : $admins[ 0 ]->ID; |
|
528 | 528 | |
529 | 529 | $this->logging->log( 'Reassign user ID: ' . var_export( $reassign_id, true ), __METHOD__, 'info' ); |
530 | 530 |