@@ -17,7 +17,7 @@ |
||
| 17 | 17 | return self::$instance; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function shortcode( $atts, $content = '', $tag = '') { |
|
| 20 | + public function shortcode( $atts, $content = '', $tag = '' ) { |
|
| 21 | 21 | $shortcode = new \GV\Shortcodes\gvlogic(); |
| 22 | 22 | return $shortcode->callback( $atts, $content, $tag ); |
| 23 | 23 | } |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | $value = $this->get_value( $atts ); |
| 58 | 58 | |
| 59 | 59 | if ( false === $operator && is_null( $value ) ) { |
| 60 | - if ( false !== $atts['if'] ) { // Only-if test |
|
| 61 | - $match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) ); |
|
| 60 | + if ( false !== $atts[ 'if' ] ) { // Only-if test |
|
| 61 | + $match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) ); |
|
| 62 | 62 | } else { |
| 63 | 63 | $match = $authed; // Just login test |
| 64 | 64 | } |
| 65 | 65 | } else { // Regular test |
| 66 | - $match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator ); |
|
| 66 | + $match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Output and get recursive! |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @return bool Yes, or no. |
| 82 | 82 | */ |
| 83 | 83 | private function authorized( $atts ) { |
| 84 | - if ( is_null( $needs_login = \GV\Utils::get( $atts, 'logged_in', null ) ) ) { |
|
| 84 | + if ( is_null( $needs_login = \GV\Utils::get( $atts, 'logged_in', null ) ) ) { |
|
| 85 | 85 | return true; // No auth requirements have been set |
| 86 | 86 | } |
| 87 | 87 | return ! $needs_login ^ is_user_logged_in(); // XNOR |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @return string The output. |
| 144 | 144 | */ |
| 145 | 145 | private function get_output( $match, $atts, $content ) { |
| 146 | - if ( ! $match && ! empty( $atts['else'] ) ) { |
|
| 147 | - return $atts['else']; // Attributized else is easy :) |
|
| 146 | + if ( ! $match && ! empty( $atts[ 'else' ] ) ) { |
|
| 147 | + return $atts[ 'else' ]; // Attributized else is easy :) |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $if = ''; |
@@ -267,18 +267,18 @@ discard block |
||
| 267 | 267 | $atts = array_intersect_key( $supplied_atts, $atts ); |
| 268 | 268 | |
| 269 | 269 | // Strip whitespace if it's not default false |
| 270 | - if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) { |
|
| 271 | - $atts['if'] = trim( $atts['if'] ); |
|
| 270 | + if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) { |
|
| 271 | + $atts[ 'if' ] = trim( $atts[ 'if' ] ); |
|
| 272 | 272 | } else { |
| 273 | - $atts['if'] = false; |
|
| 273 | + $atts[ 'if' ] = false; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if ( isset( $atts['logged_in'] ) ) { |
|
| 276 | + if ( isset( $atts[ 'logged_in' ] ) ) { |
|
| 277 | 277 | // Truthy |
| 278 | - if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
| 279 | - $atts['logged_in'] = false; |
|
| 278 | + if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
| 279 | + $atts[ 'logged_in' ] = false; |
|
| 280 | 280 | } else { |
| 281 | - $atts['logged_in'] = true; |
|
| 281 | + $atts[ 'logged_in' ] = true; |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |