@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | $value = $this->get_value( $atts ); |
| 62 | 62 | |
| 63 | 63 | if ( false === $operator && is_null( $value ) ) { |
| 64 | - if ( false !== $atts['if'] ) { // Only-if test |
|
| 65 | - $match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) ); |
|
| 64 | + if ( false !== $atts[ 'if' ] ) { // Only-if test |
|
| 65 | + $match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) ); |
|
| 66 | 66 | } else { |
| 67 | 67 | $match = $authed; // Just login test |
| 68 | 68 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // Need to match all AND |
| 83 | 83 | foreach ( $and_values as $and_value ) { |
| 84 | - $match = $authed && \GVCommon::matches_operation( $atts['if'], $and_value, $operator ); |
|
| 84 | + $match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $and_value, $operator ); |
|
| 85 | 85 | if ( ! $match ) { |
| 86 | 86 | break; |
| 87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // Only need to match a single OR |
| 93 | 93 | foreach ( $or_values as $or_value ) { |
| 94 | 94 | |
| 95 | - $match = \GVCommon::matches_operation( $atts['if'], $or_value, $operator ); |
|
| 95 | + $match = \GVCommon::matches_operation( $atts[ 'if' ], $or_value, $operator ); |
|
| 96 | 96 | |
| 97 | 97 | // Negate the negative operators |
| 98 | 98 | if ( ( $authed && $match ) || ( $authed && ( ! $match && in_array( $operator, array( 'isnot', 'not_contains', 'not_in' ) ) ) ) ) { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | } else { |
| 104 | - $match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator ); |
|
| 104 | + $match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator ); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $output = $this->get_output( $match, $atts, $output ); |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | * @return string The output. |
| 190 | 190 | */ |
| 191 | 191 | private function get_output( $match, $atts, $content ) { |
| 192 | - if ( ! $match && ! empty( $atts['else'] ) ) { |
|
| 193 | - return $atts['else']; // Attributized else is easy :) |
|
| 192 | + if ( ! $match && ! empty( $atts[ 'else' ] ) ) { |
|
| 193 | + return $atts[ 'else' ]; // Attributized else is easy :) |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | $if = ''; |
@@ -317,18 +317,18 @@ discard block |
||
| 317 | 317 | $atts = array_intersect_key( $supplied_atts, $atts ); |
| 318 | 318 | |
| 319 | 319 | // Strip whitespace if it's not default false |
| 320 | - if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) { |
|
| 321 | - $atts['if'] = trim( $atts['if'] ); |
|
| 320 | + if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) { |
|
| 321 | + $atts[ 'if' ] = trim( $atts[ 'if' ] ); |
|
| 322 | 322 | } else { |
| 323 | - $atts['if'] = false; |
|
| 323 | + $atts[ 'if' ] = false; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if ( isset( $atts['logged_in'] ) ) { |
|
| 326 | + if ( isset( $atts[ 'logged_in' ] ) ) { |
|
| 327 | 327 | // Truthy |
| 328 | - if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
| 329 | - $atts['logged_in'] = false; |
|
| 328 | + if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
| 329 | + $atts[ 'logged_in' ] = false; |
|
| 330 | 330 | } else { |
| 331 | - $atts['logged_in'] = true; |
|
| 331 | + $atts[ 'logged_in' ] = true; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |