@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | * @return string The version of PHP. |
203 | 203 | */ |
204 | 204 | private function get_php_version() { |
205 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
206 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
205 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
206 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return string The version of WordPress. |
215 | 215 | */ |
216 | 216 | private function get_wordpress_version() { |
217 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
218 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
217 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
218 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | * @return string|null The version of Gravity Forms or null if inactive. |
227 | 227 | */ |
228 | 228 | private function get_gravityforms_version() { |
229 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
229 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
230 | 230 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
231 | 231 | return null; |
232 | 232 | } |
233 | 233 | |
234 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
235 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
234 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
235 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | private function __clone() { } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // Add the list columns |
64 | 64 | foreach ( $list_fields as $list_field ) { |
65 | 65 | |
66 | - if( empty( $list_field->enableColumns ) ) { |
|
66 | + if ( empty( $list_field->enableColumns ) ) { |
|
67 | 67 | continue; |
68 | 68 | } |
69 | 69 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | // If there are columns, add them under the parent field |
87 | - if( ! empty( $list_columns ) ) { |
|
87 | + if ( ! empty( $list_columns ) ) { |
|
88 | 88 | |
89 | 89 | $index = array_search( $list_field->id, array_keys( $fields ) ) + 1; |
90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * Merge the $list_columns into the $fields array at $index |
93 | 93 | * @see https://stackoverflow.com/a/1783125 |
94 | 94 | */ |
95 | - $fields = array_slice( $fields, 0, $index, true) + $list_columns + array_slice( $fields, $index, null, true); |
|
95 | + $fields = array_slice( $fields, 0, $index, true ) + $list_columns + array_slice( $fields, $index, null, true ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | unset( $list_columns, $index, $input_id ); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $list_rows = maybe_unserialize( $field_value ); |
121 | 121 | |
122 | - if( ! is_array( $list_rows ) ) { |
|
122 | + if ( ! is_array( $list_rows ) ) { |
|
123 | 123 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
124 | 124 | return null; |
125 | 125 | } |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | // Each list row |
130 | 130 | foreach ( $list_rows as $list_row ) { |
131 | 131 | $current_column = 0; |
132 | - foreach ( (array) $list_row as $column_key => $column_value ) { |
|
132 | + foreach ( (array)$list_row as $column_key => $column_value ) { |
|
133 | 133 | |
134 | 134 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
135 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
136 | - $column_values[] = $column_value; |
|
135 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
136 | + $column_values[ ] = $column_value; |
|
137 | 137 | } |
138 | 138 | $current_column++; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Return the array of values |
143 | - if( 'raw' === $format ) { |
|
143 | + if ( 'raw' === $format ) { |
|
144 | 144 | return $column_values; |
145 | 145 | } |
146 | 146 | // Return the Gravity Forms Field output |
@@ -163,22 +163,22 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function _filter_field_label( $label, $field, $form, $entry ) { |
165 | 165 | |
166 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
166 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
167 | 167 | |
168 | 168 | // Not a list field |
169 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
169 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
170 | 170 | return $label; |
171 | 171 | } |
172 | 172 | |
173 | 173 | // Custom label is defined, so use it |
174 | - if( ! empty( $field['custom_label'] ) ) { |
|
174 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
175 | 175 | return $label; |
176 | 176 | } |
177 | 177 | |
178 | - $column_id = gravityview_get_input_id_from_id( $field['id'] ); |
|
178 | + $column_id = gravityview_get_input_id_from_id( $field[ 'id' ] ); |
|
179 | 179 | |
180 | 180 | // Parent field, not column field |
181 | - if( false === $column_id ) { |
|
181 | + if ( false === $column_id ) { |
|
182 | 182 | return $label; |
183 | 183 | } |
184 | 184 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
200 | 200 | |
201 | 201 | // Doesn't have columns enabled |
202 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
202 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
203 | 203 | return $backup_label; |
204 | 204 | } |
205 | 205 |
@@ -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,33 +56,33 @@ 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 | 76 | /** |
77 | 77 | * @filter `gravityview_disable_change_entry_creator_note` Disable adding a note when changing the entry creator |
78 | 78 | * @since 1.21.5 |
79 | 79 | * @param boolean $disable Disable the Change Entry Creator note. Default: false. |
80 | 80 | */ |
81 | - if( apply_filters('gravityview_disable_change_entry_creator_note', false ) ) { |
|
81 | + if ( apply_filters( 'gravityview_disable_change_entry_creator_note', false ) ) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
85 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
@@ -94,20 +94,20 @@ discard block |
||
94 | 94 | |
95 | 95 | // Plugin that was provided here: |
96 | 96 | // @link https://gravityview.co/support/documentation/201991205/ |
97 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
98 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
97 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
98 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
99 | 99 | |
100 | 100 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
101 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
101 | + if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
102 | 102 | |
103 | 103 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
104 | 104 | |
105 | 105 | // Now, no validation is required in the methods; let's hook in. |
106 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
106 | + remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
107 | 107 | |
108 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 ); |
|
108 | + remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 ); |
|
109 | 109 | |
110 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
110 | + remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | } |
@@ -119,26 +119,26 @@ discard block |
||
119 | 119 | function load() { |
120 | 120 | |
121 | 121 | // Does GF exist? |
122 | - if( !class_exists('GFCommon') ) { |
|
122 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
126 | 126 | // Can the user edit entries? |
127 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
127 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // If screen mode isn't set, then we're in the wrong place. |
132 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
132 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // Now, no validation is required in the methods; let's hook in. |
137 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
137 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
138 | 138 | |
139 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
139 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
140 | 140 | |
141 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
141 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | function set_screen_mode() { |
150 | 150 | |
151 | 151 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
152 | - if( rgget('screen_mode') === 'edit' ) { |
|
153 | - $_POST["screen_mode"] = 'edit'; |
|
152 | + if ( rgget( 'screen_mode' ) === 'edit' ) { |
|
153 | + $_POST[ "screen_mode" ] = 'edit'; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | } |
@@ -161,42 +161,42 @@ discard block |
||
161 | 161 | * @param int $entry_id Entry ID |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - function update_entry_creator($form, $entry_id) { |
|
164 | + function update_entry_creator( $form, $entry_id ) { |
|
165 | 165 | global $current_user; |
166 | 166 | |
167 | 167 | // Update the entry |
168 | - $created_by = absint( rgpost('created_by') ); |
|
168 | + $created_by = absint( rgpost( 'created_by' ) ); |
|
169 | 169 | |
170 | 170 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
171 | 171 | |
172 | 172 | // If the creator has changed, let's add a note about who it used to be. |
173 | - $originally_created_by = rgpost('originally_created_by'); |
|
173 | + $originally_created_by = rgpost( 'originally_created_by' ); |
|
174 | 174 | |
175 | 175 | // If there's no owner and there didn't used to be, keep going |
176 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
176 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
177 | 177 | return; |
178 | 178 | } |
179 | 179 | |
180 | 180 | // If the values have changed |
181 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
181 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
182 | 182 | |
183 | - $user_data = get_userdata($current_user->ID); |
|
183 | + $user_data = get_userdata( $current_user->ID ); |
|
184 | 184 | |
185 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
185 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
186 | 186 | |
187 | - $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'); |
|
187 | + $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' ); |
|
188 | 188 | |
189 | - if( !empty( $originally_created_by ) ) { |
|
190 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
189 | + if ( ! empty( $originally_created_by ) ) { |
|
190 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
191 | 191 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
192 | 192 | } |
193 | 193 | |
194 | - if( !empty( $created_by ) ) { |
|
195 | - $created_by_user_data = get_userdata($created_by); |
|
194 | + if ( ! empty( $created_by ) ) { |
|
195 | + $created_by_user_data = get_userdata( $created_by ); |
|
196 | 196 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
197 | 197 | } |
198 | 198 | |
199 | - 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' ); |
|
199 | + 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' ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | * @param array $entry GF entry array |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - function add_select($form_id, $entry ) { |
|
210 | + function add_select( $form_id, $entry ) { |
|
211 | 211 | |
212 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
212 | + if ( rgpost( 'screen_mode' ) !== 'edit' ) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | |
@@ -228,23 +228,23 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | $output = '<label for="change_created_by">'; |
231 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
231 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
232 | 232 | $output .= '</label>'; |
233 | 233 | |
234 | 234 | // If there are users who are not being shown, show a warning. |
235 | 235 | // TODO: Use AJAX instead of <select> |
236 | 236 | $count_users = count_users(); |
237 | - if( sizeof( $users ) < $count_users['total_users'] ) { |
|
237 | + if ( sizeof( $users ) < $count_users[ 'total_users' ] ) { |
|
238 | 238 | $output .= '<p><i class="dashicons dashicons-warning"></i> ' . sprintf( esc_html__( 'The displayed list of users has been trimmed due to the large number of users. %sLearn how to remove this limit%s.', 'gravityview' ), '<a href="https://docs.gravityview.co/article/251-i-only-see-some-users-in-the-change-entry-creator-dropdown" rel="external">', '</a>' ) . '</p>'; |
239 | 239 | } |
240 | 240 | |
241 | 241 | $output .= '<select name="created_by" id="change_created_by" class="widefat">'; |
242 | - $output .= '<option value="' . selected( $entry['created_by'], '0', false ) . '"> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
243 | - foreach($users as $user) { |
|
244 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
242 | + $output .= '<option value="' . selected( $entry[ 'created_by' ], '0', false ) . '"> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
243 | + foreach ( $users as $user ) { |
|
244 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
245 | 245 | } |
246 | 246 | $output .= '</select>'; |
247 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
247 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
248 | 248 | |
249 | 249 | unset( $is_created_by_in_users, $created_by_user, $users, $created_by_id, $count_users ); |
250 | 250 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) { |
46 | 46 | |
47 | 47 | // No modifier was set or the raw value was empty |
48 | - if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
48 | + if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
49 | 49 | return $value; |
50 | 50 | } |
51 | 51 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | foreach ( $gv_modifiers as $gv_modifier => $method ) { |
62 | 62 | |
63 | 63 | // Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure |
64 | - preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches ); |
|
64 | + preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches ); |
|
65 | 65 | |
66 | - if( ! empty( $matches ) ) { |
|
66 | + if ( ! empty( $matches ) ) { |
|
67 | 67 | // The called method is passed the raw value and the full matches array |
68 | 68 | $return = self::$method( $raw_value, $matches ); |
69 | 69 | break; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private static function modifier_timestamp( $raw_value, $matches ) { |
89 | 89 | |
90 | - if( empty( $matches[0] ) ) { |
|
90 | + if ( empty( $matches[ 0 ] ) ) { |
|
91 | 91 | return $raw_value; |
92 | 92 | } |
93 | 93 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private static function modifier_wpautop( $raw_value, $matches ) { |
113 | 113 | |
114 | - if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) { |
|
114 | + if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) { |
|
115 | 115 | return $raw_value; |
116 | 116 | } |
117 | 117 | |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private static function modifier_maxwords( $raw_value, $matches ) { |
137 | 137 | |
138 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
138 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
139 | 139 | return $raw_value; |
140 | 140 | } |
141 | 141 | |
142 | - $max = intval( $matches[1] ); |
|
142 | + $max = intval( $matches[ 1 ] ); |
|
143 | 143 | |
144 | 144 | $more_placeholder = '[GVMORE]'; |
145 | 145 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param bool $esc_html Pass return value through `esc_html()` |
172 | 172 | * @return string Text with variables maybe replaced |
173 | 173 | */ |
174 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
174 | + public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @internal Fixed $form['title'] in Gravity Forms |
197 | 197 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
198 | 198 | */ |
199 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
200 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
201 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
199 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
200 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
201 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
202 | 202 | |
203 | 203 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
204 | 204 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
222 | 222 | |
223 | - if( '' === $text ) { |
|
223 | + if ( '' === $text ) { |
|
224 | 224 | return $text; |
225 | 225 | } |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @see GFCommon::replace_variables_prepopulate() |
231 | 231 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
232 | 232 | */ |
233 | - if( false === $form ) { |
|
233 | + if ( false === $form ) { |
|
234 | 234 | return $text; |
235 | 235 | } |
236 | 236 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
265 | 265 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
266 | 266 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
267 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
267 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
268 | 268 | ); |
269 | 269 | |
270 | 270 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | return $original_text; |
342 | 342 | } |
343 | 343 | |
344 | - foreach ( (array) $matches as $match ) { |
|
345 | - $full_tag = $match[0]; |
|
344 | + foreach ( (array)$matches as $match ) { |
|
345 | + $full_tag = $match[ 0 ]; |
|
346 | 346 | $modifier = rgar( $match, 2, 'permalink' ); |
347 | 347 | |
348 | 348 | $replacement = false; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $replacement = esc_html( $replacement ); |
361 | 361 | } |
362 | 362 | |
363 | - if( $url_encode ) { |
|
363 | + if ( $url_encode ) { |
|
364 | 364 | $replacement = urlencode( $replacement ); |
365 | 365 | } |
366 | 366 | |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
401 | 401 | |
402 | 402 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
403 | - if( empty( $matches ) ) { |
|
403 | + if ( empty( $matches ) ) { |
|
404 | 404 | return $text; |
405 | 405 | } |
406 | 406 | |
407 | 407 | foreach ( $matches as $match ) { |
408 | 408 | |
409 | - $full_tag = $match[0]; |
|
410 | - $property = $match[1]; |
|
409 | + $full_tag = $match[ 0 ]; |
|
410 | + $property = $match[ 1 ]; |
|
411 | 411 | |
412 | 412 | $value = stripslashes_deep( rgget( $property ) ); |
413 | 413 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @since 1.15 |
432 | 432 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
433 | 433 | */ |
434 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
434 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
435 | 435 | |
436 | 436 | $value = $esc_html ? esc_html( $value ) : $value; |
437 | 437 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @param[in] array $form Gravity Forms form array |
443 | 443 | * @param[in] array $entry Entry array |
444 | 444 | */ |
445 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
445 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
446 | 446 | |
447 | 447 | $text = str_replace( $full_tag, $value, $text ); |
448 | 448 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @since 1.11 |
53 | 53 | * @param boolean $boolean Whether to trigger update on user registration (default: true) |
54 | 54 | */ |
55 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
55 | + if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
56 | 56 | |
57 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
57 | + add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 ); |
|
58 | 58 | |
59 | 59 | // last resort in case the current user display name don't match any of the defaults |
60 | 60 | add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function update_user( $form = array(), $entry_id = 0 ) { |
74 | 74 | |
75 | - if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
75 | + if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
76 | 76 | do_action( 'gravityview_log_error', __METHOD__ . ': GFAPI or User Registration class not found; not updating the user' ); |
77 | 77 | return; |
78 | - } elseif( empty( $entry_id ) ) { |
|
78 | + } elseif ( empty( $entry_id ) ) { |
|
79 | 79 | do_action( 'gravityview_log_error', __METHOD__ . ': Entry ID is empty; not updating the user', $entry_id ); |
80 | 80 | return; |
81 | 81 | } |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // If an Update feed, make sure the conditions are met. |
104 | - if( rgars( $config, 'meta/feedType' ) === 'update' ) { |
|
105 | - if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
104 | + if ( rgars( $config, 'meta/feedType' ) === 'update' ) { |
|
105 | + if ( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | remove_filter( 'send_email_change_email', '__return_false', 3 ); |
119 | 119 | |
120 | 120 | // Prevent double-triggering by removing the hook |
121 | - remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 ); |
|
121 | + remove_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10 ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | */ |
152 | 152 | $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
153 | 153 | |
154 | - if( $preserve_role ) { |
|
155 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
154 | + if ( $preserve_role ) { |
|
155 | + $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role'; |
|
156 | 156 | } |
157 | 157 | |
158 | - $displayname = $this->match_current_display_name( $entry['created_by'] ); |
|
158 | + $displayname = $this->match_current_display_name( $entry[ 'created_by' ] ); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Make sure the current display name is not changed with the update user method. |
162 | 162 | * @since 1.15 |
163 | 163 | */ |
164 | - $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname']; |
|
164 | + $config[ 'meta' ][ 'displayname' ] = $displayname ? $displayname : $config[ 'meta' ][ 'displayname' ]; |
|
165 | 165 | |
166 | 166 | /** |
167 | 167 | * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $user = get_userdata( $user_id ); |
190 | 190 | |
191 | - if( ! $user ) { |
|
191 | + if ( ! $user ) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook |
201 | 201 | * @see restore_display_name |
202 | 202 | */ |
203 | - if( false === $format ) { |
|
203 | + if ( false === $format ) { |
|
204 | 204 | $this->_user_before_update = $user; |
205 | 205 | } |
206 | 206 | |
@@ -218,20 +218,20 @@ discard block |
||
218 | 218 | public function generate_display_names( $profileuser ) { |
219 | 219 | |
220 | 220 | $public_display = array(); |
221 | - $public_display['nickname'] = $profileuser->nickname; |
|
222 | - $public_display['username'] = $profileuser->user_login; |
|
221 | + $public_display[ 'nickname' ] = $profileuser->nickname; |
|
222 | + $public_display[ 'username' ] = $profileuser->user_login; |
|
223 | 223 | |
224 | - if ( !empty($profileuser->first_name) ) { |
|
225 | - $public_display['firstname'] = $profileuser->first_name; |
|
224 | + if ( ! empty( $profileuser->first_name ) ) { |
|
225 | + $public_display[ 'firstname' ] = $profileuser->first_name; |
|
226 | 226 | } |
227 | 227 | |
228 | - if ( !empty($profileuser->last_name) ) { |
|
229 | - $public_display['lastname'] = $profileuser->last_name; |
|
228 | + if ( ! empty( $profileuser->last_name ) ) { |
|
229 | + $public_display[ 'lastname' ] = $profileuser->last_name; |
|
230 | 230 | } |
231 | 231 | |
232 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
233 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
234 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
232 | + if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
|
233 | + $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
234 | + $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $public_display = array_map( 'trim', $public_display ); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | */ |
262 | 262 | $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true ); |
263 | 263 | |
264 | - $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' ); |
|
264 | + $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' ); |
|
265 | 265 | |
266 | 266 | /** |
267 | 267 | * Don't restore display name: |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * - or we don't need as we found the correct format before updating user. |
271 | 271 | * @since 1.14.4 |
272 | 272 | */ |
273 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
273 | + if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
274 | 274 | return null; |
275 | 275 | } |
276 | 276 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | // User not found |
280 | 280 | if ( ! $user_after_update ) { |
281 | - do_action('gravityview_log_error', __METHOD__ . sprintf( ' - User not found at $user_id #%d', $user_id ) ); |
|
281 | + do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - User not found at $user_id #%d', $user_id ) ); |
|
282 | 282 | return false; |
283 | 283 | } |
284 | 284 | |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | |
303 | 303 | $updated = wp_update_user( $restored_user ); |
304 | 304 | |
305 | - if( is_wp_error( $updated ) ) { |
|
306 | - do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
305 | + if ( is_wp_error( $updated ) ) { |
|
306 | + do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated ); |
|
307 | 307 | } else { |
308 | - do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
308 | + do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) ); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | $this->_user_before_update = null; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public static function get_instance() { |
87 | 87 | |
88 | - if( empty( self::$instance ) ) { |
|
88 | + if ( empty( self::$instance ) ) { |
|
89 | 89 | self::$instance = new self; |
90 | 90 | } |
91 | 91 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | |
119 | 119 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
120 | 120 | |
121 | - if( $with_values ) { |
|
121 | + if ( $with_values ) { |
|
122 | 122 | $operators_with_values = array(); |
123 | - foreach( $operators as $key ) { |
|
123 | + foreach ( $operators as $key ) { |
|
124 | 124 | $operators_with_values[ $key ] = ''; |
125 | 125 | } |
126 | 126 | return $operators_with_values; |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | */ |
138 | 138 | function set_operation( $operation = '' ) { |
139 | 139 | |
140 | - if( empty( $operation ) ) { |
|
140 | + if ( empty( $operation ) ) { |
|
141 | 141 | return false; |
142 | 142 | } |
143 | 143 | |
144 | 144 | $operators = $this->get_operators( false ); |
145 | 145 | |
146 | - if( !in_array( $operation, $operators ) ) { |
|
147 | - do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation ); |
|
146 | + if ( ! in_array( $operation, $operators ) ) { |
|
147 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation ); |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function setup_operation_and_comparison() { |
166 | 166 | |
167 | - foreach( $this->atts as $key => $value ) { |
|
167 | + foreach ( $this->atts as $key => $value ) { |
|
168 | 168 | |
169 | 169 | $valid = $this->set_operation( $key ); |
170 | 170 | |
171 | - if( $valid ) { |
|
171 | + if ( $valid ) { |
|
172 | 172 | $this->comparison = $value; |
173 | 173 | return true; |
174 | 174 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | return null; |
195 | 195 | } |
196 | 196 | |
197 | - if( empty( $atts ) ) { |
|
198 | - do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts ); |
|
197 | + if ( empty( $atts ) ) { |
|
198 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts ); |
|
199 | 199 | return null; |
200 | 200 | } |
201 | 201 | |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | $this->parse_atts(); |
207 | 207 | |
208 | 208 | // We need an "if" |
209 | - if( false === $this->if ) { |
|
210 | - do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts ); |
|
209 | + if ( false === $this->if ) { |
|
210 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts ); |
|
211 | 211 | return null; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $setup = $this->setup_operation_and_comparison(); |
215 | 215 | |
216 | 216 | // We need an operation and comparison value |
217 | - if( ! $setup ) { |
|
218 | - do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts ); |
|
217 | + if ( ! $setup ) { |
|
218 | + do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts ); |
|
219 | 219 | return null; |
220 | 220 | } |
221 | 221 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | private function get_output() { |
250 | 250 | |
251 | - if( $this->is_match ) { |
|
251 | + if ( $this->is_match ) { |
|
252 | 252 | $output = $this->content; |
253 | 253 | } else { |
254 | 254 | $output = $this->else_content; |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | * @param string $output HTML/text output |
263 | 263 | * @param GVLogic_Shortcode $this This class |
264 | 264 | */ |
265 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
265 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
266 | 266 | |
267 | - do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output ); |
|
267 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output ); |
|
268 | 268 | |
269 | 269 | return $output; |
270 | 270 | } |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | |
281 | 281 | $content = explode( '[else]', $this->passed_content ); |
282 | 282 | |
283 | - $this->content = $content[0]; |
|
283 | + $this->content = $content[ 0 ]; |
|
284 | 284 | |
285 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
285 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
286 | 286 | |
287 | - $this->else_content = isset( $content[1] ) ? $content[1] : $else_attr; |
|
287 | + $this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts; |
308 | 308 | |
309 | 309 | // Strip whitespace if it's not default false |
310 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
310 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
311 | 311 | |
312 | 312 | /** |
313 | 313 | * @action `gravityview/gvlogic/parse_atts/after` Modify shortcode attributes after it's been parsed |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
319 | 319 | |
320 | 320 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
321 | - unset( $this->atts['if'] ); |
|
321 | + unset( $this->atts[ 'if' ] ); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | |
238 | 238 | $this->context_view_id = $view_id; |
239 | 239 | |
240 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
240 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
241 | 241 | /** |
242 | 242 | * used on a has_multiple_views context |
243 | 243 | * @see GravityView_API::entry_link |
244 | 244 | */ |
245 | - $this->context_view_id = $_GET['gvid']; |
|
245 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
246 | 246 | |
247 | 247 | } elseif ( ! $multiple_views ) { |
248 | 248 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -285,25 +285,25 @@ discard block |
||
285 | 285 | global $wp_rewrite; |
286 | 286 | |
287 | 287 | $is_front_page = ( $query->is_home || $query->is_page ); |
288 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
289 | - $front_page_id = get_option('page_on_front'); |
|
288 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
289 | + $front_page_id = get_option( 'page_on_front' ); |
|
290 | 290 | |
291 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
291 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
292 | 292 | |
293 | 293 | // Force to be an array, potentially a query string ( entry=16 ) |
294 | 294 | $_query = wp_parse_args( $query->query ); |
295 | 295 | |
296 | 296 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
297 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
298 | - unset( $_query['pagename'] ); |
|
297 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
298 | + unset( $_query[ 'pagename' ] ); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | // this is where will break from core wordpress |
302 | 302 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
303 | 303 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
304 | 304 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
305 | - foreach ( (array) $endpoints as $endpoint ) { |
|
306 | - $ignore[] = $endpoint[1]; |
|
305 | + foreach ( (array)$endpoints as $endpoint ) { |
|
306 | + $ignore[ ] = $endpoint[ 1 ]; |
|
307 | 307 | } |
308 | 308 | unset( $endpoints ); |
309 | 309 | |
@@ -313,21 +313,21 @@ discard block |
||
313 | 313 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
314 | 314 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
315 | 315 | |
316 | - $qv =& $query->query_vars; |
|
316 | + $qv = & $query->query_vars; |
|
317 | 317 | |
318 | 318 | // Prevent redirect when on the single entry endpoint |
319 | - if( self::is_single_entry() ) { |
|
319 | + if ( self::is_single_entry() ) { |
|
320 | 320 | add_filter( 'redirect_canonical', '__return_false' ); |
321 | 321 | } |
322 | 322 | |
323 | 323 | $query->is_page = true; |
324 | 324 | $query->is_home = false; |
325 | - $qv['page_id'] = $front_page_id; |
|
325 | + $qv[ 'page_id' ] = $front_page_id; |
|
326 | 326 | |
327 | 327 | // Correct <!--nextpage--> for page_on_front |
328 | - if ( ! empty( $qv['paged'] ) ) { |
|
329 | - $qv['page'] = $qv['paged']; |
|
330 | - unset( $qv['paged'] ); |
|
328 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
329 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
330 | + unset( $qv[ 'paged' ] ); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
362 | 362 | |
363 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
363 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
364 | 364 | $this->setPostId( $post_id ); |
365 | 365 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
366 | 366 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
398 | 398 | |
399 | - if( 'post' === $search_method ) { |
|
399 | + if ( 'post' === $search_method ) { |
|
400 | 400 | $get = $_POST; |
401 | 401 | } else { |
402 | 402 | $get = $_GET; |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
453 | 453 | * @param array $entry Current entry |
454 | 454 | */ |
455 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
455 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
456 | 456 | |
457 | 457 | if ( ! $apply_outside_loop ) { |
458 | 458 | return $title; |
459 | 459 | } |
460 | 460 | |
461 | 461 | // User reported WooCommerce doesn't pass two args. |
462 | - if ( empty( $passed_post_id ) ) { |
|
462 | + if ( empty( $passed_post_id ) ) { |
|
463 | 463 | return $title; |
464 | 464 | } |
465 | 465 | |
466 | 466 | // Don't modify the title for anything other than the current view/post. |
467 | 467 | // This is true for embedded shortcodes and Views. |
468 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
468 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
469 | 469 | return $title; |
470 | 470 | } |
471 | 471 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | } else { |
489 | 489 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
490 | 490 | foreach ( gravityview()->views->all() as $_view ) { |
491 | - if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) { |
|
491 | + if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) { |
|
492 | 492 | $view = $_view; |
493 | 493 | break; |
494 | 494 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } else { |
501 | 501 | /** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
502 | 502 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
503 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
503 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
504 | 504 | $view_meta = $view_data; |
505 | 505 | break; |
506 | 506 | } |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | } |
516 | 516 | } else { |
517 | 517 | /** Deprecated stuff in the future. See the branch above. */ |
518 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
518 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
519 | 519 | |
520 | - $title = $view_meta['atts']['single_title']; |
|
520 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
521 | 521 | |
522 | 522 | // We are allowing HTML in the fields, so no escaping the output |
523 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
523 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
524 | 524 | |
525 | 525 | $title = do_shortcode( $title ); |
526 | 526 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | // Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
561 | - if( ! in_the_loop() ) { |
|
561 | + if ( ! in_the_loop() ) { |
|
562 | 562 | return $content; |
563 | 563 | } |
564 | 564 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | $context = GravityView_View::getInstance()->getContext(); |
635 | 635 | |
636 | - switch( $context ) { |
|
636 | + switch ( $context ) { |
|
637 | 637 | case 'directory': |
638 | 638 | $tab = __( 'Multiple Entries', 'gravityview' ); |
639 | 639 | break; |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | |
650 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
650 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
651 | 651 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
652 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
652 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
653 | 653 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
654 | 654 | |
655 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
655 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
656 | 656 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
657 | 657 | |
658 | 658 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | public function render_view( $passed_args ) { |
684 | 684 | |
685 | 685 | // validate attributes |
686 | - if ( empty( $passed_args['id'] ) ) { |
|
686 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
687 | 687 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
688 | 688 | return null; |
689 | 689 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | return null; |
706 | 706 | } |
707 | 707 | |
708 | - $view_id = $passed_args['id']; |
|
708 | + $view_id = $passed_args[ 'id' ]; |
|
709 | 709 | |
710 | 710 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
711 | 711 | $view = gravityview()->views->get( $view_id ); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $passed_args = array_filter( $passed_args, 'strlen' ); |
736 | 736 | |
737 | 737 | //Override shortcode args over View template settings |
738 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
738 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
739 | 739 | |
740 | 740 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
741 | 741 | } |
@@ -759,14 +759,14 @@ discard block |
||
759 | 759 | * @since 1.15 |
760 | 760 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
761 | 761 | */ |
762 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
762 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
763 | 763 | |
764 | 764 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
765 | 765 | |
766 | 766 | return null; |
767 | 767 | } |
768 | 768 | |
769 | - if( $this->isGravityviewPostType() ) { |
|
769 | + if ( $this->isGravityviewPostType() ) { |
|
770 | 770 | |
771 | 771 | /** |
772 | 772 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -782,10 +782,10 @@ discard block |
||
782 | 782 | $embed_only = $view->settings->get( 'embed_only' ); |
783 | 783 | } else { |
784 | 784 | /** Deprecated. View attributes moved to \GV\View::$settings. */ |
785 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
785 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
786 | 786 | } |
787 | 787 | |
788 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
788 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
789 | 789 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
790 | 790 | } |
791 | 791 | } |
@@ -801,13 +801,13 @@ discard block |
||
801 | 801 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
802 | 802 | $view_data = $view->as_data(); |
803 | 803 | $gravityview_view = new GravityView_View( $view_data ); |
804 | - $post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() ); |
|
804 | + $post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() ); |
|
805 | 805 | $template_id = $view->template ? $view->template->ID : null; |
806 | 806 | } else { |
807 | 807 | /** These constructs are deprecated. Use the new gravityview() wrapper. */ |
808 | 808 | $gravityview_view = new GravityView_View( $view_data ); |
809 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
810 | - $template_id = $view_data['template_id']; |
|
809 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
810 | + $template_id = $view_data[ 'template_id' ]; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | $gravityview_view->setPostId( $post_id ); |
@@ -818,20 +818,20 @@ discard block |
||
818 | 818 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
819 | 819 | |
820 | 820 | //fetch template and slug |
821 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' ); |
|
821 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' ); |
|
822 | 822 | |
823 | 823 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
824 | 824 | |
825 | 825 | /** |
826 | 826 | * Disable fetching initial entries for views that don't need it (DataTables) |
827 | 827 | */ |
828 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
828 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
829 | 829 | |
830 | 830 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
831 | 831 | $hide_until_searched = $view->settings->get( 'hide_until_searched' ); |
832 | 832 | } else { |
833 | 833 | /** $atts is deprecated, use \GV\View:$settings */ |
834 | - $hide_until_searched = ! empty( $atts['hide_until_searched'] ); |
|
834 | + $hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] ); |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
@@ -849,12 +849,12 @@ discard block |
||
849 | 849 | $sort_columns = $view->settings->get( 'sort_columns' ); |
850 | 850 | } else { |
851 | 851 | /** $atts is deprecated, use \GV\View:$settings */ |
852 | - $sort_columns = ! empty( $atts['sort_columns'] ); |
|
852 | + $sort_columns = ! empty( $atts[ 'sort_columns' ] ); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | if ( $sort_columns ) { |
856 | 856 | // add filter to enable column sorting |
857 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
857 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -862,19 +862,19 @@ discard block |
||
862 | 862 | } else { |
863 | 863 | /** $atts is deprecated, use \GV\View:$settings */ |
864 | 864 | /** $view_data is depreacted, use \GV\View properties */ |
865 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
865 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
866 | 866 | } |
867 | 867 | |
868 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
868 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
869 | 869 | |
870 | 870 | } else { |
871 | 871 | |
872 | 872 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
873 | 873 | |
874 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
874 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
875 | 875 | } |
876 | 876 | |
877 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
877 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
878 | 878 | $gravityview_view->setContext( 'directory' ); |
879 | 879 | $sections = array( 'header', 'body', 'footer' ); |
880 | 880 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | do_action( 'gravityview_render_entry_' . $view->ID ); |
892 | 892 | } else { |
893 | 893 | /** $view_data is depreacted, use \GV\View properties */ |
894 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
894 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | $entry = $this->getEntry(); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
903 | 903 | |
904 | 904 | // Only display warning once when multiple Views are embedded |
905 | - if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
905 | + if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
906 | 906 | ob_end_clean(); |
907 | 907 | return null; |
908 | 908 | } |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
928 | 928 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views(); |
929 | 929 | if ( $multiple_views && $view_id != $this->get_context_view_id() ) { |
930 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
930 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
931 | 931 | ob_end_clean(); |
932 | 932 | return null; |
933 | 933 | } |
@@ -937,14 +937,14 @@ discard block |
||
937 | 937 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
938 | 938 | |
939 | 939 | //fetch entry detail |
940 | - $view_entries['count'] = 1; |
|
941 | - $view_entries['entries'][] = $entry; |
|
942 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
940 | + $view_entries[ 'count' ] = 1; |
|
941 | + $view_entries[ 'entries' ][ ] = $entry; |
|
942 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
943 | 943 | |
944 | 944 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
945 | 945 | $back_link_label = $view->settings->get( 'back_link_label', null ); |
946 | 946 | } else { |
947 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
947 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | // set back link label |
@@ -958,8 +958,8 @@ discard block |
||
958 | 958 | self::add_style( $template_id ); |
959 | 959 | |
960 | 960 | // Prepare to render view and set vars |
961 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
962 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
961 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
962 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
963 | 963 | |
964 | 964 | // If Edit |
965 | 965 | if ( 'edit' === gravityview_get_context() ) { |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | |
977 | 977 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
978 | 978 | foreach ( $sections as $section ) { |
979 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
979 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
980 | 980 | $gravityview_view->render( $view_slug, $section, false ); |
981 | 981 | } |
982 | 982 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | $datetime_format = 'Y-m-d H:i:s'; |
1031 | 1031 | $search_is_outside_view_bounds = false; |
1032 | 1032 | |
1033 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
1033 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
1034 | 1034 | |
1035 | 1035 | $search_date = strtotime( $search_criteria[ $key ] ); |
1036 | 1036 | |
@@ -1058,14 +1058,14 @@ discard block |
||
1058 | 1058 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
1059 | 1059 | |
1060 | 1060 | // Then we override the search and re-set the start date |
1061 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
1061 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
1066 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
1067 | 1067 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
1068 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
1068 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
1069 | 1069 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
1070 | 1070 | } |
1071 | 1071 | } |
@@ -1084,19 +1084,19 @@ discard block |
||
1084 | 1084 | public static function process_search_only_approved( $args, $search_criteria ) { |
1085 | 1085 | |
1086 | 1086 | /** @since 1.19 */ |
1087 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1087 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1088 | 1088 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
1089 | 1089 | return $search_criteria; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
1092 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
1093 | 1093 | |
1094 | - $search_criteria['field_filters'][] = array( |
|
1094 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1095 | 1095 | 'key' => GravityView_Entry_Approval::meta_key, |
1096 | 1096 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
1097 | 1097 | ); |
1098 | 1098 | |
1099 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
1099 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
1100 | 1100 | |
1101 | 1101 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
1102 | 1102 | } |
@@ -1123,18 +1123,18 @@ discard block |
||
1123 | 1123 | */ |
1124 | 1124 | public static function is_entry_approved( $entry, $args = array() ) { |
1125 | 1125 | |
1126 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
1126 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
1127 | 1127 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
1128 | 1128 | return true; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | /** @since 1.19 */ |
1132 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
1132 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
1133 | 1133 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
1134 | 1134 | return true; |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
1137 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
1138 | 1138 | |
1139 | 1139 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
1140 | 1140 | } |
@@ -1168,29 +1168,29 @@ discard block |
||
1168 | 1168 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
1169 | 1169 | |
1170 | 1170 | // implicity search |
1171 | - if ( ! empty( $args['search_value'] ) ) { |
|
1171 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
1172 | 1172 | |
1173 | 1173 | // Search operator options. Options: `is` or `contains` |
1174 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
1174 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
1175 | 1175 | |
1176 | - $search_criteria['field_filters'][] = array( |
|
1176 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1177 | 1177 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
1178 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
1178 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1179 | 1179 | 'operator' => $operator, |
1180 | 1180 | ); |
1181 | 1181 | |
1182 | 1182 | // Lock search mode to "all" with implicit presearch filter. |
1183 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
1183 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | - if( $search_criteria !== $original_search_criteria ) { |
|
1186 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1187 | 1187 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | // Handle setting date range |
1191 | 1191 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
1192 | 1192 | |
1193 | - if( $search_criteria !== $original_search_criteria ) { |
|
1193 | + if ( $search_criteria !== $original_search_criteria ) { |
|
1194 | 1194 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1202 | 1202 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1203 | 1203 | */ |
1204 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1204 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1205 | 1205 | |
1206 | 1206 | return $search_criteria; |
1207 | 1207 | } |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | 'search_criteria' => $search_criteria, |
1326 | 1326 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1327 | 1327 | 'paging' => $paging, |
1328 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1328 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1329 | 1329 | ); |
1330 | 1330 | |
1331 | 1331 | /** |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1351 | 1351 | * @param array $args View configuration args. |
1352 | 1352 | */ |
1353 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1353 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1354 | 1354 | |
1355 | 1355 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1356 | 1356 | |
@@ -1375,17 +1375,17 @@ discard block |
||
1375 | 1375 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1376 | 1376 | |
1377 | 1377 | // Paging & offset |
1378 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1378 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1379 | 1379 | |
1380 | 1380 | if ( -1 === $page_size ) { |
1381 | 1381 | $page_size = PHP_INT_MAX; |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1384 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1385 | 1385 | $offset = ( $curr_page - 1 ) * $page_size; |
1386 | 1386 | |
1387 | - if ( ! empty( $args['offset'] ) ) { |
|
1388 | - $offset += intval( $args['offset'] ); |
|
1387 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1388 | + $offset += intval( $args[ 'offset' ] ); |
|
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | $paging = array( |
@@ -1409,8 +1409,8 @@ discard block |
||
1409 | 1409 | */ |
1410 | 1410 | public static function updateViewSorting( $args, $form_id ) { |
1411 | 1411 | $sorting = array(); |
1412 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1413 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1412 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1413 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1414 | 1414 | |
1415 | 1415 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1416 | 1416 | |
@@ -1450,11 +1450,11 @@ discard block |
||
1450 | 1450 | |
1451 | 1451 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1452 | 1452 | |
1453 | - if( ! $sort_field ) { |
|
1453 | + if ( ! $sort_field ) { |
|
1454 | 1454 | return $sort_field_id; |
1455 | 1455 | } |
1456 | 1456 | |
1457 | - switch ( $sort_field['type'] ) { |
|
1457 | + switch ( $sort_field[ 'type' ] ) { |
|
1458 | 1458 | |
1459 | 1459 | case 'address': |
1460 | 1460 | // Sorting by full address |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | */ |
1472 | 1472 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1473 | 1473 | |
1474 | - switch( strtolower( $address_part ) ){ |
|
1474 | + switch ( strtolower( $address_part ) ) { |
|
1475 | 1475 | case 'street': |
1476 | 1476 | $sort_field_id .= '.1'; |
1477 | 1477 | break; |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | */ |
1557 | 1557 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1558 | 1558 | |
1559 | - if ( empty( $single_entry ) ){ |
|
1559 | + if ( empty( $single_entry ) ) { |
|
1560 | 1560 | return false; |
1561 | 1561 | } else { |
1562 | 1562 | return $single_entry; |
@@ -1589,14 +1589,14 @@ discard block |
||
1589 | 1589 | $template_id = $view->template ? $view->template->ID : null; |
1590 | 1590 | $data = $view->as_data(); |
1591 | 1591 | } else { |
1592 | - $template_id = $data['template_id']; |
|
1592 | + $template_id = $data[ 'template_id' ]; |
|
1593 | 1593 | } |
1594 | 1594 | |
1595 | 1595 | /** |
1596 | 1596 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1597 | 1597 | * @since 1.15 |
1598 | 1598 | */ |
1599 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1599 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1600 | 1600 | continue; |
1601 | 1601 | } |
1602 | 1602 | |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | $lightbox = $view->settings->get( 'lightbox' ); |
1609 | 1609 | } else { |
1610 | 1610 | /** View data attributes are now stored in \GV\View::$settings */ |
1611 | - $lightbox = ! empty( $data['atts']['lightbox'] ); |
|
1611 | + $lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] ); |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | // If the thickbox is enqueued, add dependencies |
@@ -1618,13 +1618,13 @@ discard block |
||
1618 | 1618 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1619 | 1619 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1620 | 1620 | */ |
1621 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1621 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1622 | 1622 | |
1623 | 1623 | /** |
1624 | 1624 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1625 | 1625 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1626 | 1626 | */ |
1627 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1627 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1628 | 1628 | } |
1629 | 1629 | |
1630 | 1630 | /** |
@@ -1632,19 +1632,19 @@ discard block |
||
1632 | 1632 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1633 | 1633 | * @since 1.15 |
1634 | 1634 | */ |
1635 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1636 | - $css_dependencies[] = 'dashicons'; |
|
1635 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1636 | + $css_dependencies[ ] = 'dashicons'; |
|
1637 | 1637 | } |
1638 | 1638 | |
1639 | 1639 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1640 | 1640 | |
1641 | 1641 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1642 | 1642 | |
1643 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1643 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1644 | 1644 | |
1645 | 1645 | wp_enqueue_script( 'gravityview-fe-view' ); |
1646 | 1646 | |
1647 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1647 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1648 | 1648 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1649 | 1649 | } |
1650 | 1650 | |
@@ -1712,7 +1712,7 @@ discard block |
||
1712 | 1712 | } elseif ( empty( $template_id ) ) { |
1713 | 1713 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1714 | 1714 | } else { |
1715 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1715 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1716 | 1716 | } |
1717 | 1717 | |
1718 | 1718 | } |
@@ -1737,11 +1737,11 @@ discard block |
||
1737 | 1737 | * Not a table-based template; don't add sort icons |
1738 | 1738 | * @since 1.12 |
1739 | 1739 | */ |
1740 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1740 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1741 | 1741 | return $label; |
1742 | 1742 | } |
1743 | 1743 | |
1744 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1744 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1745 | 1745 | return $label; |
1746 | 1746 | } |
1747 | 1747 | |
@@ -1749,29 +1749,29 @@ discard block |
||
1749 | 1749 | |
1750 | 1750 | $class = 'gv-sort'; |
1751 | 1751 | |
1752 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1752 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1753 | 1753 | |
1754 | 1754 | $sort_args = array( |
1755 | - 'sort' => $field['id'], |
|
1755 | + 'sort' => $field[ 'id' ], |
|
1756 | 1756 | 'dir' => 'asc', |
1757 | 1757 | ); |
1758 | 1758 | |
1759 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1759 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1760 | 1760 | //toggle sorting direction. |
1761 | - if ( 'asc' === $sorting['direction'] ) { |
|
1762 | - $sort_args['dir'] = 'desc'; |
|
1761 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1762 | + $sort_args[ 'dir' ] = 'desc'; |
|
1763 | 1763 | $class .= ' gv-icon-sort-desc'; |
1764 | 1764 | } else { |
1765 | - $sort_args['dir'] = 'asc'; |
|
1765 | + $sort_args[ 'dir' ] = 'asc'; |
|
1766 | 1766 | $class .= ' gv-icon-sort-asc'; |
1767 | 1767 | } |
1768 | 1768 | } else { |
1769 | 1769 | $class .= ' gv-icon-caret-up-down'; |
1770 | 1770 | } |
1771 | 1771 | |
1772 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1772 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1773 | 1773 | |
1774 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1774 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1775 | 1775 | |
1776 | 1776 | } |
1777 | 1777 | |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | |
1790 | 1790 | $field_type = $field_id; |
1791 | 1791 | |
1792 | - if( is_numeric( $field_id ) ) { |
|
1792 | + if ( is_numeric( $field_id ) ) { |
|
1793 | 1793 | $field = GFFormsModel::get_field( $form, $field_id ); |
1794 | 1794 | $field_type = $field->type; |
1795 | 1795 | } |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | return false; |
1813 | 1813 | } |
1814 | 1814 | |
1815 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1815 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1816 | 1816 | |
1817 | 1817 | } |
1818 | 1818 |
@@ -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,17 +68,17 @@ 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 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
75 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
76 | 76 | |
77 | 77 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
78 | 78 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
79 | - )); |
|
79 | + ) ); |
|
80 | 80 | |
81 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
81 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | } |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | function widget( $args, $instance ) { |
94 | 94 | |
95 | 95 | // Don't have the Customizer render too soon. |
96 | - if( empty( $instance['view_id'] ) ) { |
|
96 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
100 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
101 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
100 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
101 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
102 | 102 | |
103 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
103 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
104 | 104 | |
105 | - echo $args['before_widget']; |
|
105 | + echo $args[ 'before_widget' ]; |
|
106 | 106 | |
107 | - if ( !empty( $title ) ) { |
|
108 | - echo $args['before_title'] . $title . $args['after_title']; |
|
107 | + if ( ! empty( $title ) ) { |
|
108 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
127 | 127 | |
128 | - echo $args['after_widget']; |
|
128 | + echo $args[ 'after_widget' ]; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | private function get_output( $instance ) { |
141 | 141 | |
142 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
142 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
143 | 143 | |
144 | 144 | $form = gravityview_get_form( $form_id ); |
145 | 145 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | * @since 1.6.1 |
150 | 150 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
151 | 151 | */ |
152 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
152 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Generate list output |
156 | 156 | * @since 1.7.2 |
157 | 157 | */ |
158 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
158 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
159 | 159 | |
160 | 160 | $output = $List->get_output(); |
161 | 161 | |
@@ -180,30 +180,30 @@ discard block |
||
180 | 180 | private function get_entries( $instance, $form_id ) { |
181 | 181 | |
182 | 182 | // Get the settings for the View ID |
183 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
183 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
184 | 184 | |
185 | 185 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
186 | - $criteria['context_view_id'] = $instance['view_id']; |
|
186 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
187 | 187 | |
188 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
189 | - $view_settings['id'] = $instance['view_id']; |
|
190 | - $view_settings['page_size'] = $instance['limit']; |
|
188 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
189 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
190 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
191 | 191 | |
192 | 192 | // Prepare paging criteria |
193 | - $criteria['paging'] = array( |
|
193 | + $criteria[ 'paging' ] = array( |
|
194 | 194 | 'offset' => 0, |
195 | - 'page_size' => $instance['limit'] |
|
195 | + 'page_size' => $instance[ 'limit' ] |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | // Prepare Search Criteria |
199 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
200 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
201 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
199 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
200 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
201 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Modify the search parameters before the entries are fetched |
205 | 205 | */ |
206 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
206 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
207 | 207 | |
208 | 208 | $results = GVCommon::get_entries( $form_id, $criteria ); |
209 | 209 | |
@@ -224,23 +224,23 @@ discard block |
||
224 | 224 | $instance = $new_instance; |
225 | 225 | |
226 | 226 | // Force positive number |
227 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
227 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
228 | 228 | |
229 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
229 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
230 | 230 | |
231 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
231 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
232 | 232 | |
233 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
233 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
234 | 234 | |
235 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
235 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
236 | 236 | |
237 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
237 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
238 | 238 | |
239 | 239 | //check if post_id is a valid post with embedded View |
240 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
240 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
241 | 241 | |
242 | 242 | // Share that the widget isn't brand new |
243 | - $instance['updated'] = 1; |
|
243 | + $instance[ 'updated' ] = 1; |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -262,22 +262,22 @@ discard block |
||
262 | 262 | |
263 | 263 | // Set up some default widget settings. |
264 | 264 | $defaults = array( |
265 | - 'title' => __('Recent Entries', 'gravityview'), |
|
265 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
266 | 266 | 'view_id' => NULL, |
267 | 267 | 'post_id' => NULL, |
268 | 268 | 'limit' => 10, |
269 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
269 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
270 | 270 | 'after_link' => '' |
271 | 271 | ); |
272 | 272 | |
273 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
273 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
274 | 274 | |
275 | 275 | ?> |
276 | 276 | |
277 | 277 | <!-- Title --> |
278 | 278 | <p> |
279 | 279 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
280 | - <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'] ); ?>" /> |
|
280 | + <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' ] ); ?>" /> |
|
281 | 281 | </p> |
282 | 282 | |
283 | 283 | <!-- Download --> |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $views = get_posts( $args ); |
291 | 291 | |
292 | 292 | // If there are no views set up yet, we get outta here. |
293 | - if( empty( $views ) ) { |
|
293 | + if ( empty( $views ) ) { |
|
294 | 294 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
295 | 295 | return; |
296 | 296 | } |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | * Display errors generated for invalid embed IDs |
303 | 303 | * @see GravityView_View_Data::is_valid_embed_id |
304 | 304 | */ |
305 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
305 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
306 | 306 | ?> |
307 | 307 | <div class="error inline hide-on-view-change"> |
308 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
308 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
309 | 309 | </div> |
310 | 310 | <?php |
311 | 311 | unset ( $error ); |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | ?> |
314 | 314 | |
315 | 315 | <p> |
316 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
316 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
317 | 317 | <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' ) ); ?>"> |
318 | 318 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
319 | 319 | <?php |
320 | 320 | |
321 | - foreach( $views as $view ) { |
|
322 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
323 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
321 | + foreach ( $views as $view ) { |
|
322 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
323 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | ?> |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | * Display errors generated for invalid embed IDs |
333 | 333 | * @see GravityView_View_Data::is_valid_embed_id |
334 | 334 | */ |
335 | - if( !empty( $instance['error_post_id'] ) ) { |
|
335 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
336 | 336 | ?> |
337 | 337 | <div class="error inline"> |
338 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
338 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
339 | 339 | </div> |
340 | 340 | <?php |
341 | 341 | unset ( $error ); |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | ?> |
344 | 344 | |
345 | 345 | <p> |
346 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
347 | - <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'] ); ?>" /> |
|
346 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
347 | + <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 | 348 | <span class="howto"><?php |
349 | - 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' ); |
|
350 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
349 | + 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' ); |
|
350 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | 351 | ?></span> |
352 | 352 | </p> |
353 | 353 | |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
356 | 356 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
357 | 357 | </label> |
358 | - <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" /> |
|
358 | + <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" /> |
|
359 | 359 | </p> |
360 | 360 | |
361 | 361 | <p> |
362 | 362 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
363 | 363 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
364 | 364 | </label> |
365 | - <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" /> |
|
365 | + <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" /> |
|
366 | 366 | </p> |
367 | 367 | |
368 | 368 | <p> |
369 | 369 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
370 | 370 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
371 | 371 | </label> |
372 | - <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> |
|
372 | + <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> |
|
373 | 373 | </p> |
374 | 374 | |
375 | 375 | <?php |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
380 | 380 | * @param array $instance Current widget instance |
381 | 381 | */ |
382 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
382 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
383 | 383 | |
384 | 384 | ?> |
385 | 385 |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
50 | 50 | |
51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
52 | 52 | |
53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
54 | 54 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public static function no_views_text() { |
65 | 65 | |
66 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
66 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
67 | 67 | return __( 'No Views found in Trash', 'gravityview' ); |
68 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
68 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
69 | 69 | return __( 'No Views found.', 'gravityview' ); |
70 | 70 | } |
71 | 71 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
110 | 110 | } |
111 | 111 | |
112 | - if( $error ) { |
|
112 | + if ( $error ) { |
|
113 | 113 | ?> |
114 | 114 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
115 | 115 | <?php echo gravityview_get_floaty(); ?> |
@@ -128,22 +128,22 @@ discard block |
||
128 | 128 | public function backend_actions() { |
129 | 129 | |
130 | 130 | /** @define "GRAVITYVIEW_DIR" "../" */ |
131 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
136 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
131 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
136 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
143 | 143 | * |
144 | 144 | * Nice place to insert extensions' backend stuff |
145 | 145 | */ |
146 | - do_action('gravityview_include_backend_actions'); |
|
146 | + do_action( 'gravityview_include_backend_actions' ); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | |
160 | 160 | $actions = array(); |
161 | 161 | |
162 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
163 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
162 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
163 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
164 | 164 | } |
165 | 165 | |
166 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
167 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
166 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
167 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return array_merge( $actions, $links ); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // By default, there will only be one item being modified. |
193 | 193 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
194 | 194 | // of modified items that will override this array. |
195 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
195 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
196 | 196 | |
197 | 197 | // If we're starting fresh, a new form was created. |
198 | 198 | // We should let the user know this is the case. |
@@ -200,60 +200,60 @@ discard block |
||
200 | 200 | |
201 | 201 | $new_form_text = ''; |
202 | 202 | |
203 | - if( !empty( $start_fresh ) ) { |
|
203 | + if ( ! empty( $start_fresh ) ) { |
|
204 | 204 | |
205 | 205 | // Get the form that was created |
206 | 206 | $connected_form = gravityview_get_form_id( $post_id ); |
207 | 207 | |
208 | - if( !empty( $connected_form ) ) { |
|
208 | + if ( ! empty( $connected_form ) ) { |
|
209 | 209 | $form = gravityview_get_form( $connected_form ); |
210 | - $form_name = esc_attr( $form['title'] ); |
|
210 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
211 | 211 | $image = self::get_floaty(); |
212 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
213 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
212 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
213 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
214 | 214 | |
215 | 215 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
216 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
216 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
217 | 217 | $new_form_text = wpautop( $new_form_text ); |
218 | 218 | |
219 | 219 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | - $messages['gravityview'] = array( |
|
223 | + $messages[ 'gravityview' ] = array( |
|
224 | 224 | 0 => '', // Unused. Messages start at index 1. |
225 | 225 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
226 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
226 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
228 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
228 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
229 | 229 | 3 => __( 'View deleted.', 'gravityview' ), |
230 | 230 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
231 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
231 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
232 | 232 | /* translators: %s: date and time of the revision */ |
233 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
233 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
234 | 234 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
235 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
235 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
237 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
237 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
238 | 238 | 8 => __( 'View submitted.', 'gravityview' ), |
239 | 239 | 9 => sprintf( |
240 | 240 | /* translators: Date and time the View is scheduled to be published */ |
241 | 241 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
242 | 242 | // translators: Publish box date format, see http://php.net/date |
243 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
243 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
244 | 244 | ) . $new_form_text, |
245 | 245 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
246 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
246 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * These apply to `bulk_post_updated_messages` |
250 | 250 | * @file wp-admin/edit.php |
251 | 251 | */ |
252 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
253 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
254 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
255 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
256 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
252 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
253 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
254 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
255 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
256 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | return $messages; |
@@ -313,29 +313,29 @@ discard block |
||
313 | 313 | static function is_admin_page( $hook = '', $page = NULL ) { |
314 | 314 | global $current_screen, $plugin_page, $pagenow, $post; |
315 | 315 | |
316 | - if( ! is_admin() ) { return false; } |
|
316 | + if ( ! is_admin() ) { return false; } |
|
317 | 317 | |
318 | 318 | $is_page = false; |
319 | 319 | |
320 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
320 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
321 | 321 | |
322 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
322 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
323 | 323 | |
324 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
324 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
325 | 325 | |
326 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
327 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
328 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
326 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
327 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
328 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
329 | 329 | } else { |
330 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
330 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
331 | 331 | } |
332 | 332 | |
333 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
333 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
334 | 334 | |
335 | 335 | // $_GET `post_type` variable |
336 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
336 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
337 | 337 | $is_page = 'single'; |
338 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
338 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
339 | 339 | $is_page = 'settings'; |
340 | 340 | } else { |
341 | 341 | $is_page = 'views'; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
351 | 351 | |
352 | 352 | // If the current page is the same as the compared page |
353 | - if( !empty( $page ) ) { |
|
353 | + if ( ! empty( $page ) ) { |
|
354 | 354 | return $is_page === $page; |
355 | 355 | } |
356 | 356 | |
@@ -371,6 +371,6 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return bool|string If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
373 | 373 | */ |
374 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
374 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
375 | 375 | return GravityView_Admin::is_admin_page( $hook, $page ); |
376 | 376 | } |