Completed
Pull Request — develop (#1572)
by Zack
19:45
created
future/includes/class-gv-collection-view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			 * @deprecated
115 115
 			 * @see The `gravityview/view_collection/from_post/meta_keys` filter.
116 116
 			 */
117
-			$meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
117
+			$meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
118 118
 
119 119
 			/** What about inside post meta values? */
120 120
 			foreach ( $meta_keys as $meta_key ) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 
169 169
 		/** Let's find us some [gravityview] shortcodes perhaps. */
170 170
 		foreach ( Shortcode::parse( $content ) as $shortcode ) {
171
-			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) {
171
+			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) {
172 172
 				continue;
173 173
 			}
174 174
 
175
-			if ( is_numeric( $shortcode->atts['id'] ) ) {
176
-				$view = View::by_id( $shortcode->atts['id'] );
175
+			if ( is_numeric( $shortcode->atts[ 'id' ] ) ) {
176
+				$view = View::by_id( $shortcode->atts[ 'id' ] );
177 177
 				if ( ! $view ) {
178 178
 					continue;
179 179
 				}
Please login to merge, or discard this patch.
includes/class-gravityview-admin-notices.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
 	public function dismiss_notice() {
61 61
 
62 62
 		// No dismiss sent
63
-		if( empty( $_GET['gv-dismiss'] ) || empty( $_GET['notice'] ) ) {
63
+		if ( empty( $_GET[ 'gv-dismiss' ] ) || empty( $_GET[ 'notice' ] ) ) {
64 64
 			return;
65 65
 		}
66 66
 
67 67
 		// Invalid nonce
68
-		if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
68
+		if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) {
69 69
 			return;
70 70
 		}
71 71
 
72
-		$notice_id = esc_attr( $_GET['notice'] );
72
+		$notice_id = esc_attr( $_GET[ 'notice' ] );
73 73
 
74 74
 		//don't display a message if use has dismissed the message for this version
75 75
 		$dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' );
76 76
 
77
-		$dismissed_notices[] = $notice_id;
77
+		$dismissed_notices[ ] = $notice_id;
78 78
 
79 79
 		$dismissed_notices = array_unique( $dismissed_notices );
80 80
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	private function is_notice_dismissed( $notice ) {
98 98
 
99 99
 		// There are no dismissed notices.
100
-		if( empty( self::$dismissed_notices ) ) {
100
+		if ( empty( self::$dismissed_notices ) ) {
101 101
 			return false;
102 102
 		}
103 103
 
104 104
 		// Has the
105
-		$is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices );
105
+		$is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices );
106 106
 
107 107
 		return $is_dismissed ? true : false;
108 108
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	private function check_show_multisite_notices() {
129 129
 
130
-		if( ! is_multisite() ) {
130
+		if ( ! is_multisite() ) {
131 131
 			return true;
132 132
 		}
133 133
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		}
138 138
 
139 139
 		// or they don't have admin capabilities
140
-		if( ! is_super_admin() ) {
140
+		if ( ! is_super_admin() ) {
141 141
 			return false;
142 142
 		}
143 143
 
@@ -160,48 +160,48 @@  discard block
 block discarded – undo
160 160
 		 */
161 161
 		$notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices );
162 162
 
163
-		if( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
163
+		if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
164 164
 			return;
165 165
 		}
166 166
 
167 167
 		//don't display a message if use has dismissed the message for this version
168 168
 		// TODO: Use get_user_meta instead of get_transient
169
-		self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
169
+		self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
170 170
 
171 171
 		$output = '';
172 172
 
173
-		foreach( $notices as $notice ) {
173
+		foreach ( $notices as $notice ) {
174 174
 
175 175
 			// If the user doesn't have the capability to see the warning
176
-			if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) {
176
+			if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) {
177 177
 				gravityview()->log->debug( 'Notice not shown because user does not have the capability to view it.', array( 'data' => $notice ) );
178 178
 				continue;
179 179
 			}
180 180
 
181
-			if( true === $this->is_notice_dismissed( $notice ) ) {
181
+			if ( true === $this->is_notice_dismissed( $notice ) ) {
182 182
 				gravityview()->log->debug( 'Notice not shown because the notice has already been dismissed.', array( 'data' => $notice ) );
183 183
 				continue;
184 184
 			}
185 185
 
186
-			$output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">';
186
+			$output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">';
187 187
 
188 188
 			// Too cute to leave out.
189 189
 			$output .= gravityview_get_floaty();
190 190
 
191
-			if( !empty( $notice['title'] ) ) {
192
-				$output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>';
191
+			if ( ! empty( $notice[ 'title' ] ) ) {
192
+				$output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>';
193 193
 			}
194 194
 
195
-			$message = isset( $notice['message'] ) ? $notice['message'] : '';
195
+			$message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : '';
196 196
 
197
-			if( !empty( $notice['dismiss'] ) ) {
197
+			if ( ! empty( $notice[ 'dismiss' ] ) ) {
198 198
 
199
-				$dismiss = esc_attr($notice['dismiss']);
199
+				$dismiss = esc_attr( $notice[ 'dismiss' ] );
200 200
 
201 201
 				$url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) );
202 202
 
203 203
 				$align = is_rtl() ? 'alignleft' : 'alignright';
204
-				$message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>';
204
+				$message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>';
205 205
 			}
206 206
 
207 207
 			$output .= wpautop( $message );
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public static function add_notice( $notice = array() ) {
235 235
 
236
-		if( !isset( $notice['message'] ) ) {
236
+		if ( ! isset( $notice[ 'message' ] ) ) {
237 237
 			gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) );
238 238
 			return;
239 239
 		}
240 240
 
241
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
241
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
242 242
 
243
-		self::$admin_notices[] = $notice;
243
+		self::$admin_notices[ ] = $notice;
244 244
 	}
245 245
 }
246 246
 
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 3 patches
Doc Comments   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,6 +64,9 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
 
67
+    /**
68
+     * @param string $component
69
+     */
67 70
     private function load_components( $component ) {
68 71
 
69 72
         $dir = trailingslashit( self::$file );
@@ -104,7 +107,7 @@  discard block
 block discarded – undo
104 107
 	 *
105 108
 	 * @param array $args Existing reserved args
106 109
 	 *
107
-	 * @return array
110
+	 * @return string[]
108 111
 	 */
109 112
 	public function add_reserved_arg( $args ) {
110 113
 
@@ -200,7 +203,7 @@  discard block
 block discarded – undo
200 203
      * "You can edit this post from the post page" fields, for example.
201 204
      *
202 205
      * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
206
+     * @param integer $view_id int GravityView view id
204 207
      * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205 208
      * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206 209
      * @return string
@@ -303,7 +306,7 @@  discard block
 block discarded – undo
303 306
      * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
304 307
      *
305 308
      * @param  array $entry Gravity Forms entry array
306
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
309
+     * @param integer $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
307 310
      * @return bool
308 311
      */
309 312
     public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -18,84 +18,84 @@  discard block
 block discarded – undo
18 18
 
19 19
 class GravityView_Edit_Entry {
20 20
 
21
-    /**
22
-     * @var string
23
-     */
21
+	/**
22
+	 * @var string
23
+	 */
24 24
 	static $file;
25 25
 
26 26
 	static $instance;
27 27
 
28
-    /**
29
-     * Component instances.
30
-     * @var array
31
-     */
32
-    public $instances = array();
28
+	/**
29
+	 * Component instances.
30
+	 * @var array
31
+	 */
32
+	public $instances = array();
33 33
 
34 34
 
35 35
 	function __construct() {
36 36
 
37
-        self::$file = plugin_dir_path( __FILE__ );
37
+		self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
40
-            $this->load_components( 'admin' );
41
-        }
39
+		if( is_admin() ) {
40
+			$this->load_components( 'admin' );
41
+		}
42 42
 
43 43
 		$this->load_components( 'locking' );
44 44
 
45
-        $this->load_components( 'render' );
45
+		$this->load_components( 'render' );
46 46
 
47
-        // If GF User Registration Add-on exists
48
-        $this->load_components( 'user-registration' );
47
+		// If GF User Registration Add-on exists
48
+		$this->load_components( 'user-registration' );
49 49
 
50
-        $this->add_hooks();
50
+		$this->add_hooks();
51 51
 
52 52
 		// Process hooks for addons that may or may not be present
53 53
 		$this->addon_specific_hooks();
54 54
 	}
55 55
 
56 56
 
57
-    static function getInstance() {
57
+	static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
60
-            self::$instance = new GravityView_Edit_Entry;
61
-        }
59
+		if( empty( self::$instance ) ) {
60
+			self::$instance = new GravityView_Edit_Entry;
61
+		}
62 62
 
63
-        return self::$instance;
64
-    }
63
+		return self::$instance;
64
+	}
65 65
 
66 66
 
67
-    private function load_components( $component ) {
67
+	private function load_components( $component ) {
68 68
 
69
-        $dir = trailingslashit( self::$file );
69
+		$dir = trailingslashit( self::$file );
70 70
 
71
-        $filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
-        $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
71
+		$filename  = $dir . 'class-edit-entry-' . $component . '.php';
72
+		$classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) );
73 73
 
74
-        // Loads component and pass extension's instance so that component can
75
-        // talk each other.
76
-        require_once $filename;
77
-        $this->instances[ $component ] = new $classname( $this );
78
-        $this->instances[ $component ]->load();
74
+		// Loads component and pass extension's instance so that component can
75
+		// talk each other.
76
+		require_once $filename;
77
+		$this->instances[ $component ] = new $classname( $this );
78
+		$this->instances[ $component ]->load();
79 79
 
80
-    }
80
+	}
81 81
 
82
-    private function add_hooks() {
82
+	private function add_hooks() {
83 83
 
84
-        // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
84
+		// Add front-end access to Gravity Forms delete file action
85
+		add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
86 86
 
87
-        // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
87
+		// Make sure this hook is run for non-admins
88
+		add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
89 89
 
90
-        add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90
+		add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
91 91
 
92
-        // add template path to check for field
93
-        add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
92
+		// add template path to check for field
93
+		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
94 94
 
95 95
 		add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 );
96 96
 
97 97
 		add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) );
98
-    }
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * Adds "edit" to the list of internal reserved query args
@@ -166,74 +166,74 @@  discard block
 block discarded – undo
166 166
 		return false;
167 167
 	}
168 168
 
169
-    /**
170
-     * Include this extension templates path
171
-     * @param array $file_paths List of template paths ordered
172
-     */
173
-    public function add_template_path( $file_paths ) {
174
-
175
-        // Index 100 is the default GravityView template path.
176
-        $file_paths[ 110 ] = self::$file;
177
-
178
-        return $file_paths;
179
-    }
180
-
181
-    /**
182
-     *
183
-     * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
-     *
185
-     * @param $view_id int GravityView view id
186
-     * @param $form_id int Gravity Forms form id
187
-     * @param $entry_id int Gravity Forms entry id
188
-     * @return string
189
-     */
190
-    public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
-        return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
-    }
193
-
194
-
195
-    /**
196
-     * The edit entry link creates a secure link with a nonce
197
-     *
198
-     * It also mimics the URL structure Gravity Forms expects to have so that
199
-     * it formats the display of the edit form like it does in the backend, like
200
-     * "You can edit this post from the post page" fields, for example.
201
-     *
202
-     * @param $entry array Gravity Forms entry object
203
-     * @param $view_id int GravityView view id
204
-     * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
-     * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
-     * @return string
207
-     */
208
-    public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
-
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
-
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
-
214
-        $url = add_query_arg( array(
215
-            'edit' => wp_create_nonce( $nonce_key )
216
-        ), $base );
217
-
218
-        if( $post_id ) {
219
-	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
-        }
221
-
222
-	    /**
223
-	     * Allow passing params to dynamically populate entry with values
224
-	     * @since 1.9.2
225
-	     */
226
-	    if( !empty( $field_values ) ) {
227
-
228
-		    if( is_array( $field_values ) ) {
229
-			    // If already an array, no parse_str() needed
230
-			    $params = $field_values;
231
-		    } else {
232
-			    parse_str( $field_values, $params );
233
-		    }
234
-
235
-		    $url = add_query_arg( $params, $url );
236
-	    }
169
+	/**
170
+	 * Include this extension templates path
171
+	 * @param array $file_paths List of template paths ordered
172
+	 */
173
+	public function add_template_path( $file_paths ) {
174
+
175
+		// Index 100 is the default GravityView template path.
176
+		$file_paths[ 110 ] = self::$file;
177
+
178
+		return $file_paths;
179
+	}
180
+
181
+	/**
182
+	 *
183
+	 * Return a well formatted nonce key according to GravityView Edit Entry protocol
184
+	 *
185
+	 * @param $view_id int GravityView view id
186
+	 * @param $form_id int Gravity Forms form id
187
+	 * @param $entry_id int Gravity Forms entry id
188
+	 * @return string
189
+	 */
190
+	public static function get_nonce_key( $view_id, $form_id, $entry_id ) {
191
+		return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id );
192
+	}
193
+
194
+
195
+	/**
196
+	 * The edit entry link creates a secure link with a nonce
197
+	 *
198
+	 * It also mimics the URL structure Gravity Forms expects to have so that
199
+	 * it formats the display of the edit form like it does in the backend, like
200
+	 * "You can edit this post from the post page" fields, for example.
201
+	 *
202
+	 * @param $entry array Gravity Forms entry object
203
+	 * @param $view_id int GravityView view id
204
+	 * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2}
205
+	 * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ }
206
+	 * @return string
207
+	 */
208
+	public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209
+
210
+		$nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
211
+
212
+		$base = gv_entry_link( $entry, $post_id ? : $view_id  );
213
+
214
+		$url = add_query_arg( array(
215
+			'edit' => wp_create_nonce( $nonce_key )
216
+		), $base );
217
+
218
+		if( $post_id ) {
219
+			$url = add_query_arg( array( 'gvid' => $view_id ), $url );
220
+		}
221
+
222
+		/**
223
+		 * Allow passing params to dynamically populate entry with values
224
+		 * @since 1.9.2
225
+		 */
226
+		if( !empty( $field_values ) ) {
227
+
228
+			if( is_array( $field_values ) ) {
229
+				// If already an array, no parse_str() needed
230
+				$params = $field_values;
231
+			} else {
232
+				parse_str( $field_values, $params );
233
+			}
234
+
235
+			$url = add_query_arg( $params, $url );
236
+		}
237 237
 
238 238
 		/**
239 239
 		 * @filter `gravityview/edit/link` Filter the edit URL link.
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244 244
 		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
245
-    }
245
+	}
246 246
 
247 247
 	/**
248 248
 	 * Edit mode doesn't allow certain field types.
@@ -297,19 +297,19 @@  discard block
 block discarded – undo
297 297
 	}
298 298
 
299 299
 
300
-    /**
301
-     * checks if user has permissions to edit a specific entry
302
-     *
303
-     * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
304
-     *
305
-     * @param  array $entry Gravity Forms entry array
306
-     * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
307
-     * @return bool
308
-     */
309
-    public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
300
+	/**
301
+	 * checks if user has permissions to edit a specific entry
302
+	 *
303
+	 * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!!
304
+	 *
305
+	 * @param  array $entry Gravity Forms entry array
306
+	 * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0
307
+	 * @return bool
308
+	 */
309
+	public static function check_user_cap_edit_entry( $entry, $view = 0 ) {
310 310
 
311
-        // No permission by default
312
-        $user_can_edit = false;
311
+		// No permission by default
312
+		$user_can_edit = false;
313 313
 
314 314
 		// get user_edit setting
315 315
 		if ( empty( $view ) ) {
@@ -327,60 +327,60 @@  discard block
 block discarded – undo
327 327
 			$user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
328 328
 		}
329 329
 
330
-        // If they can edit any entries (as defined in Gravity Forms)
331
-        // Or if they can edit other people's entries
332
-        // Then we're good.
333
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
330
+		// If they can edit any entries (as defined in Gravity Forms)
331
+		// Or if they can edit other people's entries
332
+		// Then we're good.
333
+		if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
334 334
 
335
-            gravityview()->log->debug( 'User has ability to edit all entries.' );
335
+			gravityview()->log->debug( 'User has ability to edit all entries.' );
336 336
 
337
-            $user_can_edit = true;
337
+			$user_can_edit = true;
338 338
 
339
-        } else if( !isset( $entry['created_by'] ) ) {
339
+		} else if( !isset( $entry['created_by'] ) ) {
340 340
 
341
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
341
+			gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
342 342
 
343
-            $user_can_edit = false;
343
+			$user_can_edit = false;
344 344
 
345
-        } else {
345
+		} else {
346 346
 
347
-            $current_user = wp_get_current_user();
347
+			$current_user = wp_get_current_user();
348 348
 
349
-            // User edit is disabled
350
-            if( empty( $user_edit ) ) {
349
+			// User edit is disabled
350
+			if( empty( $user_edit ) ) {
351 351
 
352
-                gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
352
+				gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
353 353
 
354
-                $user_can_edit = false;
355
-            }
354
+				$user_can_edit = false;
355
+			}
356 356
 
357
-            // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
357
+			// User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
+			else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
359 359
 
360
-                gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
360
+				gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
361 361
 
362
-                $user_can_edit = true;
362
+				$user_can_edit = true;
363 363
 
364
-            } else if( ! is_user_logged_in() ) {
364
+			} else if( ! is_user_logged_in() ) {
365 365
 
366
-                gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
366
+				gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
367 367
 
368
-	            $user_can_edit = false; // Here just for clarity
369
-            }
368
+				$user_can_edit = false; // Here just for clarity
369
+			}
370 370
 
371
-        }
371
+		}
372 372
 
373
-        /**
374
-         * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
375
-         * @since 1.15 Added `$entry` and `$view_id` parameters
376
-         * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
377
-         * @param[in] array $entry Gravity Forms entry array {@since 1.15}
378
-         * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
379
-         */
380
-        $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
373
+		/**
374
+		 * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry.
375
+		 * @since 1.15 Added `$entry` and `$view_id` parameters
376
+		 * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false)
377
+		 * @param[in] array $entry Gravity Forms entry array {@since 1.15}
378
+		 * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15}
379
+		 */
380
+		$user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
381 381
 
382
-        return (bool) $user_can_edit;
383
-    }
382
+		return (bool) $user_can_edit;
383
+	}
384 384
 
385 385
 
386 386
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     static function getInstance() {
58 58
 
59
-        if( empty( self::$instance ) ) {
59
+        if ( empty( self::$instance ) ) {
60 60
             self::$instance = new GravityView_Edit_Entry;
61 61
         }
62 62
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
     private function add_hooks() {
83 83
 
84 84
         // Add front-end access to Gravity Forms delete file action
85
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') );
85
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) );
86 86
 
87 87
         // Make sure this hook is run for non-admins
88
-        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') );
88
+        add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) );
89 89
 
90 90
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function add_reserved_arg( $args ) {
110 110
 
111
-		$args[] = 'edit';
111
+		$args[ ] = 'edit';
112 112
 
113 113
 		return $args;
114 114
 	}
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	private function addon_specific_hooks() {
121 121
 
122
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
122
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
123
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
124 124
 		}
125 125
 
126 126
 	}
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
209 209
 
210
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
210
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
211 211
 
212
-        $base = gv_entry_link( $entry, $post_id ? : $view_id  );
212
+        $base = gv_entry_link( $entry, $post_id ?: $view_id );
213 213
 
214 214
         $url = add_query_arg( array(
215 215
             'edit' => wp_create_nonce( $nonce_key )
216 216
         ), $base );
217 217
 
218
-        if( $post_id ) {
218
+        if ( $post_id ) {
219 219
 	        $url = add_query_arg( array( 'gvid' => $view_id ), $url );
220 220
         }
221 221
 
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	     * Allow passing params to dynamically populate entry with values
224 224
 	     * @since 1.9.2
225 225
 	     */
226
-	    if( !empty( $field_values ) ) {
226
+	    if ( ! empty( $field_values ) ) {
227 227
 
228
-		    if( is_array( $field_values ) ) {
228
+		    if ( is_array( $field_values ) ) {
229 229
 			    // If already an array, no parse_str() needed
230 230
 			    $params = $field_values;
231 231
 		    } else {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 * @param array $entry The entry.
242 242
 		 * @param \GV\View $view The View.
243 243
 		 */
244
-		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id  ) );
244
+		return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ) );
245 245
     }
246 246
 
247 247
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
254 254
 
255
-		if( empty( $context ) || $context !== 'edit' ) {
255
+		if ( empty( $context ) || $context !== 'edit' ) {
256 256
 			return $fields;
257 257
 		}
258 258
 
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
         // If they can edit any entries (as defined in Gravity Forms)
331 331
         // Or if they can edit other people's entries
332 332
         // Then we're good.
333
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
333
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
334 334
 
335 335
             gravityview()->log->debug( 'User has ability to edit all entries.' );
336 336
 
337 337
             $user_can_edit = true;
338 338
 
339
-        } else if( !isset( $entry['created_by'] ) ) {
339
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
340 340
 
341
-            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.');
341
+            gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' );
342 342
 
343 343
             $user_can_edit = false;
344 344
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             $current_user = wp_get_current_user();
348 348
 
349 349
             // User edit is disabled
350
-            if( empty( $user_edit ) ) {
350
+            if ( empty( $user_edit ) ) {
351 351
 
352 352
                 gravityview()->log->debug( 'User Edit is disabled. Returning false.' );
353 353
 
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
             }
356 356
 
357 357
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
358
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
358
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
359 359
 
360 360
                 gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) );
361 361
 
362 362
                 $user_can_edit = true;
363 363
 
364
-            } else if( ! is_user_logged_in() ) {
364
+            } else if ( ! is_user_logged_in() ) {
365 365
 
366 366
                 gravityview()->log->debug( 'No user defined; edit entry requires logged in user' );
367 367
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
          */
380 380
         $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id );
381 381
 
382
-        return (bool) $user_can_edit;
382
+        return (bool)$user_can_edit;
383 383
     }
384 384
 
385 385
 
Please login to merge, or discard this patch.
includes/presets/register-default-templates.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 		'GravityView_DataTables_Template' => array(
60 60
 			'slug' => 'dt_placeholder',
61 61
 			'label' =>  __( 'DataTables Table', 'gv-datatables', 'gravityview' ),
62
-			'description' => __('Display items in a dynamic table powered by DataTables.', 'gravityview'),
63
-			'logo' => plugins_url('assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ),
62
+			'description' => __( 'Display items in a dynamic table powered by DataTables.', 'gravityview' ),
63
+			'logo' => plugins_url( 'assets/images/templates/logo-datatables.png', GRAVITYVIEW_FILE ),
64 64
 			'buy_source' => 'https://gravityview.co/pricing/?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=datatables',
65 65
 			'preview' => 'https://try.gravityview.co/view/datatables/?utm_source=plugin&utm_medium=try_demo&utm_campaign=view_type&utm_term=datatables',
66 66
 			'license' => esc_html__( 'All Access', 'gravityview' ),
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 				continue;
100 100
 			}
101 101
 
102
-			$placeholder['type']     = 'custom';
103
-			$placeholder['included'] = ( (int) $license['price_id'] >= $placeholder['price_id'] );
102
+			$placeholder[ 'type' ]     = 'custom';
103
+			$placeholder[ 'included' ] = ( (int)$license[ 'price_id' ] >= $placeholder[ 'price_id' ] );
104 104
 
105
-			new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder );
105
+			new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder );
106 106
 		}
107 107
 
108 108
 	} catch ( Exception $exception ) {
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-sequence.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$this->label = esc_html__( 'Number Sequence', 'gravityview' );
42 42
 		$this->description = esc_html__( 'Display a sequential result number for each entry.', 'gravityview' );
43 43
 
44
-		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips') );
44
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips' ) );
45 45
 
46 46
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
47 47
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			return $entry_default_fields;
66 66
 		}
67 67
 
