@@ -5,7 +5,7 @@ |
||
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ |
| 8 | -if ( version_compare( phpversion(), '5.3' , '<' ) ) { |
|
| 8 | +if ( version_compare( phpversion(), '5.3', '<' ) ) { |
|
| 9 | 9 | return false; |
| 10 | 10 | |
| 11 | 11 | /** Tests with a suppressed future. */ |
@@ -50,7 +50,6 @@ |
||
| 50 | 50 | * Register this shortcode class with the WordPress Shortcode API. |
| 51 | 51 | * |
| 52 | 52 | * @internal |
| 53 | - |
|
| 54 | 53 | * @return \GV\Shortcode|null The only internally registered instance of this shortcode, or null on error. |
| 55 | 54 | */ |
| 56 | 55 | public static function add() { |
@@ -56,16 +56,16 @@ discard block |
||
| 56 | 56 | public static function add() { |
| 57 | 57 | $shortcode = new static(); |
| 58 | 58 | if ( shortcode_exists( $shortcode->name ) ) { |
| 59 | - if ( empty( self::$shortcodes[$shortcode->name] ) ) { |
|
| 59 | + if ( empty( self::$shortcodes[ $shortcode->name ] ) ) { |
|
| 60 | 60 | gravityview()->log->error( 'Shortcode [{shortcode}] has already been registered elsewhere.', array( 'shortcode' => $shortcode->name ) ); |
| 61 | 61 | return null; |
| 62 | 62 | } |
| 63 | 63 | } else { |
| 64 | 64 | add_shortcode( $shortcode->name, array( get_class( $shortcode ), 'callback' ) ); |
| 65 | - self::$shortcodes[$shortcode->name] = $shortcode; |
|
| 65 | + self::$shortcodes[ $shortcode->name ] = $shortcode; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return self::$shortcodes[$shortcode->name]; |
|
| 68 | + return self::$shortcodes[ $shortcode->name ]; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function remove() { |
| 79 | 79 | $shortcode = new static(); |
| 80 | - unset( self::$shortcodes[$shortcode->name] ); |
|
| 80 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
| 81 | 81 | remove_shortcode( $shortcode->name ); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
| 110 | 110 | |
| 111 | 111 | foreach ( $matches as $shortcode ) { |
| 112 | - $shortcode_name = $shortcode[2]; |
|
| 112 | + $shortcode_name = $shortcode[ 2 ]; |
|
| 113 | 113 | |
| 114 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
| 115 | - $shortcode_content = $shortcode[5]; |
|
| 114 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
| 115 | + $shortcode_content = $shortcode[ 5 ]; |
|
| 116 | 116 | |
| 117 | 117 | /** This is a registered GravityView shortcode. */ |
| 118 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
| 119 | - $shortcode = clone self::$shortcodes[$shortcode_name]; |
|
| 118 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
| 119 | + $shortcode = clone self::$shortcodes[ $shortcode_name ]; |
|
| 120 | 120 | } else { |
| 121 | 121 | /** This is some generic shortcode. */ |
| 122 | 122 | $shortcode = new self; |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | * @return string The version of PHP. |
| 203 | 203 | */ |
| 204 | 204 | private function get_php_version() { |
| 205 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 206 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 205 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 206 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | * @return string The version of WordPress. |
| 215 | 215 | */ |
| 216 | 216 | private function get_wordpress_version() { |
| 217 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 218 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 217 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 218 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | * @return string|null The version of Gravity Forms or null if inactive. |
| 227 | 227 | */ |
| 228 | 228 | private function get_gravityforms_version() { |
| 229 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
| 229 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
| 230 | 230 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
| 231 | 231 | return null; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 235 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 234 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 235 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | private function __clone() { } |