@@ -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 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $setup = $this->setup_operation_and_comparison(); |
| 226 | 226 | |
| 227 | 227 | // We need an operation and comparison value |
| 228 | - if( ! $setup ) { |
|
| 228 | + if ( ! $setup ) { |
|
| 229 | 229 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
| 230 | 230 | return null; |
| 231 | 231 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $logged_in_match = ! $this->logged_in ^ is_user_logged_in(); // XNOR |
| 278 | 278 | |
| 279 | 279 | // Only logged-in match |
| 280 | - if( 1 === sizeof( $this->passed_atts ) ) { |
|
| 280 | + if ( 1 === sizeof( $this->passed_atts ) ) { |
|
| 281 | 281 | $this->is_match = $logged_in_match; |
| 282 | 282 | } else { |
| 283 | 283 | $this->is_match = $logged_in_match && $comparison_match; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | private function get_output() { |
| 293 | 293 | |
| 294 | - if( $this->is_match ) { |
|
| 294 | + if ( $this->is_match ) { |
|
| 295 | 295 | $output = $this->content; |
| 296 | 296 | } else { |
| 297 | 297 | $output = $this->else_content; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param string $output HTML/text output |
| 310 | 310 | * @param GVLogic_Shortcode $this This class |
| 311 | 311 | */ |
| 312 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 312 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 313 | 313 | |
| 314 | 314 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
| 315 | 315 | |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content, 2 ), 2, NULL ); |
| 330 | 330 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content, 2 ), 2, NULL ); |
| 331 | 331 | |
| 332 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 332 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 333 | 333 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
| 334 | 334 | |
| 335 | 335 | // The content is everything OTHER than the [else] |
| 336 | 336 | $this->content = $before_else_if; |
| 337 | 337 | |
| 338 | 338 | if ( ! $this->is_match ) { |
| 339 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 339 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 340 | 340 | $this->else_content = $elseif_content; |
| 341 | 341 | } else { |
| 342 | 342 | $this->else_content = $else_content; |
@@ -364,16 +364,16 @@ discard block |
||
| 364 | 364 | foreach ( $else_if_matches as $key => $else_if_match ) { |
| 365 | 365 | |
| 366 | 366 | // If $else_if_match[5] exists and has content, check for more shortcodes |
| 367 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 367 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 368 | 368 | |
| 369 | 369 | // If the logic passes, this is the value that should be used for $this->else_content |
| 370 | - $else_if_value = $else_if_match[5]; |
|
| 371 | - $check_elseif_match = $else_if_match[0]; |
|
| 370 | + $else_if_value = $else_if_match[ 5 ]; |
|
| 371 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
| 372 | 372 | |
| 373 | 373 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
| 374 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
| 375 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
| 376 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
| 374 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
| 375 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
| 376 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | // Process any remaining [else] tags |
| 393 | - return $this->process_elseif( $else_if_match[5] ); |
|
| 393 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | return false; |
@@ -417,11 +417,11 @@ discard block |
||
| 417 | 417 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
| 418 | 418 | |
| 419 | 419 | // Strip whitespace if it's not default false |
| 420 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
| 420 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 421 | 421 | |
| 422 | - if ( isset( $this->atts['logged_in'] ) ) { |
|
| 422 | + if ( isset( $this->atts[ 'logged_in' ] ) ) { |
|
| 423 | 423 | // Truthy |
| 424 | - if ( in_array( strtolower( $this->atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
| 424 | + if ( in_array( strtolower( $this->atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
| 425 | 425 | $this->logged_in = false; |
| 426 | 426 | } else { |
| 427 | 427 | $this->logged_in = true; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
| 438 | 438 | |
| 439 | 439 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 440 | - unset( $this->atts['if'] ); |
|
| 440 | + unset( $this->atts[ 'if' ] ); |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |