@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $tables = array(); |
43 | 43 | |
44 | 44 | if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
45 | - $tables []= GFFormsModel::get_entry_meta_table_name(); |
|
45 | + $tables [ ] = GFFormsModel::get_entry_meta_table_name(); |
|
46 | 46 | } |
47 | - $tables []= GFFormsModel::get_lead_meta_table_name(); |
|
47 | + $tables [ ] = GFFormsModel::get_lead_meta_table_name(); |
|
48 | 48 | |
49 | 49 | $suppress = $wpdb->suppress_errors(); |
50 | 50 | foreach ( $tables as $meta_table ) { |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | $tables = array(); |
71 | 71 | |
72 | 72 | if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
73 | - $tables []= GFFormsModel::get_entry_notes_table_name(); |
|
73 | + $tables [ ] = GFFormsModel::get_entry_notes_table_name(); |
|
74 | 74 | } |
75 | - $tables []= GFFormsModel::get_lead_notes_table_name(); |
|
75 | + $tables [ ] = GFFormsModel::get_lead_notes_table_name(); |
|
76 | 76 | |
77 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
78 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
77 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
78 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
79 | 79 | |
80 | 80 | $suppress = $wpdb->suppress_errors(); |
81 | 81 | foreach ( $tables as $notes_table ) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $self = new self(); |
56 | 56 | $self->form = $form; |
57 | 57 | |
58 | - $self->ID = $self->form['id']; |
|
58 | + $self->ID = $self->form[ 'id' ]; |
|
59 | 59 | |
60 | 60 | return $self; |
61 | 61 | } |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | |
99 | 99 | /** The offset and limit */ |
100 | 100 | if ( ! empty( $offset->limit ) ) { |
101 | - $paging['page_size'] = $offset->limit; |
|
101 | + $paging[ 'page_size' ] = $offset->limit; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if ( ! empty( $offset->offset ) ) { |
105 | - $paging['offset'] = $offset->offset; |
|
105 | + $paging[ 'offset' ] = $offset->offset; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return bool Whether the offset exists or not. |
139 | 139 | */ |
140 | 140 | public function offsetExists( $offset ) { |
141 | - return isset( $this->form[$offset] ); |
|
141 | + return isset( $this->form[ $offset ] ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return mixed The value of the requested form data. |
154 | 154 | */ |
155 | 155 | public function offsetGet( $offset ) { |
156 | - return $this->form[$offset]; |
|
156 | + return $this->form[ $offset ]; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' ); |
11 | 11 | |
12 | 12 | //current value |
13 | -$current_form = (int) rgar( (array) $_GET, 'form_id', gravityview_get_form_id( $post->ID ) ); |
|
13 | +$current_form = (int)rgar( (array)$_GET, 'form_id', gravityview_get_form_id( $post->ID ) ); |
|
14 | 14 | |
15 | 15 | // check for available gravity forms |
16 | -$forms = gravityview_get_forms('any'); |
|
16 | +$forms = gravityview_get_forms( 'any' ); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param int $current_form Form currently selected in the View (0 if none selected) |
@@ -32,24 +32,24 @@ discard block |
||
32 | 32 | ?> |
33 | 33 | <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Use a Form Preset', 'gravityview' ); ?>"><?php esc_html_e( 'Use a Form Preset', 'gravityview' ); ?></a> |
34 | 34 | |
35 | - <?php if( !empty( $forms ) ) { ?> |
|
35 | + <?php if ( ! empty( $forms ) ) { ?> |
|
36 | 36 | <span> <?php esc_html_e( 'or use an existing form', 'gravityview' ); ?> </span> |
37 | 37 | <?php } |
38 | 38 | } |
39 | 39 | |
40 | 40 | // If there are no forms to select, show no forms. |
41 | - if( !empty( $forms ) ) { ?> |
|
41 | + if ( ! empty( $forms ) ) { ?> |
|
42 | 42 | <select name="gravityview_form_id" id="gravityview_form_id"> |
43 | 43 | <option value="" <?php selected( '', $current_form, true ); ?>>— <?php esc_html_e( 'list of forms', 'gravityview' ); ?> —</option> |
44 | - <?php foreach( $forms as $form ) { ?> |
|
45 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
44 | + <?php foreach ( $forms as $form ) { ?> |
|
45 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
46 | 46 | <?php } ?> |
47 | 47 | </select> |
48 | 48 | <?php } else { ?> |
49 | 49 | <select name="gravityview_form_id" id="gravityview_form_id" class="hidden"><option selected="selected" value=""></option></select> |
50 | 50 | <?php } ?> |
51 | 51 | |
52 | - <a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
52 | + <a class="button button-primary" <?php if ( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
53 | 53 | </p> |
54 | 54 | |
55 | 55 | <?php // confirm dialog box ?> |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | add_action( 'init', array( $this, 'register_handler' ) ); |
36 | 36 | add_action( 'init', array( $this, 'add_provider' ) ); |
37 | 37 | |
38 | - if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) { |
|
38 | + if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) { |
|
39 | 39 | add_action( 'template_redirect', array( $this, 'render_provider_request' ) ); |
40 | 40 | } |
41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | static function getInstance() { |
48 | 48 | |
49 | - if( empty( self::$instance ) ) { |
|
49 | + if ( empty( self::$instance ) ) { |
|
50 | 50 | self::$instance = new self; |
51 | 51 | |
52 | 52 | self::$instance->initialize(); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @return void |
91 | 91 | */ |
92 | 92 | function render_provider_request() { |
93 | - if ( ! empty( $_GET['url'] ) ) { |
|
94 | - $url = $_GET['url']; |
|
93 | + if ( ! empty( $_GET[ 'url' ] ) ) { |
|
94 | + $url = $_GET[ 'url' ]; |
|
95 | 95 | } else { |
96 | 96 | header( 'HTTP/1.0 404 Not Found' ); |
97 | 97 | exit; |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | preg_match( $this->get_handler_regex(), $url, $matches ); |
101 | 101 | |
102 | 102 | // If not using permalinks, re-assign values for matching groups |
103 | - if ( ! empty( $matches['entry_slug2'] ) ) { |
|
104 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
105 | - $matches['slug'] = $matches['slug2']; |
|
106 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
107 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
103 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
104 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
105 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
106 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
107 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // No Entry was found |
111 | - if ( empty( $matches['entry_slug'] ) ) { |
|
112 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
111 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
112 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
113 | 113 | header( 'HTTP/1.0 404 Not Found' ); |
114 | 114 | exit; |
115 | 115 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // Catch either |
163 | 163 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
164 | 164 | |
165 | - return '#'.$match_regex.'#i'; |
|
165 | + return '#' . $match_regex . '#i'; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | |
184 | 184 | $page_on_front = get_option( 'page_on_front' ); |
185 | 185 | |
186 | - if( (int) $post_id === (int) $page_on_front || empty( $post_id ) ) { |
|
186 | + if ( (int)$post_id === (int)$page_on_front || empty( $post_id ) ) { |
|
187 | 187 | |
188 | 188 | $args = array( |
189 | 189 | 'post_status' => 'publish', |
190 | 190 | 'name' => $slug, |
191 | - 'post_type' => array('any', 'gravityview'), |
|
191 | + 'post_type' => array( 'any', 'gravityview' ), |
|
192 | 192 | ); |
193 | 193 | |
194 | 194 | $posts = get_posts( $args ); |
195 | 195 | |
196 | - if( !empty( $posts ) ) { |
|
197 | - $post_id = $posts[0]->ID; |
|
196 | + if ( ! empty( $posts ) ) { |
|
197 | + $post_id = $posts[ 0 ]->ID; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | public function render_handler( $matches, $attr, $url, $rawattr ) { |
228 | 228 | |
229 | 229 | // If not using permalinks, re-assign values for matching groups |
230 | - if( !empty( $matches['entry_slug2'] ) ) { |
|
231 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
232 | - $matches['slug'] = $matches['slug2']; |
|
233 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
234 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
230 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
231 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
232 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
233 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
234 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // No Entry was found |
238 | - if( empty( $matches['entry_slug'] ) ) { |
|
238 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
239 | 239 | |
240 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
240 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
241 | 241 | |
242 | 242 | return ''; |
243 | 243 | } |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | // Setup the data used |
248 | 248 | $this->set_vars( $matches, $attr, $url, $rawattr ); |
249 | 249 | |
250 | - if( is_admin() && !$this->is_full_oembed_preview ) { |
|
250 | + if ( is_admin() && ! $this->is_full_oembed_preview ) { |
|
251 | 251 | $return = $this->render_admin( $matches, $attr, $url, $rawattr ); |
252 | 252 | } else { |
253 | 253 | |
254 | - if( $this->is_full_oembed_preview ) { |
|
254 | + if ( $this->is_full_oembed_preview ) { |
|
255 | 255 | $return .= $this->generate_preview_notice(); |
256 | 256 | } |
257 | 257 | |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | private function generate_preview_notice() { |
271 | 271 | $floaty = GravityView_Admin::get_floaty(); |
272 | 272 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
273 | - $message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
274 | - return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
273 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
274 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -284,14 +284,14 @@ discard block |
||
284 | 284 | */ |
285 | 285 | private function set_vars( $matches, $attr, $url, $rawattr ) { |
286 | 286 | |
287 | - $this->entry_id = $matches['entry_slug']; |
|
287 | + $this->entry_id = $matches[ 'entry_slug' ]; |
|
288 | 288 | |
289 | - $post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] ); |
|
289 | + $post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] ); |
|
290 | 290 | |
291 | 291 | // The URL didn't have the View Custom Post Type structure. |
292 | - if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) { |
|
292 | + if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) { |
|
293 | 293 | |
294 | - do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
294 | + do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
295 | 295 | |
296 | 296 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && $post = get_post( $post_id ) ) { |
297 | 297 | $views = \GV\View_Collection::from_post( $post ); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | - $this->view_id = $views[0]->ID; |
|
307 | + $this->view_id = $views[ 0 ]->ID; |
|
308 | 308 | } |
309 | 309 | } else { |
310 | 310 | /** Deprecated. */ |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | // The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that. |
321 | - $this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) ); |
|
321 | + $this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -336,15 +336,15 @@ discard block |
||
336 | 336 | // Floaty the astronaut |
337 | 337 | $image = GravityView_Admin::get_floaty(); |
338 | 338 | |
339 | - $embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id ); |
|
339 | + $embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id ); |
|
340 | 340 | |
341 | - $embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id ); |
|
341 | + $embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id ); |
|
342 | 342 | |
343 | 343 | return ' |
344 | 344 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
345 | - <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
345 | + <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
346 | 346 | <p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;"> |
347 | - '.$embed_text.' |
|
347 | + '.$embed_text . ' |
|
348 | 348 | </p> |
349 | 349 | <br style="clear: both;"> |
350 | 350 | </div>'; |
@@ -399,14 +399,14 @@ discard block |
||
399 | 399 | private function render_frontend( $matches, $attr, $url, $rawattr ) { |
400 | 400 | |
401 | 401 | // If it's already been parsed, don't re-output it. |
402 | - if( !empty( $this->output[ $this->entry_id ] ) ) { |
|
402 | + if ( ! empty( $this->output[ $this->entry_id ] ) ) { |
|
403 | 403 | return $this->output[ $this->entry_id ]; |
404 | 404 | } |
405 | 405 | |
406 | 406 | $entry_output = $this->generate_entry_output(); |
407 | 407 | |
408 | 408 | // Wrap a container div around the output to allow for custom styling |
409 | - $output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output ); |
|
409 | + $output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output ); |
|
410 | 410 | |
411 | 411 | /** |
412 | 412 | * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @var string $url The original URL that was matched by the regex. \n |
420 | 420 | * @var array $rawattr The original unmodified attributes. |
421 | 421 | */ |
422 | - $output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
422 | + $output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
423 | 423 | |
424 | 424 | unset( $entry_output ); |
425 | 425 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public static function get_instance() { |
87 | 87 | |
88 | - if( empty( self::$instance ) ) { |
|
88 | + if ( empty( self::$instance ) ) { |
|
89 | 89 | self::$instance = new self; |
90 | 90 | } |
91 | 91 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
121 | 121 | |
122 | - if( $with_values ) { |
|
122 | + if ( $with_values ) { |
|
123 | 123 | $operators_with_values = array(); |
124 | - foreach( $operators as $key ) { |
|
124 | + foreach ( $operators as $key ) { |
|
125 | 125 | $operators_with_values[ $key ] = ''; |
126 | 126 | } |
127 | 127 | return $operators_with_values; |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | */ |
139 | 139 | private function set_operation( $operation = '' ) { |
140 | 140 | |
141 | - if( empty( $operation ) ) { |
|
141 | + if ( empty( $operation ) ) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | |
145 | 145 | $operators = $this->get_operators( false ); |
146 | 146 | |
147 | - if( !in_array( $operation, $operators ) ) { |
|
148 | - do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation ); |
|
147 | + if ( ! in_array( $operation, $operators ) ) { |
|
148 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation ); |
|
149 | 149 | return false; |
150 | 150 | } |
151 | 151 | |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | */ |
166 | 166 | private function setup_operation_and_comparison() { |
167 | 167 | |
168 | - foreach( $this->atts as $key => $value ) { |
|
168 | + foreach ( $this->atts as $key => $value ) { |
|
169 | 169 | |
170 | 170 | $valid = $this->set_operation( $key ); |
171 | 171 | |
172 | - if( $valid ) { |
|
172 | + if ( $valid ) { |
|
173 | 173 | $this->comparison = $value; |
174 | 174 | return true; |
175 | 175 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | return null; |
196 | 196 | } |
197 | 197 | |
198 | - if( empty( $atts ) ) { |
|
199 | - do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts ); |
|
198 | + if ( empty( $atts ) ) { |
|
199 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts ); |
|
200 | 200 | return null; |
201 | 201 | } |
202 | 202 | |
@@ -210,16 +210,16 @@ discard block |
||
210 | 210 | $this->parse_atts(); |
211 | 211 | |
212 | 212 | // We need an "if" |
213 | - if( false === $this->if ) { |
|
214 | - do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts ); |
|
213 | + if ( false === $this->if ) { |
|
214 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts ); |
|
215 | 215 | return null; |
216 | 216 | } |
217 | 217 | |
218 | 218 | $setup = $this->setup_operation_and_comparison(); |
219 | 219 | |
220 | 220 | // We need an operation and comparison value |
221 | - if( ! $setup ) { |
|
222 | - do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts ); |
|
221 | + if ( ! $setup ) { |
|
222 | + do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts ); |
|
223 | 223 | return null; |
224 | 224 | } |
225 | 225 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | private function get_output() { |
254 | 254 | |
255 | - if( $this->is_match ) { |
|
255 | + if ( $this->is_match ) { |
|
256 | 256 | $output = $this->content; |
257 | 257 | } else { |
258 | 258 | $output = $this->else_content; |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | * @param string $output HTML/text output |
267 | 267 | * @param GVLogic_Shortcode $this This class |
268 | 268 | */ |
269 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
269 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
270 | 270 | |
271 | - do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output ); |
|
271 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output ); |
|
272 | 272 | |
273 | 273 | return $output; |
274 | 274 | } |
@@ -286,14 +286,14 @@ discard block |
||
286 | 286 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
287 | 287 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
288 | 288 | |
289 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
289 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
290 | 290 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
291 | 291 | |
292 | 292 | // The content is everything OTHER than the [else] |
293 | 293 | $this->content = $before_else_if; |
294 | 294 | |
295 | 295 | if ( ! $this->is_match ) { |
296 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
296 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
297 | 297 | $this->else_content = $elseif_content; |
298 | 298 | } else { |
299 | 299 | $this->else_content = $else_content; |
@@ -321,16 +321,16 @@ discard block |
||
321 | 321 | foreach ( $else_if_matches as $key => $else_if_match ) { |
322 | 322 | |
323 | 323 | // If $else_if_match[5] exists and has content, check for more shortcodes |
324 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
324 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
325 | 325 | |
326 | 326 | // If the logic passes, this is the value that should be used for $this->else_content |
327 | - $else_if_value = $else_if_match[5]; |
|
328 | - $check_elseif_match = $else_if_match[0]; |
|
327 | + $else_if_value = $else_if_match[ 5 ]; |
|
328 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
329 | 329 | |
330 | 330 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
331 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
332 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
333 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
331 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
332 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
333 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | } |
348 | 348 | |
349 | 349 | // Process any remaining [else] tags |
350 | - return $this->process_elseif( $else_if_match[5] ); |
|
350 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return false; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts; |
374 | 374 | |
375 | 375 | // Strip whitespace if it's not default false |
376 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
376 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
377 | 377 | |
378 | 378 | /** |
379 | 379 | * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
385 | 385 | |
386 | 386 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
387 | - unset( $this->atts['if'] ); |
|
387 | + unset( $this->atts[ 'if' ] ); |
|
388 | 388 | } |
389 | 389 | } |
390 | 390 |