@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @since 1.11 |
44 | 44 | * @param boolean $boolean Whether to trigger update on user registration (default: true) |
45 | 45 | */ |
46 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
47 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
46 | + if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
47 | + add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 ); |
|
48 | 48 | |
49 | 49 | // last resort in case the current user display name don't match any of the defaults |
50 | 50 | add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function update_user( $form = array(), $entry_id = 0 ) { |
64 | 64 | |
65 | - if( !class_exists( 'GFAPI' ) || !class_exists( 'GFUser' ) || empty( $entry_id ) ) { |
|
65 | + if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GFUser' ) || empty( $entry_id ) ) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | 69 | // support for GF User Registration 3.x |
70 | - $gf_user_3 = class_exists('GF_User_Registration') ? true : false; |
|
70 | + $gf_user_3 = class_exists( 'GF_User_Registration' ) ? true : false; |
|
71 | 71 | |
72 | - if( $gf_user_3 ) { |
|
72 | + if ( $gf_user_3 ) { |
|
73 | 73 | $gf_user_registration = GF_User_Registration::get_instance(); |
74 | 74 | } |
75 | 75 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @since 1.14 |
88 | 88 | */ |
89 | - if( $gf_user_3 ) { |
|
89 | + if ( $gf_user_3 ) { |
|
90 | 90 | $config = $gf_user_registration->get_single_submission_feed( $entry, $form ); |
91 | 91 | } else { |
92 | 92 | $config = GFUser::get_active_config( $form, $entry ); |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | */ |
103 | 103 | $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
104 | 104 | |
105 | - if( $preserve_role ) { |
|
106 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
105 | + if ( $preserve_role ) { |
|
106 | + $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Make sure the current display name is not changed with the update user method. |
111 | 111 | * @since 1.15 |
112 | 112 | */ |
113 | - $config['meta']['displayname'] = $this->match_current_display_name( $entry['created_by'] ); |
|
113 | + $config[ 'meta' ][ 'displayname' ] = $this->match_current_display_name( $entry[ 'created_by' ] ); |
|
114 | 114 | |
115 | 115 | |
116 | 116 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $is_create_feed = ( $config && rgars( $config, $feed_pos ) === 'create' ); |
128 | 128 | |
129 | 129 | // Only update if it's a create feed |
130 | - if( ! $is_create_feed ) { |
|
130 | + if ( ! $is_create_feed ) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | add_filter( 'send_email_change_email', '__return_false', 3 ); |
137 | 137 | |
138 | 138 | // Trigger the User Registration update user method |
139 | - if( $gf_user_3 ) { |
|
139 | + if ( $gf_user_3 ) { |
|
140 | 140 | $gf_user_registration->update_user( $entry, $form, $config ); |
141 | 141 | } else { |
142 | 142 | GFUser::update_user( $entry, $form, $config ); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | // In case we can't find the current display name format, or it is the 'nickname' format (which Gravity Forms doesn't support) |
168 | 168 | // trigger last resort method at the 'gform_user_updated' hook |
169 | - if( false === $format || 'nickname' === $format ) { |
|
169 | + if ( false === $format || 'nickname' === $format ) { |
|
170 | 170 | $this->_user_before_update = $user; |
171 | 171 | $format = 'nickname'; |
172 | 172 | } |
@@ -186,18 +186,18 @@ discard block |
||
186 | 186 | public function generate_display_names( $profileuser ) { |
187 | 187 | |
188 | 188 | $public_display = array(); |
189 | - $public_display['nickname'] = $profileuser->nickname; |
|
190 | - $public_display['username'] = $profileuser->user_login; |
|
189 | + $public_display[ 'nickname' ] = $profileuser->nickname; |
|
190 | + $public_display[ 'username' ] = $profileuser->user_login; |
|
191 | 191 | |
192 | - if ( !empty($profileuser->first_name) ) |
|
193 | - $public_display['firstname'] = $profileuser->first_name; |
|
192 | + if ( ! empty( $profileuser->first_name ) ) |
|
193 | + $public_display[ 'firstname' ] = $profileuser->first_name; |
|
194 | 194 | |
195 | - if ( !empty($profileuser->last_name) ) |
|
196 | - $public_display['lastname'] = $profileuser->last_name; |
|
195 | + if ( ! empty( $profileuser->last_name ) ) |
|
196 | + $public_display[ 'lastname' ] = $profileuser->last_name; |
|
197 | 197 | |
198 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
199 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
200 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
198 | + if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
|
199 | + $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
200 | + $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $public_display = array_map( 'trim', $public_display ); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true ); |
229 | 229 | |
230 | - $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' ); |
|
230 | + $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' ); |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Don't restore display name: |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * - or we don't need as we found the correct format before updating user. |
237 | 237 | * @since 1.14.4 |
238 | 238 | */ |
239 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
239 | + if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
240 | 240 | return; |
241 | 241 | } |
242 | 242 | |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | |
263 | 263 | $updated = wp_update_user( $restored_user ); |
264 | 264 | |
265 | - if( is_wp_error( $updated ) ) { |
|
266 | - do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
265 | + if ( is_wp_error( $updated ) ) { |
|
266 | + do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
267 | 267 | } else { |
268 | - do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
268 | + do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | $this->_user_before_update = null; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
38 | 38 | |
39 | - if( is_admin() ) { |
|
39 | + if ( is_admin() ) { |
|
40 | 40 | $this->load_components( 'admin' ); |
41 | 41 | } |
42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | static function getInstance() { |
57 | 57 | |
58 | - if( empty( self::$instance ) ) { |
|
58 | + if ( empty( self::$instance ) ) { |
|
59 | 59 | self::$instance = new GravityView_Edit_Entry; |
60 | 60 | } |
61 | 61 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | private function add_hooks() { |
82 | 82 | |
83 | 83 | // Add front-end access to Gravity Forms delete file action |
84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file' ) ); |
|
85 | 85 | |
86 | 86 | // Make sure this hook is run for non-admins |
87 | - add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
87 | + add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file' ) ); |
|
88 | 88 | |
89 | 89 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function addon_specific_hooks() { |
101 | 101 | |
102 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
103 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
102 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
103 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
148 | 148 | |
149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
149 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
150 | 150 | |
151 | 151 | $base = gv_entry_link( $entry, $post_id ); |
152 | 152 | |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | * Allow passing params to dynamically populate entry with values |
161 | 161 | * @since 1.9.2 |
162 | 162 | */ |
163 | - if( !empty( $field_values ) ) { |
|
163 | + if ( ! empty( $field_values ) ) { |
|
164 | 164 | |
165 | - if( is_array( $field_values ) ) { |
|
165 | + if ( is_array( $field_values ) ) { |
|
166 | 166 | // If already an array, no parse_str() needed |
167 | 167 | $params = $field_values; |
168 | 168 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
186 | 186 | |
187 | - if( empty( $context ) || $context !== 'edit' ) { |
|
187 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
188 | 188 | return $fields; |
189 | 189 | } |
190 | 190 | |
@@ -226,24 +226,24 @@ discard block |
||
226 | 226 | // If they can edit any entries (as defined in Gravity Forms) |
227 | 227 | // Or if they can edit other people's entries |
228 | 228 | // Then we're good. |
229 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
229 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
230 | 230 | |
231 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
231 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' ); |
|
232 | 232 | |
233 | 233 | $user_can_edit = true; |
234 | 234 | |
235 | - } else if( !isset( $entry['created_by'] ) ) { |
|
235 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
236 | 236 | |
237 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
237 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' ); |
|
238 | 238 | |
239 | 239 | $user_can_edit = false; |
240 | 240 | |
241 | 241 | } else { |
242 | 242 | |
243 | 243 | // get user_edit setting |
244 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
244 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
245 | 245 | // if View ID not specified or is the current view |
246 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
246 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
247 | 247 | } else { |
248 | 248 | // in case is specified and not the current view |
249 | 249 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -252,21 +252,21 @@ discard block |
||
252 | 252 | $current_user = wp_get_current_user(); |
253 | 253 | |
254 | 254 | // User edit is disabled |
255 | - if( empty( $user_edit ) ) { |
|
255 | + if ( empty( $user_edit ) ) { |
|
256 | 256 | |
257 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
257 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
258 | 258 | |
259 | 259 | $user_can_edit = false; |
260 | 260 | } |
261 | 261 | |
262 | 262 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
263 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
263 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
264 | 264 | |
265 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
265 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
266 | 266 | |
267 | 267 | $user_can_edit = true; |
268 | 268 | |
269 | - } else if( ! is_user_logged_in() ) { |
|
269 | + } else if ( ! is_user_logged_in() ) { |
|
270 | 270 | |
271 | 271 | do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
272 | 272 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | $labels = array( |
31 | 31 | 'cancel' => __( 'Cancel', 'gravityview' ), |
32 | - 'submit' => __( 'Update', 'gravityview') |
|
32 | + 'submit' => __( 'Update', 'gravityview' ) |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $object->form, $object->entry, $object->view_id ); |
44 | 44 | |
45 | 45 | ?> |
46 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" /> |
|
46 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" /> |
|
47 | 47 | |
48 | - <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a> |
|
48 | + <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a> |
|
49 | 49 | <?php |
50 | 50 | |
51 | 51 | /** |
@@ -59,5 +59,5 @@ discard block |
||
59 | 59 | |
60 | 60 | ?> |
61 | 61 | <input type="hidden" name="action" value="update" /> |
62 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
62 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
63 | 63 | </div> |
@@ -11,10 +11,10 @@ |
||
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="gv-search-box gv-search-date"> |
14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
16 | 16 | <?php } ?> |
17 | 17 | <p> |
18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
19 | 19 | </p> |
20 | 20 | </div> |
21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | ?> |
12 | 12 | <div class="gv-search-box gv-search-field-text"> |
13 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
15 | 15 | <?php } ?> |
16 | 16 | <p> |
17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
18 | 18 | </p> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | die; |
17 | 17 | } |
18 | 18 | |
19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
19 | +if ( ! class_exists( '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; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | static function getInstance( $passed_post = NULL ) { |
191 | 191 | |
192 | - if( empty( self::$instance ) ) { |
|
192 | + if ( empty( self::$instance ) ) { |
|
193 | 193 | self::$instance = new self( $passed_post ); |
194 | 194 | } |
195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function getCurrentField( $key = NULL ) { |
204 | 204 | |
205 | - if( !empty( $key ) ) { |
|
206 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
205 | + if ( ! empty( $key ) ) { |
|
206 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
207 | 207 | return $this->_current_field[ $key ]; |
208 | 208 | } |
209 | 209 | return NULL; |
@@ -214,16 +214,16 @@ discard block |
||
214 | 214 | |
215 | 215 | public function setCurrentFieldSetting( $key, $value ) { |
216 | 216 | |
217 | - if( !empty( $this->_current_field ) ) { |
|
218 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
217 | + if ( ! empty( $this->_current_field ) ) { |
|
218 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | 223 | public function getCurrentFieldSetting( $key ) { |
224 | - $settings = $this->getCurrentField('field_settings'); |
|
224 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
225 | 225 | |
226 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
226 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
227 | 227 | return $settings[ $key ]; |
228 | 228 | } |
229 | 229 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getAtts( $key = NULL ) { |
256 | 256 | |
257 | - if( !empty( $key ) ) { |
|
258 | - if( isset( $this->atts[ $key ] ) ) { |
|
257 | + if ( ! empty( $key ) ) { |
|
258 | + if ( isset( $this->atts[ $key ] ) ) { |
|
259 | 259 | return $this->atts[ $key ]; |
260 | 260 | } |
261 | 261 | return NULL; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
323 | 323 | |
324 | - if( $fields && !empty( $key ) ) { |
|
324 | + if ( $fields && ! empty( $key ) ) { |
|
325 | 325 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
326 | 326 | } |
327 | 327 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | */ |
342 | 342 | public function getField( $key ) { |
343 | 343 | |
344 | - if( !empty( $key ) ) { |
|
345 | - if( isset( $this->fields[ $key ] ) ) { |
|
344 | + if ( ! empty( $key ) ) { |
|
345 | + if ( isset( $this->fields[ $key ] ) ) { |
|
346 | 346 | return $this->fields[ $key ]; |
347 | 347 | } |
348 | 348 | } |
@@ -442,8 +442,8 @@ discard block |
||
442 | 442 | public function getPaginationCounts() { |
443 | 443 | |
444 | 444 | $paging = $this->getPaging(); |
445 | - $offset = $paging['offset']; |
|
446 | - $page_size = $paging['page_size']; |
|
445 | + $offset = $paging[ 'offset' ]; |
|
446 | + $page_size = $paging[ 'page_size' ]; |
|
447 | 447 | $total = $this->getTotalEntries(); |
448 | 448 | |
449 | 449 | if ( empty( $total ) ) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
466 | 466 | |
467 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
467 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -548,16 +548,16 @@ discard block |
||
548 | 548 | */ |
549 | 549 | public function getCurrentEntry() { |
550 | 550 | |
551 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
551 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
552 | 552 | $entries = $this->getEntries(); |
553 | - $entry = $entries[0]; |
|
553 | + $entry = $entries[ 0 ]; |
|
554 | 554 | } else { |
555 | 555 | $entry = $this->_current_entry; |
556 | 556 | } |
557 | 557 | |
558 | 558 | /** @since 1.16 Fixes DataTables empty entry issue */ |
559 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
560 | - $entry = $this->_current_field['entry']; |
|
559 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
560 | + $entry = $this->_current_field[ 'entry' ]; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | return $entry; |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | */ |
595 | 595 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
596 | 596 | |
597 | - if( empty( $zone ) ) { |
|
598 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
|
597 | + if ( empty( $zone ) ) { |
|
598 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); |
|
599 | 599 | return NULL; |
600 | 600 | } |
601 | 601 | |
@@ -604,33 +604,33 @@ discard block |
||
604 | 604 | 'context' => $this->getContext(), |
605 | 605 | 'entry' => $this->getCurrentEntry(), |
606 | 606 | 'form' => $this->getForm(), |
607 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
607 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
608 | 608 | ); |
609 | 609 | |
610 | 610 | $final_atts = wp_parse_args( $atts, $defaults ); |
611 | 611 | |
612 | 612 | $output = ''; |
613 | 613 | |
614 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
614 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
615 | 615 | |
616 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
616 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
617 | 617 | |
618 | 618 | // Backward compatibility |
619 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
619 | + if ( 'table' === $this->getTemplatePartSlug() ) { |
|
620 | 620 | /** |
621 | 621 | * Modify the fields displayed in the table |
622 | 622 | * @var array |
623 | 623 | */ |
624 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
624 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
625 | 625 | } |
626 | 626 | |
627 | - if( empty( $fields ) ) { |
|
627 | + if ( empty( $fields ) ) { |
|
628 | 628 | return NULL; |
629 | 629 | } |
630 | 630 | |
631 | 631 | $field_output = ''; |
632 | 632 | foreach ( $fields as $field ) { |
633 | - $final_atts['field'] = $field; |
|
633 | + $final_atts[ 'field' ] = $field; |
|
634 | 634 | |
635 | 635 | $field_output .= gravityview_field_output( $final_atts ); |
636 | 636 | } |
@@ -641,21 +641,21 @@ discard block |
||
641 | 641 | * @since 1.7.6 |
642 | 642 | * @param boolean $hide_empty_zone Default: false |
643 | 643 | */ |
644 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
644 | + if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
645 | 645 | return NULL; |
646 | 646 | } |
647 | 647 | |
648 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
649 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
648 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
649 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | $output .= $field_output; |
653 | 653 | |
654 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
654 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
655 | 655 | $output .= '</div>'; |
656 | 656 | } |
657 | 657 | |
658 | - if( $echo ) { |
|
658 | + if ( $echo ) { |
|
659 | 659 | echo $output; |
660 | 660 | } |
661 | 661 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | */ |
674 | 674 | function locate_template( $template_names, $load = false, $require_once = true ) { |
675 | 675 | |
676 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
676 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
677 | 677 | |
678 | 678 | $located = $this->located_templates[ $template_names ]; |
679 | 679 | |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | // Set $load to always false so we handle it here. |
683 | 683 | $located = parent::locate_template( $template_names, false, $require_once ); |
684 | 684 | |
685 | - if( is_string( $template_names ) ) { |
|
685 | + if ( is_string( $template_names ) ) { |
|
686 | 686 | $this->located_templates[ $template_names ] = $located; |
687 | 687 | } |
688 | 688 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @return mixed|null The stored data. |
701 | 701 | */ |
702 | 702 | public function __get( $name ) { |
703 | - if( isset( $this->{$name} ) ) { |
|
703 | + if ( isset( $this->{$name} ) ) { |
|
704 | 704 | return $this->{$name}; |
705 | 705 | } else { |
706 | 706 | return NULL; |
@@ -729,15 +729,15 @@ discard block |
||
729 | 729 | $additional = array(); |
730 | 730 | |
731 | 731 | // form-19-table-body.php |
732 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
732 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
733 | 733 | |
734 | 734 | // view-3-table-body.php |
735 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
735 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
736 | 736 | |
737 | - if( $this->getPostId() ) { |
|
737 | + if ( $this->getPostId() ) { |
|
738 | 738 | |
739 | 739 | // page-19-table-body.php |
740 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
740 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | // Combine with existing table-body.php and table.php |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
761 | 761 | |
762 | - if( !empty( $template_file) ) { |
|
762 | + if ( ! empty( $template_file ) ) { |
|
763 | 763 | |
764 | 764 | if ( $require_once ) { |
765 | 765 | require_once( $template_file ); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | */ |
777 | 777 | public function render_widget_hooks( $view_id ) { |
778 | 778 | |
779 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
779 | + if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
780 | 780 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
781 | 781 | return; |
782 | 782 | } |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | $view_data = gravityview_get_current_view_data( $view_id ); |
785 | 785 | |
786 | 786 | // get View widget configuration |
787 | - $widgets = (array)$view_data['widgets']; |
|
787 | + $widgets = (array)$view_data[ 'widgets' ]; |
|
788 | 788 | |
789 | - switch( current_filter() ) { |
|
789 | + switch ( current_filter() ) { |
|
790 | 790 | default: |
791 | 791 | case 'gravityview_before': |
792 | 792 | $zone = 'header'; |
@@ -800,9 +800,9 @@ discard block |
||
800 | 800 | * Filter widgets not in the current zone |
801 | 801 | * @since 1.16 |
802 | 802 | */ |
803 | - foreach( $widgets as $key => $widget ) { |
|
803 | + foreach ( $widgets as $key => $widget ) { |
|
804 | 804 | // The widget isn't in the current zone |
805 | - if( false === strpos( $key, $zone ) ) { |
|
805 | + if ( false === strpos( $key, $zone ) ) { |
|
806 | 806 | unset( $widgets[ $key ] ); |
807 | 807 | } |
808 | 808 | } |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | } |
818 | 818 | |
819 | 819 | // Prevent being called twice |
820 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
821 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
820 | + if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { |
|
821 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); |
|
822 | 822 | return; |
823 | 823 | } |
824 | 824 | |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | |
830 | 830 | $default_css_class = 'gv-grid gv-widgets-' . $zone; |
831 | 831 | |
832 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
832 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
833 | 833 | $default_css_class .= ' gv-widgets-no-results'; |
834 | 834 | } |
835 | 835 | |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | * @param string $zone Current widget zone, either `header` or `footer` |
841 | 841 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
842 | 842 | */ |
843 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
843 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
844 | 844 | |
845 | 845 | $css_class = gravityview_sanitize_html_class( $css_class ); |
846 | 846 | |
@@ -848,17 +848,17 @@ discard block |
||
848 | 848 | ?> |
849 | 849 | <div class="<?php echo $css_class; ?>"> |
850 | 850 | <?php |
851 | - foreach( $rows as $row ) { |
|
852 | - foreach( $row as $col => $areas ) { |
|
853 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
|
851 | + foreach ( $rows as $row ) { |
|
852 | + foreach ( $row as $col => $areas ) { |
|
853 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; |
|
854 | 854 | ?> |
855 | 855 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
856 | 856 | <?php |
857 | - if( !empty( $areas ) ) { |
|
858 | - foreach( $areas as $area ) { |
|
859 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
860 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
861 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
857 | + if ( ! empty( $areas ) ) { |
|
858 | + foreach ( $areas as $area ) { |
|
859 | + if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
860 | + foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { |
|
861 | + do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
@@ -874,8 +874,8 @@ discard block |
||
874 | 874 | * Prevent widgets from being called twice. |
875 | 875 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin |
876 | 876 | */ |
877 | - if( did_action( 'loop_start' ) ) { |
|
878 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
877 | + if ( did_action( 'loop_start' ) ) { |
|
878 | + do_action( $zone . '_' . $view_id . '_widgets' ); |
|
879 | 879 | } |
880 | 880 | } |
881 | 881 |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
89 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
90 | 90 | |
91 | 91 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
92 | 92 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | |
234 | 234 | $this->context_view_id = $view_id; |
235 | 235 | |
236 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
236 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
237 | 237 | /** |
238 | 238 | * used on a has_multiple_views context |
239 | 239 | * @see GravityView_API::entry_link |
240 | 240 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
241 | 241 | */ |
242 | - $this->context_view_id = $_GET['gvid']; |
|
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 |
||
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 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
283 | 283 | |
284 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
284 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
285 | 285 | $this->setPostId( $post_id ); |
286 | 286 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
287 | 287 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
319 | 319 | |
320 | - if( 'post' === $search_method ) { |
|
320 | + if ( 'post' === $search_method ) { |
|
321 | 321 | $get = $_POST; |
322 | 322 | } else { |
323 | 323 | $get = $_GET; |
@@ -373,20 +373,20 @@ discard block |
||
373 | 373 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
374 | 374 | * @param array $entry Current entry |
375 | 375 | */ |
376 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
376 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
377 | 377 | |
378 | 378 | if ( ! $apply_outside_loop ) { |
379 | 379 | return $title; |
380 | 380 | } |
381 | 381 | |
382 | 382 | // User reported WooCommerce doesn't pass two args. |
383 | - if ( empty( $passed_post_id ) ) { |
|
383 | + if ( empty( $passed_post_id ) ) { |
|
384 | 384 | return $title; |
385 | 385 | } |
386 | 386 | |
387 | 387 | // Don't modify the title for anything other than the current view/post. |
388 | 388 | // This is true for embedded shortcodes and Views. |
389 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
389 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
390 | 390 | return $title; |
391 | 391 | } |
392 | 392 | |
@@ -396,19 +396,19 @@ discard block |
||
396 | 396 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
397 | 397 | } else { |
398 | 398 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
399 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
399 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
400 | 400 | $view_meta = $view_data; |
401 | 401 | break; |
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
406 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
407 | 407 | |
408 | - $title = $view_meta['atts']['single_title']; |
|
408 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
409 | 409 | |
410 | 410 | // We are allowing HTML in the fields, so no escaping the output |
411 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
411 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
412 | 412 | |
413 | 413 | $title = do_shortcode( $title ); |
414 | 414 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | public function render_view( $passed_args ) { |
510 | 510 | |
511 | 511 | // validate attributes |
512 | - if ( empty( $passed_args['id'] ) ) { |
|
512 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
513 | 513 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
514 | 514 | return null; |
515 | 515 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | return null; |
532 | 532 | } |
533 | 533 | |
534 | - $view_id = $passed_args['id']; |
|
534 | + $view_id = $passed_args[ 'id' ]; |
|
535 | 535 | |
536 | 536 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
537 | 537 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $passed_args = array_filter( $passed_args, 'strlen' ); |
545 | 545 | |
546 | 546 | //Override shortcode args over View template settings |
547 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
547 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
548 | 548 | |
549 | 549 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
550 | 550 | |
@@ -566,11 +566,11 @@ discard block |
||
566 | 566 | * Don't render View if user isn't allowed to see it |
567 | 567 | * @since 1.15 |
568 | 568 | */ |
569 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
569 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
570 | 570 | return null; |
571 | 571 | } |
572 | 572 | |
573 | - if( $this->isGravityviewPostType() ) { |
|
573 | + if ( $this->isGravityviewPostType() ) { |
|
574 | 574 | |
575 | 575 | /** |
576 | 576 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -582,9 +582,9 @@ discard block |
||
582 | 582 | */ |
583 | 583 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
584 | 584 | |
585 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
585 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
586 | 586 | |
587 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
587 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
588 | 588 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
589 | 589 | } |
590 | 590 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | $gravityview_view = new GravityView_View( $view_data ); |
601 | 601 | |
602 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
602 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
603 | 603 | |
604 | 604 | $gravityview_view->setPostId( $post_id ); |
605 | 605 | |
@@ -609,20 +609,20 @@ discard block |
||
609 | 609 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
610 | 610 | |
611 | 611 | //fetch template and slug |
612 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
612 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
613 | 613 | |
614 | 614 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Disable fetching initial entries for views that don't need it (DataTables) |
618 | 618 | */ |
619 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
619 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
620 | 620 | |
621 | 621 | /** |
622 | 622 | * Hide View data until search is performed |
623 | 623 | * @since 1.5.4 |
624 | 624 | */ |
625 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
625 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
626 | 626 | $gravityview_view->setHideUntilSearched( true ); |
627 | 627 | $get_entries = false; |
628 | 628 | } |
@@ -630,23 +630,23 @@ discard block |
||
630 | 630 | |
631 | 631 | if ( $get_entries ) { |
632 | 632 | |
633 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
633 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
634 | 634 | // add filter to enable column sorting |
635 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
635 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
636 | 636 | } |
637 | 637 | |
638 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
638 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
639 | 639 | |
640 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
640 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
641 | 641 | |
642 | 642 | } else { |
643 | 643 | |
644 | 644 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
645 | 645 | |
646 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
646 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
647 | 647 | } |
648 | 648 | |
649 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
649 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
650 | 650 | $gravityview_view->setContext( 'directory' ); |
651 | 651 | $sections = array( 'header', 'body', 'footer' ); |
652 | 652 | |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | // user requested Single Entry View |
656 | 656 | do_action( 'gravityview_log_debug', '[render_view] Executing Single View' ); |
657 | 657 | |
658 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
658 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
659 | 659 | |
660 | 660 | $entry = $this->getEntry(); |
661 | 661 | |
@@ -682,20 +682,20 @@ discard block |
||
682 | 682 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
683 | 683 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
684 | 684 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
685 | - 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 ); |
|
685 | + 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 ); |
|
686 | 686 | return null; |
687 | 687 | } |
688 | 688 | |
689 | 689 | //fetch template and slug |
690 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
690 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
691 | 691 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
692 | 692 | |
693 | 693 | //fetch entry detail |
694 | - $view_entries['count'] = 1; |
|
695 | - $view_entries['entries'][] = $entry; |
|
696 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
694 | + $view_entries[ 'count' ] = 1; |
|
695 | + $view_entries[ 'entries' ][ ] = $entry; |
|
696 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
697 | 697 | |
698 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
698 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
699 | 699 | |
700 | 700 | // set back link label |
701 | 701 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -705,11 +705,11 @@ discard block |
||
705 | 705 | } |
706 | 706 | |
707 | 707 | // add template style |
708 | - self::add_style( $view_data['template_id'] ); |
|
708 | + self::add_style( $view_data[ 'template_id' ] ); |
|
709 | 709 | |
710 | 710 | // Prepare to render view and set vars |
711 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
712 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
711 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
712 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
713 | 713 | |
714 | 714 | // If Edit |
715 | 715 | if ( 'edit' === gravityview_get_context() ) { |
@@ -722,11 +722,11 @@ discard block |
||
722 | 722 | |
723 | 723 | } else { |
724 | 724 | // finaly we'll render some html |
725 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
725 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
726 | 726 | |
727 | 727 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
728 | 728 | foreach ( $sections as $section ) { |
729 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
729 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
730 | 730 | $gravityview_view->render( $view_slug, $section, false ); |
731 | 731 | } |
732 | 732 | } |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | $datetime_format = 'Y-m-d H:i:s'; |
781 | 781 | $search_is_outside_view_bounds = false; |
782 | 782 | |
783 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
783 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
784 | 784 | |
785 | 785 | $search_date = strtotime( $search_criteria[ $key ] ); |
786 | 786 | |
@@ -808,14 +808,14 @@ discard block |
||
808 | 808 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
809 | 809 | |
810 | 810 | // Then we override the search and re-set the start date |
811 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
811 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
812 | 812 | } |
813 | 813 | } |
814 | 814 | } |
815 | 815 | |
816 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
816 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
817 | 817 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
818 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
818 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
819 | 819 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
820 | 820 | } |
821 | 821 | } |
@@ -833,9 +833,9 @@ discard block |
||
833 | 833 | */ |
834 | 834 | public static function process_search_only_approved( $args, $search_criteria ) { |
835 | 835 | |
836 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
837 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
838 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
836 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
837 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
838 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
839 | 839 | |
840 | 840 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
841 | 841 | } |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | */ |
860 | 860 | public static function is_entry_approved( $entry, $args = array() ) { |
861 | 861 | |
862 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
862 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
863 | 863 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
864 | 864 | return true; |
865 | 865 | } |
866 | 866 | |
867 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
867 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
868 | 868 | |
869 | 869 | if ( $is_approved ) { |
870 | 870 | return true; |
@@ -897,26 +897,26 @@ discard block |
||
897 | 897 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
898 | 898 | |
899 | 899 | // implicity search |
900 | - if ( ! empty( $args['search_value'] ) ) { |
|
900 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
901 | 901 | |
902 | 902 | // Search operator options. Options: `is` or `contains` |
903 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
903 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
904 | 904 | |
905 | - $search_criteria['field_filters'][] = array( |
|
905 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
906 | 906 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
907 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
907 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
908 | 908 | 'operator' => $operator, |
909 | 909 | ); |
910 | 910 | } |
911 | 911 | |
912 | - if( $search_criteria !== $original_search_criteria ) { |
|
912 | + if ( $search_criteria !== $original_search_criteria ) { |
|
913 | 913 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
914 | 914 | } |
915 | 915 | |
916 | 916 | // Handle setting date range |
917 | 917 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
918 | 918 | |
919 | - if( $search_criteria !== $original_search_criteria ) { |
|
919 | + if ( $search_criteria !== $original_search_criteria ) { |
|
920 | 920 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
921 | 921 | } |
922 | 922 | |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
928 | 928 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
929 | 929 | */ |
930 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
930 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
931 | 931 | |
932 | 932 | return $search_criteria; |
933 | 933 | } |
@@ -973,16 +973,16 @@ discard block |
||
973 | 973 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
974 | 974 | |
975 | 975 | // Paging & offset |
976 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
976 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
977 | 977 | |
978 | 978 | if ( -1 === $page_size ) { |
979 | 979 | $page_size = PHP_INT_MAX; |
980 | 980 | } |
981 | 981 | |
982 | - if ( isset( $args['offset'] ) ) { |
|
983 | - $offset = intval( $args['offset'] ); |
|
982 | + if ( isset( $args[ 'offset' ] ) ) { |
|
983 | + $offset = intval( $args[ 'offset' ] ); |
|
984 | 984 | } else { |
985 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
985 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
986 | 986 | $offset = ( $curr_page - 1 ) * $page_size; |
987 | 987 | } |
988 | 988 | |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | 'search_criteria' => $search_criteria, |
1001 | 1001 | 'sorting' => $sorting, |
1002 | 1002 | 'paging' => $paging, |
1003 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1003 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1004 | 1004 | ); |
1005 | 1005 | |
1006 | 1006 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1026 | 1026 | * @param array $args View configuration args. |
1027 | 1027 | */ |
1028 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1028 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1029 | 1029 | |
1030 | 1030 | do_action( 'gravityview_log_debug', '[get_view_entries] $parameters passed to gravityview_get_entries(): ', $parameters ); |
1031 | 1031 | |
@@ -1065,8 +1065,8 @@ discard block |
||
1065 | 1065 | */ |
1066 | 1066 | public static function updateViewSorting( $args, $form_id ) { |
1067 | 1067 | $sorting = array(); |
1068 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1069 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1068 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1069 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1070 | 1070 | |
1071 | 1071 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1072 | 1072 | |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | |
1107 | 1107 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1108 | 1108 | |
1109 | - switch ( $sort_field['type'] ) { |
|
1109 | + switch ( $sort_field[ 'type' ] ) { |
|
1110 | 1110 | |
1111 | 1111 | case 'address': |
1112 | 1112 | // Sorting by full address |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | */ |
1124 | 1124 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1125 | 1125 | |
1126 | - switch( strtolower( $address_part ) ){ |
|
1126 | + switch ( strtolower( $address_part ) ) { |
|
1127 | 1127 | case 'street': |
1128 | 1128 | $sort_field_id .= '.1'; |
1129 | 1129 | break; |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | */ |
1204 | 1204 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1205 | 1205 | |
1206 | - if ( empty( $single_entry ) ){ |
|
1206 | + if ( empty( $single_entry ) ) { |
|
1207 | 1207 | return false; |
1208 | 1208 | } else { |
1209 | 1209 | return $single_entry; |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1231 | 1231 | * @since 1.15 |
1232 | 1232 | */ |
1233 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1233 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1234 | 1234 | continue; |
1235 | 1235 | } |
1236 | 1236 | |
@@ -1239,19 +1239,19 @@ discard block |
||
1239 | 1239 | $css_dependencies = array(); |
1240 | 1240 | |
1241 | 1241 | // If the thickbox is enqueued, add dependencies |
1242 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1242 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1243 | 1243 | |
1244 | 1244 | /** |
1245 | 1245 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1246 | 1246 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1247 | 1247 | */ |
1248 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1248 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1249 | 1249 | |
1250 | 1250 | /** |
1251 | 1251 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1252 | 1252 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1253 | 1253 | */ |
1254 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1254 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
@@ -1259,25 +1259,25 @@ discard block |
||
1259 | 1259 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1260 | 1260 | * @since 1.15 |
1261 | 1261 | */ |
1262 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1263 | - $css_dependencies[] = 'dashicons'; |
|
1262 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1263 | + $css_dependencies[ ] = 'dashicons'; |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1267 | 1267 | |
1268 | 1268 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1269 | 1269 | |
1270 | - 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 ); |
|
1270 | + 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 ); |
|
1271 | 1271 | |
1272 | 1272 | wp_enqueue_script( 'gravityview-fe-view' ); |
1273 | 1273 | |
1274 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1274 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1275 | 1275 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | wp_enqueue_style( 'gravityview_default_style', plugins_url( 'templates/css/gv-default-styles.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1279 | 1279 | |
1280 | - self::add_style( $data['template_id'] ); |
|
1280 | + self::add_style( $data[ 'template_id' ] ); |
|
1281 | 1281 | |
1282 | 1282 | } |
1283 | 1283 | |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | } elseif ( empty( $template_id ) ) { |
1314 | 1314 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1315 | 1315 | } else { |
1316 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1316 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | } |
@@ -1338,11 +1338,11 @@ discard block |
||
1338 | 1338 | * Not a table-based template; don't add sort icons |
1339 | 1339 | * @since 1.12 |
1340 | 1340 | */ |
1341 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1341 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1342 | 1342 | return $label; |
1343 | 1343 | } |
1344 | 1344 | |
1345 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1345 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1346 | 1346 | return $label; |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1350,29 +1350,29 @@ discard block |
||
1350 | 1350 | |
1351 | 1351 | $class = 'gv-sort'; |
1352 | 1352 | |
1353 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1353 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1354 | 1354 | |
1355 | 1355 | $sort_args = array( |
1356 | - 'sort' => $field['id'], |
|
1356 | + 'sort' => $field[ 'id' ], |
|
1357 | 1357 | 'dir' => 'asc', |
1358 | 1358 | ); |
1359 | 1359 | |
1360 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1360 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1361 | 1361 | //toggle sorting direction. |
1362 | - if ( 'asc' === $sorting['direction'] ) { |
|
1363 | - $sort_args['dir'] = 'desc'; |
|
1362 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1363 | + $sort_args[ 'dir' ] = 'desc'; |
|
1364 | 1364 | $class .= ' gv-icon-sort-desc'; |
1365 | 1365 | } else { |
1366 | - $sort_args['dir'] = 'asc'; |
|
1366 | + $sort_args[ 'dir' ] = 'asc'; |
|
1367 | 1367 | $class .= ' gv-icon-sort-asc'; |
1368 | 1368 | } |
1369 | 1369 | } else { |
1370 | 1370 | $class .= ' gv-icon-caret-up-down'; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1373 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1374 | 1374 | |
1375 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1375 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1376 | 1376 | |
1377 | 1377 | } |
1378 | 1378 | |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | |
1391 | 1391 | $field_type = $field_id; |
1392 | 1392 | |
1393 | - if( is_numeric( $field_id ) ) { |
|
1393 | + if ( is_numeric( $field_id ) ) { |
|
1394 | 1394 | $field = GFFormsModel::get_field( $form, $field_id ); |
1395 | 1395 | $field_type = $field->type; |
1396 | 1396 | } |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | return false; |
1414 | 1414 | } |
1415 | 1415 | |
1416 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1416 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1417 | 1417 | |
1418 | 1418 | } |
1419 | 1419 |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | + do_action( 'gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | * @param string $default_option Default: `—` (—) |
22 | 22 | * @param string $field_type Field type: "select" or "multiselect" |
23 | 23 | */ |
24 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'select' ); |
|
24 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'select' ); |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <div class="gv-search-box"> |
28 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
29 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
28 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
29 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
30 | 30 | <?php } ?> |
31 | 31 | <p> |
32 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
33 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
32 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"> |
|
33 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
34 | 34 | <?php |
35 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
36 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
35 | + foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
36 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
37 | 37 | <?php endforeach; ?> |
38 | 38 | </select> |
39 | 39 | </p> |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-multiselect.php - No choices for field' ); |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | + do_action( 'gravityview_log_debug', 'search-field-multiselect.php - No choices for field' ); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | * @param string $default_option Default: `—` (—) |
22 | 22 | * @param string $field_type Field type: "select" or "multiselect" |
23 | 23 | */ |
24 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'multiselect' ); |
|
24 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'multiselect' ); |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <div class="gv-search-box"> |
28 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
29 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
28 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
29 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
30 | 30 | <?php } ?> |
31 | 31 | <p> |
32 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple> |
|
33 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
32 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" multiple> |
|
33 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
34 | 34 | <?php |
35 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
36 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
35 | + foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
36 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
37 | 37 | <?php endforeach; ?> |
38 | 38 | </select> |
39 | 39 | </p> |