Completed
Pull Request — develop (#1620)
by Zack
15:37
created
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravityformsquiz.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,26 +50,26 @@
 block discarded – undo
50 50
 
51 51
 		if ( ! empty( $quiz_fields ) ) {
52 52
 
53
-			$fields['gquiz_score']   = array(
53
+			$fields[ 'gquiz_score' ] = array(
54 54
 				'label' => __( 'Quiz Score Total', 'gravityview' ),
55 55
 				'type'  => 'quiz_score',
56 56
 				'desc'  => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ),
57 57
 				'icon'  => 'dashicons-forms',
58 58
 			);
59
-			$fields['gquiz_percent'] = array(
59
+			$fields[ 'gquiz_percent' ] = array(
60 60
 				'label' => __( 'Quiz Percentage Grade', 'gravityview' ),
61 61
 				'type'  => 'quiz_percent',
62 62
 				'desc'  => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ),
63 63
 				'icon'  => 'dashicons-forms',
64 64
 			);
65
-			$fields['gquiz_grade']   = array(
65
+			$fields[ 'gquiz_grade' ] = array(
66 66
 				/* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc.  */
67 67
 				'label' => __( 'Quiz Letter Grade', 'gravityview' ),
68 68
 				'type'  => 'quiz_grade',
69 69
 				'desc'  => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ),
70 70
 				'icon'  => 'dashicons-forms',
71 71
 			);
72
-			$fields['gquiz_is_pass'] = array(
72
+			$fields[ 'gquiz_is_pass' ] = array(
73 73
 				'label' => __( 'Quiz Pass/Fail', 'gravityview' ),
74 74
 				'type'  => 'quiz_is_pass',
75 75
 				'desc'  => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ),
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		/**
82 82
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
83 83
 		 */
84
-		foreach( $this->lead_db_columns as $column ) {
84
+		foreach ( $this->lead_db_columns as $column ) {
85 85
 			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
86 86
 		}
87 87
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 			return;
113 113
 		}
114 114
 
115
-		gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{lead_id} was deleted', array( 'form_id' => $entry['form_id'], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) );
115
+		gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{lead_id} was deleted', array( 'form_id' => $entry[ 'form_id' ], 'entry_id' => $lead_id, 'data' => array( 'value' => $property_value, 'previous' => $previous_value ) ) );
116 116
 
117
-		$this->blacklist_add( $entry['form_id'] );
117
+		$this->blacklist_add( $entry[ 'form_id' ] );
118 118
 	}
119 119
 
120 120
 	/**
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function entry_updated( $form, $lead_id ) {
129 129
 
130
-		gravityview()->log->debug(' adding form {form_id} to blacklist because entry #{entry_id} was updated', array( 'form_id' => $form['id'], 'entry_id' => $lead_id ) );
130
+		gravityview()->log->debug( ' adding form {form_id} to blacklist because entry #{entry_id} was updated', array( 'form_id' => $form[ 'id' ], 'entry_id' => $lead_id ) );
131 131
 
132
-		$this->blacklist_add( $form['id'] );
132
+		$this->blacklist_add( $form[ 'id' ] );
133 133
 	}
134 134
 
135 135
 	/**
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function entry_created( $entry, $form ) {
146 146
 
147
-		gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was created', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) );
147
+		gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was created', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) );
148 148
 
149
-		$this->blacklist_add( $form['id'] );
149
+		$this->blacklist_add( $form[ 'id' ] );
150 150
 	}
151 151
 
152 152
 	/**
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 			return;
163 163
 		}
164 164
 
165
-		gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was added', array( 'form_id' => $form['id'], 'entry_id' => $entry['id'] ) );
165
+		gravityview()->log->debug( 'adding form {form_id} to blacklist because entry #{entry_id} was added', array( 'form_id' => $form[ 'id' ], 'entry_id' => $entry[ 'id' ] ) );
166 166
 
167
-		$this->blacklist_add( $form['id'] );
167
+		$this->blacklist_add( $form[ 'id' ] );
168 168
 	}
169 169
 
170 170
 	/**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		// Normally just one form, but supports multiple forms
184 184
 		//
185 185
 		// Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14`
186
-		$forms = 'f:' . implode( '-f:', (array) $form_ids );
186
+		$forms = 'f:' . implode( '-f:', (array)$form_ids );
187 187
 
188 188
 		// Prefix for transient keys
189 189
 		// Now the prefix would be: `gv-cache-f:12-f:5-f:14-`
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$form_ids = is_array( $form_ids ) ? $form_ids : array( $form_ids );
236 236
 
237 237
 		// Add the passed form IDs
238
-		$blacklist = array_merge( (array) $blacklist, $form_ids );
238
+		$blacklist = array_merge( (array)$blacklist, $form_ids );
239 239
 
240 240
 		// Don't duplicate
241 241
 		$blacklist = array_unique( $blacklist );
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
268 268
 
269
-		$updated_list = array_diff( $blacklist, (array) $form_ids );
269
+		$updated_list = array_diff( $blacklist, (array)$form_ids );
270 270
 
271 271
 		gravityview()->log->debug( 'Removing form IDs from cache blacklist', array( 'data' => array(
272 272
 			'$form_ids'     => $form_ids,
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			return false;
300 300
 		}
301 301
 
302
-		foreach ( (array) $form_ids as $form_id ) {
302
+		foreach ( (array)$form_ids as $form_id ) {
303 303
 
304 304
 			if ( in_array( $form_id, $blacklist ) ) {
305 305
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
374 374
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
375 375
 			 */
376
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
376
+			$cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
377 377
 
378 378
 			gravityview()->log->debug( 'Setting cache with transient key {key} for {cache_time} seconds', array( 'key' => $this->key, 'cache_time' => $cache_time ) );
379 379
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 			return;
410 410
 		}
411 411
 
412
-		foreach ( (array) $form_ids as $form_id ) {
412
+		foreach ( (array)$form_ids as $form_id ) {
413 413
 
414 414
 			$key = '_transient_gv-cache-';
415 415
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	public function use_cache() {
521 521
 
522 522
 		// Exit early if debugging (unless running PHPUnit)
523
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined('DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) {
523
+		if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && DOING_GRAVITYVIEW_TESTS ) ) {
524 524
 			return apply_filters( 'gravityview_use_cache', false, $this );
525 525
 		}
526 526
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 
529 529
 		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
530 530
 
531
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
531
+			if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) {
532 532
 
533 533
 				gravityview()->log->debug( 'Not using cache: ?cache or ?nocache is in the URL' );
534 534
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		 */
556 556
 		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
557 557
 
558
-		return (boolean) $use_cache;
558
+		return (boolean)$use_cache;
559 559
 	}
560 560
 
561 561
 }
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gvlogic.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 		$value    = $this->get_value( $atts );
62 62
 
63 63
 		if ( false === $operator && is_null( $value ) ) {
64
-			if ( false !== $atts['if'] ) { // Only-if test
65
-				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
64
+			if ( false !== $atts[ 'if' ] ) { // Only-if test
65
+				$match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) );
66 66
 			} else {
67 67
 				$match = $authed; // Just login test
68 68
 			}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 				// Need to match all AND
83 83
 				foreach ( $and_values as $and_value ) {
84
-					$match = $authed && \GVCommon::matches_operation( $atts['if'], $and_value, $operator );
84
+					$match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $and_value, $operator );
85 85
 					if ( ! $match ) {
86 86
 						break;
87 87
 					}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				// Only need to match a single OR
93 93
 				foreach ( $or_values as $or_value ) {
94 94
 
95
-					$match = \GVCommon::matches_operation( $atts['if'], $or_value, $operator );
95
+					$match = \GVCommon::matches_operation( $atts[ 'if' ], $or_value, $operator );
96 96
 
97 97
 					// Negate the negative operators
98 98
 					if ( ( $authed && $match ) || ( $authed && ( ! $match && in_array( $operator, array( 'isnot', 'not_contains', 'not_in' ) ) ) ) ) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 				}
102 102
 
103 103
 			} else {
104
-				$match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator );
104
+				$match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator );
105 105
 			}
