@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | var $is_searchable = false; |
13 | 13 | |
14 | - var $contexts = array( 'multiple', 'single' ); |
|
14 | + var $contexts = array('multiple', 'single'); |
|
15 | 15 | |
16 | 16 | var $group = 'gravityview'; |
17 | 17 | |
18 | 18 | public function __construct() { |
19 | - $this->label = esc_attr__( 'Other Entries', 'gravityview' ); |
|
19 | + $this->label = esc_attr__('Other Entries', 'gravityview'); |
|
20 | 20 | $this->description = __('Display other entries created by the entry creator.', 'gravityview'); |
21 | 21 | parent::__construct(); |
22 | 22 | } |
@@ -25,27 +25,27 @@ discard block |
||
25 | 25 | * @inheritDoc |
26 | 26 | * @since 1.7.2 |
27 | 27 | */ |
28 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
28 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
29 | 29 | |
30 | - if( 'edit' === $context ) { |
|
30 | + if ('edit' === $context) { |
|
31 | 31 | return $field_options; |
32 | 32 | } |
33 | 33 | |
34 | 34 | // No "Link to single entry"; all the items will be links to entries! |
35 | - unset( $field_options['show_as_link'] ); |
|
35 | + unset($field_options['show_as_link']); |
|
36 | 36 | |
37 | 37 | $new_options = array(); |
38 | 38 | |
39 | 39 | $new_options['link_format'] = array( |
40 | 40 | 'type' => 'text', |
41 | - 'label' => __( 'Entry link text (required)', 'gravityview' ), |
|
41 | + 'label' => __('Entry link text (required)', 'gravityview'), |
|
42 | 42 | 'value' => __('Entry #{entry_id}', 'gravityview'), |
43 | 43 | 'merge_tags' => 'force', |
44 | 44 | ); |
45 | 45 | |
46 | 46 | $new_options['after_link'] = array( |
47 | 47 | 'type' => 'textarea', |
48 | - 'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ), |
|
48 | + 'label' => __('Text or HTML to display after the link (optional)', 'gravityview'), |
|
49 | 49 | 'desc' => __('This content will be displayed below each entry link.', 'gravityview'), |
50 | 50 | 'value' => '', |
51 | 51 | 'merge_tags' => 'force', |
@@ -54,24 +54,24 @@ discard block |
||
54 | 54 | |
55 | 55 | $new_options['page_size'] = array( |
56 | 56 | 'type' => 'number', |
57 | - 'label' => __( 'Entries to Display', 'gravityview' ), |
|
58 | - 'desc' => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ), |
|
57 | + 'label' => __('Entries to Display', 'gravityview'), |
|
58 | + 'desc' => __('What is the maximum number of entries that should be shown?', 'gravityview'), |
|
59 | 59 | 'value' => '10', |
60 | 60 | 'merge_tags' => false, |
61 | 61 | ); |
62 | 62 | |
63 | 63 | $new_options['no_entries_hide'] = array( |
64 | 64 | 'type' => 'checkbox', |
65 | - 'label' => __( 'Hide if no entries', 'gravityview' ), |
|
66 | - 'desc' => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ), |
|
65 | + 'label' => __('Hide if no entries', 'gravityview'), |
|
66 | + 'desc' => __('Don\'t display this field if the entry creator has no other entries', 'gravityview'), |
|
67 | 67 | 'value' => false, |
68 | 68 | ); |
69 | 69 | |
70 | 70 | $new_options['no_entries_text'] = array( |
71 | 71 | 'type' => 'text', |
72 | - 'label' => __( 'No Entries Text', 'gravityview' ), |
|
73 | - 'desc' => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ), |
|
74 | - 'value' => __( 'This user has no other entries.', 'gravityview' ), |
|
72 | + 'label' => __('No Entries Text', 'gravityview'), |
|
73 | + 'desc' => __('The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview'), |
|
74 | + 'value' => __('This user has no other entries.', 'gravityview'), |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | return $new_options + $field_options; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | var $name = 'checkbox'; |
6 | 6 | |
7 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
7 | + var $search_operators = array('is', 'in', 'not in', 'isnot', 'contains'); |
|
8 | 8 | |
9 | 9 | var $_gf_field_class_name = 'GF_Field_Checkbox'; |
10 | 10 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | var $_gf_field_class_name = 'GF_Field_Text'; |
8 | 8 | |
9 | - var $search_operators = array( 'contains', 'is', 'isnot', 'starts_with', 'ends_with' ); |
|
9 | + var $search_operators = array('contains', 'is', 'isnot', 'starts_with', 'ends_with'); |
|
10 | 10 | |
11 | 11 | var $group = 'standard'; |
12 | 12 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | var $name = 'time'; |
9 | 9 | |
10 | - var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' ); |
|
10 | + var $search_operators = array('is', 'isnot', 'greater_than', 'less_than'); |
|
11 | 11 | |
12 | 12 | var $_gf_field_class_name = 'GF_Field_Time'; |
13 | 13 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | parent::__construct(); |
46 | 46 | |
47 | - add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
|
47 | + add_filter('gravityview/sorting/time', array($this, 'modify_sort_id'), 10, 2); |
|
48 | 48 | |
49 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
49 | + add_filter('gravityview_search_criteria', array($this, '_maybe_filter_gravity_forms_query'), 10, 4); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string Modified sort key imploded with $_sort_divider, like `5|:time:|12|:time:|h:i A` |
62 | 62 | */ |
63 | - public function modify_sort_id( $sort_field_id, $form_id ) { |
|
63 | + public function modify_sort_id($sort_field_id, $form_id) { |
|
64 | 64 | |
65 | - $time_format = self::_get_time_format_for_field( $sort_field_id, $form_id ); |
|
65 | + $time_format = self::_get_time_format_for_field($sort_field_id, $form_id); |
|
66 | 66 | |
67 | - $date_format = self::date_format( $time_format, $sort_field_id ); |
|
67 | + $date_format = self::date_format($time_format, $sort_field_id); |
|
68 | 68 | |
69 | 69 | // Should look something like `5|:time:|12|:time:|h:i A` |
70 | - $new_sort_field_id = implode( $this->_sort_divider, array( $sort_field_id, $time_format, $date_format ) ); |
|
70 | + $new_sort_field_id = implode($this->_sort_divider, array($sort_field_id, $time_format, $date_format)); |
|
71 | 71 | |
72 | 72 | return $new_sort_field_id; |
73 | 73 | } |
@@ -84,25 +84,25 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return $criteria If a match, the sorting will be updated to set `is_numeric` to true and make sure the field ID is an int |
86 | 86 | */ |
87 | - public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
|
87 | + public function _maybe_filter_gravity_forms_query($criteria, $form_ids, $view_id) { |
|
88 | 88 | |
89 | 89 | // If the search is being sorted |
90 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
90 | + if (!empty($criteria['sorting']['key'])) { |
|
91 | 91 | |
92 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
92 | + $pieces = explode($this->_sort_divider, $criteria['sorting']['key']); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
96 | 96 | * @see modify_sort_id() |
97 | 97 | */ |
98 | - if( ! empty( $pieces[1] ) ) { |
|
98 | + if (!empty($pieces[1])) { |
|
99 | 99 | |
100 | 100 | // Pass these to the _modify_query_sort_by_time_hack() method |
101 | 101 | $this->_time_format = $pieces[1]; |
102 | 102 | $this->_date_format = $pieces[2]; |
103 | 103 | |
104 | 104 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
105 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
105 | + $criteria['sorting']['key'] = floor($pieces[0]); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $criteria['sorting']['is_numeric'] = true; |
112 | 112 | |
113 | 113 | // Modify the Gravity Forms WP Query |
114 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
114 | + add_filter('query', array($this, '_modify_query_sort_by_time_hack')); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -127,22 +127,22 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return string Modified query, if the query matches the expected Gravity Forms SQL string used for sorting time fields. Otherwise, original query. |
129 | 129 | */ |
130 | - function _modify_query_sort_by_time_hack( $query ) { |
|
130 | + function _modify_query_sort_by_time_hack($query) { |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * If this is a Gravity Forms entry selection sorting query, generated by sort_by_field_query(), |
134 | 134 | * then we want to modify the query. |
135 | 135 | * @see GFFormsModel::sort_by_field_query() |
136 | 136 | */ |
137 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
137 | + if (strpos($query, self::GF_SORTING_SQL) > 0) { |
|
138 | 138 | |
139 | - if( $this->_time_format === '24' ) { |
|
139 | + if ($this->_time_format === '24') { |
|
140 | 140 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
141 | 141 | } else { |
142 | 142 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
143 | 143 | } |
144 | 144 | |
145 | - switch ( $this->_date_format ) { |
|
145 | + switch ($this->_date_format) { |
|
146 | 146 | case 'h': |
147 | 147 | case 'H': |
148 | 148 | $modification = "TIME_FORMAT( {$sql_str_to_date}, '%H' )"; |
@@ -160,40 +160,40 @@ discard block |
||
160 | 160 | * Convert the time (12:30 pm) to the MySQL `TIME_TO_SEC()` value for that time (45000) |
161 | 161 | * This way, Gravity Forms is able to sort numerically. |
162 | 162 | */ |
163 | - $replacement_query = str_replace( 'value', "{$modification} as value", self::GF_SORTING_SQL ); |
|
163 | + $replacement_query = str_replace('value', "{$modification} as value", self::GF_SORTING_SQL); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Replace it in the main query |
167 | 167 | */ |
168 | - $query = str_replace( self::GF_SORTING_SQL, $replacement_query, $query ); |
|
168 | + $query = str_replace(self::GF_SORTING_SQL, $replacement_query, $query); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * REMOVE the Gravity Forms WP Query modifications! |
172 | 172 | */ |
173 | - remove_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
173 | + remove_filter('query', array($this, '_modify_query_sort_by_time_hack')); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | return $query; |
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | - function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
180 | + function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') { |
|
181 | 181 | |
182 | 182 | // Set variables |
183 | - parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
|
183 | + parent::field_options($field_options, $template_id, $field_id, $context, $input_type); |
|
184 | 184 | |
185 | - if( 'edit' === $context ) { |
|
185 | + if ('edit' === $context) { |
|
186 | 186 | return $field_options; |
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Set default date format based on field ID and Form ID |
191 | 191 | */ |
192 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
192 | + add_filter('gravityview_date_format', array($this, '_filter_date_display_date_format')); |
|
193 | 193 | |
194 | - $this->add_field_support('date_display', $field_options ); |
|
194 | + $this->add_field_support('date_display', $field_options); |
|
195 | 195 | |
196 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
196 | + remove_filter('gravityview_date_format', array($this, '_filter_date_display_date_format')); |
|
197 | 197 | |
198 | 198 | return $field_options; |
199 | 199 | } |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | private function _get_time_format() { |
209 | 209 | global $post; |
210 | 210 | |
211 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
211 | + $current_form = isset($_POST['form_id']) ? intval($_POST['form_id']) : gravityview_get_form_id($post->ID); |
|
212 | 212 | |
213 | - return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
|
213 | + return self::_get_time_format_for_field($this->_field_id, $current_form); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -222,17 +222,17 @@ discard block |
||
222 | 222 | * @param int $form_id ID for Gravity Forms form |
223 | 223 | * @return string Either "12" or "24". "12" is default. |
224 | 224 | */ |
225 | - static public function _get_time_format_for_field( $field_id, $form_id = 0 ) { |
|
225 | + static public function _get_time_format_for_field($field_id, $form_id = 0) { |
|
226 | 226 | |
227 | 227 | // GF defaults to 12, so should we. |
228 | 228 | $time_format = '12'; |
229 | 229 | |
230 | - if( $form_id ) { |
|
231 | - $form = GFAPI::get_form( $form_id ); |
|
230 | + if ($form_id) { |
|
231 | + $form = GFAPI::get_form($form_id); |
|
232 | 232 | |
233 | - if ( $form ) { |
|
234 | - $field = GFFormsModel::get_field( $form, floor( $field_id ) ); |
|
235 | - if ( $field && $field instanceof GF_Field_Time ) { |
|
233 | + if ($form) { |
|
234 | + $field = GFFormsModel::get_field($form, floor($field_id)); |
|
235 | + if ($field && $field instanceof GF_Field_Time) { |
|
236 | 236 | $field->sanitize_settings(); // Make sure time is set |
237 | 237 | $time_format = $field->timeFormat; |
238 | 238 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $time_format = $this->_get_time_format(); |
255 | 255 | $field_id = $this->_field_id; |
256 | 256 | |
257 | - return self::date_format( $time_format, $field_id ); |
|
257 | + return self::date_format($time_format, $field_id); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -267,19 +267,19 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return string PHP date format for the time |
269 | 269 | */ |
270 | - static public function date_format( $time_format = '12', $field_id = 0 ) { |
|
270 | + static public function date_format($time_format = '12', $field_id = 0) { |
|
271 | 271 | |
272 | - $field_id_array = explode( '.', $field_id ); |
|
272 | + $field_id_array = explode('.', $field_id); |
|
273 | 273 | |
274 | - $field_input_id = isset( $field_id_array[1] ) ? intval( $field_id_array[1] ) : 0; |
|
274 | + $field_input_id = isset($field_id_array[1]) ? intval($field_id_array[1]) : 0; |
|
275 | 275 | |
276 | 276 | $default = 'h:i A'; |
277 | 277 | |
278 | 278 | // This doesn't take into account 24-hour |
279 | - switch( $field_input_id ) { |
|
279 | + switch ($field_input_id) { |
|
280 | 280 | // Hours |
281 | 281 | case 1: |
282 | - return ( $time_format === '12' ) ? 'h' : 'H'; |
|
282 | + return ($time_format === '12') ? 'h' : 'H'; |
|
283 | 283 | break; |
284 | 284 | // Minutes |
285 | 285 | case 2: |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | break; |
292 | 292 | // Full time field |
293 | 293 | case 0: |
294 | - return ( $time_format === '12' ) ? $default : 'H:i'; |
|
294 | + return ($time_format === '12') ? $default : 'H:i'; |
|
295 | 295 | break; |
296 | 296 | } |
297 | 297 |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @param string $prevent_multiple_instances |
71 | 71 | */ |
72 | - public function __construct( $prevent_multiple_instances = '' ) { |
|
72 | + public function __construct($prevent_multiple_instances = '') { |
|
73 | 73 | |
74 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
74 | + if ($prevent_multiple_instances === 'get_instance') { |
|
75 | 75 | return parent::__construct(); |
76 | 76 | } |
77 | 77 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function get_instance() { |
85 | 85 | |
86 | - if( empty( self::$instance ) ) { |
|
87 | - self::$instance = new self( 'get_instance' ); |
|
86 | + if (empty(self::$instance)) { |
|
87 | + self::$instance = new self('get_instance'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return self::$instance; |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - public function current_user_can_any( $caps ) { |
|
103 | + public function current_user_can_any($caps) { |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Prevent Gravity Forms from showing the uninstall tab on the settings page |
107 | 107 | * @hack |
108 | 108 | */ |
109 | - if( $caps === $this->_capabilities_uninstall ) { |
|
109 | + if ($caps === $this->_capabilities_uninstall) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - if( empty( $caps ) ) { |
|
114 | - $caps = array( 'gravityview_full_access' ); |
|
113 | + if (empty($caps)) { |
|
114 | + $caps = array('gravityview_full_access'); |
|
115 | 115 | } |
116 | 116 | |
117 | - return GVCommon::has_cap( $caps ); |
|
117 | + return GVCommon::has_cap($caps); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | |
131 | 131 | $this->license_key_notice(); |
132 | 132 | |
133 | - add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
|
133 | + add_filter('gform_addon_app_settings_menu_gravityview', array($this, 'modify_app_settings_menu_title')); |
|
134 | 134 | |
135 | 135 | /** @since 1.7.6 */ |
136 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
136 | + add_action('network_admin_menu', array($this, 'add_network_menu')); |
|
137 | 137 | |
138 | 138 | parent::init_admin(); |
139 | 139 | } |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @return array |
147 | 147 | */ |
148 | - public function modify_app_settings_menu_title( $setting_tabs ) { |
|
148 | + public function modify_app_settings_menu_title($setting_tabs) { |
|
149 | 149 | |
150 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
150 | + $setting_tabs[0]['label'] = __('GravityView Settings', 'gravityview'); |
|
151 | 151 | |
152 | 152 | return $setting_tabs; |
153 | 153 | } |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _load_license_handler() { |
166 | 166 | |
167 | - if( !empty( $this->License_Handler ) ) { |
|
167 | + if (!empty($this->License_Handler)) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
171 | + require_once(GRAVITYVIEW_DIR.'includes/class-gv-license-handler.php'); |
|
172 | 172 | |
173 | - $this->License_Handler = GV_License_Handler::get_instance( $this ); |
|
173 | + $this->License_Handler = GV_License_Handler::get_instance($this); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | function license_key_notice() { |
181 | 181 | |
182 | 182 | // Only show on GravityView pages |
183 | - if( ! gravityview_is_admin_page() ) { |
|
183 | + if (!gravityview_is_admin_page()) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | 187 | $license_status = self::getSetting('license_key_status'); |
188 | 188 | $license_id = self::getSetting('license_key'); |
189 | - $license_id = empty( $license_id ) ? 'license' : $license_id; |
|
189 | + $license_id = empty($license_id) ? 'license' : $license_id; |
|
190 | 190 | |
191 | 191 | $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
192 | 192 | |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * I wanted to remove the period from after the buttons in the string, |
195 | 195 | * but didn't want to mess up the translation strings for the translators. |
196 | 196 | */ |
197 | - $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
|
197 | + $message = mb_substr($message, 0, mb_strlen($message) - 1); |
|
198 | 198 | $title = __('Inactive License', 'gravityview'); |
199 | 199 | $status = ''; |
200 | 200 | $update_below = false; |
201 | - $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
|
202 | - switch ( $license_status ) { |
|
201 | + $primary_button_link = admin_url('edit.php?post_type=gravityview&page=gravityview_settings'); |
|
202 | + switch ($license_status) { |
|
203 | 203 | case 'invalid': |
204 | 204 | $title = __('Invalid License', 'gravityview'); |
205 | 205 | $status = __('is invalid', 'gravityview'); |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
221 | 221 | |
222 | 222 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
223 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
224 | - $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
|
223 | + if ($update_below && gravityview_is_admin_page('', 'settings')) { |
|
224 | + $message = sprintf($message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">'.$update_below.'</a>'); |
|
225 | 225 | } else { |
226 | - $message = sprintf( $message, $status, "\n\n" . '<a href="' . $primary_button_link . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
|
226 | + $message = sprintf($message, $status, "\n\n".'<a href="'.$primary_button_link.'" class="button button-primary">', '</a>', '<a href="'.esc_url($url).'" class="button button-secondary">', '</a>'); |
|
227 | 227 | } |
228 | 228 | |
229 | - if( !empty( $status ) ) { |
|
230 | - GravityView_Admin_Notices::add_notice( array( |
|
229 | + if (!empty($status)) { |
|
230 | + GravityView_Admin_Notices::add_notice(array( |
|
231 | 231 | 'message' => $message, |
232 | 232 | 'class' => 'updated', |
233 | 233 | 'title' => $title, |
234 | 234 | 'cap' => 'gravityview_edit_settings', |
235 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
235 | + 'dismiss' => sha1($license_status.'_'.$license_id), |
|
236 | 236 | )); |
237 | 237 | } |
238 | 238 | } |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | |
248 | 248 | $styles[] = array( |
249 | 249 | 'handle' => 'gravityview_settings', |
250 | - 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
|
250 | + 'src' => plugins_url('assets/css/admin-settings.css', GRAVITYVIEW_FILE), |
|
251 | 251 | 'version' => GravityView_Plugin::version, |
252 | 252 | "deps" => array( |
253 | 253 | 'gaddon_form_settings_css' |
254 | 254 | ), |
255 | 255 | 'enqueue' => array( |
256 | - array( 'admin_page' => array( |
|
256 | + array('admin_page' => array( |
|
257 | 257 | 'app_settings' |
258 | - ) ), |
|
258 | + )), |
|
259 | 259 | ) |
260 | 260 | ); |
261 | 261 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | * @return void |
269 | 269 | */ |
270 | 270 | public function add_network_menu() { |
271 | - if( GravityView_Plugin::is_network_activated() ) { |
|
272 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
271 | + if (GravityView_Plugin::is_network_activated()) { |
|
272 | + add_menu_page(__('Settings', 'gravityview'), __('GravityView', 'gravityview'), $this->_capabilities_app_settings, "{$this->_slug}_settings", array($this, 'app_tab_page'), 'none'); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | * If multisite and not network admin, we don't want the settings to show. |
286 | 286 | * @since 1.7.6 |
287 | 287 | */ |
288 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
288 | + $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || (is_network_admin() && GravityView_Plugin::is_network_activated()); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Override whether to show the Settings menu on a per-blog basis. |
292 | 292 | * @since 1.7.6 |
293 | 293 | * @param bool $hide_if_network_activated Default: true |
294 | 294 | */ |
295 | - $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
|
295 | + $show_submenu = apply_filters('gravityview/show-settings-menu', $show_submenu); |
|
296 | 296 | |
297 | - if( $show_submenu ) { |
|
298 | - add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
|
297 | + if ($show_submenu) { |
|
298 | + add_submenu_page('edit.php?post_type=gravityview', __('Settings', 'gravityview'), __('Settings', 'gravityview'), $this->_capabilities_app_settings, $this->_slug.'_settings', array($this, 'app_tab_page')); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @inheritDoc |
321 | 321 | * @access public |
322 | 322 | */ |
323 | - public function get_app_setting( $setting_name ) { |
|
323 | + public function get_app_setting($setting_name) { |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Backward compatibility with Redux |
327 | 327 | */ |
328 | - if( $setting_name === 'license' ) { |
|
328 | + if ($setting_name === 'license') { |
|
329 | 329 | return array( |
330 | - 'license' => parent::get_app_setting( 'license_key' ), |
|
331 | - 'status' => parent::get_app_setting( 'license_key_status' ), |
|
332 | - 'response' => parent::get_app_setting( 'license_key_response' ), |
|
330 | + 'license' => parent::get_app_setting('license_key'), |
|
331 | + 'status' => parent::get_app_setting('license_key_status'), |
|
332 | + 'response' => parent::get_app_setting('license_key_response'), |
|
333 | 333 | ); |
334 | 334 | } |
335 | 335 | |
336 | - return parent::get_app_setting( $setting_name ); |
|
336 | + return parent::get_app_setting($setting_name); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @return array |
349 | 349 | */ |
350 | 350 | public function get_app_settings() { |
351 | - return get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $this->get_default_settings() ); |
|
351 | + return get_option('gravityformsaddon_'.$this->_slug.'_app_settings', $this->get_default_settings()); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | * |
362 | 362 | * @return boolean False if value was not updated and true if value was updated. |
363 | 363 | */ |
364 | - public function update_app_settings( $settings ) { |
|
365 | - return update_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $settings ); |
|
364 | + public function update_app_settings($settings) { |
|
365 | + return update_option('gravityformsaddon_'.$this->_slug.'_app_settings', $settings); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | * @inheritDoc |
371 | 371 | * @access public |
372 | 372 | */ |
373 | - public function set_field_error( $field, $error_message = '' ) { |
|
374 | - parent::set_field_error( $field, $error_message ); |
|
373 | + public function set_field_error($field, $error_message = '') { |
|
374 | + parent::set_field_error($field, $error_message); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -381,15 +381,15 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @return string |
383 | 383 | */ |
384 | - protected function settings_edd_license( $field, $echo = true ) { |
|
384 | + protected function settings_edd_license($field, $echo = true) { |
|
385 | 385 | |
386 | - $text = self::settings_text( $field, false ); |
|
386 | + $text = self::settings_text($field, false); |
|
387 | 387 | |
388 | - $activation = $this->License_Handler->settings_edd_license_activation( $field, false ); |
|
388 | + $activation = $this->License_Handler->settings_edd_license_activation($field, false); |
|
389 | 389 | |
390 | - $return = $text . $activation; |
|
390 | + $return = $text.$activation; |
|
391 | 391 | |
392 | - if( $echo ) { |
|
392 | + if ($echo) { |
|
393 | 393 | echo $return; |
394 | 394 | } |
395 | 395 | |
@@ -414,32 +414,32 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @return string The HTML |
416 | 416 | */ |
417 | - public function settings_submit( $field, $echo = true ) { |
|
417 | + public function settings_submit($field, $echo = true) { |
|
418 | 418 | |
419 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
419 | + $field['type'] = (isset($field['type']) && in_array($field['type'], array('submit', 'reset', 'button'))) ? $field['type'] : 'submit'; |
|
420 | 420 | |
421 | - $attributes = $this->get_field_attributes( $field ); |
|
422 | - $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
|
423 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
421 | + $attributes = $this->get_field_attributes($field); |
|
422 | + $default_value = rgar($field, 'value') ? rgar($field, 'value') : rgar($field, 'default_value'); |
|
423 | + $value = $this->get_setting($field['name'], $default_value); |
|
424 | 424 | |
425 | 425 | |
426 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
427 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
426 | + $attributes['class'] = isset($attributes['class']) ? esc_attr($attributes['class']) : 'button-primary gfbutton'; |
|
427 | + $name = ($field['name'] === 'gform-settings-save') ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
428 | 428 | |
429 | - if ( empty( $value ) ) { |
|
430 | - $value = __( 'Update Settings', 'gravityview' ); |
|
429 | + if (empty($value)) { |
|
430 | + $value = __('Update Settings', 'gravityview'); |
|
431 | 431 | } |
432 | 432 | |
433 | - $attributes = $this->get_field_attributes( $field ); |
|
433 | + $attributes = $this->get_field_attributes($field); |
|
434 | 434 | |
435 | 435 | $html = '<input |
436 | - type="' . $field['type'] . '" |
|
437 | - name="' . esc_attr( $name ) . '" |
|
438 | - value="' . $value . '" ' . |
|
439 | - implode( ' ', $attributes ) . |
|
436 | + type="' . $field['type'].'" |
|
437 | + name="' . esc_attr($name).'" |
|
438 | + value="' . $value.'" '. |
|
439 | + implode(' ', $attributes). |
|
440 | 440 | ' />'; |
441 | 441 | |
442 | - if ( $echo ) { |
|
442 | + if ($echo) { |
|
443 | 443 | echo $html; |
444 | 444 | } |
445 | 445 | |
@@ -454,17 +454,17 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @return string |
456 | 456 | */ |
457 | - public function settings_save( $field, $echo = true ) { |
|
457 | + public function settings_save($field, $echo = true) { |
|
458 | 458 | $field['type'] = 'submit'; |
459 | 459 | $field['name'] = 'gform-settings-save'; |
460 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
460 | + $field['class'] = isset($field['class']) ? $field['class'] : 'button-primary gfbutton'; |
|
461 | 461 | |
462 | - if ( ! rgar( $field, 'value' ) ) |
|
463 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
462 | + if (!rgar($field, 'value')) |
|
463 | + $field['value'] = __('Update Settings', 'gravityview'); |
|
464 | 464 | |
465 | - $output = $this->settings_submit( $field, false ); |
|
465 | + $output = $this->settings_submit($field, false); |
|
466 | 466 | |
467 | - if( $echo ) { |
|
467 | + if ($echo) { |
|
468 | 468 | echo $output; |
469 | 469 | } |
470 | 470 | |
@@ -476,22 +476,22 @@ discard block |
||
476 | 476 | * @inheritDoc |
477 | 477 | * @param $field array |
478 | 478 | */ |
479 | - public function single_setting_label( $field ) { |
|
479 | + public function single_setting_label($field) { |
|
480 | 480 | |
481 | 481 | echo $field['label']; |
482 | 482 | |
483 | 483 | |
484 | - if ( isset( $field['tooltip'] ) ) { |
|
485 | - echo ' ' . gform_tooltip( $field['tooltip'], rgar( $field, 'tooltip_class' ), true ); |
|
484 | + if (isset($field['tooltip'])) { |
|
485 | + echo ' '.gform_tooltip($field['tooltip'], rgar($field, 'tooltip_class'), true); |
|
486 | 486 | } |
487 | 487 | |
488 | - if ( rgar( $field, 'required' ) ) { |
|
489 | - echo ' ' . $this->get_required_indicator( $field ); |
|
488 | + if (rgar($field, 'required')) { |
|
489 | + echo ' '.$this->get_required_indicator($field); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | // Added by GravityView |
493 | - if ( isset( $field['description'] ) ) { |
|
494 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
493 | + if (isset($field['description'])) { |
|
494 | + echo '<span class="description">'.$field['description'].'</span>'; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | } |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | |
508 | 508 | $defaults = array( |
509 | 509 | // Set the default license in wp-config.php |
510 | - 'license_key' => defined( 'GRAVITYVIEW_LICENSE_KEY' ) ? GRAVITYVIEW_LICENSE_KEY : '', |
|
510 | + 'license_key' => defined('GRAVITYVIEW_LICENSE_KEY') ? GRAVITYVIEW_LICENSE_KEY : '', |
|
511 | 511 | 'license_key_response' => '', |
512 | 512 | 'license_key_status' => '', |
513 | - 'support-email' => get_bloginfo( 'admin_email' ), |
|
513 | + 'support-email' => get_bloginfo('admin_email'), |
|
514 | 514 | 'no-conflict-mode' => '0', |
515 | 515 | 'support_port' => '1', |
516 | 516 | 'delete-on-uninstall' => '0', |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | */ |
529 | 529 | public function maybe_save_app_settings() { |
530 | 530 | |
531 | - if ( $this->is_save_postback() ) { |
|
532 | - if ( ! GVCommon::has_cap( 'gravityview_edit_settings' ) ) { |
|
531 | + if ($this->is_save_postback()) { |
|
532 | + if (!GVCommon::has_cap('gravityview_edit_settings')) { |
|
533 | 533 | $_POST = array(); // If you don't reset the $_POST array, it *looks* like the settings were changed, but they weren't |
534 | - GFCommon::add_error_message( __( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ) ); |
|
534 | + GFCommon::add_error_message(__('You don\'t have the ability to edit plugin settings.', 'gravityview')); |
|
535 | 535 | return; |
536 | 536 | } |
537 | 537 | } |
@@ -548,16 +548,16 @@ discard block |
||
548 | 548 | |
549 | 549 | $posted_settings = parent::get_posted_settings(); |
550 | 550 | |
551 | - $local_key = rgar( $posted_settings, 'license_key' ); |
|
552 | - $response_key = rgars( $posted_settings, 'license_key_response/license_key' ); |
|
551 | + $local_key = rgar($posted_settings, 'license_key'); |
|
552 | + $response_key = rgars($posted_settings, 'license_key_response/license_key'); |
|
553 | 553 | |
554 | 554 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
555 | 555 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
556 | - if( $local_key !== $response_key ) { |
|
556 | + if ($local_key !== $response_key) { |
|
557 | 557 | |
558 | - unset( $posted_settings['license_key_response'] ); |
|
559 | - unset( $posted_settings['license_key_status'] ); |
|
560 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
558 | + unset($posted_settings['license_key_response']); |
|
559 | + unset($posted_settings['license_key_status']); |
|
560 | + GFCommon::add_error_message(__('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview')); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | return $posted_settings; |
@@ -571,8 +571,8 @@ discard block |
||
571 | 571 | * |
572 | 572 | * @return string - Returns markup of the required indicator symbol |
573 | 573 | */ |
574 | - public function get_required_indicator( $field ) { |
|
575 | - return '<span class="required" title="' . esc_attr__( 'Required', 'gravityview' ) . '">*</span>'; |
|
574 | + public function get_required_indicator($field) { |
|
575 | + return '<span class="required" title="'.esc_attr__('Required', 'gravityview').'">*</span>'; |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -583,18 +583,18 @@ discard block |
||
583 | 583 | |
584 | 584 | $default_settings = $this->get_default_settings(); |
585 | 585 | |
586 | - $disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled'; |
|
586 | + $disabled_attribute = GVCommon::has_cap('gravityview_edit_settings') ? false : 'disabled'; |
|
587 | 587 | |
588 | - $fields = apply_filters( 'gravityview_settings_fields', array( |
|
588 | + $fields = apply_filters('gravityview_settings_fields', array( |
|
589 | 589 | array( |
590 | 590 | 'name' => 'license_key', |
591 | 591 | 'required' => true, |
592 | - 'label' => __( 'License Key', 'gravityview' ), |
|
593 | - 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
|
592 | + 'label' => __('License Key', 'gravityview'), |
|
593 | + 'description' => __('Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview'), |
|
594 | 594 | 'type' => 'edd_license', |
595 | 595 | 'data-pending-text' => __('Verifying license…', 'gravityview'), |
596 | 596 | 'default_value' => $default_settings['license_key'], |
597 | - 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
|
597 | + 'class' => ('' == $this->get_app_setting('license_key')) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
|
598 | 598 | ), |
599 | 599 | array( |
600 | 600 | 'name' => 'license_key_response', |
@@ -611,8 +611,8 @@ discard block |
||
611 | 611 | 'type' => 'text', |
612 | 612 | 'validate' => 'email', |
613 | 613 | 'default_value' => $default_settings['support-email'], |
614 | - 'label' => __( 'Support Email', 'gravityview' ), |
|
615 | - 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
|
614 | + 'label' => __('Support Email', 'gravityview'), |
|
615 | + 'description' => __('In order to provide responses to your support requests, please provide your email address.', 'gravityview'), |
|
616 | 616 | 'class' => 'code regular-text', |
617 | 617 | ), |
618 | 618 | /** |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | array( |
622 | 622 | 'name' => 'support_port', |
623 | 623 | 'type' => 'radio', |
624 | - 'label' => __( 'Show Support Port?', 'gravityview' ), |
|
624 | + 'label' => __('Show Support Port?', 'gravityview'), |
|
625 | 625 | 'default_value' => $default_settings['support_port'], |
626 | 626 | 'horizontal' => 1, |
627 | 627 | 'choices' => array( |
@@ -634,13 +634,13 @@ discard block |
||
634 | 634 | 'value' => '0', |
635 | 635 | ), |
636 | 636 | ), |
637 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
638 | - 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
|
637 | + 'tooltip' => '<p><img src="'.esc_url_raw(plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE)).'" alt="'.esc_attr__('The Support Port looks like this.', 'gravityview').'" class="alignright" style="max-width:40px; margin:.5em;" />'.esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview').'</p>', |
|
638 | + 'description' => __('Show the Support Port on GravityView pages?', 'gravityview'), |
|
639 | 639 | ), |
640 | 640 | array( |
641 | 641 | 'name' => 'no-conflict-mode', |
642 | 642 | 'type' => 'radio', |
643 | - 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
|
643 | + 'label' => __('No-Conflict Mode', 'gravityview'), |
|
644 | 644 | 'default_value' => $default_settings['no-conflict-mode'], |
645 | 645 | 'horizontal' => 1, |
646 | 646 | 'choices' => array( |
@@ -653,30 +653,30 @@ discard block |
||
653 | 653 | 'value' => '0', |
654 | 654 | ), |
655 | 655 | ), |
656 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
656 | + 'description' => __('Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview').' '.__('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
657 | 657 | ), |
658 | 658 | array( |
659 | 659 | 'name' => 'delete-on-uninstall', |
660 | 660 | 'type' => 'radio', |
661 | - 'label' => __( 'Remove Data on Delete?', 'gravityview' ), |
|
661 | + 'label' => __('Remove Data on Delete?', 'gravityview'), |
|
662 | 662 | 'default_value' => $default_settings['delete-on-uninstall'], |
663 | 663 | 'horizontal' => 1, |
664 | 664 | 'choices' => array( |
665 | 665 | array( |
666 | - 'label' => _x( 'Keep GravityView Data', 'Setting: what to do when uninstalling plugin', 'gravityview' ), |
|
666 | + 'label' => _x('Keep GravityView Data', 'Setting: what to do when uninstalling plugin', 'gravityview'), |
|
667 | 667 | 'value' => '0', |
668 | - 'tooltip' => sprintf( '<h6>%s</h6><p>%s</p>', __( 'Keep GravityView content and settings', 'gravityview' ), __( 'If you delete then re-install the plugin, all GravityView data will be kept. Views, settings, etc. will be untouched.', 'gravityview' ) ), |
|
668 | + 'tooltip' => sprintf('<h6>%s</h6><p>%s</p>', __('Keep GravityView content and settings', 'gravityview'), __('If you delete then re-install the plugin, all GravityView data will be kept. Views, settings, etc. will be untouched.', 'gravityview')), |
|
669 | 669 | ), |
670 | 670 | array( |
671 | - 'label' => _x( 'Permanently Delete', 'Setting: what to do when uninstalling plugin', 'gravityview' ), |
|
671 | + 'label' => _x('Permanently Delete', 'Setting: what to do when uninstalling plugin', 'gravityview'), |
|
672 | 672 | 'value' => 'delete', |
673 | - 'tooltip' => sprintf( '<h6>%s</h6><p><span class="howto">%s</span></p><p>%s</p>', __( 'Delete all GravityView content and settings', 'gravityview' ), __( 'If you delete then re-install GravityView, it will be like installing GravityView for the first time.', 'gravityview' ), __( 'When GravityView is uninstalled and deleted, delete all Views, GravityView entry approvals, GravityView-generated entry notes (including approval and entry creator changes), and GravityView plugin settings. No Gravity Forms data will be touched.', 'gravityview' ) ), |
|
673 | + 'tooltip' => sprintf('<h6>%s</h6><p><span class="howto">%s</span></p><p>%s</p>', __('Delete all GravityView content and settings', 'gravityview'), __('If you delete then re-install GravityView, it will be like installing GravityView for the first time.', 'gravityview'), __('When GravityView is uninstalled and deleted, delete all Views, GravityView entry approvals, GravityView-generated entry notes (including approval and entry creator changes), and GravityView plugin settings. No Gravity Forms data will be touched.', 'gravityview')), |
|
674 | 674 | ), |
675 | 675 | ), |
676 | - 'description' => sprintf( __( 'Should GravityView content and entry approval status be removed from the site when the GravityView plugin is deleted?', 'gravityview' ), __( 'Permanently Delete', 'gravityview' ) ), |
|
676 | + 'description' => sprintf(__('Should GravityView content and entry approval status be removed from the site when the GravityView plugin is deleted?', 'gravityview'), __('Permanently Delete', 'gravityview')), |
|
677 | 677 | ), |
678 | 678 | |
679 | - ) ); |
|
679 | + )); |
|
680 | 680 | |
681 | 681 | |
682 | 682 | |
@@ -684,21 +684,21 @@ discard block |
||
684 | 684 | * Redux backward compatibility |
685 | 685 | * @since 1.7.4 |
686 | 686 | */ |
687 | - foreach ( $fields as &$field ) { |
|
688 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
689 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
690 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
691 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
692 | - |
|
693 | - if( $disabled_attribute ) { |
|
694 | - $field['disabled'] = $disabled_attribute; |
|
687 | + foreach ($fields as &$field) { |
|
688 | + $field['name'] = isset($field['name']) ? $field['name'] : rgget('id', $field); |
|
689 | + $field['label'] = isset($field['label']) ? $field['label'] : rgget('title', $field); |
|
690 | + $field['default_value'] = isset($field['default_value']) ? $field['default_value'] : rgget('default', $field); |
|
691 | + $field['description'] = isset($field['description']) ? $field['description'] : rgget('subtitle', $field); |
|
692 | + |
|
693 | + if ($disabled_attribute) { |
|
694 | + $field['disabled'] = $disabled_attribute; |
|
695 | 695 | } |
696 | 696 | } |
697 | 697 | |
698 | 698 | |
699 | 699 | $sections = array( |
700 | 700 | array( |
701 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
701 | + 'description' => sprintf('<span class="version-info description">%s</span>', sprintf(__('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version)), |
|
702 | 702 | 'fields' => $fields, |
703 | 703 | ) |
704 | 704 | ); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | 'type' => 'save', |
710 | 710 | ); |
711 | 711 | |
712 | - if( $disabled_attribute ) { |
|
712 | + if ($disabled_attribute) { |
|
713 | 713 | $button['disabled'] = $disabled_attribute; |
714 | 714 | } |
715 | 715 | |
@@ -725,22 +725,22 @@ discard block |
||
725 | 725 | * </code> |
726 | 726 | * @param array $extension_settings Empty array, ready for extension settings! |
727 | 727 | */ |
728 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
728 | + $extension_sections = apply_filters('gravityview/settings/extension/sections', array()); |
|
729 | 729 | |
730 | 730 | // If there are extensions, add a section for them |
731 | - if ( ! empty( $extension_sections ) ) { |
|
731 | + if (!empty($extension_sections)) { |
|
732 | 732 | |
733 | - if( $disabled_attribute ) { |
|
734 | - foreach ( $extension_sections as &$section ) { |
|
735 | - foreach ( $section['fields'] as &$field ) { |
|
733 | + if ($disabled_attribute) { |
|
734 | + foreach ($extension_sections as &$section) { |
|
735 | + foreach ($section['fields'] as &$field) { |
|
736 | 736 | $field['disabled'] = $disabled_attribute; |
737 | 737 | } |
738 | 738 | } |
739 | 739 | } |
740 | 740 | |
741 | - $k = count( $extension_sections ) - 1 ; |
|
742 | - $extension_sections[ $k ]['fields'][] = $button; |
|
743 | - $sections = array_merge( $sections, $extension_sections ); |
|
741 | + $k = count($extension_sections) - 1; |
|
742 | + $extension_sections[$k]['fields'][] = $button; |
|
743 | + $sections = array_merge($sections, $extension_sections); |
|
744 | 744 | } else { |
745 | 745 | // add the 'update settings' button to the general section |
746 | 746 | $sections[0]['fields'][] = $button; |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @return mixed |
758 | 758 | */ |
759 | - static public function getSetting( $key ) { |
|
760 | - return self::get_instance()->get_app_setting( $key ); |
|
759 | + static public function getSetting($key) { |
|
760 | + return self::get_instance()->get_app_setting($key); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | } |
@@ -7,20 +7,20 @@ |
||
7 | 7 | |
8 | 8 | var $name = 'post_tags'; |
9 | 9 | |
10 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
10 | + var $search_operators = array('is', 'in', 'not in', 'isnot', 'contains'); |
|
11 | 11 | |
12 | 12 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
13 | 13 | |
14 | 14 | var $group = 'post'; |
15 | 15 | |
16 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
16 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
17 | 17 | |
18 | - if( 'edit' === $context ) { |
|
18 | + if ('edit' === $context) { |
|
19 | 19 | return $field_options; |
20 | 20 | } |
21 | 21 | |
22 | - $this->add_field_support('dynamic_data', $field_options ); |
|
23 | - $this->add_field_support('link_to_term', $field_options ); |
|
22 | + $this->add_field_support('dynamic_data', $field_options); |
|
23 | + $this->add_field_support('link_to_term', $field_options); |
|
24 | 24 | |
25 | 25 | return $field_options; |
26 | 26 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @copyright Copyright 2014, Katz Web Services, Inc. |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'WPINC' ) ) { |
|
12 | +if (!defined('WPINC')) { |
|
13 | 13 | die; |
14 | 14 | } |
15 | 15 | |
@@ -22,28 +22,28 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | |
25 | - $this->widget_description = esc_html__( 'Search form for searching entries.', 'gravityview' ); |
|
25 | + $this->widget_description = esc_html__('Search form for searching entries.', 'gravityview'); |
|
26 | 26 | |
27 | 27 | self::$instance = &$this; |
28 | 28 | |
29 | - self::$file = plugin_dir_path( __FILE__ ); |
|
29 | + self::$file = plugin_dir_path(__FILE__); |
|
30 | 30 | |
31 | - $default_values = array( 'header' => 0, 'footer' => 0 ); |
|
31 | + $default_values = array('header' => 0, 'footer' => 0); |
|
32 | 32 | |
33 | 33 | $settings = array( |
34 | 34 | 'search_layout' => array( |
35 | 35 | 'type' => 'radio', |
36 | 36 | 'full_width' => true, |
37 | - 'label' => esc_html__( 'Search Layout', 'gravityview' ), |
|
37 | + 'label' => esc_html__('Search Layout', 'gravityview'), |
|
38 | 38 | 'value' => 'horizontal', |
39 | 39 | 'options' => array( |
40 | - 'horizontal' => esc_html__( 'Horizontal', 'gravityview' ), |
|
41 | - 'vertical' => esc_html__( 'Vertical', 'gravityview' ), |
|
40 | + 'horizontal' => esc_html__('Horizontal', 'gravityview'), |
|
41 | + 'vertical' => esc_html__('Vertical', 'gravityview'), |
|
42 | 42 | ), |
43 | 43 | ), |
44 | 44 | 'search_clear' => array( |
45 | 45 | 'type' => 'checkbox', |
46 | - 'label' => __( 'Show Clear button', 'gravityview' ), |
|
46 | + 'label' => __('Show Clear button', 'gravityview'), |
|
47 | 47 | 'value' => false, |
48 | 48 | ), |
49 | 49 | 'search_fields' => array( |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | 'search_mode' => array( |
56 | 56 | 'type' => 'radio', |
57 | 57 | 'full_width' => true, |
58 | - 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
|
58 | + 'label' => esc_html__('Search Mode', 'gravityview'), |
|
59 | 59 | 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
60 | 60 | 'value' => 'any', |
61 | 61 | 'class' => 'hide-if-js', |
62 | 62 | 'options' => array( |
63 | - 'any' => esc_html__( 'Match Any Fields', 'gravityview' ), |
|
64 | - 'all' => esc_html__( 'Match All Fields', 'gravityview' ), |
|
63 | + 'any' => esc_html__('Match Any Fields', 'gravityview'), |
|
64 | + 'all' => esc_html__('Match All Fields', 'gravityview'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | ); |
68 | - parent::__construct( esc_html__( 'Search Bar', 'gravityview' ), 'search_bar', $default_values, $settings ); |
|
68 | + parent::__construct(esc_html__('Search Bar', 'gravityview'), 'search_bar', $default_values, $settings); |
|
69 | 69 | |
70 | 70 | // frontend - filter entries |
71 | - add_filter( 'gravityview_fe_search_criteria', array( $this, 'filter_entries' ), 10, 1 ); |
|
71 | + add_filter('gravityview_fe_search_criteria', array($this, 'filter_entries'), 10, 1); |
|
72 | 72 | |
73 | 73 | // frontend - add template path |
74 | - add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
74 | + add_filter('gravityview_template_paths', array($this, 'add_template_path')); |
|
75 | 75 | |
76 | 76 | // Add hidden fields for "Default" permalink structure |
77 | - add_filter( 'gravityview_widget_search_filters', array( $this, 'add_no_permalink_fields' ), 10, 3 ); |
|
77 | + add_filter('gravityview_widget_search_filters', array($this, 'add_no_permalink_fields'), 10, 3); |
|
78 | 78 | |
79 | 79 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
80 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
|
81 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
80 | + add_action('admin_enqueue_scripts', array($this, 'add_scripts_and_styles'), 1100); |
|
81 | + add_filter('gravityview_noconflict_scripts', array($this, 'register_no_conflict')); |
|
82 | 82 | |
83 | 83 | // ajax - get the searchable fields |
84 | - add_action( 'wp_ajax_gv_searchable_fields', array( 'GravityView_Widget_Search', 'get_searchable_fields' ) ); |
|
84 | + add_action('wp_ajax_gv_searchable_fields', array('GravityView_Widget_Search', 'get_searchable_fields')); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return GravityView_Widget_Search |
90 | 90 | */ |
91 | 91 | public static function getInstance() { |
92 | - if ( empty( self::$instance ) ) { |
|
92 | + if (empty(self::$instance)) { |
|
93 | 93 | self::$instance = new GravityView_Widget_Search; |
94 | 94 | } |
95 | 95 | return self::$instance; |
@@ -100,18 +100,18 @@ discard block |
||
100 | 100 | * Add script to Views edit screen (admin) |
101 | 101 | * @param mixed $hook |
102 | 102 | */ |
103 | - public function add_scripts_and_styles( $hook ) { |
|
103 | + public function add_scripts_and_styles($hook) { |
|
104 | 104 | global $pagenow; |
105 | 105 | |
106 | 106 | // Don't process any scripts below here if it's not a GravityView page or the widgets screen |
107 | - if ( ! gravityview_is_admin_page( $hook ) && ( 'widgets.php' !== $pagenow ) ) { |
|
107 | + if (!gravityview_is_admin_page($hook) && ('widgets.php' !== $pagenow)) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | - $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
112 | - $script_source = empty( $script_min ) ? '/source' : ''; |
|
111 | + $script_min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
112 | + $script_source = empty($script_min) ? '/source' : ''; |
|
113 | 113 | |
114 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
114 | + wp_enqueue_script('gravityview_searchwidget_admin', plugins_url('assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__), array('jquery', 'gravityview_views_scripts'), GravityView_Plugin::version); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @var array |
121 | 121 | */ |
122 | 122 | $input_labels = array( |
123 | - 'input_text' => esc_html__( 'Text', 'gravityview' ), |
|
124 | - 'date' => esc_html__( 'Date', 'gravityview' ), |
|
125 | - 'select' => esc_html__( 'Select', 'gravityview' ), |
|
126 | - 'multiselect' => esc_html__( 'Select (multiple values)', 'gravityview' ), |
|
127 | - 'radio' => esc_html__( 'Radio', 'gravityview' ), |
|
128 | - 'checkbox' => esc_html__( 'Checkbox', 'gravityview' ), |
|
129 | - 'single_checkbox' => esc_html__( 'Checkbox', 'gravityview' ), |
|
130 | - 'link' => esc_html__( 'Links', 'gravityview' ), |
|
131 | - 'date_range' => esc_html__( 'Date range', 'gravityview' ), |
|
123 | + 'input_text' => esc_html__('Text', 'gravityview'), |
|
124 | + 'date' => esc_html__('Date', 'gravityview'), |
|
125 | + 'select' => esc_html__('Select', 'gravityview'), |
|
126 | + 'multiselect' => esc_html__('Select (multiple values)', 'gravityview'), |
|
127 | + 'radio' => esc_html__('Radio', 'gravityview'), |
|
128 | + 'checkbox' => esc_html__('Checkbox', 'gravityview'), |
|
129 | + 'single_checkbox' => esc_html__('Checkbox', 'gravityview'), |
|
130 | + 'link' => esc_html__('Links', 'gravityview'), |
|
131 | + 'date_range' => esc_html__('Date range', 'gravityview'), |
|
132 | 132 | ); |
133 | 133 | |
134 | 134 | /** |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | * @var array |
138 | 138 | */ |
139 | 139 | $input_types = array( |
140 | - 'text' => array( 'input_text' ), |
|
141 | - 'address' => array( 'input_text' ), |
|
142 | - 'date' => array( 'date', 'date_range' ), |
|
143 | - 'boolean' => array( 'single_checkbox' ), |
|
144 | - 'select' => array( 'select', 'radio', 'link' ), |
|
145 | - 'multi' => array( 'select', 'multiselect', 'radio', 'checkbox', 'link' ), |
|
140 | + 'text' => array('input_text'), |
|
141 | + 'address' => array('input_text'), |
|
142 | + 'date' => array('date', 'date_range'), |
|
143 | + 'boolean' => array('single_checkbox'), |
|
144 | + 'select' => array('select', 'radio', 'link'), |
|
145 | + 'multi' => array('select', 'multiselect', 'radio', 'checkbox', 'link'), |
|
146 | 146 | ); |
147 | 147 | |
148 | - wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
|
149 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
|
150 | - 'label_nofields' => esc_html__( 'No search fields configured yet.', 'gravityview' ), |
|
151 | - 'label_addfield' => esc_html__( 'Add Search Field', 'gravityview' ), |
|
152 | - 'label_label' => esc_html__( 'Label', 'gravityview' ), |
|
153 | - 'label_searchfield' => esc_html__( 'Search Field', 'gravityview' ), |
|
154 | - 'label_inputtype' => esc_html__( 'Input Type', 'gravityview' ), |
|
155 | - 'label_ajaxerror' => esc_html__( 'There was an error loading searchable fields. Save the View or refresh the page to fix this issue.', 'gravityview' ), |
|
156 | - 'input_labels' => json_encode( $input_labels ), |
|
157 | - 'input_types' => json_encode( $input_types ), |
|
158 | - ) ); |
|
148 | + wp_localize_script('gravityview_searchwidget_admin', 'gvSearchVar', array( |
|
149 | + 'nonce' => wp_create_nonce('gravityview_ajaxsearchwidget'), |
|
150 | + 'label_nofields' => esc_html__('No search fields configured yet.', 'gravityview'), |
|
151 | + 'label_addfield' => esc_html__('Add Search Field', 'gravityview'), |
|
152 | + 'label_label' => esc_html__('Label', 'gravityview'), |
|
153 | + 'label_searchfield' => esc_html__('Search Field', 'gravityview'), |
|
154 | + 'label_inputtype' => esc_html__('Input Type', 'gravityview'), |
|
155 | + 'label_ajaxerror' => esc_html__('There was an error loading searchable fields. Save the View or refresh the page to fix this issue.', 'gravityview'), |
|
156 | + 'input_labels' => json_encode($input_labels), |
|
157 | + 'input_types' => json_encode($input_types), |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Add admin script to the whitelist |
164 | 164 | */ |
165 | - public function register_no_conflict( $required ) { |
|
165 | + public function register_no_conflict($required) { |
|
166 | 166 | $required[] = 'gravityview_searchwidget_admin'; |
167 | 167 | return $required; |
168 | 168 | } |
@@ -176,31 +176,31 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public static function get_searchable_fields() { |
178 | 178 | |
179 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
180 | - exit( '0' ); |
|
179 | + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'gravityview_ajaxsearchwidget')) { |
|
180 | + exit('0'); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $form = ''; |
184 | 184 | |
185 | 185 | // Fetch the form for the current View |
186 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
186 | + if (!empty($_POST['view_id'])) { |
|
187 | 187 | |
188 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
188 | + $form = gravityview_get_form_id($_POST['view_id']); |
|
189 | 189 | |
190 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
190 | + } elseif (!empty($_POST['formid'])) { |
|
191 | 191 | |
192 | - $form = (int) $_POST['formid']; |
|
192 | + $form = (int)$_POST['formid']; |
|
193 | 193 | |
194 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
194 | + } elseif (!empty($_POST['template_id']) && class_exists('GravityView_Ajax')) { |
|
195 | 195 | |
196 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
196 | + $form = GravityView_Ajax::pre_get_form_fields($_POST['template_id']); |
|
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | 200 | // fetch form id assigned to the view |
201 | - $response = self::render_searchable_fields( $form ); |
|
201 | + $response = self::render_searchable_fields($form); |
|
202 | 202 | |
203 | - exit( $response ); |
|
203 | + exit($response); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | * @param string $current (for future use) |
210 | 210 | * @return string |
211 | 211 | */ |
212 | - public static function render_searchable_fields( $form_id = null, $current = '' ) { |
|
212 | + public static function render_searchable_fields($form_id = null, $current = '') { |
|
213 | 213 | |
214 | - if ( is_null( $form_id ) ) { |
|
214 | + if (is_null($form_id)) { |
|
215 | 215 | return ''; |
216 | 216 | } |
217 | 217 | |
218 | 218 | // Get fields with sub-inputs and no parent |
219 | - $fields = gravityview_get_form_fields( $form_id, true, true ); |
|
219 | + $fields = gravityview_get_form_fields($form_id, true, true); |
|
220 | 220 | |
221 | 221 | // start building output |
222 | 222 | |
@@ -224,40 +224,40 @@ discard block |
||
224 | 224 | |
225 | 225 | $custom_fields = array( |
226 | 226 | 'search_all' => array( |
227 | - 'text' => esc_html__( 'Search Everything', 'gravityview' ), |
|
227 | + 'text' => esc_html__('Search Everything', 'gravityview'), |
|
228 | 228 | 'type' => 'text', |
229 | 229 | ), |
230 | 230 | 'entry_date' => array( |
231 | - 'text' => esc_html__( 'Entry Date', 'gravityview' ), |
|
231 | + 'text' => esc_html__('Entry Date', 'gravityview'), |
|
232 | 232 | 'type' => 'date', |
233 | 233 | ), |
234 | 234 | 'entry_id' => array( |
235 | - 'text' => esc_html__( 'Entry ID', 'gravityview' ), |
|
235 | + 'text' => esc_html__('Entry ID', 'gravityview'), |
|
236 | 236 | 'type' => 'text', |
237 | 237 | ), |
238 | 238 | 'created_by' => array( |
239 | - 'text' => esc_html__( 'Entry Creator', 'gravityview' ), |
|
239 | + 'text' => esc_html__('Entry Creator', 'gravityview'), |
|
240 | 240 | 'type' => 'select', |
241 | 241 | ) |
242 | 242 | ); |
243 | 243 | |
244 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
245 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
244 | + foreach ($custom_fields as $custom_field_key => $custom_field) { |
|
245 | + $output .= sprintf('<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected($custom_field_key, $current, false), $custom_field['type'], self::get_field_label(array('field' => $custom_field_key)), $custom_field['text']); |
|
246 | 246 | } |
247 | 247 | |
248 | - if ( ! empty( $fields ) ) { |
|
248 | + if (!empty($fields)) { |
|
249 | 249 | |
250 | - $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'fileupload', 'post_image', 'post_id' ), null ); |
|
250 | + $blacklist_field_types = apply_filters('gravityview_blacklist_field_types', array('fileupload', 'post_image', 'post_id'), null); |
|
251 | 251 | |
252 | - foreach ( $fields as $id => $field ) { |
|
252 | + foreach ($fields as $id => $field) { |
|
253 | 253 | |
254 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
254 | + if (in_array($field['type'], $blacklist_field_types)) { |
|
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | |
258 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
258 | + $types = self::get_search_input_types($id, $field['type']); |
|
259 | 259 | |
260 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
260 | + $output .= '<option value="'.$id.'" '.selected($id, $current, false).'data-inputtypes="'.esc_attr($types).'">'.esc_html($field['label']).'</option>'; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
@@ -276,21 +276,21 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @return string GV field search input type ('multi', 'boolean', 'select', 'date', 'text') |
278 | 278 | */ |
279 | - public static function get_search_input_types( $id = '', $field_type = null ) { |
|
279 | + public static function get_search_input_types($id = '', $field_type = null) { |
|
280 | 280 | |
281 | 281 | // @todo - This needs to be improved - many fields have . including products and addresses |
282 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
282 | + if (false !== strpos((string)$id, '.') && in_array($field_type, array('checkbox')) || in_array($id, array('is_fulfilled'))) { |
|
283 | 283 | // on/off checkbox |
284 | 284 | $input_type = 'boolean'; |
285 | - } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
|
285 | + } elseif (in_array($field_type, array('checkbox', 'post_category', 'multiselect'))) { |
|
286 | 286 | //multiselect |
287 | 287 | $input_type = 'multi'; |
288 | 288 | |
289 | - } elseif ( in_array( $field_type, array( 'select', 'radio' ) ) ) { |
|
289 | + } elseif (in_array($field_type, array('select', 'radio'))) { |
|
290 | 290 | //single select |
291 | 291 | $input_type = 'select'; |
292 | 292 | |
293 | - } elseif ( in_array( $field_type, array( 'date' ) ) || in_array( $id, array( 'payment_date' ) ) ) { |
|
293 | + } elseif (in_array($field_type, array('date')) || in_array($id, array('payment_date'))) { |
|
294 | 294 | // date |
295 | 295 | $input_type = 'date'; |
296 | 296 | } else { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param string $field_type Gravity Forms field type |
305 | 305 | * @since 1.2 |
306 | 306 | */ |
307 | - $input_type = apply_filters( 'gravityview/extension/search/input_type', $input_type, $field_type ); |
|
307 | + $input_type = apply_filters('gravityview/extension/search/input_type', $input_type, $field_type); |
|
308 | 308 | |
309 | 309 | return $input_type; |
310 | 310 | } |
@@ -315,29 +315,29 @@ discard block |
||
315 | 315 | * @since 1.8 |
316 | 316 | * @return array Search fields, modified if not using permalinks |
317 | 317 | */ |
318 | - public function add_no_permalink_fields( $search_fields, $object, $widget_args = array() ) { |
|
318 | + public function add_no_permalink_fields($search_fields, $object, $widget_args = array()) { |
|
319 | 319 | /** @global WP_Rewrite $wp_rewrite */ |
320 | 320 | global $wp_rewrite; |
321 | 321 | |
322 | 322 | // Support default permalink structure |
323 | - if ( false === $wp_rewrite->using_permalinks() ) { |
|
323 | + if (false === $wp_rewrite->using_permalinks()) { |
|
324 | 324 | |
325 | 325 | // By default, use current post. |
326 | 326 | $post_id = 0; |
327 | 327 | |
328 | 328 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
329 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
330 | - $post_id = absint( $widget_args['post_id'] ); |
|
329 | + if (!empty($widget_args['post_id'])) { |
|
330 | + $post_id = absint($widget_args['post_id']); |
|
331 | 331 | } |
332 | 332 | // We're in the WordPress Widget context, and the base View ID should be used |
333 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
334 | - $post_id = absint( $widget_args['view_id'] ); |
|
333 | + else if (!empty($widget_args['view_id'])) { |
|
334 | + $post_id = absint($widget_args['view_id']); |
|
335 | 335 | } |
336 | 336 | |
337 | - $args = gravityview_get_permalink_query_args( $post_id ); |
|
337 | + $args = gravityview_get_permalink_query_args($post_id); |
|
338 | 338 | |
339 | 339 | // Add hidden fields to the search form |
340 | - foreach ( $args as $key => $value ) { |
|
340 | + foreach ($args as $key => $value) { |
|
341 | 341 | $search_fields[] = array( |
342 | 342 | 'name' => $key, |
343 | 343 | 'input' => 'hidden', |
@@ -357,23 +357,23 @@ discard block |
||
357 | 357 | * @param array $search_criteria |
358 | 358 | * @return array |
359 | 359 | */ |
360 | - public function filter_entries( $search_criteria ) { |
|
360 | + public function filter_entries($search_criteria) { |
|
361 | 361 | |
362 | - do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Requested $_GET: ', get_class( $this ) ), $_GET ); |
|
362 | + do_action('gravityview_log_debug', sprintf('%s[filter_entries] Requested $_GET: ', get_class($this)), $_GET); |
|
363 | 363 | |
364 | - if ( empty( $_GET ) || ! is_array( $_GET ) ) { |
|
364 | + if (empty($_GET) || !is_array($_GET)) { |
|
365 | 365 | return $search_criteria; |
366 | 366 | } |
367 | 367 | |
368 | 368 | // add free search |
369 | - if ( ! empty( $_GET['gv_search'] ) ) { |
|
369 | + if (!empty($_GET['gv_search'])) { |
|
370 | 370 | |
371 | 371 | // Search for a piece |
372 | - $words = explode( ' ', stripslashes_deep( urldecode( $_GET['gv_search'] ) ) ); |
|
372 | + $words = explode(' ', stripslashes_deep(urldecode($_GET['gv_search']))); |
|
373 | 373 | |
374 | - $words = array_filter( $words ); |
|
374 | + $words = array_filter($words); |
|
375 | 375 | |
376 | - foreach ( $words as $word ) { |
|
376 | + foreach ($words as $word) { |
|
377 | 377 | $search_criteria['field_filters'][] = array( |
378 | 378 | 'key' => null, // The field ID to search |
379 | 379 | 'value' => $word, // The value to search |
@@ -383,8 +383,8 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | //start date & end date |
386 | - $curr_start = esc_attr( rgget( 'gv_start' ) ); |
|
387 | - $curr_end = esc_attr( rgget( 'gv_end' ) ); |
|
386 | + $curr_start = esc_attr(rgget('gv_start')); |
|
387 | + $curr_end = esc_attr(rgget('gv_end')); |
|
388 | 388 | |
389 | 389 | /** |
390 | 390 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -393,51 +393,51 @@ discard block |
||
393 | 393 | * @param[out,in] boolean $adjust_tz Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true |
394 | 394 | * @param[in] string $context Where the filter is being called from. `search` in this case. |
395 | 395 | */ |
396 | - $adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, 'search' ); |
|
397 | - $search_criteria['start_date'] = ( $adjust_tz && !empty( $curr_start ) ) ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
398 | - $search_criteria['end_date'] = ( $adjust_tz && !empty( $curr_end ) ) ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
396 | + $adjust_tz = apply_filters('gravityview_date_created_adjust_timezone', true, 'search'); |
|
397 | + $search_criteria['start_date'] = ($adjust_tz && !empty($curr_start)) ? get_gmt_from_date($curr_start) : $curr_start; |
|
398 | + $search_criteria['end_date'] = ($adjust_tz && !empty($curr_end)) ? get_gmt_from_date($curr_end) : $curr_end; |
|
399 | 399 | |
400 | 400 | |
401 | 401 | // search for a specific entry ID |
402 | - if ( ! empty( $_GET[ 'gv_id' ] ) ) { |
|
402 | + if (!empty($_GET['gv_id'])) { |
|
403 | 403 | $search_criteria['field_filters'][] = array( |
404 | 404 | 'key' => 'id', |
405 | - 'value' => absint( $_GET[ 'gv_id' ] ), |
|
405 | + 'value' => absint($_GET['gv_id']), |
|
406 | 406 | 'operator' => '=', |
407 | 407 | ); |
408 | 408 | } |
409 | 409 | |
410 | 410 | // search for a specific Created_by ID |
411 | - if ( ! empty( $_GET[ 'gv_by' ] ) ) { |
|
411 | + if (!empty($_GET['gv_by'])) { |
|
412 | 412 | $search_criteria['field_filters'][] = array( |
413 | 413 | 'key' => 'created_by', |
414 | - 'value' => absint( $_GET['gv_by'] ), |
|
414 | + 'value' => absint($_GET['gv_by']), |
|
415 | 415 | 'operator' => '=', |
416 | 416 | ); |
417 | 417 | } |
418 | 418 | |
419 | 419 | |
420 | 420 | // Get search mode passed in URL |
421 | - $mode = in_array( rgget( 'mode' ), array( 'any', 'all' ) ) ? esc_attr( rgget( 'mode' ) ) : 'any'; |
|
421 | + $mode = in_array(rgget('mode'), array('any', 'all')) ? esc_attr(rgget('mode')) : 'any'; |
|
422 | 422 | |
423 | 423 | // get the other search filters |
424 | - foreach ( $_GET as $key => $value ) { |
|
424 | + foreach ($_GET as $key => $value) { |
|
425 | 425 | |
426 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
426 | + if (0 !== strpos($key, 'filter_') || empty($value) || (is_array($value) && count($value) === 1 && empty($value[0]))) { |
|
427 | 427 | continue; |
428 | 428 | } |
429 | 429 | |
430 | 430 | // could return simple filter or multiple filters |
431 | - $filter = $this->prepare_field_filter( $key, $value ); |
|
431 | + $filter = $this->prepare_field_filter($key, $value); |
|
432 | 432 | |
433 | - if ( isset( $filter[0]['value'] ) ) { |
|
434 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
433 | + if (isset($filter[0]['value'])) { |
|
434 | + $search_criteria['field_filters'] = array_merge($search_criteria['field_filters'], $filter); |
|
435 | 435 | |
436 | 436 | // if date range type, set search mode to ALL |
437 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>', '<' ) ) ) { |
|
437 | + if (!empty($filter[0]['operator']) && in_array($filter[0]['operator'], array('>', '<'))) { |
|
438 | 438 | $mode = 'all'; |
439 | 439 | } |
440 | - } elseif( !empty( $filter ) ) { |
|
440 | + } elseif (!empty($filter)) { |
|
441 | 441 | $search_criteria['field_filters'][] = $filter; |
442 | 442 | } |
443 | 443 | } |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | * @since 1.5.1 |
448 | 448 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
449 | 449 | */ |
450 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
450 | + $search_criteria['field_filters']['mode'] = apply_filters('gravityview/search/mode', $mode); |
|
451 | 451 | |
452 | - do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
|
452 | + do_action('gravityview_log_debug', sprintf('%s[filter_entries] Returned Search Criteria: ', get_class($this)), $search_criteria); |
|
453 | 453 | |
454 | 454 | return $search_criteria; |
455 | 455 | } |
@@ -464,16 +464,16 @@ discard block |
||
464 | 464 | * @param string $value $_GET search value |
465 | 465 | * @return array 1 or 2 deph levels |
466 | 466 | */ |
467 | - public function prepare_field_filter( $key, $value ) { |
|
467 | + public function prepare_field_filter($key, $value) { |
|
468 | 468 | |
469 | 469 | $gravityview_view = GravityView_View::getInstance(); |
470 | 470 | |
471 | 471 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
472 | - $field_id = str_replace( '_', '.', str_replace( 'filter_', '', $key ) ); |
|
472 | + $field_id = str_replace('_', '.', str_replace('filter_', '', $key)); |
|
473 | 473 | |
474 | 474 | // get form field array |
475 | 475 | $form = $gravityview_view->getForm(); |
476 | - $form_field = gravityview_get_field( $form, $field_id ); |
|
476 | + $form_field = gravityview_get_field($form, $field_id); |
|
477 | 477 | |
478 | 478 | // default filter array |
479 | 479 | $filter = array( |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | 'value' => $value, |
482 | 482 | ); |
483 | 483 | |
484 | - switch ( $form_field['type'] ) { |
|
484 | + switch ($form_field['type']) { |
|
485 | 485 | |
486 | 486 | case 'select': |
487 | 487 | case 'radio': |
@@ -490,18 +490,18 @@ discard block |
||
490 | 490 | |
491 | 491 | case 'post_category': |
492 | 492 | |
493 | - if ( ! is_array( $value ) ) { |
|
494 | - $value = array( $value ); |
|
493 | + if (!is_array($value)) { |
|
494 | + $value = array($value); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | // Reset filter variable |
498 | 498 | $filter = array(); |
499 | 499 | |
500 | - foreach ( $value as $val ) { |
|
501 | - $cat = get_term( $val, 'category' ); |
|
500 | + foreach ($value as $val) { |
|
501 | + $cat = get_term($val, 'category'); |
|
502 | 502 | $filter[] = array( |
503 | 503 | 'key' => $field_id, |
504 | - 'value' => esc_attr( $cat->name ) . ':' . $val, |
|
504 | + 'value' => esc_attr($cat->name).':'.$val, |
|
505 | 505 | 'operator' => 'is', |
506 | 506 | ); |
507 | 507 | } |
@@ -510,35 +510,35 @@ discard block |
||
510 | 510 | |
511 | 511 | case 'multiselect': |
512 | 512 | |
513 | - if ( ! is_array( $value ) ) { |
|
513 | + if (!is_array($value)) { |
|
514 | 514 | break; |
515 | 515 | } |
516 | 516 | |
517 | 517 | // Reset filter variable |
518 | 518 | $filter = array(); |
519 | 519 | |
520 | - foreach ( $value as $val ) { |
|
521 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
520 | + foreach ($value as $val) { |
|
521 | + $filter[] = array('key' => $field_id, 'value' => $val); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | break; |
525 | 525 | |
526 | 526 | case 'checkbox': |
527 | 527 | // convert checkbox on/off into the correct search filter |
528 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
529 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
530 | - if ( $input['id'] == $field_id ) { |
|
531 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
528 | + if (false !== strpos($field_id, '.') && !empty($form_field['inputs']) && !empty($form_field['choices'])) { |
|
529 | + foreach ($form_field['inputs'] as $k => $input) { |
|
530 | + if ($input['id'] == $field_id) { |
|
531 | + $filter['value'] = $form_field['choices'][$k]['value']; |
|
532 | 532 | $filter['operator'] = 'is'; |
533 | 533 | break; |
534 | 534 | } |
535 | 535 | } |
536 | - } elseif ( is_array( $value ) ) { |
|
536 | + } elseif (is_array($value)) { |
|
537 | 537 | |
538 | 538 | // Reset filter variable |
539 | 539 | $filter = array(); |
540 | 540 | |
541 | - foreach ( $value as $val ) { |
|
541 | + foreach ($value as $val) { |
|
542 | 542 | $filter[] = array( |
543 | 543 | 'key' => $field_id, |
544 | 544 | 'value' => $val, |
@@ -552,13 +552,13 @@ discard block |
||
552 | 552 | case 'name': |
553 | 553 | case 'address': |
554 | 554 | |
555 | - if ( false === strpos( $field_id, '.' ) ) { |
|
555 | + if (false === strpos($field_id, '.')) { |
|
556 | 556 | |
557 | - $words = explode( ' ', $value ); |
|
557 | + $words = explode(' ', $value); |
|
558 | 558 | |
559 | 559 | $filters = array(); |
560 | - foreach ( $words as $word ) { |
|
561 | - if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
|
560 | + foreach ($words as $word) { |
|
561 | + if (!empty($word) && strlen($word) > 1) { |
|
562 | 562 | // Keep the same key for each filter |
563 | 563 | $filter['value'] = $word; |
564 | 564 | // Add a search for the value |
@@ -573,25 +573,25 @@ discard block |
||
573 | 573 | |
574 | 574 | case 'date': |
575 | 575 | |
576 | - if ( is_array( $value ) ) { |
|
576 | + if (is_array($value)) { |
|
577 | 577 | |
578 | 578 | // Reset filter variable |
579 | 579 | $filter = array(); |
580 | 580 | |
581 | - foreach ( $value as $k => $date ) { |
|
582 | - if ( empty( $date ) ) { |
|
581 | + foreach ($value as $k => $date) { |
|
582 | + if (empty($date)) { |
|
583 | 583 | continue; |
584 | 584 | } |
585 | 585 | $operator = 'start' === $k ? '>' : '<'; |
586 | 586 | |
587 | 587 | $filter[] = array( |
588 | 588 | 'key' => $field_id, |
589 | - 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
|
589 | + 'value' => self::get_formatted_date($date, 'Y-m-d'), |
|
590 | 590 | 'operator' => $operator, |
591 | 591 | ); |
592 | 592 | } |
593 | 593 | } else { |
594 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
594 | + $filter['value'] = self::get_formatted_date($value, 'Y-m-d'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | break; |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | * |
611 | 611 | * @return string Format of the date in the database |
612 | 612 | */ |
613 | - public static function get_date_field_format( GF_Field_Date $field ) { |
|
613 | + public static function get_date_field_format(GF_Field_Date $field) { |
|
614 | 614 | $format = 'm/d/Y'; |
615 | 615 | $datepicker = array( |
616 | 616 | 'mdy' => 'm/d/Y', |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | 'ymd_dot' => 'Y.m.d', |
623 | 623 | ); |
624 | 624 | |
625 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
626 | - $format = $datepicker[ $field->dateFormat ]; |
|
625 | + if (!empty($field->dateFormat) && isset($datepicker[$field->dateFormat])) { |
|
626 | + $format = $datepicker[$field->dateFormat]; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | return $format; |
@@ -636,13 +636,13 @@ discard block |
||
636 | 636 | * @param string $format Wanted formatted date |
637 | 637 | * @return string |
638 | 638 | */ |
639 | - public static function get_formatted_date( $value = '', $format = 'Y-m-d' ) { |
|
640 | - $date = date_create( $value ); |
|
641 | - if ( empty( $date ) ) { |
|
642 | - do_action( 'gravityview_log_debug', sprintf( '%s[get_formatted_date] Date format not valid: ', get_class( self::$instance ) ), $value ); |
|
639 | + public static function get_formatted_date($value = '', $format = 'Y-m-d') { |
|
640 | + $date = date_create($value); |
|
641 | + if (empty($date)) { |
|
642 | + do_action('gravityview_log_debug', sprintf('%s[get_formatted_date] Date format not valid: ', get_class(self::$instance)), $value); |
|
643 | 643 | return ''; |
644 | 644 | } |
645 | - return $date->format( $format ); |
|
645 | + return $date->format($format); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | * Include this extension templates path |
651 | 651 | * @param array $file_paths List of template paths ordered |
652 | 652 | */ |
653 | - public function add_template_path( $file_paths ) { |
|
653 | + public function add_template_path($file_paths) { |
|
654 | 654 | |
655 | 655 | // Index 100 is the default GravityView template path. |
656 | - $file_paths[102] = self::$file . 'templates/'; |
|
656 | + $file_paths[102] = self::$file.'templates/'; |
|
657 | 657 | |
658 | 658 | return $file_paths; |
659 | 659 | } |
@@ -665,50 +665,50 @@ discard block |
||
665 | 665 | * @param type $context |
666 | 666 | * @return type |
667 | 667 | */ |
668 | - public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
668 | + public function render_frontend($widget_args, $content = '', $context = '') { |
|
669 | 669 | /** @var GravityView_View $gravityview_view */ |
670 | 670 | $gravityview_view = GravityView_View::getInstance(); |
671 | 671 | |
672 | - if ( empty( $gravityview_view ) ) { |
|
673 | - do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class( $this ) ) ); |
|
672 | + if (empty($gravityview_view)) { |
|
673 | + do_action('gravityview_log_debug', sprintf('%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this))); |
|
674 | 674 | return; |
675 | 675 | } |
676 | 676 | |
677 | 677 | // get configured search fields |
678 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
678 | + $search_fields = !empty($widget_args['search_fields']) ? json_decode($widget_args['search_fields'], true) : ''; |
|
679 | 679 | |
680 | - if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
|
681 | - do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
|
680 | + if (empty($search_fields) || !is_array($search_fields)) { |
|
681 | + do_action('gravityview_log_debug', sprintf('%s[render_frontend] No search fields configured for widget:', get_class($this)), $widget_args); |
|
682 | 682 | return; |
683 | 683 | } |
684 | 684 | |
685 | 685 | $has_date = false; |
686 | 686 | |
687 | 687 | // prepare fields |
688 | - foreach ( $search_fields as $k => $field ) { |
|
688 | + foreach ($search_fields as $k => $field) { |
|
689 | 689 | |
690 | 690 | $updated_field = $field; |
691 | 691 | |
692 | - if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) { |
|
692 | + if (in_array($field['input'], array('date', 'date_range'))) { |
|
693 | 693 | $has_date = true; |
694 | 694 | } |
695 | 695 | |
696 | - $updated_field = $this->get_search_filter_details( $updated_field ); |
|
696 | + $updated_field = $this->get_search_filter_details($updated_field); |
|
697 | 697 | |
698 | - switch ( $field['field'] ) { |
|
698 | + switch ($field['field']) { |
|
699 | 699 | |
700 | 700 | case 'search_all': |
701 | 701 | $updated_field['key'] = 'search_all'; |
702 | 702 | $updated_field['input'] = 'search_all'; |
703 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_search' ) ) ); |
|
703 | + $updated_field['value'] = esc_attr(stripslashes_deep(rgget('gv_search'))); |
|
704 | 704 | break; |
705 | 705 | |
706 | 706 | case 'entry_date': |
707 | 707 | $updated_field['key'] = 'entry_date'; |
708 | 708 | $updated_field['input'] = 'entry_date'; |
709 | 709 | $updated_field['value'] = array( |
710 | - 'start' => esc_attr( stripslashes_deep( rgget( 'gv_start' ) ) ), |
|
711 | - 'end' => esc_attr( stripslashes_deep( rgget( 'gv_end' ) ) ), |
|
710 | + 'start' => esc_attr(stripslashes_deep(rgget('gv_start'))), |
|
711 | + 'end' => esc_attr(stripslashes_deep(rgget('gv_end'))), |
|
712 | 712 | ); |
713 | 713 | $has_date = true; |
714 | 714 | break; |
@@ -716,21 +716,21 @@ discard block |
||
716 | 716 | case 'entry_id': |
717 | 717 | $updated_field['key'] = 'entry_id'; |
718 | 718 | $updated_field['input'] = 'entry_id'; |
719 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_id' ) ) ); |
|
719 | + $updated_field['value'] = esc_attr(stripslashes_deep(rgget('gv_id'))); |
|
720 | 720 | break; |
721 | 721 | |
722 | 722 | case 'created_by': |
723 | 723 | $updated_field['key'] = 'created_by'; |
724 | 724 | $updated_field['name'] = 'gv_by'; |
725 | - $updated_field['value'] = esc_attr( stripslashes_deep( rgget( 'gv_by' ) ) ); |
|
725 | + $updated_field['value'] = esc_attr(stripslashes_deep(rgget('gv_by'))); |
|
726 | 726 | $updated_field['choices'] = self::get_created_by_choices(); |
727 | 727 | break; |
728 | 728 | } |
729 | 729 | |
730 | - $search_fields[ $k ] = $updated_field; |
|
730 | + $search_fields[$k] = $updated_field; |
|
731 | 731 | } |
732 | 732 | |
733 | - do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] Calculated Search Fields: ', get_class( $this ) ), $search_fields ); |
|
733 | + do_action('gravityview_log_debug', sprintf('%s[render_frontend] Calculated Search Fields: ', get_class($this)), $search_fields); |
|
734 | 734 | |
735 | 735 | /** |
736 | 736 | * @filter `gravityview_widget_search_filters` Modify what fields are shown. The order of the fields in the $search_filters array controls the order as displayed in the search bar widget. |
@@ -739,25 +739,25 @@ discard block |
||
739 | 739 | * @param array $widget_args Args passed to this method. {@since 1.8} |
740 | 740 | * @var array |
741 | 741 | */ |
742 | - $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
|
742 | + $gravityview_view->search_fields = apply_filters('gravityview_widget_search_filters', $search_fields, $this, $widget_args); |
|
743 | 743 | |
744 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
744 | + $gravityview_view->search_layout = !empty($widget_args['search_layout']) ? $widget_args['search_layout'] : 'horizontal'; |
|
745 | 745 | |
746 | 746 | /** @since 1.14 */ |
747 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
747 | + $gravityview_view->search_mode = !empty($widget_args['search_mode']) ? $widget_args['search_mode'] : 'any'; |
|
748 | 748 | |
749 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
749 | + $custom_class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : ''; |
|
750 | 750 | |
751 | - $gravityview_view->search_class = self::get_search_class( $custom_class ); |
|
751 | + $gravityview_view->search_class = self::get_search_class($custom_class); |
|
752 | 752 | |
753 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
753 | + $gravityview_view->search_clear = !empty($widget_args['search_clear']) ? $widget_args['search_clear'] : false; |
|
754 | 754 | |
755 | - if ( $has_date ) { |
|
755 | + if ($has_date) { |
|
756 | 756 | // enqueue datepicker stuff only if needed! |
757 | 757 | $this->enqueue_datepicker(); |
758 | 758 | } |
759 | 759 | |
760 | - $gravityview_view->render( 'widget', 'search', false ); |
|
760 | + $gravityview_view->render('widget', 'search', false); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
@@ -767,12 +767,12 @@ discard block |
||
767 | 767 | * |
768 | 768 | * @return string Sanitized CSS class for the search form |
769 | 769 | */ |
770 | - public static function get_search_class( $custom_class = '' ) { |
|
770 | + public static function get_search_class($custom_class = '') { |
|
771 | 771 | $gravityview_view = GravityView_View::getInstance(); |
772 | 772 | |
773 | 773 | $search_class = 'gv-search-'.$gravityview_view->search_layout; |
774 | 774 | |
775 | - if ( ! empty( $custom_class ) ) { |
|
775 | + if (!empty($custom_class)) { |
|
776 | 776 | $search_class .= ' '.$custom_class; |
777 | 777 | } |
778 | 778 | |
@@ -781,12 +781,12 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @param string $search_class The CSS class for the search form |
783 | 783 | */ |
784 | - $search_class = apply_filters( 'gravityview_search_class', $search_class ); |
|
784 | + $search_class = apply_filters('gravityview_search_class', $search_class); |
|
785 | 785 | |
786 | 786 | // Is there an active search being performed? Used by fe-views.js |
787 | 787 | $search_class .= GravityView_frontend::getInstance()->isSearch() ? ' gv-is-search' : ''; |
788 | 788 | |
789 | - return gravityview_sanitize_html_class( $search_class ); |
|
789 | + return gravityview_sanitize_html_class($search_class); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | |
802 | 802 | $post_id = $gravityview_view->getPostId() ? $gravityview_view->getPostId() : $gravityview_view->getViewId(); |
803 | 803 | |
804 | - $url = add_query_arg( array(), get_permalink( $post_id ) ); |
|
804 | + $url = add_query_arg(array(), get_permalink($post_id)); |
|
805 | 805 | |
806 | - return esc_url( $url ); |
|
806 | + return esc_url($url); |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /** |
@@ -812,42 +812,42 @@ discard block |
||
812 | 812 | * @param array $form_field Form field data, as fetched by `gravityview_get_field()` |
813 | 813 | * @return string Label for the search form |
814 | 814 | */ |
815 | - private static function get_field_label( $field, $form_field = array() ) { |
|
815 | + private static function get_field_label($field, $form_field = array()) { |
|
816 | 816 | |
817 | - $label = rgget( 'label', $field ); |
|
817 | + $label = rgget('label', $field); |
|
818 | 818 | |
819 | - if( '' === $label ) { |
|
819 | + if ('' === $label) { |
|
820 | 820 | |
821 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
821 | + $label = isset($form_field['label']) ? $form_field['label'] : ''; |
|
822 | 822 | |
823 | - switch( $field['field'] ) { |
|
823 | + switch ($field['field']) { |
|
824 | 824 | case 'search_all': |
825 | - $label = __( 'Search Entries:', 'gravityview' ); |
|
825 | + $label = __('Search Entries:', 'gravityview'); |
|
826 | 826 | break; |
827 | 827 | case 'entry_date': |
828 | - $label = __( 'Filter by date:', 'gravityview' ); |
|
828 | + $label = __('Filter by date:', 'gravityview'); |
|
829 | 829 | break; |
830 | 830 | case 'entry_id': |
831 | - $label = __( 'Entry ID:', 'gravityview' ); |
|
831 | + $label = __('Entry ID:', 'gravityview'); |
|
832 | 832 | break; |
833 | 833 | case 'created_by': |
834 | - $label = __( 'Submitted by:', 'gravityview' ); |
|
834 | + $label = __('Submitted by:', 'gravityview'); |
|
835 | 835 | break; |
836 | 836 | case 'is_fulfilled': |
837 | - $label = __( 'Is Fulfilled', 'gravityview' ); |
|
837 | + $label = __('Is Fulfilled', 'gravityview'); |
|
838 | 838 | break; |
839 | 839 | default: |
840 | 840 | // If this is a field input, not a field |
841 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
841 | + if (strpos($field['field'], '.') > 0 && !empty($form_field['inputs'])) { |
|
842 | 842 | |
843 | 843 | // Get the label for the field in question, which returns an array |
844 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
844 | + $items = wp_list_filter($form_field['inputs'], array('id' => $field['field'])); |
|
845 | 845 | |
846 | 846 | // Get the item with the `label` key |
847 | - $values = wp_list_pluck( $items, 'label' ); |
|
847 | + $values = wp_list_pluck($items, 'label'); |
|
848 | 848 | |
849 | 849 | // There will only one item in the array, but this is easier |
850 | - foreach ( $values as $value ) { |
|
850 | + foreach ($values as $value) { |
|
851 | 851 | $label = $value; |
852 | 852 | break; |
853 | 853 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | * @param[in,out] string $label Existing label text, sanitized. |
861 | 861 | * @param[in] array $form_field Gravity Forms field array, as returned by `GFFormsModel::get_field()` |
862 | 862 | */ |
863 | - $label = apply_filters( 'gravityview_search_field_label', esc_attr( $label ), $form_field ); |
|
863 | + $label = apply_filters('gravityview_search_field_label', esc_attr($label), $form_field); |
|
864 | 864 | |
865 | 865 | return $label; |
866 | 866 | } |
@@ -871,39 +871,39 @@ discard block |
||
871 | 871 | * @param array $field |
872 | 872 | * @return array |
873 | 873 | */ |
874 | - private function get_search_filter_details( $field ) { |
|
874 | + private function get_search_filter_details($field) { |
|
875 | 875 | |
876 | 876 | $gravityview_view = GravityView_View::getInstance(); |
877 | 877 | |
878 | 878 | $form = $gravityview_view->getForm(); |
879 | 879 | |
880 | 880 | // for advanced field ids (eg, first name / last name ) |
881 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
881 | + $name = 'filter_'.str_replace('.', '_', $field['field']); |
|
882 | 882 | |
883 | 883 | // get searched value from $_GET (string or array) |
884 | - $value = rgget( $name ); |
|
884 | + $value = rgget($name); |
|
885 | 885 | |
886 | 886 | // get form field details |
887 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
887 | + $form_field = gravityview_get_field($form, $field['field']); |
|
888 | 888 | |
889 | 889 | $filter = array( |
890 | 890 | 'key' => $field['field'], |
891 | 891 | 'name' => $name, |
892 | - 'label' => self::get_field_label( $field, $form_field ), |
|
892 | + 'label' => self::get_field_label($field, $form_field), |
|
893 | 893 | 'input' => $field['input'], |
894 | 894 | 'value' => $value, |
895 | 895 | 'type' => $form_field['type'], |
896 | 896 | ); |
897 | 897 | |
898 | 898 | // collect choices |
899 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
899 | + if ('post_category' === $form_field['type'] && !empty($form_field['displayAllCategories']) && empty($form_field['choices'])) { |
|
900 | 900 | $filter['choices'] = gravityview_get_terms_choices(); |
901 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
901 | + } elseif (!empty($form_field['choices'])) { |
|
902 | 902 | $filter['choices'] = $form_field['choices']; |
903 | 903 | } |
904 | 904 | |
905 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
906 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
905 | + if ('date_range' === $field['input'] && empty($value)) { |
|
906 | + $filter['value'] = array('start' => '', 'end' => ''); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | return $filter; |
@@ -923,10 +923,10 @@ discard block |
||
923 | 923 | * filter gravityview/get_users/search_widget |
924 | 924 | * @see \GVCommon::get_users |
925 | 925 | */ |
926 | - $users = GVCommon::get_users( 'search_widget', array( 'fields' => array( 'ID', 'display_name' ) ) ); |
|
926 | + $users = GVCommon::get_users('search_widget', array('fields' => array('ID', 'display_name'))); |
|
927 | 927 | |
928 | 928 | $choices = array(); |
929 | - foreach ( $users as $user ) { |
|
929 | + foreach ($users as $user) { |
|
930 | 930 | $choices[] = array( |
931 | 931 | 'value' => $user->ID, |
932 | 932 | 'text' => $user->display_name, |
@@ -944,11 +944,11 @@ discard block |
||
944 | 944 | public static function the_clear_search_button() { |
945 | 945 | $gravityview_view = GravityView_View::getInstance(); |
946 | 946 | |
947 | - if ( $gravityview_view->search_clear ) { |
|
947 | + if ($gravityview_view->search_clear) { |
|
948 | 948 | |
949 | - $url = strtok( add_query_arg( array() ), '?' ); |
|
949 | + $url = strtok(add_query_arg(array()), '?'); |
|
950 | 950 | |
951 | - echo gravityview_get_link( $url, esc_html__( 'Clear', 'gravityview' ), 'class=button gv-search-clear' ); |
|
951 | + echo gravityview_get_link($url, esc_html__('Clear', 'gravityview'), 'class=button gv-search-clear'); |
|
952 | 952 | |
953 | 953 | } |
954 | 954 | } |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | * Require the datepicker script for the frontend GV script |
960 | 960 | * @param array $js_dependencies Array of existing required scripts for the fe-views.js script |
961 | 961 | */ |
962 | - public function add_datepicker_js_dependency( $js_dependencies ) { |
|
962 | + public function add_datepicker_js_dependency($js_dependencies) { |
|
963 | 963 | |
964 | 964 | $js_dependencies[] = 'jquery-ui-datepicker'; |
965 | 965 | |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * |
975 | 975 | * @return array |
976 | 976 | */ |
977 | - public function add_datepicker_localization( $localizations = array(), $view_data = array() ) { |
|
977 | + public function add_datepicker_localization($localizations = array(), $view_data = array()) { |
|
978 | 978 | global $wp_locale; |
979 | 979 | |
980 | 980 | /** |
@@ -984,26 +984,26 @@ discard block |
||
984 | 984 | * @param array $js_localization The data padded to the Javascript file |
985 | 985 | * @param array $view_data View data array with View settings |
986 | 986 | */ |
987 | - $datepicker_settings = apply_filters( 'gravityview_datepicker_settings', array( |
|
987 | + $datepicker_settings = apply_filters('gravityview_datepicker_settings', array( |
|
988 | 988 | 'yearRange' => '-5:+5', |
989 | 989 | 'changeMonth' => true, |
990 | 990 | 'changeYear' => true, |
991 | - 'closeText' => esc_attr_x( 'Close', 'Close calendar', 'gravityview' ), |
|
992 | - 'prevText' => esc_attr_x( 'Prev', 'Previous month in calendar', 'gravityview' ), |
|
993 | - 'nextText' => esc_attr_x( 'Next', 'Next month in calendar', 'gravityview' ), |
|
994 | - 'currentText' => esc_attr_x( 'Today', 'Today in calendar', 'gravityview' ), |
|
995 | - 'weekHeader' => esc_attr_x( 'Week', 'Week in calendar', 'gravityview' ), |
|
996 | - 'monthStatus' => __( 'Show a different month', 'gravityview' ), |
|
997 | - 'monthNames' => array_values( $wp_locale->month ), |
|
998 | - 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), |
|
999 | - 'dayNames' => array_values( $wp_locale->weekday ), |
|
1000 | - 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), |
|
1001 | - 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), |
|
991 | + 'closeText' => esc_attr_x('Close', 'Close calendar', 'gravityview'), |
|
992 | + 'prevText' => esc_attr_x('Prev', 'Previous month in calendar', 'gravityview'), |
|
993 | + 'nextText' => esc_attr_x('Next', 'Next month in calendar', 'gravityview'), |
|
994 | + 'currentText' => esc_attr_x('Today', 'Today in calendar', 'gravityview'), |
|
995 | + 'weekHeader' => esc_attr_x('Week', 'Week in calendar', 'gravityview'), |
|
996 | + 'monthStatus' => __('Show a different month', 'gravityview'), |
|
997 | + 'monthNames' => array_values($wp_locale->month), |
|
998 | + 'monthNamesShort' => array_values($wp_locale->month_abbrev), |
|
999 | + 'dayNames' => array_values($wp_locale->weekday), |
|
1000 | + 'dayNamesShort' => array_values($wp_locale->weekday_abbrev), |
|
1001 | + 'dayNamesMin' => array_values($wp_locale->weekday_initial), |
|
1002 | 1002 | // get the start of week from WP general setting |
1003 | - 'firstDay' => get_option( 'start_of_week' ), |
|
1003 | + 'firstDay' => get_option('start_of_week'), |
|
1004 | 1004 | // is Right to left language? default is false |
1005 | 1005 | 'isRTL' => is_rtl(), |
1006 | - ), $view_data ); |
|
1006 | + ), $view_data); |
|
1007 | 1007 | |
1008 | 1008 | $localizations['datepicker'] = $datepicker_settings; |
1009 | 1009 | |
@@ -1022,13 +1022,13 @@ discard block |
||
1022 | 1022 | public function enqueue_datepicker() { |
1023 | 1023 | $gravityview_view = GravityView_View::getInstance(); |
1024 | 1024 | |
1025 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1025 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
1026 | 1026 | |
1027 | - add_filter( 'gravityview_js_dependencies', array( $this, 'add_datepicker_js_dependency' ) ); |
|
1028 | - add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
|
1027 | + add_filter('gravityview_js_dependencies', array($this, 'add_datepicker_js_dependency')); |
|
1028 | + add_filter('gravityview_js_localization', array($this, 'add_datepicker_localization'), 10, 2); |
|
1029 | 1029 | |
1030 | 1030 | $scheme = is_ssl() ? 'https://' : 'http://'; |
1031 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
1031 | + wp_enqueue_style('jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css'); |
|
1032 | 1032 | |
1033 | 1033 | /** |
1034 | 1034 | * @filter `gravityview_search_datepicker_class` |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | * - `ymd_dash` (yyyy-mm-dd) |
1044 | 1044 | * - `ymp_dot` (yyyy.mm.dd) |
1045 | 1045 | */ |
1046 | - $datepicker_class = apply_filters( 'gravityview_search_datepicker_class', 'gv-datepicker datepicker mdy' ); |
|
1046 | + $datepicker_class = apply_filters('gravityview_search_datepicker_class', 'gv-datepicker datepicker mdy'); |
|
1047 | 1047 | |
1048 | 1048 | $gravityview_view->datepicker_class = $datepicker_class; |
1049 | 1049 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | /** If this file is called directly, abort. */ |
29 | -if ( ! defined( 'ABSPATH' ) ) { |
|
29 | +if (!defined('ABSPATH')) { |
|
30 | 30 | die; |
31 | 31 | } |
32 | 32 | |
@@ -36,52 +36,52 @@ discard block |
||
36 | 36 | * Full path to the GravityView file |
37 | 37 | * @define "GRAVITYVIEW_FILE" "./gravityview.php" |
38 | 38 | */ |
39 | -define( 'GRAVITYVIEW_FILE', __FILE__ ); |
|
39 | +define('GRAVITYVIEW_FILE', __FILE__); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * The URL to this file |
43 | 43 | */ |
44 | -define( 'GRAVITYVIEW_URL', plugin_dir_url( __FILE__ ) ); |
|
44 | +define('GRAVITYVIEW_URL', plugin_dir_url(__FILE__)); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | /** @define "GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory */ |
48 | -define( 'GRAVITYVIEW_DIR', plugin_dir_path( __FILE__ ) ); |
|
48 | +define('GRAVITYVIEW_DIR', plugin_dir_path(__FILE__)); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * GravityView requires at least this version of Gravity Forms to function properly. |
52 | 52 | */ |
53 | -define( 'GV_MIN_GF_VERSION', '1.9.9.10' ); |
|
53 | +define('GV_MIN_GF_VERSION', '1.9.9.10'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * GravityView requires at least this version of WordPress to function properly. |
57 | 57 | * @since 1.12 |
58 | 58 | */ |
59 | -define( 'GV_MIN_WP_VERSION', '3.3' ); |
|
59 | +define('GV_MIN_WP_VERSION', '3.3'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * GravityView requires at least this version of PHP to function properly. |
63 | 63 | * @since 1.12 |
64 | 64 | */ |
65 | -define( 'GV_MIN_PHP_VERSION', '5.2.4' ); |
|
65 | +define('GV_MIN_PHP_VERSION', '5.2.4'); |
|
66 | 66 | |
67 | 67 | /** Load common & connector functions */ |
68 | -require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
|
69 | -require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
70 | -require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
71 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
|
72 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
|
73 | -require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
|
68 | +require_once(GRAVITYVIEW_DIR.'includes/helper-functions.php'); |
|
69 | +require_once(GRAVITYVIEW_DIR.'includes/class-common.php'); |
|
70 | +require_once(GRAVITYVIEW_DIR.'includes/connector-functions.php'); |
|
71 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-compatibility.php'); |
|
72 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-roles-capabilities.php'); |
|
73 | +require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-notices.php'); |
|
74 | 74 | |
75 | 75 | /** Register Post Types and Rewrite Rules */ |
76 | -require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
76 | +require_once(GRAVITYVIEW_DIR.'includes/class-post-types.php'); |
|
77 | 77 | |
78 | 78 | /** Add Cache Class */ |
79 | -require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
79 | +require_once(GRAVITYVIEW_DIR.'includes/class-cache.php'); |
|
80 | 80 | |
81 | 81 | /** Register hooks that are fired when the plugin is activated and deactivated. */ |
82 | -if( is_admin() ) { |
|
83 | - register_activation_hook( __FILE__, array( 'GravityView_Plugin', 'activate' ) ); |
|
84 | - register_deactivation_hook( __FILE__, array( 'GravityView_Plugin', 'deactivate' ) ); |
|
82 | +if (is_admin()) { |
|
83 | + register_activation_hook(__FILE__, array('GravityView_Plugin', 'activate')); |
|
84 | + register_deactivation_hook(__FILE__, array('GravityView_Plugin', 'deactivate')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public static function getInstance() { |
102 | 102 | |
103 | - if( empty( self::$instance ) ) { |
|
103 | + if (empty(self::$instance)) { |
|
104 | 104 | self::$instance = new self; |
105 | 105 | } |
106 | 106 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | private function __construct() { |
111 | 111 | |
112 | 112 | |
113 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
113 | + if (!GravityView_Compatibility::is_valid()) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | private function add_hooks() { |
128 | 128 | // Load plugin text domain |
129 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ), 1 ); |
|
129 | + add_action('init', array($this, 'load_plugin_textdomain'), 1); |
|
130 | 130 | |
131 | 131 | // Load frontend files |
132 | - add_action( 'init', array( $this, 'frontend_actions' ), 20 ); |
|
132 | + add_action('init', array($this, 'frontend_actions'), 20); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -139,48 +139,48 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function include_files() { |
141 | 141 | |
142 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin.php' ); |
|
142 | + include_once(GRAVITYVIEW_DIR.'includes/class-admin.php'); |
|
143 | 143 | |
144 | 144 | // Load fields |
145 | - include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-fields.php' ); |
|
146 | - include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
145 | + include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-fields.php'); |
|
146 | + include_once(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field.php'); |
|
147 | 147 | |
148 | 148 | // Load all field files automatically |
149 | - foreach ( glob( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field*.php' ) as $gv_field_filename ) { |
|
150 | - include_once( $gv_field_filename ); |
|
149 | + foreach (glob(GRAVITYVIEW_DIR.'includes/fields/class-gravityview-field*.php') as $gv_field_filename) { |
|
150 | + include_once($gv_field_filename); |
|
151 | 151 | } |
152 | 152 | |
153 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
154 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
153 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-notes.php'); |
|
154 | + include_once(GRAVITYVIEW_DIR.'includes/load-plugin-and-theme-hooks.php'); |
|
155 | 155 | |
156 | 156 | // Load Extensions |
157 | 157 | // @todo: Convert to a scan of the directory or a method where this all lives |
158 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
159 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
158 | + include_once(GRAVITYVIEW_DIR.'includes/extensions/edit-entry/class-edit-entry.php'); |
|
159 | + include_once(GRAVITYVIEW_DIR.'includes/extensions/delete-entry/class-delete-entry.php'); |
|
160 | 160 | |
161 | 161 | // Load WordPress Widgets |
162 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
162 | + include_once(GRAVITYVIEW_DIR.'includes/wordpress-widgets/register-wordpress-widgets.php'); |
|
163 | 163 | |
164 | 164 | // Load GravityView Widgets |
165 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
165 | + include_once(GRAVITYVIEW_DIR.'includes/widgets/register-gravityview-widgets.php'); |
|
166 | 166 | |
167 | 167 | // Add oEmbed |
168 | - include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
|
168 | + include_once(GRAVITYVIEW_DIR.'includes/class-oembed.php'); |
|
169 | 169 | |
170 | 170 | // Add logging |
171 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-logging.php' ); |
|
172 | - |
|
173 | - include_once( GRAVITYVIEW_DIR . 'includes/class-ajax.php' ); |
|
174 | - include_once( GRAVITYVIEW_DIR . 'includes/class-settings.php'); |
|
175 | - include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
176 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
|
177 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
|
178 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
179 | - include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
|
180 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
|
181 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
|
182 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gvlogic-shortcode.php' ); |
|
183 | - include_once( GRAVITYVIEW_DIR . 'includes/presets/register-default-templates.php' ); |
|
171 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-logging.php'); |
|
172 | + |
|
173 | + include_once(GRAVITYVIEW_DIR.'includes/class-ajax.php'); |
|
174 | + include_once(GRAVITYVIEW_DIR.'includes/class-settings.php'); |
|
175 | + include_once(GRAVITYVIEW_DIR.'includes/class-frontend-views.php'); |
|
176 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-admin-bar.php'); |
|
177 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-list.php'); |
|
178 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
179 | + include_once(GRAVITYVIEW_DIR.'includes/class-data.php'); |
|
180 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-shortcode.php'); |
|
181 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-entry-link-shortcode.php'); |
|
182 | + include_once(GRAVITYVIEW_DIR.'includes/class-gvlogic-shortcode.php'); |
|
183 | + include_once(GRAVITYVIEW_DIR.'includes/presets/register-default-templates.php'); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return bool |
191 | 191 | */ |
192 | 192 | public static function is_network_activated() { |
193 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
193 | + return is_multisite() && (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('gravityview/gravityview.php')); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | flush_rewrite_rules(); |
213 | 213 | |
214 | 214 | // Update the current GV version |
215 | - update_option( 'gv_version', self::version ); |
|
215 | + update_option('gv_version', self::version); |
|
216 | 216 | |
217 | 217 | // Add the transient to redirect to configuration page |
218 | - set_transient( '_gv_activation_redirect', true, 60 ); |
|
218 | + set_transient('_gv_activation_redirect', true, 60); |
|
219 | 219 | |
220 | 220 | // Clear settings transient |
221 | - delete_transient( 'redux_edd_license_license_valid' ); |
|
221 | + delete_transient('redux_edd_license_license_valid'); |
|
222 | 222 | |
223 | 223 | GravityView_Roles_Capabilities::get_instance()->add_caps(); |
224 | 224 | } |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | * @return void |
245 | 245 | */ |
246 | 246 | public static function include_extension_framework() { |
247 | - if ( ! class_exists( 'GravityView_Extension' ) ) { |
|
248 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-extension.php' ); |
|
247 | + if (!class_exists('GravityView_Extension')) { |
|
248 | + require_once(GRAVITYVIEW_DIR.'includes/class-gravityview-extension.php'); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @since 1.7.5.1 |
256 | 256 | */ |
257 | 257 | public static function include_widget_class() { |
258 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
258 | + include_once(GRAVITYVIEW_DIR.'includes/widgets/class-gravityview-widget.php'); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -267,17 +267,17 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function load_plugin_textdomain() { |
269 | 269 | |
270 | - $loaded = load_plugin_textdomain( 'gravityview', false, '/languages/' ); |
|
271 | - if ( ! $loaded ) { |
|
272 | - $loaded = load_muplugin_textdomain( 'gravityview', '/languages/' ); |
|
270 | + $loaded = load_plugin_textdomain('gravityview', false, '/languages/'); |
|
271 | + if (!$loaded) { |
|
272 | + $loaded = load_muplugin_textdomain('gravityview', '/languages/'); |
|
273 | 273 | } |
274 | - if ( ! $loaded ) { |
|
275 | - $loaded = load_theme_textdomain( 'gravityview', '/languages/' ); |
|
274 | + if (!$loaded) { |
|
275 | + $loaded = load_theme_textdomain('gravityview', '/languages/'); |
|
276 | 276 | } |
277 | - if ( ! $loaded ) { |
|
278 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
|
279 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
280 | - load_textdomain( 'gravityview', $mofile ); |
|
277 | + if (!$loaded) { |
|
278 | + $locale = apply_filters('plugin_locale', get_locale(), 'gravityview'); |
|
279 | + $mofile = dirname(__FILE__).'/languages/gravityview-'.$locale.'.mo'; |
|
280 | + load_textdomain('gravityview', $mofile); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | } |
@@ -289,9 +289,9 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public static function is_admin() { |
291 | 291 | |
292 | - $doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false; |
|
292 | + $doing_ajax = defined('DOING_AJAX') ? DOING_AJAX : false; |
|
293 | 293 | |
294 | - return is_admin() && ! $doing_ajax; |
|
294 | + return is_admin() && !$doing_ajax; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -302,27 +302,27 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function frontend_actions() { |
304 | 304 | |
305 | - if( self::is_admin() ) { return; } |
|
305 | + if (self::is_admin()) { return; } |
|
306 | 306 | |
307 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
|
308 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
309 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
310 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
311 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
|
307 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-image.php'); |
|
308 | + include_once(GRAVITYVIEW_DIR.'includes/class-template.php'); |
|
309 | + include_once(GRAVITYVIEW_DIR.'includes/class-api.php'); |
|
310 | + include_once(GRAVITYVIEW_DIR.'includes/class-frontend-views.php'); |
|
311 | + include_once(GRAVITYVIEW_DIR.'includes/class-gravityview-change-entry-creator.php'); |
|
312 | 312 | |
313 | 313 | |
314 | 314 | /** |
315 | 315 | * When an entry is created, check if we need to update the custom slug meta |
316 | 316 | * todo: move this to its own class.. |
317 | 317 | */ |
318 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
318 | + add_action('gform_entry_created', array('GravityView_API', 'entry_create_custom_slug'), 10, 2); |
|
319 | 319 | |
320 | 320 | /** |
321 | 321 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
322 | 322 | * |
323 | 323 | * Nice place to insert extensions' frontend stuff |
324 | 324 | */ |
325 | - do_action( 'gravityview_include_frontend_actions' ); |
|
325 | + do_action('gravityview_include_frontend_actions'); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -332,15 +332,15 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public static function get_default_widget_areas() { |
334 | 334 | $default_areas = array( |
335 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
336 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
335 | + array('1-1' => array(array('areaid' => 'top', 'title' => __('Top', 'gravityview'), 'subtitle' => ''))), |
|
336 | + array('1-2' => array(array('areaid' => 'left', 'title' => __('Left', 'gravityview'), 'subtitle' => '')), '2-2' => array(array('areaid' => 'right', 'title' => __('Right', 'gravityview'), 'subtitle' => ''))), |
|
337 | 337 | ); |
338 | 338 | |
339 | 339 | /** |
340 | 340 | * @filter `gravityview_widget_active_areas` Array of zones available for widgets to be dropped into |
341 | 341 | * @param array $default_areas Definition for default widget areas |
342 | 342 | */ |
343 | - return apply_filters( 'gravityview_widget_active_areas', $default_areas ); |
|
343 | + return apply_filters('gravityview_widget_active_areas', $default_areas); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** DEBUG */ |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * @param mixed $data Additional data to display |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public static function log_debug( $message, $data = null ){ |
|
354 | + public static function log_debug($message, $data = null) { |
|
355 | 355 | /** |
356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
357 | 357 | * @param string $message Message to display |
358 | 358 | * @param mixed $data Supporting data to print alongside it |
359 | 359 | */ |
360 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
360 | + do_action('gravityview_log_debug', $message, $data); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -365,13 +365,13 @@ discard block |
||
365 | 365 | * @param string $message log message |
366 | 366 | * @return void |
367 | 367 | */ |
368 | - public static function log_error( $message, $data = null ){ |
|
368 | + public static function log_error($message, $data = null) { |
|
369 | 369 | /** |
370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
371 | 371 | * @param string $message Error message to display |
372 | 372 | * @param mixed $data Supporting data to print alongside it |
373 | 373 | */ |
374 | - do_action( 'gravityview_log_error', $message, $data ); |
|
374 | + do_action('gravityview_log_error', $message, $data); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | } // end class GravityView_Plugin |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'created_by'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'isnot' ); |
|
12 | + var $search_operators = array('is', 'isnot'); |
|
13 | 13 | |
14 | 14 | var $group = 'meta'; |
15 | 15 | |
16 | 16 | var $_custom_merge_tag = 'created_by'; |
17 | 17 | |
18 | 18 | public function __construct() { |
19 | - $this->label = esc_attr__( 'Created By', 'gravityview' ); |
|
19 | + $this->label = esc_attr__('Created By', 'gravityview'); |
|
20 | 20 | parent::__construct(); |
21 | 21 | } |
22 | 22 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return array Modified merge tags |
32 | 32 | */ |
33 | - protected function custom_merge_tags( $form = array(), $fields = array() ) { |
|
33 | + protected function custom_merge_tags($form = array(), $fields = array()) { |
|
34 | 34 | |
35 | 35 | $merge_tags = array( |
36 | 36 | array( |
@@ -75,52 +75,52 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return string Text, with user variables replaced, if they existed |
77 | 77 | */ |
78 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
78 | + public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) { |
|
79 | 79 | |
80 | 80 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
81 | - if( empty( $entry['created_by'] ) ) { |
|
81 | + if (empty($entry['created_by'])) { |
|
82 | 82 | return $text; |
83 | 83 | } |
84 | 84 | |
85 | 85 | // Get the creator of the entry |
86 | - $entry_creator = new WP_User( $entry['created_by'] ); |
|
86 | + $entry_creator = new WP_User($entry['created_by']); |
|
87 | 87 | |
88 | - foreach ( $matches as $match ) { |
|
88 | + foreach ($matches as $match) { |
|
89 | 89 | |
90 | 90 | $full_tag = $match[0]; |
91 | 91 | $property = $match[1]; |
92 | 92 | |
93 | - switch( $property ) { |
|
93 | + switch ($property) { |
|
94 | 94 | /** @since 1.13.2 */ |
95 | 95 | case 'roles': |
96 | - $value = implode( ', ', $entry_creator->roles ); |
|
96 | + $value = implode(', ', $entry_creator->roles); |
|
97 | 97 | break; |
98 | 98 | default: |
99 | - $value = $entry_creator->get( $property ); |
|
99 | + $value = $entry_creator->get($property); |
|
100 | 100 | } |
101 | 101 | |
102 | - $value = $url_encode ? urlencode( $value ) : $value; |
|
102 | + $value = $url_encode ? urlencode($value) : $value; |
|
103 | 103 | |
104 | - $value = $esc_html ? esc_html( $value ) : $value; |
|
104 | + $value = $esc_html ? esc_html($value) : $value; |
|
105 | 105 | |
106 | - $text = str_replace( $full_tag, $value, $text ); |
|
106 | + $text = str_replace($full_tag, $value, $text); |
|
107 | 107 | } |
108 | 108 | |
109 | - unset( $entry_creator ); |
|
109 | + unset($entry_creator); |
|
110 | 110 | |
111 | 111 | return $text; |
112 | 112 | } |
113 | 113 | |
114 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
114 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
115 | 115 | |
116 | - if( 'edit' === $context ) { |
|
116 | + if ('edit' === $context) { |
|
117 | 117 | return $field_options; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $field_options['name_display'] = array( |
121 | 121 | 'type' => 'select', |
122 | - 'label' => __( 'User Format', 'gravityview' ), |
|
123 | - 'desc' => __( 'How should the User information be displayed?', 'gravityview'), |
|
122 | + 'label' => __('User Format', 'gravityview'), |
|
123 | + 'desc' => __('How should the User information be displayed?', 'gravityview'), |
|
124 | 124 | 'choices' => array( |
125 | 125 | 'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'), |
126 | 126 | 'user_login' => __('Username (Example: "nostromo")', 'gravityview'), |