68
-		$entry_default_fields['sequence'] = array(
68
+		$entry_default_fields[ 'sequence' ] = array(
69 69
 			'label' => __( 'Result Number', 'gravityview' ),
70 70
 			'type'  => $this->name,
71 71
 			'desc'  => $this->description,
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 		$return = $tooltips;
86 86
 
87
-		$return['reverse_sequence'] = array(
88
-			'title' => __('Reverse the order of the result numbers', 'gravityview'),
89
-			'value' => __('Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview'),
87
+		$return[ 'reverse_sequence' ] = array(
88
+			'title' => __( 'Reverse the order of the result numbers', 'gravityview' ),
89
+			'value' => __( 'Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview' ),
90 90
 		);
91 91
 
92 92
 		return $return;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
96 96
 
97
-		unset ( $field_options['search_filter'] );
97
+		unset ( $field_options[ 'search_filter' ] );
98 98
 
99 99
 		$new_fields = array(
100 100
 			'start' => array(
101 101
 				'type' => 'number',
102 102
 				'label' => __( 'First Number in the Sequence', 'gravityview' ),
103
-				'desc' => __('For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview'),
103
+				'desc' => __( 'For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview' ),
104 104
 				'value' => '1',
105 105
 				'merge_tags' => false,
106 106
 			),
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 		$return = $text;
157 157
 
158 158
 		$context = new \GV\Template_Context();
159
-		$context->view = \GV\View::by_id( $view_data['view_id'] );
159
+		$context->view = \GV\View::by_id( $view_data[ 'view_id' ] );
160 160
 		$context->entry = \GV\GF_Entry::from_entry( $entry );
161 161
 
162 162
 		$gv_field = \GV\Internal_Field::by_id( 'sequence' );
163 163
 		$merge_tag_context = \GV\Utils::get( $legacy_field, 'UID' );
164
-		$merge_tag_context = $entry['id'] . "/{$merge_tag_context}";
164
+		$merge_tag_context = $entry[ 'id' ] . "/{$merge_tag_context}";
165 165
 
166 166
 		foreach ( $matches as $match ) {
167 167
 
168
-			$full_tag = $match[0];
169
-			$property = $match[1];
168
+			$full_tag = $match[ 0 ];
169
+			$property = $match[ 1 ];
170 170
 
171 171
 			$gv_field->reverse = false;
172 172
 			$gv_field->start = 1;
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 
186 186
 				// If there is a field with the ID of the start number, the merge tag won't work.
187 187
 				// In that case, you can use "=" instead: `{sequence start=10}`
188
-				if( 1 === sizeof( $maybe_start ) ) {
188
+				if ( 1 === sizeof( $maybe_start ) ) {
189 189
 					$maybe_start = explode( '=', $modifier );
190 190
 				}
191 191
 
192 192
 				if ( 'start' === rgar( $maybe_start, 0 ) && is_numeric( rgar( $maybe_start, 1 ) ) ) {
193
-					$gv_field->start = (int) rgar( $maybe_start, 1 );
193
+					$gv_field->start = (int)rgar( $maybe_start, 1 );
194 194
 				}
195 195
 			}
196 196
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			$merge_tag_context_modifiers = $merge_tag_context . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
202 202
 
203 203
 			if ( ! isset( $merge_tag_sequences[ $merge_tag_context_modifiers ] ) ) {
204
-				$gv_field->UID = $legacy_field['UID'] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
204
+				$gv_field->UID = $legacy_field[ 'UID' ] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
205 205
 				$context->field = $gv_field;
206 206
 				$sequence = $merge_tag_sequences[ $merge_tag_context_modifiers ] = $this->get_sequence( $context );
207 207
 			} else {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			$total = $context->view->get_entries()->total();
247 247
 			remove_filter( 'gform_gf_query_sql', $callback );
248 248
 
249
-			unset( $sql_query['paginate'] );
249
+			unset( $sql_query[ 'paginate' ] );
250 250
 
251 251
 			global $wpdb;
252 252
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/select-template.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -26,52 +26,52 @@
 block discarded – undo
26 26
 
27 27
 <?php // list all the available templates (type= fresh or custom ) ?>
28 28
 <div class="gv-grid">
29
-	<?php foreach( $templates as $id => $template ) {
29
+	<?php foreach ( $templates as $id => $template ) {
30 30
 		$selected     = ( $id == $current_template ) ? ' gv-selected' : '';
31
-		$placeholder  = ! empty( $template['buy_source'] );
32
-		$is_included  = ! empty( $template['included'] );
31
+		$placeholder  = ! empty( $template[ 'buy_source' ] );
32
+		$is_included  = ! empty( $template[ 'included' ] );
33 33
 		$plugin_data  = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) );
34 34
 		$button_text  = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' );
35 35
 		$button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' );
36
-		$template_path = isset($plugin_data['path']) ? $plugin_data['path'] : '';
36
+		$template_path = isset( $plugin_data[ 'path' ] ) ? $plugin_data[ 'path' ] : '';
37 37
 
38 38
 		?>
39 39
 		<div class="gv-grid-col-1-4">
40
-			<div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>">
40
+			<div class="gv-view-types-module<?php echo $selected; if ( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>">
41 41
 				<div class="gv-view-types-normal">
42
-					<img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>">
43
-					<h5><?php echo esc_html( $template['label'] ); ?></h5>
44
-					<p class="description"><?php echo esc_html( $template['description'] ); ?></p>
42
+					<img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>">
43
+					<h5><?php echo esc_html( $template[ 'label' ] ); ?></h5>
44
+					<p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p>
45 45
 				</div>
46 46
 				<div class="gv-view-types-hover">
47 47
 					<div>
48 48
 						<?php
49
-						if( $is_included ) {
49
+						if ( $is_included ) {
50 50
 						?>
51 51
 							<p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p>
52
-							<?php if( !empty( $template['license'] ) ) { ?>
53
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) ); ?></p>
52
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
53
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) ); ?></p>
54 54
 							<?php } ?>
55 55
 						<?php
56
-						} elseif( $placeholder ) {
57
-							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] );
56
+						} elseif ( $placeholder ) {
57
+							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template[ 'license' ] ) . '&utm_content=' . urlencode( $template[ 'slug' ] );
58 58
 							?>
59
-							<p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p>
59
+							<p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p>
60 60
 
61
-							<?php if( !empty( $template['preview'] ) ) { ?>
62
-								<p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
61
+							<?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
62
+								<p><a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview' ); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
63 63
 							<?php } ?>
64 64
 
65
-							<?php if( ! empty( $template['license'] ) ) { ?>
66
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) . '</a>' ); ?></p>
65
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
66
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) . '</a>' ); ?></p>
67 67
 							<?php } ?>
68 68
 						<?php }
69 69
 
70
-						if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?>
70
+						if ( $placeholder || $is_included ) { ?> </div><div class="hidden"> <?php } ?>
71 71
 
