Completed
Push — master ( 9cf7be...029c15 )
by Zack
04:07
created
includes/class-gravityview-template.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 * @return string                Path to XML file
194 194
 	 */
195 195
 	public function assign_form_xml( $xml = '', $template = '' ) {
196
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_form'] ) && $this->template_id === $template ) {
197
-			return $this->settings['preset_form'];
196
+		if ( $this->settings[ 'type' ] === 'preset' && ! empty( $this->settings[ 'preset_form' ] ) && $this->template_id === $template ) {
197
+			return $this->settings[ 'preset_form' ];
198 198
 		}
199 199
 
200 200
 		return $xml;
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @return string                Path to XML file
208 208
 	 */
209 209
 	public function assign_fields_xml( $xml = '', $template = '' ) {
210
-		if ( $this->settings['type'] === 'preset' && ! empty( $this->settings['preset_fields'] ) && $this->template_id === $template ) {
211
-			return $this->settings['preset_fields'];
210
+		if ( $this->settings[ 'type' ] === 'preset' && ! empty( $this->settings[ 'preset_fields' ] ) && $this->template_id === $template ) {
211
+			return $this->settings[ 'preset_fields' ];
212 212
 		}
213 213
 
214 214
 		return $xml;
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function assign_view_slug( $default, $context ) {
228 228
 
229
-		if ( ! empty( $this->settings['slug'] ) ) {
230
-			return $this->settings['slug'];
229
+		if ( ! empty( $this->settings[ 'slug' ] ) ) {
230
+			return $this->settings[ 'slug' ];
231 231
 		}
232 232
 		if ( ! empty( $default ) ) {
233 233
 			return $default;
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	 * @return void
245 245
 	 */
246 246
 	public function register_styles() {
247
-		if ( ! empty( $this->settings['css_source'] ) ) {
248
-			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings['css_source'], array(), GravityView_Plugin::version, 'all' );
247
+		if ( ! empty( $this->settings[ 'css_source' ] ) ) {
248
+			wp_register_style( 'gravityview_style_' . $this->template_id, $this->settings[ 'css_source' ], array(), GravityView_Plugin::version, 'all' );
249 249
 		}
250 250
 	}
251 251
 
Please login to merge, or discard this patch.
includes/class-debug-bar.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	function init() {
22 22
 
23 23
 		$icon = is_admin() ? '<i class="icon gv-icon-astronaut-head"></i>&nbsp;' : NULL;
24
-		$this->title( $icon . __('GravityView', 'gravityview') );
24
+		$this->title( $icon . __( 'GravityView', 'gravityview' ) );
25 25
 	}
26 26
 
27 27
 	function get_warnings() {
28 28
 
29
-		if( is_null( $this->warnings ) ) {
29
+		if ( is_null( $this->warnings ) ) {
30 30
 			$this->warnings = GravityView_Logging::get_errors();
31 31
 		}
32 32
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 	function get_notices() {
37 37
 
38
-		if( is_null( $this->notices ) ) {
38
+		if ( is_null( $this->notices ) ) {
39 39
 			$this->notices = GravityView_Logging::get_notices();
40 40
 		}
41 41
 
@@ -84,27 +84,27 @@  discard block
 block discarded – undo
84 84
 		</style>
85 85
 		<div id='debug-bar-gravityview'>";
86 86
 
87
-		$output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignright" alt="" width="100" height="132" />';
87
+		$output .= '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="alignright" alt="" width="100" height="132" />';
88 88
 
89 89
 
90 90
 		$warnings = $this->get_warnings();
91 91
 		$notices = $this->get_notices();
92 92
 
93
-		if(count($warnings)) {
94
-			$output .= '<h3><span>'.__('Warnings', 'gravityview').'</span></h3>';
93
+		if ( count( $warnings ) ) {
94
+			$output .= '<h3><span>' . __( 'Warnings', 'gravityview' ) . '</span></h3>';
95 95
 			$output .= '<ol>';
96
-			foreach ( $warnings as $key => $notice) {
97
-				if(empty($notice['message'])) { continue; }
98
-				$output .= '<li><a href="#'.sanitize_html_class( 'gv-warning-' . $key ).'">'.strip_tags($notice['message']).'</a></li>';
96
+			foreach ( $warnings as $key => $notice ) {
97
+				if ( empty( $notice[ 'message' ] ) ) { continue; }
98
+				$output .= '<li><a href="#' . sanitize_html_class( 'gv-warning-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>';
99 99
 			}
100 100
 			$output .= '</ol><hr />';
101 101
 		}
102
-		if(count($notices)) {
103
-			$output .= '<h3><span>'.__('Logs', 'gravityview').'</span></h3>';
102
+		if ( count( $notices ) ) {
103
+			$output .= '<h3><span>' . __( 'Logs', 'gravityview' ) . '</span></h3>';
104 104
 			$output .= '<ol>';
105
-			foreach ( $notices as $key => $notice) {
106
-				if(empty($notice['message'])) { continue; }
107
-				$output .= '<li><a href="#'.sanitize_html_class( 'gv-notice-' . $key ).'">'.strip_tags($notice['message']).'</a></li>';
105
+			foreach ( $notices as $key => $notice ) {
106
+				if ( empty( $notice[ 'message' ] ) ) { continue; }
107
+				$output .= '<li><a href="#' . sanitize_html_class( 'gv-notice-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>';
108 108
 			}
109 109
 			$output .= '</ol><hr />';
110 110
 		}
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 		if ( count( $warnings ) ) {
113 113
 			$output .= '<h3>Warnings</h3>';
114 114
 			$output .= '<ol class="debug-bar-php-list">';
115
-			foreach ( $warnings as $key => $notice) { $output .= $this->render_item( $notice, 'gv-warning-'  . $key ); }
115
+			foreach ( $warnings as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); }
116 116
 			$output .= '</ol>';
117 117
 		}
118 118
 
119 119
 		if ( count( $notices ) ) {
120 120
 			$output .= '<h3>Notices</h3>';
121 121
 			$output .= '<ol class="debug-bar-php-list">';
122
-			foreach ( $notices as $key => $notice) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); }
122
+			foreach ( $notices as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); }
123 123
 			$output .= '</ol>';
124 124
 		}
125 125
 
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 	 * @param  string|array $item Unescaped
134 134
 	 * @return string       Escaped HTML
135 135
 	 */
136
-	function esc_html_recursive($item) {
137
-		if(is_object($item)) {
138
-			foreach($item as $key => $value) {
139
-				$item->{$key} = $this->esc_html_recursive($value);
136
+	function esc_html_recursive( $item ) {
137
+		if ( is_object( $item ) ) {
138
+			foreach ( $item as $key => $value ) {
139
+				$item->{$key} = $this->esc_html_recursive( $value );
140 140
 			}
141
-		} else if(is_array($item)) {
142
-			foreach($item as $key => $value) {
143
-				$item[$key] = $this->esc_html_recursive($value);
141
+		} else if ( is_array( $item ) ) {
142
+			foreach ( $item as $key => $value ) {
143
+				$item[ $key ] = $this->esc_html_recursive( $value );
144 144
 			}
145 145
 		} else {
146
-			$item = esc_html($item);
146
+			$item = esc_html( $item );
147 147
 		}
148 148
 		return $item;
149 149
 	}
@@ -159,26 +159,26 @@  discard block
 block discarded – undo
159 159
 
160 160
 		$output = '';
161 161
 
162
-		if(!empty($notice['message'])) {
163
-			$output .= '<a id="'.sanitize_html_class( $anchor ).'"></a>';
162
+		if ( ! empty( $notice[ 'message' ] ) ) {
163
+			$output .= '<a id="' . sanitize_html_class( $anchor ) . '"></a>';
164 164
 			$output .= "<li class='debug-bar-php-notice'>";
165 165
 		}
166 166
 
167 167
 		$output .= '<div class="clear"></div>';
168 168
 
169 169
 		// Title
170
-		$output .= '<div class="gravityview-debug-bar-title">'.esc_attr( $notice['message'] ).'</div>';
170
+		$output .= '<div class="gravityview-debug-bar-title">' . esc_attr( $notice[ 'message' ] ) . '</div>';
171 171
 
172 172
 		// Debugging Output
173
-		if( empty( $notice['data'] ) ) {
174
-			if( !is_null( $notice['data'] ) ) {
175
-				$output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>';
173
+		if ( empty( $notice[ 'data' ] ) ) {
174
+			if ( ! is_null( $notice[ 'data' ] ) ) {
175
+				$output .= '<em>' . _x( 'Empty', 'Debugging output data is empty.', 'gravityview' ) . '</em>';
176 176
 			}
177 177
 		} else {
178
-			$output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) );
178
+			$output .= sprintf( '<pre>%s</pre>', print_r( $this->esc_html_recursive( $notice[ 'data' ] ), true ) );
179 179
 		}
180 180
 
181
-		if(!empty($notice['message'])) {
181
+		if ( ! empty( $notice[ 'message' ] ) ) {
182 182
 			$output .= '</li>';
183 183
 		}
184 184
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			$wp_admin_bar->add_menu( array(
63 63
 				'id' => 'edit-entry',
64 64
 				'title' => __( 'Edit Entry', 'gravityview' ),
65
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
65
+				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ),
66 66
 			) );
67 67
 
68 68
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		/** @var WP_Admin_Bar $wp_admin_bar */
79 79
 		global $wp_admin_bar;
80 80
 
81
-		if( GVCommon::has_cap('edit_gravityviews') ) {
81
+		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
82 82
 
83 83
 			$view_data = GravityView_View_Data::getInstance();
84 84
 
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 			if ( ! $this->gravityview_view->isGravityviewPostType() && ! empty( $views ) && ! $view_data->has_multiple_views() ) {
90 90
 				$view = reset( $views );
91 91
 
92
-				if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) ) {
92
+				if ( GVCommon::has_cap( 'edit_gravityview', $view[ 'id' ] ) ) {
93 93
 					$wp_admin_bar->add_menu( array(
94 94
 						'id'    => 'edit-view',
95 95
 						'title' => __( 'Edit View', 'gravityview' ),
96
-						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ),
96
+						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view[ 'id' ] ) ) ),
97 97
 					) );
98 98
 				}
99 99
 			}
Please login to merge, or discard this patch.
includes/default-widgets.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,4 +5,4 @@
 block discarded – undo
5 5
  * @deprecated 1.7.5
6 6
  */
7 7
 
8
-include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' );
8
+include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' );
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 1 patch
Spacing   +35 added lines, -35 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
 
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 * @return boolean
176 176
 	 */
177 177
 	public static function check_php() {
178
-		if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) {
178
+		if ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) {
179 179
 
180
-			self::$notices['php_version'] = array(
180
+			self::$notices[ 'php_version' ] = array(
181 181
 				'class' => 'error',
182
-				'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>' ),
182
+				'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>' ),
183 183
 				'cap' => 'manage_options',
184 184
 				'dismiss' => 'php_version',
185 185
 			);
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	public static function check_wordpress() {
200 200
 		global $wp_version;
201 201
 
202
-		if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
202
+		if ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
203 203
 
204
-			self::$notices['wp_version'] = array(
204
+			self::$notices[ 'wp_version' ] = array(
205 205
 				'class' => 'error',
206
-				'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>' ),
206
+				'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>' ),
207 207
 			    'cap' => 'update_core',
208 208
 				'dismiss' => 'wp_version',
209 209
 			);
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 	public static function check_gravityforms() {
227 227
 
228 228
 		// Bypass other checks: if the class exists
229
-		if( class_exists( 'GFCommon' ) ) {
229
+		if ( class_exists( 'GFCommon' ) ) {
230 230
 
231 231
 			// and the version's right, we're good.
232
-			if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
232
+			if ( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
233 233
 				return true;
234 234
 			}
235 235
 
236 236
 			// Or the version's wrong
237
-			self::$notices['gf_version'] = array(
237
+			self::$notices[ 'gf_version' ] = array(
238 238
 				'class' => 'error',
239
-				'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_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
239
+				'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_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
240 240
 				'cap' => 'update_plugins',
241 241
 				'dismiss' => 'gf_version',
242 242
 			);
@@ -251,42 +251,42 @@  discard block
 block discarded – undo
251 251
 		 * OR
252 252
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
253 253
 		 */
254
-		if( true === $gf_status || is_network_admin() ) {
254
+		if ( true === $gf_status || is_network_admin() ) {
255 255
 			return true;
256 256
 		}
257 257
 
258 258
 		// If GFCommon doesn't exist, assume GF not active
259 259
 		$return = false;
260 260
 
261
-		switch( $gf_status ) {
261
+		switch ( $gf_status ) {
262 262
 			case 'inactive':
263 263
 
264 264
 				// Required for multisite
265
-				if( ! function_exists('wp_create_nonce') ) {
265
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
266 266
 					require_once ABSPATH . WPINC . '/pluggable.php';
267 267
 				}
268 268
 
269 269
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
270
-				if( is_multisite() ) {
270
+				if ( is_multisite() ) {
271 271
 					wp_cookie_constants();
272 272
 				}
273 273
 
274 274
 				$return = false;
275 275
 
276
-				$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">';
276
+				$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">';
277 277
 
278
-				self::$notices['gf_inactive'] = array(
278
+				self::$notices[ 'gf_inactive' ] = array(
279 279
 					'class' => 'error',
280
-					'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>' ),
280
+					'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>' ),
281 281
 					'cap' => 'activate_plugins',
282 282
 					'dismiss' => 'gf_inactive',
283 283
 				);
284 284
 
285 285
 				break;
286 286
 			default:
287
-				self::$notices['gf_installed'] = array(
287
+				self::$notices[ 'gf_installed' ] = array(
288 288
 					'class' => 'error',
289
-					'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>'),
289
+					'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>' ),
290 290
 					'cap' => 'install_plugins',
291 291
 					'dismiss' => 'gf_installed',
292 292
 				);
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	private static function check_gf_directory() {
305 305
 
306
-		if( class_exists( 'GFDirectory' ) ) {
307
-			self::$notices['gf_directory'] = array(
306
+		if ( class_exists( 'GFDirectory' ) ) {
307
+			self::$notices[ 'gf_directory' ] = array(
308 308
 				'class' => 'error is-dismissible',
309
-				'title' => __('Potential Conflict', 'gravityview' ),
309
+				'title' => __( 'Potential Conflict', 'gravityview' ),
310 310
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
311 311
 				'dismiss' => 'gf_directory',
312 312
 				'cap' => 'activate_plugins',
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public static function get_plugin_status( $location = '' ) {
327 327
 
328
-		if( ! function_exists('is_plugin_active') ) {
328
+		if ( ! function_exists( 'is_plugin_active' ) ) {
329 329
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
330 330
 		}
331 331
 
332
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
332
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
333 333
 			return true;
334 334
 		}
335 335
 
336
-		if( !is_network_admin() && is_plugin_active( $location ) ) {
336
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
337 337
 			return true;
338 338
 		}
339 339
 
340
-		if(
341
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
342
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
340
+		if (
341
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
342
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
343 343
 		) {
344 344
 			return false;
345 345
 		}
Please login to merge, or discard this patch.
includes/class-admin-label.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,29 +11,29 @@  discard block
 block discarded – undo
11 11
 		$field_info_items = array();
12 12
 
13 13
 		// Fields with IDs, not like Source URL or Entry ID
14
-		if( is_numeric( $this->id ) ) {
14
+		if ( is_numeric( $this->id ) ) {
15 15
 
16
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
16
+			$field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] );
17 17
 
18
-			$field_info_items[] = array(
19
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title )
18
+			$field_info_items[ ] = array(
19
+				'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title )
20 20
 			);
21 21
 
22
-			$field_info_items[] = array(
23
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
22
+			$field_info_items[ ] = array(
23
+				'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ),
24 24
 			);
25 25
 
26 26
 		}
27 27
 
28
-		if( !empty( $this->item['desc'] ) ) {
29
-			$field_info_items[] = array(
30
-				'value' => $this->item['desc']
28
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
29
+			$field_info_items[ ] = array(
30
+				'value' => $this->item[ 'desc' ]
31 31
 			);
32 32
 		}
33 33
 
34
-		if( !empty( $this->item['adminLabel'] ) ) {
35
-			$field_info_items[] = array(
36
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
34
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
35
+			$field_info_items[ ] = array(
36
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
37 37
 				'class'	=> 'gv-sublabel'
38 38
 			);
39 39
 		}
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 		$field_info = '';
53 53
 		$field_info_items = array();
54 54
 
55
-		if( !empty( $this->item['description'] ) ) {
55
+		if ( ! empty( $this->item[ 'description' ] ) ) {
56 56
 
57
-			$field_info_items[] = array(
58
-				'value' => $this->item['description']
57
+			$field_info_items[ ] = array(
58
+				'value' => $this->item[ 'description' ]
59 59
 			);
60 60
 
61 61
 		}
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	function __construct( $title = '', $field_id, $item = array(), $settings = array() ) {
81 81
 
82 82
 		// Backward compat
83
-		if( !empty( $item['type'] ) ) {
84
-			$item['input_type'] = $item['type'];
85
-			unset( $item['type'] );
83
+		if ( ! empty( $item[ 'type' ] ) ) {
84
+			$item[ 'input_type' ] = $item[ 'type' ];
85
+			unset( $item[ 'type' ] );
86 86
 		}
87 87
 
88 88
 		// Prevent items from not having index set
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 			'adminLabel' => NULL,
97 97
 			'adminOnly' => NULL,
98 98
 			'subtitle' => NULL,
99
-		));
99
+		) );
100 100
 
101 101
 		$this->title = $title;
102 102
 		$this->item = $item;
103 103
 		$this->id = $field_id;
104 104
 		$this->settings = $settings;
105
-		$this->label_type = $item['label_type'];
105
+		$this->label_type = $item[ 'label_type' ];
106 106
 	}
107 107
 
108 108
 	/**
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 		 */
142 142
 		$field_info_items = apply_filters( 'gravityview_admin_label_item_info', $field_info_items, $this );
143 143
 
144
-		if( $html ) {
144
+		if ( $html ) {
145 145
 
146 146
 			foreach ( $field_info_items as $item ) {
147
-				$class = isset($item['class']) ? sanitize_html_class( $item['class'] ).' description' : 'description';
147
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
148 148
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
149
-				$output .= '<span class="'.$class.'">';
150
-				$output .= esc_html( $item['value'] );
149
+				$output .= '<span class="' . $class . '">';
150
+				$output .= esc_html( $item[ 'value' ] );
151 151
 				$output .= '</span>';
152 152
 			}
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 			$values = wp_list_pluck( $field_info_items, 'value' );
157 157
 
158
-			$output = esc_html( implode(', ', $values) );
158
+			$output = esc_html( implode( ', ', $values ) );
159 159
 
160 160
 		}
161 161
 
@@ -170,53 +170,53 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	function getOutput() {
172 172
 
173
-		$settings_title = sprintf(__('Configure %s Settings', 'gravityview'), ucfirst($this->label_type));
174
-		$delete_title = sprintf(__('Remove %s', 'gravityview'), ucfirst($this->label_type));
175
-		$single_link_title = __('This field links to the Single Entry', 'gravityview');
173
+		$settings_title = sprintf( __( 'Configure %s Settings', 'gravityview' ), ucfirst( $this->label_type ) );
174
+		$delete_title = sprintf( __( 'Remove %s', 'gravityview' ), ucfirst( $this->label_type ) );
175
+		$single_link_title = __( 'This field links to the Single Entry', 'gravityview' );
176 176
 
177 177
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
178 178
 		// TODO: Un-hack this
179
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->') > 0 ) ? 'hide-if-js' : '';
179
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
180 180
 		$settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
181 181
 
182 182
 		// Should we show the icon that the field is being used as a link to single entry?
183
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
184
-		$show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr( $single_link_title ).'"></span>';
183
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
184
+		$show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
185 185
 
186 186
 		// When a field label is empty, use the Field ID
187
-		$label = empty( $this->title ) ? sprintf( _x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id ) : $this->title;
187
+		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
188 188
 
189 189
 		// If there's a custom label, and show label is checked, use that as the field heading
190
-		if( !empty( $this->settings['custom_label'] ) && !empty( $this->settings['show_label'] ) ) {
191
-			$label = $this->settings['custom_label'];
192
-		} else if( !empty( $this->item['customLabel'] ) ) {
193
-			$label = $this->item['customLabel'];
190
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
191
+			$label = $this->settings[ 'custom_label' ];
192
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
193
+			$label = $this->item[ 'customLabel' ];
194 194
 		}
195 195
 
196
-		$output = '<h5 class="selectable gfield field-id-'.esc_attr($this->id).'">';
196
+		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
197 197
 
198 198
 		$label = esc_attr( $label );
199 199
 
200
-		if( !empty( $this->item['parent'] ) ) {
201
-			$label .= ' <small>('.esc_attr( $this->item['parent']['label'] ) .')</small>';
200
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
201
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
202 202
 		}
203 203
 
204 204
 		// Name of field / widget
205
-		$output .= '<span class="gv-field-label" data-original-title="'.esc_attr( $label ).'" title="'. $this->get_item_info( false ) .'">'. $label . '</span>';
205
+		$output .= '<span class="gv-field-label" data-original-title="' . esc_attr( $label ) . '" title="' . $this->get_item_info( false ) . '">' . $label . '</span>';
206 206
 
207 207
 
208
-		$output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr( $delete_title ) .'"></a></span>';
208
+		$output .= '<span class="gv-field-controls">' . $settings_link . $show_as_link . '<a href="#remove" class="dashicons-dismiss dashicons" title="' . esc_attr( $delete_title ) . '"></a></span>';
209 209
 
210 210
 		// Displays only in the field/widget picker.
211
-		if( $field_info = $this->get_item_info() ) {
212
-			$output .= '<span class="gv-field-info">'.$field_info.'</span>';
211
+		if ( $field_info = $this->get_item_info() ) {
212
+			$output .= '<span class="gv-field-info">' . $field_info . '</span>';
213 213
 		}
214 214
 
215 215
 		$output .= '</h5>';
216 216
 
217
-		$container_class = !empty( $this->item['parent'] ) ? ' gv-child-field' : '';
217
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
218 218
 
219
-		$output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr( $this->item['input_type'] ).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>';
219
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
220 220
 
221 221
 		return $output;
222 222
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 
21 21
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
22 22
 
23
-		unset( $field_options['search_filter'] );
23
+		unset( $field_options[ 'search_filter' ] );
24 24
 
25
-		if( 'edit' === $context ) {
25
+		if ( 'edit' === $context ) {
26 26
 			return $field_options;
27 27
 		}
28 28
 
29
-		$add_options['link_to_file'] = array(
29
+		$add_options[ 'link_to_file' ] = array(
30 30
 			'type' => 'checkbox',
31 31
 			'label' => __( 'Display as a Link:', 'gravityview' ),
32
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
32
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
33 33
 			'value' => false,
34 34
 			'merge_tags' => false,
35 35
 		);
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
 		$output_arr = array();
60 60
 
61 61
 		// Get an array of file paths for the field.
62
-		$file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
62
+		$file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
63 63
 
64 64
 		// Process each file path
65
-		foreach( $file_paths as $file_path ) {
65
+		foreach ( $file_paths as $file_path ) {
66 66
 
67 67
 			// If the site is HTTPS, use HTTPS
68
-			if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); }
68
+			if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); }
69 69
 
70 70
 			// This is from Gravity Forms's code
71
-			$file_path = esc_attr(str_replace(" ", "%20", $file_path));
71
+			$file_path = esc_attr( str_replace( " ", "%20", $file_path ) );
72 72
 
73 73
 			// If the field is set to link to the single entry, link to it.
74
-			$link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
74
+			$link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
75 75
 
76 76
 			// Get file path information
77
-			$file_path_info = pathinfo($file_path);
77
+			$file_path_info = pathinfo( $file_path );
78 78
 
79 79
 			$html_format = NULL;
80 80
 
@@ -83,30 +83,30 @@  discard block
 block discarded – undo
83 83
 			$disable_wrapped_link = false;
84 84
 
85 85
 			// Is this an image?
86
-			$image = new GravityView_Image(array(
86
+			$image = new GravityView_Image( array(
87 87
 				'src' => $file_path,
88
-				'class' => 'gv-image gv-field-id-'.$field_settings['id'],
89
-				'alt' => $field_settings['label'],
90
-				'width' => (gravityview_get_context() === 'single' ? NULL : 250)
91
-			));
88
+				'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
89
+				'alt' => $field_settings[ 'label' ],
90
+				'width' => ( gravityview_get_context() === 'single' ? NULL : 250 )
91
+			) );
92 92
 
93 93
 			$content = $image->html();
94 94
 
95 95
 			// The new default content is the image, if it exists. If not, use the file name as the content.
96
-			$content = !empty( $content ) ? $content : $file_path_info['basename'];
96
+			$content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ];
97 97
 
98 98
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
99
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
99
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
100 100
 
101 101
 
102
-			switch( true ) {
102
+			switch ( true ) {
103 103
 
104 104
 				// Audio file
105 105
 				case in_array( $extension, wp_get_audio_extensions() ):
106 106
 
107 107
 					$disable_lightbox = true;
108 108
 
109
-					if( shortcode_exists( 'audio' ) ) {
109
+					if ( shortcode_exists( 'audio' ) ) {
110 110
 
111 111
 						$disable_wrapped_link = true;
112 112
 
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 						 */
118 118
 						$audio_settings = apply_filters( 'gravityview_audio_settings', array(
119 119
 							'src' => $file_path,
120
-							'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
121
-						));
120
+							'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
121
+						) );
122 122
 
123 123
 						/**
124 124
 						 * Generate the audio shortcode
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 					$disable_lightbox = true;
138 138
 
139
-					if( shortcode_exists( 'video' ) ) {
139
+					if ( shortcode_exists( 'video' ) ) {
140 140
 
141 141
 						$disable_wrapped_link = true;
142 142
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 						 */
148 148
 						$video_settings = apply_filters( 'gravityview_video_settings', array(
149 149
 							'src' => $file_path,
150
-							'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
151
-						));
150
+							'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
151
+						) );
152 152
 
153 153
 						/**
154 154
 						 * Generate the video shortcode
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 					break;
171 171
 
172 172
 				// if not image, do not set the lightbox (@since 1.5.3)
173
-				case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
173
+				case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
174 174
 
175 175
 					$disable_lightbox = true;
176 176
 
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 
181 181
 			// If using Link to File, override the content.
182 182
 			// (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
183
-			if( !empty( $field_settings['link_to_file'] ) ) {
183
+			if ( ! empty( $field_settings[ 'link_to_file' ] ) ) {
184 184
 
185 185
 				// Force the content to be the file name
186
-				$content =  $file_path_info["basename"];
186
+				$content = $file_path_info[ "basename" ];
187 187
 
188 188
 				// Restore the wrapped link
189 189
 				$disable_wrapped_link = false;
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 			}
192 192
 
193 193
 			// Whether to use lightbox or not
194
-			if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) {
194
+			if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) {
195 195
 
196
-				$link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array();
196
+				$link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array();
197 197
 
198 198
 			} else {
199 199
 
200 200
 				$link_atts = array(
201
-					'rel' => sprintf( "%s-%s", $gv_class, $entry['id'] ),
201
+					'rel' => sprintf( "%s-%s", $gv_class, $entry[ 'id' ] ),
202 202
 					'target' => '_blank',
203 203
 					'class' => 'thickbox',
204 204
 				);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() );
223 223
 
224 224
 			// If the HTML output hasn't been overridden by the switch statement above, use the default format
225
-			if( !empty( $content ) && empty( $disable_wrapped_link ) ) {
225
+			if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) {
226 226
 
227 227
 				/**
228 228
 				 * Modify the link text (defaults to the file name)
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                 $content = gravityview_get_link( $link, $content, $link_atts );
238 238
 			}
239 239
 
240
-			$output_arr[] = array(
240
+			$output_arr[ ] = array(
241 241
 				'file_path' => $file_path,
242 242
 				'content' => $content
243 243
 			);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-textarea.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
27 27
 
28
-		if( 'edit' === $context ) {
28
+		if ( 'edit' === $context ) {
29 29
 			return $field_options;
30 30
 		}
31 31
 
32
-		$field_options['trim_words'] = array(
32
+		$field_options[ 'trim_words' ] = array(
33 33
 			'type' => 'number',
34 34
 			'merge_tags' => false,
35 35
 			'value' => null,
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
38 38
 		);
39 39
 
40
-        $field_options['make_clickable'] = array(
40
+        $field_options[ 'make_clickable' ] = array(
41 41
             'type' => 'checkbox',
42 42
             'merge_tags' => false,
43 43
             'value' => 0,
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-html.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
29 29
 
30
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
30
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
31 31
 
32 32
 		return $field_options;
33 33
 	}
Please login to merge, or discard this patch.