| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | |
| 151 | 151 | /** | 
| 152 | 152 | * Sets the single entry ID and also the entry | 
| 153 | - * @param bool|int|string $single_entry | |
| 153 | + * @param boolean|string $single_entry | |
| 154 | 154 | */ | 
| 155 | 155 |  	public function setSingleEntry( $single_entry ) { | 
| 156 | 156 | |
| @@ -167,7 +167,7 @@ discard block | ||
| 167 | 167 | |
| 168 | 168 | /** | 
| 169 | 169 | * Set the current entry | 
| 170 | - * @param array|int $entry Entry array or entry slug or ID | |
| 170 | + * @param boolean|string $entry Entry array or entry slug or ID | |
| 171 | 171 | */ | 
| 172 | 172 |  	public function setEntry( $entry ) { | 
| 173 | 173 | |
| @@ -225,7 +225,7 @@ discard block | ||
| 225 | 225 | * | 
| 226 | 226 | * | 
| 227 | 227 | * | 
| 228 | - * @param null $view_id | |
| 228 | + * @param string $view_id | |
| 229 | 229 | */ | 
| 230 | 230 |  	public function set_context_view_id( $view_id = null ) { | 
| 231 | 231 | |
| @@ -957,7 +957,7 @@ discard block | ||
| 957 | 957 | * | 
| 958 | 958 | * @uses gravityview_get_entries() | 
| 959 | 959 | * @access public | 
| 960 | - * @param array $args\n | |
| 960 | + * @param array $args | |
| 961 | 961 | * - $id - View id | 
| 962 | 962 | * - $page_size - Page | 
| 963 | 963 | * - $sort_field - form field id to sort | 
| @@ -1413,7 +1413,7 @@ discard block | ||
| 1413 | 1413 | /** | 
| 1414 | 1414 | * Checks if field (column) is sortable | 
| 1415 | 1415 | * | 
| 1416 | - * @param string $field Field settings | |
| 1416 | + * @param string $field_id Field settings | |
| 1417 | 1417 | * @param array $form Gravity Forms form array | 
| 1418 | 1418 | * | 
| 1419 | 1419 | * @since 1.7 | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | |
| 60 | 60 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); | 
| 61 | 61 | |
| 62 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); | |
| 62 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); | |
| 63 | 63 | } | 
| 64 | 64 | |
| 65 | 65 | /** | 
| @@ -141,7 +141,7 @@ discard block | ||
| 141 | 141 | |
| 142 | 142 | $this->remove_url_hooks(); | 
| 143 | 143 | |
| 144 | -			if( $translations ) { | |
| 144 | +			if ( $translations ) { | |
| 145 | 145 |  				foreach ( $languages as $lang_code => $language ) { | 
| 146 | 146 | |
| 147 | 147 | $lang_post_id = $translations[ $lang_code ]->element_id; | 
| @@ -151,12 +151,12 @@ discard block | ||
| 151 | 151 |  					if ( ! empty( $translations[ $lang_code ]->original ) ) { | 
| 152 | 152 | |
| 153 | 153 | // The original doesn't need a language parameter | 
| 154 | - $languages[ $lang_code ]['url'] = remove_query_arg( 'lang', $entry_link ); | |
| 154 | + $languages[ $lang_code ][ 'url' ] = remove_query_arg( 'lang', $entry_link ); | |
| 155 | 155 | |
| 156 | 156 |  					} elseif ( $entry_link ) { | 
| 157 | 157 | |
| 158 | 158 | // Every other language does | 
| 159 | - $languages[ $lang_code ]['url'] = add_query_arg( array( 'lang' => $lang_code ), $entry_link ); | |
| 159 | + $languages[ $lang_code ][ 'url' ] = add_query_arg( array( 'lang' => $lang_code ), $entry_link ); | |
| 160 | 160 | |
| 161 | 161 | } | 
| 162 | 162 | } | 
| @@ -65,11 +65,11 @@ discard block | ||
| 65 | 65 | |
| 66 | 66 | $atts = wp_parse_args( $atts, $defaults ); | 
| 67 | 67 | |
| 68 | -		foreach( $atts as $key => $val ) { | |
| 68 | +		foreach ( $atts as $key => $val ) { | |
| 69 | 69 |  			$this->{$key} = $val; | 
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | - $this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; | |
| 72 | + $this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; | |
| 73 | 73 | |
| 74 | 74 | $this->set_image_size(); | 
| 75 | 75 | |
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | */ | 
| 86 | 86 |  	function validate_image_src() { | 
| 87 | 87 | |
| 88 | -		if ( !$this->validate_src ) { return true; } | |
| 88 | +		if ( ! $this->validate_src ) { return true; } | |
| 89 | 89 | |
| 90 | 90 | $info = pathinfo( $this->src ); | 
| 91 | 91 | |
| @@ -93,9 +93,9 @@ discard block | ||
| 93 | 93 | * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag | 
| 94 | 94 | * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']` | 
| 95 | 95 | */ | 
| 96 | - $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' )); | |
| 96 | + $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) ); | |
| 97 | 97 | |
| 98 | - return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts); | |
| 98 | + return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts ); | |
| 99 | 99 | } | 
| 100 | 100 | |
| 101 | 101 | /** | 
| @@ -111,16 +111,16 @@ discard block | ||
| 111 | 111 | |
| 112 | 112 | // And there is no string size passed | 
| 113 | 113 | // And we want to get the image size using PHP | 
| 114 | -			if ( empty( $string ) && !empty( $this->getimagesize ) ) { | |
| 114 | +			if ( empty( $string ) && ! empty( $this->getimagesize ) ) { | |
| 115 | 115 | |
| 116 | 116 | $image_size = @getimagesize( $this->src ); | 
| 117 | 117 | |
| 118 | 118 | // If it didn't return a response, it may be a HTTPS/SSL error | 
| 119 | -				if ( empty( $image_size[0] ) ) { | |
| 119 | +				if ( empty( $image_size[ 0 ] ) ) { | |
| 120 | 120 | $image_size = @getimagesize( set_url_scheme( $this->src, 'http' ) ); | 
| 121 | 121 | } | 
| 122 | 122 | |
| 123 | -				if ( !empty( $image_size ) ) { | |
| 123 | +				if ( ! empty( $image_size ) ) { | |
| 124 | 124 | list( $width, $height ) = $image_size; | 
| 125 | 125 | } | 
| 126 | 126 | |
| @@ -133,33 +133,33 @@ discard block | ||
| 133 | 133 | * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels | 
| 134 | 134 | */ | 
| 135 | 135 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( | 
| 136 | -					'tiny' => array('width' => 40, 'height' => 30), | |
| 137 | -					'small' => array('width' => 100, 'height' => 75), | |
| 138 | -					'medium' => array('width' => 250, 'height' => 188), | |
| 139 | -					'large' => array('width' => 448, 'height' => 336), | |
| 136 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), | |
| 137 | + 'small' => array( 'width' => 100, 'height' => 75 ), | |
| 138 | + 'medium' => array( 'width' => 250, 'height' => 188 ), | |
| 139 | + 'large' => array( 'width' => 448, 'height' => 336 ), | |
| 140 | 140 | ) ); | 
| 141 | 141 | |
| 142 | -				switch( $this->size ) { | |
| 142 | +				switch ( $this->size ) { | |
| 143 | 143 | case 'tiny': | 
| 144 | - extract($image_sizes['tiny']); | |
| 144 | + extract( $image_sizes[ 'tiny' ] ); | |
| 145 | 145 | break; | 
| 146 | 146 | case 'small': | 
| 147 | 147 | case 's': | 
| 148 | 148 | case 'thumb': | 
| 149 | - extract($image_sizes['small']); | |
| 149 | + extract( $image_sizes[ 'small' ] ); | |
| 150 | 150 | break; | 
| 151 | 151 | case 'm': | 
| 152 | 152 | case 'medium': | 
| 153 | - extract($image_sizes['medium']); | |
| 153 | + extract( $image_sizes[ 'medium' ] ); | |
| 154 | 154 | break; | 
| 155 | 155 | case 'large': | 
| 156 | 156 | case 'l': | 
| 157 | - extract($image_sizes['large']); | |
| 157 | + extract( $image_sizes[ 'large' ] ); | |
| 158 | 158 | break; | 
| 159 | 159 | default: | 
| 160 | 160 | // Verify that the passed sizes are integers. | 
| 161 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); | |
| 162 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); | |
| 161 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); | |
| 162 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); | |
| 163 | 163 | } | 
| 164 | 164 | |
| 165 | 165 | } | 
| @@ -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 | ( function_exists( 'gravityview' ) && ! 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 | || ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) | 
| 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 | } | 
| @@ -2,8 +2,9 @@ discard block | ||
| 2 | 2 | namespace GV; | 
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ | 
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) | |
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { | |
| 6 | 6 | die(); | 
| 7 | +} | |
| 7 | 8 | |
| 8 | 9 | /** | 
| 9 | 10 | * The core GravityView API. | 
| @@ -45,8 +46,9 @@ discard block | ||
| 45 | 46 | * @return \GV\Core The global instance of GravityView Core. | 
| 46 | 47 | */ | 
| 47 | 48 |  	public static function get() { | 
| 48 | - if ( ! self::$__instance instanceof self ) | |
| 49 | - self::$__instance = new self; | |
| 49 | +		if ( ! self::$__instance instanceof self ) { | |
| 50 | + self::$__instance = new self; | |
| 51 | + } | |
| 50 | 52 | return self::$__instance; | 
| 51 | 53 | } | 
| 52 | 54 | |
| @@ -200,8 +200,8 @@ discard block | ||
| 200 | 200 | * @return string The version of PHP. | 
| 201 | 201 | */ | 
| 202 | 202 |  	private function get_php_version() { | 
| 203 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? | |
| 204 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); | |
| 203 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? | |
| 204 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); | |
| 205 | 205 | } | 
| 206 | 206 | |
| 207 | 207 | /** | 
| @@ -212,8 +212,8 @@ discard block | ||
| 212 | 212 | * @return string The version of WordPress. | 
| 213 | 213 | */ | 
| 214 | 214 |  	private function get_wordpress_version() { | 
| 215 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? | |
| 216 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; | |
| 215 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? | |
| 216 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; | |
| 217 | 217 | } | 
| 218 | 218 | |
| 219 | 219 | /** | 
| @@ -225,11 +225,11 @@ discard block | ||
| 225 | 225 | * @return string The version of Gravity Forms. | 
| 226 | 226 | */ | 
| 227 | 227 |  	private function get_gravityforms_version() { | 
| 228 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) | |
| 228 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) | |
| 229 | 229 | throw new \ErrorException( __( 'Gravity Forms is inactive or not installed at all.', 'gravityview' ) ); | 
| 230 | 230 | |
| 231 | - return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? | |
| 232 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; | |
| 231 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? | |
| 232 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; | |
| 233 | 233 | } | 
| 234 | 234 | |
| 235 | 235 |  	private function __clone() { } | 
| @@ -2,8 +2,9 @@ discard block | ||
| 2 | 2 | namespace GV; | 
| 3 | 3 | |
| 4 | 4 | /** If this file is called directly, abort. */ | 
| 5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) | |
| 5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { | |
| 6 | 6 | die(); | 
| 7 | +} | |
| 7 | 8 | |
| 8 | 9 | /** | 
| 9 | 10 | * The GravityView WordPress plugin class. | 
| @@ -68,8 +69,9 @@ discard block | ||
| 68 | 69 | * @return \GV\Plugin The global instance of GravityView Plugin. | 
| 69 | 70 | */ | 
| 70 | 71 |  	public static function get() { | 
| 71 | - if ( ! self::$__instance instanceof self ) | |
| 72 | - self::$__instance = new self; | |
| 72 | +		if ( ! self::$__instance instanceof self ) { | |
| 73 | + self::$__instance = new self; | |
| 74 | + } | |
| 73 | 75 | return self::$__instance; | 
| 74 | 76 | } | 
| 75 | 77 | |
| @@ -225,8 +227,9 @@ discard block | ||
| 225 | 227 | * @return string The version of Gravity Forms. | 
| 226 | 228 | */ | 
| 227 | 229 |  	private function get_gravityforms_version() { | 
| 228 | - if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) | |
| 229 | - throw new \ErrorException( __( 'Gravity Forms is inactive or not installed.', 'gravityview' ) ); | |
| 230 | +		if ( !class_exists( '\GFCommon' ) || !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { | |
| 231 | + throw new \ErrorException( __( 'Gravity Forms is inactive or not installed.', 'gravityview' ) ); | |
| 232 | + } | |
| 230 | 233 | |
| 231 | 234 | return !empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? | 
| 232 | 235 | $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; | 
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | die(); | 
| 5 | 5 | |
| 6 | 6 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ | 
| 7 | -if ( version_compare( phpversion(), '5.3' , '<' ) ) | |
| 7 | +if ( version_compare( phpversion(), '5.3', '<' ) ) | |
| 8 | 8 | return false; | 
| 9 | 9 | |
| 10 | 10 | /** Require */ | 
| @@ -1,11 +1,13 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** If this file is called directly, abort. */ | 
| 3 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) | |
| 3 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { | |
| 4 | 4 | die(); | 
| 5 | +} | |
| 5 | 6 | |
| 6 | 7 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ | 
| 7 | -if ( version_compare( phpversion(), '5.3' , '<' ) ) | |
| 8 | +if ( version_compare( phpversion(), '5.3' , '<' ) ) { | |
| 8 | 9 | return false; | 
| 10 | +} | |
| 9 | 11 | |
| 10 | 12 | /** Require */ | 
| 11 | 13 | require GRAVITYVIEW_DIR . 'future/includes/class-gv-core.php'; | 
| @@ -58,8 +58,8 @@ discard block | ||
| 58 | 58 | |
| 59 | 59 |  			if ( 'address' === rgar( $search_field, 'type' ) ) { | 
| 60 | 60 | |
| 61 | - $field_id = intval( floor( $search_field['key'] ) ); | |
| 62 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); | |
| 61 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); | |
| 62 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); | |
| 63 | 63 | $form = GravityView_View::getInstance()->getForm(); | 
| 64 | 64 | |
| 65 | 65 | /** @var GF_Field_Address $address_field */ | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | $choices = array(); | 
| 69 | 69 | |
| 70 | 70 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); | 
| 71 | -				if( method_exists( $this, $method_name ) ) { | |
| 71 | +				if ( method_exists( $this, $method_name ) ) { | |
| 72 | 72 | /** | 
| 73 | 73 | * @uses GravityView_Field_Address::get_choices_country() | 
| 74 | 74 | * @uses GravityView_Field_Address::get_choices_state() | 
| @@ -76,12 +76,12 @@ discard block | ||
| 76 | 76 |  					$choices = $this->{$method_name}( $address_field ); | 
| 77 | 77 | } | 
| 78 | 78 | |
| 79 | -				if( ! empty( $choices ) ) { | |
| 80 | - $search_field['choices'] = $choices; | |
| 81 | - $search_field['type'] = rgar( $search_field, 'input'); | |
| 79 | +				if ( ! empty( $choices ) ) { | |
| 80 | + $search_field[ 'choices' ] = $choices; | |
| 81 | + $search_field[ 'type' ] = rgar( $search_field, 'input' ); | |
| 82 | 82 |  				} else { | 
| 83 | - $search_field['type'] = 'text'; | |
| 84 | - $search_field['input'] = 'input_text'; | |
| 83 | + $search_field[ 'type' ] = 'text'; | |
| 84 | + $search_field[ 'input' ] = 'input_text'; | |
| 85 | 85 | } | 
| 86 | 86 | } | 
| 87 | 87 | } | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | $country_choices = array(); | 
| 108 | 108 | |
| 109 | 109 |  		foreach ( $countries as $key => $country ) { | 
| 110 | - $country_choices[] = array( | |
| 110 | + $country_choices[ ] = array( | |
| 111 | 111 | 'value' => $country, | 
| 112 | 112 | 'text' => $country, | 
| 113 | 113 | ); | 
| @@ -131,7 +131,7 @@ discard block | ||
| 131 | 131 | */ | 
| 132 | 132 |  	private function get_choices_state( $address_field ) { | 
| 133 | 133 | |
| 134 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; | |
| 134 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; | |
| 135 | 135 | |
| 136 | 136 | $state_choices = array(); | 
| 137 | 137 | |
| @@ -143,12 +143,12 @@ discard block | ||
| 143 | 143 | $states = GFCommon::get_canadian_provinces(); | 
| 144 | 144 | break; | 
| 145 | 145 | default: | 
| 146 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; | |
| 146 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; | |
| 147 | 147 | break; | 
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | 150 |  		foreach ( $states as $key => $state ) { | 
| 151 | - $state_choices[] = array( | |
| 151 | + $state_choices[ ] = array( | |
| 152 | 152 | 'value' => $state, | 
| 153 | 153 | 'text' => $state, | 
| 154 | 154 | ); | 
| @@ -171,13 +171,13 @@ discard block | ||
| 171 | 171 | // Use the same inputs as the "text" input type allows | 
| 172 | 172 | $text_inputs = rgar( $input_types, 'text' ); | 
| 173 | 173 | |
| 174 | - $input_types['street'] = $text_inputs; | |
| 175 | - $input_types['street2'] = $text_inputs; | |
| 176 | - $input_types['city'] = $text_inputs; | |
| 174 | + $input_types[ 'street' ] = $text_inputs; | |
| 175 | + $input_types[ 'street2' ] = $text_inputs; | |
| 176 | + $input_types[ 'city' ] = $text_inputs; | |
| 177 | 177 | |
| 178 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; | |
| 179 | - $input_types['zip'] = array( 'input_text' ); | |
| 180 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; | |
| 178 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; | |
| 179 | + $input_types[ 'zip' ] = array( 'input_text' ); | |
| 180 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; | |
| 181 | 181 | |
| 182 | 182 | return $input_types; | 
| 183 | 183 | } | 
| @@ -198,10 +198,10 @@ discard block | ||
| 198 | 198 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? | 
| 199 | 199 | $input_id = gravityview_get_input_id_from_id( $field_id ); | 
| 200 | 200 | |
| 201 | -		if( 'address' === $field_type && $input_id ) { | |
| 201 | +		if ( 'address' === $field_type && $input_id ) { | |
| 202 | 202 | |
| 203 | 203 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. | 
| 204 | -			if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { | |
| 204 | +			if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { | |
| 205 | 205 | $input_type = $address_field_name; | 
| 206 | 206 | } | 
| 207 | 207 | } | 
| @@ -250,20 +250,20 @@ discard block | ||
| 250 | 250 |  	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { | 
| 251 | 251 | |
| 252 | 252 | // If this is NOT the full address field, return default options. | 
| 253 | -		if( floor( $field_id ) !== floatval( $field_id ) ) { | |
| 253 | +		if ( floor( $field_id ) !== floatval( $field_id ) ) { | |
| 254 | 254 | return $field_options; | 
| 255 | 255 | } | 
| 256 | 256 | |
| 257 | -		if( 'edit' === $context ) { | |
| 257 | +		if ( 'edit' === $context ) { | |
| 258 | 258 | return $field_options; | 
| 259 | 259 | } | 
| 260 | 260 | |
| 261 | 261 | $add_options = array(); | 
| 262 | 262 | |
| 263 | - $add_options['show_map_link'] = array( | |
| 263 | + $add_options[ 'show_map_link' ] = array( | |
| 264 | 264 | 'type' => 'checkbox', | 
| 265 | 265 | 'label' => __( 'Show Map Link:', 'gravityview' ), | 
| 266 | -			'desc' => __('Display a "Map It" link below the address', 'gravityview'), | |
| 266 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), | |
| 267 | 267 | 'value' => true, | 
| 268 | 268 | 'merge_tags' => false, | 
| 269 | 269 | ); |