Completed
Pull Request — develop (#1436)
by
unknown
15:35
created
includes/class-gravityview-change-entry-creator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -354,7 +354,7 @@
 block discarded – undo
354 354
 	 *
355 355
 	 * @param array $assets
356 356
 	 *
357
-	 * @return array
357
+	 * @return string[]
358 358
 	 */
359 359
 	function register_gform_noconflict( $assets ) {
360 360
 		$assets[] = 'gravityview_selectwoo';
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			array(
82 82
 				'ajaxurl'  => admin_url( 'admin-ajax.php' ),
83 83
 				'action'   => 'entry_creator_get_users',
84
-				'gf25'    => (bool) gravityview()->plugin->is_GF_25(),
84
+				'gf25'    => (bool)gravityview()->plugin->is_GF_25(),
85 85
 				'language' => array(
86 86
 					'search_placeholder' => esc_html__( 'Search by ID, login, email, or name.', 'gravityview' ),
87 87
 				),
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 			)
106 106
 		);
107 107
 
108
-		if ( ! wp_verify_nonce( $post_var['gv_nonce'], 'gv_entry_creator' ) ) {
108
+		if ( ! wp_verify_nonce( $post_var[ 'gv_nonce' ], 'gv_entry_creator' ) ) {
109 109
 			die();
110 110
 		}
111 111
 
112
-		$search_string = $post_var['q'];
112
+		$search_string = $post_var[ 'q' ];
113 113
 
114 114
 		if ( is_numeric( $search_string ) ) {
115 115
 			$user_args = array(
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		}
157 157
 
158 158
 		// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
159
-		$result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true );
159
+		$result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true );
160 160
 
161 161
 		if ( false === $result ) {
162 162
 			$status = __( 'Error', 'gravityview' );
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			return;
179 179
 		}
180 180
 
181
-		GravityView_Entry_Notes::add_note( $entry['id'], - 1, 'GravityView', $note, 'gravityview' );
181
+		GravityView_Entry_Notes::add_note( $entry[ 'id' ], - 1, 'GravityView', $note, 'gravityview' );
182 182
 
183 183
 	}
184 184
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		}
214 214
 
215 215
 		// If screen mode isn't set, then we're in the wrong place.
216
-		if ( empty( $_REQUEST['screen_mode'] ) ) {
216
+		if ( empty( $_REQUEST[ 'screen_mode' ] ) ) {
217 217
 			return;
218 218
 		}
219 219
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		// If $_GET['screen_mode'] is set to edit, set $_POST value
241 241
 		if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) {
242
-			$_POST["screen_mode"] = 'edit';
242
+			$_POST[ "screen_mode" ] = 'edit';
243 243
 		}
244 244
 
245 245
 	}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		$entry_creator_user_id = \GV\Utils::get( $entry, 'created_by' );
315 315
 
316 316
 		$entry_creator_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $entry_creator_user_id ) );
317
-		$entry_creator_user = isset( $entry_creator_user[0] ) ? $entry_creator_user[0] : array();
317
+		$entry_creator_user = isset( $entry_creator_user[ 0 ] ) ? $entry_creator_user[ 0 ] : array();
318 318
 
319 319
 		if ( empty( $entry_creator_user ) ) {
320 320
 			$output .= '<option value="0"> &mdash; ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' &mdash; </option>';
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
 		}
333 333
 
334 334
 		$user_count      = count_users();
335
-		$user_count      = $user_count['total_users'];
335
+		$user_count      = $user_count[ 'total_users' ];
336 336
 		$users_displayed = self::DEFAULT_NUMBER_OF_USERS + ( ! empty( $entry_creator_user ) ? 1 : 0 );
337 337
 		if ( $user_count > $users_displayed ) {
338 338
 			$remaining_users = $user_count - $users_displayed;
339
-			$user_users = _n( esc_html__('user', 'gravityview' ), esc_html__('users', 'gravityview' ), $remaining_users );
339
+			$user_users = _n( esc_html__( 'user', 'gravityview' ), esc_html__( 'users', 'gravityview' ), $remaining_users );
340 340
 			$message = esc_html_x( 'Use the input above to search the remaining %d %s.', '%d is replaced with user count %s is replaced with "user" or "users"', 'gravityview' );
341 341
 			$message = sprintf( $message, $remaining_users, $user_users );
342
-			$output  .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>';
342
+			$output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>';
343 343
 		}
344 344
 
345 345
 		$output .= '</select>';
346
-		$output .= '<input name="originally_created_by" value="' . esc_attr( $entry['created_by'] ) . '" type="hidden" />';
346
+		$output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />';
347 347
 		$output .= wp_nonce_field( 'gv_entry_creator', 'gv_entry_creator_nonce', false, false );
348 348
 
349 349
 		echo $output;
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 * @return array
358 358
 	 */
359 359
 	function register_gform_noconflict( $assets ) {
360
-		$assets[] = 'gravityview_selectwoo';
361
-		$assets[] = 'gravityview_entry_creator';
360
+		$assets[ ] = 'gravityview_selectwoo';
361
+		$assets[ ] = 'gravityview_entry_creator';
362 362
 
363 363
 		return $assets;
364 364
 	}
Please login to merge, or discard this patch.
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/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-3">
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.