Completed
Push — master ( 21157a...9cf7be )
by Zack
84:58 queued 65:12
created
uninstall.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		$delete = $this->get_delete_setting();
36 36
 
37
-		if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) {
37
+		if ( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) {
38 38
 			$this->fire_everything();
39 39
 		}
40 40
 	}
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
 		$notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes';
99 99
 
100
-		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
101
-		$approved = __('Approved the Entry for GravityView', 'gravityview');
100
+		$disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' );
101
+		$approved = __( 'Approved the Entry for GravityView', 'gravityview' );
102 102
 
103 103
 		$sql = $wpdb->prepare( "
104 104
 			DELETE FROM $notes_table
Please login to merge, or discard this patch.
gravityview.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 
67 67
 /** Load common & connector functions */
68 68
 require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' );
69
-require_once( GRAVITYVIEW_DIR . 'includes/class-common.php');
70
-require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php');
69
+require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' );
70
+require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' );
71 71
 require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' );
72 72
 require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' );
73 73
 require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' );
74 74
 
75 75
 /** Register Post Types and Rewrite Rules */
76
-require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php');
76
+require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' );
77 77
 
78 78
 /** Add Cache Class */
79
-require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php');
79
+require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' );
80 80
 
81 81
 /** Register hooks that are fired when the plugin is activated and deactivated. */
82
-if( is_admin() ) {
82
+if ( is_admin() ) {
83 83
 	register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) );
84 84
 	register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) );
85 85
 }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public static function getInstance() {
102 102
 
103
-		if( empty( self::$instance ) ) {
103
+		if ( empty( self::$instance ) ) {
104 104
 			self::$instance = new self;
105 105
 		}
106 106
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	private function __construct() {
111 111
 
112 112
 
113
-		if( ! GravityView_Compatibility::is_valid() ) {
113
+		if ( ! GravityView_Compatibility::is_valid() ) {
114 114
 			return;
115 115
 		}
116 116
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function include_files() {
141 141
 
142
-		include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' );
142
+		include_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' );
143 143
 
144 144
 		// Load fields
145 145
 		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' );
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
 			include_once( $gv_field_filename );
151 151
 		}
152 152
 
153
-		include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' );
154
-		include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' );
153
+		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' );
154
+		include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' );
155 155
 
156 156
 		// Load Extensions
157 157
 		// @todo: Convert to a scan of the directory or a method where this all lives
158
-		include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' );
159
-		include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' );
158
+		include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' );
159
+		include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' );
160 160
 
161 161
 		// Load WordPress Widgets
162
-		include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' );
162
+		include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' );
163 163
 
164 164
 		// Load GravityView Widgets
165
-		include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' );
165
+		include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' );
166 166
 
167 167
 		// Add oEmbed
168 168
 		include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' );
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-logging.php' );
172 172
 
173 173
 		include_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' );
174
-		include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php');
174
+		include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php' );
175 175
 		include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' );
176 176
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' );
177 177
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' );
178
-		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */
178
+		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */
179 179
 		include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' );
180 180
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' );
181 181
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' );
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @return bool
191 191
 	 */
192 192
 	public static function is_network_activated() {
193
-		return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) );
193
+		return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) );
194 194
 	}
195 195
 
196 196
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @since 1.7.5.1
256 256
 	 */
257 257
 	public static function include_widget_class() {
258
-		include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' );
258
+		include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' );
259 259
 	}
260 260
 
261 261
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		}
277 277
 		if ( ! $loaded ) {
278 278
 			$locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' );
279
-			$mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo';
279
+			$mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo';
280 280
 			load_textdomain( 'gravityview', $mofile );
281 281
 		}
282 282
 
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 	 */
303 303
 	public function frontend_actions() {
304 304
 
305
-		if( self::is_admin() ) { return; }
305
+		if ( self::is_admin() ) { return; }
306 306
 
307 307
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' );
308
-		include_once( GRAVITYVIEW_DIR .'includes/class-template.php' );
309
-		include_once( GRAVITYVIEW_DIR .'includes/class-api.php' );
310
-		include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' );
308
+		include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' );
309
+		include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' );
310
+		include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' );
311 311
 		include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' );
312 312
 
313 313
 
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public static function get_default_widget_areas() {
334 334
 		$default_areas = array(
335
-			array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ),
336
-			array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ),
335
+			array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ),
336
+			array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ),
337 337
 		);
338 338
 
339 339
 		/**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
      * @param mixed $data Additional data to display
352 352
      * @return void
353 353
      */
