@@ -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://katz.si/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://katz.si/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 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | static function getInstance() { |
| 44 | 44 | |
| 45 | - if( empty( self::$instance ) ) { |
|
| 45 | + if ( empty( self::$instance ) ) { |
|
| 46 | 46 | self::$instance = new self; |
| 47 | 47 | |
| 48 | 48 | self::$instance->initialize(); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // Catch either |
| 100 | 100 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
| 101 | 101 | |
| 102 | - return '#'.$match_regex.'#i'; |
|
| 102 | + return '#' . $match_regex . '#i'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $post_id = url_to_postid( $url ); |
| 120 | 120 | |
| 121 | - if( empty( $post_id ) ) { |
|
| 121 | + if ( empty( $post_id ) ) { |
|
| 122 | 122 | |
| 123 | 123 | $args = array( |
| 124 | 124 | 'post_status' => 'publish', |
| 125 | 125 | 'name' => $slug, |
| 126 | - 'post_type' => array('any', 'gravityview'), |
|
| 126 | + 'post_type' => array( 'any', 'gravityview' ), |
|
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $posts = get_posts( $args ); |
| 130 | 130 | |
| 131 | - if( !empty( $posts ) ) { |
|
| 132 | - $post_id = $posts[0]->ID; |
|
| 131 | + if ( ! empty( $posts ) ) { |
|
| 132 | + $post_id = $posts[ 0 ]->ID; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | public function render_handler( $matches, $attr, $url, $rawattr ) { |
| 163 | 163 | |
| 164 | 164 | // If not using permalinks, re-assign values for matching groups |
| 165 | - if( !empty( $matches['entry_slug2'] ) ) { |
|
| 166 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
| 167 | - $matches['slug'] = $matches['slug2']; |
|
| 168 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
| 169 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
| 165 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
| 166 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
| 167 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
| 168 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
| 169 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // No Entry was found |
| 173 | - if( empty( $matches['entry_slug'] ) ) { |
|
| 173 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
| 174 | 174 | |
| 175 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
| 175 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
| 176 | 176 | |
| 177 | 177 | return ''; |
| 178 | 178 | } |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | // Setup the data used |
| 183 | 183 | $this->set_vars( $matches, $attr, $url, $rawattr ); |
| 184 | 184 | |
| 185 | - if( is_admin() && !$this->is_full_oembed_preview ) { |
|
| 185 | + if ( is_admin() && ! $this->is_full_oembed_preview ) { |
|
| 186 | 186 | $return = $this->render_admin( $matches, $attr, $url, $rawattr ); |
| 187 | 187 | } else { |
| 188 | 188 | |
| 189 | - if( $this->is_full_oembed_preview ) { |
|
| 189 | + if ( $this->is_full_oembed_preview ) { |
|
| 190 | 190 | $return .= $this->generate_preview_notice(); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | private function generate_preview_notice() { |
| 206 | 206 | $floaty = GravityView_Admin::get_floaty(); |
| 207 | 207 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
| 208 | - $message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
| 209 | - return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
| 208 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
| 209 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -219,14 +219,14 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | private function set_vars( $matches, $attr, $url, $rawattr ) { |
| 221 | 221 | |
| 222 | - $this->entry_id = $matches['entry_slug']; |
|
| 222 | + $this->entry_id = $matches[ 'entry_slug' ]; |
|
| 223 | 223 | |
| 224 | - $post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] ); |
|
| 224 | + $post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] ); |
|
| 225 | 225 | |
| 226 | 226 | // The URL didn't have the View Custom Post Type structure. |
| 227 | - if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) { |
|
| 227 | + if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) { |
|
| 228 | 228 | |
| 229 | - do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
| 229 | + do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
| 230 | 230 | |
| 231 | 231 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) && $post = get_post( $post_id ) ) { |
| 232 | 232 | $views = \GV\View_Collection::from_post( $post ); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $this->view_id = $views[0]->ID; |
|
| 242 | + $this->view_id = $views[ 0 ]->ID; |
|
| 243 | 243 | } |
| 244 | 244 | } else { |
| 245 | 245 | /** Deprecated. */ |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that. |
| 256 | - $this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) ); |
|
| 256 | + $this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -271,15 +271,15 @@ discard block |
||
| 271 | 271 | // Floaty the astronaut |
| 272 | 272 | $image = GravityView_Admin::get_floaty(); |
| 273 | 273 | |
| 274 | - $embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id ); |
|
| 274 | + $embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id ); |
|
| 275 | 275 | |
| 276 | - $embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id ); |
|
| 276 | + $embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id ); |
|
| 277 | 277 | |
| 278 | 278 | return ' |
| 279 | 279 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
| 280 | - <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
| 280 | + <h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
| 281 | 281 | <p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;"> |
| 282 | - '.$embed_text.' |
|
| 282 | + '.$embed_text . ' |
|
| 283 | 283 | </p> |
| 284 | 284 | <br style="clear: both;"> |
| 285 | 285 | </div>'; |
@@ -334,14 +334,14 @@ discard block |
||
| 334 | 334 | private function render_frontend( $matches, $attr, $url, $rawattr ) { |
| 335 | 335 | |
| 336 | 336 | // If it's already been parsed, don't re-output it. |
| 337 | - if( !empty( $this->output[ $this->entry_id ] ) ) { |
|
| 337 | + if ( ! empty( $this->output[ $this->entry_id ] ) ) { |
|
| 338 | 338 | return $this->output[ $this->entry_id ]; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | $entry_output = $this->generate_entry_output(); |
| 342 | 342 | |
| 343 | 343 | // Wrap a container div around the output to allow for custom styling |
| 344 | - $output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output ); |
|
| 344 | + $output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output ); |
|
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | * @var string $url The original URL that was matched by the regex. \n |
| 355 | 355 | * @var array $rawattr The original unmodified attributes. |
| 356 | 356 | */ |
| 357 | - $output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
| 357 | + $output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
| 358 | 358 | |
| 359 | 359 | unset( $entry_output ); |
| 360 | 360 | |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * @param mixed $field_id Field ID or Field array |
| 329 | 329 | * @return string field type |
| 330 | 330 | */ |
| 331 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
| 332 | - return GVCommon::get_field_type( $form, $field_id ); |
|
| 331 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
| 332 | + return GVCommon::get_field_type( $form, $field_id ); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | * @return string HTML of the output. Empty string if $view_id is empty. |
| 343 | 343 | */ |
| 344 | 344 | function get_gravityview( $view_id = '', $atts = array() ) { |
| 345 | - if( !empty( $view_id ) ) { |
|
| 346 | - $atts['id'] = $view_id; |
|
| 345 | + if ( ! empty( $view_id ) ) { |
|
| 346 | + $atts[ 'id' ] = $view_id; |
|
| 347 | 347 | $args = wp_parse_args( $atts, defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? \GV\View_Settings::defaults() : GravityView_View_Data::get_default_args() ); |
| 348 | 348 | $GravityView_frontend = GravityView_frontend::getInstance(); |
| 349 | 349 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -386,19 +386,19 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
| 388 | 388 | |
| 389 | - if( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 389 | + if ( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 390 | 390 | |
| 391 | 391 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
| 392 | - foreach( $form_fields as $form_field ) { |
|
| 392 | + foreach ( $form_fields as $form_field ) { |
|
| 393 | 393 | $field_id = $form_field->id; |
| 394 | - foreach( $view_fields as $zone ) { |
|
| 394 | + foreach ( $view_fields as $zone ) { |
|
| 395 | 395 | |
| 396 | 396 | // ACF compatibility; ACF-added fields aren't arrays |
| 397 | 397 | if ( ! is_array( $zone ) ) { continue; } |
| 398 | 398 | |
| 399 | - foreach( $zone as $field ) { |
|
| 399 | + foreach ( $zone as $field ) { |
|
| 400 | 400 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
| 401 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
| 401 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
| 402 | 402 | return true; |
| 403 | 403 | } |
| 404 | 404 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** @var WP_Admin_Bar $wp_admin_bar */ |
| 39 | 39 | global $wp_admin_bar; |
| 40 | 40 | |
| 41 | - if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
| 41 | + if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | 'parent' => 'gravityview', |
| 111 | 111 | 'title' => __( 'Edit Entry', 'gravityview' ), |
| 112 | 112 | 'meta' => array( |
| 113 | - 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry['id'], $entry ) ), |
|
| 113 | + 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ) ), |
|
| 114 | 114 | ), |
| 115 | - 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ), |
|
| 115 | + 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ), |
|
| 116 | 116 | ) ); |
| 117 | 117 | |
| 118 | 118 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /** @var WP_Admin_Bar $wp_admin_bar */ |
| 129 | 129 | global $wp_admin_bar; |
| 130 | 130 | |
| 131 | - if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
| 131 | + if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
| 132 | 132 | |
| 133 | 133 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
| 134 | 134 | $views = gravityview()->views->all(); |
@@ -152,21 +152,21 @@ discard block |
||
| 152 | 152 | $form_id = $view->form ? $view->form->ID : null; |
| 153 | 153 | } else { |
| 154 | 154 | /** Deprecated. */ |
| 155 | - $view_id = $view['id']; |
|
| 156 | - $form_id = $view['form_id']; |
|
| 155 | + $view_id = $view[ 'id' ]; |
|
| 156 | + $form_id = $view[ 'form_id' ]; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $edit_view_title = __( 'Edit View', 'gravityview' ); |
| 160 | 160 | $edit_form_title = __( 'Edit Form', 'gravityview' ); |
| 161 | 161 | |
| 162 | - if( sizeof( $views ) > 1 ) { |
|
| 162 | + if ( sizeof( $views ) > 1 ) { |
|
| 163 | 163 | $edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view_id ); |
| 164 | 164 | $edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $form_id ); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
| 167 | + if ( GVCommon::has_cap( 'edit_gravityview', $view_id ) && ! in_array( $view_id, $added_views ) ) { |
|
| 168 | 168 | |
| 169 | - $added_views[] = $view_id; |
|
| 169 | + $added_views[ ] = $view_id; |
|
| 170 | 170 | |
| 171 | 171 | $wp_admin_bar->add_menu( array( |
| 172 | 172 | 'id' => 'edit-view-' . $view_id, |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | ) ); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
| 179 | + if ( ! empty( $form_id ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $form_id ) && ! in_array( $form_id, $added_forms ) ) { |
|
| 180 | 180 | |
| 181 | - $added_forms[] = $form_id; |
|
| 181 | + $added_forms[ ] = $form_id; |
|
| 182 | 182 | |
| 183 | 183 | $wp_admin_bar->add_menu( array( |
| 184 | 184 | 'id' => 'edit-form-' . $form_id, |
@@ -129,12 +129,12 @@ |
||
| 129 | 129 | |
| 130 | 130 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
| 131 | 131 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
| 132 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
| 132 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
| 133 | 133 | continue; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
| 137 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
| 136 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
| 137 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
| 138 | 138 | if ( ! $view ) { |
| 139 | 139 | continue; |
| 140 | 140 | } |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | /** Call all lazy callbacks. */ |
| 105 | 105 | foreach ( $this->callbacks as $callback ) { |
| 106 | - if ( $callback[0] != 'count' ) { |
|
| 106 | + if ( $callback[ 0 ] != 'count' ) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $total += $callback[1]( $this->filters ); |
|
| 110 | + $total += $callback[ 1 ]( $this->filters ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $total - $this->offset; |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | /** Call all lazy callbacks. */ |
| 163 | 163 | foreach ( $this->callbacks as $i => $callback ) { |
| 164 | - if ( $callback[0] != 'fetch' ) { |
|
| 164 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
| 165 | 165 | continue; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
| 168 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $this->fetched = $this->count(); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $this->callbacks []= array( $type, $callback ); |
|
| 324 | + $this->callbacks [ ] = array( $type, $callback ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | 27 | public function add( $value ) { |
| 28 | - $this->storage []= $value; |
|
| 28 | + $this->storage [ ] = $value; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | 51 | public function merge( \GV\Collection $collection ) { |
| 52 | - array_map( array( $this, 'add'), $collection->all() ); |
|
| 52 | + array_map( array( $this, 'add' ), $collection->all() ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | protected function log( $level, $message, $context ) { |
| 29 | 29 | |
| 30 | 30 | $backtrace = debug_backtrace(); |
| 31 | - $location = $this->interpolate( "{class}{type}{function}", $backtrace[2] ); |
|
| 31 | + $location = $this->interpolate( "{class}{type}{function}", $backtrace[ 2 ] ); |
|
| 32 | 32 | |
| 33 | 33 | $message = $this->interpolate( "[$level, $location] $message", $context ); |
| 34 | 34 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | do_action( |
| 53 | 53 | sprintf( 'gravityview_log_%s_test', $action ), |
| 54 | 54 | $this->interpolate( $message, $context ), |
| 55 | - empty( $context['data'] ) ? array() : $context['data'] |
|
| 55 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | do_action( |
| 60 | 60 | sprintf( 'gravityview_log_%s', $action ), |
| 61 | 61 | $this->interpolate( $message, $context ), |
| 62 | - empty( $context['data'] ) ? array() : $context['data'] |
|
| 62 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | - public function emergency($message, array $context = array()) |
|
| 39 | + public function emergency( $message, array $context = array() ) |
|
| 40 | 40 | { |
| 41 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
| 41 | + $this->log( LogLevel::EMERGENCY, $message, $context ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - public function alert($message, array $context = array()) |
|
| 55 | + public function alert( $message, array $context = array() ) |
|
| 56 | 56 | { |
| 57 | - $this->log(LogLevel::ALERT, $message, $context); |
|
| 57 | + $this->log( LogLevel::ALERT, $message, $context ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return void |
| 69 | 69 | */ |
| 70 | - public function critical($message, array $context = array()) |
|
| 70 | + public function critical( $message, array $context = array() ) |
|
| 71 | 71 | { |
| 72 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
| 72 | + $this->log( LogLevel::CRITICAL, $message, $context ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return void |
| 83 | 83 | */ |
| 84 | - public function error($message, array $context = array()) |
|
| 84 | + public function error( $message, array $context = array() ) |
|
| 85 | 85 | { |
| 86 | - $this->log(LogLevel::ERROR, $message, $context); |
|
| 86 | + $this->log( LogLevel::ERROR, $message, $context ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - public function warning($message, array $context = array()) |
|
| 100 | + public function warning( $message, array $context = array() ) |
|
| 101 | 101 | { |
| 102 | - $this->log(LogLevel::WARNING, $message, $context); |
|
| 102 | + $this->log( LogLevel::WARNING, $message, $context ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function notice($message, array $context = array()) |
|
| 113 | + public function notice( $message, array $context = array() ) |
|
| 114 | 114 | { |
| 115 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
| 115 | + $this->log( LogLevel::NOTICE, $message, $context ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @return void |
| 127 | 127 | */ |
| 128 | - public function info($message, array $context = array()) |
|
| 128 | + public function info( $message, array $context = array() ) |
|
| 129 | 129 | { |
| 130 | - $this->log(LogLevel::INFO, $message, $context); |
|
| 130 | + $this->log( LogLevel::INFO, $message, $context ); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @return void |
| 140 | 140 | */ |
| 141 | - public function debug($message, array $context = array()) |
|
| 141 | + public function debug( $message, array $context = array() ) |
|
| 142 | 142 | { |
| 143 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
| 143 | + $this->log( LogLevel::DEBUG, $message, $context ); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |