@@ -185,7 +185,6 @@ discard block |
||
185 | 185 | * Returns the list of available forms |
186 | 186 | * |
187 | 187 | * @access public |
188 | - * @param mixed $form_id |
|
189 | 188 | * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys |
190 | 189 | */ |
191 | 190 | public static function get_forms() { |
@@ -206,7 +205,7 @@ discard block |
||
206 | 205 | * Return array of fields' id and label, for a given Form ID |
207 | 206 | * |
208 | 207 | * @access public |
209 | - * @param string|array $form_id (default: '') or $form object |
|
208 | + * @param string|array $form (default: '') or $form object |
|
210 | 209 | * @return array |
211 | 210 | */ |
212 | 211 | public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -907,7 +906,7 @@ discard block |
||
907 | 906 | * |
908 | 907 | * @param array $form Gravity Forms form array |
909 | 908 | * @param string $field_id ID of the field. If an input, full input ID (like `1.3`) |
910 | - * @param string|array $field_value Raw value of the field. |
|
909 | + * @param string $field_value Raw value of the field. |
|
911 | 910 | * @return string |
912 | 911 | */ |
913 | 912 | public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) { |
@@ -1551,9 +1550,9 @@ discard block |
||
1551 | 1550 | * @param string $message Message body (required) |
1552 | 1551 | * @param string $from_name Displayed name of the sender |
1553 | 1552 | * @param string $message_format If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html". |
1554 | - * @param string|array $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
1553 | + * @param string $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
1555 | 1554 | * @param array|false $entry Gravity Forms entry array, related to the email. Default: false. |
1556 | - * @param array|false $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
1555 | + * @param boolean $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
1557 | 1556 | */ |
1558 | 1557 | public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) { |
1559 | 1558 |
@@ -236,13 +236,13 @@ discard block |
||
236 | 236 | |
237 | 237 | if ( $add_default_properties && ! empty( $field->inputs ) ) { |
238 | 238 | foreach ( $field->inputs as $input ) { |
239 | - /** |
|
240 | - * @hack |
|
241 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
242 | - */ |
|
239 | + /** |
|
240 | + * @hack |
|
241 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
242 | + */ |
|
243 | 243 | if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) { |
244 | - continue; |
|
245 | - } |
|
244 | + continue; |
|
245 | + } |
|
246 | 246 | $fields["{$input['id']}"] = array( |
247 | 247 | 'label' => rgar( $input, 'label' ), |
248 | 248 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
420 | 420 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
421 | 421 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
422 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
422 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
423 | 423 | $criteria['context_view_id'] = null; |
424 | 424 | } |
425 | 425 | |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | ), |
1149 | 1149 | ); |
1150 | 1150 | |
1151 | - $fields = $date_created + $fields; |
|
1151 | + $fields = $date_created + $fields; |
|
1152 | 1152 | |
1153 | 1153 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1154 | 1154 | |
@@ -1160,13 +1160,13 @@ discard block |
||
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | - /** |
|
1164 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1165 | - * @since 1.12 |
|
1166 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1167 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1168 | - */ |
|
1169 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1163 | + /** |
|
1164 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1165 | + * @since 1.12 |
|
1166 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1167 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1168 | + */ |
|
1169 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1170 | 1170 | |
1171 | 1171 | return $fields; |
1172 | 1172 | } |
@@ -1449,17 +1449,17 @@ discard block |
||
1449 | 1449 | } |
1450 | 1450 | |
1451 | 1451 | |
1452 | - /** |
|
1453 | - * Display updated/error notice |
|
1454 | - * |
|
1455 | - * @param string $notice text/HTML of notice |
|
1456 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1457 | - * |
|
1458 | - * @return string |
|
1459 | - */ |
|
1460 | - public static function generate_notice( $notice, $class = '' ) { |
|
1461 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1462 | - } |
|
1452 | + /** |
|
1453 | + * Display updated/error notice |
|
1454 | + * |
|
1455 | + * @param string $notice text/HTML of notice |
|
1456 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1457 | + * |
|
1458 | + * @return string |
|
1459 | + */ |
|
1460 | + public static function generate_notice( $notice, $class = '' ) { |
|
1461 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1462 | + } |
|
1463 | 1463 | |
1464 | 1464 | /** |
1465 | 1465 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
177 | 177 | |
178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
179 | 179 | |
180 | 180 | return $result; |
181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
194 | 194 | $gf_forms = GFAPI::get_forms(); |
195 | 195 | foreach ( $gf_forms as $form ) { |
196 | - $forms[] = array( |
|
197 | - 'id' => $form['id'], |
|
198 | - 'title' => $form['title'], |
|
196 | + $forms[ ] = array( |
|
197 | + 'id' => $form[ 'id' ], |
|
198 | + 'title' => $form[ 'title' ], |
|
199 | 199 | ); |
200 | 200 | } |
201 | 201 | } |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | $has_post_fields = false; |
223 | 223 | |
224 | 224 | if ( $form ) { |
225 | - foreach ( $form['fields'] as $field ) { |
|
225 | + foreach ( $form[ 'fields' ] as $field ) { |
|
226 | 226 | |
227 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
228 | - $fields["{$field->id}"] = array( |
|
227 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
228 | + $fields[ "{$field->id}" ] = array( |
|
229 | 229 | 'label' => rgar( $field, 'label' ), |
230 | 230 | 'parent' => null, |
231 | 231 | 'type' => rgar( $field, 'type' ), |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | * @hack |
241 | 241 | * In case of email/email confirmation, the input for email has the same id as the parent field |
242 | 242 | */ |
243 | - if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) { |
|
243 | + if ( 'email' === $field->type && false === strpos( $input[ 'id' ], '.' ) ) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | - $fields["{$input['id']}"] = array( |
|
246 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
247 | 247 | 'label' => rgar( $input, 'label' ), |
248 | 248 | 'customLabel' => rgar( $input, 'customLabel' ), |
249 | 249 | 'parent' => $field, |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | - if( GFCommon::is_product_field( $field->type ) ){ |
|
258 | + if ( GFCommon::is_product_field( $field->type ) ) { |
|
259 | 259 | $has_product_fields = true; |
260 | 260 | } |
261 | 261 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @since 1.7 |
270 | 270 | */ |
271 | 271 | if ( $has_post_fields ) { |
272 | - $fields['post_id'] = array( |
|
272 | + $fields[ 'post_id' ] = array( |
|
273 | 273 | 'label' => __( 'Post ID', 'gravityview' ), |
274 | 274 | 'type' => 'post_id', |
275 | 275 | ); |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
281 | 281 | |
282 | 282 | foreach ( $payment_fields as $payment_field ) { |
283 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
283 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
284 | 284 | continue; |
285 | 285 | } |
286 | - $fields["{$payment_field->name}"] = array( |
|
286 | + $fields[ "{$payment_field->name}" ] = array( |
|
287 | 287 | 'label' => $payment_field->label, |
288 | 288 | 'desc' => $payment_field->description, |
289 | 289 | 'type' => $payment_field->name, |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | |
316 | 316 | $fields = array(); |
317 | 317 | |
318 | - foreach ( $extra_fields as $key => $field ){ |
|
319 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
320 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
318 | + foreach ( $extra_fields as $key => $field ) { |
|
319 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
320 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -357,32 +357,32 @@ discard block |
||
357 | 357 | 'search_criteria' => null, |
358 | 358 | 'sorting' => null, |
359 | 359 | 'paging' => null, |
360 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
360 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
361 | 361 | ); |
362 | 362 | |
363 | 363 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
364 | 364 | |
365 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
366 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
365 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
366 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
367 | 367 | |
368 | 368 | if ( ! is_array( $filter ) ) { |
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | |
372 | 372 | // By default, we want searches to be wildcard for each field. |
373 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
373 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
377 | 377 | * @param string $operator Existing search operator |
378 | 378 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
379 | 379 | */ |
380 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
380 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // don't send just the [mode] without any field filter. |
384 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
385 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
384 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
385 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | } |
@@ -393,21 +393,21 @@ discard block |
||
393 | 393 | * Prepare date formats to be in Gravity Forms DB format; |
394 | 394 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
395 | 395 | */ |
396 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
396 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
397 | 397 | |
398 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
398 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
399 | 399 | |
400 | 400 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
401 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
401 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
402 | 402 | |
403 | 403 | if ( $date ) { |
404 | 404 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
405 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
405 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
406 | 406 | } else { |
407 | 407 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
408 | - unset( $criteria['search_criteria'][ $key ] ); |
|
408 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
409 | 409 | |
410 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
410 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | |
416 | 416 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
417 | 417 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
418 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
418 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
419 | 419 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
420 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
421 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
420 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
421 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
422 | 422 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
423 | - $criteria['context_view_id'] = null; |
|
423 | + $criteria[ 'context_view_id' ] = null; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param array $form_ids Forms to search |
430 | 430 | * @param int $view_id ID of the view being used to search |
431 | 431 | */ |
432 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
432 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
433 | 433 | |
434 | 434 | return (array)$criteria; |
435 | 435 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | /** Reduce # of database calls */ |
461 | 461 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
462 | 462 | |
463 | - if ( ! empty( $criteria['cache'] ) ) { |
|
463 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
464 | 464 | |
465 | 465 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
466 | 466 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | // Still update the total count when using cached results |
470 | 470 | if ( ! is_null( $total ) ) { |
471 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
471 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | $return = $entries; |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
489 | 489 | |
490 | 490 | // No entries returned from gravityview_before_get_entries |
491 | - if( is_null( $entries ) ) { |
|
491 | + if ( is_null( $entries ) ) { |
|
492 | 492 | |
493 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
493 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
494 | 494 | |
495 | 495 | if ( is_wp_error( $entries ) ) { |
496 | 496 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
502 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
503 | 503 | |
504 | 504 | // Cache results |
505 | 505 | $Cache->set( $entries, 'entries' ); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
588 | 588 | |
589 | - if( $check_entry_display ) { |
|
589 | + if ( $check_entry_display ) { |
|
590 | 590 | // Is the entry allowed |
591 | 591 | $entry = self::check_entry_display( $entry ); |
592 | 592 | } |
@@ -619,12 +619,12 @@ discard block |
||
619 | 619 | |
620 | 620 | $value = false; |
621 | 621 | |
622 | - if( 'context' === $val1 ) { |
|
622 | + if ( 'context' === $val1 ) { |
|
623 | 623 | |
624 | 624 | $matching_contexts = array( $val2 ); |
625 | 625 | |
626 | 626 | // We allow for non-standard contexts. |
627 | - switch( $val2 ) { |
|
627 | + switch ( $val2 ) { |
|
628 | 628 | // Check for either single or edit |
629 | 629 | case 'singular': |
630 | 630 | $matching_contexts = array( 'single', 'edit' ); |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | return false; |
685 | 685 | } |
686 | 686 | |
687 | - if ( empty( $entry['form_id'] ) ) { |
|
687 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
688 | 688 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
689 | 689 | return false; |
690 | 690 | } |
@@ -692,26 +692,26 @@ discard block |
||
692 | 692 | $criteria = self::calculate_get_entries_criteria(); |
693 | 693 | |
694 | 694 | // Make sure the current View is connected to the same form as the Entry |
695 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
696 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
695 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
696 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
697 | 697 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
698 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
699 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
698 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
699 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
700 | 700 | return false; |
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
704 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
704 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
705 | 705 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
706 | 706 | return $entry; |
707 | 707 | } |
708 | 708 | |
709 | - $search_criteria = $criteria['search_criteria']; |
|
709 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
710 | 710 | unset( $criteria ); |
711 | 711 | |
712 | 712 | // check entry status |
713 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
714 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
713 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
714 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
715 | 715 | return false; |
716 | 716 | } |
717 | 717 | |
@@ -719,37 +719,37 @@ discard block |
||
719 | 719 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
720 | 720 | |
721 | 721 | // field_filters |
722 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
722 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
723 | 723 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
724 | 724 | return $entry; |
725 | 725 | } |
726 | 726 | |
727 | - $filters = $search_criteria['field_filters']; |
|
727 | + $filters = $search_criteria[ 'field_filters' ]; |
|
728 | 728 | unset( $search_criteria ); |
729 | 729 | |
730 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
731 | - unset( $filters['mode'] ); |
|
730 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
731 | + unset( $filters[ 'mode' ] ); |
|
732 | 732 | |
733 | - $form = self::get_form( $entry['form_id'] ); |
|
733 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
734 | 734 | |
735 | 735 | foreach ( $filters as $filter ) { |
736 | 736 | |
737 | - if ( ! isset( $filter['key'] ) ) { |
|
737 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
738 | 738 | continue; |
739 | 739 | } |
740 | 740 | |
741 | - $k = $filter['key']; |
|
741 | + $k = $filter[ 'key' ]; |
|
742 | 742 | |
743 | 743 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
744 | 744 | $field_value = $entry[ $k ]; |
745 | 745 | $field = null; |
746 | 746 | } else { |
747 | 747 | $field = self::get_field( $form, $k ); |
748 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
748 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
749 | 749 | } |
750 | 750 | |
751 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
752 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
751 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
752 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
753 | 753 | |
754 | 754 | // verify if we are already free to go! |
755 | 755 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -807,18 +807,18 @@ discard block |
||
807 | 807 | * Gravity Forms code to adjust date to locally-configured Time Zone |
808 | 808 | * @see GFCommon::format_date() for original code |
809 | 809 | */ |
810 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
810 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
811 | 811 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
812 | 812 | |
813 | - $format = rgar( $atts, 'format' ); |
|
814 | - $is_human = ! empty( $atts['human'] ); |
|
815 | - $is_diff = ! empty( $atts['diff'] ); |
|
816 | - $is_raw = ! empty( $atts['raw'] ); |
|
817 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
818 | - $include_time = ! empty( $atts['time'] ); |
|
813 | + $format = rgar( $atts, 'format' ); |
|
814 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
815 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
816 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
817 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
818 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
819 | 819 | |
820 | 820 | // If we're using time diff, we want to have a different default format |
821 | - if( empty( $format ) ) { |
|
821 | + if ( empty( $format ) ) { |
|
822 | 822 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
823 | 823 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
824 | 824 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | // If raw was specified, don't modify the stored value |
827 | 827 | if ( $is_raw ) { |
828 | 828 | $formatted_date = $date_string; |
829 | - } elseif( $is_timestamp ) { |
|
829 | + } elseif ( $is_timestamp ) { |
|
830 | 830 | $formatted_date = $date_local_timestamp; |
831 | 831 | } elseif ( $is_diff ) { |
832 | 832 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | |
861 | 861 | $label = rgar( $field, 'label' ); |
862 | 862 | |
863 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
863 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
864 | 864 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
865 | 865 | } |
866 | 866 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
882 | 882 | */ |
883 | 883 | public static function get_field( $form, $field_id ) { |
884 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
884 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
885 | 885 | return GFFormsModel::get_field( $form, $field_id ); |
886 | 886 | } else { |
887 | 887 | return null; |
@@ -928,19 +928,19 @@ discard block |
||
928 | 928 | $shortcodes = array(); |
929 | 929 | |
930 | 930 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
931 | - if ( empty( $matches ) ){ |
|
931 | + if ( empty( $matches ) ) { |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | |
935 | 935 | foreach ( $matches as $shortcode ) { |
936 | - if ( $tag === $shortcode[2] ) { |
|
936 | + if ( $tag === $shortcode[ 2 ] ) { |
|
937 | 937 | |
938 | 938 | // Changed this to $shortcode instead of true so we get the parsed atts. |
939 | - $shortcodes[] = $shortcode; |
|
939 | + $shortcodes[ ] = $shortcode; |
|
940 | 940 | |
941 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
942 | - foreach( $results as $result ) { |
|
943 | - $shortcodes[] = $result; |
|
941 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
942 | + foreach ( $results as $result ) { |
|
943 | + $shortcodes[ ] = $result; |
|
944 | 944 | } |
945 | 945 | } |
946 | 946 | } |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | * @return string html |
1102 | 1102 | */ |
1103 | 1103 | public static function get_sortable_fields( $formid, $current = '' ) { |
1104 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1104 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1105 | 1105 | |
1106 | 1106 | if ( empty( $formid ) ) { |
1107 | 1107 | return $output; |
@@ -1114,11 +1114,11 @@ discard block |
||
1114 | 1114 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1115 | 1115 | |
1116 | 1116 | foreach ( $fields as $id => $field ) { |
1117 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1117 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1118 | 1118 | continue; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1121 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1122 | 1122 | } |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1153,9 +1153,9 @@ discard block |
||
1153 | 1153 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1154 | 1154 | |
1155 | 1155 | // TODO: Convert to using array_filter |
1156 | - foreach( $fields as $id => $field ) { |
|
1156 | + foreach ( $fields as $id => $field ) { |
|
1157 | 1157 | |
1158 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1158 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1159 | 1159 | unset( $fields[ $id ] ); |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | * @param int|array $field field key or field array |
1197 | 1197 | * @return boolean |
1198 | 1198 | */ |
1199 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1199 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1200 | 1200 | |
1201 | 1201 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1202 | 1202 | $form = self::get_form( $form ); |
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | // If entry meta, it's a string. Otherwise, numeric |
1206 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1206 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1207 | 1207 | $type = $field; |
1208 | 1208 | } else { |
1209 | 1209 | $type = self::get_field_type( $form, $field ); |
@@ -1217,9 +1217,9 @@ discard block |
||
1217 | 1217 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1218 | 1218 | |
1219 | 1219 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1220 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1221 | - if( true === $gv_field->is_numeric ) { |
|
1222 | - $numeric_types[] = $gv_field->is_numeric; |
|
1220 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1221 | + if ( true === $gv_field->is_numeric ) { |
|
1222 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | |
@@ -1369,11 +1369,11 @@ discard block |
||
1369 | 1369 | $final_atts = array_filter( $final_atts ); |
1370 | 1370 | |
1371 | 1371 | // If the href wasn't passed as an attribute, use the value passed to the function |
1372 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1373 | - $final_atts['href'] = $href; |
|
1372 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1373 | + $final_atts[ 'href' ] = $href; |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1376 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1377 | 1377 | |
1378 | 1378 | // Sort the attributes alphabetically, to help testing |
1379 | 1379 | ksort( $final_atts ); |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1385 | 1385 | } |
1386 | 1386 | |
1387 | - if( '' !== $output ) { |
|
1387 | + if ( '' !== $output ) { |
|
1388 | 1388 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1389 | 1389 | } |
1390 | 1390 | |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
1409 | 1409 | $merged = $array1; |
1410 | 1410 | |
1411 | - foreach ( $array2 as $key => &$value ) { |
|
1411 | + foreach ( $array2 as $key => &$value ) { |
|
1412 | 1412 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1413 | 1413 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1414 | 1414 | } else { |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1444 | 1444 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1445 | 1445 | */ |
1446 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1446 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1447 | 1447 | |
1448 | 1448 | return get_users( $get_users_settings ); |
1449 | 1449 | } |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | * @return string |
1459 | 1459 | */ |
1460 | 1460 | public static function generate_notice( $notice, $class = '' ) { |
1461 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1461 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | |
258 | - if( GFCommon::is_product_field( $field->type ) ){ |
|
258 | + if( GFCommon::is_product_field( $field->type ) ) { |
|
259 | 259 | $has_product_fields = true; |
260 | 260 | } |
261 | 261 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | |
316 | 316 | $fields = array(); |
317 | 317 | |
318 | - foreach ( $extra_fields as $key => $field ){ |
|
318 | + foreach ( $extra_fields as $key => $field ) { |
|
319 | 319 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
320 | 320 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
321 | 321 | } |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
882 | 882 | */ |
883 | 883 | public static function get_field( $form, $field_id ) { |
884 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
884 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
885 | 885 | return GFFormsModel::get_field( $form, $field_id ); |
886 | 886 | } else { |
887 | 887 | return null; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $shortcodes = array(); |
929 | 929 | |
930 | 930 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
931 | - if ( empty( $matches ) ){ |
|
931 | + if ( empty( $matches ) ) { |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
1409 | 1409 | $merged = $array1; |
1410 | 1410 | |
1411 | - foreach ( $array2 as $key => &$value ) { |
|
1411 | + foreach ( $array2 as $key => &$value ) { |
|
1412 | 1412 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1413 | 1413 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1414 | 1414 | } else { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
176 | 176 | 8 => __( 'View submitted.', 'gravityview' ), |
177 | 177 | 9 => sprintf( |
178 | - /* translators: Date and time the View is scheduled to be published */ |
|
178 | + /* translators: Date and time the View is scheduled to be published */ |
|
179 | 179 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
180 | 180 | // translators: Publish box date format, see http://php.net/date |
181 | 181 | date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
@@ -232,7 +232,6 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @deprecated since 1.12 |
234 | 234 | * @see GravityView_Compatibility::get_plugin_status() |
235 | - |
|
236 | 235 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive |
237 | 236 | */ |
238 | 237 | static function get_plugin_status( $location = '' ) { |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
54 | 54 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
55 | 55 | |
56 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
56 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
57 | 57 | |
58 | 58 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
59 | 59 | |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | public function backend_actions() { |
69 | 69 | |
70 | 70 | /** @define "GRAVITYVIEW_DIR" "../" */ |
71 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
72 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
73 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
74 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
75 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
76 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
77 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
71 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
72 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
73 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); |
|
74 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
75 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
76 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
81 | 81 | * |
82 | 82 | * Nice place to insert extensions' backend stuff |
83 | 83 | */ |
84 | - do_action('gravityview_include_backend_actions'); |
|
84 | + do_action( 'gravityview_include_backend_actions' ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | |
98 | 98 | $actions = array(); |
99 | 99 | |
100 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
101 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
100 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
101 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
102 | 102 | } |
103 | 103 | |
104 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
105 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
104 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
105 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return array_merge( $actions, $links ); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | // By default, there will only be one item being modified. |
131 | 131 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
132 | 132 | // of modified items that will override this array. |
133 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
133 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
134 | 134 | |
135 | 135 | // If we're starting fresh, a new form was created. |
136 | 136 | // We should let the user know this is the case. |
@@ -138,60 +138,60 @@ discard block |
||
138 | 138 | |
139 | 139 | $new_form_text = ''; |
140 | 140 | |
141 | - if( !empty( $start_fresh ) ) { |
|
141 | + if ( ! empty( $start_fresh ) ) { |
|
142 | 142 | |
143 | 143 | // Get the form that was created |
144 | 144 | $connected_form = gravityview_get_form_id( $post_id ); |
145 | 145 | |
146 | - if( !empty( $connected_form ) ) { |
|
146 | + if ( ! empty( $connected_form ) ) { |
|
147 | 147 | $form = gravityview_get_form( $connected_form ); |
148 | - $form_name = esc_attr( $form['title'] ); |
|
148 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
149 | 149 | $image = self::get_floaty(); |
150 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
151 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
150 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
151 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
152 | 152 | |
153 | 153 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
154 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
154 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
155 | 155 | $new_form_text = wpautop( $new_form_text ); |
156 | 156 | |
157 | 157 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - $messages['gravityview'] = array( |
|
161 | + $messages[ 'gravityview' ] = array( |
|
162 | 162 | 0 => '', // Unused. Messages start at index 1. |
163 | 163 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
164 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
164 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
165 | 165 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
166 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
166 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
167 | 167 | 3 => __( 'View deleted.', 'gravityview' ), |
168 | 168 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
169 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
169 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
170 | 170 | /* translators: %s: date and time of the revision */ |
171 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
171 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
172 | 172 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
173 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
173 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
174 | 174 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
175 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
175 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
176 | 176 | 8 => __( 'View submitted.', 'gravityview' ), |
177 | 177 | 9 => sprintf( |
178 | 178 | /* translators: Date and time the View is scheduled to be published */ |
179 | 179 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
180 | 180 | // translators: Publish box date format, see http://php.net/date |
181 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
181 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
182 | 182 | ) . $new_form_text, |
183 | 183 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
184 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
184 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * These apply to `bulk_post_updated_messages` |
188 | 188 | * @file wp-admin/edit.php |
189 | 189 | */ |
190 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
191 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
192 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
193 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
194 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
190 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
191 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
192 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
193 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
194 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
195 | 195 | ); |
196 | 196 | |
197 | 197 | return $messages; |
@@ -251,29 +251,29 @@ discard block |
||
251 | 251 | static function is_admin_page( $hook = '', $page = NULL ) { |
252 | 252 | global $current_screen, $plugin_page, $pagenow, $post; |
253 | 253 | |
254 | - if( ! is_admin() ) { return false; } |
|
254 | + if ( ! is_admin() ) { return false; } |
|
255 | 255 | |
256 | 256 | $is_page = false; |
257 | 257 | |
258 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
258 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
259 | 259 | |
260 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
260 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
261 | 261 | |
262 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
262 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
263 | 263 | |
264 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
265 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
266 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
264 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
265 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
266 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
267 | 267 | } else { |
268 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
268 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
269 | 269 | } |
270 | 270 | |
271 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
271 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
272 | 272 | |
273 | 273 | // $_GET `post_type` variable |
274 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
274 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
275 | 275 | $is_page = 'single'; |
276 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
276 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
277 | 277 | $is_page = 'settings'; |
278 | 278 | } else { |
279 | 279 | $is_page = 'views'; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
289 | 289 | |
290 | 290 | // If the current page is the same as the compared page |
291 | - if( !empty( $page ) ) { |
|
291 | + if ( ! empty( $page ) ) { |
|
292 | 292 | return $is_page === $page; |
293 | 293 | } |
294 | 294 | |
@@ -309,6 +309,6 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
311 | 311 | */ |
312 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
312 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
313 | 313 | return GravityView_Admin::is_admin_page( $hook, $page ); |
314 | 314 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - if( ! is_admin() ) { return; } |
|
21 | + if ( ! is_admin() ) { return; } |
|
22 | 22 | |
23 | 23 | $this->add_hooks(); |
24 | 24 | } |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | private function add_hooks() { |
34 | 34 | //Hooks for no-conflict functionality |
35 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
36 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
35 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
36 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
37 | 37 | |
38 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
39 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
40 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
41 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
38 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
39 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
40 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
41 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | function no_conflict_scripts() { |
52 | 52 | global $wp_scripts; |
53 | 53 | |
54 | - if( ! gravityview_is_admin_page() ) { |
|
54 | + if ( ! gravityview_is_admin_page() ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
58 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
59 | 59 | |
60 | - if( empty( $no_conflict_mode ) ) { |
|
60 | + if ( empty( $no_conflict_mode ) ) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -110,24 +110,24 @@ discard block |
||
110 | 110 | function no_conflict_styles() { |
111 | 111 | global $wp_styles; |
112 | 112 | |
113 | - if( ! gravityview_is_admin_page() ) { |
|
113 | + if ( ! gravityview_is_admin_page() ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Dequeue other jQuery styles even if no-conflict is off. |
118 | 118 | // Terrible-looking tabs help no one. |
119 | - if( !empty( $wp_styles->registered ) ) { |
|
120 | - foreach ($wp_styles->registered as $key => $style) { |
|
121 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
119 | + if ( ! empty( $wp_styles->registered ) ) { |
|
120 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
121 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
122 | 122 | wp_dequeue_style( $key ); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
127 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
128 | 128 | |
129 | 129 | // If no conflict is off, jQuery will suffice. |
130 | - if( empty( $no_conflict_mode ) ) { |
|
130 | + if ( empty( $no_conflict_mode ) ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
156 | 156 | */ |
157 | - do_action('gravityview_remove_conflicts_after'); |
|
157 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | |
179 | 179 | //reset queue |
180 | 180 | $queue = array(); |
181 | - foreach( $wp_objects->queue as $object ) { |
|
182 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
183 | - $queue[] = $object; |
|
181 | + foreach ( $wp_objects->queue as $object ) { |
|
182 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
183 | + $queue[ ] = $object; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | $wp_objects->queue = $queue; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | |
190 | 190 | //unregistering scripts |
191 | 191 | $registered = array(); |
192 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
193 | - if( in_array( $handle, $required_objects ) ){ |
|
192 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
193 | + if ( in_array( $handle, $required_objects ) ) { |
|
194 | 194 | $registered[ $handle ] = $script_registration; |
195 | 195 | } |
196 | 196 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @param array $registered [description] |
206 | 206 | * @param array $scripts [description] |
207 | 207 | */ |
208 | - private function add_script_dependencies($registered, $scripts) { |
|
208 | + private function add_script_dependencies( $registered, $scripts ) { |
|
209 | 209 | |
210 | 210 | //gets all dependent scripts linked to the $scripts array passed |
211 | 211 | do { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
215 | 215 | foreach ( $deps as $dep ) { |
216 | 216 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
217 | - $dependents[] = $dep; |
|
217 | + $dependents[ ] = $dep; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // Dequeue other jQuery styles even if no-conflict is off. |
118 | 118 | // Terrible-looking tabs help no one. |
119 | - if( !empty( $wp_styles->registered ) ) { |
|
119 | + if( !empty( $wp_styles->registered ) ) { |
|
120 | 120 | foreach ($wp_styles->registered as $key => $style) { |
121 | 121 | if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
122 | 122 | wp_dequeue_style( $key ); |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | |
190 | 190 | //unregistering scripts |
191 | 191 | $registered = array(); |
192 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
193 | - if( in_array( $handle, $required_objects ) ){ |
|
192 | + foreach( $wp_objects->registered as $handle => $script_registration ) { |
|
193 | + if( in_array( $handle, $required_objects ) ) { |
|
194 | 194 | $registered[ $handle ] = $script_registration; |
195 | 195 | } |
196 | 196 | } |
@@ -19,12 +19,12 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function render_input( $override_input = null ) { |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $this->field['options'] as $value => $label ) : ?> |
|
27 | + foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
28 | 28 | <label class="<?php echo $this->get_label_class(); ?>"> |
29 | 29 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> /> <?php echo esc_html( $label ); ?> |
30 | 30 | </label> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'radio'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
13 | 13 | |
14 | 14 | var $_gf_field_class_name = 'GF_Field_Radio'; |
15 | 15 | |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | // Set the $_field_id var |
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | - if( $this->is_choice_value_enabled() ) { |
|
42 | - $field_options['choice_display'] = array( |
|
41 | + if ( $this->is_choice_value_enabled() ) { |
|
42 | + $field_options[ 'choice_display' ] = array( |
|
43 | 43 | 'type' => 'radio', |
44 | 44 | 'value' => 'value', |
45 | 45 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -38,8 +38,8 @@ |
||
38 | 38 | // Set the $_field_id var |
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | - if( $this->is_choice_value_enabled() ) { |
|
42 | - $field_options['choice_display'] = array( |
|
41 | + if ( $this->is_choice_value_enabled() ) { |
|
42 | + $field_options[ 'choice_display' ] = array( |
|
43 | 43 | 'type' => 'radio', |
44 | 44 | 'value' => 'value', |
45 | 45 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -48,25 +48,25 @@ |
||
48 | 48 | |
49 | 49 | $quiz_fields = GFAPI::get_fields_by_type( $form, 'quiz' ); |
50 | 50 | |
51 | - if( ! empty( $quiz_fields ) ) { |
|
51 | + if ( ! empty( $quiz_fields ) ) { |
|
52 | 52 | |
53 | - $fields['gquiz_score'] = array( |
|
53 | + $fields[ 'gquiz_score' ] = array( |
|
54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
55 | 55 | 'type' => 'quiz_score', |
56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
57 | 57 | ); |
58 | - $fields['gquiz_percent'] = array( |
|
58 | + $fields[ 'gquiz_percent' ] = array( |
|
59 | 59 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
60 | 60 | 'type' => 'quiz_percent', |
61 | 61 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
62 | 62 | ); |
63 | - $fields['gquiz_grade'] = array( |
|
63 | + $fields[ 'gquiz_grade' ] = array( |
|
64 | 64 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
65 | 65 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
66 | 66 | 'type' => 'quiz_grade', |
67 | 67 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
68 | 68 | ); |
69 | - $fields['gquiz_is_pass'] = array( |
|
69 | + $fields[ 'gquiz_is_pass' ] = array( |
|
70 | 70 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
71 | 71 | 'type' => 'quiz_is_pass', |
72 | 72 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @return string If a custom field label isn't set, return the field label for the password field |
51 | 51 | */ |
52 | - function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){ |
|
52 | + function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) { |
|
53 | 53 | |
54 | 54 | // If using a custom label, no need to fetch the parent label |
55 | 55 | if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) { |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return string If a custom field label isn't set, return the field label for the password field |
51 | 51 | */ |
52 | - function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){ |
|
52 | + function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) { |
|
53 | 53 | |
54 | 54 | // If using a custom label, no need to fetch the parent label |
55 | - if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) { |
|
55 | + if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) { |
|
56 | 56 | return $label; |
57 | 57 | } |
58 | 58 | |
59 | - $field_object = GFFormsModel::get_field( $form, $field['id'] ); |
|
59 | + $field_object = GFFormsModel::get_field( $form, $field[ 'id' ] ); |
|
60 | 60 | |
61 | - if( $field_object && 'password' === $field_object->type ) { |
|
62 | - $label = $field['label']; |
|
61 | + if ( $field_object && 'password' === $field_object->type ) { |
|
62 | + $label = $field[ 'label' ]; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $label; |
@@ -79,17 +79,17 @@ discard block |
||
79 | 79 | function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) { |
80 | 80 | |
81 | 81 | foreach ( $fields as $key => $field ) { |
82 | - if( 'password' === $field['type'] ) { |
|
82 | + if ( 'password' === $field[ 'type' ] ) { |
|
83 | 83 | |
84 | 84 | // The Enter Password input |
85 | - if( floor( $key ) === floatval( $key ) ) { |
|
85 | + if ( floor( $key ) === floatval( $key ) ) { |
|
86 | 86 | |
87 | - if( ! empty( $field['parent'] ) ) { |
|
88 | - $field['label'] = $field['parent']->label; |
|
89 | - $field['adminOnly'] = $field['parent']->adminOnly; |
|
90 | - $field['adminLabel'] = $field['parent']->adminLabel; |
|
87 | + if ( ! empty( $field[ 'parent' ] ) ) { |
|
88 | + $field[ 'label' ] = $field[ 'parent' ]->label; |
|
89 | + $field[ 'adminOnly' ] = $field[ 'parent' ]->adminOnly; |
|
90 | + $field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel; |
|
91 | 91 | // Don't show as a child input |
92 | - unset( $field['parent'] ); |
|
92 | + unset( $field[ 'parent' ] ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $fields[ $key ] = $field; |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | 'slug' => 'edit', |
25 | 25 | 'type' => 'internal', |
26 | 26 | 'label' => __( 'Edit Table', 'gravityview' ), |
27 | - 'description' => __('Display items in a table view.', 'gravityview'), |
|
28 | - 'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE), |
|
27 | + 'description' => __( 'Display items in a table view.', 'gravityview' ), |
|
28 | + 'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ), |
|
29 | 29 | 'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ), |
30 | 30 | ); |
31 | 31 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | '1-1' => array( |
43 | 43 | array( |
44 | 44 | 'areaid' => 'edit-fields', |
45 | - 'title' => __('Visible Edit Fields', 'gravityview' ) |
|
45 | + 'title' => __( 'Visible Edit Fields', 'gravityview' ) |
|
46 | 46 | ) |
47 | 47 | ) |
48 | 48 | ) |