@@ -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 |
@@ -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 | } |