106 106
 
107 107
 			$output = $this->get_output( $match, $atts, $output );
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 * @return string The output.
190 190
 	 */
191 191
 	private function get_output( $match, $atts, $content ) {
192
-		if ( ! $match && ! empty( $atts['else'] ) ) {
193
-			return $atts['else']; // Attributized else is easy :)
192
+		if ( ! $match && ! empty( $atts[ 'else' ] ) ) {
193
+			return $atts[ 'else' ]; // Attributized else is easy :)
194 194
 		}
195 195
 
196 196
 		$if = '';
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 		$atts = array_intersect_key( $supplied_atts, $atts );
318 318
 
319 319
 		// Strip whitespace if it's not default false
320
-		if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) {
321
-			$atts['if'] = trim( $atts['if'] );
320
+		if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) {
321
+			$atts[ 'if' ] = trim( $atts[ 'if' ] );
322 322
 		} else {
323
-			$atts['if'] = false;
323
+			$atts[ 'if' ] = false;
324 324
 		}
325 325
 
326
-		if ( isset( $atts['logged_in'] ) ) {
326
+		if ( isset( $atts[ 'logged_in' ] ) ) {
327 327
 			// Truthy
328
-			if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) {
329
-				$atts['logged_in'] = false;
328
+			if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) {
329
+				$atts[ 'logged_in' ] = false;
330 330
 			} else {
331
-				$atts['logged_in'] = true;
331
+				$atts[ 'logged_in' ] = true;
332 332
 			}
333 333
 		}
334 334
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,14 +61,16 @@  discard block
 block discarded – undo
61 61
 		$value    = $this->get_value( $atts );
62 62
 
63 63
 		if ( false === $operator && is_null( $value ) ) {
64
-			if ( false !== $atts['if'] ) { // Only-if test
64
+			if ( false !== $atts['if'] ) {
65
+// Only-if test
65 66
 				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
66 67
 			} else {
67 68
 				$match = $authed; // Just login test
68 69
 			}
69 70
 
70 71
 			$output = $this->get_output( $match, $atts, $content );
71
-		} else { // Regular test
72
+		} else {
73
+// Regular test
72 74
 
73 75
 			$output = $content;
74 76
 
@@ -199,12 +201,15 @@  discard block
 block discarded – undo
199 201
 		$opens = 0; // inner opens
200 202
 		$found = false; // found split position
201 203
 
202
-		while ( $content ) { // scan
204
+		while ( $content ) {
205
+// scan
203 206
 
204 207
 			if ( ! preg_match( '#(.*?)(\[\/?(gvlogic|else).*?])(.*)#s', $content, $matches ) ) {
205
-				if ( ! $found ) { // We're still iffing.
208
+				if ( ! $found ) {
209
+// We're still iffing.
206 210
 					$if .= $content;
207
-				} else { // We are elsing
211
+				} else {
212
+// We are elsing
208 213
 					$else .= $content;
209 214
 				}
210 215
 				break; // No more shortcodes
@@ -212,9 +217,11 @@  discard block
 block discarded – undo
212 217
 
213 218
 			list( $_, $before_shortcode, $shortcode, $_, $after_shortcode ) = $matches;
214 219
 
215
-			if ( ! $found ) { // We're still iffing.
220
+			if ( ! $found ) {
221
+// We're still iffing.
216 222
 				$if .= $before_shortcode;
217
-			} else { // We are elsing
223
+			} else {
224
+// We are elsing
218 225
 				$else .= $before_shortcode;
219 226
 			}
220 227
 
@@ -238,9 +245,11 @@  discard block
 block discarded – undo
238 245
 				}
239 246
 
240 247
 				// Tack on the shortcode
241
-				if ( ! $found ) { // We're still iffing.
248
+				if ( ! $found ) {
249
+// We're still iffing.
242 250
 					$if .= $shortcode;
243
-				} else { // We are elsing
251
+				} else {
252
+// We are elsing
244 253
 					$else .= $shortcode;
245 254
 				}
246 255
 			}
Please login to merge, or discard this patch.
lightbox/fancybox/class-gravityview-lightbox-provider-fancybox.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -110,18 +110,18 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function allowed_atts( $atts = array() ) {
112 112
 
113
-		$atts['data-fancybox']         = null;
114
-		$atts['data-fancybox-trigger'] = null;
115
-		$atts['data-fancybox-index']   = null;
116
-		$atts['data-src']              = null;
117
-		$atts['data-type']             = null;
118
-		$atts['data-width']            = null;
119
-		$atts['data-height']           = null;
120
-		$atts['data-srcset']           = null;
121
-		$atts['data-caption']          = null;
122
-		$atts['data-options']          = null;
123
-		$atts['data-filter']           = null;
124
-		$atts['data-type']             = null;
113
+		$atts[ 'data-fancybox' ]         = null;
114
+		$atts[ 'data-fancybox-trigger' ] = null;
115
+		$atts[ 'data-fancybox-index' ]   = null;
116
+		$atts[ 'data-src' ]              = null;
117
+		$atts[ 'data-type' ]             = null;
118
+		$atts[ 'data-width' ]            = null;
119
+		$atts[ 'data-height' ]           = null;
120
+		$atts[ 'data-srcset' ]           = null;
121
+		$atts[ 'data-caption' ]          = null;
122
+		$atts[ 'data-options' ]          = null;
123
+		$atts[ 'data-filter' ]           = null;
124
+		$atts[ 'data-type' ]             = null;
125 125
 
126 126
 		return $atts;
127 127
 	}
@@ -136,23 +136,23 @@  discard block
 block discarded – undo
136 136
 		}
137 137
 
138 138
 		// Prevent empty content from getting added to the lightbox gallery
139
-		if ( is_array( $additional_details ) && empty( $additional_details['file_path'] ) ) {
139
+		if ( is_array( $additional_details ) && empty( $additional_details[ 'file_path' ] ) ) {
140 140
 			return $link_atts;
141 141
 		}
142 142
 
143 143
 		// Prevent empty content from getting added to the lightbox gallery
144
-		if ( is_array( $additional_details ) && ! empty( $additional_details['disable_lightbox'] ) ) {
144
+		if ( is_array( $additional_details ) && ! empty( $additional_details[ 'disable_lightbox' ] ) ) {
145 145
 			return $link_atts;
146 146
 		}
147 147
 
148
-		$link_atts['class'] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';
148
+		$link_atts[ 'class' ] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';
149 149
 
150
-		$link_atts['class'] = gravityview_sanitize_html_class( $link_atts['class'] );
150
+		$link_atts[ 'class' ] = gravityview_sanitize_html_class( $link_atts[ 'class' ] );
151 151
 
152 152
 		if ( $context && ! empty( $context->field->field ) ) {
153 153
 			if ( $context->field->field->multipleFiles ) {
154 154
 				$entry = $context->entry->as_entry();
155
-				$link_atts['data-fancybox'] = 'gallery-' . sprintf( "%s-%s-%s", $entry['form_id'], $context->field->ID, $context->entry->get_slug() );
155
+				$link_atts[ 'data-fancybox' ] = 'gallery-' . sprintf( "%s-%s-%s", $entry[ 'form_id' ], $context->field->ID, $context->entry->get_slug() );
156 156
 			}
157 157
 		}
158 158
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				),
168 168
 			);
169 169
 
170
-			$link_atts['data-options'] = json_encode( $fancybox_settings );
170
+			$link_atts[ 'data-options' ] = json_encode( $fancybox_settings );
171 171
 		}
172 172
 
173 173
 		return $link_atts;
Please login to merge, or discard this patch.
includes/extensions/lightbox/class-gravityview-lightbox-provider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 		add_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10, 4 );
24 24
 		add_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) );
25 25
 
26
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') );
27
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') );
26
+		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
27
+		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
28 28
 
29 29
 		add_action( 'gravityview/template/after', array( $this, 'print_scripts' ) );
30 30
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 		remove_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10 );
93 93
 		remove_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) );
94 94
 
95
-		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') );
96
-		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') );
95
+		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
96
+		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
97 97
 
98 98
 		remove_action( 'wp_footer', array( $this, 'output_footer' ) );
99 99
 	}
Please login to merge, or discard this patch.
includes/admin/entry-list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 );
12 12
 
13 13
 		// Add script to enable edit link
14
-		add_action( 'admin_head', array( $this, 'add_edit_script') );
14
+		add_action( 'admin_head', array( $this, 'add_edit_script' ) );
15 15
 	}
16 16
 
17 17
 	/**
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 			'page' => 'gf_entries',
61 61
 			'view' => 'entry',
62 62
 			'id'	=> (int)$form_id,
63
-			'lid'	=>	(int)$lead["id"],
63
+			'lid'	=>	(int)$lead[ "id" ],
64 64
 			'screen_mode'	=> 'edit',
65 65
 		);
66 66
 		?>
67 67
 
68 68
 		<span class="edit edit_entry">
69 69
 			|
70
-		    <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a>
70
+		    <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview' ); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page=' . $query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a>
71 71
 		</span>
72 72
 		<?php
73 73
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
28 28
 
29
-		unset( $field_options['search_filter'] );
29
+		unset( $field_options[ 'search_filter' ] );
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ( 'edit' === $context ) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35
-		$add_options['link_to_file'] = array(
35
+		$add_options[ 'link_to_file' ] = array(
36 36
 			'type' => 'checkbox',
37 37
 			'label' => __( 'Display as a Link:', 'gravityview' ),
38
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
38
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
39 39
 			'value' => false,
40 40
 			'merge_tags' => false,
41 41
 		);
42 42
 
43
-		$add_options['image_width'] = array(
43
+		$add_options[ 'image_width' ] = array(
44 44
 			'type' => 'text',
45 45
 			'label' => __( 'Custom Width:', 'gravityview' ),
46 46
 			'desc' => __( 'Override the default image width (250).', 'gravityview' ),
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 			$base_id = null;
130 130
 
131 131
 			$is_single = gravityview_get_context() === 'single';
132
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
132
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
133 133
 			$field_compat = $gravityview_view->getCurrentField();
134 134
 		}
135 135
 
136 136
 		$output_arr = array();
137 137
 
138 138
 		// Get an array of file paths for the field.
139
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
139
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
140 140
 
141 141
 		// The $value JSON was probably truncated; let's check lead_detail_long.
142 142
 		if ( ! is_array( $file_paths ) ) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			$rendered = null;
157 157
 
158 158
 			// If the site is HTTPS, use HTTPS
159
-			if ( function_exists('set_url_scheme') ) {
159
+			if ( function_exists( 'set_url_scheme' ) ) {
160 160
 				$file_path = set_url_scheme( $file_path );
161 161
 			}
162 162
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 			$file_path_info = pathinfo( $file_path );
168 168
 
169 169
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
170
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
171
-			$basename = $file_path_info['basename'];
170
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
171
+			$basename = $file_path_info[ 'basename' ];
172 172
 
173 173
 			// Get the secure download URL
174 174
 			$is_secure = false;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 					 */
209 209
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
210 210
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
211
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
211
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
212 212
 					), $context );
213 213
 
214 214
 					/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 					 */
245 245
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
246 246
 						'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension
247
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
247
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
248 248
 					), $context );
249 249
 
250 250
 					/**
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
 					$file_path = add_query_arg( array( 'gv-iframe' => 'true' ), $file_path );
276 276
 				}
277 277
 
278
-				$field_settings['link_to_file'] = true;
278
+				$field_settings[ 'link_to_file' ] = true;
279 279
 
280 280
 			// Images
281 281
 			} else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) {
282 282
 				$width = \GV\Utils::get( $field_settings, 'image_width', 250 );
283 283
 				$image_atts = array(
284 284
 					'src'   => $file_path,
285
-					'class' => 'gv-image gv-field-id-' . $field_settings['id'],
286
-					'alt'   => $field_settings['label'],
287
-					'width' => ( $is_single ? null : ( $width ? $width: 250 ) )
285
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
286
+					'alt'   => $field_settings[ 'label' ],
287
+					'width' => ( $is_single ? null : ( $width ? $width : 250 ) )
288 288
 				);
289 289
 
290 290
 				if ( $is_secure ) {
291
-					$image_atts['validate_src'] = false;
291
+					$image_atts[ 'validate_src' ] = false;
292 292
 				}
293 293
 
294 294
 				/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
 				unset( $gv_entry );
311 311
 
312
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {
312
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) {
313 313
 					$lightbox_link_atts = array(
314 314
 						'rel'   => sprintf( "%s-%s", $gv_class, $entry_slug ),
315 315
 						'class' => '',
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 				}
324 324
 
325 325
 				// Show as link should render the image regardless.
326
-				if ( ! empty( $field_settings['show_as_link'] ) ) {
326
+				if ( ! empty( $field_settings[ 'show_as_link' ] ) ) {
327 327
 					$text = $rendered;
328 328
 				}
329 329
 			}
330 330
 			// For all other non-media file types (ZIP, for example), always show as a link regardless of setting.
331 331
 			else {
332
-				$field_settings['link_to_file'] = true;
332
+				$field_settings[ 'link_to_file' ] = true;
333 333
 				$disable_lightbox = true;
334 334
 			}
335 335
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
346 346
 
347 347
 			// Output textualized content where
348
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) {
348
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) {
349 349
 				/**
350 350
 				 * Modify the link text (defaults to the file name)
351 351
 				 *
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 				 */
359 359
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context );
360 360
 
