@@ -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 | |
@@ -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 | } |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ( $form ) { |
| 230 | - foreach ( $form['fields'] as $field ) { |
|
| 230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 231 | 231 | |
| 232 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 233 | - $fields[ $field['id'] ] = array( |
|
| 232 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 233 | + $fields[ $field[ 'id' ] ] = array( |
|
| 234 | 234 | 'label' => rgar( $field, 'label' ), |
| 235 | 235 | 'parent' => null, |
| 236 | 236 | 'type' => rgar( $field, 'type' ), |
@@ -239,16 +239,16 @@ discard block |
||
| 239 | 239 | ); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
| 243 | - foreach ( $field['inputs'] as $input ) { |
|
| 242 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
| 243 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
| 244 | 244 | /** |
| 245 | 245 | * @hack |
| 246 | 246 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 247 | 247 | */ |
| 248 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
| 248 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 249 | 249 | continue; |
| 250 | 250 | } |
| 251 | - $fields[ (string)$input['id'] ] = array( |
|
| 251 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
| 252 | 252 | 'label' => rgar( $input, 'label' ), |
| 253 | 253 | 'customLabel' => rgar( $input, 'customLabel' ), |
| 254 | 254 | 'parent' => $field, |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** @since 1.14 */ |
| 263 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
| 263 | + if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { |
|
| 264 | 264 | |
| 265 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
| 265 | + foreach ( (array)$field[ 'choices' ] as $key => $input ) { |
|
| 266 | 266 | |
| 267 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
| 267 | + $input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} |
|
| 268 | 268 | |
| 269 | 269 | $fields[ $input_id ] = array( |
| 270 | 270 | 'label' => rgar( $input, 'text' ), |
@@ -280,25 +280,25 @@ discard block |
||
| 280 | 280 | /** |
| 281 | 281 | * @since 1.8 |
| 282 | 282 | */ |
| 283 | - if( 'quiz' === $field['type'] ) { |
|
| 283 | + if ( 'quiz' === $field[ 'type' ] ) { |
|
| 284 | 284 | $has_quiz_fields = true; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | 288 | * @since 1.8 |
| 289 | 289 | */ |
| 290 | - if( 'poll' === $field['type'] ) { |
|
| 290 | + if ( 'poll' === $field[ 'type' ] ) { |
|
| 291 | 291 | $has_poll_fields = true; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
| 294 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
| 295 | 295 | $has_product_fields = true; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * @hack Version 1.9 |
| 300 | 300 | */ |
| 301 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
| 301 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
| 302 | 302 | |
| 303 | 303 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
| 304 | 304 | $has_post_fields = true; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @since 1.7 |
| 311 | 311 | */ |
| 312 | 312 | if ( $has_post_fields ) { |
| 313 | - $fields['post_id'] = array( |
|
| 313 | + $fields[ 'post_id' ] = array( |
|
| 314 | 314 | 'label' => __( 'Post ID', 'gravityview' ), |
| 315 | 315 | 'type' => 'post_id', |
| 316 | 316 | ); |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
| 322 | 322 | |
| 323 | 323 | foreach ( $payment_fields as $payment_field ) { |
| 324 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
| 324 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
| 325 | 325 | continue; |
| 326 | 326 | } |
| 327 | - $fields["{$payment_field->name}"] = array( |
|
| 327 | + $fields[ "{$payment_field->name}" ] = array( |
|
| 328 | 328 | 'label' => $payment_field->label, |
| 329 | 329 | 'desc' => $payment_field->description, |
| 330 | 330 | 'type' => $payment_field->name, |
@@ -335,25 +335,25 @@ discard block |
||
| 335 | 335 | /** |
| 336 | 336 | * @since 1.8 |
| 337 | 337 | */ |
| 338 | - if( $has_quiz_fields ) { |
|
| 338 | + if ( $has_quiz_fields ) { |
|
| 339 | 339 | |
| 340 | - $fields['gquiz_score'] = array( |
|
| 340 | + $fields[ 'gquiz_score' ] = array( |
|
| 341 | 341 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
| 342 | 342 | 'type' => 'quiz_score', |
| 343 | 343 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
| 344 | 344 | ); |
| 345 | - $fields['gquiz_percent'] = array( |
|
| 345 | + $fields[ 'gquiz_percent' ] = array( |
|
| 346 | 346 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
| 347 | 347 | 'type' => 'quiz_percent', |
| 348 | 348 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
| 349 | 349 | ); |
| 350 | - $fields['gquiz_grade'] = array( |
|
| 350 | + $fields[ 'gquiz_grade' ] = array( |
|
| 351 | 351 | /* 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. */ |
| 352 | 352 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
| 353 | 353 | 'type' => 'quiz_grade', |
| 354 | 354 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
| 355 | 355 | ); |
| 356 | - $fields['gquiz_is_pass'] = array( |
|
| 356 | + $fields[ 'gquiz_is_pass' ] = array( |
|
| 357 | 357 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
| 358 | 358 | 'type' => 'quiz_is_pass', |
| 359 | 359 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | $fields = array(); |
| 377 | 377 | |
| 378 | - foreach ( $extra_fields as $key => $field ){ |
|
| 379 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 380 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
| 378 | + foreach ( $extra_fields as $key => $field ) { |
|
| 379 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 380 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
@@ -417,32 +417,32 @@ discard block |
||
| 417 | 417 | 'search_criteria' => null, |
| 418 | 418 | 'sorting' => null, |
| 419 | 419 | 'paging' => null, |
| 420 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
| 420 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
| 421 | 421 | ); |
| 422 | 422 | |
| 423 | 423 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 424 | 424 | |
| 425 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 426 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 425 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 426 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 427 | 427 | |
| 428 | 428 | if ( ! is_array( $filter ) ) { |
| 429 | 429 | continue; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | // By default, we want searches to be wildcard for each field. |
| 433 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 433 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 434 | 434 | |
| 435 | 435 | /** |
| 436 | 436 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 437 | 437 | * @param string $operator Existing search operator |
| 438 | 438 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 439 | 439 | */ |
| 440 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 440 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | // don't send just the [mode] without any field filter. |
| 444 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
| 445 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 444 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 445 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | } |
@@ -453,21 +453,21 @@ discard block |
||
| 453 | 453 | * Prepare date formats to be in Gravity Forms DB format; |
| 454 | 454 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
| 455 | 455 | */ |
| 456 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
| 456 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
| 457 | 457 | |
| 458 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 458 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 459 | 459 | |
| 460 | 460 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 461 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 461 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 462 | 462 | |
| 463 | 463 | if ( $date ) { |
| 464 | 464 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 465 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 465 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 466 | 466 | } else { |
| 467 | 467 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 468 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 468 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 469 | 469 | |
| 470 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
| 470 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | } |
@@ -475,12 +475,12 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
| 477 | 477 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 478 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 478 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 479 | 479 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 480 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
| 481 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
| 480 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
| 481 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
| 482 | 482 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
| 483 | - $criteria['context_view_id'] = null; |
|
| 483 | + $criteria[ 'context_view_id' ] = null; |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | * @param array $form_ids Forms to search |
| 490 | 490 | * @param int $view_id ID of the view being used to search |
| 491 | 491 | */ |
| 492 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 492 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 493 | 493 | |
| 494 | 494 | return (array)$criteria; |
| 495 | 495 | |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | /** Reduce # of database calls */ |
| 521 | 521 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 522 | 522 | |
| 523 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 523 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 524 | 524 | |
| 525 | 525 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 526 | 526 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | // Still update the total count when using cached results |
| 530 | 530 | if ( ! is_null( $total ) ) { |
| 531 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 531 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | $return = $entries; |
@@ -548,9 +548,9 @@ discard block |
||
| 548 | 548 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
| 549 | 549 | |
| 550 | 550 | // No entries returned from gravityview_before_get_entries |
| 551 | - if( is_null( $entries ) ) { |
|
| 551 | + if ( is_null( $entries ) ) { |
|
| 552 | 552 | |
| 553 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 553 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 554 | 554 | |
| 555 | 555 | if ( is_wp_error( $entries ) ) { |
| 556 | 556 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 562 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 563 | 563 | |
| 564 | 564 | // Cache results |
| 565 | 565 | $Cache->set( $entries, 'entries' ); |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
| 648 | 648 | |
| 649 | - if( $check_entry_display ) { |
|
| 649 | + if ( $check_entry_display ) { |
|
| 650 | 650 | // Is the entry allowed |
| 651 | 651 | $entry = self::check_entry_display( $entry ); |
| 652 | 652 | } |
@@ -679,12 +679,12 @@ discard block |
||
| 679 | 679 | |
| 680 | 680 | $value = false; |
| 681 | 681 | |
| 682 | - if( 'context' === $val1 ) { |
|
| 682 | + if ( 'context' === $val1 ) { |
|
| 683 | 683 | |
| 684 | 684 | $matching_contexts = array( $val2 ); |
| 685 | 685 | |
| 686 | 686 | // We allow for non-standard contexts. |
| 687 | - switch( $val2 ) { |
|
| 687 | + switch ( $val2 ) { |
|
| 688 | 688 | // Check for either single or edit |
| 689 | 689 | case 'singular': |
| 690 | 690 | $matching_contexts = array( 'single', 'edit' ); |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | return false; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | - if ( empty( $entry['form_id'] ) ) { |
|
| 747 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 748 | 748 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
| 749 | 749 | return false; |
| 750 | 750 | } |
@@ -752,26 +752,26 @@ discard block |
||
| 752 | 752 | $criteria = self::calculate_get_entries_criteria(); |
| 753 | 753 | |
| 754 | 754 | // Make sure the current View is connected to the same form as the Entry |
| 755 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
| 756 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
| 755 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 756 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
| 757 | 757 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
| 758 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
| 759 | - 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'] ); |
|
| 758 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
| 759 | + 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' ] ); |
|
| 760 | 760 | return false; |
| 761 | 761 | } |
| 762 | 762 | } |
| 763 | 763 | |
| 764 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
| 764 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
| 765 | 765 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
| 766 | 766 | return $entry; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - $search_criteria = $criteria['search_criteria']; |
|
| 769 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
| 770 | 770 | unset( $criteria ); |
| 771 | 771 | |
| 772 | 772 | // check entry status |
| 773 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
| 774 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
| 773 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
| 774 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
| 775 | 775 | return false; |
| 776 | 776 | } |
| 777 | 777 | |
@@ -779,37 +779,37 @@ discard block |
||
| 779 | 779 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
| 780 | 780 | |
| 781 | 781 | // field_filters |
| 782 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
| 782 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
| 783 | 783 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
| 784 | 784 | return $entry; |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | - $filters = $search_criteria['field_filters']; |
|
| 787 | + $filters = $search_criteria[ 'field_filters' ]; |
|
| 788 | 788 | unset( $search_criteria ); |
| 789 | 789 | |
| 790 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
| 791 | - unset( $filters['mode'] ); |
|
| 790 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
| 791 | + unset( $filters[ 'mode' ] ); |
|
| 792 | 792 | |
| 793 | - $form = self::get_form( $entry['form_id'] ); |
|
| 793 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 794 | 794 | |
| 795 | 795 | foreach ( $filters as $filter ) { |
| 796 | 796 | |
| 797 | - if ( ! isset( $filter['key'] ) ) { |
|
| 797 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
| 798 | 798 | continue; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - $k = $filter['key']; |
|
| 801 | + $k = $filter[ 'key' ]; |
|
| 802 | 802 | |
| 803 | 803 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
| 804 | 804 | $field_value = $entry[ $k ]; |
| 805 | 805 | $field = null; |
| 806 | 806 | } else { |
| 807 | 807 | $field = self::get_field( $form, $k ); |
| 808 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 808 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 809 | 809 | } |
| 810 | 810 | |
| 811 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
| 812 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
| 811 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
| 812 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
| 813 | 813 | |
| 814 | 814 | // verify if we are already free to go! |
| 815 | 815 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -867,18 +867,18 @@ discard block |
||
| 867 | 867 | * Gravity Forms code to adjust date to locally-configured Time Zone |
| 868 | 868 | * @see GFCommon::format_date() for original code |
| 869 | 869 | */ |
| 870 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 870 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 871 | 871 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 872 | 872 | |
| 873 | - $format = rgar( $atts, 'format' ); |
|
| 874 | - $is_human = ! empty( $atts['human'] ); |
|
| 875 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 876 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 877 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 878 | - $include_time = ! empty( $atts['time'] ); |
|
| 873 | + $format = rgar( $atts, 'format' ); |
|
| 874 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 875 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 876 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 877 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 878 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 879 | 879 | |
| 880 | 880 | // If we're using time diff, we want to have a different default format |
| 881 | - if( empty( $format ) ) { |
|
| 881 | + if ( empty( $format ) ) { |
|
| 882 | 882 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
| 883 | 883 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
| 884 | 884 | } |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | // If raw was specified, don't modify the stored value |
| 887 | 887 | if ( $is_raw ) { |
| 888 | 888 | $formatted_date = $date_string; |
| 889 | - } elseif( $is_timestamp ) { |
|
| 889 | + } elseif ( $is_timestamp ) { |
|
| 890 | 890 | $formatted_date = $date_local_timestamp; |
| 891 | 891 | } elseif ( $is_diff ) { |
| 892 | 892 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | |
| 921 | 921 | $label = rgar( $field, 'label' ); |
| 922 | 922 | |
| 923 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 923 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 924 | 924 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
| 925 | 925 | } |
| 926 | 926 | |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
| 942 | 942 | */ |
| 943 | 943 | public static function get_field( $form, $field_id ) { |
| 944 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 944 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 945 | 945 | return GFFormsModel::get_field( $form, $field_id ); |
| 946 | 946 | } else { |
| 947 | 947 | return null; |
@@ -988,19 +988,19 @@ discard block |
||
| 988 | 988 | $shortcodes = array(); |
| 989 | 989 | |
| 990 | 990 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 991 | - if ( empty( $matches ) ){ |
|
| 991 | + if ( empty( $matches ) ) { |
|
| 992 | 992 | return false; |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | foreach ( $matches as $shortcode ) { |
| 996 | - if ( $tag === $shortcode[2] ) { |
|
| 996 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 997 | 997 | |
| 998 | 998 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 999 | - $shortcodes[] = $shortcode; |
|
| 999 | + $shortcodes[ ] = $shortcode; |
|
| 1000 | 1000 | |
| 1001 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 1002 | - foreach( $results as $result ) { |
|
| 1003 | - $shortcodes[] = $result; |
|
| 1001 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 1002 | + foreach ( $results as $result ) { |
|
| 1003 | + $shortcodes[ ] = $result; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | 1006 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | * @return string html |
| 1162 | 1162 | */ |
| 1163 | 1163 | public static function get_sortable_fields( $formid, $current = '' ) { |
| 1164 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
| 1164 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
| 1165 | 1165 | |
| 1166 | 1166 | if ( empty( $formid ) ) { |
| 1167 | 1167 | return $output; |
@@ -1174,11 +1174,11 @@ discard block |
||
| 1174 | 1174 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
| 1175 | 1175 | |
| 1176 | 1176 | foreach ( $fields as $id => $field ) { |
| 1177 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1177 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1178 | 1178 | continue; |
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
| 1181 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1182 | 1182 | } |
| 1183 | 1183 | } |
| 1184 | 1184 | |
@@ -1213,9 +1213,9 @@ discard block |
||
| 1213 | 1213 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1214 | 1214 | |
| 1215 | 1215 | // TODO: Convert to using array_filter |
| 1216 | - foreach( $fields as $id => $field ) { |
|
| 1216 | + foreach ( $fields as $id => $field ) { |
|
| 1217 | 1217 | |
| 1218 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1218 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1219 | 1219 | unset( $fields[ $id ] ); |
| 1220 | 1220 | } |
| 1221 | 1221 | } |
@@ -1256,14 +1256,14 @@ discard block |
||
| 1256 | 1256 | * @param int|array $field field key or field array |
| 1257 | 1257 | * @return boolean |
| 1258 | 1258 | */ |
| 1259 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1259 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1260 | 1260 | |
| 1261 | 1261 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
| 1262 | 1262 | $form = self::get_form( $form ); |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | // If entry meta, it's a string. Otherwise, numeric |
| 1266 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1266 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1267 | 1267 | $type = $field; |
| 1268 | 1268 | } else { |
| 1269 | 1269 | $type = self::get_field_type( $form, $field ); |
@@ -1277,9 +1277,9 @@ discard block |
||
| 1277 | 1277 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
| 1278 | 1278 | |
| 1279 | 1279 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1280 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1281 | - if( true === $gv_field->is_numeric ) { |
|
| 1282 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1280 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1281 | + if ( true === $gv_field->is_numeric ) { |
|
| 1282 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1283 | 1283 | } |
| 1284 | 1284 | } |
| 1285 | 1285 | |
@@ -1429,11 +1429,11 @@ discard block |
||
| 1429 | 1429 | $final_atts = array_filter( $final_atts ); |
| 1430 | 1430 | |
| 1431 | 1431 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1432 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1433 | - $final_atts['href'] = $href; |
|
| 1432 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1433 | + $final_atts[ 'href' ] = $href; |
|
| 1434 | 1434 | } |
| 1435 | 1435 | |
| 1436 | - $final_atts['href'] = esc_url_raw( $href ); |
|
| 1436 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
| 1437 | 1437 | |
| 1438 | 1438 | // Sort the attributes alphabetically, to help testing |
| 1439 | 1439 | ksort( $final_atts ); |
@@ -1444,7 +1444,7 @@ discard block |
||
| 1444 | 1444 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | - if( '' !== $output ) { |
|
| 1447 | + if ( '' !== $output ) { |
|
| 1448 | 1448 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
| 1449 | 1449 | } |
| 1450 | 1450 | |
@@ -1468,7 +1468,7 @@ discard block |
||
| 1468 | 1468 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
| 1469 | 1469 | $merged = $array1; |
| 1470 | 1470 | |
| 1471 | - foreach ( $array2 as $key => &$value ) { |
|
| 1471 | + foreach ( $array2 as $key => &$value ) { |
|
| 1472 | 1472 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1473 | 1473 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1474 | 1474 | } else { |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
| 1504 | 1504 | * @param array $settings Settings array, with `number` key defining the # of users to display |
| 1505 | 1505 | */ |
| 1506 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1506 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1507 | 1507 | |
| 1508 | 1508 | return get_users( $get_users_settings ); |
| 1509 | 1509 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | * @return string |
| 1519 | 1519 | */ |
| 1520 | 1520 | public static function generate_notice( $notice, $class = '' ) { |
| 1521 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1521 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | /** |
@@ -41,7 +41,6 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @see GVCommon::get_forms() |
| 43 | 43 | * @access public |
| 44 | - * @param mixed $form_id |
|
| 45 | 44 | * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys |
| 46 | 45 | */ |
| 47 | 46 | function gravityview_get_forms() { |
@@ -53,7 +52,7 @@ discard block |
||
| 53 | 52 | * |
| 54 | 53 | * @see GVCommon::get_form_fields() |
| 55 | 54 | * @access public |
| 56 | - * @param string|array $form_id (default: '') or $form object |
|
| 55 | + * @param string|array $form (default: '') or $form object |
|
| 57 | 56 | * @return array |
| 58 | 57 | */ |
| 59 | 58 | function gravityview_get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -91,6 +90,7 @@ discard block |
||
| 91 | 90 | * @param int|array $form_ids The ID of the form or an array IDs of the Forms. Zero for all forms. |
| 92 | 91 | * @param mixed $passed_criteria (default: null) |
| 93 | 92 | * @param mixed &$total (default: null) |
| 93 | + * @param integer $total |
|
| 94 | 94 | * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays |
| 95 | 95 | */ |
| 96 | 96 | function gravityview_get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) { |
@@ -103,7 +103,6 @@ discard block |
||
| 103 | 103 | * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()` |
| 104 | 104 | * |
| 105 | 105 | * @access public |
| 106 | - * @param mixed $entry_id |
|
| 107 | 106 | * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false. |
| 108 | 107 | * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true {@since 1.14} |
| 109 | 108 | * @return array|boolean |
@@ -190,7 +189,6 @@ discard block |
||
| 190 | 189 | * |
| 191 | 190 | * @see GravityView_Template::template_id |
| 192 | 191 | * |
| 193 | - * @param int $view_id The ID of the View to get the layout of |
|
| 194 | 192 | * |
| 195 | 193 | * @return string GravityView_Template::template_id value. Empty string if not. |
| 196 | 194 | */ |
@@ -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 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @return GV_License_Handler |
| 41 | 41 | */ |
| 42 | 42 | public static function get_instance( GravityView_Settings $GFAddOn ) { |
| 43 | - if( empty( self::$instance ) ) { |
|
| 43 | + if ( empty( self::$instance ) ) { |
|
| 44 | 44 | self::$instance = new self( $GFAddOn ); |
| 45 | 45 | } |
| 46 | 46 | return self::$instance; |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | public function refresh_license_status() { |
| 71 | 71 | |
| 72 | 72 | // Only perform on GravityView pages |
| 73 | - if( ! gravityview_is_admin_page() ) { |
|
| 73 | + if ( ! gravityview_is_admin_page() ) { |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // The transient is fresh; don't fetch. |
| 78 | - if( $status = get_transient( self::status_transient_key ) ) { |
|
| 78 | + if ( $status = get_transient( self::status_transient_key ) ) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -100,37 +100,37 @@ discard block |
||
| 100 | 100 | $status = trim( $this->Addon->get_app_setting( 'license_key_status' ) ); |
| 101 | 101 | $key = trim( $this->Addon->get_app_setting( 'license_key' ) ); |
| 102 | 102 | |
| 103 | - if( !empty( $key ) ) { |
|
| 103 | + if ( ! empty( $key ) ) { |
|
| 104 | 104 | $response = $this->Addon->get_app_setting( 'license_key_response' ); |
| 105 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
| 105 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
| 106 | 106 | } else { |
| 107 | 107 | $response = array(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array( |
| 111 | 111 | 'license_box' => $this->get_license_message( $response ) |
| 112 | - )); |
|
| 112 | + ) ); |
|
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | $fields = array( |
| 116 | 116 | array( |
| 117 | 117 | 'name' => 'edd-activate', |
| 118 | - 'value' => __('Activate License', 'gravityview'), |
|
| 119 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
| 118 | + 'value' => __( 'Activate License', 'gravityview' ), |
|
| 119 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
| 120 | 120 | 'data-edd_action' => 'activate_license', |
| 121 | 121 | 'class' => 'button-primary', |
| 122 | 122 | ), |
| 123 | 123 | array( |
| 124 | 124 | 'name' => 'edd-deactivate', |
| 125 | - 'value' => __('Deactivate License', 'gravityview'), |
|
| 126 | - 'data-pending_text' => __('Deactivating license…', 'gravityview'), |
|
| 125 | + 'value' => __( 'Deactivate License', 'gravityview' ), |
|
| 126 | + 'data-pending_text' => __( 'Deactivating license…', 'gravityview' ), |
|
| 127 | 127 | 'data-edd_action' => 'deactivate_license', |
| 128 | 128 | 'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ), |
| 129 | 129 | ), |
| 130 | 130 | array( |
| 131 | 131 | 'name' => 'edd-check', |
| 132 | - 'value' => __('Check License', 'gravityview'), |
|
| 133 | - 'data-pending_text' => __('Verifying license…', 'gravityview'), |
|
| 132 | + 'value' => __( 'Check License', 'gravityview' ), |
|
| 133 | + 'data-pending_text' => __( 'Verifying license…', 'gravityview' ), |
|
| 134 | 134 | 'title' => 'Check the license before saving it', |
| 135 | 135 | 'data-edd_action' => 'check_license', |
| 136 | 136 | 'class' => 'button-secondary', |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $class = 'button gv-edd-action'; |
| 142 | 142 | |
| 143 | - $class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
| 143 | + $class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide'; |
|
| 144 | 144 | |
| 145 | 145 | $disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled'; |
| 146 | 146 | |
| 147 | 147 | $submit = '<div class="gv-edd-button-wrapper">'; |
| 148 | 148 | foreach ( $fields as $field ) { |
| 149 | - $field['type'] = 'button'; |
|
| 150 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
| 151 | - $field['style'] = 'margin-left: 10px;'; |
|
| 152 | - if( $disabled_attribute ) { |
|
| 153 | - $field['disabled'] = $disabled_attribute; |
|
| 149 | + $field[ 'type' ] = 'button'; |
|
| 150 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
| 151 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
| 152 | + if ( $disabled_attribute ) { |
|
| 153 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 154 | 154 | } |
| 155 | 155 | $submit .= $this->Addon->settings_submit( $field, $echo ); |
| 156 | 156 | } |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function setup_edd() { |
| 168 | 168 | |
| 169 | - if( !class_exists('EDD_SL_Plugin_Updater') ) { |
|
| 170 | - require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php'); |
|
| 169 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
| 170 | + require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // setup the updater |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | 'url' => home_url(), |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - if( !empty( $action ) ) { |
|
| 208 | - $settings['edd_action'] = esc_attr( $action ); |
|
| 207 | + if ( ! empty( $action ) ) { |
|
| 208 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $settings = array_map( 'urlencode', $settings ); |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | private function _license_get_remote_response( $data, $license = '' ) { |
| 221 | 221 | |
| 222 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
| 222 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
| 223 | 223 | |
| 224 | 224 | $url = add_query_arg( $api_params, self::url ); |
| 225 | 225 | |
| 226 | 226 | $response = wp_remote_get( $url, array( |
| 227 | 227 | 'timeout' => 15, |
| 228 | 228 | 'sslverify' => false, |
| 229 | - )); |
|
| 229 | + ) ); |
|
| 230 | 230 | |
| 231 | 231 | if ( is_wp_error( $response ) ) { |
| 232 | 232 | return array(); |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function get_license_message( $license_data ) { |
| 261 | 261 | |
| 262 | - if( empty( $license_data ) ) { |
|
| 262 | + if ( empty( $license_data ) ) { |
|
| 263 | 263 | $message = ''; |
| 264 | 264 | } else { |
| 265 | 265 | |
| 266 | - if( ! empty( $license_data->error ) ) { |
|
| 266 | + if ( ! empty( $license_data->error ) ) { |
|
| 267 | 267 | $class = 'error'; |
| 268 | 268 | $string_key = $license_data->error; |
| 269 | 269 | } else { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $string_key = $license_data->license; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) ); |
|
| 274 | + $message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) ); |
|
| 275 | 275 | |
| 276 | 276 | $message = $this->generate_license_box( $message, $class ); |
| 277 | 277 | } |
@@ -308,15 +308,15 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function license_details( $response = array() ) { |
| 310 | 310 | |
| 311 | - $response = (array) $response; |
|
| 311 | + $response = (array)$response; |
|
| 312 | 312 | |
| 313 | 313 | $return = ''; |
| 314 | 314 | $return .= '<span class="gv-license-details" aria-live="polite" aria-busy="false">'; |
| 315 | 315 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
| 316 | 316 | |
| 317 | - if( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
|
| 318 | - $return .= $this->strings( $response['license'], $response ); |
|
| 319 | - } elseif( ! empty( $response['license_name'] ) ) { |
|
| 317 | + if ( in_array( rgar( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
|
| 318 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
| 319 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
| 320 | 320 | |
| 321 | 321 | $response_keys = array( |
| 322 | 322 | 'license_name' => '', |
@@ -331,19 +331,19 @@ discard block |
||
| 331 | 331 | // Make sure all the keys are set |
| 332 | 332 | $response = wp_parse_args( $response, $response_keys ); |
| 333 | 333 | |
| 334 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 335 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 334 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 335 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 336 | 336 | $details = array( |
| 337 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
| 338 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'] ), esc_html__( $response['customer_email'] ) ) . $login_link, |
|
| 339 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
| 340 | - 'expires' => sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
| 341 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
| 337 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
| 338 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ] ), esc_html__( $response[ 'customer_email' ] ) ) . $login_link, |
|
| 339 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
| 340 | + 'expires' => sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
| 341 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
| 345 | - unset( $details['upgrade'] ); |
|
| 346 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 344 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
| 345 | + unset( $details[ 'upgrade' ] ); |
|
| 346 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -367,11 +367,11 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | $output = ''; |
| 369 | 369 | |
| 370 | - if( ! empty( $upgrades ) ) { |
|
| 370 | + if ( ! empty( $upgrades ) ) { |
|
| 371 | 371 | |
| 372 | 372 | $locale_parts = explode( '_', get_locale() ); |
| 373 | 373 | |
| 374 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
| 374 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
| 375 | 375 | |
| 376 | 376 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
| 377 | 377 | |
@@ -379,14 +379,14 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
| 381 | 381 | |
| 382 | - $upgrade = (object) $upgrade; |
|
| 382 | + $upgrade = (object)$upgrade; |
|
| 383 | 383 | |
| 384 | 384 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
| 385 | 385 | |
| 386 | - if( $is_english && isset( $upgrade->description ) ) { |
|
| 386 | + if ( $is_english && isset( $upgrade->description ) ) { |
|
| 387 | 387 | $message = esc_html( $upgrade->description ); |
| 388 | 388 | } else { |
| 389 | - switch( $upgrade->price_id ) { |
|
| 389 | + switch ( $upgrade->price_id ) { |
|
| 390 | 390 | // Interstellar |
| 391 | 391 | case 1: |
| 392 | 392 | default: |
@@ -424,16 +424,16 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function license_call( $array = array() ) { |
| 426 | 426 | |
| 427 | - $is_ajax = ( defined('DOING_AJAX') && DOING_AJAX ); |
|
| 428 | - $data = empty( $array ) ? $_POST['data'] : $array; |
|
| 427 | + $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
| 428 | + $data = empty( $array ) ? $_POST[ 'data' ] : $array; |
|
| 429 | 429 | $has_cap = GVCommon::has_cap( 'gravityview_edit_settings' ); |
| 430 | 430 | |
| 431 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
| 432 | - die( - 1 ); |
|
| 431 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
| 432 | + die( -1 ); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // If the user isn't allowed to edit settings, show an error message |
| 436 | - if( ! $has_cap ) { |
|
| 436 | + if ( ! $has_cap ) { |
|
| 437 | 437 | $license_data = new stdClass(); |
| 438 | 438 | $license_data->error = 'capability'; |
| 439 | 439 | $license_data->message = $this->get_license_message( $license_data ); |
@@ -457,9 +457,9 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $json = json_encode( $license_data ); |
| 459 | 459 | |
| 460 | - $update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) ); |
|
| 460 | + $update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) ); |
|
| 461 | 461 | |
| 462 | - $is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
| 462 | + $is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
| 463 | 463 | |
| 464 | 464 | // Failed is the response from trying to de-activate a license and it didn't work. |
| 465 | 465 | // This likely happened because people entered in a different key and clicked "Deactivate", |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | // most likely a mistake. |
| 468 | 468 | if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) { |
| 469 | 469 | |
| 470 | - if ( ! empty( $data['field_id'] ) ) { |
|
| 470 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
| 471 | 471 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
| 472 | 472 | } |
| 473 | 473 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | if ( $is_ajax ) { |
| 479 | 479 | exit( $json ); |
| 480 | 480 | } else { // Non-ajax call |
| 481 | - return ( rgget('format', $data ) === 'object' ) ? $license_data : $json; |
|
| 481 | + return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json; |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | |
@@ -492,9 +492,9 @@ discard block |
||
| 492 | 492 | // Update option with passed data license |
| 493 | 493 | $settings = $this->Addon->get_app_settings(); |
| 494 | 494 | |
| 495 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 496 | - $settings['license_key_status'] = $license_data->license; |
|
| 497 | - $settings['license_key_response'] = (array)$license_data; |
|
| 495 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
| 496 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
| 497 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
| 498 | 498 | |
| 499 | 499 | $this->Addon->update_app_settings( $settings ); |
| 500 | 500 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | private function get_license_renewal_url( $license_data ) { |
| 509 | 509 | $license_data = is_array( $license_data ) ? (object)$license_data : $license_data; |
| 510 | - $renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
| 510 | + $renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation&force_login=1', $license_data->license_key ) : 'https://gravityview.co/account/'; |
|
| 511 | 511 | return $renew_license_url; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -522,31 +522,31 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | |
| 524 | 524 | $strings = array( |
| 525 | - 'status' => esc_html__('Status', 'gravityview'), |
|
| 526 | - 'error' => esc_html__('There was an error processing the request.', 'gravityview'), |
|
| 527 | - 'failed' => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'), |
|
| 528 | - 'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
| 529 | - 'inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'), |
|
| 530 | - 'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
| 531 | - 'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'), |
|
| 532 | - 'valid' => esc_html__('The license key is valid and active.', 'gravityview'), |
|
| 533 | - 'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'), |
|
| 534 | - 'missing' => esc_html__('Invalid license key.', 'gravityview'), |
|
| 535 | - 'revoked' => esc_html__('This license key has been revoked.', 'gravityview'), |
|
| 536 | - 'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
| 525 | + 'status' => esc_html__( 'Status', 'gravityview' ), |
|
| 526 | + 'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ), |
|
| 527 | + 'failed' => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ), |
|
| 528 | + 'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
| 529 | + 'inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ), |
|
| 530 | + 'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ), |
|
| 531 | + 'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ), |
|
| 532 | + 'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ), |
|
| 533 | + 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
|
| 534 | + 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
|
| 535 | + 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
|
| 536 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
| 537 | 537 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
| 538 | 538 | |
| 539 | - 'verifying_license' => esc_html__('Verifying license…', 'gravityview'), |
|
| 540 | - 'activate_license' => esc_html__('Activate License', 'gravityview'), |
|
| 541 | - 'deactivate_license' => esc_html__('Deactivate License', 'gravityview'), |
|
| 542 | - 'check_license' => esc_html__('Verify License', 'gravityview'), |
|
| 539 | + 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
|
| 540 | + 'activate_license' => esc_html__( 'Activate License', 'gravityview' ), |
|
| 541 | + 'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ), |
|
| 542 | + 'check_license' => esc_html__( 'Verify License', 'gravityview' ), |
|
| 543 | 543 | ); |
| 544 | 544 | |
| 545 | - if( empty( $status ) ) { |
|
| 545 | + if ( empty( $status ) ) { |
|
| 546 | 546 | return $strings; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - if( isset( $strings[ $status ] ) ) { |
|
| 549 | + if ( isset( $strings[ $status ] ) ) { |
|
| 550 | 550 | return $strings[ $status ]; |
| 551 | 551 | } |
| 552 | 552 | |
@@ -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' ), |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'checkbox'; |
| 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_Checkbox'; |
| 15 | 15 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
| 40 | 40 | |
| 41 | 41 | // It's not the parent field; it's an input |
| 42 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 42 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 43 | 43 | |
| 44 | - if( $this->is_choice_value_enabled() ) { |
|
| 45 | - $field_options['choice_display'] = array( |
|
| 44 | + if ( $this->is_choice_value_enabled() ) { |
|
| 45 | + $field_options[ 'choice_display' ] = array( |
|
| 46 | 46 | 'type' => 'radio', |
| 47 | 47 | 'value' => 'value', |
| 48 | 48 | 'class' => 'vertical', |
@@ -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' ), |