@@ -47,7 +47,7 @@ |
||
47 | 47 | function edit_entry_fix_hidden_fields( $fields ) { |
48 | 48 | |
49 | 49 | /** @var GF_Field $field */ |
50 | - foreach( $fields as &$field ) { |
|
50 | + foreach ( $fields as &$field ) { |
|
51 | 51 | if ( 'hidden' === $field->type ) { |
52 | 52 | |
53 | 53 | // Replace GF_Field_Hidden with GF_Field_Text, copying all the data from $field |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @since 1.5.1 |
12 | 12 | */ |
13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
13 | + add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 ); |
|
14 | 14 | |
15 | 15 | // ONLY ADMIN FROM HERE ON. |
16 | - if( !is_admin() ) { return; } |
|
16 | + if ( ! is_admin() ) { return; } |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
20 | 20 | * @since 1.7.4 |
21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
22 | 22 | */ |
23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
23 | + if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * Use `init` to fix bbPress warning |
29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
30 | 30 | */ |
31 | - add_action('init', array( $this, 'load'), 100 ); |
|
31 | + add_action( 'init', array( $this, 'load' ), 100 ); |
|
32 | 32 | |
33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
33 | + add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) ); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
57 | 57 | |
58 | 58 | // If filter returns false, do not process |
59 | - if( empty( $assign_to_lead ) ) { |
|
59 | + if ( empty( $assign_to_lead ) ) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
64 | + $result = RGFormsModel::update_lead_property( $entry[ 'id' ], 'created_by', $user_id, false, true ); |
|
65 | 65 | |
66 | - if( empty( $result ) ) { |
|
67 | - $status = __('Error', 'gravityview'); |
|
66 | + if ( empty( $result ) ) { |
|
67 | + $status = __( 'Error', 'gravityview' ); |
|
68 | 68 | } else { |
69 | - $status = __('Success', 'gravityview'); |
|
69 | + $status = __( 'Success', 'gravityview' ); |
|
70 | 70 | } |
71 | 71 | |
72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
72 | + $note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id ); |
|
73 | 73 | |
74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - ' . $note ); |
|
75 | 75 | |
76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
76 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | // Plugin that was provided here: |
87 | 87 | // @link https://gravityview.co/support/documentation/201991205/ |
88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
88 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
89 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
90 | 90 | |
91 | 91 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
92 | + if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
93 | 93 | |
94 | 94 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
95 | 95 | |
96 | 96 | // Now, no validation is required in the methods; let's hook in. |
97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
97 | + remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
98 | 98 | |
99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 ); |
|
99 | + remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 ); |
|
100 | 100 | |
101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
101 | + remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
@@ -110,26 +110,26 @@ discard block |
||
110 | 110 | function load() { |
111 | 111 | |
112 | 112 | // Does GF exist? |
113 | - if( !class_exists('GFCommon') ) { |
|
113 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Can the user edit entries? |
118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
118 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // If screen mode isn't set, then we're in the wrong place. |
123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
123 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Now, no validation is required in the methods; let's hook in. |
128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
128 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
129 | 129 | |
130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
130 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
131 | 131 | |
132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
132 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | function set_screen_mode() { |
141 | 141 | |
142 | 142 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
143 | - if( rgget('screen_mode') === 'edit' ) { |
|
144 | - $_POST["screen_mode"] = 'edit'; |
|
143 | + if ( rgget( 'screen_mode' ) === 'edit' ) { |
|
144 | + $_POST[ "screen_mode" ] = 'edit'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -152,42 +152,42 @@ discard block |
||
152 | 152 | * @param int $entry_id Entry ID |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - function update_entry_creator($form, $entry_id) { |
|
155 | + function update_entry_creator( $form, $entry_id ) { |
|
156 | 156 | global $current_user; |
157 | 157 | |
158 | 158 | // Update the entry |
159 | - $created_by = absint( rgpost('created_by') ); |
|
159 | + $created_by = absint( rgpost( 'created_by' ) ); |
|
160 | 160 | |
161 | 161 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
162 | 162 | |
163 | 163 | // If the creator has changed, let's add a note about who it used to be. |
164 | - $originally_created_by = rgpost('originally_created_by'); |
|
164 | + $originally_created_by = rgpost( 'originally_created_by' ); |
|
165 | 165 | |
166 | 166 | // If there's no owner and there didn't used to be, keep going |
167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
167 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | 171 | // If the values have changed |
172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
172 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
173 | 173 | |
174 | - $user_data = get_userdata($current_user->ID); |
|
174 | + $user_data = get_userdata( $current_user->ID ); |
|
175 | 175 | |
176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
176 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
177 | 177 | |
178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' ); |
|
179 | 179 | |
180 | - if( !empty( $originally_created_by ) ) { |
|
181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
180 | + if ( ! empty( $originally_created_by ) ) { |
|
181 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
182 | 182 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
183 | 183 | } |
184 | 184 | |
185 | - if( !empty( $created_by ) ) { |
|
186 | - $created_by_user_data = get_userdata($created_by); |
|
185 | + if ( ! empty( $created_by ) ) { |
|
186 | + $created_by_user_data = get_userdata( $created_by ); |
|
187 | 187 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
188 | 188 | } |
189 | 189 | |
190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | } |
@@ -198,24 +198,24 @@ discard block |
||
198 | 198 | * @param array $entry GF entry array |
199 | 199 | * @return void |
200 | 200 | */ |
201 | - function add_select($form_id, $entry ) { |
|
201 | + function add_select( $form_id, $entry ) { |
|
202 | 202 | |
203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
203 | + if ( rgpost( 'screen_mode' ) !== 'edit' ) { |
|
204 | 204 | return; |
205 | 205 | } |
206 | 206 | |
207 | 207 | $users = GVCommon::get_users( 'change_entry_creator' ); |
208 | 208 | |
209 | 209 | $output = '<label for="change_created_by">'; |
210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
210 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
211 | 211 | $output .= '</label> |
212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | - foreach($users as $user) { |
|
215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
213 | + $output .= '<option value=""> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
214 | + foreach ( $users as $user ) { |
|
215 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
216 | 216 | } |
217 | 217 | $output .= '</select>'; |
218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
218 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
219 | 219 | echo $output; |
220 | 220 | |
221 | 221 | } |
@@ -59,8 +59,8 @@ |
||
59 | 59 | |
60 | 60 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
61 | 61 | |
62 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
63 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
62 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
63 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
64 | 64 | |
65 | 65 | $sql = $wpdb->prepare( " |
66 | 66 | DELETE FROM $notes_table |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if( ! class_exists('GFAddOn') ) { |
|
3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
4 | 4 | return; |
5 | 5 | } |
6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
77 | 77 | |
78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
79 | 79 | return parent::__construct(); |
80 | 80 | } |
81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public static function get_instance() { |
89 | 89 | |
90 | - if( empty( self::$instance ) ) { |
|
90 | + if ( empty( self::$instance ) ) { |
|
91 | 91 | self::$instance = new self( 'get_instance' ); |
92 | 92 | } |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function current_user_can_any( $caps ) { |
108 | 108 | |
109 | - if( empty( $caps ) ) { |
|
109 | + if ( empty( $caps ) ) { |
|
110 | 110 | $caps = array( 'gravityview_full_access' ); |
111 | 111 | } |
112 | 112 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ), |
161 | 161 | 'found-other' => array( |
162 | 162 | 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
163 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
163 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
164 | 164 | ), |
165 | 165 | 'other' => array( |
166 | 166 | 'label' => esc_html__( 'Other', 'gravityview' ), |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | }); |
248 | 248 | |
249 | 249 | function gv_feedback_append_error_message() { |
250 | - $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
250 | + $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
251 | 251 | } |
252 | 252 | }); |
253 | 253 | </script> |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | </ul> |
265 | 265 | <div class="gv-followup widefat"> |
266 | 266 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
267 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
267 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
268 | 268 | </div> |
269 | 269 | <div class="scale-description"> |
270 | - <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
270 | + <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
271 | 271 | <ul class="inline"> |
272 | 272 | <?php |
273 | 273 | $i = 0; |
274 | - while( $i < 11 ) { |
|
275 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
274 | + while ( $i < 11 ) { |
|
275 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
276 | 276 | $i++; |
277 | 277 | } |
278 | 278 | ?> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | </div> |
282 | 282 | |
283 | 283 | <div class="gv-form-field-wrapper"> |
284 | - <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label> |
|
284 | + <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label> |
|
285 | 285 | </div> |
286 | 286 | |
287 | 287 | <div class="submit"> |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;"> |
296 | 296 | <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3> |
297 | 297 | <p><?php echo gravityview_get_floaty(); ?> |
298 | - <?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
298 | + <?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
299 | 299 | </p> |
300 | 300 | <div class="wp-clearfix"></div> |
301 | 301 | </div> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
370 | 370 | |
371 | 371 | /** @since 1.7.6 */ |
372 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
372 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
373 | 373 | |
374 | 374 | parent::init_admin(); |
375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public function modify_app_settings_menu_title( $setting_tabs ) { |
385 | 385 | |
386 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
386 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
387 | 387 | |
388 | 388 | return $setting_tabs; |
389 | 389 | } |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | */ |
401 | 401 | private function _load_license_handler() { |
402 | 402 | |
403 | - if( !empty( $this->License_Handler ) ) { |
|
403 | + if ( ! empty( $this->License_Handler ) ) { |
|
404 | 404 | return; |
405 | 405 | } |
406 | 406 | |
407 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
407 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
408 | 408 | |
409 | 409 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
410 | 410 | } |
@@ -416,42 +416,42 @@ discard block |
||
416 | 416 | function license_key_notice() { |
417 | 417 | |
418 | 418 | // Only show on GravityView pages |
419 | - if( ! gravityview_is_admin_page() ) { |
|
419 | + if ( ! gravityview_is_admin_page() ) { |
|
420 | 420 | return; |
421 | 421 | } |
422 | 422 | |
423 | - $license_status = self::getSetting('license_key_status'); |
|
424 | - $license_key = self::getSetting('license_key'); |
|
425 | - if( '' === $license_key ) { |
|
423 | + $license_status = self::getSetting( 'license_key_status' ); |
|
424 | + $license_key = self::getSetting( 'license_key' ); |
|
425 | + if ( '' === $license_key ) { |
|
426 | 426 | $license_status = 'inactive'; |
427 | 427 | } |
428 | 428 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
429 | 429 | |
430 | - $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'); |
|
430 | + $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' ); |
|
431 | 431 | |
432 | 432 | /** |
433 | 433 | * I wanted to remove the period from after the buttons in the string, |
434 | 434 | * but didn't want to mess up the translation strings for the translators. |
435 | 435 | */ |
436 | 436 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
437 | - $title = __('Inactive License', 'gravityview'); |
|
437 | + $title = __( 'Inactive License', 'gravityview' ); |
|
438 | 438 | $status = ''; |
439 | 439 | $update_below = false; |
440 | 440 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
441 | 441 | switch ( $license_status ) { |
442 | 442 | /** @since 1.17 */ |
443 | 443 | case 'expired': |
444 | - $title = __('Expired License', 'gravityview'); |
|
444 | + $title = __( 'Expired License', 'gravityview' ); |
|
445 | 445 | $status = 'expired'; |
446 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
446 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
447 | 447 | break; |
448 | 448 | case 'invalid': |
449 | - $title = __('Invalid License', 'gravityview'); |
|
450 | - $status = __('is invalid', 'gravityview'); |
|
449 | + $title = __( 'Invalid License', 'gravityview' ); |
|
450 | + $status = __( 'is invalid', 'gravityview' ); |
|
451 | 451 | break; |
452 | 452 | case 'deactivated': |
453 | - $status = __('is inactive', 'gravityview'); |
|
454 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
453 | + $status = __( 'is inactive', 'gravityview' ); |
|
454 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
455 | 455 | break; |
456 | 456 | /** @noinspection PhpMissingBreakStatementInspection */ |
457 | 457 | case '': |
@@ -459,27 +459,27 @@ discard block |
||
459 | 459 | // break intentionally left blank |
460 | 460 | case 'inactive': |
461 | 461 | case 'site_inactive': |
462 | - $status = __('has not been activated', 'gravityview'); |
|
463 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
462 | + $status = __( 'has not been activated', 'gravityview' ); |
|
463 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
464 | 464 | break; |
465 | 465 | } |
466 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
466 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
467 | 467 | |
468 | 468 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
469 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
469 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
470 | 470 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
471 | 471 | } else { |
472 | 472 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
473 | 473 | } |
474 | 474 | |
475 | - if( !empty( $status ) ) { |
|
475 | + if ( ! empty( $status ) ) { |
|
476 | 476 | GravityView_Admin_Notices::add_notice( array( |
477 | 477 | 'message' => $message, |
478 | 478 | 'class' => 'updated', |
479 | 479 | 'title' => $title, |
480 | 480 | 'cap' => 'gravityview_edit_settings', |
481 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
482 | - )); |
|
481 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
482 | + ) ); |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | |
492 | 492 | $styles = parent::styles(); |
493 | 493 | |
494 | - $styles[] = array( |
|
494 | + $styles[ ] = array( |
|
495 | 495 | 'handle' => 'gravityview_settings', |
496 | 496 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
497 | 497 | 'version' => GravityView_Plugin::version, |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @return void |
515 | 515 | */ |
516 | 516 | public function add_network_menu() { |
517 | - if( GravityView_Plugin::is_network_activated() ) { |
|
517 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
518 | 518 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
519 | 519 | } |
520 | 520 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | * If multisite and not network admin, we don't want the settings to show. |
532 | 532 | * @since 1.7.6 |
533 | 533 | */ |
534 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
534 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
535 | 535 | |
536 | 536 | /** |
537 | 537 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | */ |
541 | 541 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
542 | 542 | |
543 | - if( $show_submenu ) { |
|
543 | + if ( $show_submenu ) { |
|
544 | 544 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
545 | 545 | } |
546 | 546 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * Backward compatibility with Redux |
581 | 581 | */ |
582 | - if( $setting_name === 'license' ) { |
|
582 | + if ( $setting_name === 'license' ) { |
|
583 | 583 | return array( |
584 | 584 | 'license' => parent::get_app_setting( 'license_key' ), |
585 | 585 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | |
644 | 644 | $return = $text . $activation; |
645 | 645 | |
646 | - if( $echo ) { |
|
646 | + if ( $echo ) { |
|
647 | 647 | echo $return; |
648 | 648 | } |
649 | 649 | |
@@ -670,15 +670,15 @@ discard block |
||
670 | 670 | */ |
671 | 671 | public function settings_submit( $field, $echo = true ) { |
672 | 672 | |
673 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
673 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
674 | 674 | |
675 | 675 | $attributes = $this->get_field_attributes( $field ); |
676 | 676 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
677 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
677 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
678 | 678 | |
679 | 679 | |
680 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
681 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
680 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
681 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
682 | 682 | |
683 | 683 | if ( empty( $value ) ) { |
684 | 684 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $attributes = $this->get_field_attributes( $field ); |
688 | 688 | |
689 | 689 | $html = '<input |
690 | - type="' . $field['type'] . '" |
|
690 | + type="' . $field[ 'type' ] . '" |
|
691 | 691 | name="' . esc_attr( $name ) . '" |
692 | 692 | value="' . $value . '" ' . |
693 | 693 | implode( ' ', $attributes ) . |
@@ -709,12 +709,12 @@ discard block |
||
709 | 709 | * @return string |
710 | 710 | */ |
711 | 711 | public function settings_save( $field, $echo = true ) { |
712 | - $field['type'] = 'submit'; |
|
713 | - $field['name'] = 'gform-settings-save'; |
|
714 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
712 | + $field[ 'type' ] = 'submit'; |
|
713 | + $field[ 'name' ] = 'gform-settings-save'; |
|
714 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
715 | 715 | |
716 | 716 | if ( ! rgar( $field, 'value' ) ) { |
717 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
717 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | $output = $this->settings_submit( $field, false ); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $this->app_settings_uninstall_tab(); |
724 | 724 | $output .= ob_get_clean(); |
725 | 725 | |
726 | - if( $echo ) { |
|
726 | + if ( $echo ) { |
|
727 | 727 | echo $output; |
728 | 728 | } |
729 | 729 | |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | parent::single_setting_label( $field ); |
742 | 742 | |
743 | 743 | // Added by GravityView |
744 | - if ( isset( $field['description'] ) ) { |
|
745 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
744 | + if ( isset( $field[ 'description' ] ) ) { |
|
745 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | } |
@@ -804,11 +804,11 @@ discard block |
||
804 | 804 | |
805 | 805 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
806 | 806 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
807 | - if( $local_key !== $response_key ) { |
|
807 | + if ( $local_key !== $response_key ) { |
|
808 | 808 | |
809 | - unset( $posted_settings['license_key_response'] ); |
|
810 | - unset( $posted_settings['license_key_status'] ); |
|
811 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
809 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
810 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
811 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | return $posted_settings; |
@@ -843,25 +843,25 @@ discard block |
||
843 | 843 | 'label' => __( 'License Key', 'gravityview' ), |
844 | 844 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
845 | 845 | 'type' => 'edd_license', |
846 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
847 | - 'default_value' => $default_settings['license_key'], |
|
846 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
847 | + 'default_value' => $default_settings[ 'license_key' ], |
|
848 | 848 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
849 | 849 | ), |
850 | 850 | array( |
851 | 851 | 'name' => 'license_key_response', |
852 | - 'default_value' => $default_settings['license_key_response'], |
|
852 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
853 | 853 | 'type' => 'hidden', |
854 | 854 | ), |
855 | 855 | array( |
856 | 856 | 'name' => 'license_key_status', |
857 | - 'default_value' => $default_settings['license_key_status'], |
|
857 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
858 | 858 | 'type' => 'hidden', |
859 | 859 | ), |
860 | 860 | array( |
861 | 861 | 'name' => 'support-email', |
862 | 862 | 'type' => 'text', |
863 | 863 | 'validate' => 'email', |
864 | - 'default_value' => $default_settings['support-email'], |
|
864 | + 'default_value' => $default_settings[ 'support-email' ], |
|
865 | 865 | 'label' => __( 'Support Email', 'gravityview' ), |
866 | 866 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
867 | 867 | 'class' => 'code regular-text', |
@@ -873,38 +873,38 @@ discard block |
||
873 | 873 | 'name' => 'support_port', |
874 | 874 | 'type' => 'radio', |
875 | 875 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
876 | - 'default_value' => $default_settings['support_port'], |
|
876 | + 'default_value' => $default_settings[ 'support_port' ], |
|
877 | 877 | 'horizontal' => 1, |
878 | 878 | 'choices' => array( |
879 | 879 | array( |
880 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
880 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
881 | 881 | 'value' => '1', |
882 | 882 | ), |
883 | 883 | array( |
884 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
884 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
885 | 885 | 'value' => '0', |
886 | 886 | ), |
887 | 887 | ), |
888 | - '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>', |
|
888 | + '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>', |
|
889 | 889 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
890 | 890 | ), |
891 | 891 | array( |
892 | 892 | 'name' => 'no-conflict-mode', |
893 | 893 | 'type' => 'radio', |
894 | 894 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
895 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
895 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
896 | 896 | 'horizontal' => 1, |
897 | 897 | 'choices' => array( |
898 | 898 | array( |
899 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
899 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
900 | 900 | 'value' => '1', |
901 | 901 | ), |
902 | 902 | array( |
903 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
903 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
904 | 904 | 'value' => '0', |
905 | 905 | ), |
906 | 906 | ), |
907 | - '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'), |
|
907 | + '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' ), |
|
908 | 908 | ), |
909 | 909 | ) ); |
910 | 910 | |
@@ -915,20 +915,20 @@ discard block |
||
915 | 915 | * @since 1.7.4 |
916 | 916 | */ |
917 | 917 | foreach ( $fields as &$field ) { |
918 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
919 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
920 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
921 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
918 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
919 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
920 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
921 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
922 | 922 | |
923 | - if( $disabled_attribute ) { |
|
924 | - $field['disabled'] = $disabled_attribute; |
|
923 | + if ( $disabled_attribute ) { |
|
924 | + $field[ 'disabled' ] = $disabled_attribute; |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
928 | 928 | |
929 | 929 | $sections = array( |
930 | 930 | array( |
931 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
931 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
932 | 932 | 'fields' => $fields, |
933 | 933 | ) |
934 | 934 | ); |
@@ -939,8 +939,8 @@ discard block |
||
939 | 939 | 'type' => 'save', |
940 | 940 | ); |
941 | 941 | |
942 | - if( $disabled_attribute ) { |
|
943 | - $button['disabled'] = $disabled_attribute; |
|
942 | + if ( $disabled_attribute ) { |
|
943 | + $button[ 'disabled' ] = $disabled_attribute; |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | |
@@ -960,20 +960,20 @@ discard block |
||
960 | 960 | // If there are extensions, add a section for them |
961 | 961 | if ( ! empty( $extension_sections ) ) { |
962 | 962 | |
963 | - if( $disabled_attribute ) { |
|
963 | + if ( $disabled_attribute ) { |
|
964 | 964 | foreach ( $extension_sections as &$section ) { |
965 | - foreach ( $section['fields'] as &$field ) { |
|
966 | - $field['disabled'] = $disabled_attribute; |
|
965 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
966 | + $field[ 'disabled' ] = $disabled_attribute; |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
971 | - $k = count( $extension_sections ) - 1 ; |
|
972 | - $extension_sections[ $k ]['fields'][] = $button; |
|
971 | + $k = count( $extension_sections ) - 1; |
|
972 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
973 | 973 | $sections = array_merge( $sections, $extension_sections ); |
974 | 974 | } else { |
975 | 975 | // add the 'update settings' button to the general section |
976 | - $sections[0]['fields'][] = $button; |
|
976 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | return $sections; |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | |
21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
22 | 22 | |
23 | - unset( $field_options['search_filter'] ); |
|
23 | + unset( $field_options[ 'search_filter' ] ); |
|
24 | 24 | |
25 | - if( 'edit' === $context ) { |
|
25 | + if ( 'edit' === $context ) { |
|
26 | 26 | return $field_options; |
27 | 27 | } |
28 | 28 | |
29 | - $add_options['link_to_file'] = array( |
|
29 | + $add_options[ 'link_to_file' ] = array( |
|
30 | 30 | 'type' => 'checkbox', |
31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
33 | 33 | 'value' => false, |
34 | 34 | 'merge_tags' => false, |
35 | 35 | ); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $output_arr = array(); |
66 | 66 | |
67 | 67 | // Get an array of file paths for the field. |
68 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
68 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
69 | 69 | |
70 | 70 | // The $value JSON was probably truncated; let's check lead_detail_long. |
71 | 71 | if ( ! is_array( $file_paths ) ) { |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // Process each file path |
82 | - foreach( $file_paths as $file_path ) { |
|
82 | + foreach ( $file_paths as $file_path ) { |
|
83 | 83 | |
84 | 84 | // If the site is HTTPS, use HTTPS |
85 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
85 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
86 | 86 | |
87 | 87 | // This is from Gravity Forms's code |
88 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
88 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
89 | 89 | |
90 | 90 | // If the field is set to link to the single entry, link to it. |
91 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
91 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
92 | 92 | |
93 | 93 | // Get file path information |
94 | - $file_path_info = pathinfo($file_path); |
|
94 | + $file_path_info = pathinfo( $file_path ); |
|
95 | 95 | |
96 | 96 | $html_format = NULL; |
97 | 97 | |
@@ -100,30 +100,30 @@ discard block |
||
100 | 100 | $disable_wrapped_link = false; |
101 | 101 | |
102 | 102 | // Is this an image? |
103 | - $image = new GravityView_Image(array( |
|
103 | + $image = new GravityView_Image( array( |
|
104 | 104 | 'src' => $file_path, |
105 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
106 | - 'alt' => $field_settings['label'], |
|
107 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
108 | - )); |
|
105 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
106 | + 'alt' => $field_settings[ 'label' ], |
|
107 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
108 | + ) ); |
|
109 | 109 | |
110 | 110 | $content = $image->html(); |
111 | 111 | |
112 | 112 | // The new default content is the image, if it exists. If not, use the file name as the content. |
113 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
113 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
114 | 114 | |
115 | 115 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
116 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
116 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
117 | 117 | |
118 | 118 | |
119 | - switch( true ) { |
|
119 | + switch ( true ) { |
|
120 | 120 | |
121 | 121 | // Audio file |
122 | 122 | case in_array( $extension, wp_get_audio_extensions() ): |
123 | 123 | |
124 | 124 | $disable_lightbox = true; |
125 | 125 | |
126 | - if( shortcode_exists( 'audio' ) ) { |
|
126 | + if ( shortcode_exists( 'audio' ) ) { |
|
127 | 127 | |
128 | 128 | $disable_wrapped_link = true; |
129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | */ |
135 | 135 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
136 | 136 | 'src' => $file_path, |
137 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
138 | - )); |
|
137 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
138 | + ) ); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * Generate the audio shortcode |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $disable_lightbox = true; |
155 | 155 | |
156 | - if( shortcode_exists( 'video' ) ) { |
|
156 | + if ( shortcode_exists( 'video' ) ) { |
|
157 | 157 | |
158 | 158 | $disable_wrapped_link = true; |
159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
166 | 166 | 'src' => $file_path, |
167 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
168 | - )); |
|
167 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
168 | + ) ); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Generate the video shortcode |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | break; |
188 | 188 | |
189 | 189 | // if not image, do not set the lightbox (@since 1.5.3) |
190 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
190 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
191 | 191 | |
192 | 192 | $disable_lightbox = true; |
193 | 193 | |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | |
198 | 198 | // If using Link to File, override the content. |
199 | 199 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
200 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
200 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
201 | 201 | |
202 | 202 | // Force the content to be the file name |
203 | - $content = $file_path_info["basename"]; |
|
203 | + $content = $file_path_info[ "basename" ]; |
|
204 | 204 | |
205 | 205 | // Restore the wrapped link |
206 | 206 | $disable_wrapped_link = false; |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // Whether to use lightbox or not |
211 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
211 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
212 | 212 | |
213 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
213 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
214 | 214 | |
215 | 215 | } else { |
216 | 216 | |
217 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
217 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
218 | 218 | |
219 | 219 | $link_atts = array( |
220 | 220 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
241 | 241 | |
242 | 242 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
243 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
243 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Modify the link text (defaults to the file name) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $content = gravityview_get_link( $link, $content, $link_atts ); |
256 | 256 | } |
257 | 257 | |
258 | - $output_arr[] = array( |
|
258 | + $output_arr[ ] = array( |
|
259 | 259 | 'file_path' => $file_path, |
260 | 260 | 'content' => $content |
261 | 261 | ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $disapproved_result = $wpdb->query( $wpdb->prepare( $sql, GravityView_Entry_Approval_Status::DISAPPROVED, '0' ) ); |
65 | 65 | |
66 | - if( false === $approved_result || false === $disapproved_result ) { |
|
66 | + if ( false === $approved_result || false === $disapproved_result ) { |
|
67 | 67 | do_action( 'gravityview_log_error', __METHOD__ . ': There was an error processing the query.', $wpdb->last_error ); |
68 | 68 | } else { |
69 | 69 | // All done: Meta values are migrated |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $redux_settings = $this->get_redux_settings(); |
97 | 97 | |
98 | 98 | // No need to process |
99 | - if( false === $redux_settings ) { |
|
99 | + if ( false === $redux_settings ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
103 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
104 | 104 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
105 | 105 | } |
106 | 106 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
115 | 115 | |
116 | 116 | // And now remove the previous option, so this is a one-time thing. |
117 | - delete_option('gravityview_settings'); |
|
118 | - delete_option('gravityview_settings-transients'); |
|
117 | + delete_option( 'gravityview_settings' ); |
|
118 | + delete_option( 'gravityview_settings-transients' ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | |
132 | 132 | $data = array( |
133 | 133 | 'edd_action' => 'check_license', |
134 | - 'license' => rgget('license_key', $redux_settings ), |
|
134 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
135 | 135 | 'update' => false, |
136 | 136 | 'format' => 'object', |
137 | 137 | ); |
138 | 138 | |
139 | 139 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
140 | 140 | |
141 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | - $redux_settings['license_key_status'] = $license_call->license; |
|
143 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
141 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
142 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
143 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $redux_settings; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | function get_redux_settings() { |
155 | 155 | |
156 | 156 | // Previous settings set by Redux |
157 | - $redux_option = get_option('gravityview_settings'); |
|
157 | + $redux_option = get_option( 'gravityview_settings' ); |
|
158 | 158 | |
159 | 159 | // No Redux settings? Don't proceed. |
160 | - if( false === $redux_option ) { |
|
160 | + if ( false === $redux_option ) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
168 | 168 | ); |
169 | 169 | |
170 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
170 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
171 | 171 | |
172 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
172 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
173 | 173 | |
174 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
174 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
175 | 175 | |
176 | 176 | // This contains the last response for license validation |
177 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
177 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
178 | 178 | |
179 | - $saved_license = rgget('license', $saved_values ); |
|
179 | + $saved_license = rgget( 'license', $saved_values ); |
|
180 | 180 | |
181 | 181 | // Only use the last-saved values if they are for the same license |
182 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
184 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
182 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
183 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
184 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | /** ---- Migrate from old search widget to new search widget ---- */ |
194 | 194 | function update_search_on_views() { |
195 | 195 | |
196 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
197 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
196 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
197 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | // Loop through all the views |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | $views = get_posts( $query_args ); |
208 | 208 | |
209 | - foreach( $views as $view ) { |
|
209 | + foreach ( $views as $view ) { |
|
210 | 210 | |
211 | 211 | $widgets = gravityview_get_directory_widgets( $view->ID ); |
212 | 212 | $search_fields = null; |
213 | 213 | |
214 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
214 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
215 | 215 | |
216 | 216 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
217 | 217 | |
218 | - foreach( $widgets as $area => $ws ) { |
|
219 | - foreach( $ws as $k => $widget ) { |
|
220 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
218 | + foreach ( $widgets as $area => $ws ) { |
|
219 | + foreach ( $ws as $k => $widget ) { |
|
220 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
221 | 221 | |
222 | - if( is_null( $search_fields ) ) { |
|
222 | + if ( is_null( $search_fields ) ) { |
|
223 | 223 | $search_fields = $this->get_search_fields( $view->ID ); |
224 | 224 | } |
225 | 225 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | // [search_free] => 1 |
228 | 228 | // [search_date] => 1 |
229 | 229 | $search_generic = array(); |
230 | - if( !empty( $widget['search_free'] ) ) { |
|
231 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
230 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
231 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
232 | 232 | } |
233 | - if( !empty( $widget['search_date'] ) ) { |
|
234 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
233 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
234 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $search_config = array_merge( $search_generic, $search_fields ); |
238 | 238 | |
239 | 239 | // don't throw '[]' when json_encode an empty array |
240 | - if( empty( $search_config ) ) { |
|
240 | + if ( empty( $search_config ) ) { |
|
241 | 241 | $search_config = ''; |
242 | 242 | } else { |
243 | 243 | $search_config = json_encode( $search_config ); |
244 | 244 | } |
245 | 245 | |
246 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
247 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
246 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
247 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
248 | 248 | |
249 | 249 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
250 | 250 | } |
@@ -272,26 +272,26 @@ discard block |
||
272 | 272 | // check view fields' settings |
273 | 273 | $fields = gravityview_get_directory_fields( $view_id, false ); |
274 | 274 | |
275 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
275 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
276 | 276 | |
277 | - foreach( $fields as $t => $fs ) { |
|
277 | + foreach ( $fields as $t => $fs ) { |
|
278 | 278 | |
279 | - foreach( $fs as $k => $field ) { |
|
279 | + foreach ( $fs as $k => $field ) { |
|
280 | 280 | // is field a search_filter ? |
281 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
281 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
282 | 282 | |
283 | 283 | // get field type & calculate the input type (by default) |
284 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
284 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
285 | 285 | |
286 | - if( empty( $form_field['type'] ) ) { |
|
286 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
287 | 287 | continue; |
288 | 288 | } |
289 | 289 | |
290 | 290 | // depending on the field type assign a group of possible search field types |
291 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
291 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
292 | 292 | |
293 | 293 | // add field to config |
294 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
294 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function getInstance() { |
74 | 74 | |
75 | - if( empty( self::$instance ) ) { |
|
75 | + if ( empty( self::$instance ) ) { |
|
76 | 76 | self::$instance = new self; |
77 | 77 | } |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | self::require_files(); |
85 | 85 | |
86 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
86 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 | |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private static function require_files() { |
100 | 100 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
101 | - require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
102 | - require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
101 | + require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
102 | + require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
103 | 103 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
104 | 104 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
105 | 105 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
106 | - require_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
107 | - require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
108 | - require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
106 | + require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
|
107 | + require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
108 | + require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval-status.php' ); |
141 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-approval.php' ); |
|
141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval.php' ); |
|
142 | 142 | |
143 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
144 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
143 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
144 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
145 | 145 | |
146 | 146 | // Load Extensions |
147 | 147 | // @todo: Convert to a scan of the directory or a method where this all lives |
148 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
149 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
150 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
148 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
149 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
150 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
151 | 151 | |
152 | 152 | // Load WordPress Widgets |
153 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
153 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
154 | 154 | |
155 | 155 | // Load GravityView Widgets |
156 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
156 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
157 | 157 | |
158 | 158 | // Add oEmbed |
159 | 159 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
167 | 167 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
168 | 168 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
169 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
169 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
170 | 170 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
171 | 171 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
172 | 172 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return bool |
182 | 182 | */ |
183 | 183 | public static function is_network_activated() { |
184 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
184 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @since 1.7.5.1 |
247 | 247 | */ |
248 | 248 | public static function include_widget_class() { |
249 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
249 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | if ( ! $loaded ) { |
270 | 270 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
271 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
271 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
272 | 272 | load_textdomain( 'gravityview', $mofile ); |
273 | 273 | } |
274 | 274 | |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function frontend_actions( $force = false ) { |
301 | 301 | |
302 | - if( self::is_admin() && ! $force ) { return; } |
|
302 | + if ( self::is_admin() && ! $force ) { return; } |
|
303 | 303 | |
304 | 304 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
305 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
306 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
307 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
305 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
306 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
307 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
308 | 308 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
309 | 309 | |
310 | 310 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public static function get_default_widget_areas() { |
331 | 331 | $default_areas = array( |
332 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
333 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
332 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
333 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
334 | 334 | ); |
335 | 335 | |
336 | 336 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param mixed $data Additional data to display |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - public static function log_debug( $message, $data = null ){ |
|
351 | + public static function log_debug( $message, $data = null ) { |
|
352 | 352 | /** |
353 | 353 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
354 | 354 | * @param string $message Message to display |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @param string $message log message |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public static function log_error( $message, $data = null ){ |
|
365 | + public static function log_error( $message, $data = null ) { |
|
366 | 366 | /** |
367 | 367 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
368 | 368 | * @param string $message Error message to display |
@@ -373,4 +373,4 @@ discard block |
||
373 | 373 | |
374 | 374 | } // end class GravityView_Plugin |
375 | 375 | |
376 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
376 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
91 | + if ( empty( $views ) ) { |
|
92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
93 | 93 | return; |
94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct( ) { |
14 | 14 | |
15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
29 | 29 | |
30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
42 | 42 | exit( false ); |
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
46 | 46 | |
47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
51 | - 'id' => $form['id'], |
|
52 | - 'title' => $form['title'], |
|
53 | - 'fields' => $form['fields'], |
|
51 | + 'id' => $form[ 'id' ], |
|
52 | + 'title' => $form[ 'title' ], |
|
53 | + 'fields' => $form[ 'fields' ], |
|
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | echo json_encode( $output ); |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ( $pagenow === 'widgets.php' ) { |
|
72 | 72 | |
73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
74 | 74 | |
75 | 75 | GravityView_Admin_Views::enqueue_gravity_forms_scripts(); |
76 | 76 | |
77 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
77 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
78 | 78 | |
79 | 79 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
80 | 80 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
81 | - )); |
|
81 | + ) ); |
|
82 | 82 | |
83 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
83 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | function widget( $args, $instance ) { |
96 | 96 | |
97 | 97 | // Don't have the Customizer render too soon. |
98 | - if( empty( $instance['view_id'] ) ) { |
|
98 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
103 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
102 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
103 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
104 | 104 | |
105 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
105 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
106 | 106 | |
107 | - echo $args['before_widget']; |
|
107 | + echo $args[ 'before_widget' ]; |
|
108 | 108 | |
109 | - if ( !empty( $title ) ) { |
|
110 | - echo $args['before_title'] . $title . $args['after_title']; |
|
109 | + if ( ! empty( $title ) ) { |
|
110 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
129 | 129 | |
130 | - echo $args['after_widget']; |
|
130 | + echo $args[ 'after_widget' ]; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function get_output( $instance ) { |
143 | 143 | |
144 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
144 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
145 | 145 | |
146 | 146 | $form = gravityview_get_form( $form_id ); |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | * @since 1.6.1 |
152 | 152 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
153 | 153 | */ |
154 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
154 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Generate list output |
158 | 158 | * @since 1.7.2 |
159 | 159 | */ |
160 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
160 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
161 | 161 | |
162 | 162 | $output = $List->get_output(); |
163 | 163 | |
@@ -182,30 +182,30 @@ discard block |
||
182 | 182 | private function get_entries( $instance, $form_id ) { |
183 | 183 | |
184 | 184 | // Get the settings for the View ID |
185 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
185 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
186 | 186 | |
187 | 187 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
188 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
189 | 189 | |
190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
191 | - $view_settings['id'] = $instance['view_id']; |
|
192 | - $view_settings['page_size'] = $instance['limit']; |
|
190 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
191 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
192 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
193 | 193 | |
194 | 194 | // Prepare paging criteria |
195 | - $criteria['paging'] = array( |
|
195 | + $criteria[ 'paging' ] = array( |
|
196 | 196 | 'offset' => 0, |
197 | - 'page_size' => $instance['limit'] |
|
197 | + 'page_size' => $instance[ 'limit' ] |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Prepare Search Criteria |
201 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
202 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
203 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
201 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
202 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
203 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Modify the search parameters before the entries are fetched |
207 | 207 | */ |
208 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
208 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
209 | 209 | |
210 | 210 | $results = GVCommon::get_entries( $form_id, $criteria ); |
211 | 211 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | $instance = $new_instance; |
227 | 227 | |
228 | 228 | // Force positive number |
229 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
229 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
230 | 230 | |
231 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
231 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
232 | 232 | |
233 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
233 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
234 | 234 | |
235 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
235 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
236 | 236 | |
237 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
237 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
238 | 238 | |
239 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
239 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
240 | 240 | |
241 | 241 | //check if post_id is a valid post with embedded View |
242 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
242 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
243 | 243 | |
244 | 244 | // Share that the widget isn't brand new |
245 | - $instance['updated'] = 1; |
|
245 | + $instance[ 'updated' ] = 1; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | |
265 | 265 | // Set up some default widget settings. |
266 | 266 | $defaults = array( |
267 | - 'title' => __('Recent Entries', 'gravityview'), |
|
267 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
268 | 268 | 'view_id' => NULL, |
269 | 269 | 'post_id' => NULL, |
270 | 270 | 'limit' => 10, |
271 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
271 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
272 | 272 | 'after_link' => '' |
273 | 273 | ); |
274 | 274 | |
275 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
275 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
276 | 276 | |
277 | 277 | ?> |
278 | 278 | |
279 | 279 | <!-- Title --> |
280 | 280 | <p> |
281 | 281 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
282 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
282 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
283 | 283 | </p> |
284 | 284 | |
285 | 285 | <!-- Download --> |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $views = get_posts( $args ); |
293 | 293 | |
294 | 294 | // If there are no views set up yet, we get outta here. |
295 | - if( empty( $views ) ) { |
|
295 | + if ( empty( $views ) ) { |
|
296 | 296 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
297 | 297 | return; |
298 | 298 | } |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * Display errors generated for invalid embed IDs |
305 | 305 | * @see GravityView_View_Data::is_valid_embed_id |
306 | 306 | */ |
307 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
307 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
308 | 308 | ?> |
309 | 309 | <div class="error inline hide-on-view-change"> |
310 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
310 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
311 | 311 | </div> |
312 | 312 | <?php |
313 | 313 | unset ( $error ); |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | ?> |
316 | 316 | |
317 | 317 | <p> |
318 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
318 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
319 | 319 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
320 | 320 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
321 | 321 | <?php |
322 | 322 | |
323 | - foreach( $views as $view ) { |
|
324 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
325 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
323 | + foreach ( $views as $view ) { |
|
324 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
325 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * Display errors generated for invalid embed IDs |
335 | 335 | * @see GravityView_View_Data::is_valid_embed_id |
336 | 336 | */ |
337 | - if( !empty( $instance['error_post_id'] ) ) { |
|
337 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
338 | 338 | ?> |
339 | 339 | <div class="error inline"> |
340 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
340 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
341 | 341 | </div> |
342 | 342 | <?php |
343 | 343 | unset ( $error ); |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | |
347 | 347 | <p> |
348 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
348 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
350 | 350 | <span class="howto"><?php |
351 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
353 | 353 | ?></span> |
354 | 354 | </p> |
355 | 355 | |
@@ -357,21 +357,21 @@ discard block |
||
357 | 357 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
358 | 358 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
359 | 359 | </label> |
360 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
360 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
361 | 361 | </p> |
362 | 362 | |
363 | 363 | <p> |
364 | 364 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
365 | 365 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
366 | 366 | </label> |
367 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
367 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
371 | 371 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
372 | 372 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
373 | 373 | </label> |
374 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
374 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
375 | 375 | </p> |
376 | 376 | |
377 | 377 | <?php |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
382 | 382 | * @param array $instance Current widget instance |
383 | 383 | */ |
384 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
384 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
385 | 385 | |
386 | 386 | ?> |
387 | 387 |