@@ -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 | |