354
-    public static function log_debug( $message, $data = null ){
354
+    public static function log_debug( $message, $data = null ) {
355 355
 	    /**
356 356
 	     * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output
357 357
 	     * @param string $message Message to display
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param  string $message log message
366 366
      * @return void
367 367
      */
368
-    public static function log_error( $message, $data = null ){
368
+    public static function log_error( $message, $data = null ) {
369 369
 	    /**
370 370
 	     * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output
371 371
 	     * @param string $message Error message to display
@@ -376,4 +376,4 @@  discard block
 block discarded – undo
376 376
 
377 377
 } // end class GravityView_Plugin
378 378
 
379
-add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1);
379
+add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 );
Please login to merge, or discard this patch.
includes/connector-functions.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
  * @param  mixed $field_id Field ID or Field array
290 290
  * @return string field type
291 291
  */
292
-function gravityview_get_field_type(  $form = null , $field_id = '' ) {
293
-	return GVCommon::get_field_type(  $form, $field_id );
292
+function gravityview_get_field_type( $form = null, $field_id = '' ) {
293
+	return GVCommon::get_field_type( $form, $field_id );
294 294
 }
295 295
 
296 296
 
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
  * @return string HTML of the output. Empty string if $view_id is empty.
304 304
  */
305 305
 function get_gravityview( $view_id = '', $atts = array() ) {
306
-	if( !empty( $view_id ) ) {
307
-		$atts['id'] = $view_id;
306
+	if ( ! empty( $view_id ) ) {
307
+		$atts[ 'id' ] = $view_id;
308 308
 		$args = wp_parse_args( $atts, GravityView_View_Data::get_default_args() );
309 309
 		$GravityView_frontend = GravityView_frontend::getInstance();
310 310
 		$GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) );
@@ -347,15 +347,15 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) {
349 349
 
350
-	if( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) {
350
+	if ( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) {
351 351
 
352 352
 		/** @var GF_Field_Radio|GF_Field_Checkbox $form_field */
353
-		foreach( $form_fields as $form_field ) {
353
+		foreach ( $form_fields as $form_field ) {
354 354
 			$field_id = $form_field->id;
355
-			foreach( $view_fields as $zone ) {
356
-				foreach( $zone as $field ) {
355
+			foreach ( $view_fields as $zone ) {
356
+				foreach ( $zone as $field ) {
357 357
 					// If it's an input, not the parent and the parent ID matches a checkbox or radio
358
-					if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) {
358
+					if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) {
359 359
 						return true;
360 360
 					}
361 361
 				}
Please login to merge, or discard this patch.
includes/class-ajax.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		 * Don't exit if we're running test suite.
37 37
 		 * @since 1.15
38 38
 		 */
39
-		if( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) {
39
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) {
40 40
 			return $mixed;
41 41
 		}
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @return void
51 51
 	 */
52 52
 	function check_ajax_nonce() {
53
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxviews' ) ) {
53
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxviews' ) ) {
54 54
 			$this->_exit( false );
55 55
 		}
56 56
 	}
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 		//check nonce
68 68
 		$this->check_ajax_nonce();
69 69
 
70
-		$context = isset($_POST['context']) ? esc_attr( $_POST['context'] ) : 'directory';
70
+		$context = isset( $_POST[ 'context' ] ) ? esc_attr( $_POST[ 'context' ] ) : 'directory';
71 71
 
72 72
 		// If Form was changed, JS sends form ID, if start fresh, JS sends template_id
73
-		if( !empty( $_POST['form_id'] ) ) {
74
-			do_action( 'gravityview_render_available_fields', (int) $_POST['form_id'], $context );
73
+		if ( ! empty( $_POST[ 'form_id' ] ) ) {
74
+			do_action( 'gravityview_render_available_fields', (int)$_POST[ 'form_id' ], $context );
75 75
 			$this->_exit();
76
-		} elseif( !empty( $_POST['template_id'] ) ) {
77
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
76
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) ) {
77
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
78 78
 			do_action( 'gravityview_render_available_fields', $form, $context );
79 79
 			$this->_exit();
80 80
 		}
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 	function get_active_areas() {
95 95
 		$this->check_ajax_nonce();
96 96
 
97
-		if( empty( $_POST['template_id'] ) ) {
97
+		if ( empty( $_POST[ 'template_id' ] ) ) {
98 98
 			$this->_exit( false );
99 99
 		}
100 100
 
101 101
 		ob_start();
102
-		do_action( 'gravityview_render_directory_active_areas', $_POST['template_id'], 'directory', '', true );
103
-		$response['directory'] = ob_get_clean();
102
+		do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'directory', '', true );
103
+		$response[ 'directory' ] = ob_get_clean();
104 104
 
105 105
 		ob_start();
106
-		do_action( 'gravityview_render_directory_active_areas',  $_POST['template_id'], 'single', '', true );
107
-		$response['single'] = ob_get_clean();
106
+		do_action( 'gravityview_render_directory_active_areas', $_POST[ 'template_id' ], 'single', '', true );
107
+		$response[ 'single' ] = ob_get_clean();
108 108
 
109 109
 		$response = array_map( 'gravityview_strip_whitespace', $response );
110 110
 
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$this->check_ajax_nonce();
121 121
 
122
-		if( empty( $_POST['template_id'] ) ) {
122
+		if ( empty( $_POST[ 'template_id' ] ) ) {
123 123
 			$this->_exit( false );
124 124
 		}
125 125
 
126 126
 		// get the fields xml config file for this specific preset
127
-		$preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST['template_id'] );
127
+		$preset_fields_path = apply_filters( 'gravityview_template_fieldsxml', array(), $_POST[ 'template_id' ] );
128 128
 		// import fields
129
-		if( !empty( $preset_fields_path ) ) {
129
+		if ( ! empty( $preset_fields_path ) ) {
130 130
 			$presets = $this->import_fields( $preset_fields_path );
131 131
 		} else {
132 132
 			$presets = array( 'widgets' => array(), 'fields' => array() );
133 133
 		}
134 134
 
135
-		$template_id = esc_attr( $_POST['template_id'] );
135
+		$template_id = esc_attr( $_POST[ 'template_id' ] );
136 136
 
137 137
 		// template areas
138 138
 		$template_areas_directory = apply_filters( 'gravityview_template_active_areas', array(), $template_id, 'directory' );
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
143 143
 
144 144
 		ob_start();
145
-		do_action('gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets['widgets'] );
146
-		$response['header'] = ob_get_clean();
145
+		do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'header', $default_widget_areas, $presets[ 'widgets' ] );
146
+		$response[ 'header' ] = ob_get_clean();
147 147
 
148 148
 		ob_start();
149
-		do_action('gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets['widgets'] );
150
-		$response['footer'] = ob_get_clean();
149
+		do_action( 'gravityview_render_active_areas', $template_id, 'widget', 'footer', $default_widget_areas, $presets[ 'widgets' ] );
150
+		$response[ 'footer' ] = ob_get_clean();
151 151
 
152 152
 		ob_start();
153
-		do_action('gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets['fields'] );
154
-		$response['directory'] = ob_get_clean();
153
+		do_action( 'gravityview_render_active_areas', $template_id, 'field', 'directory', $template_areas_directory, $presets[ 'fields' ] );
154
+		$response[ 'directory' ] = ob_get_clean();
155 155
 
156 156
 		ob_start();
157
-		do_action('gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets['fields'] );
158
-		$response['single'] = ob_get_clean();
157
+		do_action( 'gravityview_render_active_areas', $template_id, 'field', 'single', $template_areas_single, $presets[ 'fields' ] );
158
+		$response[ 'single' ] = ob_get_clean();
159 159
 
160 160
 		$response = array_map( 'gravityview_strip_whitespace', $response );
161 161
 
@@ -173,26 +173,26 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$this->check_ajax_nonce();
175 175
 
176
-		if( empty( $_POST['template_id'] ) ) {
176
+		if ( empty( $_POST[ 'template_id' ] ) ) {
177 177
 			do_action( 'gravityview_log_error', '[create_preset_form] Cannot create preset form; the template_id is empty.' );
178 178
 			$this->_exit( false );
179 179
 		}
180 180
 
181 181
 		// get the xml for this specific template_id
182
-		$preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST['template_id'] );
182
+		$preset_form_xml_path = apply_filters( 'gravityview_template_formxml', '', $_POST[ 'template_id' ] );
183 183
 
184 184
 		// import form
185 185
 		$form = $this->import_form( $preset_form_xml_path );
186 186
 
187 187
 		// get the form ID
188
-		if( false === $form ) {
188
+		if ( false === $form ) {
189 189
 			// send error to user
190
-			do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int) $_POST['template_id'] );
190
+			do_action( 'gravityview_log_error', '[create_preset_form] Error importing form for template id: ' . (int)$_POST[ 'template_id' ] );
191 191
 
192 192
 			$this->_exit( false );
193 193
 		}
194 194
 
195
-		$this->_exit( '<option value="'.esc_attr( $form['id'] ).'" selected="selected">'.esc_html( $form['title'] ).'</option>' );
195
+		$this->_exit( '<option value="' . esc_attr( $form[ 'id' ] ) . '" selected="selected">' . esc_html( $form[ 'title' ] ) . '</option>' );
196 196
 
197 197
 	}
198 198
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 		do_action( 'gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_or_json_path );
208 208
 
209
-		if( empty( $xml_or_json_path ) || !class_exists('GFExport') || !file_exists( $xml_or_json_path ) ) {
209
+		if ( empty( $xml_or_json_path ) || ! class_exists( 'GFExport' ) || ! file_exists( $xml_or_json_path ) ) {
210 210
 			do_action( 'gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_or_json_path );
211 211
 			return false;
212 212
 		}
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 		do_action( 'gravityview_log_debug', '[import_form] Importing form (Result)', $count );
219 219
 		do_action( 'gravityview_log_debug', '[import_form] Importing form (Form) ', $forms );
220 220
 
221
-		if( $count != 1 || empty( $forms[0]['id'] ) ) {
221
+		if ( $count != 1 || empty( $forms[ 0 ][ 'id' ] ) ) {
222 222
 			do_action( 'gravityview_log_error', '[import_form] Form Import Failed!' );
223 223
 			return false;
224 224
 		}
225 225
 
226 226
 		// import success - return form id
227
-		return $forms[0];
227
+		return $forms[ 0 ];
228 228
 	}
229 229
 
230 230
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	function get_field_options() {
239 239
 		$this->check_ajax_nonce();
240 240
 
241
-		if( empty( $_POST['template'] ) || empty( $_POST['area'] ) || empty( $_POST['field_id'] ) || empty( $_POST['field_type'] ) ) {
241
+		if ( empty( $_POST[ 'template' ] ) || empty( $_POST[ 'area' ] ) || empty( $_POST[ 'field_id' ] ) || empty( $_POST[ 'field_type' ] ) ) {
242 242
 			do_action( 'gravityview_log_error', '[get_field_options] Required fields were not set in the $_POST request. ' );
243 243
 			$this->_exit( false );
244 244
 		}
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 		$_post = array_map( 'esc_attr', $_post );
251 251
 
252 252
 		// The GF type of field: `product`, `name`, `creditcard`, `id`, `text`
253
-		$input_type = isset($_post['input_type']) ? esc_attr( $_post['input_type'] ) : NULL;
254
-		$context = isset($_post['context']) ? esc_attr( $_post['context'] ) : NULL;
253
+		$input_type = isset( $_post[ 'input_type' ] ) ? esc_attr( $_post[ 'input_type' ] ) : NULL;
254
+		$context = isset( $_post[ 'context' ] ) ? esc_attr( $_post[ 'context' ] ) : NULL;
255 255
 
256
-		$response = GravityView_Render_Settings::render_field_options( $_post['field_type'], $_post['template'], $_post['field_id'], $_post['field_label'], $_post['area'], $input_type, '', '', $context  );
256
+		$response = GravityView_Render_Settings::render_field_options( $_post[ 'field_type' ], $_post[ 'template' ], $_post[ 'field_id' ], $_post[ 'field_label' ], $_post[ 'area' ], $input_type, '', '', $context );
257 257
 
258 258
 		$response = gravityview_strip_whitespace( $response );
259 259
 
@@ -274,15 +274,15 @@  discard block
 block discarded – undo
274 274
 		$form = '';
275 275
 
276 276
 		// if form id is set, use it, else, get form from preset
277
-		if( !empty( $_POST['form_id'] ) ) {
277
+		if ( ! empty( $_POST[ 'form_id' ] ) ) {
278 278
 
279
-			$form = (int) $_POST['form_id'];
279
+			$form = (int)$_POST[ 'form_id' ];
280 280
 
281 281
 		}
282 282
 		// get form from preset
283
-		elseif( !empty( $_POST['template_id'] ) ) {
283
+		elseif ( ! empty( $_POST[ 'template_id' ] ) ) {
284 284
 
285
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
285
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
286 286
 
287 287
 		}
288 288
 
@@ -298,27 +298,27 @@  discard block
 block discarded – undo
298 298
 	 * @param  string $template_id Preset template
299 299
 	 *
300 300
 	 */
301
-	static function pre_get_form_fields( $template_id = '') {
301
+	static function pre_get_form_fields( $template_id = '' ) {
302 302
 
303
-		if( empty( $template_id ) ) {
303
+		if ( empty( $template_id ) ) {
304 304
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Template ID not set.' );
305 305
 			return false;
306 306
 		} else {
307 307
 			$form_file = apply_filters( 'gravityview_template_formxml', '', $template_id );
308
-			if( !file_exists( $form_file )  ) {
309
-				do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset ['. $template_id .']. File not found. file: ' . $form_file );
308
+			if ( ! file_exists( $form_file ) ) {
309
+				do_action( 'gravityview_log_error', __METHOD__ . ' - Importing Form Fields for preset [' . $template_id . ']. File not found. file: ' . $form_file );
310 310
 				return false;
311 311
 			}
312 312
 		}
313 313
 
314 314
 		// Load xml parser (from GravityForms)
315
-		if( class_exists( 'GFCommon' ) ) {
315
+		if ( class_exists( 'GFCommon' ) ) {
316 316
 			$xml_parser = GFCommon::get_base_path() . '/xml.php';
317 317
 		} else {
318 318
 			$xml_parser = trailingslashit( WP_PLUGIN_DIR ) . 'gravityforms/xml.php';
319 319
 		}
320 320
 
321
-		if( file_exists( $xml_parser ) ) {
321
+		if ( file_exists( $xml_parser ) ) {
322 322
 			require_once( $xml_parser );
323 323
 		} else {
324 324
 			do_action( 'gravityview_log_debug', __METHOD__ . ' - Gravity Forms XML Parser not found.', $xml_parser );
@@ -329,37 +329,37 @@  discard block
 block discarded – undo
329 329
 		$xmlstr = file_get_contents( $form_file );
330 330
 
331 331
         $options = array(
332
-            "page" => array("unserialize_as_array" => true),
333
-            "form"=> array("unserialize_as_array" => true),
334
-            "field"=> array("unserialize_as_array" => true),
335
-            "rule"=> array("unserialize_as_array" => true),
336
-            "choice"=> array("unserialize_as_array" => true),
337
-            "input"=> array("unserialize_as_array" => true),
338
-            "routing_item"=> array("unserialize_as_array" => true),
339
-            "creditCard"=> array("unserialize_as_array" => true),
340
-            "routin"=> array("unserialize_as_array" => true),
341
-            "confirmation" => array("unserialize_as_array" => true),
342
-            "notification" => array("unserialize_as_array" => true)
332
+            "page" => array( "unserialize_as_array" => true ),
333
+            "form"=> array( "unserialize_as_array" => true ),
334
+            "field"=> array( "unserialize_as_array" => true ),
335
+            "rule"=> array( "unserialize_as_array" => true ),
336
+            "choice"=> array( "unserialize_as_array" => true ),
337
+            "input"=> array( "unserialize_as_array" => true ),
338
+            "routing_item"=> array( "unserialize_as_array" => true ),
339
+            "creditCard"=> array( "unserialize_as_array" => true ),
340
+            "routin"=> array( "unserialize_as_array" => true ),
341
+            "confirmation" => array( "unserialize_as_array" => true ),
342
+            "notification" => array( "unserialize_as_array" => true )
343 343
         );
344 344
 
345
-		$xml = new RGXML($options);
346
-        $forms = $xml->unserialize($xmlstr);
345
+		$xml = new RGXML( $options );
346
+        $forms = $xml->unserialize( $xmlstr );
347 347
 
348
-        if( !$forms ) {
349
-        	do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. Error importing file. (File)', $form_file );
348
+        if ( ! $forms ) {
349
+        	do_action( 'gravityview_log_error', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. Error importing file. (File)', $form_file );
350 350
         	return false;
351 351
         }
352 352
 
353
-        if( !empty( $forms[0] ) && is_array( $forms[0] ) ) {
354
-        	$form = $forms[0];
353
+        if ( ! empty( $forms[ 0 ] ) && is_array( $forms[ 0 ] ) ) {
354
+        	$form = $forms[ 0 ];
355 355
         }
356 356
 
357
-        if( empty( $form ) ) {
357
+        if ( empty( $form ) ) {
358 358
         	do_action( 'gravityview_log_error', '[pre_get_available_fields] $form not set.', $forms );
359 359
         	return false;
360 360
         }
361 361
 
362
-        do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset ['. $template_id .']. (Form)', $form );
362
+        do_action( 'gravityview_log_debug', '[pre_get_available_fields] Importing Form Fields for preset [' . $template_id . ']. (Form)', $form );
363 363
 
364 364
         return $form;
365 365
 
@@ -373,38 +373,38 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	function import_fields( $file ) {
375 375
 
376
-		if( empty( $file ) || !file_exists(  $file ) ) {
376
+		if ( empty( $file ) || ! file_exists( $file ) ) {
377 377
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields. File not found. (File)', $file );
378 378
 			return false;
379 379
 		}
380 380
 
381
-		if( !class_exists('WXR_Parser') ) {
381
+		if ( ! class_exists( 'WXR_Parser' ) ) {
382 382
 			include_once GRAVITYVIEW_DIR . 'includes/lib/xml-parsers/parsers.php';
383 383
 		}
384 384
 
385 385
 		$parser = new WXR_Parser();
386 386
 		$presets = $parser->parse( $file );
387 387
 
388
-		if(is_wp_error( $presets )) {
388
+		if ( is_wp_error( $presets ) ) {
389 389
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Threw WP_Error.', $presets );
390 390
 			return false;
391 391
 		}
392 392
 
393
-		if( empty( $presets['posts'][0]['postmeta'] ) && !is_array( $presets['posts'][0]['postmeta'] ) ) {
393
+		if ( empty( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) && ! is_array( $presets[ 'posts' ][ 0 ][ 'postmeta' ] ) ) {
394 394
 			do_action( 'gravityview_log_error', '[import_fields] Importing Preset Fields failed. Meta not found in file.', $file );
395 395
 			return false;
396 396
 		}
397 397
 
398
-		do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets['posts'][0]['postmeta'] );
398
+		do_action( 'gravityview_log_debug', '[import_fields] postmeta', $presets[ 'posts' ][ 0 ][ 'postmeta' ] );
399 399
 
400 400
 		$fields = $widgets = array();
401
-		foreach( $presets['posts'][0]['postmeta'] as $meta ) {
402
-			switch ($meta['key']) {
401
+		foreach ( $presets[ 'posts' ][ 0 ][ 'postmeta' ] as $meta ) {
402
+			switch ( $meta[ 'key' ] ) {
403 403
 				case '_gravityview_directory_fields':
404
-					$fields = maybe_unserialize( $meta['value'] );
404
+					$fields = maybe_unserialize( $meta[ 'value' ] );
405 405
 					break;
406 406
 				case '_gravityview_directory_widgets':
407
-					$widgets = maybe_unserialize( $meta['value'] );
407
+					$widgets = maybe_unserialize( $meta[ 'value' ] );
408 408
 					break;
409 409
 			}
410 410
 		}
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 		/** gf_entries page - entries table screen */
35 35
 
36 36
 		// capture bulk actions
37
-		add_action( 'init', array( $this, 'process_bulk_action') );
37
+		add_action( 'init', array( $this, 'process_bulk_action' ) );
38 38
 		// add hidden field with approve status
39 39
 		add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
40 40
 		// process ajax approve entry requests
41
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
41
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
42 42
 
43 43
 		// in case entry is edited (on admin or frontend)
44
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
44
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
45 45
 
46 46
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
47 47
 
48 48
 		// adding styles and scripts
49
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
49
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
50 50
 		// bypass Gravity Forms no-conflict mode
51 51
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
52 52
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	function tooltips( $tooltips ) {
63 63
 
64
-		$tooltips['form_gravityview_fields'] = array(
65
-			'title' => __('GravityView Fields', 'gravityview'),
66
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
64
+		$tooltips[ 'form_gravityview_fields' ] = array(
65
+			'title' => __( 'GravityView Fields', 'gravityview' ),
66
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
67 67
 		);
68 68
 
69 69
 		return $tooltips;
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 		}
179 179
 
180 180
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
181
-		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) {
181
+		if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
182 182
 
183 183
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
184 184
 
185 185
 			// The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form.
186
-			$bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2'];
186
+			$bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ];
187 187
 
188 188
 			/**
189 189
 			 * The extra '-' is to make sure that there are at *least* two items in array.
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 			}
200 200
 
201 201
 			// All entries are set to be updated, not just the visible ones
202
-			if ( ! empty( $_POST['all_entries'] ) ) {
202
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
203 203
 
204 204
 				// Convert the current entry search into GF-formatted search criteria
205 205
 				$search = array(
206
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
207
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
208
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
206
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
207
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
208
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
209 209
 				);
210 210
 
211 211
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 			} else {
217 217
 
218
-				$entries = $_POST['lead'];
218
+				$entries = $_POST[ 'lead' ];
219 219
 
220 220
 			}
221 221
 
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private static function update_bulk( $entries, $approved, $form_id ) {
258 258
 
259
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
259
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
260 260
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
261 261
 			return false;
262 262
 		}
263 263
 
264
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
264
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
265 265
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
266 266
 			return false;
267 267
 		}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		// calculate approved field id
272 272
 		$approved_column_id = self::get_approved_column( $form_id );
273 273
 
274
-		foreach( $entries as $entry_id ) {
274
+		foreach ( $entries as $entry_id ) {
275 275
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
276 276
 		}
277 277
 	}
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 	 * @param int $approvedcolumn (default: 0)
291 291
 	 * @return boolean True: It worked; False: it failed
292 292
 	 */
293
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
293
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
294 294
 
295
-		if( !class_exists( 'GFAPI' ) ) {
295
+		if ( ! class_exists( 'GFAPI' ) ) {
296 296
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
297 297
 			return false;
298 298
 		}
299 299
 
300
-		if( empty( $approvedcolumn ) ) {
300
+		if ( empty( $approvedcolumn ) ) {
301 301
 			$approvedcolumn = self::get_approved_column( $form_id );
302 302
 		}
303 303
 
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 		self::update_approved_meta( $entry_id, $approved );
317 317
 
318 318
 		// add note to entry
319
-		if( $result === true ) {
319
+		if ( $result === true ) {
320 320
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
321 321
 
322
-			if( class_exists( 'GravityView_Entry_Notes' ) ){
322
+			if ( class_exists( 'GravityView_Entry_Notes' ) ) {
323 323
 				global $current_user;
324 324
       			get_currentuserinfo();
325 325
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			 */
333 333
 			do_action( 'gravityview_clear_form_cache', $form_id );
334 334
 
335
-		} else if( is_wp_error( $result ) ) {
335
+		} else if ( is_wp_error( $result ) ) {
336 336
 
337 337
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
338 338
 
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
356 356
 
357
-		$approvedcolumn = self::get_approved_column( $form['id'] );
357
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
358 358
 
359 359
         /**
360 360
          * If the form doesn't contain the approve field, don't assume anything.
361 361
          */
362
-        if( empty( $approvedcolumn ) ) {
362
+        if ( empty( $approvedcolumn ) ) {
363 363
             return;
364 364
         }
365 365
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	private static function update_approved_meta( $entry_id, $is_approved ) {
382 382
 
383 383
 		// update entry meta
384
-		if( function_exists('gform_update_meta') ) {
384
+		if ( function_exists( 'gform_update_meta' ) ) {
385 385
 
386 386
 			gform_update_meta( $entry_id, 'is_approved', $is_approved );
387 387
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			 */
394 394
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
395 395
 
396
-			if( empty( $is_approved ) ) {
396
+			if ( empty( $is_approved ) ) {
397 397
 
398 398
 				/**
399 399
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
 		} else {
417 417
 
418
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
418
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
419 419
 
420 420
 		}
421 421
 	}
@@ -427,21 +427,21 @@  discard block
 block discarded – undo
427 427
 	 */
428 428
 	public function ajax_update_approved() {
429 429
 
430
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
430
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
431 431
 
432 432
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
433 433
 
434 434
 			$result = false;
435 435
 		}
436 436
 
437
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
437
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
438 438
 
439 439
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
440 440
 
441 441
 			$result = false;
442 442
 		}
443 443
 
444
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
444
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
445 445
 
446 446
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
447 447
 
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 
451 451
 		else {
452 452
 
453
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
453
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
454 454
 
455
-			if( is_wp_error( $result ) ) {
455
+			if ( is_wp_error( $result ) ) {
456 456
 				/** @var WP_Error $result */
457
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
457
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
458 458
 				$result = false;
459 459
 			}
460 460
 
@@ -474,29 +474,29 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	static public function get_approved_column( $form ) {
476 476
 
477
-        if( empty( $form ) ) {
477
+        if ( empty( $form ) ) {
478 478
             return null;
479 479
         }
480 480
 
481
-        if( !is_array( $form ) ) {
481
+        if ( ! is_array( $form ) ) {
482 482
             $form = GVCommon::get_form( $form );
483 483
         }
484 484
 
485
-		foreach( $form['fields'] as $key => $field ) {
485
+		foreach ( $form[ 'fields' ] as $key => $field ) {
486 486
 
487
-            $field = (array) $field;
487
+            $field = (array)$field;
488 488
 
489
-			if( !empty( $field['gravityview_approved'] ) ) {
490
-				if( !empty($field['inputs'][0]['id']) ) {
491
-					return $field['inputs'][0]['id'];
489
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
490
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
491
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
492 492
 				}
493 493
 			}
494 494
 
495 495
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
496
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
497
-                foreach ( $field['inputs'] as $key2 => $input ) {
498
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
499
-                        return $input['id'];
496
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
497
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
498
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
499
+                        return $input[ 'id' ];
500 500
                     }
501 501
                 }
502 502
             }
@@ -507,18 +507,18 @@  discard block
 block discarded – undo
507 507
 
508 508
 
509 509
 
510
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
510
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
511 511
 
512
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
512
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
513 513
 			return;
514 514
 		}
515 515
 
516
-		if( empty( $entry['id'] ) ) {
516
+		if ( empty( $entry[ 'id' ] ) ) {
517 517
 			return;
518 518
 		}
519 519
 
520
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
521
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
520
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
521
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
522 522
 		}
523 523
 	}
524 524
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
 	function add_scripts_and_styles( $hook ) {
529 529
 
530
-		if( !class_exists( 'RGForms' ) ) {
530
+		if ( ! class_exists( 'RGForms' ) ) {
531 531
 
532 532
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
533 533
 
@@ -536,40 +536,40 @@  discard block
 block discarded – undo
536 536
 
537 537
 		// enqueue styles & scripts gf_entries
538 538
 		// But only if we're on the main Entries page, not on reports pages
539
-		if( RGForms::get_page() === 'entry_list' ) {
539
+		if ( RGForms::get_page() === 'entry_list' ) {
540 540
 
541
-			$form_id = RGForms::get('id');
541
+			$form_id = RGForms::get( 'id' );
542 542
 
543 543
 			// If there are no forms identified, use the first form. That's how GF does it.
544
-			if( empty( $form_id ) && class_exists('RGFormsModel') ) {
544
+			if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
545 545
 				$forms = gravityview_get_forms();
546
-				if( !empty( $forms ) ) {
547
-					$form_id = $forms[0]['id'];
546
+				if ( ! empty( $forms ) ) {
547
+					$form_id = $forms[ 0 ][ 'id' ];
548 548
 				}
549 549
 			}
550 550
 
551 551
 			$approvedcolumn = self::get_approved_column( $form_id );
552 552
 
553
-			wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
553
+			wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
554 554
 			wp_enqueue_style( 'gravityview_entries_list' );
555 555
 
556
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
556
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
557 557
 
558
-			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
558
+			wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
559 559
 			wp_enqueue_script( 'gravityview_gf_entries_scripts' );
560 560
 
561 561
 			wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
562
-				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
562
+				'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
563 563
 				'form_id' => $form_id,
564 564
 				'show_column' => (int)$this->show_approve_entry_column( $form_id ),
565 565
 				'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
566
-				'label_approve' => __( 'Approve', 'gravityview' ) ,
566
+				'label_approve' => __( 'Approve', 'gravityview' ),
567 567
 				'label_disapprove' => __( 'Disapprove', 'gravityview' ),
568 568
 				'bulk_message' => $this->bulk_update_message,
569
-				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
570
-				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
571
-				'column_title' => __( 'Show entry in directory view?', 'gravityview'),
572
-				'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ),
569
+				'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
570
+				'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
571
+				'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
572
+				'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ),
573 573
 			) );
574 574
 
575 575
 		}
@@ -594,13 +594,13 @@  discard block
 block discarded – undo
594 594
 		 * @since 1.7.2
595 595
 		 * @param boolean $hide_if_no_connections
596 596
 		 */
597
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
597
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
598 598
 
599
-		if( $hide_if_no_connections ) {
599
+		if ( $hide_if_no_connections ) {
600 600
 
601 601
 			$connected_views = gravityview_get_connected_views( $form_id );
602 602
 
603
-			if( empty( $connected_views ) ) {
603
+			if ( empty( $connected_views ) ) {
604 604
 				$show_approve_column = false;
605 605
 			}
606 606
 		}
@@ -610,18 +610,18 @@  discard block
 block discarded – undo
610 610
 		 * @param boolean $show_approve_column Whether the column will be shown
611 611
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
612 612
 		 */
613
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
613
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
614 614
 
615 615
 		return $show_approve_column;
616 616
 	}
617 617
 
618 618
 	function register_gform_noconflict_script( $scripts ) {
619
-		$scripts[] = 'gravityview_gf_entries_scripts';
619
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
620 620
 		return $scripts;
621 621
 	}
622 622
 
623 623
 	function register_gform_noconflict_style( $styles ) {
624
-		$styles[] = 'gravityview_entries_list';
624
+		$styles[ ] = 'gravityview_entries_list';
625 625
 		return $styles;
626 626
 	}
627 627
 
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
89
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
90 90
 
91 91
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
92 92
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 
234 234
 			$this->context_view_id = $view_id;
235 235
 
236
-		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) {
236
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) {
237 237
 			/**
238 238
 			 * used on a has_multiple_views context
239 239
 			 * @see GravityView_API::entry_link
240 240
 			 * @see GravityView_View_Data::getInstance()->has_multiple_views()
241 241
 			 */
242
-			$this->context_view_id = $_GET['gvid'];
242
+			$this->context_view_id = $_GET[ 'gvid' ];
243 243
 
244
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
244
+		} elseif ( ! $this->getGvOutputData()->has_multiple_views() ) {
245 245
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
246 246
 			$this->context_view_id = array_pop( $array_keys );
247 247
 			unset( $array_keys );
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		global $post;
270 270
 
271 271
 		// If in admin and NOT AJAX request, get outta here.
272
-		if ( GravityView_Plugin::is_admin() )  {
272
+		if ( GravityView_Plugin::is_admin() ) {
273 273
 			return;
274 274
 		}
275 275
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
283 283
 
284
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
284
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
285 285
 		$this->setPostId( $post_id );
286 286
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
287 287
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
366 366
 		 * @param array $entry Current entry
367 367
 		 */
368
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
368
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
369 369
 
370 370
 		if ( ! $apply_outside_loop ) {
371 371
 			return $title;
372 372
 		}
373 373
 
374 374
 		// User reported WooCommerce doesn't pass two args.
375
-		if ( empty( $passed_post_id ) )  {
375
+		if ( empty( $passed_post_id ) ) {
376 376
 			return $title;
377 377
 		}
378 378
 
379 379
 		// Don't modify the title for anything other than the current view/post.
380 380
 		// This is true for embedded shortcodes and Views.
381
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
381
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
382 382
 			return $title;
383 383
 		}
384 384
 
@@ -388,19 +388,19 @@  discard block
 block discarded – undo
388 388
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
389 389
 		} else {
390 390
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
391
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
391
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
392 392
 					$view_meta = $view_data;
393 393
 					break;
394 394
 				}
395 395
 			}
396 396
 		}
397 397
 
398
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
398
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
399 399
 
400
-			$title = $view_meta['atts']['single_title'];
400
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
401 401
 
402 402
 			// We are allowing HTML in the fields, so no escaping the output
403
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
403
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
404 404
 
405 405
 			$title = do_shortcode( $title );
406 406
 		}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	public function render_view( $passed_args ) {
502 502
 
503 503
 		// validate attributes
504
-		if ( empty( $passed_args['id'] ) ) {
504
+		if ( empty( $passed_args[ 'id' ] ) ) {
505 505
 			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
506 506
 			return null;
507 507
 		}
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 			return null;
524 524
 		}
525 525
 
526
-		$view_id = $passed_args['id'];
526
+		$view_id = $passed_args[ 'id' ];
527 527
 
528 528
 		$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args );
529 529
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 		$passed_args = array_filter( $passed_args, 'strlen' );
537 537
 
538 538
 		//Override shortcode args over View template settings
539
-		$atts = wp_parse_args( $passed_args, $view_data['atts'] );
539
+		$atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] );
540 540
 
541 541
 		do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
542 542
 
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 		 * Don't render View if user isn't allowed to see it
559 559
 		 * @since 1.15
560 560
 		 */
561
-		if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
561
+		if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
562 562
 			return null;
563 563
 		}
564 564
 
565
-		if( $this->isGravityviewPostType() ) {
565
+		if ( $this->isGravityviewPostType() ) {
566 566
 
567 567
 			/**
568 568
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 			 */
575 575
 			$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id );
576 576
 
577
-			$embed_only = ! empty( $atts['embed_only'] );
577
+			$embed_only = ! empty( $atts[ 'embed_only' ] );
578 578
 
579
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
579
+			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
580 580
 				return __( 'You are not allowed to view this content.', 'gravityview' );
581 581
 			}
582 582
 		}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 		$gravityview_view = new GravityView_View( $view_data );
593 593
 
594
-		$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId();
594
+		$post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId();
595 595
 
596 596
 		$gravityview_view->setPostId( $post_id );
597 597
 
@@ -601,20 +601,20 @@  discard block
 block discarded – undo
601 601
 			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
602 602
 
603 603
 			//fetch template and slug
604
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' );
604
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' );
605 605
 
606 606
 			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
607 607
 
608 608
 			/**
609 609
 			 * Disable fetching initial entries for views that don't need it (DataTables)
610 610
 			 */
611
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
611
+			$get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true );
612 612
 
613 613
 			/**
614 614
 			 * Hide View data until search is performed
615 615
 			 * @since 1.5.4
616 616
 			 */
617
-			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) {
617
+			if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) {
618 618
 				$gravityview_view->setHideUntilSearched( true );
619 619
 				$get_entries = false;
620 620
 			}
@@ -622,23 +622,23 @@  discard block
 block discarded – undo
622 622
 
623 623
 			if ( $get_entries ) {
624 624
 
625
-				if ( ! empty( $atts['sort_columns'] ) ) {
625
+				if ( ! empty( $atts[ 'sort_columns' ] ) ) {
626 626
 					// add filter to enable column sorting
627
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
627
+					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 );
628 628
 				}
629 629
 
630
-				$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
630
+				$view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] );
631 631
 
632
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
632
+				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) );
633 633
 
634 634
 			} else {
635 635
 
636 636
 				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
637 637
 
638
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
638
+				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' );
639 639
 			}
640 640
 
641
-			$gravityview_view->setPaging( $view_entries['paging'] );
641
+			$gravityview_view->setPaging( $view_entries[ 'paging' ] );
642 642
 			$gravityview_view->setContext( 'directory' );
643 643
 			$sections = array( 'header', 'body', 'footer' );
644 644
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 			// user requested Single Entry View
648 648
 			do_action( 'gravityview_log_debug', '[render_view] Executing Single View' );
649 649
 
650
-			do_action( 'gravityview_render_entry_'.$view_data['id'] );
650
+			do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] );
651 651
 
652 652
 			$entry = $this->getEntry();
653 653
 
@@ -667,20 +667,20 @@  discard block
 block discarded – undo
667 667
 			// We're in single view, but the view being processed is not the same view the single entry belongs to.
668 668
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
669 669
 			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) {
670
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
670
+				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id );
671 671
 				return null;
672 672
 			}
673 673
 
674 674
 			//fetch template and slug
675
-			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' );
675
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' );
676 676
 			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
677 677
 
678 678
 			//fetch entry detail
679
-			$view_entries['count'] = 1;
680
-			$view_entries['entries'][] = $entry;
681
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
679
+			$view_entries[ 'count' ] = 1;
680
+			$view_entries[ 'entries' ][ ] = $entry;
681
+			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] );
682 682
 
683
-			$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
683
+			$back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null;
684 684
 
685 685
 			// set back link label
686 686
 			$gravityview_view->setBackLinkLabel( $back_link_label );
@@ -690,11 +690,11 @@  discard block
 block discarded – undo
690 690
 		}
691 691
 
692 692
 		// add template style
693
-		self::add_style( $view_data['template_id'] );
693
+		self::add_style( $view_data[ 'template_id' ] );
694 694
 
695 695
 		// Prepare to render view and set vars
696
-		$gravityview_view->setEntries( $view_entries['entries'] );
697
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
696
+		$gravityview_view->setEntries( $view_entries[ 'entries' ] );
697
+		$gravityview_view->setTotalEntries( $view_entries[ 'count' ] );
698 698
 
699 699
 		// If Edit
700 700
 		if ( 'edit' === gravityview_get_context() ) {
@@ -707,11 +707,11 @@  discard block
 block discarded – undo
707 707
 
708 708
 		} else {
709 709
 			// finaly we'll render some html
710
-			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] );
710
+			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] );
711 711
 
712 712
 			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
713 713
 			foreach ( $sections as $section ) {
714
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
714
+				do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' );
715 715
 				$gravityview_view->render( $view_slug, $section, false );
716 716
 			}
717 717
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 				$datetime_format = 'Y-m-d H:i:s';
766 766
 				$search_is_outside_view_bounds = false;
767 767
 
768
-				if( ! empty( $search_criteria[ $key ] ) ) {
768
+				if ( ! empty( $search_criteria[ $key ] ) ) {
769 769
 
770 770
 					$search_date = strtotime( $search_criteria[ $key ] );
771 771
 
@@ -793,14 +793,14 @@  discard block
 block discarded – undo
793 793
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
794 794
 
795 795
 					// Then we override the search and re-set the start date
796
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
796
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
797 797
 				}
798 798
 			}
799 799
 		}
800 800
 
801
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
801
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
802 802
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
803
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
803
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
804 804
 				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
805 805
 			}
806 806
 		}
@@ -818,9 +818,9 @@  discard block
 block discarded – undo
818 818
 	 */
819 819
 	public static function process_search_only_approved( $args, $search_criteria ) {
820 820
 
821
-		if ( ! empty( $args['show_only_approved'] ) ) {
822
-			$search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' );
823
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
821
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
822
+			$search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' );
823
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
824 824
 
825 825
 			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
826 826
 		}
@@ -844,12 +844,12 @@  discard block
 block discarded – undo
844 844
 	 */
845 845
 	public static function is_entry_approved( $entry, $args = array() ) {
846 846
 
847
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
847
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
848 848
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
849 849
 			return true;
850 850
 		}
851 851
 
852
-		$is_approved = gform_get_meta( $entry['id'], 'is_approved' );
852
+		$is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' );
853 853
 
854 854
 		if ( $is_approved ) {
855 855
 			return true;
@@ -882,26 +882,26 @@  discard block
 block discarded – undo
882 882
 		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
883 883
 
884 884
 		// implicity search
885
-		if ( ! empty( $args['search_value'] ) ) {
885
+		if ( ! empty( $args[ 'search_value' ] ) ) {
886 886
 
887 887
 			// Search operator options. Options: `is` or `contains`
888
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
888
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
889 889
 
890
-			$search_criteria['field_filters'][] = array(
890
+			$search_criteria[ 'field_filters' ][ ] = array(
891 891
 				'key' => rgget( 'search_field', $args ), // The field ID to search
892
-				'value' => esc_attr( $args['search_value'] ), // The value to search
892
+				'value' => esc_attr( $args[ 'search_value' ] ), // The value to search
893 893
 				'operator' => $operator,
894 894
 			);
895 895
 		}
896 896
 
897
-		if( $search_criteria !== $original_search_criteria ) {
897
+		if ( $search_criteria !== $original_search_criteria ) {
898 898
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
899 899
 		}
900 900
 
901 901
 		// Handle setting date range
902 902
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
903 903
 
904
-		if( $search_criteria !== $original_search_criteria ) {
904
+		if ( $search_criteria !== $original_search_criteria ) {
905 905
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
906 906
 		}
907 907
 
@@ -912,7 +912,7 @@  discard block
 block discarded – undo
912 912
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
913 913
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
914 914
 		 */
915
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
915
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
916 916
 
917 917
 		return $search_criteria;
918 918
 	}
@@ -958,16 +958,16 @@  discard block
 block discarded – undo
958 958
 		$search_criteria = self::get_search_criteria( $args, $form_id );
959 959
 
960 960
 		// Paging & offset
961
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 );
961
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 );
962 962
 
963 963
 		if ( -1 === $page_size ) {
964 964
 			$page_size = PHP_INT_MAX;
965 965
 		}
966 966
 
967
-		if ( isset( $args['offset'] ) ) {
968
-			$offset = intval( $args['offset'] );
967
+		if ( isset( $args[ 'offset' ] ) ) {
968
+			$offset = intval( $args[ 'offset' ] );
969 969
 		} else {
970
-			$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
970
+			$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
971 971
 			$offset = ( $curr_page - 1 ) * $page_size;
972 972
 		}
973 973
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 			'search_criteria' => $search_criteria,
986 986
 			'sorting' => $sorting,
987 987
 			'paging' => $paging,
988
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
988
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
989 989
 		);
990 990
 
991 991
 		/**
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1011 1011
 		 * @param array $args View configuration args.
1012 1012
 		 */
1013
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1013
+		$parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id );
1014 1014
 
1015 1015
 		do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters );
1016 1016
 
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 	 */
1051 1051
 	public static function updateViewSorting( $args, $form_id ) {
1052 1052
 		$sorting = array();
1053
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1054
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1053
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' );
1054
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' );
1055 1055
 
1056 1056
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1057 1057
 
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 
1092 1092
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1093 1093
 
1094
-		switch ( $sort_field['type'] ) {
1094
+		switch ( $sort_field[ 'type' ] ) {
1095 1095
 
1096 1096
 			case 'address':
1097 1097
 				// Sorting by full address
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 					 */
1109 1109
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1110 1110
 
1111
-					switch( strtolower( $address_part ) ){
1111
+					switch ( strtolower( $address_part ) ) {
1112 1112
 						case 'street':
1113 1113
 							$sort_field_id .= '.1';
1114 1114
 							break;
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 		 */
1189 1189
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1190 1190
 
1191
-		if ( empty( $single_entry ) ){
1191
+		if ( empty( $single_entry ) ) {
1192 1192
 			return false;
1193 1193
 		} else {
1194 1194
 			return $single_entry;
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1216 1216
 				 * @since 1.15
1217 1217
 				 */
1218
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1218
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1219 1219
 					continue;
1220 1220
 				}
1221 1221
 
@@ -1224,19 +1224,19 @@  discard block
 block discarded – undo
1224 1224
 				$css_dependencies = array();
1225 1225
 
1226 1226
 				// If the thickbox is enqueued, add dependencies
1227
-				if ( ! empty( $data['atts']['lightbox'] ) ) {
1227
+				if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) {
1228 1228
 
1229 1229
 					/**
1230 1230
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1231 1231
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1232 1232
 					 */
1233
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1233
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1234 1234
 
1235 1235
 					/**
1236 1236
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1237 1237
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1238 1238
 					 */
1239
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1239
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1240 1240
 				}
1241 1241
 
1242 1242
 				/**
@@ -1244,25 +1244,25 @@  discard block
 block discarded – undo
1244 1244
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1245 1245
 				 * @since 1.15
1246 1246
 				 */
1247
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1248
-					$css_dependencies[] = 'dashicons';
1247
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1248
+					$css_dependencies[ ] = 'dashicons';
1249 1249
 				}
1250 1250
 
1251 1251
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1252 1252
 
1253 1253
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1254 1254
 
1255
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1255
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1256 1256
 
1257 1257
 				wp_enqueue_script( 'gravityview-fe-view' );
1258 1258
 
1259
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1259
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1260 1260
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1261 1261
 				}
1262 1262
 
1263 1263
 				wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1264 1264
 
1265
-				self::add_style( $data['template_id'] );
1265
+				self::add_style( $data[ 'template_id' ] );
1266 1266
 
1267 1267
 			}
1268 1268
 
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 		} elseif ( empty( $template_id ) ) {
1299 1299
 			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1300 1300
 		} else {
1301
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1301
+			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) );
1302 1302
 		}
1303 1303
 
1304 1304
 	}
@@ -1323,11 +1323,11 @@  discard block
 block discarded – undo
1323 1323
 		 * Not a table-based template; don't add sort icons
1324 1324
 		 * @since 1.12
1325 1325
 		 */
1326
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1326
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1327 1327
 			return $label;
1328 1328
 		}
1329 1329
 
1330
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1330
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1331 1331
 			return $label;
1332 1332
 		}
1333 1333
 
@@ -1335,29 +1335,29 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
 		$class = 'gv-sort icon';
1337 1337
 
1338
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1338
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1339 1339
 
1340 1340
 		$sort_args = array(
1341
-			'sort' => $field['id'],
1341
+			'sort' => $field[ 'id' ],
1342 1342
 			'dir' => 'asc',
1343 1343
 		);
1344 1344
 
1345
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1345
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1346 1346
 			//toggle sorting direction.
1347
-			if ( 'asc' === $sorting['direction'] ) {
1348
-				$sort_args['dir'] = 'desc';
1347
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1348
+				$sort_args[ 'dir' ] = 'desc';
1349 1349
 				$class .= ' gv-icon-sort-desc';
1350 1350
 			} else {
1351
-				$sort_args['dir'] = 'asc';
1351
+				$sort_args[ 'dir' ] = 'asc';
1352 1352
 				$class .= ' gv-icon-sort-asc';
1353 1353
 			}
1354 1354
 		} else {
1355 1355
 			$class .= ' gv-icon-caret-up-down';
1356 1356
 		}
1357 1357
 
1358
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1358
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1359 1359
 
1360
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1360
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1361 1361
 
1362 1362
 	}
1363 1363
 
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 		$field_type = $field_id;
1377 1377
 
1378
-		if( is_numeric( $field_id ) ) {
1378
+		if ( is_numeric( $field_id ) ) {
1379 1379
 			$field = GFFormsModel::get_field( $form, $field_id );
1380 1380
 			$field_type = $field->type;
1381 1381
 		}
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 			return false;
1399 1399
 		}
1400 1400
 
1401
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1401
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1402 1402
 
1403 1403
 	}
1404 1404
 
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if ( ! self::$instance ) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+        add_action( 'admin_init', array( $this, 'add_caps' ) );
60 60
 	}
61 61
 
62 62
 
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if ( ! $usercaps || ! $caps ) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
91
+			foreach ( $all_gravityview_caps as $gv_cap ) {
92 92
 				$usercaps[ $gv_cap ] = true;
93 93
 			}
94 94
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$all = $administrator;
305 305
 
306 306
 		// If role is set, return caps_to_check for just that role.
307
-		if( $single_role ) {
307
+		if ( $single_role ) {
308 308
 			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
309 309
 			return $flat_array ? $caps : array( $single_role => $caps );
310 310
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
 		$has_cap = false;
336 336
 
337
-		if( empty( $caps_to_check ) ) {
337
+		if ( empty( $caps_to_check ) ) {
338 338
 			return $has_cap;
339 339
 		}
340 340
 
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
343 343
 
344 344
 		foreach ( $caps_to_check as $cap ) {
345
-			if( ! is_null( $object_id ) ) {
345
+			if ( ! is_null( $object_id ) ) {
346 346
 				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
347 347
 			} else {
348 348
 				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
349 349
 			}
350 350
 			// At the first successful response, stop checking
351
-			if( $has_cap ) {
351
+			if ( $has_cap ) {
352 352
 				break;
353 353
 			}
354 354
 		}
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 		$all_gravityview_caps = self::all_caps();
373 373
 
374 374
 		// Are there any $caps_to_check that are from GravityView?
375
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
376
-			$caps_to_check[] = 'gravityview_full_access';
375
+		if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
376
+			$caps_to_check[ ] = 'gravityview_full_access';
377 377
 		}
378 378
 
379 379
 		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
380 380
 
381 381
 		// Are there any $caps_to_check that are from Gravity Forms?
382
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
383
-			$caps_to_check[] = 'gform_full_access';
382
+		if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
383
+			$caps_to_check[ ] = 'gform_full_access';
384 384
 		}
385 385
 
386 386
 		return array_unique( $caps_to_check );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			$capabilities = self::all_caps();
403 403
 
404 404
 			// Loop through each role and remove GV caps_to_check
405
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
405
+			foreach ( $wp_roles->get_names() as $role_slug => $role_name ) {
406 406
 				foreach ( $capabilities as $cap ) {
407 407
 					$wp_roles->remove_cap( $role_slug, $cap );
408 408
 				}
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function get_instance() {
87 87
 
88
-		if( empty( self::$instance ) ) {
88
+		if ( empty( self::$instance ) ) {
89 89
 			self::$instance = new self;
90 90
 		}
91 91
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
120 120
 
121
-		if( $with_values ) {
121
+		if ( $with_values ) {
122 122
 			$operators_with_values = array();
123
-			foreach( $operators as $key ) {
123
+			foreach ( $operators as $key ) {
124 124
 				$operators_with_values[ $key ] = '';
125 125
 			}
126 126
 			return $operators_with_values;
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	function set_operation( $operation = '' ) {
139 139
 
140
-		if( empty( $operation ) ) {
140
+		if ( empty( $operation ) ) {
141 141
 			return false;
142 142
 		}
143 143
 
144 144
 		$operators = $this->get_operators( false );
145 145
 
146
-		if( !in_array( $operation, $operators ) ) {
147
-			do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation );
146
+		if ( ! in_array( $operation, $operators ) ) {
147
+			do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation );
148 148
 			return false;
149 149
 		}
150 150
 
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	function setup_operation_and_comparison() {
166 166
 
167
-		foreach( $this->atts as $key => $value ) {
167
+		foreach ( $this->atts as $key => $value ) {
168 168
 
169 169
 			$valid = $this->set_operation( $key );
170 170
 
171
-			if( $valid ) {
171
+			if ( $valid ) {
172 172
 				$this->comparison = $value;
173 173
 				return true;
174 174
 			}
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
 		$this->parse_atts();
199 199
 
200 200
 		// We need an "if"
201
-		if( false === $this->if ) {
202
-			do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->atts );
201
+		if ( false === $this->if ) {
202
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->atts );
203 203
 			return null;
204 204
 		}
205 205
 
206 206
 		$setup = $this->setup_operation_and_comparison();
207 207
 
208 208
 		// We need an operation and comparison value
209
-		if( ! $setup ) {
210
-			do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts );
209
+		if ( ! $setup ) {
210
+			do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts );
211 211
 			return null;
212 212
 		}
213 213
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	function get_output() {
240 240
 
241
-		if( $this->is_match ) {
241
+		if ( $this->is_match ) {
242 242
 			$output = $this->content;
243 243
 		} else {
244 244
 			$output = $this->else_content;
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 		 * @param string $output HTML/text output
253 253
 		 * @param GVLogic_Shortcode $this This class
254 254
 		 */
255
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
255
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
256 256
 
257
-		do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output );
257
+		do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output );
258 258
 
259 259
 		return $output;
260 260
 	}
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 
271 271
 		$content = explode( '[else]', $this->passed_content );
272 272
 
273
-		$this->content = $content[0];
273
+		$this->content = $content[ 0 ];
274 274
 
275
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
275
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
276 276
 
277
-		$this->else_content = isset( $content[1] ) ? $content[1] : $else_attr;
277
+		$this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr;
278 278
 	}
279 279
 
280 280
 	/**
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 		$this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts;
298 298
 
299 299
 		// Strip whitespace if it's not default false
300
-		$this->if = is_string( $this->atts['if'] ) ? trim( $this->atts['if'] ) : false;
300
+		$this->if = is_string( $this->atts[ 'if' ] ) ? trim( $this->atts[ 'if' ] ) : false;
301 301
 
302 302
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
303
-		unset( $this->atts['if'] );
303
+		unset( $this->atts[ 'if' ] );
304 304
 	}
305 305
 }
306 306
 
Please login to merge, or discard this patch.
includes/class-gv-license-handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @return GV_License_Handler
35 35
 	 */
36 36
 	public static function get_instance( GravityView_Settings $GFAddOn ) {
37
-		if( empty( self::$instance ) ) {
37
+		if ( empty( self::$instance ) ) {
38 38
 			self::$instance = new self( $GFAddOn );
39 39
 		}
40 40
 		return self::$instance;
@@ -60,37 +60,37 @@  discard block
 block discarded – undo
60 60
 		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
61 61
 		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
62 62
 
63
-		if( !empty( $key ) ) {
63
+		if ( ! empty( $key ) ) {
64 64
 			$response = $this->Addon->get_app_setting( 'license_key_response' );
65
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
65
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
66 66
 		} else {
67 67
 			$response = array();
68 68
 		}
69 69
 
70 70
 		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
71 71
 			'license_box' => $this->get_license_message( $response )
72
-		));
72
+		) );
73 73
 
74 74
 
75 75
 		$fields = array(
76 76
 			array(
77 77
 				'name'  => 'edd-activate',
78
-				'value' => __('Activate License', 'gravityview'),
79
-				'data-pending_text' => __('Verifying license&hellip;', 'gravityview'),
78
+				'value' => __( 'Activate License', 'gravityview' ),
79
+				'data-pending_text' => __( 'Verifying license&hellip;', 'gravityview' ),
80 80
 				'data-edd_action' => 'activate_license',
81 81
 				'class' => 'button-primary',
82 82
 			),
83 83
 			array(
84 84
 				'name'  => 'edd-deactivate',
85
-				'value' => __('Deactivate License', 'gravityview'),
86
-				'data-pending_text' => __('Deactivating license&hellip;', 'gravityview'),
85
+				'value' => __( 'Deactivate License', 'gravityview' ),
86
+				'data-pending_text' => __( 'Deactivating license&hellip;', 'gravityview' ),
87 87
 				'data-edd_action' => 'deactivate_license',
88 88
 				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
89 89
 			),
90 90
 			array(
91 91
 				'name'  => 'edd-check',
92
-				'value' => __('Check License', 'gravityview'),
93
-				'data-pending_text' => __('Verifying license&hellip;', 'gravityview'),
92
+				'value' => __( 'Check License', 'gravityview' ),
93
+				'data-pending_text' => __( 'Verifying license&hellip;', 'gravityview' ),
94 94
 				'title' => 'Check the license before saving it',
95 95
 				'data-edd_action' => 'check_license',
96 96
 				'class' => 'button-secondary',
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 
101 101
 		$class = 'button gv-edd-action';
102 102
 
103
-		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
103
+		$class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
104 104
 
105 105
 		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
106 106
 
107 107
 		$submit = '<div class="gv-edd-button-wrapper">';
108 108
 		foreach ( $fields as $field ) {
109
-			$field['type'] = 'button';
110
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
111
-			$field['style'] = 'margin-left: 10px;';
112
-			if( $disabled_attribute ) {
113
-				$field['disabled'] = $disabled_attribute;
109
+			$field[ 'type' ] = 'button';
110
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
111
+			$field[ 'style' ] = 'margin-left: 10px;';
112
+			if ( $disabled_attribute ) {
113
+				$field[ 'disabled' ] = $disabled_attribute;
114 114
 			}
115 115
 			$submit .= $this->Addon->settings_submit( $field, $echo );
116 116
 		}
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	private function setup_edd() {
128 128
 
129
-		if( !class_exists('EDD_SL_Plugin_Updater') ) {
130
-			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
129
+		if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
130
+			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' );
131 131
 		}
132 132
 
133 133
 		// setup the updater
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 			'url'       => home_url(),
164 164
 		);
165 165
 
166
-		if( !empty( $action ) ) {
167
-			$settings['edd_action'] = esc_attr( $action );
166
+		if ( ! empty( $action ) ) {
167
+			$settings[ 'edd_action' ] = esc_attr( $action );
168 168
 		}
169 169
 
170 170
 		$settings = array_map( 'urlencode', $settings );
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	private function _license_get_remote_response( $data, $license = '' ) {
180 180
 
181
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
181
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
182 182
 
183 183
 		$url = add_query_arg( $api_params, self::url );
184 184
 
185 185
 		$response = wp_remote_get( $url, array(
186 186
 			'timeout'   => 15,
187 187
 			'sslverify' => false,
188
-		));
188
+		) );
189 189
 
190 190
 		if ( is_wp_error( $response ) ) {
191 191
 			return array();
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		// Not JSON
197 197
 		if ( empty( $license_data ) ) {
198 198
 
199
-			delete_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid' );
199
+			delete_transient( 'gravityview_' . esc_attr( $data[ 'field_id' ] ) . '_valid' );
200 200
 
201 201
 			// Change status
202 202
 			return array();
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	function get_license_message( $license_data ) {
220 220
 
221
-		if( empty( $license_data ) ) {
221
+		if ( empty( $license_data ) ) {
222 222
 			$class = 'hide';
223 223
 			$message = '';
224 224
 		} else {
225 225
 
226
-			if( ! empty( $license_data->error ) ) {
226
+			if ( ! empty( $license_data->error ) ) {
227 227
 				$class = 'error';
228 228
 				$string_key = $license_data->license;
229 229
 			} else {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				$string_key = $license_data->license;
232 232
 			}
233 233
 
234
-			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
234
+			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) );
235 235
 		}
236 236
 
237 237
 		return $this->generate_license_box( $message, $class );
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function license_call( $array = array() ) {
274 274
 
275
-		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
276
-		$data = empty( $array ) ? $_POST['data'] : $array;
275
+		$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
276
+		$data = empty( $array ) ? $_POST[ 'data' ] : $array;
277 277
 		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
278 278
 
279
-		if ( $is_ajax && empty( $data['license'] ) ) {
280
-			die( - 1 );
279
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
280
+			die( -1 );
281 281
 		}
282 282
 
283 283
 		// If the user isn't allowed to edit settings, show an error message
284
-		if( ! $has_cap ) {
284
+		if ( ! $has_cap ) {
285 285
 			$license_data = new stdClass();
286 286
 			$license_data->error = 'capability';
287 287
 			$license_data->message = $this->get_license_message( $license_data );
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 			$json = json_encode( $license_data );
306 306
 
307
-			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
307
+			$update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) );
308 308
 
309
-			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
309
+			$is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX );
310 310
 
311 311
 			// Failed is the response from trying to de-activate a license and it didn't work.
312 312
 			// This likely happened because people entered in a different key and clicked "Deactivate",
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 			// most likely a mistake.
315 315
 			if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
316 316
 
317
-				if ( ! empty( $data['field_id'] ) ) {
318
-					set_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid', $license_data, DAY_IN_SECONDS );
317
+				if ( ! empty( $data[ 'field_id' ] ) ) {
318
+					set_transient( 'gravityview_' . esc_attr( $data[ 'field_id' ] ) . '_valid', $license_data, DAY_IN_SECONDS );
319 319
 				}
320 320
 
321 321
 				$this->license_call_update_settings( $license_data, $data );
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		if ( $is_ajax ) {
327 327
 			exit( $json );
328 328
 		} else { // Non-ajax call
329
-			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
329
+			return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json;
330 330
 		}
331 331
 	}
332 332
 
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 		// Update option with passed data license
341 341
 		$settings = $this->Addon->get_app_settings();
342 342
 
343
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
344
-		$settings['license_key_status'] = $license_data->license;
345
-		$settings['license_key_response'] = (array)$license_data;
343
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
344
+		$settings[ 'license_key_status' ] = $license_data->license;
345
+		$settings[ 'license_key_response' ] = (array)$license_data;
346 346
 
347 347
 		$this->Addon->update_app_settings( $settings );
348 348
 	}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @return string Renewal or account URL
355 355
 	 */
356 356
 	private function get_license_renewal_url( $license_data ) {
357
-		$renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
357
+		$renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
358 358
 		return $renew_license_url;
359 359
 	}
360 360
 
@@ -368,30 +368,30 @@  discard block
 block discarded – undo
368 368
 
369 369
 
370 370
 		$strings = array(
371
-			'status' => esc_html__('Status', 'gravityview'),
372
-			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
373
-			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
374
-			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
375
-			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
376
-			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
377
-			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
378
-			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
379
-			'missing' => esc_html__('The license key was not defined.', 'gravityview'),
380
-			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
381
-			'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
371
+			'status' => esc_html__( 'Status', 'gravityview' ),
372
+			'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ),
373
+			'failed'  => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ),
374
+			'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
375
+			'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
376
+			'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ),
377
+			'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ),
378
+			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
379
+			'missing' => esc_html__( 'The license key was not defined.', 'gravityview' ),
380
+			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
381
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
382 382
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
383 383
 
384
-			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
385
-			'activate_license' => esc_html__('Activate License', 'gravityview'),
386
-			'deactivate_license' => esc_html__('Deactivate License', 'gravityview'),
387
-			'check_license' => esc_html__('Verify License', 'gravityview'),
384
+			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
385
+			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
386
+			'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ),
387
+			'check_license' => esc_html__( 'Verify License', 'gravityview' ),
388 388
 		);
389 389
 
390
-		if( empty( $status ) ) {
390
+		if ( empty( $status ) ) {
391 391
 			return $strings;
392 392
 		}
393 393
 
394
-		if( isset( $strings[ $status ] ) ) {
394
+		if ( isset( $strings[ $status ] ) ) {
395 395
 			return $strings[ $status ];
396 396
 		}
397 397
 
@@ -401,19 +401,19 @@  discard block
 block discarded – undo
401 401
 	public function validate_license_key( $value, $field ) {
402 402
 
403 403
 		// No license? No status.
404
-		if( empty( $value ) ) {
404
+		if ( empty( $value ) ) {
405 405
 			return NULL;
406 406
 		}
407 407
 
408
-		$response = $this->license_call(array(
408
+		$response = $this->license_call( array(
409 409
 			'license' => $this->Addon->get_app_setting( 'license_key' ),
410 410
 			'edd_action' => 'check_license',
411
-			'field_id' => $field['name'],
412
-		));
411
+			'field_id' => $field[ 'name' ],
412
+		) );
413 413
 
414 414
 		$response = is_string( $response ) ? json_decode( $response, true ) : $response;
415 415
 
416
-		switch( $response['license'] ) {
416
+		switch ( $response[ 'license' ] ) {
417 417
 			case 'valid':
418 418
 				$return = true;
419 419
 				break;
Please login to merge, or discard this patch.