@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @var string The REST API functionality identifier. |
| 91 | 91 | */ |
| 92 | - const FEATURE_REST = 'rest_api'; |
|
| 92 | + const FEATURE_REST = 'rest_api'; |
|
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * Get the global instance of \GV\Plugin. |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | include_once $this->dir( 'includes/class-frontend-views.php' ); |
| 216 | 216 | include_once $this->dir( 'includes/class-gravityview-admin-bar.php' ); |
| 217 | 217 | include_once $this->dir( 'includes/class-gravityview-entry-list.php' ); |
| 218 | - include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 218 | + include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 219 | 219 | include_once $this->dir( 'includes/class-data.php' ); |
| 220 | 220 | include_once $this->dir( 'includes/class-gravityview-shortcode.php' ); |
| 221 | 221 | include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | // Pre-4.6 loading |
| 271 | 271 | // TODO: Remove when GV minimum version is WordPress 4.6.0 |
| 272 | - $locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
| 272 | + $locale = apply_filters( 'plugin_locale', ( ( function_exists( 'get_user_locale' ) && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' ); |
|
| 273 | 273 | |
| 274 | - $loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir('languages'), $domain, $locale ) ); |
|
| 274 | + $loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir( 'languages' ), $domain, $locale ) ); |
|
| 275 | 275 | |
| 276 | - if( $loaded ) { |
|
| 276 | + if ( $loaded ) { |
|
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function is_compatible_wordpress( $version = null ) { |
| 426 | 426 | |
| 427 | - if( ! $version ) { |
|
| 427 | + if ( ! $version ) { |
|
| 428 | 428 | $version = self::$min_wp_version; |
| 429 | 429 | } |
| 430 | 430 | |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | * @return string The version of PHP. |
| 466 | 466 | */ |
| 467 | 467 | private function get_php_version() { |
| 468 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 469 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 468 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 469 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -477,8 +477,8 @@ discard block |
||
| 477 | 477 | * @return string The version of WordPress. |
| 478 | 478 | */ |
| 479 | 479 | private function get_wordpress_version() { |
| 480 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 481 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 480 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 481 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
@@ -489,13 +489,13 @@ discard block |
||
| 489 | 489 | * @return string|null The version of Gravity Forms or null if inactive. |
| 490 | 490 | */ |
| 491 | 491 | private function get_gravityforms_version() { |
| 492 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
| 492 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
| 493 | 493 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
| 494 | 494 | return null; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 498 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 497 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 498 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /** |
@@ -552,9 +552,9 @@ discard block |
||
| 552 | 552 | $tables = array(); |
| 553 | 553 | |
| 554 | 554 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
| 555 | - $tables []= \GFFormsModel::get_entry_meta_table_name(); |
|
| 555 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
| 556 | 556 | } |
| 557 | - $tables []= \GFFormsModel::get_lead_meta_table_name(); |
|
| 557 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
| 558 | 558 | |
| 559 | 559 | foreach ( $tables as $meta_table ) { |
| 560 | 560 | $sql = " |
@@ -572,13 +572,13 @@ discard block |
||
| 572 | 572 | $tables = array(); |
| 573 | 573 | |
| 574 | 574 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
| 575 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 575 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 578 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 579 | 579 | |
| 580 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 581 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 580 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 581 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 582 | 582 | |
| 583 | 583 | $suppress = $wpdb->suppress_errors(); |
| 584 | 584 | foreach ( $tables as $notes_table ) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function __construct() { |
| 27 | 27 | $this->label = esc_html__( 'Other Entries', 'gravityview' ); |
| 28 | - $this->description = esc_html__('Display other entries created by the entry creator.', 'gravityview'); |
|
| 28 | + $this->description = esc_html__( 'Display other entries created by the entry creator.', 'gravityview' ); |
|
| 29 | 29 | parent::__construct(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -35,32 +35,32 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 37 | 37 | |
| 38 | - if( 'edit' === $context ) { |
|
| 38 | + if ( 'edit' === $context ) { |
|
| 39 | 39 | return $field_options; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // No "Link to single entry"; all the items will be links to entries! |
| 43 | - unset( $field_options['show_as_link'] ); |
|
| 43 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 44 | 44 | |
| 45 | 45 | $new_options = array(); |
| 46 | 46 | |
| 47 | - $new_options['link_format'] = array( |
|
| 47 | + $new_options[ 'link_format' ] = array( |
|
| 48 | 48 | 'type' => 'text', |
| 49 | 49 | 'label' => __( 'Entry link text (required)', 'gravityview' ), |
| 50 | - 'value' => __('Entry #{entry_id}', 'gravityview'), |
|
| 50 | + 'value' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
| 51 | 51 | 'merge_tags' => 'force', |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - $new_options['after_link'] = array( |
|
| 54 | + $new_options[ 'after_link' ] = array( |
|
| 55 | 55 | 'type' => 'textarea', |
| 56 | 56 | 'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ), |
| 57 | - 'desc' => __('This content will be displayed below each entry link.', 'gravityview'), |
|
| 57 | + 'desc' => __( 'This content will be displayed below each entry link.', 'gravityview' ), |
|
| 58 | 58 | 'value' => '', |
| 59 | 59 | 'merge_tags' => 'force', |
| 60 | 60 | 'class' => 'widefat code', |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - $new_options['page_size'] = array( |
|
| 63 | + $new_options[ 'page_size' ] = array( |
|
| 64 | 64 | 'type' => 'number', |
| 65 | 65 | 'label' => __( 'Entries to Display', 'gravityview' ), |
| 66 | 66 | 'desc' => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ), |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | 'merge_tags' => false, |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | - $new_options['no_entries_hide'] = array( |
|
| 71 | + $new_options[ 'no_entries_hide' ] = array( |
|
| 72 | 72 | 'type' => 'checkbox', |
| 73 | 73 | 'label' => __( 'Hide if no entries', 'gravityview' ), |
| 74 | 74 | 'desc' => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ), |
| 75 | 75 | 'value' => false, |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | - $new_options['no_entries_text'] = array( |
|
| 78 | + $new_options[ 'no_entries_text' ] = array( |
|
| 79 | 79 | 'type' => 'text', |
| 80 | 80 | 'label' => __( 'No Entries Text', 'gravityview' ), |
| 81 | 81 | 'desc' => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ), |
@@ -107,11 +107,11 @@ discard block |
||
| 107 | 107 | foreach ( $filters as $filter ) { |
| 108 | 108 | foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) { |
| 109 | 109 | foreach ( $callbacks as $id => $callback ) { |
| 110 | - if ( ! is_array( $callback['function'] ) ) { |
|
| 110 | + if ( ! is_array( $callback[ 'function' ] ) ) { |
|
| 111 | 111 | continue; |
| 112 | 112 | } |
| 113 | - if ( $callback['function'][0] instanceof \GV\Widget ) { |
|
| 114 | - $remove[] = array( $filter, $priority, $id ); |
|
| 113 | + if ( $callback[ 'function' ][ 0 ] instanceof \GV\Widget ) { |
|
| 114 | + $remove[ ] = array( $filter, $priority, $id ); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | foreach ( $remove as $r ) { |
| 121 | 121 | list( $filter, $priority, $id ) = $r; |
| 122 | - $removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] ); |
|
| 122 | + $removed[ ] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] ); |
|
| 123 | 123 | unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | public function filter_entries( $search_criteria, $form_id = null, $args = array(), $force_search_criteria = false ) { |
| 144 | 144 | $context = $this->context; |
| 145 | 145 | |
| 146 | - $created_by = $context->entry['created_by']; |
|
| 146 | + $created_by = $context->entry[ 'created_by' ]; |
|
| 147 | 147 | |
| 148 | 148 | /** Filter entries by approved and created_by. */ |
| 149 | - $search_criteria['field_filters'][] = array( |
|
| 149 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 150 | 150 | 'key' => 'created_by', |
| 151 | 151 | 'value' => $created_by, |
| 152 | 152 | 'operator' => 'is' |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | $criteria = apply_filters( 'gravityview/field/other_entries/criteria', $search_criteria, $context->view->settings->as_atts(), $context->view->form->ID, $context ); |
| 167 | 167 | |
| 168 | 168 | /** Force mode all and filter out our own entry. */ |
| 169 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
| 170 | - $search_criteria['field_filters'][] = array( |
|
| 169 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
| 170 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 171 | 171 | 'key' => 'id', |
| 172 | 172 | 'value' => $context->entry->ID, |
| 173 | 173 | 'operator' => 'isnot' |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | - $search_criteria['paging']['page_size'] = $context->field->page_size ? : 10; |
|
| 176 | + $search_criteria[ 'paging' ][ 'page_size' ] = $context->field->page_size ?: 10; |
|
| 177 | 177 | |
| 178 | 178 | return $search_criteria; |
| 179 | 179 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if ( 'address' === \GV\Utils::get( $search_field, 'type' ) ) { |
| 62 | 62 | |
| 63 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
| 64 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
| 63 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
| 64 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
| 65 | 65 | $form = GravityView_View::getInstance()->getForm(); |
| 66 | 66 | |
| 67 | 67 | /** @var GF_Field_Address $address_field */ |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $choices = array(); |
| 71 | 71 | |
| 72 | 72 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
| 73 | - if( method_exists( $this, $method_name ) ) { |
|
| 73 | + if ( method_exists( $this, $method_name ) ) { |
|
| 74 | 74 | /** |
| 75 | 75 | * @uses GravityView_Field_Address::get_choices_country() |
| 76 | 76 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | $choices = $this->{$method_name}( $address_field, $form ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if( ! empty( $choices ) ) { |
|
| 82 | - $search_field['choices'] = $choices; |
|
| 83 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
| 81 | + if ( ! empty( $choices ) ) { |
|
| 82 | + $search_field[ 'choices' ] = $choices; |
|
| 83 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
| 84 | 84 | } else { |
| 85 | - $search_field['type'] = 'text'; |
|
| 86 | - $search_field['input'] = 'input_text'; |
|
| 85 | + $search_field[ 'type' ] = 'text'; |
|
| 86 | + $search_field[ 'input' ] = 'input_text'; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $country_choices = array(); |
| 110 | 110 | |
| 111 | 111 | foreach ( $countries as $key => $country ) { |
| 112 | - $country_choices[] = array( |
|
| 112 | + $country_choices[ ] = array( |
|
| 113 | 113 | 'value' => $country, |
| 114 | 114 | 'text' => $country, |
| 115 | 115 | ); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | private function get_choices_state( $address_field, $form ) { |
| 136 | 136 | |
| 137 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
| 137 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
| 138 | 138 | |
| 139 | 139 | $state_choices = array(); |
| 140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $states = GFCommon::get_canadian_provinces(); |
| 147 | 147 | break; |
| 148 | 148 | default: |
| 149 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
| 150 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
| 149 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
| 150 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
| 151 | 151 | break; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,19 +156,19 @@ discard block |
||
| 156 | 156 | $state_subchoices = array(); |
| 157 | 157 | |
| 158 | 158 | foreach ( $state as $substate ) { |
| 159 | - $state_subchoices[] = array( |
|
| 159 | + $state_subchoices[ ] = array( |
|
| 160 | 160 | 'value' => $substate, |
| 161 | 161 | 'text' => $substate, |
| 162 | 162 | ); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $state_choices[] = array( |
|
| 165 | + $state_choices[ ] = array( |
|
| 166 | 166 | 'text' => $key, |
| 167 | 167 | 'value' => $state_subchoices, |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | 170 | } else { |
| 171 | - $state_choices[] = array( |
|
| 171 | + $state_choices[ ] = array( |
|
| 172 | 172 | 'value' => $state, |
| 173 | 173 | 'text' => $state, |
| 174 | 174 | ); |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | // Use the same inputs as the "text" input type allows |
| 193 | 193 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
| 194 | 194 | |
| 195 | - $input_types['street'] = $text_inputs; |
|
| 196 | - $input_types['street2'] = $text_inputs; |
|
| 197 | - $input_types['city'] = $text_inputs; |
|
| 195 | + $input_types[ 'street' ] = $text_inputs; |
|
| 196 | + $input_types[ 'street2' ] = $text_inputs; |
|
| 197 | + $input_types[ 'city' ] = $text_inputs; |
|
| 198 | 198 | |
| 199 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | - $input_types['zip'] = array( 'input_text' ); |
|
| 201 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 199 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 200 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
| 201 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
| 202 | 202 | |
| 203 | 203 | return $input_types; |
| 204 | 204 | } |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
| 220 | 220 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
| 221 | 221 | |
| 222 | - if( 'address' === $field_type && $input_id ) { |
|
| 222 | + if ( 'address' === $field_type && $input_id ) { |
|
| 223 | 223 | |
| 224 | 224 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
| 225 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 225 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
| 226 | 226 | $input_type = $address_field_name; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 272 | 272 | |
| 273 | 273 | // If this is NOT the full address field, return default options. |
| 274 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 274 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 275 | 275 | return $field_options; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if( 'edit' === $context ) { |
|
| 278 | + if ( 'edit' === $context ) { |
|
| 279 | 279 | return $field_options; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $add_options = array(); |
| 283 | 283 | |
| 284 | - $add_options['show_map_link'] = array( |
|
| 284 | + $add_options[ 'show_map_link' ] = array( |
|
| 285 | 285 | 'type' => 'checkbox', |
| 286 | 286 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 287 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 287 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 288 | 288 | 'value' => true, |
| 289 | 289 | 'merge_tags' => false, |
| 290 | 290 | ); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'total' => wp_count_posts( 'gravityview' )->publish, |
| 64 | 64 | ); |
| 65 | 65 | foreach ( $items as $item ) { |
| 66 | - $data['views'][] = $this->prepare_view_for_response( $item, $request ); |
|
| 66 | + $data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return new \WP_REST_Response( $data, 200 ); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $url = $request->get_url_params(); |
| 84 | 84 | |
| 85 | - $view_id = intval( $url['id'] ); |
|
| 85 | + $view_id = intval( $url[ 'id' ] ); |
|
| 86 | 86 | |
| 87 | 87 | $item = get_post( $view_id ); |
| 88 | 88 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // Only output the fields that should be displayed. |
| 115 | 115 | $allowed = array(); |
| 116 | 116 | foreach ( $view->fields->by_position( "{$context}_*" )->by_visible()->all() as $field ) { |
| 117 | - $allowed[] = $field; |
|
| 117 | + $allowed[ ] = $field; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | // Tack on additional fields if needed |
| 135 | 135 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
| 136 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
| 136 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $r = new Request( $request ); |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | public function get_sub_items( $request ) { |
| 202 | 202 | |
| 203 | 203 | $url = $request->get_url_params(); |
| 204 | - $view_id = intval( $url['id'] ); |
|
| 204 | + $view_id = intval( $url[ 'id' ] ); |
|
| 205 | 205 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
| 206 | 206 | |
| 207 | - if( $post_id = $request->get_param('post_id') ) { |
|
| 207 | + if ( $post_id = $request->get_param( 'post_id' ) ) { |
|
| 208 | 208 | global $post; |
| 209 | 209 | |
| 210 | 210 | $post = get_post( $post_id ); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | $data = array( 'entries' => $entries->all(), 'total' => $entries->total() ); |
| 304 | 304 | |
| 305 | - foreach ( $data['entries'] as &$entry ) { |
|
| 305 | + foreach ( $data[ 'entries' ] as &$entry ) { |
|
| 306 | 306 | $entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' ); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -321,8 +321,8 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function get_sub_item( $request ) { |
| 323 | 323 | $url = $request->get_url_params(); |
| 324 | - $view_id = intval( $url['id'] ); |
|
| 325 | - $entry_id = intval( $url['s_id'] ); |
|
| 324 | + $view_id = intval( $url[ 'id' ] ); |
|
| 325 | + $entry_id = intval( $url[ 's_id' ] ); |
|
| 326 | 326 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
| 327 | 327 | |
| 328 | 328 | $view = \GV\View::by_id( $view_id ); |
@@ -357,32 +357,32 @@ discard block |
||
| 357 | 357 | // Add all the WP_Post data |
| 358 | 358 | $view_post = $view_post->to_array(); |
| 359 | 359 | |
| 360 | - unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] ); |
|
| 360 | + unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] ); |
|
| 361 | 361 | |
| 362 | 362 | $return = wp_parse_args( $item, $view_post ); |
| 363 | 363 | |
| 364 | - $return['title'] = $return['post_title']; |
|
| 364 | + $return[ 'title' ] = $return[ 'post_title' ]; |
|
| 365 | 365 | |
| 366 | - $return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array(); |
|
| 367 | - unset( $return['atts'], $return['view_id'] ); |
|
| 366 | + $return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array(); |
|
| 367 | + unset( $return[ 'atts' ], $return[ 'view_id' ] ); |
|
| 368 | 368 | |
| 369 | - $return['search_criteria'] = array( |
|
| 369 | + $return[ 'search_criteria' ] = array( |
|
| 370 | 370 | 'page_size' => rgars( $return, 'settings/page_size' ), |
| 371 | 371 | 'sort_field' => rgars( $return, 'settings/sort_field' ), |
| 372 | 372 | 'sort_direction' => rgars( $return, 'settings/sort_direction' ), |
| 373 | 373 | 'offset' => rgars( $return, 'settings/offset' ), |
| 374 | 374 | ); |
| 375 | 375 | |
| 376 | - unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] ); |
|
| 376 | + unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] ); |
|
| 377 | 377 | |
| 378 | 378 | // Redact for non-logged ins |
| 379 | 379 | if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) { |
| 380 | - unset( $return['settings'] ); |
|
| 381 | - unset( $return['search_criteria'] ); |
|
| 380 | + unset( $return[ 'settings' ] ); |
|
| 381 | + unset( $return[ 'search_criteria' ] ); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) { |
| 385 | - unset( $return['form'] ); |
|
| 385 | + unset( $return[ 'form' ] ); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | return $return; |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $view_id = func_get_arg( 1 ); // $view_id override |
| 399 | 399 | } else { |
| 400 | 400 | $url = $request->get_url_params(); |
| 401 | - $view_id = intval( $url['id'] ); |
|
| 401 | + $view_id = intval( $url[ 'id' ] ); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | if ( ! $view = \GV\View::by_id( $view_id ) ) { |
@@ -444,8 +444,8 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | $url = $request->get_url_params(); |
| 447 | - $view_id = intval( $url['id'] ); |
|
| 448 | - $entry_id = intval( $url['s_id'] ); |
|
| 447 | + $view_id = intval( $url[ 'id' ] ); |
|
| 448 | + $entry_id = intval( $url[ 's_id' ] ); |
|
| 449 | 449 | |
| 450 | 450 | $view = \GV\View::by_id( $view_id ); |
| 451 | 451 | |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if ( $entry['form_id'] != $view->form->ID ) { |
|
| 456 | + if ( $entry[ 'form_id' ] != $view->form->ID ) { |
|
| 457 | 457 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if ( $entry['status'] != 'active' ) { |
|
| 460 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 461 | 461 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 462 | 462 | } |
| 463 | 463 | |
@@ -465,10 +465,10 @@ discard block |
||
| 465 | 465 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 468 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 469 | 469 | |
| 470 | 470 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 471 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 471 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 472 | 472 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 473 | 473 | } |
| 474 | 474 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @var string The hash key used to generate secure message history |
| 16 | - * @since 2.2.5 |
|
| 16 | + * @since 2.2.5 |
|
| 17 | 17 | */ |
| 18 | 18 | const beacon_key = 'lCXlwbQR707kipR+J0MCqcxrhGOHjGF0ldD6yNbGM0w='; |
| 19 | 19 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | 'payment_id' => '', |
| 111 | 111 | 'customer_name' => '', |
| 112 | 112 | 'customer_email' => '', |
| 113 | - 'price_id' => '0', |
|
| 113 | + 'price_id' => '0', |
|
| 114 | 114 | ) ); |
| 115 | 115 | |
| 116 | 116 | // This is just HTML we don't need. |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | case 3: |
| 128 | 128 | $package = 'All Access'; |
| 129 | 129 | break; |
| 130 | - case 4: |
|
| 131 | - $package = 'Lifetime'; |
|
| 132 | - break; |
|
| 130 | + case 4: |
|
| 131 | + $package = 'Lifetime'; |
|
| 132 | + break; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $current_user = wp_get_current_user(); |
@@ -159,27 +159,27 @@ discard block |
||
| 159 | 159 | // Help Scout length limit is 200 characters |
| 160 | 160 | foreach( $data as $key => $value ) { |
| 161 | 161 | if ( ! is_string( $value ) ) { |
| 162 | - continue; |
|
| 162 | + continue; |
|
| 163 | 163 | } |
| 164 | - $data[ $key ] = mb_substr( $value, 0, 200 ); |
|
| 165 | - } |
|
| 164 | + $data[ $key ] = mb_substr( $value, 0, 200 ); |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | 167 | $localization_data = array( |
| 168 | 168 | 'contactEnabled' => (int)GVCommon::has_cap( 'gravityview_contact_support' ), |
| 169 | 169 | 'data' => $data, |
| 170 | 170 | 'translation' => $translation, |
| 171 | - 'suggest' => array(), |
|
| 171 | + 'suggest' => array(), |
|
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | - * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run |
|
| 175 | + * @filter `gravityview/support_port/localization_data` Filter data passed to the Support Port, before localize_script is run |
|
| 176 | 176 | * @since 2.0 |
| 177 | - * @param array $localization_data { |
|
| 178 | - * @type int $contactEnabled Can the user contact support? |
|
| 179 | - * @type array $data Support/license info |
|
| 180 | - * @type array $translation i18n strings |
|
| 181 | - * @type array $suggest Article IDs to recommend to the user (per page in the admin |
|
| 182 | - * } |
|
| 177 | + * @param array $localization_data { |
|
| 178 | + * @type int $contactEnabled Can the user contact support? |
|
| 179 | + * @type array $data Support/license info |
|
| 180 | + * @type array $translation i18n strings |
|
| 181 | + * @type array $suggest Article IDs to recommend to the user (per page in the admin |
|
| 182 | + * } |
|
| 183 | 183 | */ |
| 184 | 184 | $localization_data = apply_filters( 'gravityview/support_port/localization_data', $localization_data ); |
| 185 | 185 | |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * If the user doesn't have the `gravityview_support_port` capability, returns false; then |
| 195 | 195 | * If global setting is "hide", returns false; then |
| 196 | - * If user preference is not set, return global setting; then |
|
| 197 | - * If user preference is set, return that setting. |
|
| 196 | + * If user preference is not set, return global setting; then |
|
| 197 | + * If user preference is set, return that setting. |
|
| 198 | 198 | * |
| 199 | 199 | * @since 1.15 |
| 200 | - * @since 1.17.5 Changed behavior to respect global setting |
|
| 200 | + * @since 1.17.5 Changed behavior to respect global setting |
|
| 201 | 201 | * |
| 202 | 202 | * @param int $user Optional. ID of the user to check, defaults to 0 for current user. |
| 203 | 203 | * |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $global_setting = gravityview()->plugin->settings->get( 'support_port' ); |
| 213 | 213 | |
| 214 | 214 | if ( empty( $global_setting ) ) { |
| 215 | - return false; |
|
| 215 | + return false; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // Get the per-user Support Port setting |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * Modifies the output of profile.php to add GravityView Support preference |
| 249 | 249 | * |
| 250 | 250 | * @since 1.15 |
| 251 | - * @since 1.17.5 Only show if global setting is active |
|
| 251 | + * @since 1.17.5 Only show if global setting is active |
|
| 252 | 252 | * |
| 253 | 253 | * @param WP_User $user Current user info |
| 254 | 254 | * |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $global_setting = gravityview()->plugin->settings->get( 'support_port' ); |
| 260 | 260 | |
| 261 | 261 | if ( empty( $global_setting ) ) { |
| 262 | - return; |
|
| 262 | + return; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | ) ); |
| 115 | 115 | |
| 116 | 116 | // This is just HTML we don't need. |
| 117 | - unset( $response['message'] ); |
|
| 117 | + unset( $response[ 'message' ] ); |
|
| 118 | 118 | |
| 119 | - switch ( intval( $response['price_id'] ) ) { |
|
| 119 | + switch ( intval( $response[ 'price_id' ] ) ) { |
|
| 120 | 120 | default: |
| 121 | 121 | case 1: |
| 122 | 122 | $package = 'Core'; |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | 'email' => $current_user->user_email, |
| 143 | 143 | 'name' => mb_substr( $current_user->display_name, 0, 80 ), |
| 144 | 144 | 'signature' => hash_hmac( 'sha256', $current_user->user_email, self::beacon_key ), |
| 145 | - 'License Key' => $response['license_key'] . ' (' . ucwords( $response['license'] ) . ')', |
|
| 145 | + 'License Key' => $response[ 'license_key' ] . ' (' . ucwords( $response[ 'license' ] ) . ')', |
|
| 146 | 146 | 'License Level' => $package, |
| 147 | 147 | 'Alt Emails' => sprintf( "Admin: %s, GV Support: %s", get_bloginfo( 'admin_email' ), gravityview()->plugin->settings->get( 'support-email' ) ), |
| 148 | - 'Payment Details' => $response['customer_name'] . ' ' . $response['customer_email'], |
|
| 148 | + 'Payment Details' => $response[ 'customer_name' ] . ' ' . $response[ 'customer_email' ], |
|
| 149 | 149 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
| 150 | - 'PHP Version' => phpversion() . ' on ' . esc_html( $_SERVER['SERVER_SOFTWARE'] ), |
|
| 150 | + 'PHP Version' => phpversion() . ' on ' . esc_html( $_SERVER[ 'SERVER_SOFTWARE' ] ), |
|
| 151 | 151 | 'No-Conflict Mode' => empty( $no_conflict_mode ) ? 'Disabled' : 'Enabled', |
| 152 | 152 | 'GravityView Version' => \GV\Plugin::$version, |
| 153 | 153 | 'Gravity Forms Version' => GFForms::$version, |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | ob_get_clean(); |
| 158 | 158 | |
| 159 | 159 | // Help Scout length limit is 200 characters |
| 160 | - foreach( $data as $key => $value ) { |
|
| 160 | + foreach ( $data as $key => $value ) { |
|
| 161 | 161 | if ( ! is_string( $value ) ) { |
| 162 | 162 | continue; |
| 163 | 163 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public static function get_instance() { |
| 96 | 96 | |
| 97 | - if( empty( self::$instance ) ) { |
|
| 97 | + if ( empty( self::$instance ) ) { |
|
| 98 | 98 | self::$instance = new self; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 130 | 130 | |
| 131 | - if( $with_values ) { |
|
| 131 | + if ( $with_values ) { |
|
| 132 | 132 | $operators_with_values = array(); |
| 133 | - foreach( $operators as $key ) { |
|
| 133 | + foreach ( $operators as $key ) { |
|
| 134 | 134 | $operators_with_values[ $key ] = ''; |
| 135 | 135 | } |
| 136 | 136 | return $operators_with_values; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $operators = $this->get_operators( false ); |
| 151 | 151 | |
| 152 | - if( !in_array( $operation, $operators ) ) { |
|
| 152 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 153 | 153 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
| 154 | 154 | return false; |
| 155 | 155 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | return null; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if( empty( $atts ) ) { |
|
| 204 | + if ( empty( $atts ) ) { |
|
| 205 | 205 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
| 206 | 206 | return null; |
| 207 | 207 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $setup = $this->setup_operation_and_comparison(); |
| 225 | 225 | |
| 226 | 226 | // We need an operation and comparison value |
| 227 | - if( ! $setup ) { |
|
| 227 | + if ( ! $setup ) { |
|
| 228 | 228 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
| 229 | 229 | return null; |
| 230 | 230 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | private function get_output() { |
| 281 | 281 | |
| 282 | - if( $this->is_match ) { |
|
| 282 | + if ( $this->is_match ) { |
|
| 283 | 283 | $output = $this->content; |
| 284 | 284 | } else { |
| 285 | 285 | $output = $this->else_content; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param string $output HTML/text output |
| 298 | 298 | * @param GVLogic_Shortcode $this This class |
| 299 | 299 | */ |
| 300 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 300 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 301 | 301 | |
| 302 | 302 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
| 303 | 303 | |
@@ -317,14 +317,14 @@ discard block |
||
| 317 | 317 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
| 318 | 318 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
| 319 | 319 | |
| 320 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 320 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 321 | 321 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
| 322 | 322 | |
| 323 | 323 | // The content is everything OTHER than the [else] |
| 324 | 324 | $this->content = $before_else_if; |
| 325 | 325 | |
| 326 | 326 | if ( ! $this->is_match ) { |
| 327 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 327 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 328 | 328 | $this->else_content = $elseif_content; |
| 329 | 329 | } else { |
| 330 | 330 | $this->else_content = $else_content; |
@@ -352,16 +352,16 @@ discard block |
||
| 352 | 352 | foreach ( $else_if_matches as $key => $else_if_match ) { |
| 353 | 353 | |
| 354 | 354 | // If $else_if_match[5] exists and has content, check for more shortcodes |
| 355 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 355 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 356 | 356 | |
| 357 | 357 | // If the logic passes, this is the value that should be used for $this->else_content |
| 358 | - $else_if_value = $else_if_match[5]; |
|
| 359 | - $check_elseif_match = $else_if_match[0]; |
|
| 358 | + $else_if_value = $else_if_match[ 5 ]; |
|
| 359 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
| 360 | 360 | |
| 361 | 361 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
| 362 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
| 363 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
| 364 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
| 362 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
| 363 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
| 364 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // Process any remaining [else] tags |
| 381 | - return $this->process_elseif( $else_if_match[5] ); |
|
| 381 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | return false; |
@@ -405,11 +405,11 @@ discard block |
||
| 405 | 405 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
| 406 | 406 | |
| 407 | 407 | // Strip whitespace if it's not default false |
| 408 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
| 408 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 409 | 409 | |
| 410 | - if ( isset( $this->atts['logged_in'] ) ) { |
|
| 410 | + if ( isset( $this->atts[ 'logged_in' ] ) ) { |
|
| 411 | 411 | // Truthy |
| 412 | - if ( in_array( strtolower( $this->atts['logged_in'] ), array( '1', 'true', 'yes' ) ) ) { |
|
| 412 | + if ( in_array( strtolower( $this->atts[ 'logged_in' ] ), array( '1', 'true', 'yes' ) ) ) { |
|
| 413 | 413 | $this->logged_in = true; |
| 414 | 414 | } else { |
| 415 | 415 | $this->logged_in = false; |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
| 426 | 426 | |
| 427 | 427 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 428 | - unset( $this->atts['if'] ); |
|
| 428 | + unset( $this->atts[ 'if' ] ); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |