Completed
Push — develop ( 4659b8...3ce645 )
by Zack
16:21
created
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 				}
Please login to merge, or discard this patch.
includes/class-gravityview-image.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
124 124
 		// show the notice, but not load any post types or process shortcodes.
125 125
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
126
-		if( ! self::is_valid() ) {
126
+		if ( ! self::is_valid() ) {
127 127
 
128 128
 			// If the plugin's not loaded, might as well hide the shortcode for people.
129
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
129
+			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) );
130 130
 
131 131
 		}
132 132
 	}
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
154 154
 
155
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
155
+		if ( ! GVCommon::has_cap( 'activate_plugins' ) ) {
156 156
 			return null;
157 157
 		}
158 158
 
159 159
 		$notices = self::get_notices();
160 160
 
161
-		$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>';
162
-		foreach( (array)$notices as $notice ) {
163
-			$message .= wpautop( $notice['message'] );
161
+		$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>';
162
+		foreach ( (array)$notices as $notice ) {
163
+			$message .= wpautop( $notice[ 'message' ] );
164 164
 		}
165 165
 		$message .= '</div>';
166 166
 
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public static function check_php() {
180 180
 
181
-		if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) {
181
+		if ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) {
182 182
 
183
-			self::$notices['php_version'] = array(
183
+			self::$notices[ 'php_version' ] = array(
184 184
 				'class' => 'error',
185
-				'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>' ),
185
+				'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>' ),
186 186
 				'cap' => 'manage_options',
187 187
 				'dismiss' => 'php_version',
188 188
 			);
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 			return false;
191 191
 		}
192 192
 
193
-		if( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION , '>=' ) ) {
193
+		if ( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION, '>=' ) ) {
194 194
 
195 195
 			// Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking.
196
-			$key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
196
+			$key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
197 197
 
198 198
 			self::$notices[ $key ] = array(
199 199
 				'class' => 'error',
200
-				'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>' ),
200
+				'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>' ),
201 201
 				'cap' => 'manage_options',
202 202
 				'dismiss' => $key,
203 203
 			);
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 	public static function check_wordpress() {
217 217
 		global $wp_version;
218 218
 
219
-		if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
219
+		if ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
220 220
 
221
-			self::$notices['wp_version'] = array(
221
+			self::$notices[ 'wp_version' ] = array(
222 222
 				'class' => 'error',
223
-				'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>' ),
223
+				'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>' ),
224 224
 			    'cap' => 'update_core',
225 225
 				'dismiss' => 'wp_version',
226 226
 			);
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	public static function check_gravityforms() {
244 244
 
245 245
 		// Bypass other checks: if the class exists
246
-		if( class_exists( 'GFCommon' ) ) {
246
+		if ( class_exists( 'GFCommon' ) ) {
247 247
 
248 248
 			// Does the version meet future requirements?
249
-			if( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) {
249
+			if ( true === version_compare( GFCommon::$version, GV_FUTURE_MIN_GF_VERSION, ">=" ) ) {
250 250
 				return true;
251 251
 			}
252 252
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 			$class = $meets_minimum ? 'notice-warning' : 'error';
257 257
 
258 258
 			// Show the notice even if the future version requirements aren't met
259
-			self::$notices['gf_version'] = array(
259
+			self::$notices[ 'gf_version' ] = array(
260 260
 				'class' => $class,
261
-				'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>'),
261
+				'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>' ),
262 262
 				'cap' => 'update_plugins',
263 263
 				'dismiss' => 'gf_version_' . GV_FUTURE_MIN_GF_VERSION,
264 264
 			);
@@ -274,42 +274,42 @@  discard block
 block discarded – undo
274 274
 		 * OR
275 275
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
276 276
 		 */
277
-		if( true === $gf_status || is_network_admin() ) {
277
+		if ( true === $gf_status || is_network_admin() ) {
278 278
 			return true;
279 279
 		}
280 280
 
281 281
 		// If GFCommon doesn't exist, assume GF not active
282 282
 		$return = false;
283 283
 
284
-		switch( $gf_status ) {
284
+		switch ( $gf_status ) {
285 285
 			case 'inactive':
286 286
 
287 287
 				// Required for multisite
288
-				if( ! function_exists('wp_create_nonce') ) {
288
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
289 289
 					require_once ABSPATH . WPINC . '/pluggable.php';
290 290
 				}
291 291
 
292 292
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
293
-				if( is_multisite() ) {
293
+				if ( is_multisite() ) {
294 294
 					wp_cookie_constants();
295 295
 				}
296 296
 
297 297
 				$return = false;
298 298
 
299
-				$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">';
299
+				$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">';
300 300
 
301
-				self::$notices['gf_inactive'] = array(
301
+				self::$notices[ 'gf_inactive' ] = array(
302 302
 					'class' => 'error',
303
-					'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>' ),
303
+					'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>' ),
304 304
 					'cap' => 'activate_plugins',
305 305
 					'dismiss' => 'gf_inactive',
306 306
 				);
307 307
 
308 308
 				break;
309 309
 			default:
310
-				self::$notices['gf_installed'] = array(
310
+				self::$notices[ 'gf_installed' ] = array(
311 311
 					'class' => 'error',
312
-					'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>'),
312
+					'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>' ),
313 313
 					'cap' => 'install_plugins',
314 314
 					'dismiss' => 'gf_installed',
315 315
 				);
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	private static function check_gf_directory() {
328 328
 
329
-		if( class_exists( 'GFDirectory' ) ) {
330
-			self::$notices['gf_directory'] = array(
329
+		if ( class_exists( 'GFDirectory' ) ) {
330
+			self::$notices[ 'gf_directory' ] = array(
331 331
 				'class' => 'error is-dismissible',
332
-				'title' => __('Potential Conflict', 'gravityview' ),
332
+				'title' => __( 'Potential Conflict', 'gravityview' ),
333 333
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
334 334
 				'dismiss' => 'gf_directory',
335 335
 				'cap' => 'activate_plugins',
@@ -348,21 +348,21 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	public static function get_plugin_status( $location = '' ) {
350 350
 
351
-		if( ! function_exists('is_plugin_active') ) {
351
+		if ( ! function_exists( 'is_plugin_active' ) ) {
352 352
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
353 353
 		}
354 354
 
355
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
355
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
356 356
 			return true;
357 357
 		}
358 358
 
359
-		if( !is_network_admin() && is_plugin_active( $location ) ) {
359
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
360 360
 			return true;
361 361
 		}
362 362
 
363
-		if(
364
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
365
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
363
+		if (
364
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
365
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
366 366
 		) {
367 367
 			return false;
368 368
 		}
Please login to merge, or discard this patch.