@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | public function __destruct() { |
95 | - remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback );; |
|
95 | + remove_filter( $this->filter_prefix . '_get_template_part', $this->_add_id_specific_templates_callback ); ; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -175,67 +175,67 @@ discard block |
||
175 | 175 | |
176 | 176 | if ( $is_view && $post ) { |
177 | 177 | if ( $field_type ) { |
178 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
179 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
180 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
181 | - $inputType && $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
182 | - $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
183 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
184 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
185 | - $inputType && $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
178 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $field_type, $slug_name ); |
|
179 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s-%s.php', $slug_dir, $post->ID, $view_id, $inputType, $slug_name ); |
|
180 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $field_type ); |
|
181 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $inputType ); |
|
182 | + $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $field_type, $slug_name ); |
|
183 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s-%s.php', $slug_dir, $post->ID, $inputType, $slug_name ); |
|
184 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $field_type ); |
|
185 | + $inputType && $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $inputType ); |
|
186 | 186 | } |
187 | 187 | |
188 | - $specifics []= sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
189 | - $specifics []= sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
190 | - $specifics []= sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
191 | - $specifics []= sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
188 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field-%s.php', $slug_dir, $post->ID, $view_id, $slug_name ); |
|
189 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-field.php', $slug_dir, $post->ID, $view_id ); |
|
190 | + $specifics [ ] = sprintf( '%spost-%d-field-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
191 | + $specifics [ ] = sprintf( '%spost-%d-field.php', $slug_dir, $post->ID ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** Field-specific */ |
195 | 195 | if ( $field_id && $form_id ) { |
196 | 196 | |
197 | 197 | if ( $field_id ) { |
198 | - $specifics []= sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
199 | - $specifics []= sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
198 | + $specifics [ ] = sprintf( '%sform-%d-field-%d-%s.php', $slug_dir, $form_id, $field_id, $slug_name ); |
|
199 | + $specifics [ ] = sprintf( '%sform-%d-field-%d.php', $slug_dir, $form_id, $field_id ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | if ( $field_type ) { |
203 | - $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
204 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
205 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
206 | - $inputType && $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
207 | - |
|
208 | - $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
209 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
210 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
211 | - $inputType && $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
212 | - |
|
213 | - $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
214 | - $inputType && $specifics []= sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
215 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
216 | - $inputType && $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
203 | + $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $field_type, $slug_name ); |
|
204 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s-%s.php', $slug_dir, $form_id, $inputType, $slug_name ); |
|
205 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $field_type ); |
|
206 | + $inputType && $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $inputType ); |
|
207 | + |
|
208 | + $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $field_type, $slug_name ); |
|
209 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s-%s.php', $slug_dir, $view_id, $inputType, $slug_name ); |
|
210 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $field_type ); |
|
211 | + $inputType && $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $inputType ); |
|
212 | + |
|
213 | + $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $field_type, $slug_name ); |
|
214 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s-%s.php', $slug_dir, $inputType, $slug_name ); |
|
215 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $field_type ); |
|
216 | + $inputType && $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $inputType ); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | 220 | if ( $form_id ) { |
221 | 221 | /** Generic field templates */ |
222 | - $specifics []= sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
223 | - $specifics []= sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
222 | + $specifics [ ] = sprintf( '%sview-%d-field-%s.php', $slug_dir, $view_id, $slug_name ); |
|
223 | + $specifics [ ] = sprintf( '%sform-%d-field-%s.php', $slug_dir, $form_id, $slug_name ); |
|
224 | 224 | |
225 | - $specifics []= sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
226 | - $specifics []= sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
225 | + $specifics [ ] = sprintf( '%sview-%d-field.php', $slug_dir, $view_id ); |
|
226 | + $specifics [ ] = sprintf( '%sform-%d-field.php', $slug_dir, $form_id ); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
230 | 230 | * Legacy. |
231 | 231 | */ |
232 | 232 | if ( $field_type ) { |
233 | - $specifics []= sprintf( '%s.php', $field_type ); |
|
234 | - $specifics []= sprintf( 'fields/%s.php', $field_type ); |
|
233 | + $specifics [ ] = sprintf( '%s.php', $field_type ); |
|
234 | + $specifics [ ] = sprintf( 'fields/%s.php', $field_type ); |
|
235 | 235 | } |
236 | 236 | |
237 | - $specifics []= sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
238 | - $specifics []= sprintf( '%sfield.php', $slug_dir ); |
|
237 | + $specifics [ ] = sprintf( '%sfield-%s.php', $slug_dir, $slug_name ); |
|
238 | + $specifics [ ] = sprintf( '%sfield.php', $slug_dir ); |
|
239 | 239 | |
240 | 240 | return array_merge( $specifics, $templates ); |
241 | 241 | }; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | /** Prevent any PHP warnings that may be generated. */ |
266 | 266 | ob_start(); |
267 | 267 | |
268 | - $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry['currency'], false, 'html' ); |
|
268 | + $display_value = \GFCommon::get_lead_field_display( $this->field->field, $value, $this->entry[ 'currency' ], false, 'html' ); |
|
269 | 269 | |
270 | 270 | if ( $errors = ob_get_clean() ) { |
271 | 271 | gravityview()->log->error( 'Errors when calling GFCommon::get_lead_field_display()', array( 'data' => $errors ) ); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
43 | 43 | |
44 | - if( ! empty( $output ) ) { |
|
44 | + if ( ! empty( $output ) ) { |
|
45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
46 | 46 | } |
47 | 47 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ( $search_fields as & $search_field ) { |
66 | 66 | if ( $this->name === \GV\Utils::get( $search_field, 'key' ) ) { |
67 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
67 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $atts = shortcode_atts( self::$defaults, $atts ); |
77 | 77 | |
78 | - $atts['action'] = 'edit'; |
|
78 | + $atts[ 'action' ] = 'edit'; |
|
79 | 79 | |
80 | 80 | return $this->shortcode( $atts, $content, $context ); |
81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $atts = shortcode_atts( self::$defaults, $atts ); |
93 | 93 | |
94 | - $atts['action'] = 'delete'; |
|
94 | + $atts[ 'action' ] = 'delete'; |
|
95 | 95 | |
96 | 96 | return $this->shortcode( $atts, $content, $context ); |
97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
133 | 133 | |
134 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
134 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
135 | 135 | |
136 | 136 | if ( empty( $this->view_id ) ) { |
137 | 137 | gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | return null; |
140 | 140 | } |
141 | 141 | |
142 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
142 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
143 | 143 | |
144 | 144 | if ( empty( $this->entry ) ) { |
145 | - gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) ); |
|
145 | + gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) ); |
|
146 | 146 | |
147 | 147 | return null; |
148 | 148 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
151 | 151 | |
152 | 152 | if ( ! $this->has_cap() ) { |
153 | - gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
153 | + gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
154 | 154 | |
155 | 155 | return null; |
156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Get just the URL, not the tag |
167 | - if ( 'url' === $this->settings['return'] ) { |
|
167 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
168 | 168 | return $url; |
169 | 169 | } |
170 | 170 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private function get_link_atts() { |
187 | 187 | |
188 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
188 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
189 | 189 | |
190 | - if ( 'delete' === $this->settings['action'] ) { |
|
191 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
190 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
191 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
192 | 192 | } |
193 | 193 | |
194 | - return (array) $link_atts; |
|
194 | + return (array)$link_atts; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | return $content; |
212 | 212 | } |
213 | 213 | |
214 | - switch ( $this->settings['action'] ) { |
|
214 | + switch ( $this->settings[ 'action' ] ) { |
|
215 | 215 | case 'edit': |
216 | 216 | $anchor_text = __( 'Edit Entry', 'gravityview' ); |
217 | 217 | break; |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | private function get_url() { |
240 | 240 | |
241 | 241 | // if post_id is not defined, default to view_id |
242 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id']; |
|
242 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ]; |
|
243 | 243 | |
244 | - switch ( $this->settings['action'] ) { |
|
244 | + switch ( $this->settings[ 'action' ] ) { |
|
245 | 245 | case 'edit': |
246 | 246 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
247 | 247 | break; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | private function has_cap() { |
268 | 268 | |
269 | - switch ( $this->settings['action'] ) { |
|
269 | + switch ( $this->settings[ 'action' ] ) { |
|
270 | 270 | case 'edit': |
271 | 271 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
272 | 272 | break; |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | */ |
332 | 332 | private function maybe_add_field_values_query_args( $url ) { |
333 | 333 | |
334 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
334 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
335 | 335 | |
336 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
336 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
337 | 337 | |
338 | 338 | $url = add_query_arg( $field_values, $url ); |
339 | 339 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
19 | -if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
19 | +if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
21 | 21 | } |
22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | 'atts' => NULL, |
158 | 158 | ) ); |
159 | 159 | |
160 | - foreach ($atts as $key => $value) { |
|
161 | - if( is_null( $value ) ) { |
|
160 | + foreach ( $atts as $key => $value ) { |
|
161 | + if ( is_null( $value ) ) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | $this->{$key} = $value; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | static function getInstance( $passed_post = NULL ) { |
190 | 190 | |
191 | - if( empty( self::$instance ) ) { |
|
191 | + if ( empty( self::$instance ) ) { |
|
192 | 192 | self::$instance = new self( $passed_post ); |
193 | 193 | } |
194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getCurrentField( $key = NULL ) { |
203 | 203 | |
204 | - if( !empty( $key ) ) { |
|
205 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
204 | + if ( ! empty( $key ) ) { |
|
205 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
206 | 206 | return $this->_current_field[ $key ]; |
207 | 207 | } |
208 | 208 | return NULL; |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | |
214 | 214 | public function setCurrentFieldSetting( $key, $value ) { |
215 | 215 | |
216 | - if( !empty( $this->_current_field ) ) { |
|
217 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
216 | + if ( ! empty( $this->_current_field ) ) { |
|
217 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | } |
221 | 221 | |
222 | 222 | public function getCurrentFieldSetting( $key ) { |
223 | - $settings = $this->getCurrentField('field_settings'); |
|
223 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
224 | 224 | |
225 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
225 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
226 | 226 | return $settings[ $key ]; |
227 | 227 | } |
228 | 228 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getAtts( $key = NULL ) { |
255 | 255 | |
256 | - if( !empty( $key ) ) { |
|
257 | - if( isset( $this->atts[ $key ] ) ) { |
|
256 | + if ( ! empty( $key ) ) { |
|
257 | + if ( isset( $this->atts[ $key ] ) ) { |
|
258 | 258 | return $this->atts[ $key ]; |
259 | 259 | } |
260 | 260 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
322 | 322 | |
323 | - if( $fields && !empty( $key ) ) { |
|
323 | + if ( $fields && ! empty( $key ) ) { |
|
324 | 324 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
325 | 325 | } |
326 | 326 | |
@@ -338,18 +338,18 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function getContextFields( $context = '' ) { |
340 | 340 | |
341 | - if( '' === $context ) { |
|
341 | + if ( '' === $context ) { |
|
342 | 342 | $context = $this->getContext(); |
343 | 343 | } |
344 | 344 | |
345 | 345 | $fields = $this->getFields(); |
346 | 346 | |
347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
347 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
348 | 348 | |
349 | 349 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
350 | 350 | $matches = explode( '_', $key ); |
351 | 351 | |
352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
352 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
353 | 353 | return $context_fields; |
354 | 354 | } |
355 | 355 | } |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function getField( $key ) { |
372 | 372 | |
373 | - if( !empty( $key ) ) { |
|
374 | - if( isset( $this->fields[ $key ] ) ) { |
|
373 | + if ( ! empty( $key ) ) { |
|
374 | + if ( isset( $this->fields[ $key ] ) ) { |
|
375 | 375 | return $this->fields[ $key ]; |
376 | 376 | } |
377 | 377 | } |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | public function getPaginationCounts() { |
478 | 478 | |
479 | 479 | $paging = $this->getPaging(); |
480 | - $offset = $paging['offset']; |
|
481 | - $page_size = $paging['page_size']; |
|
480 | + $offset = $paging[ 'offset' ]; |
|
481 | + $page_size = $paging[ 'page_size' ]; |
|
482 | 482 | $total = $this->getTotalEntries(); |
483 | 483 | |
484 | 484 | if ( empty( $total ) ) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | */ |
500 | 500 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
501 | 501 | |
502 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
502 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -595,16 +595,16 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function getCurrentEntry() { |
597 | 597 | |
598 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
598 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
599 | 599 | $entries = $this->getEntries(); |
600 | - $entry = $entries[0]; |
|
600 | + $entry = $entries[ 0 ]; |
|
601 | 601 | } else { |
602 | 602 | $entry = $this->_current_entry; |
603 | 603 | } |
604 | 604 | |
605 | 605 | /** @since 1.16 Fixes DataTables empty entry issue */ |
606 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
607 | - $entry = $this->_current_field['entry']; |
|
606 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
607 | + $entry = $this->_current_field[ 'entry' ]; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | return $entry; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
645 | 645 | |
646 | 646 | if ( empty( $zone ) ) { |
647 | - gravityview()->log->error( 'No zone defined.'); |
|
647 | + gravityview()->log->error( 'No zone defined.' ); |
|
648 | 648 | return NULL; |
649 | 649 | } |
650 | 650 | |
@@ -653,16 +653,16 @@ discard block |
||
653 | 653 | 'context' => $this->getContext(), |
654 | 654 | 'entry' => $this->getCurrentEntry(), |
655 | 655 | 'form' => $this->getForm(), |
656 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
656 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
657 | 657 | ); |
658 | 658 | |
659 | 659 | $final_atts = wp_parse_args( $atts, $defaults ); |
660 | 660 | |
661 | 661 | $output = ''; |
662 | 662 | |
663 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
663 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
664 | 664 | |
665 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
665 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
666 | 666 | |
667 | 667 | // Backward compatibility |
668 | 668 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -672,19 +672,19 @@ discard block |
||
672 | 672 | * @param \GravityView_View $this |
673 | 673 | * @deprecated Use `gravityview/template/table/fields` |
674 | 674 | */ |
675 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
675 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
676 | 676 | } |
677 | 677 | |
678 | 678 | if ( empty( $fields ) ) { |
679 | 679 | |
680 | - gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
680 | + gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
681 | 681 | |
682 | 682 | return NULL; |
683 | 683 | } |
684 | 684 | |
685 | 685 | $field_output = ''; |
686 | 686 | foreach ( $fields as $field ) { |
687 | - $final_atts['field'] = $field; |
|
687 | + $final_atts[ 'field' ] = $field; |
|
688 | 688 | |
689 | 689 | $field_output .= gravityview_field_output( $final_atts ); |
690 | 690 | } |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | return NULL; |
702 | 702 | } |
703 | 703 | |
704 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
705 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
704 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
705 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | $output .= $field_output; |
709 | 709 | |
710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
711 | 711 | $output .= '</div>'; |
712 | 712 | } |
713 | 713 | |
714 | - if( $echo ) { |
|
714 | + if ( $echo ) { |
|
715 | 715 | echo $output; |
716 | 716 | } |
717 | 717 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | */ |
730 | 730 | function locate_template( $template_names, $load = false, $require_once = true ) { |
731 | 731 | |
732 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
732 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
733 | 733 | |
734 | 734 | $located = $this->located_templates[ $template_names ]; |
735 | 735 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // Set $load to always false so we handle it here. |
739 | 739 | $located = parent::locate_template( $template_names, false, $require_once ); |
740 | 740 | |
741 | - if( is_string( $template_names ) ) { |
|
741 | + if ( is_string( $template_names ) ) { |
|
742 | 742 | $this->located_templates[ $template_names ] = $located; |
743 | 743 | } |
744 | 744 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * @return mixed|null The stored data. |
757 | 757 | */ |
758 | 758 | public function __get( $name ) { |
759 | - if( isset( $this->{$name} ) ) { |
|
759 | + if ( isset( $this->{$name} ) ) { |
|
760 | 760 | return $this->{$name}; |
761 | 761 | } else { |
762 | 762 | return NULL; |
@@ -785,17 +785,17 @@ discard block |
||
785 | 785 | $additional = array(); |
786 | 786 | |
787 | 787 | // form-19-table-body.php |
788 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
788 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
789 | 789 | |
790 | - if( $view_id = $this->getViewId() ) { |
|
790 | + if ( $view_id = $this->getViewId() ) { |
|
791 | 791 | // view-3-table-body.php |
792 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
792 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
793 | 793 | } |
794 | 794 | |
795 | - if( $this->getPostId() ) { |
|
795 | + if ( $this->getPostId() ) { |
|
796 | 796 | |
797 | 797 | // page-19-table-body.php |
798 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
798 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | // Combine with existing table-body.php and table.php |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | |
818 | 818 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
819 | 819 | |
820 | - if( !empty( $template_file) ) { |
|
820 | + if ( ! empty( $template_file ) ) { |
|
821 | 821 | |
822 | 822 | if ( $require_once ) { |
823 | 823 | require_once( $template_file ); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | // Prevent being called twice |
887 | 887 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
888 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
888 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
889 | 889 | return; |
890 | 890 | } |
891 | 891 | |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * @param string $zone Current widget zone, either `header` or `footer` |
908 | 908 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
909 | 909 | */ |
910 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
910 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
911 | 911 | |
912 | 912 | $css_class = gravityview_sanitize_html_class( $css_class ); |
913 | 913 | |
@@ -915,15 +915,15 @@ discard block |
||
915 | 915 | ?> |
916 | 916 | <div class="<?php echo $css_class; ?>"> |
917 | 917 | <?php |
918 | - foreach( $rows as $row ) { |
|
919 | - foreach( $row as $col => $areas ) { |
|
918 | + foreach ( $rows as $row ) { |
|
919 | + foreach ( $row as $col => $areas ) { |
|
920 | 920 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
921 | 921 | ?> |
922 | 922 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
923 | 923 | <?php |
924 | 924 | if ( ! empty( $areas ) ) { |
925 | 925 | foreach ( $areas as $area ) { |
926 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
926 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
927 | 927 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
928 | 928 | } |
929 | 929 | } |