361
-				if ( empty( $field_settings['show_as_link'] ) ) {
361
+				if ( empty( $field_settings[ 'show_as_link' ] ) ) {
362 362
 					/**
363 363
 					 * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field
364 364
 					 * @since 2.0 Added $context
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 				$content = empty( $rendered ) ? $text : $rendered;
380 380
 			}
381 381
 
382
-			$output_arr[] = array(
382
+			$output_arr[ ] = array(
383 383
 				'file_path' => $file_path,
384 384
 				'content' => $content
385 385
 			);
Please login to merge, or discard this patch.
includes/presets/register-default-templates.php 1 patch
Spacing   +7 added lines, -7 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/demo/view/datatables/?utm_source=plugin&utm_medium=try_demo&utm_campaign=view_type&utm_term=datatables',
66 66
 			'license' => esc_html__( 'All Access', 'gravityview' ),
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
 				continue;
103 103
 			}
104 104
 
105
-			$license_price_id = (int) \GV\Utils::get( $license, 'price_id', 0 );
106
-			$placeholder_price_id = (int) \GV\Utils::get( $placeholder, 'price_id' );
105
+			$license_price_id = (int)\GV\Utils::get( $license, 'price_id', 0 );
106
+			$placeholder_price_id = (int)\GV\Utils::get( $placeholder, 'price_id' );
107 107
 
108
-			$placeholder['type']     = 'custom';
109
-			$placeholder['included'] = ( $license_price_id >= $placeholder_price_id );
108
+			$placeholder[ 'type' ]     = 'custom';
109
+			$placeholder[ 'included' ] = ( $license_price_id >= $placeholder_price_id );
110 110
 
111
-			new GravityView_Placeholder_Template( $placeholder['slug'], $placeholder );
111
+			new GravityView_Placeholder_Template( $placeholder[ 'slug' ], $placeholder );
112 112
 		}
113 113
 
114 114
 	} catch ( Exception $exception ) {
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-admin.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     function load() {
26 26
 
27
-        if( !is_admin() ) {
27
+        if ( ! is_admin() ) {
28 28
             return;
29 29
         }
30 30
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40 40
         // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
41
+        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) );
42 42
 
43 43
         // custom fields' options for zone EDIT
44 44
         add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
      */
78 78
     function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
79 79
 
80
-        if( $zone !== 'edit' ) {
80
+        if ( $zone !== 'edit' ) {
81 81
 
82
-            $entry_default_fields['edit_link'] = array(
83
-                'label' => __('Link to Edit Entry', 'gravityview'),
82
+            $entry_default_fields[ 'edit_link' ] = array(
83
+                'label' => __( 'Link to Edit Entry', 'gravityview' ),
84 84
                 'type' => 'edit_link',
85
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
85
+                'desc'	=> __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ),
86 86
                 'icon' => 'dashicons-welcome-write-blog',
87 87
             );
88 88
 
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
         $caps = $visibility_caps;
108 108
 
109 109
         // If we're configuring fields in the edit context, we want a limited selection
110
-        if( $context === 'edit' ) {
110
+        if ( $context === 'edit' ) {
111 111
 
112 112
             // Remove other built-in caps.
113
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
113
+            unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] );
114 114
 
115
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
115
+            $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' );
116 116
         }
117 117
 
118 118
         return $caps;
@@ -132,20 +132,20 @@  discard block
 block discarded – undo
132 132
     function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
133 133
 
134 134
         // Always a link, never a filter
135
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
135
+        unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
136 136
 
137 137
         // Edit Entry link should only appear to visitors capable of editing entries
138
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
138
+        unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
139 139
 
140
-        $add_option['edit_link'] = array(
140
+        $add_option[ 'edit_link' ] = array(
141 141
             'type' => 'text',
142 142
             'label' => __( 'Edit Link Text', 'gravityview' ),
143 143
             'desc' => NULL,
144
-            'value' => __('Edit Entry', 'gravityview'),
144
+            'value' => __( 'Edit Entry', 'gravityview' ),
145 145
             'merge_tags' => true,
146 146
         );
147 147
 
148
-	    $add_option['new_window'] = array(
148
+	    $add_option[ 'new_window' ] = array(
149 149
 		    'type' => 'checkbox',
150 150
 		    'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
151 151
 		    'value' => false,
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 
166 166
         $return = $tooltips;
167 167
 
168
-        $return['allow_edit_cap'] = array(
169
-            'title' => __('Limiting Edit Access', 'gravityview'),
170
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
168
+        $return[ 'allow_edit_cap' ] = array(
169
+            'title' => __( 'Limiting Edit Access', 'gravityview' ),
170
+            'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ),
171 171
         );
172 172
 
173 173
         return $return;
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
189 189
 
190 190
         // We only want to modify the settings for the edit context
191
-        if( 'edit' !== $context ) {
191
+        if ( 'edit' !== $context ) {
192 192
             return $field_options;
193 193
         }
194 194
 
195 195
         //  Entry field is only for logged in users
196
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
196
+        unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] );
197 197
 
198 198
         $add_options = array(
199 199
             'allow_edit_cap' => array(
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -10,42 +10,42 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 if ( ! defined( 'WPINC' ) ) {
13
-    die;
13
+	die;
14 14
 }
15 15
 
16 16
 
17 17
 class GravityView_Edit_Entry_Admin {
18 18
 
19
-    protected $loader;
19
+	protected $loader;
20 20
 
21
-    function __construct( GravityView_Edit_Entry $loader ) {
22
-        $this->loader = $loader;
23
-    }
21
+	function __construct( GravityView_Edit_Entry $loader ) {
22
+		$this->loader = $loader;
23
+	}
24 24
 
25
-    function load() {
25
+	function load() {
26 26
 
27
-        if( !is_admin() ) {
28
-            return;
29
-        }
27
+		if( !is_admin() ) {
28
+			return;
29
+		}
30 30
 
31
-        // Add Edit Link as a default field, outside those set in the Gravity Form form
32
-        add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
31
+		// Add Edit Link as a default field, outside those set in the Gravity Form form
32
+		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
33 33
 
34
-        // For the Edit Entry Link, you don't want visible to all users.
35
-        add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
34
+		// For the Edit Entry Link, you don't want visible to all users.
35
+		add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 );
36 36
 
37
-        // Modify the field options based on the name of the field type
38
-        add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
37
+		// Modify the field options based on the name of the field type
38
+		add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 );
39 39
 
40
-        // add tooltips
41
-        add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
40
+		// add tooltips
41
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') );
42 42
 
43
-        // custom fields' options for zone EDIT
44
-        add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
43
+		// custom fields' options for zone EDIT
44
+		add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 );
45 45
 
46
-        // Add Edit Entry settings to View Settings
47
-        add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
-    }
46
+		// Add Edit Entry settings to View Settings
47
+		add_action( 'gravityview/metaboxes/edit_entry', array( $this, 'view_settings_metabox' ) );
48
+	}
49 49
 
50 50
 	/**
51 51
 	 * Render Edit Entry View metabox settings
@@ -73,109 +73,109 @@  discard block
 block discarded – undo
73 73
 		GravityView_Render_Settings::render_setting_row( 'action_label_cancel', $current_settings );
74 74
 	}
75 75
 
76
-    /**
77
-     * Add Edit Link as a default field, outside those set in the Gravity Form form
78
-     * @param array $entry_default_fields Existing fields
79
-     * @param  string|array $form form_ID or form object
80
-     * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
81
-     */
82
-    function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
83
-
84
-        if( $zone !== 'edit' ) {
85
-
86
-            $entry_default_fields['edit_link'] = array(
87
-                'label' => __('Link to Edit Entry', 'gravityview'),
88
-                'type' => 'edit_link',
89
-                'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
90
-                'icon' => 'dashicons-welcome-write-blog',
91
-            );
92
-
93
-        }
94
-
95
-        return $entry_default_fields;
96
-    }
97
-
98
-    /**
99
-     * Change wording for the Edit context to read Entry Creator
100
-     *
101
-     * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
102
-     * @param  string      $field_type  Type of field options to render (`field` or `widget`)
103
-     * @param  string      $template_id Table slug
104
-     * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
105
-     * @param  string      $context     What context are we in? Example: `single` or `directory`
106
-     * @param  string      $input_type  (textarea, list, select, etc.)
107
-     * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
108
-     */
109
-    function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
110
-
111
-        $caps = $visibility_caps;
112
-
113
-        // If we're configuring fields in the edit context, we want a limited selection
114
-        if( $context === 'edit' ) {
115
-
116
-            // Remove other built-in caps.
117
-            unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
118
-
119
-            $caps['read'] = _x('Entry Creator','User capability', 'gravityview');
120
-        }
121
-
122
-        return $caps;
123
-    }
124
-
125
-    /**
126
-     * Add "Edit Link Text" setting to the edit_link field settings
127
-     *
128
-     * @param array  $field_options
129
-     * @param string $template_id
130
-     * @param string $field_id
131
-     * @param string $context
132
-     * @param string $input_type
133
-     *
134
-     * @return array $field_options, with "Edit Link Text" field option
135
-     */
136
-    function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
137
-
138
-        // Always a link, never a filter
139
-        unset( $field_options['show_as_link'], $field_options['search_filter'] );
140
-
141
-        // Edit Entry link should only appear to visitors capable of editing entries
142
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
143
-
144
-        $add_option['edit_link'] = array(
145
-            'type' => 'text',
146
-            'label' => __( 'Edit Link Text', 'gravityview' ),
147
-            'desc' => NULL,
148
-            'value' => __('Edit Entry', 'gravityview'),
149
-            'merge_tags' => true,
150
-        );
151
-
152
-	    $add_option['new_window'] = array(
153
-		    'type' => 'checkbox',
154
-		    'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
155
-		    'value' => false,
156
-		    'group' => 'display',
157
-		    'priority' => 1300,
158
-	    );
159
-
160
-        return array_merge( $add_option, $field_options );
161
-    }
162
-
163
-    /**
164
-     * Add tooltips
165
-     * @param  array $tooltips Existing tooltips
166
-     * @return array           Modified tooltips
167
-     */
168
-    function tooltips( $tooltips ) {
169
-
170
-        $return = $tooltips;
171
-
172
-        $return['allow_edit_cap'] = array(
173
-            'title' => __('Limiting Edit Access', 'gravityview'),
174
-            'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
175
-        );
176
-
177
-        return $return;
178
-    }
76
+	/**
77
+	 * Add Edit Link as a default field, outside those set in the Gravity Form form
78
+	 * @param array $entry_default_fields Existing fields
79
+	 * @param  string|array $form form_ID or form object
80
+	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
81
+	 */
82
+	function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) {
83
+
84
+		if( $zone !== 'edit' ) {
85
+
86
+			$entry_default_fields['edit_link'] = array(
87
+				'label' => __('Link to Edit Entry', 'gravityview'),
88
+				'type' => 'edit_link',
89
+				'desc'	=> __('A link to edit the entry. Visible based on View settings.', 'gravityview'),
90
+				'icon' => 'dashicons-welcome-write-blog',
91
+			);
92
+
93
+		}
94
+
95
+		return $entry_default_fields;
96
+	}
97
+
98
+	/**
99
+	 * Change wording for the Edit context to read Entry Creator
100
+	 *
101
+	 * @param  array 	   $visibility_caps        Array of capabilities to display in field dropdown.
102
+	 * @param  string      $field_type  Type of field options to render (`field` or `widget`)
103
+	 * @param  string      $template_id Table slug
104
+	 * @param  float       $field_id    GF Field ID - Example: `3`, `5.2`, `entry_link`, `created_by`
105
+	 * @param  string      $context     What context are we in? Example: `single` or `directory`
106
+	 * @param  string      $input_type  (textarea, list, select, etc.)
107
+	 * @return array                   Array of field options with `label`, `value`, `type`, `default` keys
108
+	 */
109
+	function modify_visibility_caps( $visibility_caps = array(), $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
110
+
111
+		$caps = $visibility_caps;
112
+
113
+		// If we're configuring fields in the edit context, we want a limited selection
114
+		if( $context === 'edit' ) {
115
+
116
+			// Remove other built-in caps.
117
+			unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] );
118
+
119
+			$caps['read'] = _x('Entry Creator','User capability', 'gravityview');
120
+		}
121
+
122
+		return $caps;
123
+	}
124
+
125
+	/**
126
+	 * Add "Edit Link Text" setting to the edit_link field settings
127
+	 *
128
+	 * @param array  $field_options
129
+	 * @param string $template_id
130
+	 * @param string $field_id
131
+	 * @param string $context
132
+	 * @param string $input_type
133
+	 *
134
+	 * @return array $field_options, with "Edit Link Text" field option
135
+	 */
136
+	function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
137
+
138
+		// Always a link, never a filter
139
+		unset( $field_options['show_as_link'], $field_options['search_filter'] );
140
+
141
+		// Edit Entry link should only appear to visitors capable of editing entries
142
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
143
+
144
+		$add_option['edit_link'] = array(
145
+			'type' => 'text',
146
+			'label' => __( 'Edit Link Text', 'gravityview' ),
147
+			'desc' => NULL,
148
+			'value' => __('Edit Entry', 'gravityview'),
149
+			'merge_tags' => true,
150
+		);
151
+
152
+		$add_option['new_window'] = array(
153
+			'type' => 'checkbox',
154
+			'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
155
+			'value' => false,
156
+			'group' => 'display',
157
+			'priority' => 1300,
158
+		);
159
+
160
+		return array_merge( $add_option, $field_options );
161
+	}
162
+
163
+	/**
164
+	 * Add tooltips
165
+	 * @param  array $tooltips Existing tooltips
166
+	 * @return array           Modified tooltips
167
+	 */
168
+	function tooltips( $tooltips ) {
169
+
170
+		$return = $tooltips;
171
+
172
+		$return['allow_edit_cap'] = array(
173
+			'title' => __('Limiting Edit Access', 'gravityview'),
174
+			'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'),
175
+		);
176
+
177
+		return $return;
178
+	}
179 179
 
180 180
 	/**
181 181
 	 * Add "Edit Link Text" setting to the edit_link field settings
@@ -191,28 +191,28 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
193 193
 
194
-        // We only want to modify the settings for the edit context
195
-        if( 'edit' !== $context ) {
196
-            return $field_options;
197
-        }
198
-
199
-        //  Entry field is only for logged in users
200
-        unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
201
-
202
-        $add_options = array(
203
-            'allow_edit_cap' => array(
204
-                'type' => 'select',
205
-                'label' => __( 'Make field editable to:', 'gravityview' ),
206
-                'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
207
-                'tooltip' => 'allow_edit_cap',
208
-                'class' => 'widefat',
209
-                'value' => 'read', // Default: entry creator
210
-                'group' => 'visibility',
211
-            ),
212
-        );
213
-
214
-        return array_merge( $field_options, $add_options );
215
-    }
194
+		// We only want to modify the settings for the edit context
195
+		if( 'edit' !== $context ) {
196
+			return $field_options;
197
+		}
198
+
199
+		//  Entry field is only for logged in users
200
+		unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] );
201
+
202
+		$add_options = array(
203
+			'allow_edit_cap' => array(
204
+				'type' => 'select',
205
+				'label' => __( 'Make field editable to:', 'gravityview' ),
206
+				'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ),
207
+				'tooltip' => 'allow_edit_cap',
208
+				'class' => 'widefat',
209
+				'value' => 'read', // Default: entry creator
210
+				'group' => 'visibility',
211
+			),
212
+		);
213
+
214
+		return array_merge( $field_options, $add_options );
215
+	}
216 216
 
217 217
 
218 218
 } // end class
Please login to merge, or discard this patch.