Completed
Pull Request — master (#815)
by Zack
10:24 queued 07:03
created
includes/admin/class.field.type.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -158,6 +158,7 @@
 block discarded – undo
158 158
     /**
159 159
      * important! Override this class if needed
160 160
      * outputs the field setting html
161
+     * @param string $override_input
161 162
      */
162 163
     function render_setting( $override_input = NULL ) {
163 164
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
         $defaults = self::get_field_defaults();
34 34
 
35 35
         // Backward compatibility
36
-        if( !empty( $field['choices'] ) ) {
37
-        	$field['options'] = $field['choices'];
38
-        	unset( $field['choices'] );
36
+        if ( ! empty( $field[ 'choices' ] ) ) {
37
+        	$field[ 'options' ] = $field[ 'choices' ];
38
+        	unset( $field[ 'choices' ] );
39 39
         }
40 40
 
41
-        $this->field =  wp_parse_args( $field, $defaults );
41
+        $this->field = wp_parse_args( $field, $defaults );
42 42
 
43
-        $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value;
43
+        $this->value = is_null( $curr_value ) ? $this->field[ 'value' ] : $curr_value;
44 44
 
45 45
     }
46 46
 
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
     function get_tooltip() {
81
-        if( !function_exists('gform_tooltip') ) {
81
+        if ( ! function_exists( 'gform_tooltip' ) ) {
82 82
             return NULL;
83 83
         }
84 84
 
85
-        return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL;
85
+        return ! empty( $this->field[ 'tooltip' ] ) ? ' ' . gform_tooltip( $this->field[ 'tooltip' ], false, true ) : NULL;
86 86
     }
87 87
 
88 88
     /**
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
      * @return string
91 91
      */
92 92
     function get_field_id() {
93
-        if( isset( $this->field['id'] ) ) {
94
-            return esc_attr( $this->field['id'] );
93
+        if ( isset( $this->field[ 'id' ] ) ) {
94
+            return esc_attr( $this->field[ 'id' ] );
95 95
         }
96 96
         return esc_attr( sanitize_html_class( $this->name ) );
97 97
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @return string
102 102
      */
103 103
     function get_field_label() {
104
-        return esc_html( trim( $this->field['label'] ) );
104
+        return esc_html( trim( $this->field[ 'label' ] ) );
105 105
     }
106 106
 
107 107
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return string
113 113
 	 */
114 114
 	function get_field_left_label() {
115
-		return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL;
115
+		return ! empty( $this->field[ 'left_label' ] ) ? esc_html( trim( $this->field[ 'left_label' ] ) ) : NULL;
116 116
 	}
117 117
 
118 118
     /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @return string
121 121
      */
122 122
     function get_label_class() {
123
-        return 'gv-label-'. sanitize_html_class( $this->field['type'] );
123
+        return 'gv-label-' . sanitize_html_class( $this->field[ 'type' ] );
124 124
     }
125 125
 
126 126
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @return string
130 130
      */
131 131
     function get_field_desc() {
132
-        return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : '';
132
+        return ! empty( $this->field[ 'desc' ] ) ? '<span class="howto">' . $this->field[ 'desc' ] . '</span>' : '';
133 133
     }
134 134
 
135 135
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     function render_setting( $override_input = NULL ) {
164 164
 
165
-        if( !empty( $this->field['full_width'] ) ) { ?>
165
+        if ( ! empty( $this->field[ 'full_width' ] ) ) { ?>
166 166
             <th scope="row" colspan="2">
167 167
                 <div>
168 168
                     <label for="<?php echo $this->get_field_id(); ?>">
Please login to merge, or discard this patch.
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -10,160 +10,160 @@  discard block
 block discarded – undo
10 10
 	 *
11 11
 	 * @var string
12 12
 	 */
13
-    protected $name;
13
+	protected $name;
14 14
 
15 15
 	/**
16 16
 	 * Field settings
17 17
 	 *
18 18
 	 * @var array
19 19
 	 */
20
-    protected $field;
20
+	protected $field;
21 21
 
22 22
 	/**
23 23
 	 * Field current value
24 24
 	 *
25 25
 	 * @var mixed
26 26
 	 */
27
-    protected $value;
28
-
29
-    function __construct( $name = '', $field = array(), $curr_value = NULL ) {
30
-
31
-        $this->name = $name;
32
-
33
-        $defaults = self::get_field_defaults();
34
-
35
-        // Backward compatibility
36
-        if( !empty( $field['choices'] ) ) {
37
-        	$field['options'] = $field['choices'];
38
-        	unset( $field['choices'] );
39
-        }
40
-
41
-        $this->field =  wp_parse_args( $field, $defaults );
42
-
43
-        $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value;
44
-
45
-    }
46
-
47
-    /**
48
-     * Returns the default details for a field option
49
-     *
50
-     * - default    // default option value, in case nothing is defined (@deprecated)
51
-     * - desc       // option description
52
-     * - value      // the option default value
53
-     * - label      // the option label
54
-     * - left_label // In case of checkboxes, left label will appear on the left of the checkbox
55
-     * - id         // the field id
56
-     * - type       // the option type ( text, checkbox, select, ... )
57
-     * - options    // when type is select, define the select options ('choices' is @deprecated)
58
-     * - merge_tags // if the option supports merge tags feature
59
-     * - class      // (new) define extra classes for the field
60
-     * - tooltip    //
61
-     *
62
-     * @return array
63
-     */
64
-    public static function get_field_defaults() {
65
-        return array(
66
-            'desc' => '',
67
-            'value' => NULL,
68
-            'label' => '',
69
-            'left_label' => NULL,
70
-            'id' => NULL,
71
-            'type'  => 'text',
72
-            'options' => NULL,
73
-            'merge_tags' => true,
74
-            'class' => '',
75
-            'tooltip' => NULL,
76
-            'requires' => NULL
77
-        );
78
-    }
79
-
80
-
81
-    function get_tooltip() {
82
-        if( !function_exists('gform_tooltip') ) {
83
-            return NULL;
84
-        }
85
-
86
-        return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL;
87
-    }
88
-
89
-    /**
90
-     * Build input id based on the name
91
-     * @return string
92
-     */
93
-    function get_field_id() {
94
-        if( isset( $this->field['id'] ) ) {
95
-            return esc_attr( $this->field['id'] );
96
-        }
97
-        return esc_attr( sanitize_html_class( $this->name ) );
98
-    }
99
-
100
-    /**
101
-     * Retrieve field label
102
-     * @return string
103
-     */
104
-    function get_field_label() {
105
-        return esc_html( trim( $this->field['label'] ) );
106
-    }
27
+	protected $value;
28
+
29
+	function __construct( $name = '', $field = array(), $curr_value = NULL ) {
30
+
31
+		$this->name = $name;
32
+
33
+		$defaults = self::get_field_defaults();
34
+
35
+		// Backward compatibility
36
+		if( !empty( $field['choices'] ) ) {
37
+			$field['options'] = $field['choices'];
38
+			unset( $field['choices'] );
39
+		}
40
+
41
+		$this->field =  wp_parse_args( $field, $defaults );
42
+
43
+		$this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value;
44
+
45
+	}
46
+
47
+	/**
48
+	 * Returns the default details for a field option
49
+	 *
50
+	 * - default    // default option value, in case nothing is defined (@deprecated)
51
+	 * - desc       // option description
52
+	 * - value      // the option default value
53
+	 * - label      // the option label
54
+	 * - left_label // In case of checkboxes, left label will appear on the left of the checkbox
55
+	 * - id         // the field id
56
+	 * - type       // the option type ( text, checkbox, select, ... )
57
+	 * - options    // when type is select, define the select options ('choices' is @deprecated)
58
+	 * - merge_tags // if the option supports merge tags feature
59
+	 * - class      // (new) define extra classes for the field
60
+	 * - tooltip    //
61
+	 *
62
+	 * @return array
63
+	 */
64
+	public static function get_field_defaults() {
65
+		return array(
66
+			'desc' => '',
67
+			'value' => NULL,
68
+			'label' => '',
69
+			'left_label' => NULL,
70
+			'id' => NULL,
71
+			'type'  => 'text',
72
+			'options' => NULL,
73
+			'merge_tags' => true,
74
+			'class' => '',
75
+			'tooltip' => NULL,
76
+			'requires' => NULL
77
+		);
78
+	}
79
+
80
+
81
+	function get_tooltip() {
82
+		if( !function_exists('gform_tooltip') ) {
83
+			return NULL;
84
+		}
85
+
86
+		return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL;
87
+	}
88
+
89
+	/**
90
+	 * Build input id based on the name
91
+	 * @return string
92
+	 */
93
+	function get_field_id() {
94
+		if( isset( $this->field['id'] ) ) {
95
+			return esc_attr( $this->field['id'] );
96
+		}
97
+		return esc_attr( sanitize_html_class( $this->name ) );
98
+	}
99
+
100
+	/**
101
+	 * Retrieve field label
102
+	 * @return string
103
+	 */
104
+	function get_field_label() {
105
+		return esc_html( trim( $this->field['label'] ) );
106
+	}
107 107
 
108 108
 	/**
109 109
 	 * Retrieve field left label
110
-     *
111
-     * @since 1.7
112
-     *
110
+	 *
111
+	 * @since 1.7
112
+	 *
113 113
 	 * @return string
114 114
 	 */
115 115
 	function get_field_left_label() {
116 116
 		return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL;
117 117
 	}
118 118
 
119
-    /**
120
-     * Retrieve field label class
121
-     * @return string
122
-     */
123
-    function get_label_class() {
124
-        return 'gv-label-'. sanitize_html_class( $this->field['type'] );
125
-    }
126
-
127
-
128
-    /**
129
-     * Retrieve field description
130
-     * @return string
131
-     */
132
-    function get_field_desc() {
133
-        return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : '';
134
-    }
135
-
136
-
137
-    /**
138
-     * Verify if field should have merge tags
139
-     * @return boolean
140
-     */
141
-    function show_merge_tags() {
142
-        // Show the merge tags if the field is a list view
143
-        $is_list = preg_match( '/_list-/ism', $this->name );
144
-        // Or is a single entry view
145
-        $is_single = preg_match( '/single_/ism', $this->name );
146
-
147
-        return ( $is_single || $is_list );
148
-    }
149
-
150
-
151
-
152
-    /**
153
-     * important! Override this class
154
-     * outputs the field option html
155
-     */
156
-    function render_option() {
157
-        // to replace on each field
158
-    }
159
-
160
-    /**
161
-     * important! Override this class if needed
162
-     * outputs the field setting html
163
-     */
164
-    function render_setting( $override_input = NULL ) {
165
-
166
-        if( !empty( $this->field['full_width'] ) ) { ?>
119
+	/**
120
+	 * Retrieve field label class
121
+	 * @return string
122
+	 */
123
+	function get_label_class() {
124
+		return 'gv-label-'. sanitize_html_class( $this->field['type'] );
125
+	}
126
+
127
+
128
+	/**
129
+	 * Retrieve field description
130
+	 * @return string
131
+	 */
132
+	function get_field_desc() {
133
+		return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : '';
134
+	}
135
+
136
+
137
+	/**
138
+	 * Verify if field should have merge tags
139
+	 * @return boolean
140
+	 */
141
+	function show_merge_tags() {
142
+		// Show the merge tags if the field is a list view
143
+		$is_list = preg_match( '/_list-/ism', $this->name );
144
+		// Or is a single entry view
145
+		$is_single = preg_match( '/single_/ism', $this->name );
146
+
147
+		return ( $is_single || $is_list );
148
+	}
149
+
150
+
151
+
152
+	/**
153
+	 * important! Override this class
154
+	 * outputs the field option html
155
+	 */
156
+	function render_option() {
157
+		// to replace on each field
158
+	}
159
+
160
+	/**
161
+	 * important! Override this class if needed
162
+	 * outputs the field setting html
163
+	 */
164
+	function render_setting( $override_input = NULL ) {
165
+
166
+		if( !empty( $this->field['full_width'] ) ) { ?>
167 167
             <th scope="row" colspan="2">
168 168
                 <div>
169 169
                     <label for="<?php echo $this->get_field_id(); ?>">
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
             </td>
184 184
         <?php }
185 185
 
186
-    }
186
+	}
187 187
 
188
-    /**
189
-     * important! Override this class
190
-     * outputs the input html part
191
-     */
192
-    function render_input( $override_input ) {
193
-        echo '';
194
-    }
188
+	/**
189
+	 * important! Override this class
190
+	 * outputs the input html part
191
+	 */
192
+	function render_input( $override_input ) {
193
+		echo '';
194
+	}
195 195
 
196 196
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-list.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 *
26 26
 	 * @param GF_Field_List $field Gravity Forms field
27 27
 	 * @param string|array $field_value Serialized or unserialized array value for the field
28
-	 * @param int|string $column_id The numeric key of the column (0-index) or the label of the column
28
+	 * @param integer $column_id The numeric key of the column (0-index) or the label of the column
29 29
 	 * @param string $format If set to 'raw', return an array of values for the column. Otherwise, allow Gravity Forms to render using `html` or `text`
30 30
 	 *
31 31
 	 * @return array|string|null Returns null if the $field_value passed wasn't an array or serialized array
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		// Add the list columns
63 63
 		foreach ( $list_fields as $list_field ) {
64 64
 
65
-			if( empty( $list_field->enableColumns ) ) {
65
+			if ( empty( $list_field->enableColumns ) ) {
66 66
 				continue;
67 67
 			}
68 68
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			}
84 84
 
85 85
 			// If there are columns, add them under the parent field
86
-			if( ! empty( $list_columns ) ) {
86
+			if ( ! empty( $list_columns ) ) {
87 87
 
88 88
 				$index = array_search( $list_field->id, array_keys( $fields ) ) + 1;
89 89
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				 * Merge the $list_columns into the $fields array at $index
92 92
 				 * @see https://stackoverflow.com/a/1783125
93 93
 				 */
94
-				$fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true);
94
+				$fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true );
95 95
 			}
96 96
 
97 97
 			unset( $list_columns, $index, $input_id );
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$list_rows = maybe_unserialize( $field_value );
120 120
 
121
-		if( ! is_array( $list_rows ) ) {
121
+		if ( ! is_array( $list_rows ) ) {
122 122
 			do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value );
123 123
 			return null;
124 124
 		}
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 			foreach ( $list_row as $column_key => $column_value ) {
132 132
 
133 133
 				// If the label of the column matches $column_id, or the numeric key value matches, add the value
134
-				if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
135
-					$column_values[] = $column_value;
134
+				if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
135
+					$column_values[ ] = $column_value;
136 136
 				}
137 137
 				$current_column++;
138 138
 			}
139 139
 		}
140 140
 
141 141
 		// Return the array of values
142
-		if( 'raw' === $format ) {
142
+		if ( 'raw' === $format ) {
143 143
 			return $column_values;
144 144
 		}
145 145
 		// Return the Gravity Forms Field output
@@ -162,22 +162,22 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function _filter_field_label( $label, $field, $form, $entry ) {
164 164
 
165
-		$field_object = RGFormsModel::get_field( $form, $field['id'] );
165
+		$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
166 166
 
167 167
 		// Not a list field
168
-		if( ! $field_object || 'list' !== $field_object->type ) {
168
+		if ( ! $field_object || 'list' !== $field_object->type ) {
169 169
 			return $label;
170 170
 		}
171 171
 
172 172
 		// Custom label is defined, so use it
173
-		if( ! empty( $field['custom_label'] ) ) {
173
+		if ( ! empty( $field[ 'custom_label' ] ) ) {
174 174
 			return $label;
175 175
 		}
176 176
 
177
-		$column_id = gravityview_get_input_id_from_id( $field['id'] );
177
+		$column_id = gravityview_get_input_id_from_id( $field[ 'id' ] );
178 178
 
179 179
 		// Parent field, not column field
180
-		if( false === $column_id ) {
180
+		if ( false === $column_id ) {
181 181
 			return $label;
182 182
 		}
183 183
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) {
199 199
 
200 200
 		// Doesn't have columns enabled
201
-		if( ! isset( $field->choices ) || ! $field->enableColumns ) {
201
+		if ( ! isset( $field->choices ) || ! $field->enableColumns ) {
202 202
 			return $backup_label;
203 203
 		}
204 204
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@
 block discarded – undo
227 227
 				 */
228 228
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() );
229 229
 
230
-                $content = gravityview_get_link( $link, $content, $link_atts );
230
+				$content = gravityview_get_link( $link, $content, $link_atts );
231 231
 			}
232 232
 
233 233
 			$output_arr[] = array(
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 
21 21
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
22 22
 
23
-		unset( $field_options['search_filter'] );
23
+		unset( $field_options[ 'search_filter' ] );
24 24
 
25
-		if( 'edit' === $context ) {
25
+		if ( 'edit' === $context ) {
26 26
 			return $field_options;
27 27
 		}
28 28
 
29
-		$add_options['link_to_file'] = array(
29
+		$add_options[ 'link_to_file' ] = array(
30 30
 			'type' => 'checkbox',
31 31
 			'label' => __( 'Display as a Link:', 'gravityview' ),
32
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
32
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
33 33
 			'value' => false,
34 34
 			'merge_tags' => false,
35 35
 		);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$output_arr = array();
66 66
 
67 67
 		// Get an array of file paths for the field.
68
-		$file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
68
+		$file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
69 69
 
70 70
 		// The $value JSON was probably truncated; let's check lead_detail_long.
71 71
 		if ( ! is_array( $file_paths ) ) {
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 
81 81
 		// Process each file path
82
-		foreach( $file_paths as $file_path ) {
82
+		foreach ( $file_paths as $file_path ) {
83 83
 
84 84
 			// If the site is HTTPS, use HTTPS
85
-			if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); }
85
+			if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); }
86 86
 
87 87
 			// This is from Gravity Forms's code
88
-			$file_path = esc_attr(str_replace(" ", "%20", $file_path));
88
+			$file_path = esc_attr( str_replace( " ", "%20", $file_path ) );
89 89
 
90 90
 			// If the field is set to link to the single entry, link to it.
91
-			$link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
91
+			$link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
92 92
 
93 93
 			// Get file path information
94
-			$file_path_info = pathinfo($file_path);
94
+			$file_path_info = pathinfo( $file_path );
95 95
 
96 96
 			$html_format = NULL;
97 97
 
@@ -100,30 +100,30 @@  discard block
 block discarded – undo
100 100
 			$disable_wrapped_link = false;
101 101
 
102 102
 			// Is this an image?
103
-			$image = new GravityView_Image(array(
103
+			$image = new GravityView_Image( array(
104 104
 				'src' => $file_path,
105
-				'class' => 'gv-image gv-field-id-'.$field_settings['id'],
106
-				'alt' => $field_settings['label'],
107
-				'width' => (gravityview_get_context() === 'single' ? NULL : 250)
108
-			));
105
+				'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
106
+				'alt' => $field_settings[ 'label' ],
107
+				'width' => ( gravityview_get_context() === 'single' ? NULL : 250 )
108
+			) );
109 109
 
110 110
 			$content = $image->html();
111 111
 
112 112
 			// The new default content is the image, if it exists. If not, use the file name as the content.
113
-			$content = !empty( $content ) ? $content : $file_path_info['basename'];
113
+			$content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ];
114 114
 
115 115
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
116
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
116
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
117 117
 
118 118
 
119
-			switch( true ) {
119
+			switch ( true ) {
120 120
 
121 121
 				// Audio file
122 122
 				case in_array( $extension, wp_get_audio_extensions() ):
123 123
 
124 124
 					$disable_lightbox = true;
125 125
 
126
-					if( shortcode_exists( 'audio' ) ) {
126
+					if ( shortcode_exists( 'audio' ) ) {
127 127
 
128 128
 						$disable_wrapped_link = true;
129 129
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 						 */
135 135
 						$audio_settings = apply_filters( 'gravityview_audio_settings', array(
136 136
 							'src' => $file_path,
137
-							'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
138
-						));
137
+							'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
138
+						) );
139 139
 
140 140
 						/**
141 141
 						 * Generate the audio shortcode
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 					$disable_lightbox = true;
155 155
 
156
-					if( shortcode_exists( 'video' ) ) {
156
+					if ( shortcode_exists( 'video' ) ) {
157 157
 
158 158
 						$disable_wrapped_link = true;
159 159
 
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 						 */
165 165
 						$video_settings = apply_filters( 'gravityview_video_settings', array(
166 166
 							'src' => $file_path,
167
-							'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
168
-						));
167
+							'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
168
+						) );
169 169
 
170 170
 						/**
171 171
 						 * Generate the video shortcode
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 					break;
188 188
 
189 189
 				// if not image, do not set the lightbox (@since 1.5.3)
190
-				case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
190
+				case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
191 191
 
192 192
 					$disable_lightbox = true;
193 193
 
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 
198 198
 			// If using Link to File, override the content.
199 199
 			// (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
200
-			if( !empty( $field_settings['link_to_file'] ) ) {
200
+			if ( ! empty( $field_settings[ 'link_to_file' ] ) ) {
201 201
 
202 202
 				// Force the content to be the file name
203
-				$content =  $file_path_info["basename"];
203
+				$content = $file_path_info[ "basename" ];
204 204
 
205 205
 				// Restore the wrapped link
206 206
 				$disable_wrapped_link = false;
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
 			}
209 209
 
210 210
 			// Whether to use lightbox or not
211
-			if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) {
211
+			if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) {
212 212
 
213
-				$link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array();
213
+				$link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array();
214 214
 
215 215
 			} else {
216 216
 
217
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
217
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
218 218
 
219 219
 				$link_atts = array(
220 220
 					'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ),
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() );
241 241
 
242 242
 			// If the HTML output hasn't been overridden by the switch statement above, use the default format
243
-			if( !empty( $content ) && empty( $disable_wrapped_link ) ) {
243
+			if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) {
244 244
 
245 245
 				/**
246 246
 				 * Modify the link text (defaults to the file name)
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                 $content = gravityview_get_link( $link, $content, $link_atts );
256 256
 			}
257 257
 
258
-			$output_arr[] = array(
258
+			$output_arr[ ] = array(
259 259
 				'file_path' => $file_path,
260 260
 				'content' => $content
261 261
 			);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-textarea.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
22 22
 		);
23 23
 
24
-        $field_options['make_clickable'] = array(
25
-            'type' => 'checkbox',
26
-            'merge_tags' => false,
27
-            'value' => 0,
28
-            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
29
-            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
30
-        );
24
+		$field_options['make_clickable'] = array(
25
+			'type' => 'checkbox',
26
+			'merge_tags' => false,
27
+			'value' => 0,
28
+			'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
29
+			'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
30
+		);
31 31
 
32 32
 		return $field_options;
33 33
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
27 27
 
28
-		if( 'edit' === $context ) {
28
+		if ( 'edit' === $context ) {
29 29
 			return $field_options;
30 30
 		}
31 31
 
32
-		$field_options['trim_words'] = array(
32
+		$field_options[ 'trim_words' ] = array(
33 33
 			'type' => 'number',
34 34
 			'merge_tags' => false,
35 35
 			'value' => null,
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
38 38
 		);
39 39
 
40
-        $field_options['make_clickable'] = array(
40
+        $field_options[ 'make_clickable' ] = array(
41 41
             'type' => 'checkbox',
42 42
             'merge_tags' => false,
43 43
             'value' => 0,
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -255,7 +255,6 @@
 block discarded – undo
255 255
 	 * Get the default date format for a field based on the field ID and the time format setting
256 256
 	 *
257 257
 	 * @since 1.14
258
-
259 258
 	 * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14}
260 259
 	 * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14}
261 260
 	 *
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
61 61
 
62
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
62
+		add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
63 63
 	}
64 64
 
65 65
 	/**
@@ -100,31 +100,31 @@  discard block
 block discarded – undo
100 100
 	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
101 101
 
102 102
 		// If the search is being sorted
103
-		if( ! empty( $criteria['sorting']['key'] ) ) {
103
+		if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) {
104 104
 
105
-			$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
105
+			$pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] );
106 106
 
107 107
 			/**
108 108
 			 * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL
109 109
 			 * @see modify_sort_id()
110 110
 			 */
111
-			if( ! empty( $pieces[1] ) ) {
111
+			if ( ! empty( $pieces[ 1 ] ) ) {
112 112
 
113 113
 				// Pass these to the _modify_query_sort_by_time_hack() method
114
-				$this->_time_format = $pieces[1];
115
-				$this->_date_format = $pieces[2];
114
+				$this->_time_format = $pieces[ 1 ];
115
+				$this->_date_format = $pieces[ 2 ];
116 116
 
117 117
 				// Remove fake input IDs (5.1 doesn't exist. Use 5)
118
-				$criteria['sorting']['key'] = floor( $pieces[0] );
118
+				$criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] );
119 119
 
120 120
 				/**
121 121
 				 * Make sure sorting is numeric (# of seconds). IMPORTANT.
122 122
 				 * @see GVCommon::is_field_numeric() is_numeric should also be set here
123 123
 				 */
124
-				$criteria['sorting']['is_numeric'] = true;
124
+				$criteria[ 'sorting' ][ 'is_numeric' ] = true;
125 125
 
126 126
 				// Modify the Gravity Forms WP Query
127
-				add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
127
+				add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
128 128
 			}
129 129
 		}
130 130
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 		 * then we want to modify the query.
148 148
 		 * @see GFFormsModel::sort_by_field_query()
149 149
 		 */
150
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
150
+		if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
151 151
 
152
-			if( $this->_time_format === '24' ) {
152
+			if ( $this->_time_format === '24' ) {
153 153
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
154 154
 			} else {
155 155
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
@@ -195,18 +195,18 @@  discard block
 block discarded – undo
195 195
 		// Set variables
196 196
 		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
197 197
 
198
-		if( 'edit' === $context ) {
198
+		if ( 'edit' === $context ) {
199 199
 			return $field_options;
200 200
 		}
201 201
 
202 202
 		/**
203 203
 		 * Set default date format based on field ID and Form ID
204 204
 		 */
205
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
205
+		add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
206 206
 
207
-		$this->add_field_support('date_display', $field_options );
207
+		$this->add_field_support( 'date_display', $field_options );
208 208
 
209
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
209
+		remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
210 210
 
211 211
 		return $field_options;
212 212
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	private function _get_time_format() {
222 222
 		global $post;
223 223
 
224
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
224
+		$current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID );
225 225
 
226 226
 		return self::_get_time_format_for_field( $this->_field_id, $current_form );
227 227
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		// GF defaults to 12, so should we.
241 241
 		$time_format = '12';
242 242
 
243
-		if( $form_id ) {
243
+		if ( $form_id ) {
244 244
 			$form = GFAPI::get_form( $form_id );
245 245
 
246 246
 			if ( $form ) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$default = 'h:i A';
288 288
 
289 289
 		// This doesn't take into account 24-hour
290
-		switch( $field_input_id ) {
290
+		switch ( $field_input_id ) {
291 291
 			// Hours
292 292
 			case 1:
293 293
 				return ( $time_format === '12' ) ? 'h' : 'H';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-type.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 	 *
70 70
 	 * @since 1.16
71 71
 	 *
72
-	 * @param int|string $value Number value for the field
72
+	 * @param string $value Number value for the field
73 73
 	 *
74 74
 	 * @return string Based on $value; `1`: "One-Time Payment"; `2`: "Subscription"
75 75
 	 */
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	public function get_content( $output, $entry, $field_settings, $field ) {
60 60
 
61 61
 		/** Overridden by a template. */
62
-		if( ! empty( $field['field_path'] ) ) { return $output; }
62
+		if ( ! empty( $field[ 'field_path' ] ) ) { return $output; }
63 63
 
64 64
 		return $this->get_string_from_value( $output );
65 65
 	}
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 		switch ( intval( $value ) ) {
79 79
 			case self::ONE_TIME_PAYMENT:
80 80
 			default:
81
-				$return = __('One-Time Payment', 'gravityview');
81
+				$return = __( 'One-Time Payment', 'gravityview' );
82 82
 				break;
83 83
 
84 84
 			case self::SUBSCRIPTION:
85
-				$return = __('Subscription', 'gravityview');
85
+				$return = __( 'Subscription', 'gravityview' );
86 86
 				break;
87 87
 		}
88 88
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
 	 * @param bool $url_encode Whether to URL-encode output
136 136
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
137 137
 	 *
138
-	 * @return mixed
138
+	 * @return string
139 139
 	 */
140 140
 	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
141 141
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
136 136
 
137
-		if( $this->entry_meta_key ) {
137
+		if ( $this->entry_meta_key ) {
138 138
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
139 139
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
140 140
 		}
141 141
 
142
-		if( $this->_custom_merge_tag ) {
142
+		if ( $this->_custom_merge_tag ) {
143 143
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
144 144
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
145 145
 		}
146 146
 
147
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
147
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
148 148
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
149 149
 		}
150 150
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			'type'  => $this->name
168 168
 		);
169 169
 
170
-		$fields["{$this->entry_meta_key}"] = $added_field;
170
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
171 171
 
172 172
 		return $fields;
173 173
 	}
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
189 189
 
190
-		if( $this->name === $field['field'] && '' === $label ) {
190
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
191 191
 			$label = esc_html( $this->default_search_label );
192 192
 		}
193 193
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 *
209 209
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
210 210
 	 */
211
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
211
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
212 212
 
213 213
 		/**
214 214
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		 * @see GFCommon::replace_variables_prepopulate()
217 217
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
218 218
 		 */
219
-		if( false === $form ) {
219
+		if ( false === $form ) {
220 220
 			return $text;
221 221
 		}
222 222
 
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
252
-		foreach( $matches as $match ) {
252
+		foreach ( $matches as $match ) {
253 253
 
254
-			$full_tag = $match[0];
254
+			$full_tag = $match[ 0 ];
255 255
 
256 256
 			// Strip the Merge Tags
257
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
257
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
258 258
 
259 259
 			// Replace the value from the entry, if exists
260
-			if( isset( $entry[ $tag ] ) ) {
260
+			if ( isset( $entry[ $tag ] ) ) {
261 261
 
262 262
 				$value = $entry[ $tag ];
263 263
 
264
-				if( is_callable( array( $this, 'get_content') ) ) {
264
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
265 265
 					$value = $this->get_content( $value );
266 266
 				}
267 267
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function _filter_sortable_fields( $not_sortable ) {
336 336
 
337
-		if( ! $this->is_sortable ) {
338
-			$not_sortable[] = $this->name;
337
+		if ( ! $this->is_sortable ) {
338
+			$not_sortable[ ] = $this->name;
339 339
 		}
340 340
 
341 341
 		return $not_sortable;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	function add_entry_meta( $entry_meta ) {
354 354
 
355
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
355
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
356 356
 
357 357
 			$added_meta = array(
358 358
 				'label'             => $this->label,
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
 			);
362 362
 
363 363
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
364
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
364
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
365 365
 			}
366 366
 
367
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
367
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
368 368
 
369 369
 		} else {
370
-			do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta["{$this->entry_meta_key}"] );
370
+			do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta[ "{$this->entry_meta_key}" ] );
371 371
 		}
372 372
 
373 373
 		return $entry_meta;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			'date_display' => array(
397 397
 				'type' => 'text',
398 398
 				'label' => __( 'Override Date Format', 'gravityview' ),
399
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
399
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
400 400
 				/**
401 401
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
402 402
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 
422 422
 		$options = $this->field_support_options();
423 423
 
424
-		if( isset( $options[ $key ] ) ) {
424
+		if ( isset( $options[ $key ] ) ) {
425 425
 			$field_options[ $key ] = $options[ $key ];
426 426
 		}
427 427
 
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
 		$connected_form = rgpost( 'form_id' );
486 486
 
487 487
 		// Otherwise, get the Form ID from the Post page
488
-		if( empty( $connected_form ) ) {
488
+		if ( empty( $connected_form ) ) {
489 489
 			$connected_form = gravityview_get_form_id( get_the_ID() );
490 490
 		}
491 491
 
492
-		if( empty( $connected_form ) ) {
492
+		if ( empty( $connected_form ) ) {
493 493
 			do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) );
494 494
 			return false;
495 495
 		}
Please login to merge, or discard this patch.
includes/class-frontend-views.php 3 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			 */
242 242
 			$this->context_view_id = $_GET['gvid'];
243 243
 
244
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
244
+		} elseif ( ! $this->getGvOutputData()->has_multiple_views() ) {
245 245
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
246 246
 			$this->context_view_id = array_pop( $array_keys );
247 247
 			unset( $array_keys );
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		global $post;
270 270
 
271 271
 		// If in admin and NOT AJAX request, get outta here.
272
-		if ( GravityView_Plugin::is_admin() )  {
272
+		if ( GravityView_Plugin::is_admin() ) {
273 273
 			return;
274 274
 		}
275 275
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 		}
373 373
 
374 374
 		// User reported WooCommerce doesn't pass two args.
375
-		if ( empty( $passed_post_id ) )  {
375
+		if ( empty( $passed_post_id ) ) {
376 376
 			return $title;
377 377
 		}
378 378
 
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 					 */
1109 1109
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1110 1110
 
1111
-					switch( strtolower( $address_part ) ){
1111
+					switch( strtolower( $address_part ) ) {
1112 1112
 						case 'street':
1113 1113
 							$sort_field_id .= '.1';
1114 1114
 							break;
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 		 */
1189 1189
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1190 1190
 
1191
-		if ( empty( $single_entry ) ){
1191
+		if ( empty( $single_entry ) ) {
1192 1192
 			return false;
1193 1193
 		} else {
1194 1194
 			return $single_entry;
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 	/**
155 155
 	 * Sets the single entry ID and also the entry
156
-	 * @param bool|int|string $single_entry
156
+	 * @param boolean|string $single_entry
157 157
 	 */
158 158
 	public function setSingleEntry( $single_entry ) {
159 159
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 	/**
172 172
 	 * Set the current entry
173
-	 * @param array|int $entry Entry array or entry slug or ID
173
+	 * @param boolean|string $entry Entry array or entry slug or ID
174 174
 	 */
175 175
 	public function setEntry( $entry ) {
176 176
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 *
230 230
 	 *
231
-	 * @param null $view_id
231
+	 * @param string $view_id
232 232
 	 */
233 233
 	public function set_context_view_id( $view_id = null ) {
234 234
 
@@ -558,7 +558,6 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @since 1.19.2
560 560
 	 *
561
-	 * @param string $context The current context that has no configuration
562 561
 	 *
563 562
 	 * @return void
564 563
 	 */
@@ -1091,7 +1090,7 @@  discard block
 block discarded – undo
1091 1090
 	 *
1092 1091
 	 * @uses  gravityview_get_entries()
1093 1092
 	 * @access public
1094
-	 * @param array $args\n
1093
+	 * @param array $args
1095 1094
 	 *   - $id - View id
1096 1095
 	 *   - $page_size - Page
1097 1096
 	 *   - $sort_field - form field id to sort
@@ -1551,7 +1550,7 @@  discard block
 block discarded – undo
1551 1550
 	/**
1552 1551
 	 * Checks if field (column) is sortable
1553 1552
 	 *
1554
-	 * @param string $field Field settings
1553
+	 * @param string $field_id Field settings
1555 1554
 	 * @param array $form Gravity Forms form array
1556 1555
 	 *
1557 1556
 	 * @since 1.7
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 
237 237
 			$this->context_view_id = $view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 * @see GravityView_View_Data::getInstance()->has_multiple_views()
244 244
 			 */
245
-			$this->context_view_id = $_GET['gvid'];
245
+			$this->context_view_id = $_GET[ 'gvid' ];
246 246
 
247
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
247
+		} elseif ( ! $this->getGvOutputData()->has_multiple_views() ) {
248 248
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
249 249
 			$this->context_view_id = array_pop( $array_keys );
250 250
 			unset( $array_keys );
@@ -279,24 +279,24 @@  discard block
 block discarded – undo
279 279
 		global $wp_rewrite;
280 280
 
281 281
 		$is_front_page = ( $query->is_home || $query->is_page );
282
-		$show_on_front = ( 'page' === get_option('show_on_front') );
283
-		$front_page_id = get_option('page_on_front');
282
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
283
+		$front_page_id = get_option( 'page_on_front' );
284 284
 
285
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
285
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
286 286
 
287 287
 			// Force to be an array, potentially a query string ( entry=16 )
288 288
 			$_query = wp_parse_args( $query->query );
289 289
 
290 290
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
291
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
292
-				unset( $_query['pagename'] );
291
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
292
+				unset( $_query[ 'pagename' ] );
293 293
 			}
294 294
 
295 295
 			// this is where will break from core wordpress
296 296
 			$ignore = array( 'preview', 'page', 'paged', 'cpage' );
297 297
 			$endpoints = rgobj( $wp_rewrite, 'endpoints' );
298
-			foreach ( (array) $endpoints as $endpoint ) {
299
-				$ignore[] = $endpoint[1];
298
+			foreach ( (array)$endpoints as $endpoint ) {
299
+				$ignore[ ] = $endpoint[ 1 ];
300 300
 			}
301 301
 			unset( $endpoints );
302 302
 
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
307 307
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
308 308
 
309
-				$qv =& $query->query_vars;
309
+				$qv = & $query->query_vars;
310 310
 
311 311
 				// Prevent redirect when on the single entry endpoint
312
-				if( self::is_single_entry() ) {
312
+				if ( self::is_single_entry() ) {
313 313
 					add_filter( 'redirect_canonical', '__return_false' );
314 314
 				}
315 315
 
316 316
 				$query->is_page = true;
317 317
 				$query->is_home = false;
318
-				$qv['page_id']  = $front_page_id;
318
+				$qv[ 'page_id' ]  = $front_page_id;
319 319
 
320 320
 				// Correct <!--nextpage--> for page_on_front
321
-				if ( ! empty( $qv['paged'] ) ) {
322
-					$qv['page'] = $qv['paged'];
323
-					unset( $qv['paged'] );
321
+				if ( ! empty( $qv[ 'paged' ] ) ) {
322
+					$qv[ 'page' ] = $qv[ 'paged' ];
323
+					unset( $qv[ 'paged' ] );
324 324
 				}
325 325
 			}
326 326
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		global $post;
339 339
 
340 340
 		// If in admin and NOT AJAX request, get outta here.
341
-		if ( GravityView_Plugin::is_admin() )  {
341
+		if ( GravityView_Plugin::is_admin() ) {
342 342
 			return;
343 343
 		}
344 344
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
352 352
 
353
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
353
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
354 354
 		$this->setPostId( $post_id );
355 355
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
356 356
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
388 388
 
389
-		if( 'post' === $search_method ) {
389
+		if ( 'post' === $search_method ) {
390 390
 			$get = $_POST;
391 391
 		} else {
392 392
 			$get = $_GET;
@@ -442,20 +442,20 @@  discard block
 block discarded – undo
442 442
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
443 443
 		 * @param array $entry Current entry
444 444
 		 */
445
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
445
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
446 446
 
447 447
 		if ( ! $apply_outside_loop ) {
448 448
 			return $title;
449 449
 		}
450 450
 
451 451
 		// User reported WooCommerce doesn't pass two args.
452
-		if ( empty( $passed_post_id ) )  {
452
+		if ( empty( $passed_post_id ) ) {
453 453
 			return $title;
454 454
 		}
455 455
 
456 456
 		// Don't modify the title for anything other than the current view/post.
457 457
 		// This is true for embedded shortcodes and Views.
458
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
458
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
459 459
 			return $title;
460 460
 		}
461 461
 
@@ -465,19 +465,19 @@  discard block
 block discarded – undo
465 465
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
466 466
 		} else {
467 467
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
468
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
468
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
469 469
 					$view_meta = $view_data;
470 470
 					break;
471 471
 				}
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
475
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
476 476
 
477
-			$title = $view_meta['atts']['single_title'];
477
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
478 478
 
479 479
 			// We are allowing HTML in the fields, so no escaping the output
480
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
480
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
481 481
 
482 482
 			$title = do_shortcode( $title );
483 483
 		}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 		$context = GravityView_View::getInstance()->getContext();
574 574
 
575
-		switch( $context ) {
575
+		switch ( $context ) {
576 576
 			case 'directory':
577 577
 				$tab = __( 'Multiple Entries', 'gravityview' );
578 578
 				break;
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 		}
587 587
 
588 588
 
589
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
589
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
590 590
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
591
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
591
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
592 592
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
593 593
 
594 594
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	public function render_view( $passed_args ) {
622 622
 
623 623
 		// validate attributes
624
-		if ( empty( $passed_args['id'] ) ) {
624
+		if ( empty( $passed_args[ 'id' ] ) ) {
625 625
 			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
626 626
 			return null;
627 627
 		}
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 			return null;
644 644
 		}
645 645
 
646
-		$view_id = $passed_args['id'];
646
+		$view_id = $passed_args[ 'id' ];
647 647
 
648 648
 		$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args );
649 649
 
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 		$passed_args = array_filter( $passed_args, 'strlen' );
657 657
 
658 658
 		//Override shortcode args over View template settings
659
-		$atts = wp_parse_args( $passed_args, $view_data['atts'] );
659
+		$atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] );
660 660
 
661 661
 		do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
662 662
 
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 		 * @since 1.15
680 680
 		 * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out.
681 681
 		 */
682
-		if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
682
+		if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
683 683
 
684 684
 			do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) );
685 685
 
686 686
 			return null;
687 687
 		}
688 688
 
689
-		if( $this->isGravityviewPostType() ) {
689
+		if ( $this->isGravityviewPostType() ) {
690 690
 
691 691
 			/**
692 692
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 			 */
699 699
 			$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id );
700 700
 
701
-			$embed_only = ! empty( $atts['embed_only'] );
701
+			$embed_only = ! empty( $atts[ 'embed_only' ] );
702 702
 
703
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
703
+			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
704 704
 				return __( 'You are not allowed to view this content.', 'gravityview' );
705 705
 			}
706 706
 		}
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 
716 716
 		$gravityview_view = new GravityView_View( $view_data );
717 717
 
718
-		$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId();
718
+		$post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId();
719 719
 
720 720
 		$gravityview_view->setPostId( $post_id );
721 721
 
@@ -725,20 +725,20 @@  discard block
 block discarded – undo
725 725
 			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
726 726
 
727 727
 			//fetch template and slug
728
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' );
728
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' );
729 729
 
730 730
 			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
731 731
 
732 732
 			/**
733 733
 			 * Disable fetching initial entries for views that don't need it (DataTables)
734 734
 			 */
735
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
735
+			$get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true );
736 736
 
737 737
 			/**
738 738
 			 * Hide View data until search is performed
739 739
 			 * @since 1.5.4
740 740
 			 */
741
-			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) {
741
+			if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) {
742 742
 				$gravityview_view->setHideUntilSearched( true );
743 743
 				$get_entries = false;
744 744
 			}
@@ -746,23 +746,23 @@  discard block
 block discarded – undo
746 746
 
747 747
 			if ( $get_entries ) {
748 748
 
749
-				if ( ! empty( $atts['sort_columns'] ) ) {
749
+				if ( ! empty( $atts[ 'sort_columns' ] ) ) {
750 750
 					// add filter to enable column sorting
751
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
751
+					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 );
752 752
 				}
753 753
 
754
-				$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
754
+				$view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] );
755 755
 
756
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
756
+				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) );
757 757
 
758 758
 			} else {
759 759
 
760 760
 				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
761 761
 
762
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
762
+				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' );
763 763
 			}
764 764
 
765
-			$gravityview_view->setPaging( $view_entries['paging'] );
765
+			$gravityview_view->setPaging( $view_entries[ 'paging' ] );
766 766
 			$gravityview_view->setContext( 'directory' );
767 767
 			$sections = array( 'header', 'body', 'footer' );
768 768
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 			 * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID
777 777
 			 * @since 1.17
778 778
 			 */
779
-			do_action( 'gravityview_render_entry_'.$view_data['id'] );
779
+			do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] );
780 780
 
781 781
 			$entry = $this->getEntry();
782 782
 
@@ -803,20 +803,20 @@  discard block
 block discarded – undo
803 803
 			// We're in single view, but the view being processed is not the same view the single entry belongs to.
804 804
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
805 805
 			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) {
806
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
806
+				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id );
807 807
 				return null;
808 808
 			}
809 809
 
810 810
 			//fetch template and slug
811
-			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' );
811
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' );
812 812
 			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
813 813
 
814 814
 			//fetch entry detail
815
-			$view_entries['count'] = 1;
816
-			$view_entries['entries'][] = $entry;
817
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
815
+			$view_entries[ 'count' ] = 1;
816
+			$view_entries[ 'entries' ][ ] = $entry;
817
+			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] );
818 818
 
819
-			$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
819
+			$back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null;
820 820
 
821 821
 			// set back link label
822 822
 			$gravityview_view->setBackLinkLabel( $back_link_label );
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 		}
827 827
 
828 828
 		// add template style
829
-		self::add_style( $view_data['template_id'] );
829
+		self::add_style( $view_data[ 'template_id' ] );
830 830
 
831 831
 		// Prepare to render view and set vars
832
-		$gravityview_view->setEntries( $view_entries['entries'] );
833
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
832
+		$gravityview_view->setEntries( $view_entries[ 'entries' ] );
833
+		$gravityview_view->setTotalEntries( $view_entries[ 'count' ] );
834 834
 
835 835
 		// If Edit
836 836
 		if ( 'edit' === gravityview_get_context() ) {
@@ -843,11 +843,11 @@  discard block
 block discarded – undo
843 843
 
844 844
 		} else {
845 845
 			// finaly we'll render some html
846
-			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] );
846
+			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] );
847 847
 
848 848
 			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
849 849
 			foreach ( $sections as $section ) {
850
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
850
+				do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' );
851 851
 				$gravityview_view->render( $view_slug, $section, false );
852 852
 			}
853 853
 		}
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 				$datetime_format = 'Y-m-d H:i:s';
902 902
 				$search_is_outside_view_bounds = false;
903 903
 
904
-				if( ! empty( $search_criteria[ $key ] ) ) {
904
+				if ( ! empty( $search_criteria[ $key ] ) ) {
905 905
 
906 906
 					$search_date = strtotime( $search_criteria[ $key ] );
907 907
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
930 930
 
931 931
 					// Then we override the search and re-set the start date
932
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
932
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
933 933
 				}
934 934
 			}
935 935
 		}
936 936
 
937
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
937
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
938 938
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
939
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
939
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
940 940
 				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
941 941
 			}
942 942
 		}
@@ -955,19 +955,19 @@  discard block
 block discarded – undo
955 955
 	public static function process_search_only_approved( $args, $search_criteria ) {
956 956
 
957 957
 		/** @since 1.19 */
958
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
958
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
959 959
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' );
960 960
 			return $search_criteria;
961 961
 		}
962 962
 
963
-		if ( ! empty( $args['show_only_approved'] ) ) {
963
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
964 964
 
965
-			$search_criteria['field_filters'][] = array(
965
+			$search_criteria[ 'field_filters' ][ ] = array(
966 966
 				'key' => GravityView_Entry_Approval::meta_key,
967 967
 				'value' => GravityView_Entry_Approval_Status::APPROVED
968 968
 			);
969 969
 
970
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
970
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
971 971
 
972 972
 			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
973 973
 		}
@@ -994,18 +994,18 @@  discard block
 block discarded – undo
994 994
 	 */
995 995
 	public static function is_entry_approved( $entry, $args = array() ) {
996 996
 
997
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
997
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
998 998
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
999 999
 			return true;
1000 1000
 		}
1001 1001
 
1002 1002
 		/** @since 1.19 */
1003
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1003
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1004 1004
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' );
1005 1005
 			return true;
1006 1006
 		}
1007 1007
 
1008
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
1008
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
1009 1009
 
1010 1010
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
1011 1011
 	}
@@ -1039,26 +1039,26 @@  discard block
 block discarded – undo
1039 1039
 		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
1040 1040
 
1041 1041
 		// implicity search
1042
-		if ( ! empty( $args['search_value'] ) ) {
1042
+		if ( ! empty( $args[ 'search_value' ] ) ) {
1043 1043
 
1044 1044
 			// Search operator options. Options: `is` or `contains`
1045
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
1045
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
1046 1046
 
1047
-			$search_criteria['field_filters'][] = array(
1047
+			$search_criteria[ 'field_filters' ][ ] = array(
1048 1048
 				'key' => rgget( 'search_field', $args ), // The field ID to search
1049
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
1049
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
1050 1050
 				'operator' => $operator,
1051 1051
 			);
1052 1052
 		}
1053 1053
 
1054
-		if( $search_criteria !== $original_search_criteria ) {
1054
+		if ( $search_criteria !== $original_search_criteria ) {
1055 1055
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
1056 1056
 		}
1057 1057
 
1058 1058
 		// Handle setting date range
1059 1059
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
1060 1060
 
1061
-		if( $search_criteria !== $original_search_criteria ) {
1061
+		if ( $search_criteria !== $original_search_criteria ) {
1062 1062
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
1063 1063
 		}
1064 1064
 
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
1070 1070
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
1071 1071
 		 */
1072
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
1072
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
1073 1073
 
1074 1074
 		return $search_criteria;
1075 1075
 	}
@@ -1115,16 +1115,16 @@  discard block
 block discarded – undo
1115 1115
 		$search_criteria = self::get_search_criteria( $args, $form_id );
1116 1116
 
1117 1117
 		// Paging & offset
1118
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 );
1118
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 );
1119 1119
 
1120 1120
 		if ( -1 === $page_size ) {
1121 1121
 			$page_size = PHP_INT_MAX;
1122 1122
 		}
1123 1123
 
1124
-		if ( isset( $args['offset'] ) ) {
1125
-			$offset = intval( $args['offset'] );
1124
+		if ( isset( $args[ 'offset' ] ) ) {
1125
+			$offset = intval( $args[ 'offset' ] );
1126 1126
 		} else {
1127
-			$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1127
+			$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1128 1128
 			$offset = ( $curr_page - 1 ) * $page_size;
1129 1129
 		}
1130 1130
 
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 			'search_criteria' => $search_criteria,
1143 1143
 			'sorting' => $sorting,
1144 1144
 			'paging' => $paging,
1145
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1145
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1146 1146
 		);
1147 1147
 
1148 1148
 		/**
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1168 1168
 		 * @param array $args View configuration args.
1169 1169
 		 */
1170
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1170
+		$parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id );
1171 1171
 
1172 1172
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters );
1173 1173
 
@@ -1207,8 +1207,8 @@  discard block
 block discarded – undo
1207 1207
 	 */
1208 1208
 	public static function updateViewSorting( $args, $form_id ) {
1209 1209
 		$sorting = array();
1210
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1211
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1210
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' );
1211
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' );
1212 1212
 
1213 1213
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1214 1214
 
@@ -1248,11 +1248,11 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1250 1250
 
1251
-		if( ! $sort_field ) {
1251
+		if ( ! $sort_field ) {
1252 1252
 			return $sort_field_id;
1253 1253
 		}
1254 1254
 
1255
-		switch ( $sort_field['type'] ) {
1255
+		switch ( $sort_field[ 'type' ] ) {
1256 1256
 
1257 1257
 			case 'address':
1258 1258
 				// Sorting by full address
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 					 */
1270 1270
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1271 1271
 
1272
-					switch( strtolower( $address_part ) ){
1272
+					switch ( strtolower( $address_part ) ) {
1273 1273
 						case 'street':
1274 1274
 							$sort_field_id .= '.1';
1275 1275
 							break;
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 		 */
1350 1350
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1351 1351
 
1352
-		if ( empty( $single_entry ) ){
1352
+		if ( empty( $single_entry ) ) {
1353 1353
 			return false;
1354 1354
 		} else {
1355 1355
 			return $single_entry;
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1377 1377
 				 * @since 1.15
1378 1378
 				 */
1379
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1379
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1380 1380
 					continue;
1381 1381
 				}
1382 1382
 
@@ -1385,19 +1385,19 @@  discard block
 block discarded – undo
1385 1385
 				$css_dependencies = array();
1386 1386
 
1387 1387
 				// If the thickbox is enqueued, add dependencies
1388
-				if ( ! empty( $data['atts']['lightbox'] ) ) {
1388
+				if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) {
1389 1389
 
1390 1390
 					/**
1391 1391
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1392 1392
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1393 1393
 					 */
1394
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1394
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1395 1395
 
1396 1396
 					/**
1397 1397
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1398 1398
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1399 1399
 					 */
1400
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1400
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1401 1401
 				}
1402 1402
 
1403 1403
 				/**
@@ -1405,25 +1405,25 @@  discard block
 block discarded – undo
1405 1405
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1406 1406
 				 * @since 1.15
1407 1407
 				 */
1408
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1409
-					$css_dependencies[] = 'dashicons';
1408
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1409
+					$css_dependencies[ ] = 'dashicons';
1410 1410
 				}
1411 1411
 
1412 1412
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1413 1413
 
1414 1414
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1415 1415
 
1416
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1416
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1417 1417
 
1418 1418
 				wp_enqueue_script( 'gravityview-fe-view' );
1419 1419
 
1420
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1420
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1421 1421
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1422 1422
 				}
1423 1423
 
1424 1424
 				$this->enqueue_default_style( $css_dependencies );
1425 1425
 
1426
-				self::add_style( $data['template_id'] );
1426
+				self::add_style( $data[ 'template_id' ] );
1427 1427
 			}
1428 1428
 
1429 1429
 			if ( 'wp_print_footer_scripts' === current_filter() ) {
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 		} elseif ( empty( $template_id ) ) {
1486 1486
 			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1487 1487
 		} else {
1488
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1488
+			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) );
1489 1489
 		}
1490 1490
 
1491 1491
 	}
@@ -1510,11 +1510,11 @@  discard block
 block discarded – undo
1510 1510
 		 * Not a table-based template; don't add sort icons
1511 1511
 		 * @since 1.12
1512 1512
 		 */
1513
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1513
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1514 1514
 			return $label;
1515 1515
 		}
1516 1516
 
1517
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1517
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1518 1518
 			return $label;
1519 1519
 		}
1520 1520
 
@@ -1522,29 +1522,29 @@  discard block
 block discarded – undo
1522 1522
 
1523 1523
 		$class = 'gv-sort';
1524 1524
 
1525
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1525
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1526 1526
 
1527 1527
 		$sort_args = array(
1528
-			'sort' => $field['id'],
1528
+			'sort' => $field[ 'id' ],
1529 1529
 			'dir' => 'asc',
1530 1530
 		);
1531 1531
 
1532
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1532
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1533 1533
 			//toggle sorting direction.
1534
-			if ( 'asc' === $sorting['direction'] ) {
1535
-				$sort_args['dir'] = 'desc';
1534
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1535
+				$sort_args[ 'dir' ] = 'desc';
1536 1536
 				$class .= ' gv-icon-sort-desc';
1537 1537
 			} else {
1538
-				$sort_args['dir'] = 'asc';
1538
+				$sort_args[ 'dir' ] = 'asc';
1539 1539
 				$class .= ' gv-icon-sort-asc';
1540 1540
 			}
1541 1541
 		} else {
1542 1542
 			$class .= ' gv-icon-caret-up-down';
1543 1543
 		}
1544 1544
 
1545
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1545
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1546 1546
 
1547
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1547
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1548 1548
 
1549 1549
 	}
1550 1550
 
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 
1563 1563
 		$field_type = $field_id;
1564 1564
 
1565
-		if( is_numeric( $field_id ) ) {
1565
+		if ( is_numeric( $field_id ) ) {
1566 1566
 			$field = GFFormsModel::get_field( $form, $field_id );
1567 1567
 			$field_type = $field->type;
1568 1568
 		}
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 			return false;
1586 1586
 		}
1587 1587
 
1588
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1588
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1589 1589
 
1590 1590
 	}
1591 1591
 
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-yoast-seo.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 		parent::add_hooks();
58 58
 
59
-		if( gravityview_is_admin_page() ) {
59
+		if ( gravityview_is_admin_page() ) {
60 60
 
61 61
 				// Make Yoast metabox go down to the bottom please.
62 62
 			add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) );
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 		global $pagenow;
84 84
 
85 85
 		// New View page
86
-		if( $pagenow === 'post-new.php' ) {
87
-			$options['hideeditbox-gravityview'] = true;
86
+		if ( $pagenow === 'post-new.php' ) {
87
+			$options[ 'hideeditbox-gravityview' ] = true;
88 88
 		}
89 89
 
90 90
 		return $options;
Please login to merge, or discard this patch.