@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return GravityView_Compatibility |
77 | 77 | */ |
78 | 78 | public static function getInstance() { |
79 | - if( self::$instance ) { |
|
79 | + if ( self::$instance ) { |
|
80 | 80 | return self::$instance; |
81 | 81 | } |
82 | 82 | return new self; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
155 | 155 | // show the notice, but not load any post types or process shortcodes. |
156 | 156 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
157 | - if( ! self::is_valid() ) { |
|
157 | + if ( ! self::is_valid() ) { |
|
158 | 158 | |
159 | 159 | // If the plugin's not loaded, might as well hide the shortcode for people. |
160 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
160 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | } |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
185 | 185 | |
186 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
186 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
187 | 187 | return null; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $notices = self::get_notices(); |
191 | 191 | |
192 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
193 | - foreach( (array)$notices as $notice ) { |
|
194 | - $message .= wpautop( $notice['message'] ); |
|
192 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>'; |
|
193 | + foreach ( (array)$notices as $notice ) { |
|
194 | + $message .= wpautop( $notice[ 'message' ] ); |
|
195 | 195 | } |
196 | 196 | $message .= '</div>'; |
197 | 197 | |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | |
212 | 212 | if ( |
213 | 213 | ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && ! gravityview()->plugin->is_compatible_php() ) |
214 | - || ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) |
|
214 | + || ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) |
|
215 | 215 | ) { |
216 | 216 | |
217 | - self::$notices['php_version'] = array( |
|
217 | + self::$notices[ 'php_version' ] = array( |
|
218 | 218 | 'class' => 'error', |
219 | - 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
219 | + 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
220 | 220 | 'cap' => 'manage_options', |
221 | 221 | 'dismiss' => 'php_version', |
222 | 222 | ); |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | |
227 | - if( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION , '>=' ) ) { |
|
227 | + if ( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION, '>=' ) ) { |
|
228 | 228 | |
229 | 229 | // Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking. |
230 | - $key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
230 | + $key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version ); |
|
231 | 231 | |
232 | 232 | self::$notices[ $key ] = array( |
233 | 233 | 'class' => 'error', |
234 | - 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
234 | + 'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
235 | 235 | 'cap' => 'manage_options', |
236 | 236 | 'dismiss' => $key, |
237 | 237 | ); |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | || ( false === version_compare( $wp_version, GV_MIN_WP_VERSION, '>=' ) ) |
256 | 256 | ) { |
257 | 257 | |
258 | - self::$notices['wp_version'] = array( |
|
258 | + self::$notices[ 'wp_version' ] = array( |
|
259 | 259 | 'class' => 'error', |
260 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
260 | + 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ), |
|
261 | 261 | 'cap' => 'update_core', |
262 | 262 | 'dismiss' => 'wp_version', |
263 | 263 | ); |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | public static function check_gravityforms() { |
281 | 281 | |
282 | 282 | // Bypass other checks: if the class exists |
283 | - if( class_exists( 'GFCommon' ) ) { |
|
283 | + if ( class_exists( 'GFCommon' ) ) { |
|
284 | 284 | |
285 | 285 | // Does the version meet future requirements? |
286 | - if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
286 | + if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) { |
|
287 | 287 | return true; |
288 | 288 | } |
289 | 289 | |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | $class = $meets_minimum ? 'notice-warning' : 'error'; |
298 | 298 | |
299 | 299 | // Show the notice even if the future version requirements aren't met |
300 | - self::$notices['gf_version'] = array( |
|
300 | + self::$notices[ 'gf_version' ] = array( |
|
301 | 301 | 'class' => $class, |
302 | - 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
302 | + 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
303 | 303 | 'cap' => 'update_plugins', |
304 | 304 | 'dismiss' => 'gf_version_' . GV_FUTURE_MIN_GF_VERSION, |
305 | 305 | ); |
@@ -315,42 +315,42 @@ discard block |
||
315 | 315 | * OR |
316 | 316 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
317 | 317 | */ |
318 | - if( true === $gf_status || is_network_admin() ) { |
|
318 | + if ( true === $gf_status || is_network_admin() ) { |
|
319 | 319 | return true; |
320 | 320 | } |
321 | 321 | |
322 | 322 | // If GFCommon doesn't exist, assume GF not active |
323 | 323 | $return = false; |
324 | 324 | |
325 | - switch( $gf_status ) { |
|
325 | + switch ( $gf_status ) { |
|
326 | 326 | case 'inactive': |
327 | 327 | |
328 | 328 | // Required for multisite |
329 | - if( ! function_exists('wp_create_nonce') ) { |
|
329 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
330 | 330 | require_once ABSPATH . WPINC . '/pluggable.php'; |
331 | 331 | } |
332 | 332 | |
333 | 333 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
334 | - if( is_multisite() ) { |
|
334 | + if ( is_multisite() ) { |
|
335 | 335 | wp_cookie_constants(); |
336 | 336 | } |
337 | 337 | |
338 | 338 | $return = false; |
339 | 339 | |
340 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
340 | + $button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">'; |
|
341 | 341 | |
342 | - self::$notices['gf_inactive'] = array( |
|
342 | + self::$notices[ 'gf_inactive' ] = array( |
|
343 | 343 | 'class' => 'error', |
344 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
344 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ), |
|
345 | 345 | 'cap' => 'activate_plugins', |
346 | 346 | 'dismiss' => 'gf_inactive', |
347 | 347 | ); |
348 | 348 | |
349 | 349 | break; |
350 | 350 | default: |
351 | - self::$notices['gf_installed'] = array( |
|
351 | + self::$notices[ 'gf_installed' ] = array( |
|
352 | 352 | 'class' => 'error', |
353 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
353 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
354 | 354 | 'cap' => 'install_plugins', |
355 | 355 | 'dismiss' => 'gf_installed', |
356 | 356 | ); |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | */ |
368 | 368 | private static function check_gf_directory() { |
369 | 369 | |
370 | - if( class_exists( 'GFDirectory' ) ) { |
|
371 | - self::$notices['gf_directory'] = array( |
|
370 | + if ( class_exists( 'GFDirectory' ) ) { |
|
371 | + self::$notices[ 'gf_directory' ] = array( |
|
372 | 372 | 'class' => 'error is-dismissible', |
373 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
373 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
374 | 374 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
375 | 375 | 'dismiss' => 'gf_directory', |
376 | 376 | 'cap' => 'activate_plugins', |
@@ -389,21 +389,21 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public static function get_plugin_status( $location = '' ) { |
391 | 391 | |
392 | - if( ! function_exists('is_plugin_active') ) { |
|
392 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
393 | 393 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
394 | 394 | } |
395 | 395 | |
396 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
396 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
397 | 397 | return true; |
398 | 398 | } |
399 | 399 | |
400 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
400 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
401 | 401 | return true; |
402 | 402 | } |
403 | 403 | |
404 | - if( |
|
405 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
406 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
404 | + if ( |
|
405 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
406 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
407 | 407 | ) { |
408 | 408 | return false; |
409 | 409 | } |