72
-                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p>
73
-                        <?php if( !empty( $template['preview'] ) ) { ?>
74
-                            <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a>
72
+                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p>
73
+                        <?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
74
+                            <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a>
75 75
                         <?php } ?>
76 76
 					</div>
77 77
 				</div>
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-consent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@
 block discarded – undo
97 97
 		// Set the $_field_id var
98 98
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
99 99
 
100
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
100
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
101 101
 			$default = 'tick';
102 102
 		} else {
103 103
 			$default = 'both';
104 104
 		}
105 105
 
106
-		$field_options['choice_display'] = array(
106
+		$field_options[ 'choice_display' ] = array(
107 107
 			'type'    => 'radio',
108 108
 			'class'   => 'vertical',
109 109
 			'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-field.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@
 block discarded – undo
14 14
 
15 15
 		$field_info_items = array();
16 16
 
17
-		if( !empty( $this->item['adminLabel'] ) ) {
18
-			$field_info_items[] = array(
19
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
17
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
18
+			$field_info_items[ ] = array(
19
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
20 20
 				'class'	=> 'gv-sublabel'
21 21
 			);
22 22
 		}
23 23
 
24 24
 		// Fields with IDs, not like Source URL or Entry ID
25
-		if( is_numeric( $this->id ) ) {
25
+		if ( is_numeric( $this->id ) ) {
26 26
 
27
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
27
+			$field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] );
28 28
 
29
-			if ( ! empty( $this->item['parent'] ) ) {
30
-				$field_info_items[] = array(
31
-					'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item['parent']['label'] ) ),
29
+			if ( ! empty( $this->item[ 'parent' ] ) ) {
30
+				$field_info_items[ ] = array(
31
+					'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item[ 'parent' ][ 'label' ] ) ),
32 32
 				);
33 33
 			}
34 34
 
35
-			$field_info_items[] = array(
36
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ),
37
-				'hide_in_picker' => ! empty( $this->item['parent'] ),
35
+			$field_info_items[ ] = array(
36
+				'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ),
37
+				'hide_in_picker' => ! empty( $this->item[ 'parent' ] ),
38 38
 			);
39 39
 
40
-			$field_info_items[] = array(
41
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
40
+			$field_info_items[ ] = array(
41
+				'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ),
42 42
 			);
43 43
 		}
44 44
 
45
-		if( !empty( $this->item['desc'] ) ) {
46
-			$field_info_items[] = array(
47
-				'value' => $this->item['desc']
45
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
46
+			$field_info_items[ ] = array(
47
+				'value' => $this->item[ 'desc' ]
48 48
 			);
49 49
 		}
50 50
 
51
-		$field_info_items[] = array(
52
-			'value'          => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ),
51
+		$field_info_items[ ] = array(
52
+			'value'          => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ),
53 53
 			'hide_in_picker' => true,
54 54
 		);
55 55
 
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected $form_id;
46 46
 
47
-	function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) {
47
+	function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) {
48 48
 
49 49
 		// Backward compat
50
-		if ( ! empty( $item['type'] ) ) {
51
-			$item['input_type'] = $item['type'];
52
-			unset( $item['type'] );
50
+		if ( ! empty( $item[ 'type' ] ) ) {
51
+			$item[ 'input_type' ] = $item[ 'type' ];
52
+			unset( $item[ 'type' ] );
53 53
 		}
54 54
 
55 55
 		if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$this->id         = $item_id;
77 77
 		$this->form_id    = $form_id;
78 78
 		$this->settings   = $settings;
79
-		$this->label_type = $item['label_type'];
79
+		$this->label_type = $item[ 'label_type' ];
80 80
 	}
81 81
 
82 82
 	/**
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 
121 121
 			foreach ( $field_info_items as $item ) {
122 122
 
123
-				if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
123
+				if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
124 124
 					continue;
125 125
 				}
126 126
 
127
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
127
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
128 128
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
129 129
 				$output .= '<span class="' . $class . '">';
130
-				$output .= esc_html( $item['value'] );
130
+				$output .= esc_html( $item[ 'value' ] );
131 131
 				$output .= '</span>';
132 132
 			}
133 133
 
@@ -156,39 +156,39 @@  discard block
 block discarded – undo
156 156
 
157 157
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
158 158
 		// TODO: Un-hack this
159
-		$hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
160
-		$settings_link      = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
159
+		$hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
160
+		$settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
161 161
 
162 162
 		// When a field label is empty, use the Field ID
163 163
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
164 164
 
165 165
 		// If there's a custom label, and show label is checked, use that as the field heading
166
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
167
-			$label = $this->settings['custom_label'];
168
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
169
-			$label = $this->item['customLabel'];
166
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
167
+			$label = $this->settings[ 'custom_label' ];
168
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
169
+			$label = $this->item[ 'customLabel' ];
170 170
 		}
171 171
 		$label = esc_attr( $label );
172 172
 
173 173
 		$field_icon = '';
174 174
 
175
-		if ( $this->item['icon'] && ! \GV\Utils::get( $this->item, 'parent' ) ) {
175
+		if ( $this->item[ 'icon' ] && ! \GV\Utils::get( $this->item, 'parent' ) ) {
176 176
 
177
-			$has_gf_icon = ( false !== strpos( $this->item['icon'], 'gform-icon' ) );
178
-			$has_dashicon = ( false !== strpos( $this->item['icon'], 'dashicons' ) );
177
+			$has_gf_icon = ( false !== strpos( $this->item[ 'icon' ], 'gform-icon' ) );
178
+			$has_dashicon = ( false !== strpos( $this->item[ 'icon' ], 'dashicons' ) );
179 179
 
180
-			if ( 0 === strpos( $this->item['icon'], 'data:' ) ) {
180
+			if ( 0 === strpos( $this->item[ 'icon' ], 'data:' ) ) {
181 181
 				// Inline icon SVG
182
-				$field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item['icon'] ) . '\');"></i>';
183
-			} elseif( $has_gf_icon && gravityview()->plugin->is_GF_25() ) {
182
+				$field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item[ 'icon' ] ) . '\');"></i>';
183
+			} elseif ( $has_gf_icon && gravityview()->plugin->is_GF_25() ) {
184 184
 				// Gravity Forms icon font
185
-				$field_icon = '<i class="gform-icon ' . esc_attr( $this->item['icon'] ) . '"></i>';
186
-			} elseif( $has_dashicon ) {
185
+				$field_icon = '<i class="gform-icon ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>';
186
+			} elseif ( $has_dashicon ) {
187 187
 				// Dashicon; prefix with "dashicons"
188
-				$field_icon = '<i class="dashicons ' . esc_attr( $this->item['icon'] ) . '"></i>';
188
+				$field_icon = '<i class="dashicons ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>';
189 189
 			} else {
190 190
 				// Not dashicon icon
191
-				$field_icon = '<i class="' . esc_attr( $this->item['icon'] ) . '"></i>';
191
+				$field_icon = '<i class="' . esc_attr( $this->item[ 'icon' ] ) . '"></i>';
192 192
 			}
193 193
 
194 194
 			$field_icon = $field_icon . ' ';
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$output .= '</h5>';
212 212
 
213
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
213
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
214 214
 
215
-		$container_class .= empty( $this->settings['show_as_link'] ) ? '' : ' has-single-entry-link';
215
+		$container_class .= empty( $this->settings[ 'show_as_link' ] ) ? '' : ' has-single-entry-link';
216 216
 
217
-		$container_class .= empty( $this->settings['only_loggedin'] ) ? '' : ' has-custom-visibility';
217
+		$container_class .= empty( $this->settings[ 'only_loggedin' ] ) ? '' : ' has-custom-visibility';
218 218
 
219
-		$data_form_id   = ! empty( $this->form_id ) ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : '';
219
+		$data_form_id = ! empty( $this->form_id ) ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : '';
220 220
 
221
-		$data_parent_label = ! empty( $this->item['parent'] ) ? ' data-parent-label="' . esc_attr( $this->item['parent']['label'] ) . '"' : '';
221
+		$data_parent_label = ! empty( $this->item[ 'parent' ] ) ? ' data-parent-label="' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . '"' : '';
222 222
 
223
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
223
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
224 224
 
225 225
 		return $output;
226 226
 	}
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 
239 239
 		$icons = array(
240 240
 			'show_as_link' => array(
241
-				'visible' => ( ! empty( $this->settings['show_as_link'] ) ),
241
+				'visible' => ( ! empty( $this->settings[ 'show_as_link' ] ) ),
242 242
 				'title' => __( 'This field links to the Single Entry', 'gravityview' ),
243 243
 				'css_class' => 'dashicons dashicons-media-default icon-link-to-single-entry',
244 244
 			),
245 245
 			'only_loggedin' => array(
246
-				'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings['allow_edit_cap'] ) && 'read' !== $this->settings['allow_edit_cap'] ),
246
+				'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings[ 'allow_edit_cap' ] ) && 'read' !== $this->settings[ 'allow_edit_cap' ] ),
247 247
 				'title' => __( 'This field has modified visibility', 'gravityview' ),
248 248
 				'css_class' => 'dashicons dashicons-lock icon-custom-visibility',
249 249
 			),
@@ -257,21 +257,21 @@  discard block
 block discarded – undo
257 257
 		 * @param array $icons Array of icons to be shown, with `visible`, `title`, `css_class` keys.
258 258
 		 * @param array $item_settings Settings for the current item (widget or field)
259 259
 		 */
260
-		$icons = (array) apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings );
260
+		$icons = (array)apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings );
261 261
 
262 262
 		foreach ( $icons as $icon ) {
263 263
 
264
-			if ( empty( $icon['css_class'] ) || empty( $icon['title'] ) ) {
264
+			if ( empty( $icon[ 'css_class' ] ) || empty( $icon[ 'title' ] ) ) {
265 265
 				continue;
266 266
 			}
267 267
 
268
-			$css_class = trim( $icon['css_class'] );
268
+			$css_class = trim( $icon[ 'css_class' ] );
269 269
 
270
-			if ( empty( $icon['visible'] ) ) {
270
+			if ( empty( $icon[ 'visible' ] ) ) {
271 271
 				$css_class .= ' hide-if-js';
272 272
 			}
273 273
 
274
-			$output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon['title'] ) . '"></span>';
274
+			$output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon[ 'title' ] ) . '"></span>';
275 275
 		}
276 276
 
277 277
 		return $output;
Please login to merge, or discard this patch.