@@ -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 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct( $prevent_multiple_instances = '' ) { |
73 | 73 | |
74 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
74 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
75 | 75 | return parent::__construct(); |
76 | 76 | } |
77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function get_instance() { |
85 | 85 | |
86 | - if( empty( self::$instance ) ) { |
|
86 | + if ( empty( self::$instance ) ) { |
|
87 | 87 | self::$instance = new self( 'get_instance' ); |
88 | 88 | } |
89 | 89 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * Prevent Gravity Forms from showing the uninstall tab on the settings page |
107 | 107 | * @hack |
108 | 108 | */ |
109 | - if( $caps === $this->_capabilities_uninstall ) { |
|
109 | + if ( $caps === $this->_capabilities_uninstall ) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - if( empty( $caps ) ) { |
|
113 | + if ( empty( $caps ) ) { |
|
114 | 114 | $caps = array( 'gravityview_full_access' ); |
115 | 115 | } |
116 | 116 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
134 | 134 | |
135 | 135 | /** @since 1.7.6 */ |
136 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
136 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
137 | 137 | |
138 | 138 | parent::init_admin(); |
139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function modify_app_settings_menu_title( $setting_tabs ) { |
149 | 149 | |
150 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
150 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
151 | 151 | |
152 | 152 | return $setting_tabs; |
153 | 153 | } |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _load_license_handler() { |
166 | 166 | |
167 | - if( !empty( $this->License_Handler ) ) { |
|
167 | + if ( ! empty( $this->License_Handler ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
171 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
172 | 172 | |
173 | 173 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
174 | 174 | } |
@@ -180,60 +180,60 @@ discard block |
||
180 | 180 | function license_key_notice() { |
181 | 181 | |
182 | 182 | // Only show on GravityView pages |
183 | - if( ! gravityview_is_admin_page() ) { |
|
183 | + if ( ! gravityview_is_admin_page() ) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | - $license_status = self::getSetting('license_key_status'); |
|
188 | - $license_id = self::getSetting('license_key'); |
|
187 | + $license_status = self::getSetting( 'license_key_status' ); |
|
188 | + $license_id = self::getSetting( 'license_key' ); |
|
189 | 189 | $license_id = empty( $license_id ) ? 'license' : $license_id; |
190 | 190 | |
191 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
191 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * I wanted to remove the period from after the buttons in the string, |
195 | 195 | * but didn't want to mess up the translation strings for the translators. |
196 | 196 | */ |
197 | 197 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
198 | - $title = __('Inactive License', 'gravityview'); |
|
198 | + $title = __( 'Inactive License', 'gravityview' ); |
|
199 | 199 | $status = ''; |
200 | 200 | $update_below = false; |
201 | 201 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
202 | 202 | switch ( $license_status ) { |
203 | 203 | case 'invalid': |
204 | - $title = __('Invalid License', 'gravityview'); |
|
205 | - $status = __('is invalid', 'gravityview'); |
|
204 | + $title = __( 'Invalid License', 'gravityview' ); |
|
205 | + $status = __( 'is invalid', 'gravityview' ); |
|
206 | 206 | break; |
207 | 207 | case 'deactivated': |
208 | - $status = __('is inactive', 'gravityview'); |
|
209 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
208 | + $status = __( 'is inactive', 'gravityview' ); |
|
209 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
210 | 210 | break; |
211 | 211 | /** @noinspection PhpMissingBreakStatementInspection */ |
212 | 212 | case '': |
213 | 213 | $license_status = 'site_inactive'; |
214 | 214 | // break intentionally left blank |
215 | 215 | case 'site_inactive': |
216 | - $status = __('has not been activated', 'gravityview'); |
|
217 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
216 | + $status = __( 'has not been activated', 'gravityview' ); |
|
217 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
218 | 218 | break; |
219 | 219 | } |
220 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
220 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
221 | 221 | |
222 | 222 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
223 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
223 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
224 | 224 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
225 | 225 | } else { |
226 | 226 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . $primary_button_link . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
227 | 227 | } |
228 | 228 | |
229 | - if( !empty( $status ) ) { |
|
229 | + if ( ! empty( $status ) ) { |
|
230 | 230 | GravityView_Admin_Notices::add_notice( array( |
231 | 231 | 'message' => $message, |
232 | 232 | 'class' => 'updated', |
233 | 233 | 'title' => $title, |
234 | 234 | 'cap' => 'gravityview_edit_settings', |
235 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
236 | - )); |
|
235 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
236 | + ) ); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $styles = parent::styles(); |
247 | 247 | |
248 | - $styles[] = array( |
|
248 | + $styles[ ] = array( |
|
249 | 249 | 'handle' => 'gravityview_settings', |
250 | 250 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
251 | 251 | 'version' => GravityView_Plugin::version, |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return void |
269 | 269 | */ |
270 | 270 | public function add_network_menu() { |
271 | - if( GravityView_Plugin::is_network_activated() ) { |
|
271 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
272 | 272 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
273 | 273 | } |
274 | 274 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * If multisite and not network admin, we don't want the settings to show. |
286 | 286 | * @since 1.7.6 |
287 | 287 | */ |
288 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
288 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
296 | 296 | |
297 | - if( $show_submenu ) { |
|
297 | + if ( $show_submenu ) { |
|
298 | 298 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
299 | 299 | } |
300 | 300 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | /** |
326 | 326 | * Backward compatibility with Redux |
327 | 327 | */ |
328 | - if( $setting_name === 'license' ) { |
|
328 | + if ( $setting_name === 'license' ) { |
|
329 | 329 | return array( |
330 | 330 | 'license' => parent::get_app_setting( 'license_key' ), |
331 | 331 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | $return = $text . $activation; |
391 | 391 | |
392 | - if( $echo ) { |
|
392 | + if ( $echo ) { |
|
393 | 393 | echo $return; |
394 | 394 | } |
395 | 395 | |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function settings_submit( $field, $echo = true ) { |
418 | 418 | |
419 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
419 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
420 | 420 | |
421 | 421 | $attributes = $this->get_field_attributes( $field ); |
422 | 422 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
423 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
423 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
424 | 424 | |
425 | 425 | |
426 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
427 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
426 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
427 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
428 | 428 | |
429 | 429 | if ( empty( $value ) ) { |
430 | 430 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $attributes = $this->get_field_attributes( $field ); |
434 | 434 | |
435 | 435 | $html = '<input |
436 | - type="' . $field['type'] . '" |
|
436 | + type="' . $field[ 'type' ] . '" |
|
437 | 437 | name="' . esc_attr( $name ) . '" |
438 | 438 | value="' . $value . '" ' . |
439 | 439 | implode( ' ', $attributes ) . |
@@ -455,16 +455,16 @@ discard block |
||
455 | 455 | * @return string |
456 | 456 | */ |
457 | 457 | public function settings_save( $field, $echo = true ) { |
458 | - $field['type'] = 'submit'; |
|
459 | - $field['name'] = 'gform-settings-save'; |
|
460 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
458 | + $field[ 'type' ] = 'submit'; |
|
459 | + $field[ 'name' ] = 'gform-settings-save'; |
|
460 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
461 | 461 | |
462 | 462 | if ( ! rgar( $field, 'value' ) ) |
463 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
463 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
464 | 464 | |
465 | 465 | $output = $this->settings_submit( $field, false ); |
466 | 466 | |
467 | - if( $echo ) { |
|
467 | + if ( $echo ) { |
|
468 | 468 | echo $output; |
469 | 469 | } |
470 | 470 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | parent::single_setting_label( $field ); |
482 | 482 | |
483 | 483 | // Added by GravityView |
484 | - if ( isset( $field['description'] ) ) { |
|
485 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
484 | + if ( isset( $field[ 'description' ] ) ) { |
|
485 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | |
545 | 545 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
546 | 546 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
547 | - if( $local_key !== $response_key ) { |
|
547 | + if ( $local_key !== $response_key ) { |
|
548 | 548 | |
549 | - unset( $posted_settings['license_key_response'] ); |
|
550 | - unset( $posted_settings['license_key_status'] ); |
|
551 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
549 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
550 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
551 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | return $posted_settings; |
@@ -583,25 +583,25 @@ discard block |
||
583 | 583 | 'label' => __( 'License Key', 'gravityview' ), |
584 | 584 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
585 | 585 | 'type' => 'edd_license', |
586 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
587 | - 'default_value' => $default_settings['license_key'], |
|
586 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
587 | + 'default_value' => $default_settings[ 'license_key' ], |
|
588 | 588 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
589 | 589 | ), |
590 | 590 | array( |
591 | 591 | 'name' => 'license_key_response', |
592 | - 'default_value' => $default_settings['license_key_response'], |
|
592 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
593 | 593 | 'type' => 'hidden', |
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'name' => 'license_key_status', |
597 | - 'default_value' => $default_settings['license_key_status'], |
|
597 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
598 | 598 | 'type' => 'hidden', |
599 | 599 | ), |
600 | 600 | array( |
601 | 601 | 'name' => 'support-email', |
602 | 602 | 'type' => 'text', |
603 | 603 | 'validate' => 'email', |
604 | - 'default_value' => $default_settings['support-email'], |
|
604 | + 'default_value' => $default_settings[ 'support-email' ], |
|
605 | 605 | 'label' => __( 'Support Email', 'gravityview' ), |
606 | 606 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
607 | 607 | 'class' => 'code regular-text', |
@@ -613,44 +613,44 @@ discard block |
||
613 | 613 | 'name' => 'support_port', |
614 | 614 | 'type' => 'radio', |
615 | 615 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
616 | - 'default_value' => $default_settings['support_port'], |
|
616 | + 'default_value' => $default_settings[ 'support_port' ], |
|
617 | 617 | 'horizontal' => 1, |
618 | 618 | 'choices' => array( |
619 | 619 | array( |
620 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
620 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
621 | 621 | 'value' => '1', |
622 | 622 | ), |
623 | 623 | array( |
624 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
624 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
625 | 625 | 'value' => '0', |
626 | 626 | ), |
627 | 627 | ), |
628 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
628 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
629 | 629 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
630 | 630 | ), |
631 | 631 | array( |
632 | 632 | 'name' => 'no-conflict-mode', |
633 | 633 | 'type' => 'radio', |
634 | 634 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
635 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
635 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
636 | 636 | 'horizontal' => 1, |
637 | 637 | 'choices' => array( |
638 | 638 | array( |
639 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
639 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
640 | 640 | 'value' => '1', |
641 | 641 | ), |
642 | 642 | array( |
643 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
643 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
644 | 644 | 'value' => '0', |
645 | 645 | ), |
646 | 646 | ), |
647 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
647 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
648 | 648 | ), |
649 | 649 | array( |
650 | 650 | 'name' => 'delete-on-uninstall', |
651 | 651 | 'type' => 'radio', |
652 | 652 | 'label' => __( 'Remove Data on Delete?', 'gravityview' ), |
653 | - 'default_value' => $default_settings['delete-on-uninstall'], |
|
653 | + 'default_value' => $default_settings[ 'delete-on-uninstall' ], |
|
654 | 654 | 'horizontal' => 1, |
655 | 655 | 'choices' => array( |
656 | 656 | array( |
@@ -676,20 +676,20 @@ discard block |
||
676 | 676 | * @since 1.7.4 |
677 | 677 | */ |
678 | 678 | foreach ( $fields as &$field ) { |
679 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
680 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
681 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
682 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
679 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
680 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
681 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
682 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
683 | 683 | |
684 | - if( $disabled_attribute ) { |
|
685 | - $field['disabled'] = $disabled_attribute; |
|
684 | + if ( $disabled_attribute ) { |
|
685 | + $field[ 'disabled' ] = $disabled_attribute; |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | 690 | $sections = array( |
691 | 691 | array( |
692 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
692 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
693 | 693 | 'fields' => $fields, |
694 | 694 | ) |
695 | 695 | ); |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | 'type' => 'save', |
701 | 701 | ); |
702 | 702 | |
703 | - if( $disabled_attribute ) { |
|
704 | - $button['disabled'] = $disabled_attribute; |
|
703 | + if ( $disabled_attribute ) { |
|
704 | + $button[ 'disabled' ] = $disabled_attribute; |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | |
@@ -721,20 +721,20 @@ discard block |
||
721 | 721 | // If there are extensions, add a section for them |
722 | 722 | if ( ! empty( $extension_sections ) ) { |
723 | 723 | |
724 | - if( $disabled_attribute ) { |
|
724 | + if ( $disabled_attribute ) { |
|
725 | 725 | foreach ( $extension_sections as &$section ) { |
726 | - foreach ( $section['fields'] as &$field ) { |
|
727 | - $field['disabled'] = $disabled_attribute; |
|
726 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
727 | + $field[ 'disabled' ] = $disabled_attribute; |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
732 | - $k = count( $extension_sections ) - 1 ; |
|
733 | - $extension_sections[ $k ]['fields'][] = $button; |
|
732 | + $k = count( $extension_sections ) - 1; |
|
733 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
734 | 734 | $sections = array_merge( $sections, $extension_sections ); |
735 | 735 | } else { |
736 | 736 | // add the 'update settings' button to the general section |
737 | - $sections[0]['fields'][] = $button; |
|
737 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | return $sections; |
@@ -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> |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
51 | 51 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
52 | 52 | |
53 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
53 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
54 | 54 | |
55 | 55 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
56 | 56 | |
57 | 57 | //Hooks for no-conflict functionality |
58 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
59 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
58 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
59 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
60 | 60 | |
61 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
62 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
63 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
64 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
61 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
62 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
63 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
64 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | public function backend_actions() { |
75 | 75 | |
76 | 76 | /** @define "GRAVITYVIEW_DIR" "../" */ |
77 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
78 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
80 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
81 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
82 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
83 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
78 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); |
|
80 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
81 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
82 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
83 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
87 | 87 | * |
88 | 88 | * Nice place to insert extensions' backend stuff |
89 | 89 | */ |
90 | - do_action('gravityview_include_backend_actions'); |
|
90 | + do_action( 'gravityview_include_backend_actions' ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | |
104 | 104 | $actions = array(); |
105 | 105 | |
106 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
106 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
108 | 108 | } |
109 | 109 | |
110 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
110 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return array_merge( $actions, $links ); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | function post_updated_messages( $messages, $bulk_counts = NULL ) { |
132 | 132 | global $post; |
133 | 133 | |
134 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
134 | + $post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
135 | 135 | |
136 | 136 | // By default, there will only be one item being modified. |
137 | 137 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
138 | 138 | // of modified items that will override this array. |
139 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
139 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
140 | 140 | |
141 | 141 | |
142 | 142 | // If we're starting fresh, a new form was created. |
@@ -145,60 +145,60 @@ discard block |
||
145 | 145 | |
146 | 146 | $new_form_text = ''; |
147 | 147 | |
148 | - if( !empty( $start_fresh ) ) { |
|
148 | + if ( ! empty( $start_fresh ) ) { |
|
149 | 149 | |
150 | 150 | // Get the form that was created |
151 | 151 | $connected_form = gravityview_get_form_id( $post_id ); |
152 | 152 | |
153 | - if( !empty( $connected_form ) ) { |
|
153 | + if ( ! empty( $connected_form ) ) { |
|
154 | 154 | $form = gravityview_get_form( $connected_form ); |
155 | - $form_name = esc_attr( $form['title'] ); |
|
155 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
156 | 156 | $image = self::get_floaty(); |
157 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
158 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
157 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
158 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
159 | 159 | |
160 | 160 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
161 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
161 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
162 | 162 | $new_form_text = wpautop( $new_form_text ); |
163 | 163 | |
164 | 164 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - $messages['gravityview'] = array( |
|
168 | + $messages[ 'gravityview' ] = array( |
|
169 | 169 | 0 => '', // Unused. Messages start at index 1. |
170 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
171 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
172 | 172 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
173 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
173 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
174 | 174 | 3 => __( 'View deleted.', 'gravityview' ), |
175 | 175 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
176 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
176 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
177 | 177 | /* translators: %s: date and time of the revision */ |
178 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
178 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
179 | 179 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
180 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
180 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
181 | 181 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
182 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
182 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
183 | 183 | 8 => __( 'View submitted.', 'gravityview' ), |
184 | 184 | 9 => sprintf( |
185 | 185 | /* translators: Date and time the View is scheduled to be published */ |
186 | 186 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
187 | 187 | // translators: Publish box date format, see http://php.net/date |
188 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
188 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
189 | 189 | ) . $new_form_text, |
190 | 190 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
191 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
191 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * These apply to `bulk_post_updated_messages` |
195 | 195 | * @file wp-admin/edit.php |
196 | 196 | */ |
197 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
198 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
199 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
200 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
201 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
197 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
198 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
199 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
200 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
201 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
202 | 202 | ); |
203 | 203 | |
204 | 204 | return $messages; |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | function no_conflict_scripts() { |
212 | 212 | global $wp_scripts; |
213 | 213 | |
214 | - if( ! gravityview_is_admin_page() ) { |
|
214 | + if ( ! gravityview_is_admin_page() ) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
218 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
219 | 219 | |
220 | - if( empty( $no_conflict_mode ) ) { |
|
220 | + if ( empty( $no_conflict_mode ) ) { |
|
221 | 221 | return; |
222 | 222 | } |
223 | 223 | |
@@ -267,24 +267,24 @@ discard block |
||
267 | 267 | function no_conflict_styles() { |
268 | 268 | global $wp_styles; |
269 | 269 | |
270 | - if( ! gravityview_is_admin_page() ) { |
|
270 | + if ( ! gravityview_is_admin_page() ) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // Dequeue other jQuery styles even if no-conflict is off. |
275 | 275 | // Terrible-looking tabs help no one. |
276 | - if( !empty( $wp_styles->registered ) ) { |
|
277 | - foreach ($wp_styles->registered as $key => $style) { |
|
278 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
276 | + if ( ! empty( $wp_styles->registered ) ) { |
|
277 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
278 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
279 | 279 | wp_dequeue_style( $key ); |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
284 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
285 | 285 | |
286 | 286 | // If no conflict is off, jQuery will suffice. |
287 | - if( empty( $no_conflict_mode ) ) { |
|
287 | + if ( empty( $no_conflict_mode ) ) { |
|
288 | 288 | return; |
289 | 289 | } |
290 | 290 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | /** |
312 | 312 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
313 | 313 | */ |
314 | - do_action('gravityview_remove_conflicts_after'); |
|
314 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | |
334 | 334 | //reset queue |
335 | 335 | $queue = array(); |
336 | - foreach( $wp_objects->queue as $object ) { |
|
337 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
338 | - $queue[] = $object; |
|
336 | + foreach ( $wp_objects->queue as $object ) { |
|
337 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
338 | + $queue[ ] = $object; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | $wp_objects->queue = $queue; |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | |
345 | 345 | //unregistering scripts |
346 | 346 | $registered = array(); |
347 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
348 | - if( in_array( $handle, $required_objects ) ){ |
|
347 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
348 | + if ( in_array( $handle, $required_objects ) ) { |
|
349 | 349 | $registered[ $handle ] = $script_registration; |
350 | 350 | } |
351 | 351 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @param [type] $registered [description] |
359 | 359 | * @param [type] $scripts [description] |
360 | 360 | */ |
361 | - private function add_script_dependencies($registered, $scripts) { |
|
361 | + private function add_script_dependencies( $registered, $scripts ) { |
|
362 | 362 | |
363 | 363 | //gets all dependent scripts linked to the $scripts array passed |
364 | 364 | do { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
368 | 368 | foreach ( $deps as $dep ) { |
369 | 369 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
370 | - $dependents[] = $dep; |
|
370 | + $dependents[ ] = $dep; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | } |
@@ -431,29 +431,29 @@ discard block |
||
431 | 431 | static function is_admin_page( $hook = '', $page = NULL ) { |
432 | 432 | global $current_screen, $plugin_page, $pagenow, $post; |
433 | 433 | |
434 | - if( ! is_admin() ) { return false; } |
|
434 | + if ( ! is_admin() ) { return false; } |
|
435 | 435 | |
436 | 436 | $is_page = false; |
437 | 437 | |
438 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
438 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
439 | 439 | |
440 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
440 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
441 | 441 | |
442 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
442 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
443 | 443 | |
444 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
445 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
446 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
444 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
445 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
446 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
447 | 447 | } else { |
448 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
448 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
449 | 449 | } |
450 | 450 | |
451 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
451 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
452 | 452 | |
453 | 453 | // $_GET `post_type` variable |
454 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
454 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
455 | 455 | $is_page = 'single'; |
456 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
456 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
457 | 457 | $is_page = 'settings'; |
458 | 458 | } else { |
459 | 459 | $is_page = 'views'; |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
469 | 469 | |
470 | 470 | // If the current page is the same as the compared page |
471 | - if( !empty( $page ) ) { |
|
471 | + if ( ! empty( $page ) ) { |
|
472 | 472 | return $is_page === $page; |
473 | 473 | } |
474 | 474 | |
@@ -489,6 +489,6 @@ discard block |
||
489 | 489 | * |
490 | 490 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
491 | 491 | */ |
492 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
492 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
493 | 493 | return GravityView_Admin::is_admin_page( $hook, $page ); |
494 | 494 | } |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | /** gf_entries page - entries table screen */ |
35 | 35 | |
36 | 36 | // capture bulk actions |
37 | - add_action( 'init', array( $this, 'process_bulk_action') ); |
|
37 | + add_action( 'init', array( $this, 'process_bulk_action' ) ); |
|
38 | 38 | // add hidden field with approve status |
39 | 39 | add_action( 'gform_entries_first_column', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
40 | 40 | // process ajax approve entry requests |
41 | - add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved')); |
|
41 | + add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) ); |
|
42 | 42 | |
43 | 43 | // in case entry is edited (on admin or frontend) |
44 | - add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2); |
|
44 | + add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 ); |
|
45 | 45 | |
46 | 46 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
47 | 47 | |
48 | 48 | // adding styles and scripts |
49 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
49 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
50 | 50 | // bypass Gravity Forms no-conflict mode |
51 | 51 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
52 | 52 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function tooltips( $tooltips ) { |
63 | 63 | |
64 | - $tooltips['form_gravityview_fields'] = array( |
|
65 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
66 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
64 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
65 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
66 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
67 | 67 | ); |
68 | 68 | |
69 | 69 | return $tooltips; |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
181 | - if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST['gforms_update_note'] ) ) { |
|
181 | + if ( 'bulk' === RGForms::post( 'action' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
182 | 182 | |
183 | 183 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
184 | 184 | |
185 | 185 | // The action is formatted like: approve-16 or disapprove-16, where the first word is the name of the action and the second is the ID of the form. Bulk action 2 is the bottom bulk action select form. |
186 | - $bulk_action = ! empty( $_POST['bulk_action'] ) ? $_POST['bulk_action'] : $_POST['bulk_action2']; |
|
186 | + $bulk_action = ! empty( $_POST[ 'bulk_action' ] ) ? $_POST[ 'bulk_action' ] : $_POST[ 'bulk_action2' ]; |
|
187 | 187 | |
188 | 188 | /** |
189 | 189 | * The extra '-' is to make sure that there are at *least* two items in array. |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | // All entries are set to be updated, not just the visible ones |
202 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
202 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
203 | 203 | |
204 | 204 | // Convert the current entry search into GF-formatted search criteria |
205 | 205 | $search = array( |
206 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
207 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
208 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
206 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
207 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
208 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
209 | 209 | ); |
210 | 210 | |
211 | 211 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | } else { |
217 | 217 | |
218 | - $entries = $_POST['lead']; |
|
218 | + $entries = $_POST[ 'lead' ]; |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private static function update_bulk( $entries, $approved, $form_id ) { |
258 | 258 | |
259 | - if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) { |
|
259 | + if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) { |
|
260 | 260 | do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries ); |
261 | 261 | return false; |
262 | 262 | } |
263 | 263 | |
264 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
264 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
265 | 265 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
266 | 266 | return false; |
267 | 267 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // calculate approved field id |
272 | 272 | $approved_column_id = self::get_approved_column( $form_id ); |
273 | 273 | |
274 | - foreach( $entries as $entry_id ) { |
|
274 | + foreach ( $entries as $entry_id ) { |
|
275 | 275 | self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id ); |
276 | 276 | } |
277 | 277 | } |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | * @param int $approvedcolumn (default: 0) |
291 | 291 | * @return boolean True: It worked; False: it failed |
292 | 292 | */ |
293 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
293 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
294 | 294 | |
295 | - if( !class_exists( 'GFAPI' ) ) { |
|
295 | + if ( ! class_exists( 'GFAPI' ) ) { |
|
296 | 296 | do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' ); |
297 | 297 | return false; |
298 | 298 | } |
299 | 299 | |
300 | - if( empty( $approvedcolumn ) ) { |
|
300 | + if ( empty( $approvedcolumn ) ) { |
|
301 | 301 | $approvedcolumn = self::get_approved_column( $form_id ); |
302 | 302 | } |
303 | 303 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | self::update_approved_meta( $entry_id, $approved ); |
317 | 317 | |
318 | 318 | // add note to entry |
319 | - if( $result === true ) { |
|
319 | + if ( $result === true ) { |
|
320 | 320 | |
321 | 321 | $note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' ); |
322 | 322 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | $add_note = apply_filters( 'gravityview/approve_entries/add-note', true ); |
329 | 329 | |
330 | - if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
330 | + if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) { |
|
331 | 331 | $current_user = wp_get_current_user(); |
332 | 332 | GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note ); |
333 | 333 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | do_action( 'gravityview_clear_form_cache', $form_id ); |
341 | 341 | |
342 | - } else if( is_wp_error( $result ) ) { |
|
342 | + } else if ( is_wp_error( $result ) ) { |
|
343 | 343 | |
344 | 344 | do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) ); |
345 | 345 | |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public static function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) { |
363 | 363 | |
364 | - $approvedcolumn = self::get_approved_column( $form['id'] ); |
|
364 | + $approvedcolumn = self::get_approved_column( $form[ 'id' ] ); |
|
365 | 365 | |
366 | 366 | /** |
367 | 367 | * If the form doesn't contain the approve field, don't assume anything. |
368 | 368 | */ |
369 | - if( empty( $approvedcolumn ) ) { |
|
369 | + if ( empty( $approvedcolumn ) ) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | private static function update_approved_meta( $entry_id, $is_approved ) { |
389 | 389 | |
390 | 390 | // update entry meta |
391 | - if( function_exists('gform_update_meta') ) { |
|
391 | + if ( function_exists( 'gform_update_meta' ) ) { |
|
392 | 392 | |
393 | 393 | gform_update_meta( $entry_id, 'is_approved', $is_approved ); |
394 | 394 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | */ |
401 | 401 | do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved ); |
402 | 402 | |
403 | - if( empty( $is_approved ) ) { |
|
403 | + if ( empty( $is_approved ) ) { |
|
404 | 404 | |
405 | 405 | /** |
406 | 406 | * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | } else { |
424 | 424 | |
425 | - do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
425 | + do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' ); |
|
426 | 426 | |
427 | 427 | } |
428 | 428 | } |
@@ -434,21 +434,21 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function ajax_update_approved() { |
436 | 436 | |
437 | - if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) { |
|
437 | + if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) { |
|
438 | 438 | |
439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST ); |
440 | 440 | |
441 | 441 | $result = false; |
442 | 442 | } |
443 | 443 | |
444 | - else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) { |
|
444 | + else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) { |
|
445 | 445 | |
446 | 446 | do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST ); |
447 | 447 | |
448 | 448 | $result = false; |
449 | 449 | } |
450 | 450 | |
451 | - else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) { |
|
451 | + else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) { |
|
452 | 452 | |
453 | 453 | do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' ); |
454 | 454 | |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | |
458 | 458 | else { |
459 | 459 | |
460 | - $result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] ); |
|
460 | + $result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] ); |
|
461 | 461 | |
462 | - if( is_wp_error( $result ) ) { |
|
462 | + if ( is_wp_error( $result ) ) { |
|
463 | 463 | /** @var WP_Error $result */ |
464 | - do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() ); |
|
464 | + do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() ); |
|
465 | 465 | $result = false; |
466 | 466 | } |
467 | 467 | |
@@ -481,29 +481,29 @@ discard block |
||
481 | 481 | */ |
482 | 482 | static public function get_approved_column( $form ) { |
483 | 483 | |
484 | - if( empty( $form ) ) { |
|
484 | + if ( empty( $form ) ) { |
|
485 | 485 | return null; |
486 | 486 | } |
487 | 487 | |
488 | - if( !is_array( $form ) ) { |
|
488 | + if ( ! is_array( $form ) ) { |
|
489 | 489 | $form = GVCommon::get_form( $form ); |
490 | 490 | } |
491 | 491 | |
492 | - foreach( $form['fields'] as $key => $field ) { |
|
492 | + foreach ( $form[ 'fields' ] as $key => $field ) { |
|
493 | 493 | |
494 | - $field = (array) $field; |
|
494 | + $field = (array)$field; |
|
495 | 495 | |
496 | - if( !empty( $field['gravityview_approved'] ) ) { |
|
497 | - if( !empty($field['inputs'][0]['id']) ) { |
|
498 | - return $field['inputs'][0]['id']; |
|
496 | + if ( ! empty( $field[ 'gravityview_approved' ] ) ) { |
|
497 | + if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) { |
|
498 | + return $field[ 'inputs' ][ 0 ][ 'id' ]; |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | 502 | // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work.. |
503 | - if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) { |
|
504 | - foreach ( $field['inputs'] as $key2 => $input ) { |
|
505 | - if ( strtolower( $input['label'] ) == 'approved' ) { |
|
506 | - return $input['id']; |
|
503 | + if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) { |
|
504 | + foreach ( $field[ 'inputs' ] as $key2 => $input ) { |
|
505 | + if ( strtolower( $input[ 'label' ] ) == 'approved' ) { |
|
506 | + return $input[ 'id' ]; |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
@@ -514,18 +514,18 @@ discard block |
||
514 | 514 | |
515 | 515 | |
516 | 516 | |
517 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
517 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
518 | 518 | |
519 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
519 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
520 | 520 | return; |
521 | 521 | } |
522 | 522 | |
523 | - if( empty( $entry['id'] ) ) { |
|
523 | + if ( empty( $entry[ 'id' ] ) ) { |
|
524 | 524 | return; |
525 | 525 | } |
526 | 526 | |
527 | - if( gform_get_meta( $entry['id'], 'is_approved' ) ) { |
|
528 | - echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />'; |
|
527 | + if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) { |
|
528 | + echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />'; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | function add_scripts_and_styles( $hook ) { |
536 | 536 | |
537 | - if( !class_exists( 'RGForms' ) ) { |
|
537 | + if ( ! class_exists( 'RGForms' ) ) { |
|
538 | 538 | |
539 | 539 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' ); |
540 | 540 | |
@@ -543,39 +543,39 @@ discard block |
||
543 | 543 | |
544 | 544 | // enqueue styles & scripts gf_entries |
545 | 545 | // But only if we're on the main Entries page, not on reports pages |
546 | - if( RGForms::get_page() === 'entry_list' ) { |
|
546 | + if ( RGForms::get_page() === 'entry_list' ) { |
|
547 | 547 | |
548 | - $form_id = RGForms::get('id'); |
|
548 | + $form_id = RGForms::get( 'id' ); |
|
549 | 549 | |
550 | 550 | // If there are no forms identified, use the first form. That's how GF does it. |
551 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
551 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
552 | 552 | $forms = gravityview_get_forms(); |
553 | - if( !empty( $forms ) ) { |
|
554 | - $form_id = $forms[0]['id']; |
|
553 | + if ( ! empty( $forms ) ) { |
|
554 | + $form_id = $forms[ 0 ][ 'id' ]; |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | |
558 | 558 | $approvedcolumn = self::get_approved_column( $form_id ); |
559 | 559 | |
560 | - wp_register_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
560 | + wp_register_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
561 | 561 | wp_enqueue_style( 'gravityview_entries_list' ); |
562 | 562 | |
563 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
563 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
564 | 564 | |
565 | - wp_register_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
565 | + wp_register_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
566 | 566 | wp_enqueue_script( 'gravityview_gf_entries_scripts' ); |
567 | 567 | |
568 | 568 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
569 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'), |
|
569 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ), |
|
570 | 570 | 'form_id' => $form_id, |
571 | 571 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
572 | 572 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
573 | 573 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
574 | 574 | 'bulk_message' => $this->bulk_update_message, |
575 | - 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), |
|
576 | - 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), |
|
577 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
578 | - 'column_link' => esc_url( add_query_arg( array('sort' => $approvedcolumn) ) ), |
|
575 | + 'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ), |
|
576 | + 'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ), |
|
577 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
578 | + 'column_link' => esc_url( add_query_arg( array( 'sort' => $approvedcolumn ) ) ), |
|
579 | 579 | ) ); |
580 | 580 | |
581 | 581 | } |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | // Sanitize the values, just to be sure. |
619 | 619 | foreach ( $bulk_actions as $key => $group ) { |
620 | 620 | foreach ( $group as $i => $action ) { |
621 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
622 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
621 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
622 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
@@ -644,13 +644,13 @@ discard block |
||
644 | 644 | * @since 1.7.2 |
645 | 645 | * @param boolean $hide_if_no_connections |
646 | 646 | */ |
647 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
647 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
648 | 648 | |
649 | - if( $hide_if_no_connections ) { |
|
649 | + if ( $hide_if_no_connections ) { |
|
650 | 650 | |
651 | 651 | $connected_views = gravityview_get_connected_views( $form_id ); |
652 | 652 | |
653 | - if( empty( $connected_views ) ) { |
|
653 | + if ( empty( $connected_views ) ) { |
|
654 | 654 | $show_approve_column = false; |
655 | 655 | } |
656 | 656 | } |
@@ -660,18 +660,18 @@ discard block |
||
660 | 660 | * @param boolean $show_approve_column Whether the column will be shown |
661 | 661 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
662 | 662 | */ |
663 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
663 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
664 | 664 | |
665 | 665 | return $show_approve_column; |
666 | 666 | } |
667 | 667 | |
668 | 668 | function register_gform_noconflict_script( $scripts ) { |
669 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
669 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
670 | 670 | return $scripts; |
671 | 671 | } |
672 | 672 | |
673 | 673 | function register_gform_noconflict_style( $styles ) { |
674 | - $styles[] = 'gravityview_entries_list'; |
|
674 | + $styles[ ] = 'gravityview_entries_list'; |
|
675 | 675 | return $styles; |
676 | 676 | } |
677 | 677 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public static function get_instance() { |
87 | 87 | |
88 | - if( empty( self::$instance ) ) { |
|
88 | + if ( empty( self::$instance ) ) { |
|
89 | 89 | self::$instance = new self; |
90 | 90 | } |
91 | 91 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | |
119 | 119 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
120 | 120 | |
121 | - if( $with_values ) { |
|
121 | + if ( $with_values ) { |
|
122 | 122 | $operators_with_values = array(); |
123 | - foreach( $operators as $key ) { |
|
123 | + foreach ( $operators as $key ) { |
|
124 | 124 | $operators_with_values[ $key ] = ''; |
125 | 125 | } |
126 | 126 | return $operators_with_values; |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | */ |
138 | 138 | function set_operation( $operation = '' ) { |
139 | 139 | |
140 | - if( empty( $operation ) ) { |
|
140 | + if ( empty( $operation ) ) { |
|
141 | 141 | return false; |
142 | 142 | } |
143 | 143 | |
144 | 144 | $operators = $this->get_operators( false ); |
145 | 145 | |
146 | - if( !in_array( $operation, $operators ) ) { |
|
147 | - do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation ); |
|
146 | + if ( ! in_array( $operation, $operators ) ) { |
|
147 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation ); |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function setup_operation_and_comparison() { |
166 | 166 | |
167 | - foreach( $this->atts as $key => $value ) { |
|
167 | + foreach ( $this->atts as $key => $value ) { |
|
168 | 168 | |
169 | 169 | $valid = $this->set_operation( $key ); |
170 | 170 | |
171 | - if( $valid ) { |
|
171 | + if ( $valid ) { |
|
172 | 172 | $this->comparison = $value; |
173 | 173 | return true; |
174 | 174 | } |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | $this->parse_atts(); |
199 | 199 | |
200 | 200 | // We need an "if" |
201 | - if( false === $this->if ) { |
|
202 | - do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts ); |
|
201 | + if ( false === $this->if ) { |
|
202 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts ); |
|
203 | 203 | return null; |
204 | 204 | } |
205 | 205 | |
206 | 206 | $setup = $this->setup_operation_and_comparison(); |
207 | 207 | |
208 | 208 | // We need an operation and comparison value |
209 | - if( ! $setup ) { |
|
210 | - do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts ); |
|
209 | + if ( ! $setup ) { |
|
210 | + do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts ); |
|
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | private function get_output() { |
242 | 242 | |
243 | - if( $this->is_match ) { |
|
243 | + if ( $this->is_match ) { |
|
244 | 244 | $output = $this->content; |
245 | 245 | } else { |
246 | 246 | $output = $this->else_content; |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | * @param string $output HTML/text output |
255 | 255 | * @param GVLogic_Shortcode $this This class |
256 | 256 | */ |
257 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
257 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
258 | 258 | |
259 | - do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output ); |
|
259 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output ); |
|
260 | 260 | |
261 | 261 | return $output; |
262 | 262 | } |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | |
273 | 273 | $content = explode( '[else]', $this->passed_content ); |
274 | 274 | |
275 | - $this->content = $content[0]; |
|
275 | + $this->content = $content[ 0 ]; |
|
276 | 276 | |
277 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
277 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
278 | 278 | |
279 | - $this->else_content = isset( $content[1] ) ? $content[1] : $else_attr; |
|
279 | + $this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | $this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts; |
300 | 300 | |
301 | 301 | // Strip whitespace if it's not default false |
302 | - $this->if = is_string( $this->atts['if'] ) ? trim( $this->atts['if'] ) : false; |
|
302 | + $this->if = is_string( $this->atts[ 'if' ] ) ? trim( $this->atts[ 'if' ] ) : false; |
|
303 | 303 | |
304 | 304 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
305 | - unset( $this->atts['if'] ); |
|
305 | + unset( $this->atts[ 'if' ] ); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $results = GFAPI::get_entries( 0, $search_criteria, null, $paging ); |
177 | 177 | |
178 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
178 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
179 | 179 | |
180 | 180 | return $result; |
181 | 181 | } |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | if ( class_exists( 'GFAPI' ) ) { |
194 | 194 | $gf_forms = GFAPI::get_forms(); |
195 | 195 | foreach ( $gf_forms as $form ) { |
196 | - $forms[] = array( |
|
197 | - 'id' => $form['id'], |
|
198 | - 'title' => $form['title'], |
|
196 | + $forms[ ] = array( |
|
197 | + 'id' => $form[ 'id' ], |
|
198 | + 'title' => $form[ 'title' ], |
|
199 | 199 | ); |
200 | 200 | } |
201 | 201 | } |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | if ( $form ) { |
230 | - foreach ( $form['fields'] as $field ) { |
|
231 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
232 | - $fields[ $field['id'] ] = array( |
|
230 | + foreach ( $form[ 'fields' ] as $field ) { |
|
231 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
232 | + $fields[ $field[ 'id' ] ] = array( |
|
233 | 233 | 'label' => rgar( $field, 'label' ), |
234 | 234 | 'parent' => null, |
235 | 235 | 'type' => rgar( $field, 'type' ), |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | ); |
239 | 239 | } |
240 | 240 | |
241 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
242 | - foreach ( $field['inputs'] as $input ) { |
|
241 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
242 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
243 | 243 | /** |
244 | 244 | * @hack |
245 | 245 | * In case of email/email confirmation, the input for email has the same id as the parent field |
246 | 246 | */ |
247 | - if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) { |
|
247 | + if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) { |
|
248 | 248 | continue; |
249 | 249 | } |
250 | - $fields[ (string)$input['id'] ] = array( |
|
250 | + $fields[ (string)$input[ 'id' ] ] = array( |
|
251 | 251 | 'label' => rgar( $input, 'label' ), |
252 | 252 | 'customLabel' => rgar( $input, 'customLabel' ), |
253 | 253 | 'parent' => $field, |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | /** @since 1.14 */ |
262 | - if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) { |
|
262 | + if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) { |
|
263 | 263 | |
264 | - foreach ( (array)$field['choices'] as $key => $input ) { |
|
264 | + foreach ( (array)$field[ 'choices' ] as $key => $input ) { |
|
265 | 265 | |
266 | - $input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key} |
|
266 | + $input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key} |
|
267 | 267 | |
268 | 268 | $fields[ $input_id ] = array( |
269 | 269 | 'label' => rgar( $input, 'text' ), |
@@ -279,25 +279,25 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * @since 1.8 |
281 | 281 | */ |
282 | - if( 'quiz' === $field['type'] ) { |
|
282 | + if ( 'quiz' === $field[ 'type' ] ) { |
|
283 | 283 | $has_quiz_fields = true; |
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
287 | 287 | * @since 1.8 |
288 | 288 | */ |
289 | - if( 'poll' === $field['type'] ) { |
|
289 | + if ( 'poll' === $field[ 'type' ] ) { |
|
290 | 290 | $has_poll_fields = true; |
291 | 291 | } |
292 | 292 | |
293 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
293 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
294 | 294 | $has_product_fields = true; |
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | 298 | * @hack Version 1.9 |
299 | 299 | */ |
300 | - $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field; |
|
300 | + $field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field; |
|
301 | 301 | |
302 | 302 | if ( GFCommon::is_post_field( $field_for_is_post_field ) ) { |
303 | 303 | $has_post_fields = true; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @since 1.7 |
310 | 310 | */ |
311 | 311 | if ( $has_post_fields ) { |
312 | - $fields['post_id'] = array( |
|
312 | + $fields[ 'post_id' ] = array( |
|
313 | 313 | 'label' => __( 'Post ID', 'gravityview' ), |
314 | 314 | 'type' => 'post_id', |
315 | 315 | ); |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
321 | 321 | |
322 | 322 | foreach ( $payment_fields as $payment_field ) { |
323 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
323 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
324 | 324 | continue; |
325 | 325 | } |
326 | - $fields["{$payment_field->name}"] = array( |
|
326 | + $fields[ "{$payment_field->name}" ] = array( |
|
327 | 327 | 'label' => $payment_field->label, |
328 | 328 | 'desc' => $payment_field->description, |
329 | 329 | 'type' => $payment_field->name, |
@@ -334,25 +334,25 @@ discard block |
||
334 | 334 | /** |
335 | 335 | * @since 1.8 |
336 | 336 | */ |
337 | - if( $has_quiz_fields ) { |
|
337 | + if ( $has_quiz_fields ) { |
|
338 | 338 | |
339 | - $fields['gquiz_score'] = array( |
|
339 | + $fields[ 'gquiz_score' ] = array( |
|
340 | 340 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
341 | 341 | 'type' => 'quiz_score', |
342 | 342 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
343 | 343 | ); |
344 | - $fields['gquiz_percent'] = array( |
|
344 | + $fields[ 'gquiz_percent' ] = array( |
|
345 | 345 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
346 | 346 | 'type' => 'quiz_percent', |
347 | 347 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
348 | 348 | ); |
349 | - $fields['gquiz_grade'] = array( |
|
349 | + $fields[ 'gquiz_grade' ] = array( |
|
350 | 350 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
351 | 351 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
352 | 352 | 'type' => 'quiz_grade', |
353 | 353 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
354 | 354 | ); |
355 | - $fields['gquiz_is_pass'] = array( |
|
355 | + $fields[ 'gquiz_is_pass' ] = array( |
|
356 | 356 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
357 | 357 | 'type' => 'quiz_is_pass', |
358 | 358 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -374,9 +374,9 @@ discard block |
||
374 | 374 | |
375 | 375 | $fields = array(); |
376 | 376 | |
377 | - foreach ( $extra_fields as $key => $field ){ |
|
378 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
379 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
377 | + foreach ( $extra_fields as $key => $field ) { |
|
378 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
379 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
@@ -416,32 +416,32 @@ discard block |
||
416 | 416 | 'search_criteria' => null, |
417 | 417 | 'sorting' => null, |
418 | 418 | 'paging' => null, |
419 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
419 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
420 | 420 | ); |
421 | 421 | |
422 | 422 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
423 | 423 | |
424 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
425 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
424 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
425 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
426 | 426 | |
427 | 427 | if ( ! is_array( $filter ) ) { |
428 | 428 | continue; |
429 | 429 | } |
430 | 430 | |
431 | 431 | // By default, we want searches to be wildcard for each field. |
432 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
432 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
433 | 433 | |
434 | 434 | /** |
435 | 435 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
436 | 436 | * @param string $operator Existing search operator |
437 | 437 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
438 | 438 | */ |
439 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
439 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // don't send just the [mode] without any field filter. |
443 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
444 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
443 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
444 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | } |
@@ -452,21 +452,21 @@ discard block |
||
452 | 452 | * Prepare date formats to be in Gravity Forms DB format; |
453 | 453 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
454 | 454 | */ |
455 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
455 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
456 | 456 | |
457 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
457 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
458 | 458 | |
459 | 459 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
460 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
460 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
461 | 461 | |
462 | 462 | if ( $date ) { |
463 | 463 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
464 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
464 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
465 | 465 | } else { |
466 | 466 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
467 | - unset( $criteria['search_criteria'][ $key ] ); |
|
467 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
468 | 468 | |
469 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
469 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | } |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | |
475 | 475 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
476 | 476 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
477 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
477 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
478 | 478 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
479 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null; |
|
480 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
479 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null; |
|
480 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
481 | 481 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
482 | - $criteria['context_view_id'] = null; |
|
482 | + $criteria[ 'context_view_id' ] = null; |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param array $form_ids Forms to search |
489 | 489 | * @param int $view_id ID of the view being used to search |
490 | 490 | */ |
491 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
491 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
492 | 492 | |
493 | 493 | return (array)$criteria; |
494 | 494 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | /** Reduce # of database calls */ |
520 | 520 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
521 | 521 | |
522 | - if ( ! empty( $criteria['cache'] ) ) { |
|
522 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
523 | 523 | |
524 | 524 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
525 | 525 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | // Still update the total count when using cached results |
529 | 529 | if ( ! is_null( $total ) ) { |
530 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
530 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | $return = $entries; |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
548 | 548 | |
549 | 549 | // No entries returned from gravityview_before_get_entries |
550 | - if( is_null( $entries ) ) { |
|
550 | + if ( is_null( $entries ) ) { |
|
551 | 551 | |
552 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
552 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
553 | 553 | |
554 | 554 | if ( is_wp_error( $entries ) ) { |
555 | 555 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
561 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
562 | 562 | |
563 | 563 | // Cache results |
564 | 564 | $Cache->set( $entries, 'entries' ); |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | */ |
646 | 646 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
647 | 647 | |
648 | - if( $check_entry_display ) { |
|
648 | + if ( $check_entry_display ) { |
|
649 | 649 | // Is the entry allowed |
650 | 650 | $entry = self::check_entry_display( $entry ); |
651 | 651 | } |
@@ -678,12 +678,12 @@ discard block |
||
678 | 678 | |
679 | 679 | $value = false; |
680 | 680 | |
681 | - if( 'context' === $val1 ) { |
|
681 | + if ( 'context' === $val1 ) { |
|
682 | 682 | |
683 | 683 | $matching_contexts = array( $val2 ); |
684 | 684 | |
685 | 685 | // We allow for non-standard contexts. |
686 | - switch( $val2 ) { |
|
686 | + switch ( $val2 ) { |
|
687 | 687 | // Check for either single or edit |
688 | 688 | case 'singular': |
689 | 689 | $matching_contexts = array( 'single', 'edit' ); |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | return false; |
744 | 744 | } |
745 | 745 | |
746 | - if ( empty( $entry['form_id'] ) ) { |
|
746 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
747 | 747 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
748 | 748 | return false; |
749 | 749 | } |
@@ -751,26 +751,26 @@ discard block |
||
751 | 751 | $criteria = self::calculate_get_entries_criteria(); |
752 | 752 | |
753 | 753 | // Make sure the current View is connected to the same form as the Entry |
754 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
755 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
754 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
755 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
756 | 756 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
757 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
758 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
757 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
758 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
759 | 759 | return false; |
760 | 760 | } |
761 | 761 | } |
762 | 762 | |
763 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
763 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
764 | 764 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
765 | 765 | return $entry; |
766 | 766 | } |
767 | 767 | |
768 | - $search_criteria = $criteria['search_criteria']; |
|
768 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
769 | 769 | unset( $criteria ); |
770 | 770 | |
771 | 771 | // check entry status |
772 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
773 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
772 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
773 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
774 | 774 | return false; |
775 | 775 | } |
776 | 776 | |
@@ -778,37 +778,37 @@ discard block |
||
778 | 778 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
779 | 779 | |
780 | 780 | // field_filters |
781 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
781 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
782 | 782 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
783 | 783 | return $entry; |
784 | 784 | } |
785 | 785 | |
786 | - $filters = $search_criteria['field_filters']; |
|
786 | + $filters = $search_criteria[ 'field_filters' ]; |
|
787 | 787 | unset( $search_criteria ); |
788 | 788 | |
789 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
790 | - unset( $filters['mode'] ); |
|
789 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
790 | + unset( $filters[ 'mode' ] ); |
|
791 | 791 | |
792 | - $form = self::get_form( $entry['form_id'] ); |
|
792 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
793 | 793 | |
794 | 794 | foreach ( $filters as $filter ) { |
795 | 795 | |
796 | - if ( ! isset( $filter['key'] ) ) { |
|
796 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
797 | 797 | continue; |
798 | 798 | } |
799 | 799 | |
800 | - $k = $filter['key']; |
|
800 | + $k = $filter[ 'key' ]; |
|
801 | 801 | |
802 | 802 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
803 | 803 | $field_value = $entry[ $k ]; |
804 | 804 | $field = null; |
805 | 805 | } else { |
806 | 806 | $field = self::get_field( $form, $k ); |
807 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
807 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
808 | 808 | } |
809 | 809 | |
810 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
811 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
810 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
811 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
812 | 812 | |
813 | 813 | // verify if we are already free to go! |
814 | 814 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | * Gravity Forms code to adjust date to locally-configured Time Zone |
867 | 867 | * @see GFCommon::format_date() for original code |
868 | 868 | */ |
869 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
869 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
870 | 870 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
871 | 871 | |
872 | - $format = rgar( $atts, 'format' ); |
|
873 | - $is_human = ! empty( $atts['human'] ); |
|
874 | - $is_diff = ! empty( $atts['diff'] ); |
|
875 | - $is_raw = ! empty( $atts['raw'] ); |
|
876 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
877 | - $include_time = ! empty( $atts['time'] ); |
|
872 | + $format = rgar( $atts, 'format' ); |
|
873 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
874 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
875 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
876 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
877 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
878 | 878 | |
879 | 879 | // If we're using time diff, we want to have a different default format |
880 | - if( empty( $format ) ) { |
|
880 | + if ( empty( $format ) ) { |
|
881 | 881 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
882 | 882 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
883 | 883 | } |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | // If raw was specified, don't modify the stored value |
886 | 886 | if ( $is_raw ) { |
887 | 887 | $formatted_date = $date_string; |
888 | - } elseif( $is_timestamp ) { |
|
888 | + } elseif ( $is_timestamp ) { |
|
889 | 889 | $formatted_date = $date_local_timestamp; |
890 | 890 | } elseif ( $is_diff ) { |
891 | 891 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | } |
914 | 914 | |
915 | 915 | $field = self::get_field( $form, $field_id ); |
916 | - return isset( $field['label'] ) ? $field['label'] : ''; |
|
916 | + return isset( $field[ 'label' ] ) ? $field[ 'label' ] : ''; |
|
917 | 917 | |
918 | 918 | } |
919 | 919 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist |
932 | 932 | */ |
933 | 933 | public static function get_field( $form, $field_id ) { |
934 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
934 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
935 | 935 | return GFFormsModel::get_field( $form, $field_id ); |
936 | 936 | } else { |
937 | 937 | return null; |
@@ -978,19 +978,19 @@ discard block |
||
978 | 978 | $shortcodes = array(); |
979 | 979 | |
980 | 980 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
981 | - if ( empty( $matches ) ){ |
|
981 | + if ( empty( $matches ) ) { |
|
982 | 982 | return false; |
983 | 983 | } |
984 | 984 | |
985 | 985 | foreach ( $matches as $shortcode ) { |
986 | - if ( $tag === $shortcode[2] ) { |
|
986 | + if ( $tag === $shortcode[ 2 ] ) { |
|
987 | 987 | |
988 | 988 | // Changed this to $shortcode instead of true so we get the parsed atts. |
989 | - $shortcodes[] = $shortcode; |
|
989 | + $shortcodes[ ] = $shortcode; |
|
990 | 990 | |
991 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
992 | - foreach( $results as $result ) { |
|
993 | - $shortcodes[] = $result; |
|
991 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
992 | + foreach ( $results as $result ) { |
|
993 | + $shortcodes[ ] = $result; |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | } |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | * @return string html |
1142 | 1142 | */ |
1143 | 1143 | public static function get_sortable_fields( $formid, $current = '' ) { |
1144 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1144 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1145 | 1145 | |
1146 | 1146 | if ( empty( $formid ) ) { |
1147 | 1147 | return $output; |
@@ -1154,11 +1154,11 @@ discard block |
||
1154 | 1154 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1155 | 1155 | |
1156 | 1156 | foreach ( $fields as $id => $field ) { |
1157 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1157 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1158 | 1158 | continue; |
1159 | 1159 | } |
1160 | 1160 | |
1161 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1161 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1162 | 1162 | } |
1163 | 1163 | } |
1164 | 1164 | |
@@ -1193,9 +1193,9 @@ discard block |
||
1193 | 1193 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1194 | 1194 | |
1195 | 1195 | // TODO: Convert to using array_filter |
1196 | - foreach( $fields as $id => $field ) { |
|
1196 | + foreach ( $fields as $id => $field ) { |
|
1197 | 1197 | |
1198 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1198 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1199 | 1199 | unset( $fields[ $id ] ); |
1200 | 1200 | } |
1201 | 1201 | } |
@@ -1236,14 +1236,14 @@ discard block |
||
1236 | 1236 | * @param int|array $field field key or field array |
1237 | 1237 | * @return boolean |
1238 | 1238 | */ |
1239 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1239 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1240 | 1240 | |
1241 | 1241 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1242 | 1242 | $form = self::get_form( $form ); |
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | // If entry meta, it's a string. Otherwise, numeric |
1246 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1246 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1247 | 1247 | $type = $field; |
1248 | 1248 | } else { |
1249 | 1249 | $type = self::get_field_type( $form, $field ); |
@@ -1257,9 +1257,9 @@ discard block |
||
1257 | 1257 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1258 | 1258 | |
1259 | 1259 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1260 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1261 | - if( true === $gv_field->is_numeric ) { |
|
1262 | - $numeric_types[] = $gv_field->is_numeric; |
|
1260 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1261 | + if ( true === $gv_field->is_numeric ) { |
|
1262 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1263 | 1263 | } |
1264 | 1264 | } |
1265 | 1265 | |
@@ -1409,11 +1409,11 @@ discard block |
||
1409 | 1409 | $final_atts = array_filter( $final_atts ); |
1410 | 1410 | |
1411 | 1411 | // If the href wasn't passed as an attribute, use the value passed to the function |
1412 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1413 | - $final_atts['href'] = $href; |
|
1412 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1413 | + $final_atts[ 'href' ] = $href; |
|
1414 | 1414 | } |
1415 | 1415 | |
1416 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1416 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1417 | 1417 | |
1418 | 1418 | // Sort the attributes alphabetically, to help testing |
1419 | 1419 | ksort( $final_atts ); |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1425 | 1425 | } |
1426 | 1426 | |
1427 | - if( '' !== $output ) { |
|
1427 | + if ( '' !== $output ) { |
|
1428 | 1428 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1429 | 1429 | } |
1430 | 1430 | |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) { |
1449 | 1449 | $merged = $array1; |
1450 | 1450 | |
1451 | - foreach ( $array2 as $key => &$value ) { |
|
1451 | + foreach ( $array2 as $key => &$value ) { |
|
1452 | 1452 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1453 | 1453 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1454 | 1454 | } else { |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1484 | 1484 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1485 | 1485 | */ |
1486 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1486 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1487 | 1487 | |
1488 | 1488 | return get_users( $get_users_settings ); |
1489 | 1489 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | * @return string |
1499 | 1499 | */ |
1500 | 1500 | public static function generate_notice( $notice, $class = '' ) { |
1501 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1501 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 |
@@ -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 |