@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | private function add_hooks() { |
40 | 40 | |
41 | 41 | // in case entry is edited (on admin or frontend) |
42 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
42 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
43 | 43 | |
44 | 44 | // when using the User opt-in field, check on entry submission |
45 | 45 | add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 ); |
46 | 46 | |
47 | 47 | // process ajax approve entry requests |
48 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
48 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
49 | 49 | |
50 | 50 | // autounapprove |
51 | 51 | add_action( 'gravityview/edit_entry/after_update', array( __CLASS__, 'autounapprove' ), 10, 4 ); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
97 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
98 | 98 | |
99 | 99 | if ( ! $form ) { |
100 | - gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry['form_id'], 'entry_id' => $entry_id ) ); |
|
100 | + gravityview()->log->error( 'Form not found at ID #{form_id} for entry #{entry_id}', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $entry_id ) ); |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function add_approval_notification_events( $notification_events = array(), $form = array() ) { |
116 | 116 | |
117 | - $notification_events['gravityview/approve_entries/approved'] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
118 | - $notification_events['gravityview/approve_entries/disapproved'] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
119 | - $notification_events['gravityview/approve_entries/unapproved'] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
120 | - $notification_events['gravityview/approve_entries/updated'] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
117 | + $notification_events[ 'gravityview/approve_entries/approved' ] = 'GravityView - ' . esc_html_x( 'Entry is approved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
118 | + $notification_events[ 'gravityview/approve_entries/disapproved' ] = 'GravityView - ' . esc_html_x( 'Entry is disapproved', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
119 | + $notification_events[ 'gravityview/approve_entries/unapproved' ] = 'GravityView - ' . esc_html_x( 'Entry approval is reset', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
120 | + $notification_events[ 'gravityview/approve_entries/updated' ] = 'GravityView - ' . esc_html_x( 'Entry approval is changed', 'The title for an event in a notifications drop down list.', 'gravityview' ); |
|
121 | 121 | |
122 | 122 | return $notification_events; |
123 | 123 | } |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public static function get_entry_status( $entry, $value_or_label = 'label' ) { |
137 | 137 | |
138 | - $entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry, true ); |
|
138 | + $entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry, true ); |
|
139 | 139 | |
140 | 140 | $status = gform_get_meta( $entry_id, self::meta_key ); |
141 | 141 | |
142 | 142 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
143 | 143 | |
144 | - if( 'value' === $value_or_label ) { |
|
144 | + if ( 'value' === $value_or_label ) { |
|
145 | 145 | return $status; |
146 | 146 | } |
147 | 147 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $nonce = \GV\Utils::_POST( 'nonce' ); |
180 | 180 | |
181 | 181 | // Valid status |
182 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
182 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) { |
|
183 | 183 | |
184 | 184 | gravityview()->log->error( 'Invalid approval status', array( 'data' => $_POST ) ); |
185 | 185 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' ); |
212 | 212 | |
213 | - $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') ); |
|
213 | + $result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) ); |
|
214 | 214 | |
215 | 215 | } |
216 | 216 | |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | // Set default |
264 | - self::update_approved_meta( $entry['id'], $default_status, $entry['form_id'] ); |
|
264 | + self::update_approved_meta( $entry[ 'id' ], $default_status, $entry[ 'form_id' ] ); |
|
265 | 265 | |
266 | 266 | // Then check for if there is an approval column, and use that value instead |
267 | - $this->after_update_entry_update_approved_meta( $form , $entry['id'] ); |
|
267 | + $this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
280 | 280 | |
281 | - $approved_column = self::get_approved_column( $form['id'] ); |
|
281 | + $approved_column = self::get_approved_column( $form[ 'id' ] ); |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * If the form doesn't contain the approve field, don't assume anything. |
285 | 285 | */ |
286 | - if( empty( $approved_column ) ) { |
|
286 | + if ( empty( $approved_column ) ) { |
|
287 | 287 | return; |
288 | 288 | } |
289 | 289 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $value = GravityView_Entry_Approval_Status::APPROVED; |
298 | 298 | } |
299 | 299 | |
300 | - self::update_approved_meta( $entry_id, $value, $form['id'] ); |
|
300 | + self::update_approved_meta( $entry_id, $value, $form[ 'id' ] ); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -315,12 +315,12 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public static function update_bulk( $entries = array(), $approved, $form_id ) { |
317 | 317 | |
318 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
318 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
319 | 319 | gravityview()->log->error( 'Entries were empty or malformed.', array( 'data' => $entries ) ); |
320 | 320 | return NULL; |
321 | 321 | } |
322 | 322 | |
323 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
323 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
324 | 324 | gravityview()->log->error( 'User does not have the `gravityview_moderate_entries` capability.' ); |
325 | 325 | return NULL; |
326 | 326 | } |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | $approved_column_id = self::get_approved_column( $form_id ); |
336 | 336 | |
337 | 337 | $success = true; |
338 | - foreach( $entries as $entry_id ) { |
|
338 | + foreach ( $entries as $entry_id ) { |
|
339 | 339 | $update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
340 | 340 | |
341 | - if( ! $update_success ) { |
|
341 | + if ( ! $update_success ) { |
|
342 | 342 | $success = false; |
343 | 343 | } |
344 | 344 | } |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public static function update_approved( $entry_id = 0, $approved = 2, $form_id = 0, $approvedcolumn = 0 ) { |
364 | 364 | |
365 | - if( !class_exists( 'GFAPI' ) ) { |
|
365 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
366 | 366 | gravityview()->log->error( 'GFAPI does not exist' ); |
367 | 367 | return false; |
368 | 368 | } |
369 | 369 | |
370 | - if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
370 | + if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) { |
|
371 | 371 | gravityview()->log->error( 'Not a valid approval value.' ); |
372 | 372 | return false; |
373 | 373 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | // If the form has an Approve/Reject field, update that value |
385 | 385 | $result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn ); |
386 | 386 | |
387 | - if( is_wp_error( $result ) ) { |
|
387 | + if ( is_wp_error( $result ) ) { |
|
388 | 388 | gravityview()->log->error( 'Entry approval not updated: {error}', array( 'error' => $result->get_error_message() ) ); |
389 | 389 | return false; |
390 | 390 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | // add note to entry if approval field updating worked or there was no approved field |
398 | 398 | // There's no validation for the meta |
399 | - if( true === $result ) { |
|
399 | + if ( true === $result ) { |
|
400 | 400 | |
401 | 401 | // Add an entry note |
402 | 402 | self::add_approval_status_updated_note( $entry_id, $approved ); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | $note_id = false; |
451 | 451 | |
452 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
452 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
453 | 453 | |
454 | 454 | $current_user = wp_get_current_user(); |
455 | 455 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | */ |
472 | 472 | private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) { |
473 | 473 | |
474 | - if( empty( $approvedcolumn ) ) { |
|
474 | + if ( empty( $approvedcolumn ) ) { |
|
475 | 475 | $approvedcolumn = self::get_approved_column( $form_id ); |
476 | 476 | } |
477 | 477 | |
@@ -494,12 +494,12 @@ discard block |
||
494 | 494 | $status = GravityView_Entry_Approval_Status::maybe_convert_status( $status ); |
495 | 495 | |
496 | 496 | $new_value = ''; |
497 | - if( GravityView_Entry_Approval_Status::APPROVED === $status ) { |
|
497 | + if ( GravityView_Entry_Approval_Status::APPROVED === $status ) { |
|
498 | 498 | $new_value = self::get_approved_column_input_label( $form_id, $approvedcolumn ); |
499 | 499 | } |
500 | 500 | |
501 | 501 | //update entry |
502 | - $entry["{$approvedcolumn}"] = $new_value; |
|
502 | + $entry[ "{$approvedcolumn}" ] = $new_value; |
|
503 | 503 | |
504 | 504 | /** |
505 | 505 | * Note: GFAPI::update_entry() doesn't trigger `gform_after_update_entry`, so we trigger updating the meta ourselves |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | // If the user has enabled a different value than the label (for some reason), use it. |
531 | 531 | // This is highly unlikely |
532 | 532 | if ( is_array( $field->choices ) && ! empty( $field->choices ) ) { |
533 | - return isset( $field->choices[0]['value'] ) ? $field->choices[0]['value'] : $field->choices[0]['text']; |
|
533 | + return isset( $field->choices[ 0 ][ 'value' ] ) ? $field->choices[ 0 ][ 'value' ] : $field->choices[ 0 ][ 'text' ]; |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | // Otherwise, fall back on the inputs array |
537 | 537 | if ( is_array( $field->inputs ) && ! empty( $field->inputs ) ) { |
538 | - return $field->inputs[0]['label']; |
|
538 | + return $field->inputs[ 0 ][ 'label' ]; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | return null; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | * @since 1.18 Added "unapproved" |
588 | 588 | * @param int $entry_id ID of the Gravity Forms entry |
589 | 589 | */ |
590 | - do_action( 'gravityview/approve_entries/' . $action , $entry_id ); |
|
590 | + do_action( 'gravityview/approve_entries/' . $action, $entry_id ); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | /** |
@@ -600,11 +600,11 @@ discard block |
||
600 | 600 | */ |
601 | 601 | static public function get_approved_column( $form ) { |
602 | 602 | |
603 | - if( empty( $form ) ) { |
|
603 | + if ( empty( $form ) ) { |
|
604 | 604 | return null; |
605 | 605 | } |
606 | 606 | |
607 | - if( !is_array( $form ) ) { |
|
607 | + if ( ! is_array( $form ) ) { |
|
608 | 608 | $form = GVCommon::get_form( $form ); |
609 | 609 | } |
610 | 610 | |
@@ -614,22 +614,22 @@ discard block |
||
614 | 614 | * @var string $key |
615 | 615 | * @var GF_Field $field |
616 | 616 | */ |
617 | - foreach( $form['fields'] as $key => $field ) { |
|
617 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
618 | 618 | |
619 | 619 | $inputs = $field->get_entry_inputs(); |
620 | 620 | |
621 | - if( !empty( $field->gravityview_approved ) ) { |
|
622 | - if ( ! empty( $inputs ) && !empty( $inputs[0]['id'] ) ) { |
|
623 | - $approved_column_id = $inputs[0]['id']; |
|
621 | + if ( ! empty( $field->gravityview_approved ) ) { |
|
622 | + if ( ! empty( $inputs ) && ! empty( $inputs[ 0 ][ 'id' ] ) ) { |
|
623 | + $approved_column_id = $inputs[ 0 ][ 'id' ]; |
|
624 | 624 | break; |
625 | 625 | } |
626 | 626 | } |
627 | 627 | |
628 | 628 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
629 | - if( 'checkbox' === $field->type && ! empty( $inputs ) ) { |
|
629 | + if ( 'checkbox' === $field->type && ! empty( $inputs ) ) { |
|
630 | 630 | foreach ( $inputs as $input ) { |
631 | - if ( 'approved' === strtolower( $input['label'] ) ) { |
|
632 | - $approved_column_id = $input['id']; |
|
631 | + if ( 'approved' === strtolower( $input[ 'label' ] ) ) { |
|
632 | + $approved_column_id = $input[ 'id' ]; |
|
633 | 633 | break; |
634 | 634 | } |
635 | 635 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | $view_keys = array_keys( $gv_data->get_views() ); |
657 | 657 | |
658 | - $view = \GV\View::by_id( $view_keys[0] ); |
|
658 | + $view = \GV\View::by_id( $view_keys[ 0 ] ); |
|
659 | 659 | |
660 | 660 | if ( ! $view->settings->get( 'unapprove_edit' ) ) { |
661 | 661 | return; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | return; |
666 | 666 | } |
667 | 667 | |
668 | - self::update_approved_meta( $entry_id, GravityView_Entry_Approval_Status::UNAPPROVED, $form['id'] ); |
|
668 | + self::update_approved_meta( $entry_id, GravityView_Entry_Approval_Status::UNAPPROVED, $form[ 'id' ] ); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class GravityView_Extension extends \GV\Extension { |
16 | 16 | public function __construct() { |
17 | - if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) { |
|
17 | + if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) { |
|
18 | 18 | gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) ); |
19 | 19 | } |
20 | 20 | parent::__construct(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'total' => wp_count_posts( 'gravityview' )->publish, |
64 | 64 | ); |
65 | 65 | foreach ( $items as $item ) { |
66 | - $data['views'][] = $this->prepare_view_for_response( $item, $request ); |
|
66 | + $data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return new \WP_REST_Response( $data, 200 ); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | $url = $request->get_url_params(); |
84 | 84 | |
85 | - $view_id = intval( $url['id'] ); |
|
85 | + $view_id = intval( $url[ 'id' ] ); |
|
86 | 86 | |
87 | 87 | $item = get_post( $view_id ); |
88 | 88 | |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | public function get_sub_items( $request ) { |
167 | 167 | |
168 | 168 | $url = $request->get_url_params(); |
169 | - $view_id = intval( $url['id'] ); |
|
169 | + $view_id = intval( $url[ 'id' ] ); |
|
170 | 170 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
171 | 171 | |
172 | - if( $post_id = $request->get_param('post_id') ) { |
|
172 | + if ( $post_id = $request->get_param( 'post_id' ) ) { |
|
173 | 173 | global $post; |
174 | 174 | |
175 | 175 | $post = get_post( $post_id ); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | $data = array( 'entries' => $entries->all(), 'total' => $entries->total() ); |
262 | 262 | |
263 | - foreach ( $data['entries'] as &$entry ) { |
|
263 | + foreach ( $data[ 'entries' ] as &$entry ) { |
|
264 | 264 | $entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' ); |
265 | 265 | } |
266 | 266 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function get_sub_item( $request ) { |
281 | 281 | $url = $request->get_url_params(); |
282 | - $view_id = intval( $url['id'] ); |
|
283 | - $entry_id = intval( $url['s_id'] ); |
|
282 | + $view_id = intval( $url[ 'id' ] ); |
|
283 | + $entry_id = intval( $url[ 's_id' ] ); |
|
284 | 284 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
285 | 285 | |
286 | 286 | $view = \GV\View::by_id( $view_id ); |
@@ -315,32 +315,32 @@ discard block |
||
315 | 315 | // Add all the WP_Post data |
316 | 316 | $view_post = $view_post->to_array(); |
317 | 317 | |
318 | - unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] ); |
|
318 | + unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] ); |
|
319 | 319 | |
320 | 320 | $return = wp_parse_args( $item, $view_post ); |
321 | 321 | |
322 | - $return['title'] = $return['post_title']; |
|
322 | + $return[ 'title' ] = $return[ 'post_title' ]; |
|
323 | 323 | |
324 | - $return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array(); |
|
325 | - unset( $return['atts'], $return['view_id'] ); |
|
324 | + $return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array(); |
|
325 | + unset( $return[ 'atts' ], $return[ 'view_id' ] ); |
|
326 | 326 | |
327 | - $return['search_criteria'] = array( |
|
327 | + $return[ 'search_criteria' ] = array( |
|
328 | 328 | 'page_size' => rgars( $return, 'settings/page_size' ), |
329 | 329 | 'sort_field' => rgars( $return, 'settings/sort_field' ), |
330 | 330 | 'sort_direction' => rgars( $return, 'settings/sort_direction' ), |
331 | 331 | 'offset' => rgars( $return, 'settings/offset' ), |
332 | 332 | ); |
333 | 333 | |
334 | - unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] ); |
|
334 | + unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] ); |
|
335 | 335 | |
336 | 336 | // Redact for non-logged ins |
337 | 337 | if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) { |
338 | - unset( $return['settings'] ); |
|
339 | - unset( $return['search_criteria'] ); |
|
338 | + unset( $return[ 'settings' ] ); |
|
339 | + unset( $return[ 'search_criteria' ] ); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) { |
343 | - unset( $return['form'] ); |
|
343 | + unset( $return[ 'form' ] ); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | return $return; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $view_id = func_get_arg( 1 ); // $view_id override |
357 | 357 | } else { |
358 | 358 | $url = $request->get_url_params(); |
359 | - $view_id = intval( $url['id'] ); |
|
359 | + $view_id = intval( $url[ 'id' ] ); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | if ( ! $view = \GV\View::by_id( $view_id ) ) { |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | $url = $request->get_url_params(); |
403 | - $view_id = intval( $url['id'] ); |
|
404 | - $entry_id = intval( $url['s_id'] ); |
|
403 | + $view_id = intval( $url[ 'id' ] ); |
|
404 | + $entry_id = intval( $url[ 's_id' ] ); |
|
405 | 405 | |
406 | 406 | $view = \GV\View::by_id( $view_id ); |
407 | 407 | |
@@ -409,11 +409,11 @@ discard block |
||
409 | 409 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
410 | 410 | } |
411 | 411 | |
412 | - if ( $entry['form_id'] != $view->form->ID ) { |
|
412 | + if ( $entry[ 'form_id' ] != $view->form->ID ) { |
|
413 | 413 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
414 | 414 | } |
415 | 415 | |
416 | - if ( $entry['status'] != 'active' ) { |
|
416 | + if ( $entry[ 'status' ] != 'active' ) { |
|
417 | 417 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
418 | 418 | } |
419 | 419 | |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
422 | 422 | } |
423 | 423 | |
424 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
424 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
425 | 425 | |
426 | 426 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
427 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
427 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
428 | 428 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
429 | 429 | } |
430 | 430 | } |
@@ -20,16 +20,16 @@ |
||
20 | 20 | */ |
21 | 21 | function gravityview_register_gravityview_widgets() { |
22 | 22 | |
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
24 | 24 | |
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
28 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
30 | 30 | |
31 | - if( class_exists('GFPolls') ) { |
|
32 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
31 | + if ( class_exists( 'GFPolls' ) ) { |
|
32 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $default_size = 25; |
46 | 46 | |
47 | 47 | if ( $context instanceof \GV\Template_Context ) { |
48 | - $default_size = (int) $context->view->settings->get( 'page_size' ); |
|
48 | + $default_size = (int)$context->view->settings->get( 'page_size' ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $sizes = array( 10, 25, $default_size, 50, 100 ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $page_sizes = array(); |
58 | 58 | foreach ( $sizes as $size ) { |
59 | - $page_sizes [] = array( |
|
59 | + $page_sizes [ ] = array( |
|
60 | 60 | 'value' => $size, |
61 | 61 | 'text' => $size |
62 | 62 | ); |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function render_frontend( $widget_args, $content = '', $context = null ) { |
83 | 83 | |
84 | - if( ! $this->pre_render_frontend() ) { |
|
84 | + if ( ! $this->pre_render_frontend() ) { |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
88 | - $page_size = (int) \GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
88 | + $page_size = (int)\GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
89 | 89 | |
90 | 90 | $settings = shortcode_atts( array( |
91 | 91 | 'label' => __( 'Page Size', 'gravityview' ), |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | <div class="gv-widget-page-size"> |
105 | 105 | <form method="get" action="<?php echo esc_url( add_query_arg( array() ) ); ?>" onchange="this.submit();"> |
106 | 106 | <div> |
107 | - <?php if( ! empty( $settings['label'] ) ) { ?> |
|
108 | - <label for="gv-page_size"><?php echo esc_html( $settings['label'] ); ?></label> |
|
107 | + <?php if ( ! empty( $settings[ 'label' ] ) ) { ?> |
|
108 | + <label for="gv-page_size"><?php echo esc_html( $settings[ 'label' ] ); ?></label> |
|
109 | 109 | <?php } ?> |
110 | 110 | <select name="page_size" id="gv-page_size"> |
111 | - <option value=""><?php echo esc_html( $settings['default_choice_text'] ); ?></option> |
|
111 | + <option value=""><?php echo esc_html( $settings[ 'default_choice_text' ] ); ?></option> |
|
112 | 112 | <?php |
113 | - foreach ( $settings['choices'] as $choice ) { ?> |
|
114 | - <option value='<?php echo esc_attr( $choice['value'] ); ?>'<?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
113 | + foreach ( $settings[ 'choices' ] as $choice ) { ?> |
|
114 | + <option value='<?php echo esc_attr( $choice[ 'value' ] ); ?>'<?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
115 | 115 | <?php } ?> |
116 | 116 | </select> |
117 | 117 | <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php |
118 | - if( ! empty( $_GET ) ) { |
|
118 | + if ( ! empty( $_GET ) ) { |
|
119 | 119 | $get = $_GET; |
120 | - unset( $get['page_size'] ); |
|
120 | + unset( $get[ 'page_size' ] ); |
|
121 | 121 | foreach ( $get as $key => $value ) { |
122 | 122 | printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) ); |
123 | 123 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | // Already overridden |
153 | - if ( (int) $page_size === (int) $view->settings->get( 'page_size' ) ) { |
|
153 | + if ( (int)$page_size === (int)$view->settings->get( 'page_size' ) ) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | 'view' => $view, |
159 | 159 | ) ); |
160 | 160 | |
161 | - if ( ! in_array( (int) $page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
161 | + if ( ! in_array( (int)$page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
162 | 162 | gravityview()->log->warning( 'The passed page size is not allowed: {page_size}. Not modifying result.', array( 'page_size' => $page_size ) ); |
163 | 163 | return; |
164 | 164 | } |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | ) ); |
109 | 109 | |
110 | 110 | // This is just HTML we don't need. |
111 | - unset( $response['message'] ); |
|
111 | + unset( $response[ 'message' ] ); |
|
112 | 112 | |
113 | - switch ( intval( $response['price_id'] ) ) { |
|
113 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
114 | 114 | default: |
115 | 115 | case 1: |
116 | 116 | $package = 'Core'; |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | |
129 | 129 | $data = array( |
130 | 130 | 'email' => gravityview()->plugin->settings->get( 'support-email' ), |
131 | - 'name' => $response['customer_name'], |
|
132 | - 'Valid License?' => ucwords( $response['license'] ), |
|
133 | - 'License Key' => $response['license_key'], |
|
131 | + 'name' => $response[ 'customer_name' ], |
|
132 | + 'Valid License?' => ucwords( $response[ 'license' ] ), |
|
133 | + 'License Key' => $response[ 'license_key' ], |
|
134 | 134 | 'License Level' => $package, |
135 | 135 | 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
136 | 136 | 'Support Email' => gravityview()->plugin->settings->get( 'support-email' ), |
137 | - 'License Limit' => $response['license_limit'], |
|
138 | - 'Site Count' => $response['site_count'], |
|
139 | - 'License Expires' => $response['expires'], |
|
140 | - 'Activations Left' => $response['activations_left'], |
|
141 | - 'Payment ID' => $response['payment_id'], |
|
142 | - 'Payment Name' => $response['customer_name'], |
|
143 | - 'Payment Email' => $response['customer_email'], |
|
137 | + 'License Limit' => $response[ 'license_limit' ], |
|
138 | + 'Site Count' => $response[ 'site_count' ], |
|
139 | + 'License Expires' => $response[ 'expires' ], |
|
140 | + 'Activations Left' => $response[ 'activations_left' ], |
|
141 | + 'Payment ID' => $response[ 'payment_id' ], |
|
142 | + 'Payment Name' => $response[ 'customer_name' ], |
|
143 | + 'Payment Email' => $response[ 'customer_email' ], |
|
144 | 144 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
145 | 145 | 'PHP Version' => phpversion(), |
146 | 146 | 'GravityView Version' => \GV\Plugin::$version, |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
34 | 34 | |
35 | - if( file_exists( $template_css_path ) ) { |
|
35 | + if ( file_exists( $template_css_path ) ) { |
|
36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
37 | 37 | gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) ); |
38 | 38 | } else { |
39 | 39 | // Default: use GravityView CSS file |
40 | 40 | |
41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
42 | - if( '' === $dir_path ) { |
|
42 | + if ( '' === $dir_path ) { |
|
43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
84 | 84 | |
85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
86 | 86 | |
87 | - if( empty( $permalink_args ) ) { |
|
87 | + if ( empty( $permalink_args ) ) { |
|
88 | 88 | return array(); |
89 | 89 | } |
90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
110 | 110 | |
111 | 111 | $output = ''; |
112 | - if( is_array( $current ) ) { |
|
113 | - if( in_array( $value, $current ) ) { |
|
112 | + if ( is_array( $current ) ) { |
|
113 | + if ( in_array( $value, $current ) ) { |
|
114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
118 | 118 | } |
119 | 119 | |
120 | - if( $echo ) { |
|
120 | + if ( $echo ) { |
|
121 | 121 | echo $output; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function gravityview_strip_whitespace( $string ) { |
173 | 173 | $string = normalize_whitespace( $string ); |
174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string Included file contents |
186 | 186 | */ |
187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
188 | - if( ! file_exists( $file_path ) ) { |
|
188 | + if ( ! file_exists( $file_path ) ) { |
|
189 | 189 | gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) ); |
190 | 190 | return ''; |
191 | 191 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $width = $height * 0.7586206897; |
211 | 211 | |
212 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
212 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
213 | 213 | $style = 'margin:10px 10px 10px 0;'; |
214 | 214 | $css_class = is_string( $css_class ) ? $css_class : 'alignright'; |
215 | 215 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $css_class = is_string( $css_class ) ? $css_class : 'alignleft'; |
218 | 218 | } |
219 | 219 | |
220 | - return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
220 | + return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | function gravityview_number_format( $number, $decimals = '' ) { |
241 | 241 | global $wp_locale; |
242 | 242 | |
243 | - if( '' === $decimals ) { |
|
243 | + if ( '' === $decimals ) { |
|
244 | 244 | |
245 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
245 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Calculate the position of the decimal point in the number |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $parts = parse_url( $value ); |
272 | 272 | |
273 | 273 | // No domain? Strange...show the original text. |
274 | - if( empty( $parts['host'] ) ) { |
|
274 | + if ( empty( $parts[ 'host' ] ) ) { |
|
275 | 275 | return $value; |
276 | 276 | } |
277 | 277 | |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
285 | 285 | * If true: `http://example.com => example.com` |
286 | 286 | */ |
287 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
287 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
288 | 288 | |
289 | - if( isset( $parts['scheme'] ) ) { |
|
290 | - $return .= $parts['scheme']; |
|
289 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
290 | + $return .= $parts[ 'scheme' ]; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | } |
294 | 294 | |
295 | 295 | // The domain, which may contain a subdomain |
296 | - $domain = $parts['host']; |
|
296 | + $domain = $parts[ 'host' ]; |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
302 | 302 | * If true: `www.example.com => example.com` |
303 | 303 | */ |
304 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
304 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
305 | 305 | |
306 | - if( $strip_www ) { |
|
307 | - $domain = str_replace('www.', '', $domain ); |
|
306 | + if ( $strip_www ) { |
|
307 | + $domain = str_replace( 'www.', '', $domain ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | * If true: `http://demo.example.com => example.com` \n |
315 | 315 | * If false: `http://demo.example.com => demo.example.com` |
316 | 316 | */ |
317 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
317 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
318 | 318 | |
319 | - if( $strip_subdomains ) { |
|
319 | + if ( $strip_subdomains ) { |
|
320 | 320 | |
321 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
321 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
333 | 333 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
334 | 334 | */ |
335 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
335 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
336 | 336 | |
337 | - if( empty( $root_only ) ) { |
|
337 | + if ( empty( $root_only ) ) { |
|
338 | 338 | |
339 | - if( isset( $parts['path'] ) ) { |
|
340 | - $return .= $parts['path']; |
|
339 | + if ( isset( $parts[ 'path' ] ) ) { |
|
340 | + $return .= $parts[ 'path' ]; |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
348 | 348 | * If true: `http://example.com/?query=example => example.com` |
349 | 349 | */ |
350 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
350 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
351 | 351 | |
352 | - if( empty( $strip_query_string ) ) { |
|
352 | + if ( empty( $strip_query_string ) ) { |
|
353 | 353 | |
354 | - if( isset( $parts['query'] ) ) { |
|
355 | - $return .= '?'.$parts['query']; |
|
354 | + if ( isset( $parts[ 'query' ] ) ) { |
|
355 | + $return .= '?' . $parts[ 'query' ]; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | } |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | */ |
370 | 370 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
371 | 371 | |
372 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
373 | - return $matches['domain']; |
|
372 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
373 | + return $matches[ 'domain' ]; |
|
374 | 374 | } else { |
375 | 375 | return $string_maybe_has_subdomain; |
376 | 376 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | |
440 | 440 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
441 | 441 | $value = true; |
442 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
442 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
443 | 443 | $value = false; |
444 | 444 | } |
445 | 445 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) { |
470 | 470 | |
471 | - if( ! is_string( $value ) ) { |
|
471 | + if ( ! is_string( $value ) ) { |
|
472 | 472 | return $value; |
473 | 473 | } |
474 | 474 | |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | } |
480 | 480 | |
481 | 481 | // There was a JSON error (PHP 5.3+) |
482 | - if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) { |
|
482 | + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { |
|
483 | 483 | return $value; |
484 | 484 | } |
485 | 485 | |
486 | 486 | // It wasn't JSON (PHP < 5.3 fallback) |
487 | - if( is_null( $decoded ) ) { |
|
487 | + if ( is_null( $decoded ) ) { |
|
488 | 488 | return $value; |
489 | 489 | } |
490 | 490 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | // Use the original function, if exists. |
509 | 509 | // Requires WP 4.4+ |
510 | - if( function_exists( 'map_deep') ) { |
|
510 | + if ( function_exists( 'map_deep' ) ) { |
|
511 | 511 | return map_deep( $value, $callback ); |
512 | 512 | } |
513 | 513 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | $exploded = explode( '.', "{$field_id}" ); |
574 | 574 | |
575 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
575 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -613,13 +613,13 @@ discard block |
||
613 | 613 | */ |
614 | 614 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
615 | 615 | |
616 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
616 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
617 | 617 | |
618 | 618 | $choices = array(); |
619 | 619 | |
620 | 620 | if ( is_array( $terms ) ) { |
621 | 621 | foreach ( $terms as $term_id => $term_name ) { |
622 | - $choices[] = array( |
|
622 | + $choices[ ] = array( |
|
623 | 623 | 'text' => $term_name, |
624 | 624 | 'value' => $term_id |
625 | 625 | ); |
@@ -643,21 +643,21 @@ discard block |
||
643 | 643 | function _gravityview_process_posted_fields() { |
644 | 644 | $fields = array(); |
645 | 645 | |
646 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
647 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
646 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
647 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
648 | 648 | |
649 | 649 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
650 | 650 | $fields_holder = array(); |
651 | - GVCommon::gv_parse_str( stripslashes( $_POST['gv_fields'] ), $fields_holder ); |
|
651 | + GVCommon::gv_parse_str( stripslashes( $_POST[ 'gv_fields' ] ), $fields_holder ); |
|
652 | 652 | |
653 | - if ( isset( $fields_holder['fields'] ) ) { |
|
654 | - $fields = $fields_holder['fields']; |
|
653 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
654 | + $fields = $fields_holder[ 'fields' ]; |
|
655 | 655 | } else { |
656 | 656 | gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) ); |
657 | 657 | } |
658 | 658 | |
659 | 659 | } else { |
660 | - $fields = $_POST['gv_fields']; |
|
660 | + $fields = $_POST[ 'gv_fields' ]; |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | $gv_page = gravityview()->request->is_admin( '', 'single' ); |
79 | 79 | |
80 | 80 | // New View or Edit View page |
81 | - if( $gv_page && $pagenow === 'post-new.php' ) { |
|
81 | + if ( $gv_page && $pagenow === 'post-new.php' ) { |
|
82 | 82 | remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' ); |
83 | 83 | } |
84 | 84 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | parent::add_hooks(); |
69 | 69 | |
70 | - if( gravityview()->request->is_admin( '', null ) ) { |
|
70 | + if ( gravityview()->request->is_admin( '', null ) ) { |
|
71 | 71 | |
72 | 72 | // Make Yoast metabox go down to the bottom please. |
73 | 73 | add_filter( 'wpseo_metabox_prio', array( $this, 'return_low' ) ); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function disable_content_analysis( $options ) { |
94 | 94 | |
95 | - $options['keyword_analysis_active'] = false; |
|
96 | - $options['content_analysis_active'] = false; |
|
95 | + $options[ 'keyword_analysis_active' ] = false; |
|
96 | + $options[ 'content_analysis_active' ] = false; |
|
97 | 97 | |
98 | 98 | return $options; |
99 | 99 | } |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | global $pagenow; |
113 | 113 | |
114 | 114 | // New View page |
115 | - if( $pagenow === 'post-new.php' ) { |
|
116 | - $options['hideeditbox-gravityview'] = true; |
|
115 | + if ( $pagenow === 'post-new.php' ) { |
|
116 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return $options; |