Completed
Pull Request — master (#747)
by Steve
19:06
created
includes/fields/class-gravityview-field-entry-link.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,25 +30,25 @@
 block discarded – undo
30 30
 
31 31
 	public function __construct() {
32 32
 		$this->label = esc_html__( 'Link to Entry', 'gravityview' );
33
-		$this->description = esc_html__('A dedicated link to the single entry with customizable text.', 'gravityview');
33
+		$this->description = esc_html__( 'A dedicated link to the single entry with customizable text.', 'gravityview' );
34 34
 		parent::__construct();
35 35
 	}
36 36
 
37 37
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
38 38
 
39 39
 		// Always a link!
40
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
40
+		unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] );
41 41
 
42
-		if( 'edit' === $context ) {
42
+		if ( 'edit' === $context ) {
43 43
 			return $field_options;
44 44
 		}
45 45
 
46 46
 		$add_options = array();
47
-		$add_options['entry_link_text'] = array(
47
+		$add_options[ 'entry_link_text' ] = array(
48 48
 			'type' => 'text',
49 49
 			'label' => __( 'Link Text:', 'gravityview' ),
50 50
 			'desc' => NULL,
51
-			'value' => __('View Details', 'gravityview'),
51
+			'value' => __( 'View Details', 'gravityview' ),
52 52
 			'merge_tags' => true,
53 53
 		);
54 54
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-status.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 		$this->label = esc_html__( 'Payment Status', 'gravityview' );
26
-		$this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' );
26
+		$this->description = esc_html__( 'The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' );
27 27
 		parent::__construct();
28 28
 	}
29 29
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-calculation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
37 37
 	public function blacklist_field_types( $field_types = array(), $context = '' ) {
38 38
 
39 39
 		// Allow Calculation field in Edit Entry
40
-		if( 'edit' !== $context ) {
41
-			$field_types[] = $this->name;
40
+		if ( 'edit' !== $context ) {
41
+			$field_types[ ] = $this->name;
42 42
 		}
43 43
 
44 44
 		return $field_types;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-website.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
27 27
 
28 28
 		// It makes no sense to use this as the link.
29
-		unset( $field_options['show_as_link'] );
29
+		unset( $field_options[ 'show_as_link' ] );
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ( 'edit' === $context ) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35 35
 		/**
36 36
 		 * @since 1.8
37 37
 		 */
38
-		$field_options['anchor_text'] = array(
38
+		$field_options[ 'anchor_text' ] = array(
39 39
 			'type' => 'text',
40 40
 			'label' => __( 'Link Text:', 'gravityview' ),
41 41
 			'desc' => __( 'Define custom link text. Leave blank to display the URL', 'gravityview' ),
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 			'merge_tags' => 'force',
44 44
 		);
45 45
 
46
-		$field_options['truncatelink'] = array(
46
+		$field_options[ 'truncatelink' ] = array(
47 47
 			'type' => 'checkbox',
48 48
 			'value' => true,
49 49
 			'label' => __( 'Shorten Link Display', 'gravityview' ),
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			'desc' => __( 'Don’t show the full URL, only show the domain.', 'gravityview' )
52 52
 		);
53 53
 
54
-		$field_options['open_same_window'] = array(
54
+		$field_options[ 'open_same_window' ] = array(
55 55
 			'type' => 'checkbox',
56 56
 			'value' => false,
57 57
 			'label' => __( 'Open link in the same window?', 'gravityview' ),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-gquiz_score.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
20 20
 
21
-		if( 'edit' === $context ) {
21
+		if ( 'edit' === $context ) {
22 22
 			return $field_options;
23 23
 		}
24 24
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			'quiz_use_max_score' => array(
27 27
 				'type' => 'checkbox',
28 28
 				'label' => __( 'Show Max Score?', 'gravityview' ),
29
-				'desc' => __('Display score as the a fraction: "[score]/[max score]". If unchecked, will display score.', 'gravityview'),
29
+				'desc' => __( 'Display score as the a fraction: "[score]/[max score]". If unchecked, will display score.', 'gravityview' ),
30 30
 				'value' => true,
31 31
 				'merge_tags' => false,
32 32
 			),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-section.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@
 block discarded – undo
41 41
 
42 42
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
43 43
 
44
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
44
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
45 45
 
46 46
 		// Set the default CSS class to gv-section, which applies a border and top/bottom margin
47
-		$field_options['custom_class']['value'] = 'gv-section';
47
+		$field_options[ 'custom_class' ][ 'value' ] = 'gv-section';
48 48
 
49 49
 		return $field_options;
50 50
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-created-by.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 
35 35
 		$merge_tags = array(
36 36
 			array(
37
-				'label' => __('Entry Creator: Display Name', 'gravityview'),
37
+				'label' => __( 'Entry Creator: Display Name', 'gravityview' ),
38 38
 				'tag' => '{created_by:display_name}'
39 39
 			),
40 40
 			array(
41
-				'label' => __('Entry Creator: Email', 'gravityview'),
41
+				'label' => __( 'Entry Creator: Email', 'gravityview' ),
42 42
 				'tag' => '{created_by:user_email}'
43 43
 			),
44 44
 			array(
45
-				'label' => __('Entry Creator: Username', 'gravityview'),
45
+				'label' => __( 'Entry Creator: Username', 'gravityview' ),
46 46
 				'tag' => '{created_by:user_login}'
47 47
 			),
48 48
 			array(
49
-				'label' => __('Entry Creator: User ID', 'gravityview'),
49
+				'label' => __( 'Entry Creator: User ID', 'gravityview' ),
50 50
 				'tag' => '{created_by:ID}'
51 51
 			),
52 52
 			array(
53
-				'label' => __('Entry Creator: Roles', 'gravityview'),
53
+				'label' => __( 'Entry Creator: Roles', 'gravityview' ),
54 54
 				'tag' => '{created_by:roles}'
55 55
 			),
56 56
 		);
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
79 79
 
80 80
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
81
-		if( empty( $entry['created_by'] ) ) {
81
+		if ( empty( $entry[ 'created_by' ] ) ) {
82 82
 			return $text;
83 83
 		}
84 84
 
85 85
 		// Get the creator of the entry
86
-		$entry_creator = new WP_User( $entry['created_by'] );
86
+		$entry_creator = new WP_User( $entry[ 'created_by' ] );
87 87
 
88 88
 		foreach ( $matches as $match ) {
89 89
 
90
-			$full_tag = $match[0];
91
-			$property = $match[1];
90
+			$full_tag = $match[ 0 ];
91
+			$property = $match[ 1 ];
92 92
 
93
-			switch( $property ) {
93
+			switch ( $property ) {
94 94
 				/** @since 1.13.2 */
95 95
 				case 'roles':
96 96
 					$value = implode( ', ', $entry_creator->roles );
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 
114 114
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
115 115
 
116
-		if( 'edit' === $context ) {
116
+		if ( 'edit' === $context ) {
117 117
 			return $field_options;
118 118
 		}
119 119
 
120
-		$field_options['name_display'] = array(
120
+		$field_options[ 'name_display' ] = array(
121 121
 			'type' => 'select',
122 122
 			'label' => __( 'User Format', 'gravityview' ),
123
-			'desc' => __( 'How should the User information be displayed?', 'gravityview'),
123
+			'desc' => __( 'How should the User information be displayed?', 'gravityview' ),
124 124
 			'choices' => array(
125
-				'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'),
126
-				'user_login' => __('Username (Example: "nostromo")', 'gravityview'),
127
-				'ID' => __('User ID # (Example: 426)', 'gravityview'),
125
+				'display_name' => __( 'Display Name (Example: "Ellen Ripley")', 'gravityview' ),
126
+				'user_login' => __( 'Username (Example: "nostromo")', 'gravityview' ),
127
+				'ID' => __( 'User ID # (Example: 426)', 'gravityview' ),
128 128
 			),
129 129
 			'value' => 'display_name'
130 130
 		);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-custom.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
 
37 37
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
38 38
 
39
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
39
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
40 40
 
41
-		if( 'edit' === $context ) {
41
+		if ( 'edit' === $context ) {
42 42
 			return $field_options;
43 43
 		}
44 44
 
Please login to merge, or discard this patch.
includes/class-gravityview-admin-notices.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 	public function dismiss_notice() {
58 58
 
59 59
 		// No dismiss sent
60
-		if( empty( $_GET['gv-dismiss'] ) ) {
60
+		if ( empty( $_GET[ 'gv-dismiss' ] ) ) {
61 61
 			return;
62 62
 		}
63 63
 
64 64
 		// Invalid nonce
65
-		if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) {
65
+		if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) {
66 66
 			return;
67 67
 		}
68 68
 
69
-		$notice_id = esc_attr( $_GET['notice'] );
69
+		$notice_id = esc_attr( $_GET[ 'notice' ] );
70 70
 
71 71
 		//don't display a message if use has dismissed the message for this version
72 72
 		$dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' );
73 73
 
74
-		$dismissed_notices[] = $notice_id;
74
+		$dismissed_notices[ ] = $notice_id;
75 75
 
76 76
 		$dismissed_notices = array_unique( $dismissed_notices );
77 77
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	private function is_notice_dismissed( $notice ) {
95 95
 
96 96
 		// There are no dismissed notices.
97
-		if( empty( self::$dismissed_notices ) ) {
97
+		if ( empty( self::$dismissed_notices ) ) {
98 98
 			return false;
99 99
 		}
100 100
 
101 101
 		// Has the
102
-		$is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices );
102
+		$is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices );
103 103
 
104 104
 		return $is_dismissed ? true : false;
105 105
 	}
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	private function check_show_multisite_notices() {
126 126
 
127
-		if( ! is_multisite() ) {
127
+		if ( ! is_multisite() ) {
128 128
 			return true;
129 129
 		}
130 130
 
131 131
 		// It's network activated but the user can't manage network plugins; they can't do anything about it.
132
-		if( GravityView_Plugin::is_network_activated() && ! is_main_site() ) {
132
+		if ( GravityView_Plugin::is_network_activated() && ! is_main_site() ) {
133 133
 			return false;
134 134
 		}
135 135
 
136 136
 		// or they don't have admin capabilities
137
-		if( ! is_super_admin() ) {
137
+		if ( ! is_super_admin() ) {
138 138
 			return false;
139 139
 		}
140 140
 
@@ -157,48 +157,48 @@  discard block
 block discarded – undo
157 157
 		 */
158 158
 		$notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices );
159 159
 
160
-		if( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
160
+		if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) {
161 161
 			return;
162 162
 		}
163 163
 
164 164
 		//don't display a message if use has dismissed the message for this version
165 165
 		// TODO: Use get_user_meta instead of get_transient
166
-		self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
166
+		self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' );
167 167
 
168 168
 		$output = '';
169 169
 
170
-		foreach( $notices as $notice ) {
170
+		foreach ( $notices as $notice ) {
171 171
 
172 172
 			// If the user doesn't have the capability to see the warning
173
-			if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) {
173
+			if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) {
174 174
 				do_action( 'gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice );
175 175
 				continue;
176 176
 			}
177 177
 
178
-			if( true === $this->is_notice_dismissed( $notice ) ) {
178
+			if ( true === $this->is_notice_dismissed( $notice ) ) {
179 179
 				do_action( 'gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice );
180 180
 				continue;
181 181
 			}
182 182
 
183
-			$output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">';
183
+			$output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">';
184 184
 
185 185
 			// Too cute to leave out.
186 186
 			$output .= gravityview_get_floaty();
187 187
 
188
-			if( !empty( $notice['title'] ) ) {
189
-				$output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>';
188
+			if ( ! empty( $notice[ 'title' ] ) ) {
189
+				$output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>';
190 190
 			}
191 191
 
192
-			$message = isset( $notice['message'] ) ? $notice['message'] : '';
192
+			$message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : '';
193 193
 
194
-			if( !empty( $notice['dismiss'] ) ) {
194
+			if ( ! empty( $notice[ 'dismiss' ] ) ) {
195 195
 
196
-				$dismiss = esc_attr($notice['dismiss']);
196
+				$dismiss = esc_attr( $notice[ 'dismiss' ] );
197 197
 
198 198
 				$url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) );
199 199
 
200 200
 				$align = is_rtl() ? 'alignleft' : 'alignright';
201
-				$message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>';
201
+				$message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>';
202 202
 			}
203 203
 
204 204
 			$output .= wpautop( $message );
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public static function add_notice( $notice = array() ) {
227 227
 
228
-		if( !isset( $notice['message'] ) ) {
228
+		if ( ! isset( $notice[ 'message' ] ) ) {
229 229
 			do_action( 'gravityview_log_error', 'GravityView_Admin[add_notice] Notice not set', $notice );
230 230
 			return;
231 231
 		}
232 232
 
233
-		$notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class'];
233
+		$notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ];
234 234
 
235
-		self::$admin_notices[] = $notice;
235
+		self::$admin_notices[ ] = $notice;
236 236
 	}
237 237
 }
238 238
 
Please login to merge, or discard this patch.