@@ -7,21 +7,21 @@ |
||
7 | 7 | |
8 | 8 | var $name = 'post_content'; |
9 | 9 | |
10 | - var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' ); |
|
10 | + var $search_operators = array('is', 'isnot', 'contains', 'starts_with', 'ends_with'); |
|
11 | 11 | |
12 | 12 | var $_gf_field_class_name = 'GF_Field_Post_Content'; |
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 | - unset( $field_options['show_as_link'] ); |
|
18 | + unset($field_options['show_as_link']); |
|
19 | 19 | |
20 | - if( 'edit' === $context ) { |
|
20 | + if ('edit' === $context) { |
|
21 | 21 | return $field_options; |
22 | 22 | } |
23 | 23 | |
24 | - $this->add_field_support('dynamic_data', $field_options ); |
|
24 | + $this->add_field_support('dynamic_data', $field_options); |
|
25 | 25 | |
26 | 26 | return $field_options; |
27 | 27 | } |
@@ -9,24 +9,24 @@ |
||
9 | 9 | |
10 | 10 | var $name = 'number'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' ); |
|
12 | + var $search_operators = array('is', 'isnot', 'greater_than', 'less_than'); |
|
13 | 13 | |
14 | 14 | var $_gf_field_class_name = 'GF_Field_Number'; |
15 | 15 | |
16 | 16 | var $group = 'standard'; |
17 | 17 | |
18 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
18 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
19 | 19 | |
20 | 20 | $field_options['number_format'] = array( |
21 | 21 | 'type' => 'checkbox', |
22 | - 'label' => __( 'Format number?', 'gravityview' ), |
|
22 | + 'label' => __('Format number?', 'gravityview'), |
|
23 | 23 | 'desc' => __('Display numbers with thousands separators.', 'gravityview'), |
24 | 24 | 'value' => false, |
25 | 25 | ); |
26 | 26 | |
27 | 27 | $field_options['decimals'] = array( |
28 | 28 | 'type' => 'number', |
29 | - 'label' => __( 'Decimals', 'gravityview' ), |
|
29 | + 'label' => __('Decimals', 'gravityview'), |
|
30 | 30 | 'desc' => __('Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview'), |
31 | 31 | 'value' => '', |
32 | 32 | 'merge_tags' => false, |
@@ -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 |
@@ -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 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | var $name = 'custom'; |
10 | 10 | |
11 | - var $contexts = array( 'single', 'multiple', 'edit' ); |
|
11 | + var $contexts = array('single', 'multiple', 'edit'); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var bool |
@@ -25,23 +25,23 @@ discard block |
||
25 | 25 | var $group = 'gravityview'; |
26 | 26 | |
27 | 27 | public function __construct() { |
28 | - $this->label = esc_attr__( 'Custom Content', 'gravityview' ); |
|
28 | + $this->label = esc_attr__('Custom Content', 'gravityview'); |
|
29 | 29 | parent::__construct(); |
30 | 30 | } |
31 | 31 | |
32 | - function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
|
32 | + function field_options($field_options, $template_id, $field_id, $context, $input_type) { |
|
33 | 33 | |
34 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
34 | + unset ($field_options['search_filter'], $field_options['show_as_link']); |
|
35 | 35 | |
36 | - if( 'edit' === $context ) { |
|
36 | + if ('edit' === $context) { |
|
37 | 37 | return $field_options; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $new_fields = array( |
41 | 41 | 'content' => array( |
42 | 42 | 'type' => 'textarea', |
43 | - 'label' => __( 'Custom Content', 'gravityview' ), |
|
44 | - 'desc' => sprintf( __( 'Enter text or HTML. Also supports shortcodes. You can show or hide data using the %s shortcode (%slearn more%s).', 'gravityview' ), '<code>[gvlogic]</code>', '<a href="http://docs.gravityview.co/article/252-gvlogic-shortcode">', '</a>' ), |
|
43 | + 'label' => __('Custom Content', 'gravityview'), |
|
44 | + 'desc' => sprintf(__('Enter text or HTML. Also supports shortcodes. You can show or hide data using the %s shortcode (%slearn more%s).', 'gravityview'), '<code>[gvlogic]</code>', '<a href="http://docs.gravityview.co/article/252-gvlogic-shortcode">', '</a>'), |
|
45 | 45 | 'value' => '', |
46 | 46 | 'class' => 'code', |
47 | 47 | 'merge_tags' => 'force', |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | ), |
50 | 50 | 'wpautop' => array( |
51 | 51 | 'type' => 'checkbox', |
52 | - 'label' => __( 'Automatically add paragraphs to content', 'gravityview' ), |
|
53 | - 'tooltip' => __( 'Wrap each block of text in an HTML paragraph tag (recommended for text).', 'gravityview' ), |
|
52 | + 'label' => __('Automatically add paragraphs to content', 'gravityview'), |
|
53 | + 'tooltip' => __('Wrap each block of text in an HTML paragraph tag (recommended for text).', 'gravityview'), |
|
54 | 54 | 'value' => '', |
55 | 55 | ), |
56 | 56 | ); |
@@ -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 |