@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | |
29 | 29 | $this->id = $tab = 'add-ons'; |
30 | 30 | $this->option_group = $page = 'add-ons'; |
31 | - $this->label = __( 'Add-ons', 'google-calendar-events' ); |
|
31 | + $this->label = __('Add-ons', 'google-calendar-events'); |
|
32 | 32 | $this->description = ''; |
33 | 33 | $this->sections = $this->add_sections(); |
34 | 34 | $this->fields = $this->add_fields(); |
35 | 35 | |
36 | 36 | // Disable the submit button for this page. |
37 | - add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } ); |
|
37 | + add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } ); |
|
38 | 38 | |
39 | 39 | // Add html. |
40 | - add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) ); |
|
40 | + add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html')); |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | // @todo pull data from simplecalendar.io to showcase add-ons |
52 | 52 | $js_redirect = '<script type="text/javascript">'; |
53 | - $js_redirect .= 'window.location = "' . simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'plugin-submenu-link', true ) . '"'; |
|
53 | + $js_redirect .= 'window.location = "'.simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'plugin-submenu-link', true).'"'; |
|
54 | 54 | $js_redirect .= '</script>'; |
55 | 55 | |
56 | 56 | echo $js_redirect; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Meta_Box; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -28,38 +28,38 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param \WP_Post $post |
30 | 30 | */ |
31 | - public static function html( $post ) { |
|
31 | + public static function html($post) { |
|
32 | 32 | |
33 | 33 | // @see Meta_Boxes::save_meta_boxes() |
34 | - wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' ); |
|
34 | + wp_nonce_field('simcal_save_data', 'simcal_meta_nonce'); |
|
35 | 35 | |
36 | 36 | $calendars = simcal_get_calendars(); |
37 | 37 | |
38 | - simcal_print_field( array( |
|
38 | + simcal_print_field(array( |
|
39 | 39 | 'type' => 'select', |
40 | 40 | 'id' => '_simcal_attach_calendar_id', |
41 | 41 | 'name' => '_simcal_attach_calendar_id', |
42 | - 'enhanced' => count( $calendars ) > 15 ? 'enhanced' : '', |
|
42 | + 'enhanced' => count($calendars) > 15 ? 'enhanced' : '', |
|
43 | 43 | 'allow_void' => 'allow_void', |
44 | - 'value' => absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) ), |
|
44 | + 'value' => absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true)), |
|
45 | 45 | 'options' => $calendars, |
46 | 46 | 'attributes' => array( |
47 | 47 | 'data-allowclear' => 'true', |
48 | 48 | ) |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | - $position = get_post_meta( $post->ID, '_simcal_attach_calendar_position', true ); |
|
51 | + $position = get_post_meta($post->ID, '_simcal_attach_calendar_position', true); |
|
52 | 52 | |
53 | - simcal_print_field( array( |
|
53 | + simcal_print_field(array( |
|
54 | 54 | 'type' => 'radio', |
55 | 55 | 'id' => '_simcal_attach_calendar_position', |
56 | 56 | 'name' => '_simcal_attach_calendar_position', |
57 | 57 | 'value' => $position ? $position : 'after', |
58 | 58 | 'options' => array( |
59 | - 'after' => __( 'After Content', 'google-calendar-events' ), |
|
60 | - 'before' => __( 'Before Content', 'google-calendar-events' ), |
|
59 | + 'after' => __('After Content', 'google-calendar-events'), |
|
60 | + 'before' => __('Before Content', 'google-calendar-events'), |
|
61 | 61 | ), |
62 | - ) ); |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | * @param int $post_id |
72 | 72 | * @param \WP_Post $post |
73 | 73 | */ |
74 | - public static function save( $post_id, $post ) { |
|
74 | + public static function save($post_id, $post) { |
|
75 | 75 | |
76 | - $id = isset( $_POST['_simcal_attach_calendar_id'] ) ? absint( $_POST['_simcal_attach_calendar_id'] ) : ''; |
|
77 | - update_post_meta( $post_id, '_simcal_attach_calendar_id', $id ); |
|
76 | + $id = isset($_POST['_simcal_attach_calendar_id']) ? absint($_POST['_simcal_attach_calendar_id']) : ''; |
|
77 | + update_post_meta($post_id, '_simcal_attach_calendar_id', $id); |
|
78 | 78 | |
79 | - $position = isset( $_POST['_simcal_attach_calendar_position'] ) ? sanitize_title( $_POST['_simcal_attach_calendar_position'] ) : 'after'; |
|
80 | - update_post_meta( $post_id, '_simcal_attach_calendar_position', $position ); |
|
79 | + $position = isset($_POST['_simcal_attach_calendar_position']) ? sanitize_title($_POST['_simcal_attach_calendar_position']) : 'after'; |
|
80 | + update_post_meta($post_id, '_simcal_attach_calendar_position', $position); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Abstracts; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -150,71 +150,71 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @param array $field Field data. |
152 | 152 | */ |
153 | - public function __construct( $field ) { |
|
153 | + public function __construct($field) { |
|
154 | 154 | |
155 | 155 | // Field properties. |
156 | - if ( isset( $field['title'] ) ) { |
|
157 | - $this->title = esc_attr( $field['title'] ); |
|
156 | + if (isset($field['title'])) { |
|
157 | + $this->title = esc_attr($field['title']); |
|
158 | 158 | } |
159 | - if ( isset( $field['description'] ) ) { |
|
160 | - $this->description = wp_kses_post( $field['description'] ); |
|
159 | + if (isset($field['description'])) { |
|
160 | + $this->description = wp_kses_post($field['description']); |
|
161 | 161 | } |
162 | - if ( isset( $field['type'] ) ) { |
|
163 | - $this->type = esc_attr( $field['type'] ); |
|
162 | + if (isset($field['type'])) { |
|
163 | + $this->type = esc_attr($field['type']); |
|
164 | 164 | } |
165 | - if ( isset( $field['name'] ) ) { |
|
166 | - $this->name = esc_attr( $field['name'] ); |
|
165 | + if (isset($field['name'])) { |
|
166 | + $this->name = esc_attr($field['name']); |
|
167 | 167 | } |
168 | - if ( isset( $field['id'] ) ) { |
|
169 | - $this->id = esc_attr( $field['id'] ); |
|
168 | + if (isset($field['id'])) { |
|
169 | + $this->id = esc_attr($field['id']); |
|
170 | 170 | } |
171 | - if ( isset( $field['placeholder'] ) ) { |
|
172 | - $this->placeholder = esc_attr( $field['placeholder'] ); |
|
171 | + if (isset($field['placeholder'])) { |
|
172 | + $this->placeholder = esc_attr($field['placeholder']); |
|
173 | 173 | } |
174 | - if ( isset( $field['options'] ) && is_array( $field['options'] ) ) { |
|
175 | - $this->options = array_map( 'esc_attr', $field['options'] ); |
|
174 | + if (isset($field['options']) && is_array($field['options'])) { |
|
175 | + $this->options = array_map('esc_attr', $field['options']); |
|
176 | 176 | } |
177 | - if ( isset( $field['text'] ) ) { |
|
177 | + if (isset($field['text'])) { |
|
178 | 178 | $this->text = $field['text']; |
179 | 179 | } |
180 | 180 | |
181 | 181 | // Escaping. |
182 | - if ( ! empty( $field['escaping'] ) && ( is_string( $field['escaping'] ) || is_array( $field['escaping'] ) ) ) { |
|
183 | - if ( isset( $field['default'] ) ) { |
|
184 | - $this->default = $this->escape_callback( $field['escaping'], $field['default'] ); |
|
182 | + if ( ! empty($field['escaping']) && (is_string($field['escaping']) || is_array($field['escaping']))) { |
|
183 | + if (isset($field['default'])) { |
|
184 | + $this->default = $this->escape_callback($field['escaping'], $field['default']); |
|
185 | 185 | } |
186 | - if ( isset( $field['value'] ) ) { |
|
187 | - $this->value = $this->escape_callback( $field['escaping'], $field['value'] ); |
|
186 | + if (isset($field['value'])) { |
|
187 | + $this->value = $this->escape_callback($field['escaping'], $field['value']); |
|
188 | 188 | } |
189 | 189 | } else { |
190 | - if ( isset( $field['default'] ) ) { |
|
191 | - $this->default = $this->escape( $field['default'] ); |
|
190 | + if (isset($field['default'])) { |
|
191 | + $this->default = $this->escape($field['default']); |
|
192 | 192 | } |
193 | - if ( isset( $field['value'] ) ) { |
|
194 | - $this->value = $this->escape( $field['value'] ); |
|
193 | + if (isset($field['value'])) { |
|
194 | + $this->value = $this->escape($field['value']); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
198 | 198 | // Validation. |
199 | - if ( ! empty( $field['validation'] ) ) { |
|
200 | - $this->validation = $this->validate( $field['validation'], $this->value ); |
|
199 | + if ( ! empty($field['validation'])) { |
|
200 | + $this->validation = $this->validate($field['validation'], $this->value); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | // CSS classes and styles. |
204 | - $classes = isset( $field['class'] ) ? $field['class'] : ''; |
|
205 | - $this->set_class( $classes ); |
|
206 | - if ( isset( $field['style'] ) ) { |
|
207 | - $this->set_style( $field['style'] ); |
|
204 | + $classes = isset($field['class']) ? $field['class'] : ''; |
|
205 | + $this->set_class($classes); |
|
206 | + if (isset($field['style'])) { |
|
207 | + $this->set_style($field['style']); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // Custom attributes. |
211 | - if ( isset( $field['attributes'] ) ) { |
|
212 | - $this->set_attributes( $field['attributes'] ); |
|
211 | + if (isset($field['attributes'])) { |
|
212 | + $this->set_attributes($field['attributes']); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | // Tooltip markup. |
216 | - if ( isset( $field['tooltip'] ) ) { |
|
217 | - $this->tooltip = ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . esc_attr( $field['tooltip'] ) . '"></i> ' ; |
|
216 | + if (isset($field['tooltip'])) { |
|
217 | + $this->tooltip = ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.esc_attr($field['tooltip']).'"></i> '; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return void |
229 | 229 | */ |
230 | - public function set_attributes( $attributes ) { |
|
230 | + public function set_attributes($attributes) { |
|
231 | 231 | |
232 | 232 | $attr = ''; |
233 | 233 | |
234 | - if ( ! empty( $attributes ) && is_array( $attributes ) ) { |
|
235 | - foreach ( $attributes as $k => $v ) { |
|
236 | - $attr .= esc_attr( $k ) . '="' . esc_attr( $v ) . '" '; |
|
234 | + if ( ! empty($attributes) && is_array($attributes)) { |
|
235 | + foreach ($attributes as $k => $v) { |
|
236 | + $attr .= esc_attr($k).'="'.esc_attr($v).'" '; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return void |
251 | 251 | */ |
252 | - public function set_style( $css ) { |
|
252 | + public function set_style($css) { |
|
253 | 253 | |
254 | 254 | $styles = ''; |
255 | 255 | |
256 | - if ( ! empty( $css ) && is_array( $css ) ) { |
|
257 | - foreach ( $css as $k => $v ) { |
|
258 | - $styles .= esc_attr( $k ) . ': ' . esc_attr( $v ) . '; '; |
|
256 | + if ( ! empty($css) && is_array($css)) { |
|
257 | + foreach ($css as $k => $v) { |
|
258 | + $styles .= esc_attr($k).': '.esc_attr($v).'; '; |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -271,23 +271,23 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - public function set_class( $class ) { |
|
274 | + public function set_class($class) { |
|
275 | 275 | |
276 | 276 | $classes = ''; |
277 | 277 | $type_class = ''; |
278 | 278 | $error = ''; |
279 | 279 | |
280 | - if ( ! empty( $class ) && is_array( $class ) ) { |
|
281 | - $classes = implode( ' ', array_map( 'esc_attr', $class ) ); |
|
280 | + if ( ! empty($class) && is_array($class)) { |
|
281 | + $classes = implode(' ', array_map('esc_attr', $class)); |
|
282 | 282 | } |
283 | - if ( ! empty( $this->type_class ) ) { |
|
284 | - $type_class = esc_attr( $this->type_class ); |
|
283 | + if ( ! empty($this->type_class)) { |
|
284 | + $type_class = esc_attr($this->type_class); |
|
285 | 285 | } |
286 | - if ( true !== $this->validation && ! empty( $this->validation ) ) { |
|
286 | + if (true !== $this->validation && ! empty($this->validation)) { |
|
287 | 287 | $error = 'simcal-field-error '; |
288 | 288 | } |
289 | 289 | |
290 | - $this->class = trim( $error . 'simcal-field ' . $type_class . ' ' . $classes ); |
|
290 | + $this->class = trim($error.'simcal-field '.$type_class.' '.$classes); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @return array|string |
304 | 304 | */ |
305 | - protected function escape( $value ) { |
|
306 | - return ! empty( $value ) ? ( is_array( $value ) ? array_map( 'esc_attr', $value ) : esc_attr( $value ) ) : ''; |
|
305 | + protected function escape($value) { |
|
306 | + return ! empty($value) ? (is_array($value) ? array_map('esc_attr', $value) : esc_attr($value)) : ''; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | * |
320 | 320 | * @return mixed |
321 | 321 | */ |
322 | - protected function escape_callback( $callback, $value ) { |
|
323 | - if ( $callback && ( is_string( $callback ) || is_array( $callback ) ) ) { |
|
324 | - return call_user_func( $callback, $value ); |
|
322 | + protected function escape_callback($callback, $value) { |
|
323 | + if ($callback && (is_string($callback) || is_array($callback))) { |
|
324 | + return call_user_func($callback, $value); |
|
325 | 325 | } |
326 | - return esc_attr( $value ); |
|
326 | + return esc_attr($value); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @return true|string Expected to return bool (true) if passes, message string if not. |
341 | 341 | */ |
342 | - protected function validate( $callback, $value ) { |
|
343 | - if ( $callback && ( is_string( $callback ) || is_array( $callback ) ) ) { |
|
344 | - $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : ''; |
|
345 | - return call_user_func( $callback, $value, $screen ); |
|
342 | + protected function validate($callback, $value) { |
|
343 | + if ($callback && (is_string($callback) || is_array($callback))) { |
|
344 | + $screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
|
345 | + return call_user_func($callback, $value, $screen); |
|
346 | 346 | } |
347 | 347 | return true; |
348 | 348 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | use SimpleCalendar\Abstracts\Calendar; |
10 | 10 | use SimpleCalendar\Abstracts\Admin_Page; |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -39,20 +39,20 @@ discard block |
||
39 | 39 | |
40 | 40 | $this->id = 'calendars'; |
41 | 41 | $this->option_group = 'settings'; |
42 | - $this->label = __( 'Calendars', 'google-calendar-events' ); |
|
42 | + $this->label = __('Calendars', 'google-calendar-events'); |
|
43 | 43 | //$this->description = __( 'Manage calendar preferences and calendar types settings and options.', 'google-calendar-events' ); |
44 | 44 | |
45 | 45 | $calendars = simcal_get_calendar_types(); |
46 | 46 | $calendar_settings = array(); |
47 | - if ( ! empty( $calendars ) && is_array( $calendars ) ) { |
|
48 | - foreach ( $calendars as $calendar => $views ) { |
|
47 | + if ( ! empty($calendars) && is_array($calendars)) { |
|
48 | + foreach ($calendars as $calendar => $views) { |
|
49 | 49 | |
50 | - $calendar_type = simcal_get_calendar( $calendar ); |
|
50 | + $calendar_type = simcal_get_calendar($calendar); |
|
51 | 51 | |
52 | - if ( $calendar_type instanceof Calendar ) { |
|
52 | + if ($calendar_type instanceof Calendar) { |
|
53 | 53 | $settings = $calendar_type->settings_fields(); |
54 | - if ( ! empty( $settings ) ) { |
|
55 | - $calendar_settings[ $calendar ] = $settings; |
|
54 | + if ( ! empty($settings)) { |
|
55 | + $calendar_settings[$calendar] = $settings; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | |
75 | 75 | $sections = array( |
76 | 76 | 'general' => array( |
77 | - 'title' => __( 'General', 'google-calendar-events' ), |
|
77 | + 'title' => __('General', 'google-calendar-events'), |
|
78 | 78 | 'description' => '', |
79 | 79 | ), |
80 | 80 | ); |
81 | 81 | |
82 | 82 | $calendar_types = $this->calendar_types; |
83 | 83 | |
84 | - if ( ! empty( $calendar_types ) && is_array( $calendar_types ) ) { |
|
85 | - foreach ( $calendar_types as $calendar_type => $type ) { |
|
84 | + if ( ! empty($calendar_types) && is_array($calendar_types)) { |
|
85 | + foreach ($calendar_types as $calendar_type => $type) { |
|
86 | 86 | |
87 | - $sections[ $calendar_type ] = array( |
|
87 | + $sections[$calendar_type] = array( |
|
88 | 88 | 'title' => $type['name'], |
89 | 89 | 'description' => $type['description'], |
90 | 90 | ); |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - arsort( $calendar_types ); |
|
95 | + arsort($calendar_types); |
|
96 | 96 | |
97 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections ); |
|
97 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | |
109 | 109 | $fields = array(); |
110 | 110 | $feed_types = $this->calendar_types; |
111 | - $this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id ); |
|
111 | + $this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id); |
|
112 | 112 | |
113 | - foreach ( $this->sections as $section => $contents ) : |
|
113 | + foreach ($this->sections as $section => $contents) : |
|
114 | 114 | |
115 | - if ( 'general' == $section ) { |
|
115 | + if ('general' == $section) { |
|
116 | 116 | |
117 | 117 | $options = array(); |
118 | 118 | $post_types = get_post_types( |
@@ -124,36 +124,36 @@ discard block |
||
124 | 124 | 'objects', |
125 | 125 | 'not' |
126 | 126 | ); |
127 | - unset( $post_types['attachment'] ); |
|
128 | - unset( $post_types['calendar'] ); |
|
129 | - unset( $post_types['gce_feed'] ); |
|
130 | - foreach ( $post_types as $slug => $post_type ) { |
|
131 | - $options[ $slug ] = $post_type->label; |
|
127 | + unset($post_types['attachment']); |
|
128 | + unset($post_types['calendar']); |
|
129 | + unset($post_types['gce_feed']); |
|
130 | + foreach ($post_types as $slug => $post_type) { |
|
131 | + $options[$slug] = $post_type->label; |
|
132 | 132 | } |
133 | - asort( $options ); |
|
133 | + asort($options); |
|
134 | 134 | |
135 | - $fields[ $section ][] = array( |
|
135 | + $fields[$section][] = array( |
|
136 | 136 | 'type' => 'select', |
137 | 137 | 'multiselect' => 'multiselect', |
138 | 138 | 'enhanced' => 'enhanced', |
139 | - 'title' => __( 'Attach Calendars', 'google-calendar-events' ), |
|
140 | - 'tooltip' => __( 'You can choose on which content types to add the ability to attach calendars.', 'google-calendar-events' ), |
|
141 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][attach_calendars_posts]', |
|
142 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-attach-calendars-posts', |
|
143 | - 'value' => $this->get_option_value( $section, 'attach_calendars_posts' ), |
|
139 | + 'title' => __('Attach Calendars', 'google-calendar-events'), |
|
140 | + 'tooltip' => __('You can choose on which content types to add the ability to attach calendars.', 'google-calendar-events'), |
|
141 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][attach_calendars_posts]', |
|
142 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-attach-calendars-posts', |
|
143 | + 'value' => $this->get_option_value($section, 'attach_calendars_posts'), |
|
144 | 144 | 'default' => 'post,page', |
145 | 145 | 'options' => $options, |
146 | 146 | ); |
147 | 147 | |
148 | - } elseif ( isset( $feed_types[ $section ]['fields'] ) ) { |
|
148 | + } elseif (isset($feed_types[$section]['fields'])) { |
|
149 | 149 | |
150 | - foreach ( $feed_types[ $section ]['fields'] as $key => $args ) { |
|
150 | + foreach ($feed_types[$section]['fields'] as $key => $args) { |
|
151 | 151 | |
152 | - $fields[ $section ][] = array_merge( $args, array( |
|
153 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][' . $key . ']', |
|
154 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $key, |
|
155 | - 'value' => $this->get_option_value( $section, $key ) |
|
156 | - ) ); |
|
152 | + $fields[$section][] = array_merge($args, array( |
|
153 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.']['.$key.']', |
|
154 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$key, |
|
155 | + 'value' => $this->get_option_value($section, $key) |
|
156 | + )); |
|
157 | 157 | |
158 | 158 | } |
159 | 159 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | endforeach; |
163 | 163 | |
164 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields ); |
|
164 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use SimpleCalendar\Abstracts\Feed; |
13 | 13 | use SimpleCalendar\Feeds\Admin\Google_Admin as Admin; |
14 | 14 | |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -90,35 +90,35 @@ discard block |
||
90 | 90 | * @param string|Calendar $calendar |
91 | 91 | * @param bool $load_admin |
92 | 92 | */ |
93 | - public function __construct( $calendar = '', $load_admin = true ) { |
|
93 | + public function __construct($calendar = '', $load_admin = true) { |
|
94 | 94 | |
95 | - parent::__construct( $calendar ); |
|
95 | + parent::__construct($calendar); |
|
96 | 96 | |
97 | 97 | $this->type = 'google'; |
98 | - $this->name = __( 'Google Calendar', 'google-calendar-events' ); |
|
98 | + $this->name = __('Google Calendar', 'google-calendar-events'); |
|
99 | 99 | |
100 | 100 | // Google client config. |
101 | - $settings = get_option( 'simple-calendar_settings_feeds' ); |
|
102 | - $this->google_api_key = isset( $settings['google']['api_key'] ) ? esc_attr( $settings['google']['api_key'] ) : ''; |
|
103 | - $this->google_client_scopes = array( \Google_Service_Calendar::CALENDAR_READONLY ); |
|
101 | + $settings = get_option('simple-calendar_settings_feeds'); |
|
102 | + $this->google_api_key = isset($settings['google']['api_key']) ? esc_attr($settings['google']['api_key']) : ''; |
|
103 | + $this->google_client_scopes = array(\Google_Service_Calendar::CALENDAR_READONLY); |
|
104 | 104 | $this->google_client = $this->get_client(); |
105 | 105 | |
106 | - if ( $this->post_id > 0 ) { |
|
106 | + if ($this->post_id > 0) { |
|
107 | 107 | |
108 | 108 | // Google query args. |
109 | - $this->google_calendar_id = $this->esc_google_calendar_id( get_post_meta( $this->post_id, '_google_calendar_id', true ) ); |
|
110 | - $this->google_events_recurring = esc_attr( get_post_meta( $this->post_id, '_google_events_recurring', true ) ); |
|
109 | + $this->google_calendar_id = $this->esc_google_calendar_id(get_post_meta($this->post_id, '_google_calendar_id', true)); |
|
110 | + $this->google_events_recurring = esc_attr(get_post_meta($this->post_id, '_google_events_recurring', true)); |
|
111 | 111 | // note that google_search_query is used in a URL param and not as HTML output, so don't use esc_attr() on it |
112 | - $this->google_search_query = get_post_meta( $this->post_id, '_google_events_search_query', true ); |
|
113 | - $this->google_max_results = max( absint( get_post_meta( $this->post_id, '_google_events_max_results', true ) ), 1 ); |
|
112 | + $this->google_search_query = get_post_meta($this->post_id, '_google_events_search_query', true); |
|
113 | + $this->google_max_results = max(absint(get_post_meta($this->post_id, '_google_events_max_results', true)), 1); |
|
114 | 114 | |
115 | - if ( ! is_admin() || defined( 'DOING_AJAX' ) ) { |
|
116 | - $this->events = ! empty( $this->google_api_key ) ? $this->get_events() : array(); |
|
115 | + if ( ! is_admin() || defined('DOING_AJAX')) { |
|
116 | + $this->events = ! empty($this->google_api_key) ? $this->get_events() : array(); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( is_admin() && $load_admin ) { |
|
121 | - $admin = new Admin( $this, $this->google_api_key, $this->google_calendar_id ); |
|
120 | + if (is_admin() && $load_admin) { |
|
121 | + $admin = new Admin($this, $this->google_api_key, $this->google_calendar_id); |
|
122 | 122 | $this->settings = $admin->settings_fields(); |
123 | 123 | } |
124 | 124 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public function esc_google_calendar_id( $id ) { |
|
136 | - return base64_decode( $id ); |
|
135 | + public function esc_google_calendar_id($id) { |
|
136 | + return base64_decode($id); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -147,85 +147,85 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function get_events() { |
149 | 149 | |
150 | - $calendar = get_transient( '_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type ); |
|
150 | + $calendar = get_transient('_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type); |
|
151 | 151 | |
152 | - if ( empty( $calendar ) && ! empty( $this->google_calendar_id ) ) { |
|
152 | + if (empty($calendar) && ! empty($this->google_calendar_id)) { |
|
153 | 153 | |
154 | 154 | $error = ''; |
155 | 155 | |
156 | 156 | try { |
157 | - $response = $this->make_request( $this->google_calendar_id ); |
|
158 | - } catch ( \Exception $e ) { |
|
157 | + $response = $this->make_request($this->google_calendar_id); |
|
158 | + } catch (\Exception $e) { |
|
159 | 159 | $error .= $e->getMessage(); |
160 | 160 | } |
161 | 161 | |
162 | - if ( empty( $error ) && isset( $response['events'] ) && isset( $response['timezone'] ) ) { |
|
162 | + if (empty($error) && isset($response['events']) && isset($response['timezone'])) { |
|
163 | 163 | |
164 | - $calendar = array_merge( $response, array( 'events' => array() ) ); |
|
164 | + $calendar = array_merge($response, array('events' => array())); |
|
165 | 165 | |
166 | 166 | // If no timezone has been set, use calendar feed. |
167 | - if ( 'use_calendar' == $this->timezone_setting ) { |
|
167 | + if ('use_calendar' == $this->timezone_setting) { |
|
168 | 168 | $this->timezone = $calendar['timezone']; |
169 | 169 | } |
170 | 170 | |
171 | - $source = isset( $response['title'] ) ? sanitize_text_field( $response['title'] ) : ''; |
|
171 | + $source = isset($response['title']) ? sanitize_text_field($response['title']) : ''; |
|
172 | 172 | |
173 | - if ( ! empty( $response['events'] ) && is_array( $response['events'] ) ) { |
|
174 | - foreach ( $response['events'] as $event ) { |
|
175 | - if ( $event instanceof \Google_Service_Calendar_Event ) { |
|
173 | + if ( ! empty($response['events']) && is_array($response['events'])) { |
|
174 | + foreach ($response['events'] as $event) { |
|
175 | + if ($event instanceof \Google_Service_Calendar_Event) { |
|
176 | 176 | |
177 | 177 | // Visibility and status. |
178 | 178 | // Public calendars may have private events which can't be properly accessed by simple api key method. |
179 | 179 | // Also want to skip cancelled events (single occurences deleted from repeating events) |
180 | 180 | $visibility = $event->getVisibility(); |
181 | 181 | $status = $event->getStatus(); |
182 | - if ( $this->type == 'google' && ( $visibility == 'private' || $visibility == 'confidential' || $status == 'cancelled' ) ) { |
|
182 | + if ($this->type == 'google' && ($visibility == 'private' || $visibility == 'confidential' || $status == 'cancelled')) { |
|
183 | 183 | continue; |
184 | 184 | } |
185 | 185 | |
186 | 186 | // Event title & description. |
187 | - $title = strip_tags( $event->getSummary() ); |
|
188 | - $title = sanitize_text_field( iconv( mb_detect_encoding( $title, mb_detect_order(), true ), 'UTF-8', $title ) ); |
|
189 | - $description = wp_kses_post( iconv( mb_detect_encoding( $event->getDescription(), mb_detect_order(), true ), 'UTF-8', $event->getDescription() ) ); |
|
187 | + $title = strip_tags($event->getSummary()); |
|
188 | + $title = sanitize_text_field(iconv(mb_detect_encoding($title, mb_detect_order(), true), 'UTF-8', $title)); |
|
189 | + $description = wp_kses_post(iconv(mb_detect_encoding($event->getDescription(), mb_detect_order(), true), 'UTF-8', $event->getDescription())); |
|
190 | 190 | |
191 | 191 | $whole_day = false; |
192 | 192 | |
193 | 193 | // Event start properties. |
194 | - if( 'use_calendar' == $this->timezone_setting ) { |
|
194 | + if ('use_calendar' == $this->timezone_setting) { |
|
195 | 195 | $start_timezone = ! $event->getStart()->timeZone ? $calendar['timezone'] : $event->getStart()->timeZone; |
196 | 196 | } else { |
197 | 197 | $start_timezone = $this->timezone; |
198 | 198 | } |
199 | 199 | |
200 | - if ( is_null( $event->getStart()->dateTime ) ) { |
|
200 | + if (is_null($event->getStart()->dateTime)) { |
|
201 | 201 | // Whole day event. |
202 | - $date = Carbon::parse( $event->getStart()->date ); |
|
203 | - $google_start = Carbon::createFromDate( $date->year, $date->month, $date->day, $start_timezone )->startOfDay()->addSeconds( 59 ); |
|
204 | - $google_start_utc = Carbon::createFromDate( $date->year, $date->month, $date->day, 'UTC' )->startOfDay()->addSeconds( 59 ); |
|
202 | + $date = Carbon::parse($event->getStart()->date); |
|
203 | + $google_start = Carbon::createFromDate($date->year, $date->month, $date->day, $start_timezone)->startOfDay()->addSeconds(59); |
|
204 | + $google_start_utc = Carbon::createFromDate($date->year, $date->month, $date->day, 'UTC')->startOfDay()->addSeconds(59); |
|
205 | 205 | $whole_day = true; |
206 | 206 | } else { |
207 | - $date = Carbon::parse( $event->getStart()->dateTime ); |
|
207 | + $date = Carbon::parse($event->getStart()->dateTime); |
|
208 | 208 | |
209 | 209 | // Check if there is an event level timezone |
210 | - if( $event->getStart()->timeZone && 'use_calendar' == $this->timezone_setting ) { |
|
210 | + if ($event->getStart()->timeZone && 'use_calendar' == $this->timezone_setting) { |
|
211 | 211 | |
212 | 212 | // Get the two different times with the separate timezones so we can check the offsets next |
213 | - $google_start1 = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $date->timezone ); |
|
214 | - $google_start2 = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $event->getStart()->timeZone ); |
|
213 | + $google_start1 = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $date->timezone); |
|
214 | + $google_start2 = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $event->getStart()->timeZone); |
|
215 | 215 | |
216 | 216 | // Get the offset in hours |
217 | 217 | $offset1 = $google_start1->offsetHours; |
218 | 218 | $offset2 = $google_start2->offsetHours; |
219 | 219 | |
220 | 220 | // Get the difference between the two timezones |
221 | - $total_offset = ( $offset2 - $offset1 ); |
|
221 | + $total_offset = ($offset2 - $offset1); |
|
222 | 222 | |
223 | 223 | // Add the hours offset to the date hour |
224 | 224 | $date->hour += $total_offset; |
225 | 225 | } |
226 | 226 | |
227 | - $google_start = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $start_timezone ); |
|
228 | - $google_start_utc = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC' ); |
|
227 | + $google_start = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $start_timezone); |
|
228 | + $google_start_utc = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC'); |
|
229 | 229 | |
230 | 230 | $this->timezone = $start_timezone; |
231 | 231 | } |
@@ -236,43 +236,43 @@ discard block |
||
236 | 236 | |
237 | 237 | $end = $end_utc = $end_timezone = ''; |
238 | 238 | $span = 0; |
239 | - if ( false == $event->getEndTimeUnspecified() ) { |
|
239 | + if (false == $event->getEndTimeUnspecified()) { |
|
240 | 240 | |
241 | 241 | // Event end properties. |
242 | - if( 'use_calendar' == $this->timezone_setting ) { |
|
242 | + if ('use_calendar' == $this->timezone_setting) { |
|
243 | 243 | $end_timezone = ! $event->getEnd()->timeZone ? $calendar['timezone'] : $event->getEnd()->timeZone; |
244 | 244 | } else { |
245 | 245 | $end_timezone = $this->timezone; |
246 | 246 | } |
247 | 247 | |
248 | - if ( is_null( $event->getEnd()->dateTime ) ) { |
|
248 | + if (is_null($event->getEnd()->dateTime)) { |
|
249 | 249 | // Whole day event. |
250 | - $date = Carbon::parse( $event->getEnd()->date ); |
|
251 | - $google_end = Carbon::createFromDate( $date->year, $date->month, $date->day, $end_timezone )->startOfDay()->subSeconds( 59 ); |
|
252 | - $google_end_utc = Carbon::createFromDate( $date->year, $date->month, $date->day, 'UTC' )->startOfDay()->subSeconds( 59 ); |
|
250 | + $date = Carbon::parse($event->getEnd()->date); |
|
251 | + $google_end = Carbon::createFromDate($date->year, $date->month, $date->day, $end_timezone)->startOfDay()->subSeconds(59); |
|
252 | + $google_end_utc = Carbon::createFromDate($date->year, $date->month, $date->day, 'UTC')->startOfDay()->subSeconds(59); |
|
253 | 253 | } else { |
254 | - $date = Carbon::parse( $event->getEnd()->dateTime ); |
|
254 | + $date = Carbon::parse($event->getEnd()->dateTime); |
|
255 | 255 | |
256 | 256 | // Check if there is an event level timezone |
257 | - if( $event->getEnd()->timeZone && 'use_calendar' == $this->timezone_setting ) { |
|
257 | + if ($event->getEnd()->timeZone && 'use_calendar' == $this->timezone_setting) { |
|
258 | 258 | |
259 | 259 | // Get the two different times with the separate timezones so we can check the offsets next |
260 | - $google_start1 = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $date->timezone ); |
|
261 | - $google_start2 = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $event->getEnd()->timeZone ); |
|
260 | + $google_start1 = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $date->timezone); |
|
261 | + $google_start2 = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $event->getEnd()->timeZone); |
|
262 | 262 | |
263 | 263 | // Get the offset in hours |
264 | 264 | $offset1 = $google_start1->offsetHours; |
265 | 265 | $offset2 = $google_start2->offsetHours; |
266 | 266 | |
267 | 267 | // Get the difference between the two timezones |
268 | - $total_offset = ( $offset2 - $offset1 ); |
|
268 | + $total_offset = ($offset2 - $offset1); |
|
269 | 269 | |
270 | 270 | // Add the hours offset to the date hour |
271 | 271 | $date->hour += $total_offset; |
272 | 272 | } |
273 | 273 | |
274 | - $google_end = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $end_timezone ); |
|
275 | - $google_end_utc = Carbon::create( $date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC' ); |
|
274 | + $google_end = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, $end_timezone); |
|
275 | + $google_end_utc = Carbon::create($date->year, $date->month, $date->day, $date->hour, $date->minute, $date->second, 'UTC'); |
|
276 | 276 | } |
277 | 277 | // End. |
278 | 278 | $end = $google_end->getTimestamp(); |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | $end_utc = $google_end_utc->getTimestamp(); |
281 | 281 | |
282 | 282 | // Count multiple days. |
283 | - $span = $google_start->diffInDays( $google_end ); |
|
283 | + $span = $google_start->diffInDays($google_end); |
|
284 | 284 | |
285 | - if ( $span == 0 ) { |
|
286 | - if ( ( $google_start->toDateString() !== $google_end->toDateString() ) && $google_end->toTimeString() != '00:00:00' ) { |
|
285 | + if ($span == 0) { |
|
286 | + if (($google_start->toDateString() !== $google_end->toDateString()) && $google_end->toTimeString() != '00:00:00') { |
|
287 | 287 | $span = 1; |
288 | 288 | } |
289 | 289 | } |
@@ -298,19 +298,19 @@ discard block |
||
298 | 298 | // Recurring event. |
299 | 299 | $recurrence = $event->getRecurrence(); |
300 | 300 | $recurring_id = $event->getRecurringEventId(); |
301 | - if ( ! $recurrence && $recurring_id ) { |
|
301 | + if ( ! $recurrence && $recurring_id) { |
|
302 | 302 | $recurrence = true; |
303 | 303 | } |
304 | 304 | |
305 | 305 | // Event link. |
306 | - if ( 'use_calendar' == $this->timezone_setting ) { |
|
307 | - $link = add_query_arg( array( 'ctz' => $this->timezone ), $event->getHtmlLink() ); |
|
306 | + if ('use_calendar' == $this->timezone_setting) { |
|
307 | + $link = add_query_arg(array('ctz' => $this->timezone), $event->getHtmlLink()); |
|
308 | 308 | } else { |
309 | 309 | $link = $event->getHtmlLink(); |
310 | 310 | } |
311 | 311 | |
312 | 312 | // Build the event. |
313 | - $calendar['events'][ intval( $start ) ][] = array( |
|
313 | + $calendar['events'][intval($start)][] = array( |
|
314 | 314 | 'type' => 'google-calendar', |
315 | 315 | 'source' => $source, |
316 | 316 | 'title' => $title, |
@@ -338,24 +338,24 @@ discard block |
||
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
341 | - if ( ! empty( $calendar['events'] ) ) { |
|
341 | + if ( ! empty($calendar['events'])) { |
|
342 | 342 | |
343 | - ksort( $calendar['events'], SORT_NUMERIC ); |
|
343 | + ksort($calendar['events'], SORT_NUMERIC); |
|
344 | 344 | |
345 | 345 | set_transient( |
346 | - '_simple-calendar_feed_id_' . strval( $this->post_id ) . '_' . $this->type, |
|
346 | + '_simple-calendar_feed_id_'.strval($this->post_id).'_'.$this->type, |
|
347 | 347 | $calendar, |
348 | - max( absint( $this->cache ), 1 ) // Since a value of 0 means forever we set the minimum here to 1 if the user has set it to be 0 |
|
348 | + max(absint($this->cache), 1) // Since a value of 0 means forever we set the minimum here to 1 if the user has set it to be 0 |
|
349 | 349 | ); |
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | 353 | } else { |
354 | 354 | |
355 | - $message = __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' ); |
|
356 | - $message .= '<br><br>' . $error . '<br><br>'; |
|
357 | - $message .= __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) . '<br><br>'; |
|
358 | - $message .= __( 'Only you can see this notice.', 'google-calendar-events' ); |
|
355 | + $message = __('While trying to retrieve events, Google returned an error:', 'google-calendar-events'); |
|
356 | + $message .= '<br><br>'.$error.'<br><br>'; |
|
357 | + $message .= __('Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events').'<br><br>'; |
|
358 | + $message .= __('Only you can see this notice.', 'google-calendar-events'); |
|
359 | 359 | |
360 | 360 | return $message; |
361 | 361 | } |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | // If no timezone has been set, use calendar feed. |
366 | - if ( 'use_calendar' == $this->timezone_setting && isset( $calendar['timezone'] ) ) { |
|
366 | + if ('use_calendar' == $this->timezone_setting && isset($calendar['timezone'])) { |
|
367 | 367 | $this->timezone = $calendar['timezone']; |
368 | 368 | } |
369 | 369 | |
370 | - return isset( $calendar['events'] ) ? $calendar['events'] : array(); |
|
370 | + return isset($calendar['events']) ? $calendar['events'] : array(); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -383,67 +383,67 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @throws \Exception On request failure will throw an exception from Google. |
385 | 385 | */ |
386 | - public function make_request( $id = '', $time_min = 0, $time_max = 0 ) { |
|
386 | + public function make_request($id = '', $time_min = 0, $time_max = 0) { |
|
387 | 387 | |
388 | 388 | $calendar = array(); |
389 | 389 | $google = $this->get_service(); |
390 | 390 | |
391 | - if ( ! is_null( $google ) && ! empty( $id ) ) { |
|
391 | + if ( ! is_null($google) && ! empty($id)) { |
|
392 | 392 | |
393 | 393 | // Build the request args. |
394 | 394 | $args = array(); |
395 | 395 | |
396 | 396 | // Expand recurring events. |
397 | - if ( $this->google_events_recurring == 'show' ) { |
|
397 | + if ($this->google_events_recurring == 'show') { |
|
398 | 398 | $args['singleEvents'] = true; |
399 | 399 | } |
400 | 400 | |
401 | 401 | // Query events using search terms. |
402 | - if ( ! empty( $this->google_search_query ) ) { |
|
403 | - $args['q'] = rawurlencode( $this->google_search_query ); |
|
402 | + if ( ! empty($this->google_search_query)) { |
|
403 | + $args['q'] = rawurlencode($this->google_search_query); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // Max results to query. |
407 | - $args['maxResults'] = strval( min( absint( $this->google_max_results ), 2500 ) ); |
|
407 | + $args['maxResults'] = strval(min(absint($this->google_max_results), 2500)); |
|
408 | 408 | |
409 | 409 | // Specify a timezone. |
410 | 410 | $timezone = ''; |
411 | - if ( 'use_calendar' != get_post_meta( $this->post_id, '_feed_timezone_setting', true ) ) { |
|
411 | + if ('use_calendar' != get_post_meta($this->post_id, '_feed_timezone_setting', true)) { |
|
412 | 412 | $args['timeZone'] = $timezone = $this->timezone; |
413 | 413 | } |
414 | 414 | |
415 | 415 | // Lower bound (inclusive) for an event's end time to filter by. |
416 | - $earliest_event = intval( $this->time_min ); |
|
417 | - if ( $earliest_event > 0 ) { |
|
416 | + $earliest_event = intval($this->time_min); |
|
417 | + if ($earliest_event > 0) { |
|
418 | 418 | $timeMin = Carbon::now(); |
419 | - if ( ! empty( $timezone ) ) { |
|
420 | - $timeMin->setTimezone( $timezone ); |
|
419 | + if ( ! empty($timezone)) { |
|
420 | + $timeMin->setTimezone($timezone); |
|
421 | 421 | } |
422 | - $timeMin->setTimestamp( $earliest_event ); |
|
422 | + $timeMin->setTimestamp($earliest_event); |
|
423 | 423 | $args['timeMin'] = $timeMin->toRfc3339String(); |
424 | 424 | } |
425 | 425 | |
426 | 426 | // Upper bound (exclusive) for an event's start time to filter by. |
427 | - $latest_event = intval( $this->time_max ); |
|
428 | - if ( $latest_event > 0 ) { |
|
427 | + $latest_event = intval($this->time_max); |
|
428 | + if ($latest_event > 0) { |
|
429 | 429 | $timeMax = Carbon::now(); |
430 | - if ( ! empty( $timezone ) ) { |
|
431 | - $timeMax->setTimezone( $timezone ); |
|
430 | + if ( ! empty($timezone)) { |
|
431 | + $timeMax->setTimezone($timezone); |
|
432 | 432 | } |
433 | - $timeMax->setTimestamp( $latest_event ); |
|
433 | + $timeMax->setTimestamp($latest_event); |
|
434 | 434 | $args['timeMax'] = $timeMax->toRfc3339String(); |
435 | 435 | } |
436 | 436 | |
437 | 437 | // Query events in calendar. |
438 | - $response = $google->events->listEvents( $id, $args ); |
|
438 | + $response = $google->events->listEvents($id, $args); |
|
439 | 439 | |
440 | - if ( $response instanceof \Google_Service_Calendar_Events ) { |
|
440 | + if ($response instanceof \Google_Service_Calendar_Events) { |
|
441 | 441 | $calendar = array( |
442 | 442 | 'id' => $id, |
443 | 443 | 'title' => $response->getSummary(), |
444 | 444 | 'description' => $response->getDescription(), |
445 | 445 | 'timezone' => $response->getTimeZone(), |
446 | - 'url' => esc_url( '//www.google.com/calendar/embed?src=' . $id ), |
|
446 | + 'url' => esc_url('//www.google.com/calendar/embed?src='.$id), |
|
447 | 447 | 'events' => $response->getItems(), |
448 | 448 | ); |
449 | 449 | } |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | private function get_client() { |
464 | 464 | |
465 | 465 | $client = new \Google_Client(); |
466 | - $client->setApplicationName( 'Simple Calendar' ); |
|
467 | - $client->setScopes( $this->google_client_scopes ); |
|
468 | - $client->setDeveloperKey( $this->google_api_key ); |
|
469 | - $client->setAccessType( 'online' ); |
|
466 | + $client->setApplicationName('Simple Calendar'); |
|
467 | + $client->setScopes($this->google_client_scopes); |
|
468 | + $client->setDeveloperKey($this->google_api_key); |
|
469 | + $client->setAccessType('online'); |
|
470 | 470 | |
471 | 471 | return $client; |
472 | 472 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @return null|\Google_Service_Calendar |
481 | 481 | */ |
482 | 482 | protected function get_service() { |
483 | - return $this->google_client instanceof \Google_Client ? new \Google_Service_Calendar( $this->google_client ) : null; |
|
483 | + return $this->google_client instanceof \Google_Client ? new \Google_Service_Calendar($this->google_client) : null; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Calendar_View; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function __construct() { |
62 | 62 | |
63 | - $this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min'; |
|
63 | + $this->min = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG == true) ? '' : '.min'; |
|
64 | 64 | |
65 | - $settings = get_option( 'simple-calendar_settings_advanced' ); |
|
65 | + $settings = get_option('simple-calendar_settings_advanced'); |
|
66 | 66 | |
67 | - if ( isset( $settings['assets']['disable_css'] ) ) { |
|
67 | + if (isset($settings['assets']['disable_css'])) { |
|
68 | 68 | $this->disable_styles = 'yes' == $settings['assets']['disable_css'] ? true : false; |
69 | 69 | } |
70 | 70 | |
71 | - add_action( 'init', array( $this, 'register' ), 20 ); |
|
72 | - add_action( 'init', array( $this, 'enqueue' ), 40 ); |
|
71 | + add_action('init', array($this, 'register'), 20); |
|
72 | + add_action('init', array($this, 'enqueue'), 40); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @since 3.0.0 |
79 | 79 | */ |
80 | 80 | public function register() { |
81 | - do_action( 'simcal_register_assets', $this->min ); |
|
81 | + do_action('simcal_register_assets', $this->min); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function enqueue() { |
90 | 90 | |
91 | - add_action( 'wp_enqueue_scripts', array( $this, 'load' ), 10 ); |
|
91 | + add_action('wp_enqueue_scripts', array($this, 'load'), 10); |
|
92 | 92 | |
93 | - do_action( 'simcal_enqueue_assets', $this->min ); |
|
93 | + do_action('simcal_enqueue_assets', $this->min); |
|
94 | 94 | |
95 | 95 | |
96 | 96 | $min = $this->min; |
97 | 97 | // Improves compatibility with themes and plugins using Isotope and Masonry. |
98 | - add_action( 'wp_enqueue_scripts', |
|
99 | - function () use ( $min ) { |
|
100 | - if ( wp_script_is( 'simcal-qtip', 'enqueued' ) ) { |
|
98 | + add_action('wp_enqueue_scripts', |
|
99 | + function() use ($min) { |
|
100 | + if (wp_script_is('simcal-qtip', 'enqueued')) { |
|
101 | 101 | wp_enqueue_script( |
102 | 102 | 'simplecalendar-imagesloaded', |
103 | - SIMPLE_CALENDAR_ASSETS . 'js/vendor/imagesloaded.pkgd' . $min . '.js', |
|
104 | - array( 'simcal-qtip' ), |
|
103 | + SIMPLE_CALENDAR_ASSETS.'js/vendor/imagesloaded.pkgd'.$min.'.js', |
|
104 | + array('simcal-qtip'), |
|
105 | 105 | SIMPLE_CALENDAR_VERSION, |
106 | 106 | true |
107 | 107 | ); |
108 | 108 | } |
109 | - }, 1000 ); |
|
109 | + }, 1000); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -118,34 +118,34 @@ discard block |
||
118 | 118 | |
119 | 119 | $types = simcal_get_calendar_types(); |
120 | 120 | |
121 | - foreach ( $types as $calendar => $views ) { |
|
122 | - foreach( $views as $key => $view ) { |
|
121 | + foreach ($types as $calendar => $views) { |
|
122 | + foreach ($views as $key => $view) { |
|
123 | 123 | |
124 | - $view = simcal_get_calendar_view( 0, $calendar . '-' . $view ); |
|
124 | + $view = simcal_get_calendar_view(0, $calendar.'-'.$view); |
|
125 | 125 | |
126 | - $scripts[] = $view->scripts( $this->min ); |
|
127 | - $styles[] = $view->styles( $this->min ); |
|
126 | + $scripts[] = $view->scripts($this->min); |
|
127 | + $styles[] = $view->styles($this->min); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | $this->get_widgets_assets(); |
132 | - $this->scripts = apply_filters( 'simcal_front_end_scripts', $scripts, $this->min ); |
|
132 | + $this->scripts = apply_filters('simcal_front_end_scripts', $scripts, $this->min); |
|
133 | 133 | // First check if there is a multi-dimensional array of scripts |
134 | - if ( isset( $this->scripts[0] ) ) { |
|
135 | - foreach ( $this->scripts as $script ) { |
|
136 | - $this->load_scripts ( $script ); |
|
134 | + if (isset($this->scripts[0])) { |
|
135 | + foreach ($this->scripts as $script) { |
|
136 | + $this->load_scripts($script); |
|
137 | 137 | } |
138 | 138 | } else { |
139 | - $this->load_scripts( $this->scripts ); |
|
139 | + $this->load_scripts($this->scripts); |
|
140 | 140 | } |
141 | - $this->styles = apply_filters( 'simcal_front_end_styles', $styles, $this->min ); |
|
141 | + $this->styles = apply_filters('simcal_front_end_styles', $styles, $this->min); |
|
142 | 142 | // First check if there is a multi-dimensional array of styles |
143 | - if ( isset( $this->styles[0] ) ) { |
|
144 | - foreach( $this->styles as $style ) { |
|
145 | - $this->load_styles( $style ); |
|
143 | + if (isset($this->styles[0])) { |
|
144 | + foreach ($this->styles as $style) { |
|
145 | + $this->load_styles($style); |
|
146 | 146 | } |
147 | 147 | } else { |
148 | - $this->load_styles( $this->styles ); |
|
148 | + $this->load_styles($this->styles); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -156,25 +156,25 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function get_widgets_assets() { |
158 | 158 | |
159 | - $widgets = get_option( 'widget_gce_widget' ); |
|
159 | + $widgets = get_option('widget_gce_widget'); |
|
160 | 160 | |
161 | - if ( ! empty( $widgets ) && is_array( $widgets ) ) { |
|
161 | + if ( ! empty($widgets) && is_array($widgets)) { |
|
162 | 162 | |
163 | - foreach ( $widgets as $settings ) { |
|
163 | + foreach ($widgets as $settings) { |
|
164 | 164 | |
165 | - if ( ! empty( $settings ) && is_array( $settings ) ) { |
|
165 | + if ( ! empty($settings) && is_array($settings)) { |
|
166 | 166 | |
167 | - if ( isset( $settings['calendar_id'] ) ) { |
|
167 | + if (isset($settings['calendar_id'])) { |
|
168 | 168 | |
169 | - $view = simcal_get_calendar_view( absint( $settings['calendar_id'] ) ); |
|
169 | + $view = simcal_get_calendar_view(absint($settings['calendar_id'])); |
|
170 | 170 | |
171 | - if ( $view instanceof Calendar_View ) { |
|
172 | - add_filter( 'simcal_front_end_scripts', function ( $scripts, $min ) use ( $view ) { |
|
173 | - return array_merge( $scripts, $view->scripts( $min ) ); |
|
174 | - }, 100, 2 ); |
|
175 | - add_filter( 'simcal_front_end_styles', function ( $styles, $min ) use ( $view ) { |
|
176 | - return array_merge( $styles, $view->styles( $min ) ); |
|
177 | - }, 100, 2 ); |
|
171 | + if ($view instanceof Calendar_View) { |
|
172 | + add_filter('simcal_front_end_scripts', function($scripts, $min) use ($view) { |
|
173 | + return array_merge($scripts, $view->scripts($min)); |
|
174 | + }, 100, 2); |
|
175 | + add_filter('simcal_front_end_styles', function($styles, $min) use ($view) { |
|
176 | + return array_merge($styles, $view->styles($min)); |
|
177 | + }, 100, 2); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } |
@@ -192,39 +192,39 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param array $scripts |
194 | 194 | */ |
195 | - public function load_scripts( $scripts ) { |
|
195 | + public function load_scripts($scripts) { |
|
196 | 196 | |
197 | 197 | // Only load if not disabled in the settings |
198 | - if ( ! empty( $scripts ) && is_array( $scripts ) ) { |
|
198 | + if ( ! empty($scripts) && is_array($scripts)) { |
|
199 | 199 | |
200 | - foreach ( $scripts as $script => $v ) { |
|
200 | + foreach ($scripts as $script => $v) { |
|
201 | 201 | |
202 | 202 | /** Plugin compatibility fixes */ |
203 | 203 | |
204 | 204 | // Dequeue moment.js if detected from WP Simple Pay Pro. |
205 | - if ( ( wp_script_is( 'stripe-checkout-pro-moment', 'enqueued' ) ) && $script == 'simcal-fullcal-moment' ) { |
|
205 | + if ((wp_script_is('stripe-checkout-pro-moment', 'enqueued')) && $script == 'simcal-fullcal-moment') { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! empty( $v['src'] ) ) { |
|
209 | + if ( ! empty($v['src'])) { |
|
210 | 210 | |
211 | 211 | // Enqueued individually so we can dequeue if already enqueued by another plugin. |
212 | 212 | // TODO Rework dependencies part (or remove completely). |
213 | 213 | |
214 | - $src = esc_url( $v['src'] ); |
|
215 | - $in_footer = isset( $v['in_footer'] ) ? $v['in_footer'] : false; |
|
214 | + $src = esc_url($v['src']); |
|
215 | + $in_footer = isset($v['in_footer']) ? $v['in_footer'] : false; |
|
216 | 216 | |
217 | - wp_enqueue_script( $script, $src, array(), SIMPLE_CALENDAR_VERSION, $in_footer ); |
|
217 | + wp_enqueue_script($script, $src, array(), SIMPLE_CALENDAR_VERSION, $in_footer); |
|
218 | 218 | |
219 | - if ( ! empty( $v['localize'] ) && is_array( $v['localize'] ) ) { |
|
220 | - foreach ( $v['localize'] as $object => $l10n ) { |
|
221 | - wp_localize_script( $script, $object, $l10n ); |
|
219 | + if ( ! empty($v['localize']) && is_array($v['localize'])) { |
|
220 | + foreach ($v['localize'] as $object => $l10n) { |
|
221 | + wp_localize_script($script, $object, $l10n); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - } elseif ( is_string( $v ) && ! empty( $v ) ) { |
|
225 | + } elseif (is_string($v) && ! empty($v)) { |
|
226 | 226 | |
227 | - wp_enqueue_script( $v ); |
|
227 | + wp_enqueue_script($v); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -238,26 +238,26 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param array $styles |
240 | 240 | */ |
241 | - public function load_styles( $styles ) { |
|
241 | + public function load_styles($styles) { |
|
242 | 242 | |
243 | 243 | // Only load if not disabled in the settings |
244 | - if ( ! empty( $styles ) && is_array( $styles ) && false === $this->disable_styles ) { |
|
244 | + if ( ! empty($styles) && is_array($styles) && false === $this->disable_styles) { |
|
245 | 245 | |
246 | - foreach ( $styles as $style => $v ) { |
|
246 | + foreach ($styles as $style => $v) { |
|
247 | 247 | |
248 | - if ( ! empty( $v['src'] ) ) { |
|
248 | + if ( ! empty($v['src'])) { |
|
249 | 249 | |
250 | 250 | // Enqueued individually so we can dequeue if already enqueued by another plugin. |
251 | 251 | // TODO Rework dependencies part (or remove completely). |
252 | 252 | |
253 | - $src = esc_url( $v['src'] ); |
|
254 | - $media = isset( $v['media'] ) ? $v['media'] : 'all'; |
|
253 | + $src = esc_url($v['src']); |
|
254 | + $media = isset($v['media']) ? $v['media'] : 'all'; |
|
255 | 255 | |
256 | - wp_enqueue_style( $style, $src, array(), SIMPLE_CALENDAR_VERSION, $media ); |
|
256 | + wp_enqueue_style($style, $src, array(), SIMPLE_CALENDAR_VERSION, $media); |
|
257 | 257 | |
258 | - } elseif ( is_string( $v ) && ! empty( $v ) ) { |
|
258 | + } elseif (is_string($v) && ! empty($v)) { |
|
259 | 259 | |
260 | - wp_enqueue_style( $v ); |
|
260 | + wp_enqueue_style($v); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | namespace SimpleCalendar\Admin; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | 38 | |
39 | - $this->install = isset( $_GET['simcal_install'] ) ? esc_attr( $_GET['simcal_install'] ) : ''; |
|
39 | + $this->install = isset($_GET['simcal_install']) ? esc_attr($_GET['simcal_install']) : ''; |
|
40 | 40 | |
41 | - add_action( 'admin_menu', array( $this, 'welcome_page_tabs' ) ); |
|
42 | - add_action( 'admin_head', array( $this, 'remove_submenu_pages' ) ); |
|
41 | + add_action('admin_menu', array($this, 'welcome_page_tabs')); |
|
42 | + add_action('admin_head', array($this, 'remove_submenu_pages')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -49,32 +49,32 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function welcome_page_tabs() { |
51 | 51 | |
52 | - $welcome_page_name = __( 'About Simple Calendar', 'google-calendar-events' ); |
|
53 | - $welcome_page_title = __( 'Welcome to Simple Calendar', 'google-calendar-events' ); |
|
52 | + $welcome_page_name = __('About Simple Calendar', 'google-calendar-events'); |
|
53 | + $welcome_page_title = __('Welcome to Simple Calendar', 'google-calendar-events'); |
|
54 | 54 | |
55 | - $page = isset( $_GET['page'] ) ? $_GET['page'] : 'simple-calendar_about'; |
|
55 | + $page = isset($_GET['page']) ? $_GET['page'] : 'simple-calendar_about'; |
|
56 | 56 | |
57 | - switch ( $page ) { |
|
57 | + switch ($page) { |
|
58 | 58 | |
59 | 59 | case 'simple-calendar_about' : |
60 | - $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'simple-calendar_about', array( |
|
60 | + $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'simple-calendar_about', array( |
|
61 | 61 | $this, |
62 | 62 | 'about_screen', |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | break; |
65 | 65 | |
66 | 66 | case 'simple-calendar_credits' : |
67 | - $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'simple-calendar_credits', array( |
|
67 | + $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'simple-calendar_credits', array( |
|
68 | 68 | $this, |
69 | 69 | 'credits_screen', |
70 | - ) ); |
|
70 | + )); |
|
71 | 71 | break; |
72 | 72 | |
73 | 73 | case 'simple-calendar_translators' : |
74 | - $page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'simple-calendar_translators', array( |
|
74 | + $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'simple-calendar_translators', array( |
|
75 | 75 | $this, |
76 | 76 | 'translators_screen', |
77 | - ) ); |
|
77 | + )); |
|
78 | 78 | break; |
79 | 79 | } |
80 | 80 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * @since 3.0.0 |
86 | 86 | */ |
87 | 87 | public function remove_submenu_pages() { |
88 | - remove_submenu_page( 'index.php', 'simple-calendar_about' ); |
|
89 | - remove_submenu_page( 'index.php', 'simple-calendar_credits' ); |
|
90 | - remove_submenu_page( 'index.php', 'simple-calendar_translators' ); |
|
88 | + remove_submenu_page('index.php', 'simple-calendar_about'); |
|
89 | + remove_submenu_page('index.php', 'simple-calendar_credits'); |
|
90 | + remove_submenu_page('index.php', 'simple-calendar_translators'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | |
100 | 100 | ?> |
101 | 101 | <p> |
102 | - <a href="<?php echo admin_url( 'edit.php?post_type=calendar' ); ?>" |
|
102 | + <a href="<?php echo admin_url('edit.php?post_type=calendar'); ?>" |
|
103 | 103 | class="button button-primary" |
104 | - ><?php _e( 'Calendars', 'google-calendar-events' ); ?></a> |
|
105 | - <a href="<?php echo esc_url( add_query_arg( 'page', 'simple-calendar_settings', admin_url( 'admin.php' ) ) ); ?>" |
|
104 | + ><?php _e('Calendars', 'google-calendar-events'); ?></a> |
|
105 | + <a href="<?php echo esc_url(add_query_arg('page', 'simple-calendar_settings', admin_url('admin.php'))); ?>" |
|
106 | 106 | class="button button-primary" |
107 | - ><?php _e( 'Settings', 'google-calendar-events' ); ?></a> |
|
108 | - <a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'welcome-page' ); ?>" |
|
107 | + ><?php _e('Settings', 'google-calendar-events'); ?></a> |
|
108 | + <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'welcome-page'); ?>" |
|
109 | 109 | class="docs button button-primary" target="_blank" |
110 | - ><?php _e( 'Add-ons', 'google-calendar-events' ); ?></a> |
|
111 | - <a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'welcome-page' ); ?>" |
|
110 | + ><?php _e('Add-ons', 'google-calendar-events'); ?></a> |
|
111 | + <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'welcome-page'); ?>" |
|
112 | 112 | class="docs button button-primary" target="_blank" |
113 | - ><?php _e( 'Documentation', 'google-calendar-events' ); ?></a> |
|
113 | + ><?php _e('Documentation', 'google-calendar-events'); ?></a> |
|
114 | 114 | </p> |
115 | 115 | <?php |
116 | 116 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | <h1> |
128 | 128 | <?php |
129 | 129 | /* translators: %s prints the current version of the plugin. */ |
130 | - printf( __( 'Welcome to Simple Calendar %s', 'google-calendar-events' ), SIMPLE_CALENDAR_VERSION ); |
|
130 | + printf(__('Welcome to Simple Calendar %s', 'google-calendar-events'), SIMPLE_CALENDAR_VERSION); |
|
131 | 131 | ?> |
132 | 132 | </h1> |
133 | 133 | |
@@ -135,21 +135,21 @@ discard block |
||
135 | 135 | <?php |
136 | 136 | |
137 | 137 | // Difference message if updating vs fresh install. |
138 | - if ( 'update' == $this->install ) { |
|
139 | - $message = __( 'Thanks for updating to the latest version!', 'google-calendar-events' ); |
|
138 | + if ('update' == $this->install) { |
|
139 | + $message = __('Thanks for updating to the latest version!', 'google-calendar-events'); |
|
140 | 140 | } else { |
141 | - $message = __( 'Thanks for installing!', 'google-calendar-events' ); |
|
141 | + $message = __('Thanks for installing!', 'google-calendar-events'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | echo $message; |
145 | 145 | |
146 | 146 | /* translators: %s prints the current version of the plugin. */ |
147 | - printf( ' ' . __( "Simple Calendar %s has a few display options to configure. ", 'google-calendar-events' ), SIMPLE_CALENDAR_VERSION ); |
|
147 | + printf(' '.__("Simple Calendar %s has a few display options to configure. ", 'google-calendar-events'), SIMPLE_CALENDAR_VERSION); |
|
148 | 148 | ?> |
149 | - <a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'welcome-page' ); ?>" |
|
149 | + <a href="<?php echo simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'welcome-page'); ?>" |
|
150 | 150 | target="_blank" |
151 | - ><?php _e( 'Check out our documentation', 'google-calendar-events' ); ?></a> |
|
152 | - <?php _e( 'to get started now.', 'google-calendar-events' ); ?> |
|
151 | + ><?php _e('Check out our documentation', 'google-calendar-events'); ?></a> |
|
152 | + <?php _e('to get started now.', 'google-calendar-events'); ?> |
|
153 | 153 | </div> |
154 | 154 | |
155 | 155 | <div class="simcal-badge"> </div> |
@@ -157,21 +157,21 @@ discard block |
||
157 | 157 | <?php $this->main_nav_links(); ?> |
158 | 158 | |
159 | 159 | <h2 class="nav-tab-wrapper"> |
160 | - <a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_about' ) { |
|
160 | + <a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_about') { |
|
161 | 161 | echo 'nav-tab-active'; |
162 | 162 | } ?>" |
163 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_about' ), 'index.php' ) ) ); ?>" |
|
164 | - ><?php _e( "What's New", 'google-calendar-events' ); ?></a> |
|
165 | - <a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_credits' ) { |
|
163 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_about'), 'index.php'))); ?>" |
|
164 | + ><?php _e("What's New", 'google-calendar-events'); ?></a> |
|
165 | + <a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_credits') { |
|
166 | 166 | echo 'nav-tab-active'; |
167 | 167 | } ?>" |
168 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_credits' ), 'index.php' ) ) ); ?>" |
|
169 | - ><?php _e( 'Credits', 'google-calendar-events' ); ?></a> |
|
170 | - <a class="nav-tab <?php if ( $_GET['page'] == 'simple-calendar_translators' ) { |
|
168 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_credits'), 'index.php'))); ?>" |
|
169 | + ><?php _e('Credits', 'google-calendar-events'); ?></a> |
|
170 | + <a class="nav-tab <?php if ($_GET['page'] == 'simple-calendar_translators') { |
|
171 | 171 | echo 'nav-tab-active'; |
172 | 172 | } ?>" |
173 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'simple-calendar_translators' ), 'index.php' ) ) ); ?>" |
|
174 | - ><?php _e( 'Translators', 'google-calendar-events' ); ?></a> |
|
173 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'simple-calendar_translators'), 'index.php'))); ?>" |
|
174 | + ><?php _e('Translators', 'google-calendar-events'); ?></a> |
|
175 | 175 | </h2> |
176 | 176 | <?php |
177 | 177 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | * @since 3.0.0 |
184 | 184 | */ |
185 | 185 | public function about_screen() { |
186 | - $welcome_image_about_path = SIMPLE_CALENDAR_ASSETS . '/images/welcome'; |
|
187 | - $welcome_addons_link = simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'welcome-page' ); |
|
186 | + $welcome_image_about_path = SIMPLE_CALENDAR_ASSETS.'/images/welcome'; |
|
187 | + $welcome_addons_link = simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'welcome-page'); |
|
188 | 188 | |
189 | 189 | ?> |
190 | 190 | <div id="simcal-welcome"> |
@@ -192,20 +192,20 @@ discard block |
||
192 | 192 | |
193 | 193 | <?php $this->intro(); ?> |
194 | 194 | |
195 | - <h3><?php _e( 'Configure event colors, number of events to display, grid or list style and more.', 'google-calendar-events' ); ?></h3> |
|
196 | - <img src="<?php echo $welcome_image_about_path . '/grid-view-basic.png'; ?>" /> |
|
195 | + <h3><?php _e('Configure event colors, number of events to display, grid or list style and more.', 'google-calendar-events'); ?></h3> |
|
196 | + <img src="<?php echo $welcome_image_about_path.'/grid-view-basic.png'; ?>" /> |
|
197 | 197 | |
198 | - <h3><?php _e( 'Mobile responsive and widget ready.', 'google-calendar-events' ); ?></h3> |
|
199 | - <img src="<?php echo $welcome_image_about_path . '/list-view-widget.png'; ?>" /> |
|
200 | - <img src="<?php echo $welcome_image_about_path . '/grid-view-widget-dark-theme.png'; ?>" /> |
|
198 | + <h3><?php _e('Mobile responsive and widget ready.', 'google-calendar-events'); ?></h3> |
|
199 | + <img src="<?php echo $welcome_image_about_path.'/list-view-widget.png'; ?>" /> |
|
200 | + <img src="<?php echo $welcome_image_about_path.'/grid-view-widget-dark-theme.png'; ?>" /> |
|
201 | 201 | |
202 | 202 | <h3> |
203 | - <?php _e( 'Add even more display options with add-ons like', 'google-calendar-events' ); ?> |
|
204 | - <a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e( 'FullCalendar and Google Calendar Pro', 'google-calendar-events' ); ?></a>. |
|
203 | + <?php _e('Add even more display options with add-ons like', 'google-calendar-events'); ?> |
|
204 | + <a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e('FullCalendar and Google Calendar Pro', 'google-calendar-events'); ?></a>. |
|
205 | 205 | </h3> |
206 | - <a href="<?php echo $welcome_addons_link; ?>" target="_blank"><img src="<?php echo $welcome_image_about_path . '/fullcalendar-google-calendar-pro-grid-view.png'; ?>" /></a> |
|
206 | + <a href="<?php echo $welcome_addons_link; ?>" target="_blank"><img src="<?php echo $welcome_image_about_path.'/fullcalendar-google-calendar-pro-grid-view.png'; ?>" /></a> |
|
207 | 207 | |
208 | - <h3><a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e( 'View Pricing and Try a Demo of our Simple Calendar Pro Add-ons.', 'google-calendar-events' ); ?></a></h3> |
|
208 | + <h3><a href="<?php echo $welcome_addons_link; ?>" target="_blank"><?php _e('View Pricing and Try a Demo of our Simple Calendar Pro Add-ons.', 'google-calendar-events'); ?></a></h3> |
|
209 | 209 | |
210 | 210 | <hr/> |
211 | 211 | |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | <?php |
233 | 233 | |
234 | 234 | printf( |
235 | - __( "Simple Calendar is created by a worldwide team of developers. If you'd like to contribute please visit our <a href='%s' target='_blank'>GitHub repo</a>.", 'google-calendar-events' ), |
|
236 | - simcal_get_url( 'github' ) |
|
235 | + __("Simple Calendar is created by a worldwide team of developers. If you'd like to contribute please visit our <a href='%s' target='_blank'>GitHub repo</a>.", 'google-calendar-events'), |
|
236 | + simcal_get_url('github') |
|
237 | 237 | ); |
238 | 238 | |
239 | 239 | ?> |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | <div class="wrap about-wrap translators-wrap"> |
258 | 258 | <?php $this->intro(); ?> |
259 | 259 | <p class="about-description"> |
260 | - <?php _e( 'Simple Calendar has been kindly translated into several other languages by contributors from all over the world.', 'google-calendar-events' ); ?> |
|
260 | + <?php _e('Simple Calendar has been kindly translated into several other languages by contributors from all over the world.', 'google-calendar-events'); ?> |
|
261 | 261 | </p> |
262 | 262 | <p class="about-description"> |
263 | - <a href="https://translate.wordpress.org/projects/wp-plugins/google-calendar-events" target="_blank"><?php _e( 'Click here to help translate', 'google-calendar-events' ); ?></a> |
|
263 | + <a href="https://translate.wordpress.org/projects/wp-plugins/google-calendar-events" target="_blank"><?php _e('Click here to help translate', 'google-calendar-events'); ?></a> |
|
264 | 264 | </p> |
265 | 265 | <?php |
266 | 266 | |
@@ -289,31 +289,31 @@ discard block |
||
289 | 289 | |
290 | 290 | $contributors = $this->get_contributors(); |
291 | 291 | |
292 | - if ( empty( $contributors ) ) { |
|
292 | + if (empty($contributors)) { |
|
293 | 293 | return ''; |
294 | 294 | } |
295 | 295 | |
296 | 296 | $contributor_list = '<ul class="wp-people-group">'; |
297 | 297 | |
298 | - foreach ( $contributors as $contributor ) { |
|
298 | + foreach ($contributors as $contributor) { |
|
299 | 299 | |
300 | 300 | // Skip contributor bots |
301 | - $contributor_bots = array( 'gitter-badger' ); |
|
302 | - if ( in_array( $contributor->login, $contributor_bots ) ) { |
|
301 | + $contributor_bots = array('gitter-badger'); |
|
302 | + if (in_array($contributor->login, $contributor_bots)) { |
|
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | |
306 | 306 | $contributor_list .= '<li class="wp-person">'; |
307 | 307 | $contributor_list .= sprintf( |
308 | 308 | '<a href="%s" title="%s" target="_blank">%s</a>', |
309 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
310 | - esc_html( sprintf( __( 'View %s', 'google-calendar-events' ), $contributor->login ) ), |
|
311 | - sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ) |
|
309 | + esc_url('https://github.com/'.$contributor->login), |
|
310 | + esc_html(sprintf(__('View %s', 'google-calendar-events'), $contributor->login)), |
|
311 | + sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)) |
|
312 | 312 | ); |
313 | 313 | $contributor_list .= sprintf( |
314 | 314 | '<a class="web" href="%s" target="_blank">%s</a>', |
315 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
316 | - esc_html( $contributor->login ) |
|
315 | + esc_url('https://github.com/'.$contributor->login), |
|
316 | + esc_html($contributor->login) |
|
317 | 317 | ); |
318 | 318 | $contributor_list .= '</li>'; |
319 | 319 | |
@@ -333,24 +333,24 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function get_contributors() { |
335 | 335 | |
336 | - $contributors = get_transient( '_simple-calendar_contributors' ); |
|
337 | - if ( false !== $contributors ) { |
|
336 | + $contributors = get_transient('_simple-calendar_contributors'); |
|
337 | + if (false !== $contributors) { |
|
338 | 338 | return $contributors; |
339 | 339 | } |
340 | 340 | |
341 | 341 | $response = wp_safe_remote_get( |
342 | 342 | 'https://api.github.com/repos/moonstonemedia/Simple-Calendar/contributors' |
343 | 343 | ); |
344 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
344 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
345 | 345 | return array(); |
346 | 346 | } |
347 | 347 | |
348 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
349 | - if ( ! is_array( $contributors ) ) { |
|
348 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
349 | + if ( ! is_array($contributors)) { |
|
350 | 350 | return array(); |
351 | 351 | } |
352 | 352 | |
353 | - set_transient( '_simple-calendar_contributors', $contributors, HOUR_IN_SECONDS ); |
|
353 | + set_transient('_simple-calendar_contributors', $contributors, HOUR_IN_SECONDS); |
|
354 | 354 | |
355 | 355 | return $contributors; |
356 | 356 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | |
31 | 31 | $this->id = $tab = 'system-status'; |
32 | 32 | $this->option_group = $page = 'tools'; |
33 | - $this->label = __( 'System Report', 'google-calendar-events' ); |
|
33 | + $this->label = __('System Report', 'google-calendar-events'); |
|
34 | 34 | $this->description = ''; |
35 | 35 | $this->sections = $this->add_sections(); |
36 | 36 | $this->fields = $this->add_fields(); |
37 | 37 | |
38 | 38 | // Disable the submit button for this page. |
39 | - add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } ); |
|
39 | + add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } ); |
|
40 | 40 | |
41 | 41 | // Add html. |
42 | - add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) ); |
|
42 | + add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,37 +51,37 @@ discard block |
||
51 | 51 | |
52 | 52 | ?> |
53 | 53 | <div id="simcal-system-status-report"> |
54 | - <p><?php _e( 'Please copy and paste this information when contacting support:', 'google-calendar-events' ); ?> </p> |
|
54 | + <p><?php _e('Please copy and paste this information when contacting support:', 'google-calendar-events'); ?> </p> |
|
55 | 55 | <textarea readonly="readonly" onclick="this.select();"></textarea> |
56 | - <p><?php _e( 'You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events' ); ?></p> |
|
57 | - <p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e( 'Download System Report', 'google-calendar-events' ); ?></a></p> |
|
56 | + <p><?php _e('You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events'); ?></p> |
|
57 | + <p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e('Download System Report', 'google-calendar-events'); ?></a></p> |
|
58 | 58 | </div> |
59 | 59 | <hr> |
60 | 60 | <?php |
61 | 61 | |
62 | 62 | global $wpdb; |
63 | - $wp_version = get_bloginfo( 'version' ); |
|
63 | + $wp_version = get_bloginfo('version'); |
|
64 | 64 | |
65 | 65 | $sections = array(); |
66 | 66 | $panels = array( |
67 | 67 | 'wordpress' => array( |
68 | - 'label' => __( 'WordPress Installation', 'google-calendar-events' ), |
|
68 | + 'label' => __('WordPress Installation', 'google-calendar-events'), |
|
69 | 69 | 'export' => 'WordPress Installation', |
70 | 70 | ), |
71 | 71 | 'theme' => array( |
72 | - 'label' => __( 'Active Theme', 'google-calendar-events' ), |
|
72 | + 'label' => __('Active Theme', 'google-calendar-events'), |
|
73 | 73 | 'export' => 'Active Theme', |
74 | 74 | ), |
75 | 75 | 'plugins' => array( |
76 | - 'label' => __( 'Active Plugins', 'google-calendar-events' ), |
|
76 | + 'label' => __('Active Plugins', 'google-calendar-events'), |
|
77 | 77 | 'export' => 'Active Plugins', |
78 | 78 | ), |
79 | 79 | 'server' => array( |
80 | - 'label' => __( 'Server Environment', 'google-calendar-events' ), |
|
80 | + 'label' => __('Server Environment', 'google-calendar-events'), |
|
81 | 81 | 'export' => 'Server Environment', |
82 | 82 | ), |
83 | 83 | 'client' => array( |
84 | - 'label' => __( 'Client Information', 'google-calendar-events' ), |
|
84 | + 'label' => __('Client Information', 'google-calendar-events'), |
|
85 | 85 | 'export' => 'Client Information', |
86 | 86 | ) |
87 | 87 | ); |
@@ -98,68 +98,68 @@ discard block |
||
98 | 98 | * ====================== |
99 | 99 | */ |
100 | 100 | |
101 | - $debug_mode = $script_debug = __( 'No', 'google-calendar-events' ); |
|
102 | - if ( defined( 'WP_DEBUG' ) ) { |
|
103 | - $debug_mode = true === WP_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $debug_mode; |
|
101 | + $debug_mode = $script_debug = __('No', 'google-calendar-events'); |
|
102 | + if (defined('WP_DEBUG')) { |
|
103 | + $debug_mode = true === WP_DEBUG ? __('Yes', 'google-calendar-events') : $debug_mode; |
|
104 | 104 | } |
105 | - if ( defined( 'SCRIPT_DEBUG' ) ) { |
|
106 | - $script_debug = true === SCRIPT_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $script_debug; |
|
105 | + if (defined('SCRIPT_DEBUG')) { |
|
106 | + $script_debug = true === SCRIPT_DEBUG ? __('Yes', 'google-calendar-events') : $script_debug; |
|
107 | 107 | } |
108 | 108 | |
109 | - $memory = $this->let_to_num( WP_MEMORY_LIMIT ); |
|
110 | - $memory_export = size_format( $memory ); |
|
111 | - if ( $memory < 67108864 ) { |
|
112 | - $memory = '<mark class="error">' . sprintf( __( '%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events' ), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>'; |
|
109 | + $memory = $this->let_to_num(WP_MEMORY_LIMIT); |
|
110 | + $memory_export = size_format($memory); |
|
111 | + if ($memory < 67108864) { |
|
112 | + $memory = '<mark class="error">'.sprintf(__('%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events'), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP').'</mark>'; |
|
113 | 113 | } else { |
114 | - $memory = '<mark class="ok">' . $memory_export . '</mark>'; |
|
114 | + $memory = '<mark class="ok">'.$memory_export.'</mark>'; |
|
115 | 115 | } |
116 | 116 | |
117 | - $permalinks = get_option( 'permalink_structure' ); |
|
118 | - $permalinks = empty( $permalinks ) ? '/?' : $permalinks; |
|
117 | + $permalinks = get_option('permalink_structure'); |
|
118 | + $permalinks = empty($permalinks) ? '/?' : $permalinks; |
|
119 | 119 | |
120 | 120 | $is_multisite = is_multisite(); |
121 | 121 | |
122 | 122 | $sections['wordpress'] = array( |
123 | 123 | 'name' => array( |
124 | - 'label' => __( 'Site Name', 'google-calendar-events' ), |
|
124 | + 'label' => __('Site Name', 'google-calendar-events'), |
|
125 | 125 | 'label_export' => 'Site Name', |
126 | - 'result' => get_bloginfo( 'name' ), |
|
126 | + 'result' => get_bloginfo('name'), |
|
127 | 127 | ), |
128 | 128 | 'home_url' => array( |
129 | - 'label' => __( 'Home URL', 'google-calendar-events' ), |
|
129 | + 'label' => __('Home URL', 'google-calendar-events'), |
|
130 | 130 | 'label_export' => 'Home URL', |
131 | 131 | 'result' => home_url(), |
132 | 132 | ), |
133 | 133 | 'site_url' => array( |
134 | - 'label' => __( 'Site URL', 'google-calendar-events' ), |
|
134 | + 'label' => __('Site URL', 'google-calendar-events'), |
|
135 | 135 | 'label_export' => 'Site URL', |
136 | 136 | 'result' => site_url(), |
137 | 137 | ), |
138 | 138 | 'version' => array( |
139 | - 'label' => __( 'Version', 'google-calendar-events' ), |
|
139 | + 'label' => __('Version', 'google-calendar-events'), |
|
140 | 140 | 'label_export' => 'Version', |
141 | 141 | 'result' => $wp_version, |
142 | 142 | ), |
143 | 143 | 'locale' => array( |
144 | - 'label' => __( 'Locale', 'google-calendar-events' ), |
|
144 | + 'label' => __('Locale', 'google-calendar-events'), |
|
145 | 145 | 'label_export' => 'Locale', |
146 | 146 | 'result' => get_locale(), |
147 | 147 | ), |
148 | 148 | 'wp_timezone' => array( |
149 | - 'label' => __( 'Timezone', 'google-calendar-events' ), |
|
149 | + 'label' => __('Timezone', 'google-calendar-events'), |
|
150 | 150 | 'label_export' => 'Timezone', |
151 | 151 | 'result' => simcal_get_wp_timezone(), |
152 | 152 | ), |
153 | 153 | 'multisite' => array( |
154 | - 'label' => __( 'Multisite', 'google-calendar-events' ), |
|
154 | + 'label' => __('Multisite', 'google-calendar-events'), |
|
155 | 155 | 'label_export' => 'Multisite', |
156 | - 'result' => $is_multisite ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
156 | + 'result' => $is_multisite ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
157 | 157 | 'result_export' => $is_multisite ? 'Yes' : 'No' |
158 | 158 | ), |
159 | 159 | 'permalink' => array( |
160 | - 'label' => __( 'Permalinks', 'google-calendar-events' ), |
|
160 | + 'label' => __('Permalinks', 'google-calendar-events'), |
|
161 | 161 | 'label_export' => 'Permalinks', |
162 | - 'result' => '<code>' . $permalinks . '</code>', |
|
162 | + 'result' => '<code>'.$permalinks.'</code>', |
|
163 | 163 | 'result_export' => $permalinks, |
164 | 164 | ), |
165 | 165 | 'memory_limit' => array( |
@@ -182,86 +182,86 @@ discard block |
||
182 | 182 | * ============ |
183 | 183 | */ |
184 | 184 | |
185 | - include_once ABSPATH . 'wp-admin/includes/theme-install.php'; |
|
185 | + include_once ABSPATH.'wp-admin/includes/theme-install.php'; |
|
186 | 186 | |
187 | - if ( version_compare( $wp_version, '3.4', '<' ) ) { |
|
188 | - $active_theme = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
189 | - $theme_name = '<a href="' . $active_theme['URI'] . '" target="_blank">' . $active_theme['Name'] . '</a>'; |
|
187 | + if (version_compare($wp_version, '3.4', '<')) { |
|
188 | + $active_theme = get_theme_data(get_stylesheet_directory().'/style.css'); |
|
189 | + $theme_name = '<a href="'.$active_theme['URI'].'" target="_blank">'.$active_theme['Name'].'</a>'; |
|
190 | 190 | $theme_version = $active_theme['Version']; |
191 | - $theme_author = '<a href="' . $active_theme['AuthorURI'] . '" target="_blank">' . $active_theme['Author'] . '</a>'; |
|
192 | - $theme_export = $active_theme['Name'] . ' - ' . $theme_version; |
|
191 | + $theme_author = '<a href="'.$active_theme['AuthorURI'].'" target="_blank">'.$active_theme['Author'].'</a>'; |
|
192 | + $theme_export = $active_theme['Name'].' - '.$theme_version; |
|
193 | 193 | } else { |
194 | 194 | $active_theme = wp_get_theme(); |
195 | - $theme_name = '<a href="' . $active_theme->ThemeURI . '" target="_blank">' . $active_theme->Name . '</a>'; |
|
195 | + $theme_name = '<a href="'.$active_theme->ThemeURI.'" target="_blank">'.$active_theme->Name.'</a>'; |
|
196 | 196 | $theme_version = $active_theme->Version; |
197 | 197 | $theme_author = $active_theme->Author; |
198 | - $theme_export = $active_theme->Name . ' - ' . $theme_version; |
|
198 | + $theme_export = $active_theme->Name.' - '.$theme_version; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $theme_update_version = $theme_version; |
202 | 202 | |
203 | - $api = themes_api( 'theme_information', array( |
|
203 | + $api = themes_api('theme_information', array( |
|
204 | 204 | 'slug' => get_template(), |
205 | - 'fields' => array( 'sections' => false, 'tags' => false ), |
|
206 | - ) ); |
|
207 | - if ( $api && ! is_wp_error( $api ) ) { |
|
205 | + 'fields' => array('sections' => false, 'tags' => false), |
|
206 | + )); |
|
207 | + if ($api && ! is_wp_error($api)) { |
|
208 | 208 | $theme_update_version = $api->version; |
209 | 209 | } |
210 | 210 | |
211 | - if ( version_compare( $theme_version, $theme_update_version, '<' ) ) { |
|
212 | - $theme_version = '<mark class="error">' . $theme_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $theme_update_version ) ) . ')</mark>'; |
|
211 | + if (version_compare($theme_version, $theme_update_version, '<')) { |
|
212 | + $theme_version = '<mark class="error">'.$theme_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($theme_update_version)).')</mark>'; |
|
213 | 213 | } else { |
214 | - $theme_version = '<mark class="ok">' . $theme_version . '</mark>'; |
|
214 | + $theme_version = '<mark class="ok">'.$theme_version.'</mark>'; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $theme = '<dl>'; |
218 | - $theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) . '</dt>'; |
|
219 | - $theme .= '<dd>' . $theme_name . '</dd>'; |
|
220 | - $theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>'; |
|
221 | - $theme .= '<dd>' . $theme_author . '</dd>'; |
|
222 | - $theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>'; |
|
223 | - $theme .= '<dd>' . $theme_version . '</dd>'; |
|
218 | + $theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>'; |
|
219 | + $theme .= '<dd>'.$theme_name.'</dd>'; |
|
220 | + $theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>'; |
|
221 | + $theme .= '<dd>'.$theme_author.'</dd>'; |
|
222 | + $theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>'; |
|
223 | + $theme .= '<dd>'.$theme_version.'</dd>'; |
|
224 | 224 | $theme .= '</dl>'; |
225 | 225 | |
226 | 226 | $is_child_theme = is_child_theme(); |
227 | 227 | $parent_theme = $parent_theme_export = '-'; |
228 | 228 | |
229 | - if ( $is_child_theme ) { |
|
230 | - if ( version_compare( $wp_version, '3.4', '<' ) ) { |
|
229 | + if ($is_child_theme) { |
|
230 | + if (version_compare($wp_version, '3.4', '<')) { |
|
231 | 231 | |
232 | 232 | $parent_theme = $parent_theme_export = $active_theme['Template']; |
233 | 233 | |
234 | 234 | } else { |
235 | 235 | |
236 | - $parent = wp_get_theme( $active_theme->Template ); |
|
236 | + $parent = wp_get_theme($active_theme->Template); |
|
237 | 237 | $parent_theme = '<dl>'; |
238 | - $parent_theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) . '</dt>'; |
|
239 | - $parent_theme .= '<dd>' . $parent->Name . '</dd>'; |
|
240 | - $parent_theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>'; |
|
241 | - $parent_theme .= '<dd>' . $parent->Author . '</dd>'; |
|
242 | - $parent_theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>'; |
|
243 | - $parent_theme .= '<dd>' . $parent->Version . '</dd>'; |
|
238 | + $parent_theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>'; |
|
239 | + $parent_theme .= '<dd>'.$parent->Name.'</dd>'; |
|
240 | + $parent_theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>'; |
|
241 | + $parent_theme .= '<dd>'.$parent->Author.'</dd>'; |
|
242 | + $parent_theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>'; |
|
243 | + $parent_theme .= '<dd>'.$parent->Version.'</dd>'; |
|
244 | 244 | $parent_theme .= '</dl>'; |
245 | 245 | |
246 | - $parent_theme_export = strip_tags( $parent->Name ) . ' - ' . $parent->Version; |
|
246 | + $parent_theme_export = strip_tags($parent->Name).' - '.$parent->Version; |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | 250 | $sections['theme'] = array( |
251 | 251 | 'theme' => array( |
252 | - 'label' => __( 'Theme Information', 'google-calendar-events' ), |
|
252 | + 'label' => __('Theme Information', 'google-calendar-events'), |
|
253 | 253 | 'label_export' => 'Theme', |
254 | 254 | 'result' => $theme, |
255 | 255 | 'result_export' => $theme_export, |
256 | 256 | ), |
257 | 257 | 'theme_child' => array( |
258 | - 'label' => __( 'Child Theme', 'google-calendar-events' ), |
|
258 | + 'label' => __('Child Theme', 'google-calendar-events'), |
|
259 | 259 | 'label_export' => 'Child Theme', |
260 | - 'result' => $is_child_theme ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
260 | + 'result' => $is_child_theme ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
261 | 261 | 'result_export' => $is_child_theme ? 'Yes' : 'No', |
262 | 262 | ), |
263 | 263 | 'theme_parent' => array( |
264 | - 'label' => __( 'Parent Theme', 'google-calendar-events' ), |
|
264 | + 'label' => __('Parent Theme', 'google-calendar-events'), |
|
265 | 265 | 'label_export' => 'Parent Theme', |
266 | 266 | 'result' => $parent_theme, |
267 | 267 | 'result_export' => $parent_theme_export, |
@@ -273,61 +273,61 @@ discard block |
||
273 | 273 | * ============== |
274 | 274 | */ |
275 | 275 | |
276 | - include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
276 | + include_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
277 | 277 | |
278 | - $active_plugins = (array) get_option( 'active_plugins', array() ); |
|
279 | - if ( is_multisite() ) { |
|
280 | - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); |
|
278 | + $active_plugins = (array) get_option('active_plugins', array()); |
|
279 | + if (is_multisite()) { |
|
280 | + $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
281 | 281 | } |
282 | 282 | |
283 | - foreach ( $active_plugins as $plugin ) { |
|
283 | + foreach ($active_plugins as $plugin) { |
|
284 | 284 | |
285 | - $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
|
285 | + $plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin); |
|
286 | 286 | |
287 | - if ( ! empty( $plugin_data['Name'] ) ) { |
|
287 | + if ( ! empty($plugin_data['Name'])) { |
|
288 | 288 | |
289 | 289 | $plugin_name = $plugin_data['Title']; |
290 | 290 | $plugin_author = $plugin_data['Author']; |
291 | 291 | $plugin_version = $plugin_update_version = $plugin_data['Version']; |
292 | 292 | |
293 | 293 | // Afraid that querying many plugins may risk a timeout. |
294 | - if ( count( $active_plugins ) <= 10 ) { |
|
295 | - $api = plugins_api( 'plugin_information', array( |
|
294 | + if (count($active_plugins) <= 10) { |
|
295 | + $api = plugins_api('plugin_information', array( |
|
296 | 296 | 'slug' => $plugin_data['Name'], |
297 | 297 | 'fields' => array( |
298 | 298 | 'version' => true, |
299 | 299 | ), |
300 | - ) ); |
|
301 | - if ( $api && ! is_wp_error( $api ) ) { |
|
302 | - if ( ! empty( $api->version ) ) { |
|
300 | + )); |
|
301 | + if ($api && ! is_wp_error($api)) { |
|
302 | + if ( ! empty($api->version)) { |
|
303 | 303 | $plugin_update_version = $api->version; |
304 | - if ( version_compare( $plugin_version, $plugin_update_version, '<' ) ) { |
|
305 | - $plugin_version = '<mark class="error">' . $plugin_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $plugin_update_version ) ) . ')</mark>'; |
|
304 | + if (version_compare($plugin_version, $plugin_update_version, '<')) { |
|
305 | + $plugin_version = '<mark class="error">'.$plugin_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($plugin_update_version)).')</mark>'; |
|
306 | 306 | } else { |
307 | - $plugin_version = '<mark class="ok">' . $plugin_version . '</mark>'; |
|
307 | + $plugin_version = '<mark class="ok">'.$plugin_version.'</mark>'; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
313 | 313 | $plugin = '<dl>'; |
314 | - $plugin .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>'; |
|
315 | - $plugin .= '<dd>' . $plugin_author . '</dd>'; |
|
316 | - $plugin .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>'; |
|
317 | - $plugin .= '<dd>' . $plugin_version . '</dd>'; |
|
314 | + $plugin .= '<dt>'.__('Author', 'google-calendar-events').'</dt>'; |
|
315 | + $plugin .= '<dd>'.$plugin_author.'</dd>'; |
|
316 | + $plugin .= '<dt>'.__('Version', 'google-calendar-events').'</dt>'; |
|
317 | + $plugin .= '<dd>'.$plugin_version.'</dd>'; |
|
318 | 318 | $plugin .= '</dl>'; |
319 | 319 | |
320 | - $sections['plugins'][ sanitize_key( strip_tags( $plugin_name ) ) ] = array( |
|
320 | + $sections['plugins'][sanitize_key(strip_tags($plugin_name))] = array( |
|
321 | 321 | 'label' => $plugin_name, |
322 | - 'label_export' => strip_tags( $plugin_data['Title'] ), |
|
322 | + 'label_export' => strip_tags($plugin_data['Title']), |
|
323 | 323 | 'result' => $plugin, |
324 | 324 | 'result_export' => $plugin_data['Version'], |
325 | 325 | ); |
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | - if ( isset( $sections['plugins'] ) ) { |
|
330 | - rsort( $sections['plugins'] ); |
|
329 | + if (isset($sections['plugins'])) { |
|
330 | + rsort($sections['plugins']); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -335,54 +335,54 @@ discard block |
||
335 | 335 | * ================== |
336 | 336 | */ |
337 | 337 | |
338 | - if ( version_compare( PHP_VERSION, '5.6', '<' ) ) { |
|
339 | - $php = '<mark>' . PHP_VERSION . ' - ' . |
|
340 | - __( 'WordPress.org recommends upgrading to PHP 5.6 or higher for better security.', 'google-calendar-events' ) . |
|
341 | - ' <a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'Read more.', 'google-calendar-events' ) . '</a>' . |
|
338 | + if (version_compare(PHP_VERSION, '5.6', '<')) { |
|
339 | + $php = '<mark>'.PHP_VERSION.' - '. |
|
340 | + __('WordPress.org recommends upgrading to PHP 5.6 or higher for better security.', 'google-calendar-events'). |
|
341 | + ' <a href="https://wordpress.org/about/requirements/" target="_blank">'.__('Read more.', 'google-calendar-events').'</a>'. |
|
342 | 342 | '</mark>'; |
343 | 343 | } else { |
344 | - $php = '<mark class="ok">' . PHP_VERSION . '</mark>'; |
|
344 | + $php = '<mark class="ok">'.PHP_VERSION.'</mark>'; |
|
345 | 345 | } |
346 | 346 | |
347 | - if ( $wpdb->use_mysqli ) { |
|
348 | - $mysql = @mysqli_get_server_info( $wpdb->dbh ); |
|
347 | + if ($wpdb->use_mysqli) { |
|
348 | + $mysql = @mysqli_get_server_info($wpdb->dbh); |
|
349 | 349 | } else { |
350 | 350 | $mysql = @mysql_get_server_info(); |
351 | 351 | } |
352 | 352 | |
353 | 353 | $host = $_SERVER['SERVER_SOFTWARE']; |
354 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
354 | + if (defined('WPE_APIKEY')) { |
|
355 | 355 | $host .= ' (WP Engine)'; |
356 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
356 | + } elseif (defined('PAGELYBIN')) { |
|
357 | 357 | $host .= ' (Pagely)'; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $default_timezone = $server_timezone_export = date_default_timezone_get(); |
361 | - if ( 'UTC' !== $default_timezone ) { |
|
362 | - $server_timezone = '<mark class="error">' . sprintf( __( 'Server default timezone is %s - it should be UTC', 'google-calendar-events' ), $default_timezone ) . '</mark>'; |
|
361 | + if ('UTC' !== $default_timezone) { |
|
362 | + $server_timezone = '<mark class="error">'.sprintf(__('Server default timezone is %s - it should be UTC', 'google-calendar-events'), $default_timezone).'</mark>'; |
|
363 | 363 | } else { |
364 | 364 | $server_timezone = '<mark class="ok">UTC</mark>'; |
365 | 365 | } |
366 | 366 | |
367 | 367 | // WP Remote POST test. |
368 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
368 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
369 | 369 | 'timeout' => 60, |
370 | 370 | 'body' => array( |
371 | 371 | 'cmd' => '_notify-validate', |
372 | 372 | ), |
373 | - ) ); |
|
374 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
373 | + )); |
|
374 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
375 | 375 | $wp_post_export = 'Yes'; |
376 | - $wp_post = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>'; |
|
376 | + $wp_post = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>'; |
|
377 | 377 | } else { |
378 | 378 | $wp_post_export = 'No'; |
379 | - $wp_post = '<mark class="error">' . __( 'No', 'google-calendar-events' ); |
|
380 | - if ( is_wp_error( $response ) ) { |
|
381 | - $error = ' (' . $response->get_error_message() . ')'; |
|
379 | + $wp_post = '<mark class="error">'.__('No', 'google-calendar-events'); |
|
380 | + if (is_wp_error($response)) { |
|
381 | + $error = ' ('.$response->get_error_message().')'; |
|
382 | 382 | $wp_post .= $error; |
383 | 383 | $wp_post_export .= $error; |
384 | 384 | } else { |
385 | - $error = ' (' . $response['response']['code'] . ')'; |
|
385 | + $error = ' ('.$response['response']['code'].')'; |
|
386 | 386 | $wp_post .= $error; |
387 | 387 | $wp_post_export .= $error; |
388 | 388 | } |
@@ -390,65 +390,65 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | // WP Remote GET test. |
393 | - $response = wp_safe_remote_get( get_home_url( '/?p=1' ) ); |
|
394 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
393 | + $response = wp_safe_remote_get(get_home_url('/?p=1')); |
|
394 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
395 | 395 | $wp_get_export = 'Yes'; |
396 | - $wp_get = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>'; |
|
396 | + $wp_get = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>'; |
|
397 | 397 | } else { |
398 | 398 | $wp_get_export = 'No'; |
399 | - $wp_get = '<mark class="error">' . __( 'No', 'google-calendar-events' ); |
|
400 | - if ( is_wp_error( $response ) ) { |
|
401 | - $error = ' (' . $response->get_error_message() . ')'; |
|
399 | + $wp_get = '<mark class="error">'.__('No', 'google-calendar-events'); |
|
400 | + if (is_wp_error($response)) { |
|
401 | + $error = ' ('.$response->get_error_message().')'; |
|
402 | 402 | $wp_get .= $error; |
403 | 403 | $wp_get_export .= $error; |
404 | 404 | } else { |
405 | - $error = ' (' . $response['response']['code'] . ')'; |
|
405 | + $error = ' ('.$response['response']['code'].')'; |
|
406 | 406 | $wp_get .= $error; |
407 | 407 | $wp_get_export .= $error; |
408 | 408 | } |
409 | 409 | $wp_get .= '</mark>'; |
410 | 410 | } |
411 | 411 | |
412 | - $php_memory_limit = ini_get( 'memory_limit' ); |
|
413 | - $php_max_upload_filesize = ini_get( 'upload_max_filesize' ); |
|
414 | - $php_post_max_size = ini_get( 'post_max_size' ); |
|
415 | - $php_max_execution_time = ini_get( 'max_execution_time' ); |
|
416 | - $php_max_input_vars = ini_get( 'max_input_vars' ); |
|
412 | + $php_memory_limit = ini_get('memory_limit'); |
|
413 | + $php_max_upload_filesize = ini_get('upload_max_filesize'); |
|
414 | + $php_post_max_size = ini_get('post_max_size'); |
|
415 | + $php_max_execution_time = ini_get('max_execution_time'); |
|
416 | + $php_max_input_vars = ini_get('max_input_vars'); |
|
417 | 417 | |
418 | 418 | $curl_info = ''; |
419 | 419 | |
420 | - if ( function_exists( 'curl_version' ) ) { |
|
420 | + if (function_exists('curl_version')) { |
|
421 | 421 | $curl_info = curl_version(); |
422 | 422 | } |
423 | 423 | |
424 | 424 | $sections['server'] = array( |
425 | 425 | 'host' => array( |
426 | - 'label' => __( 'Web Server', 'google-calendar-events' ), |
|
426 | + 'label' => __('Web Server', 'google-calendar-events'), |
|
427 | 427 | 'label_export' => 'Web Server', |
428 | 428 | 'result' => $host, |
429 | 429 | ), |
430 | 430 | 'php_version' => array( |
431 | - 'label' => __( 'PHP Version', 'google-calendar-events' ), |
|
431 | + 'label' => __('PHP Version', 'google-calendar-events'), |
|
432 | 432 | 'label_export' => 'PHP Version', |
433 | 433 | 'result' => $php, |
434 | 434 | 'result_export' => PHP_VERSION, |
435 | 435 | ), |
436 | 436 | 'mysql_version' => array( |
437 | - 'label' => __( 'MySQL Version', 'google-calendar-events' ), |
|
437 | + 'label' => __('MySQL Version', 'google-calendar-events'), |
|
438 | 438 | 'label_export' => 'MySQL Version', |
439 | - 'result' => version_compare( $mysql, '5.5', '>' ) ? '<mark class="ok">' . $mysql . '</mark>' : $mysql, |
|
439 | + 'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">'.$mysql.'</mark>' : $mysql, |
|
440 | 440 | 'result_export' => $mysql, |
441 | 441 | ), |
442 | 442 | 'server_timezone' => array( |
443 | - 'label' => __( 'Server Timezone', 'google-calendar-events' ), |
|
443 | + 'label' => __('Server Timezone', 'google-calendar-events'), |
|
444 | 444 | 'label_export' => 'Server Timezone', |
445 | 445 | 'result' => $server_timezone, |
446 | 446 | 'result_export' => $server_timezone_export, |
447 | 447 | ), |
448 | 448 | 'display_errors' => array( |
449 | 449 | 'label' => 'Display Errors', |
450 | - 'result' => ( ini_get( 'display_errors' ) ) ? __( 'Yes', 'google-calendar-events' ) . ' (' . ini_get( 'display_errors' ) . ')' : '-', |
|
451 | - 'result_export' => ( ini_get( 'display_errors' ) ) ? 'Yes' : 'No', |
|
450 | + 'result' => (ini_get('display_errors')) ? __('Yes', 'google-calendar-events').' ('.ini_get('display_errors').')' : '-', |
|
451 | + 'result_export' => (ini_get('display_errors')) ? 'Yes' : 'No', |
|
452 | 452 | ), |
453 | 453 | 'php_memory_limit' => array( |
454 | 454 | 'label' => 'Memory Limit', |
@@ -472,23 +472,23 @@ discard block |
||
472 | 472 | ), |
473 | 473 | 'fsockopen' => array( |
474 | 474 | 'label' => 'fsockopen', |
475 | - 'result' => function_exists( 'fsockopen' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
476 | - 'result_export' => function_exists( 'fsockopen' ) ? 'Yes' : 'No', |
|
475 | + 'result' => function_exists('fsockopen') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
476 | + 'result_export' => function_exists('fsockopen') ? 'Yes' : 'No', |
|
477 | 477 | ), |
478 | 478 | 'curl_init' => array( |
479 | 479 | 'label' => 'cURL', |
480 | - 'result' => ! empty( $curl_info ) ? $curl_info['version'] . ', ' . $curl_info['ssl_version'] : __( 'No version found.', 'google-calendar-events' ), |
|
481 | - 'result_export' => ! empty( $curl_info ) ? $curl_info['version'] . ', ' . $curl_info['ssl_version'] : 'No version found.', |
|
480 | + 'result' => ! empty($curl_info) ? $curl_info['version'].', '.$curl_info['ssl_version'] : __('No version found.', 'google-calendar-events'), |
|
481 | + 'result_export' => ! empty($curl_info) ? $curl_info['version'].', '.$curl_info['ssl_version'] : 'No version found.', |
|
482 | 482 | ), |
483 | 483 | 'soap' => array( |
484 | 484 | 'label' => 'SOAP', |
485 | - 'result' => class_exists( 'SoapClient' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
486 | - 'result_export' => class_exists( 'SoapClient' ) ? 'Yes' : 'No', |
|
485 | + 'result' => class_exists('SoapClient') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
486 | + 'result_export' => class_exists('SoapClient') ? 'Yes' : 'No', |
|
487 | 487 | ), |
488 | 488 | 'suhosin' => array( |
489 | 489 | 'label' => 'SUHOSIN', |
490 | - 'result' => extension_loaded( 'suhosin' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
491 | - 'result_export' => extension_loaded( 'suhosin' ) ? 'Yes' : 'No', |
|
490 | + 'result' => extension_loaded('suhosin') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
491 | + 'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No', |
|
492 | 492 | ), |
493 | 493 | 'wp_remote_post' => array( |
494 | 494 | 'label' => 'WP Remote POST', |
@@ -510,26 +510,26 @@ discard block |
||
510 | 510 | $user_client = new \SimpleCalendar\Browser(); |
511 | 511 | |
512 | 512 | $browser = '<dl>'; |
513 | - $browser .= '<dt>' . __( 'Name:', 'google-calendar-events' ) . '</dt>'; |
|
514 | - $browser .= '<dd>' . $user_client->getBrowser() . '</dd>'; |
|
515 | - $browser .= '<dt>' . __( 'Version:', 'google-calendar-events' ) . '</dt>'; |
|
516 | - $browser .= '<dd>' . $user_client->getVersion() . '</dd>'; |
|
517 | - $browser .= '<dt>' . __( 'User Agent:', 'google-calendar-events' ) . '</dt>'; |
|
518 | - $browser .= '<dd>' . $user_client->getUserAgent() . '</dd>'; |
|
519 | - $browser .= '<dt>' . __( 'Platform:', 'google-calendar-events' ) . '</dt>'; |
|
520 | - $browser .= '<dd>' . $user_client->getPlatform() . '</dd>'; |
|
513 | + $browser .= '<dt>'.__('Name:', 'google-calendar-events').'</dt>'; |
|
514 | + $browser .= '<dd>'.$user_client->getBrowser().'</dd>'; |
|
515 | + $browser .= '<dt>'.__('Version:', 'google-calendar-events').'</dt>'; |
|
516 | + $browser .= '<dd>'.$user_client->getVersion().'</dd>'; |
|
517 | + $browser .= '<dt>'.__('User Agent:', 'google-calendar-events').'</dt>'; |
|
518 | + $browser .= '<dd>'.$user_client->getUserAgent().'</dd>'; |
|
519 | + $browser .= '<dt>'.__('Platform:', 'google-calendar-events').'</dt>'; |
|
520 | + $browser .= '<dd>'.$user_client->getPlatform().'</dd>'; |
|
521 | 521 | $browser .= '</dl>'; |
522 | 522 | |
523 | - $browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')'; |
|
523 | + $browser_export = $user_client->getBrowser().' '.$user_client->getVersion().' ('.$user_client->getPlatform().')'; |
|
524 | 524 | |
525 | 525 | $sections['client'] = array( |
526 | 526 | 'user_ip' => array( |
527 | - 'label' => __( 'IP Address', 'google-calendar-events' ), |
|
527 | + 'label' => __('IP Address', 'google-calendar-events'), |
|
528 | 528 | 'label_export' => 'IP Address', |
529 | 529 | 'result' => $_SERVER['SERVER_ADDR'], |
530 | 530 | ), |
531 | 531 | 'browser' => array( |
532 | - 'label' => __( 'Browser', 'google-calendar-events' ), |
|
532 | + 'label' => __('Browser', 'google-calendar-events'), |
|
533 | 533 | 'result' => $browser, |
534 | 534 | 'result_export' => $browser_export, |
535 | 535 | ) |
@@ -540,12 +540,12 @@ discard block |
||
540 | 540 | * ============ |
541 | 541 | */ |
542 | 542 | |
543 | - $panels = apply_filters( 'simcal_system_status_report_panels', $panels ); |
|
544 | - $sections = apply_filters( 'simcal_system_status_report_sections', $sections ); |
|
543 | + $panels = apply_filters('simcal_system_status_report_panels', $panels); |
|
544 | + $sections = apply_filters('simcal_system_status_report_sections', $sections); |
|
545 | 545 | |
546 | - foreach ( $panels as $panel => $v ) : |
|
546 | + foreach ($panels as $panel => $v) : |
|
547 | 547 | |
548 | - if ( isset( $sections[ $panel ] ) ) : |
|
548 | + if (isset($sections[$panel])) : |
|
549 | 549 | |
550 | 550 | ?> |
551 | 551 | <table class="widefat simcal-system-status-report-panel"> |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | </tr> |
556 | 556 | </thead> |
557 | 557 | <tbody> |
558 | - <?php foreach ( $sections[ $panel ] as $row => $cell ) : ?> |
|
558 | + <?php foreach ($sections[$panel] as $row => $cell) : ?> |
|
559 | 559 | <tr> |
560 | 560 | <?php |
561 | - $label_export = isset( $cell['label_export'] ) ? $cell['label_export'] : $cell['label']; |
|
562 | - $result_export = isset( $cell['result_export'] ) ? $cell['result_export'] : $cell['result']; |
|
561 | + $label_export = isset($cell['label_export']) ? $cell['label_export'] : $cell['label']; |
|
562 | + $result_export = isset($cell['result_export']) ? $cell['result_export'] : $cell['result']; |
|
563 | 563 | ?> |
564 | - <td class="tooltip"><?php echo isset( $cell['tooltip'] ) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . $cell['tooltip'] . '"></i> ' : ''; ?></td> |
|
565 | - <td class="label" data-export="<?php echo trim( $label_export ); ?>"><?php echo $cell['label']; ?></td> |
|
566 | - <td class="result" data-export="<?php echo trim( $result_export ); ?>"><?php echo $cell['result']; ?></td> |
|
564 | + <td class="tooltip"><?php echo isset($cell['tooltip']) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.$cell['tooltip'].'"></i> ' : ''; ?></td> |
|
565 | + <td class="label" data-export="<?php echo trim($label_export); ?>"><?php echo $cell['label']; ?></td> |
|
566 | + <td class="result" data-export="<?php echo trim($result_export); ?>"><?php echo $cell['result']; ?></td> |
|
567 | 567 | </tr> |
568 | 568 | <?php endforeach; ?> |
569 | 569 | </tbody> |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | jQuery( '#simcal-system-status-report-download' ).on( 'click', function() { |
642 | 642 | var file = new Blob( [ report ], { type: 'text/plain' } ); |
643 | 643 | jQuery( this ).attr( 'href', URL.createObjectURL( file ) ); |
644 | - jQuery( this ).attr( 'download', '<?php echo sanitize_title( str_replace( array( 'http://', 'https://' ), '', get_bloginfo( 'url' ) ) . '-system-report-' . date( 'Y-m-d', time() ) ); ?>' ); |
|
644 | + jQuery( this ).attr( 'download', '<?php echo sanitize_title(str_replace(array('http://', 'https://'), '', get_bloginfo('url')).'-system-report-'.date('Y-m-d', time())); ?>' ); |
|
645 | 645 | } ); |
646 | 646 | |
647 | 647 | </script> |
@@ -661,13 +661,13 @@ discard block |
||
661 | 661 | * |
662 | 662 | * @return int|double|string |
663 | 663 | */ |
664 | - private function let_to_num( $size ) { |
|
664 | + private function let_to_num($size) { |
|
665 | 665 | |
666 | - $l = substr( $size, -1 ); |
|
667 | - $ret = substr( $size, 0, -1 ); |
|
666 | + $l = substr($size, -1); |
|
667 | + $ret = substr($size, 0, -1); |
|
668 | 668 | |
669 | 669 | // Note: do not insert break or default in this switch loop. |
670 | - switch ( strtoupper( $l ) ) { |
|
670 | + switch (strtoupper($l)) { |
|
671 | 671 | case 'P': |
672 | 672 | $ret *= 1024; |
673 | 673 | // no break |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $ret *= 1024; |
682 | 682 | // no break |
683 | 683 | case 'K': |
684 | - $ret *= 1024;; |
|
684 | + $ret *= 1024; ; |
|
685 | 685 | // no break |
686 | 686 | } |
687 | 687 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | use SimpleCalendar\Admin\Notice; |
11 | 11 | use SimpleCalendar\Feeds\Google; |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $google_api_key |
55 | 55 | * @param string $google_calendar_id |
56 | 56 | */ |
57 | - public function __construct( Google $feed, $google_api_key, $google_calendar_id ) { |
|
57 | + public function __construct(Google $feed, $google_api_key, $google_calendar_id) { |
|
58 | 58 | |
59 | 59 | $this->feed = $feed; |
60 | 60 | $this->google_api_key = $google_api_key; |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | |
63 | 63 | $screen = simcal_is_admin_screen(); |
64 | 64 | |
65 | - if ( 'calendar' == $screen ) { |
|
66 | - $this->test_api_key_connection( $this->google_calendar_id ); |
|
67 | - add_filter( 'simcal_settings_meta_tabs_li', array( $this, 'add_settings_meta_tab_li' ), 10, 1 ); |
|
68 | - add_action( 'simcal_settings_meta_panels', array( $this, 'add_settings_meta_panel' ), 10, 1 ); |
|
65 | + if ('calendar' == $screen) { |
|
66 | + $this->test_api_key_connection($this->google_calendar_id); |
|
67 | + add_filter('simcal_settings_meta_tabs_li', array($this, 'add_settings_meta_tab_li'), 10, 1); |
|
68 | + add_action('simcal_settings_meta_panels', array($this, 'add_settings_meta_panel'), 10, 1); |
|
69 | 69 | } |
70 | 70 | |
71 | - add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 ); |
|
71 | + add_action('simcal_process_settings_meta', array($this, 'process_meta'), 10, 1); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | public function settings_fields() { |
82 | 82 | return array( |
83 | 83 | 'name' => $this->feed->name, |
84 | - 'description' => __( "To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events' ) . |
|
85 | - '<br/><br/>' . |
|
86 | - '<em style="font-size: 14px;">' . |
|
87 | - sprintf( __( '<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events' ), |
|
88 | - simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'settings-link' ) |
|
89 | - ) . |
|
84 | + 'description' => __("To read events from your public Google Calendars you'll need create a Google API key and save it here.", 'google-calendar-events'). |
|
85 | + '<br/><br/>'. |
|
86 | + '<em style="font-size: 14px;">'. |
|
87 | + sprintf(__('<strong>Note:</strong> Calendars configured to use the <strong><a href="%s" target="_blank">Google Calendar Pro add-on</a></strong> use a different method of authorization.', 'google-calendar-events'), |
|
88 | + simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'settings-link') |
|
89 | + ). |
|
90 | 90 | '</em>', |
91 | 91 | 'fields' => array( |
92 | 92 | 'api_key' => array( |
93 | 93 | 'type' => 'standard', |
94 | 94 | 'subtype' => 'text', |
95 | - 'class' => array( 'simcal-wide-text regular-text', 'ltr' ), |
|
96 | - 'title' => __( 'Google API Key', 'google-calendar-events' ), |
|
97 | - 'validation' => array( $this, 'check_google_api_key' ), |
|
95 | + 'class' => array('simcal-wide-text regular-text', 'ltr'), |
|
96 | + 'title' => __('Google API Key', 'google-calendar-events'), |
|
97 | + 'validation' => array($this, 'check_google_api_key'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | ); |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return true|string |
115 | 115 | */ |
116 | - public function check_google_api_key( $api_key = '' ) { |
|
116 | + public function check_google_api_key($api_key = '') { |
|
117 | 117 | |
118 | 118 | $message = ''; |
119 | 119 | $has_errors = false; |
120 | 120 | |
121 | - if ( empty( $api_key ) ){ |
|
121 | + if (empty($api_key)) { |
|
122 | 122 | $api_key = $this->google_api_key; |
123 | - if ( empty( $api_key ) ) { |
|
124 | - $settings = get_option( 'simple-calendar_settings_feeds' ); |
|
125 | - $api_key = isset( $settings['google']['api_key'] ) ? esc_attr( $settings['google']['api_key'] ) : ''; |
|
123 | + if (empty($api_key)) { |
|
124 | + $settings = get_option('simple-calendar_settings_feeds'); |
|
125 | + $api_key = isset($settings['google']['api_key']) ? esc_attr($settings['google']['api_key']) : ''; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - $message = '<p class="description">' . |
|
130 | - sprintf( __( '<a href="%s" target="_blank">Step-by-step instructions</a> ', 'google-calendar-events' ), |
|
131 | - simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/google-api-key/', 'core-plugin', 'settings-link' ) |
|
132 | - ) . |
|
133 | - '<br/>' . |
|
134 | - sprintf( __( '<a href="%s" target="_blank">Google Developers Console</a> ', 'google-calendar-events' ), |
|
135 | - simcal_get_url( 'gdev-console' ) |
|
136 | - ) . |
|
129 | + $message = '<p class="description">'. |
|
130 | + sprintf(__('<a href="%s" target="_blank">Step-by-step instructions</a> ', 'google-calendar-events'), |
|
131 | + simcal_ga_campaign_url(simcal_get_url('docs').'/google-api-key/', 'core-plugin', 'settings-link') |
|
132 | + ). |
|
133 | + '<br/>'. |
|
134 | + sprintf(__('<a href="%s" target="_blank">Google Developers Console</a> ', 'google-calendar-events'), |
|
135 | + simcal_get_url('gdev-console') |
|
136 | + ). |
|
137 | 137 | '</p>'; |
138 | 138 | |
139 | 139 | return $message; |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return array |
150 | 150 | */ |
151 | - public function add_settings_meta_tab_li( $tabs ) { |
|
152 | - return array_merge( $tabs, array( |
|
151 | + public function add_settings_meta_tab_li($tabs) { |
|
152 | + return array_merge($tabs, array( |
|
153 | 153 | 'google' => array( |
154 | 154 | 'label' => $this->feed->name, |
155 | 155 | 'target' => 'google-settings-panel', |
156 | - 'class' => array( 'simcal-feed-type', 'simcal-feed-type-google' ), |
|
156 | + 'class' => array('simcal-feed-type', 'simcal-feed-type-google'), |
|
157 | 157 | 'icon' => 'simcal-icon-google', |
158 | 158 | ), |
159 | - ) ); |
|
159 | + )); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @param int $post_id |
168 | 168 | */ |
169 | - public function add_settings_meta_panel( $post_id ) { |
|
169 | + public function add_settings_meta_panel($post_id) { |
|
170 | 170 | |
171 | 171 | $inputs = array( |
172 | 172 | $this->feed->type => array( |
@@ -175,30 +175,30 @@ discard block |
||
175 | 175 | 'subtype' => 'text', |
176 | 176 | 'name' => '_google_calendar_id', |
177 | 177 | 'id' => '_google_calendar_id', |
178 | - 'title' => __( 'Calendar ID', 'google-calendar-events' ), |
|
179 | - 'tooltip' => __( 'Visit your Google Calendar account, copy your public calendar ID, then paste it here.', 'google-calendar-events' ), |
|
180 | - 'placeholder' => __( 'Enter a valid Google Calendar ID from a public calendar', 'google-calendar-events' ), |
|
181 | - 'escaping' => array( $this->feed, 'esc_google_calendar_id' ), |
|
182 | - 'validation' => array( $this, 'test_api_key_connection' ), |
|
178 | + 'title' => __('Calendar ID', 'google-calendar-events'), |
|
179 | + 'tooltip' => __('Visit your Google Calendar account, copy your public calendar ID, then paste it here.', 'google-calendar-events'), |
|
180 | + 'placeholder' => __('Enter a valid Google Calendar ID from a public calendar', 'google-calendar-events'), |
|
181 | + 'escaping' => array($this->feed, 'esc_google_calendar_id'), |
|
182 | + 'validation' => array($this, 'test_api_key_connection'), |
|
183 | 183 | ), |
184 | 184 | '_google_events_search_query' => array( |
185 | 185 | 'type' => 'standard', |
186 | 186 | 'subtype' => 'text', |
187 | 187 | 'name' => '_google_events_search_query', |
188 | 188 | 'id' => '_google_events_search_query', |
189 | - 'title' => __( 'Search Query', 'google-calendar-events' ), |
|
190 | - 'tooltip' => __( 'Type in keywords if you only want display events that match these terms. You can use basic boolean search operators too.', 'google-calendar-events' ), |
|
191 | - 'placeholder' => __( 'Filter events to display by search terms...', 'google-calendar-events' ), |
|
189 | + 'title' => __('Search Query', 'google-calendar-events'), |
|
190 | + 'tooltip' => __('Type in keywords if you only want display events that match these terms. You can use basic boolean search operators too.', 'google-calendar-events'), |
|
191 | + 'placeholder' => __('Filter events to display by search terms...', 'google-calendar-events'), |
|
192 | 192 | ), |
193 | 193 | '_google_events_recurring' => array( |
194 | 194 | 'type' => 'select', |
195 | 195 | 'name' => '_google_events_recurring', |
196 | 196 | 'id' => '_google_events_recurring', |
197 | - 'title' => __( 'Recurring Events', 'google-calendar-events' ), |
|
198 | - 'tooltip' => __( 'Events that are programmed to repeat themselves periodically.', 'google-calendar-events' ), |
|
197 | + 'title' => __('Recurring Events', 'google-calendar-events'), |
|
198 | + 'tooltip' => __('Events that are programmed to repeat themselves periodically.', 'google-calendar-events'), |
|
199 | 199 | 'options' => array( |
200 | - 'show' => __( 'Show all', 'google-calendar-events' ), |
|
201 | - 'first-only' => __( 'Only show first occurrence', 'google-calendar-events' ), |
|
200 | + 'show' => __('Show all', 'google-calendar-events'), |
|
201 | + 'first-only' => __('Only show first occurrence', 'google-calendar-events'), |
|
202 | 202 | ), |
203 | 203 | ), |
204 | 204 | '_google_events_max_results' => array( |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | 'subtype' => 'number', |
207 | 207 | 'name' => '_google_events_max_results', |
208 | 208 | 'id' => '_google_events_max_results', |
209 | - 'title' => __( 'Maximum Events', 'google-calendar-events' ), |
|
210 | - 'tooltip' => __( 'Google Calendar only allows to query for a maximum amount of 2500 events from a calendar each time.', 'google-calendar-events' ), |
|
209 | + 'title' => __('Maximum Events', 'google-calendar-events'), |
|
210 | + 'tooltip' => __('Google Calendar only allows to query for a maximum amount of 2500 events from a calendar each time.', 'google-calendar-events'), |
|
211 | 211 | 'class' => array( |
212 | 212 | 'simcal-field-small', |
213 | 213 | ), |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | <div id="google-settings-panel" class="simcal-panel"> |
225 | 225 | <table> |
226 | 226 | <thead> |
227 | - <tr><th colspan="2"><?php _e( 'Google Calendar Settings', 'google-calendar-events' ); ?></th></tr> |
|
227 | + <tr><th colspan="2"><?php _e('Google Calendar Settings', 'google-calendar-events'); ?></th></tr> |
|
228 | 228 | </thead> |
229 | - <?php Settings::print_panel_fields( $inputs, $post_id ); ?> |
|
229 | + <?php Settings::print_panel_fields($inputs, $post_id); ?> |
|
230 | 230 | </table> |
231 | 231 | </div> |
232 | 232 | <?php |
@@ -242,47 +242,47 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return true|string |
244 | 244 | */ |
245 | - public function test_api_key_connection( $google_calendar_id ) { |
|
245 | + public function test_api_key_connection($google_calendar_id) { |
|
246 | 246 | |
247 | 247 | global $post; |
248 | 248 | |
249 | - $post_id = isset( $post->ID ) ? $post->ID : 0; |
|
249 | + $post_id = isset($post->ID) ? $post->ID : 0; |
|
250 | 250 | $feed = null; |
251 | - if ( $feed_type = wp_get_object_terms( $post_id, 'calendar_feed' ) ) { |
|
252 | - $feed = sanitize_title( current( $feed_type )->name ); |
|
251 | + if ($feed_type = wp_get_object_terms($post_id, 'calendar_feed')) { |
|
252 | + $feed = sanitize_title(current($feed_type)->name); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | $message = ''; |
256 | 256 | $error = ''; |
257 | 257 | $has_errors = false; |
258 | 258 | |
259 | - $message .= '<p class="description">' . |
|
259 | + $message .= '<p class="description">'. |
|
260 | 260 | sprintf( |
261 | - __( 'Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events' ) . '<br />' . |
|
262 | - __( 'Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events' ), |
|
263 | - simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/make-google-calendar-public/', 'core-plugin', 'settings-link' ), |
|
264 | - simcal_ga_campaign_url( simcal_get_url( 'docs' ) . '/find-google-calendar-id/', 'core-plugin', 'settings-link' ) |
|
265 | - ) . '</p>'; |
|
261 | + __('Step 1: Set the Google Calendar you want to use as <strong>"public."</strong> <a href="%1s" target="_blank">Detailed instructions</a>', 'google-calendar-events').'<br />'. |
|
262 | + __('Step 2: Copy and paste your Google Calendar ID here. <a href="%2s" target="_blank">Detailed instructions</a>', 'google-calendar-events'), |
|
263 | + simcal_ga_campaign_url(simcal_get_url('docs').'/make-google-calendar-public/', 'core-plugin', 'settings-link'), |
|
264 | + simcal_ga_campaign_url(simcal_get_url('docs').'/find-google-calendar-id/', 'core-plugin', 'settings-link') |
|
265 | + ).'</p>'; |
|
266 | 266 | |
267 | - if ( $post_id > 0 && ! is_null( $feed ) && ! empty( $this->feed->type ) ) { |
|
267 | + if ($post_id > 0 && ! is_null($feed) && ! empty($this->feed->type)) { |
|
268 | 268 | |
269 | - $no_key_notice = new Notice( array( |
|
270 | - 'id' => array( 'calendar_' . $post_id => 'google-no-api-key' ), |
|
269 | + $no_key_notice = new Notice(array( |
|
270 | + 'id' => array('calendar_'.$post_id => 'google-no-api-key'), |
|
271 | 271 | 'type' => 'error', |
272 | 272 | 'screen' => 'calendar', |
273 | 273 | 'post' => $post_id, |
274 | 274 | 'dismissable' => false, |
275 | - 'content' => '<p>' . |
|
276 | - '<i class="simcal-icon-warning"></i> ' . |
|
275 | + 'content' => '<p>'. |
|
276 | + '<i class="simcal-icon-warning"></i> '. |
|
277 | 277 | sprintf( |
278 | - __( 'Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events' ), |
|
279 | - admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds' ) |
|
280 | - ) . |
|
278 | + __('Your Google Calendar events will not show up until you <a href="%s">create and save a Google API key</a>.', 'google-calendar-events'), |
|
279 | + admin_url('edit.php?post_type=calendar&page=simple-calendar_settings&tab=feeds') |
|
280 | + ). |
|
281 | 281 | '</p>', |
282 | 282 | ) |
283 | 283 | ); |
284 | 284 | |
285 | - if ( empty( $this->google_api_key ) && ( $feed == $this->feed->type ) ) { |
|
285 | + if (empty($this->google_api_key) && ($feed == $this->feed->type)) { |
|
286 | 286 | |
287 | 287 | $has_errors = true; |
288 | 288 | $no_key_notice->add(); |
@@ -292,28 +292,28 @@ discard block |
||
292 | 292 | $no_key_notice->remove(); |
293 | 293 | |
294 | 294 | try { |
295 | - $this->feed->make_request( $google_calendar_id ); |
|
296 | - } catch ( \Exception $e ) { |
|
295 | + $this->feed->make_request($google_calendar_id); |
|
296 | + } catch (\Exception $e) { |
|
297 | 297 | $error = $e->getMessage(); |
298 | - $message = ! empty( $error ) ? '<blockquote>' . $error . '</blockquote>' : ''; |
|
298 | + $message = ! empty($error) ? '<blockquote>'.$error.'</blockquote>' : ''; |
|
299 | 299 | } |
300 | 300 | |
301 | - $error_notice = new Notice( array( |
|
302 | - 'id' => array( 'calendar_' . $post_id => 'google-error-response' ), |
|
301 | + $error_notice = new Notice(array( |
|
302 | + 'id' => array('calendar_'.$post_id => 'google-error-response'), |
|
303 | 303 | 'type' => 'error', |
304 | 304 | 'screen' => 'calendar', |
305 | 305 | 'post' => $post_id, |
306 | 306 | 'dismissable' => false, |
307 | - 'content' => '<p>' . |
|
308 | - '<i class="simcal-icon-warning"></i> ' . |
|
309 | - __( 'While trying to retrieve events, Google returned an error:', 'google-calendar-events' ) . |
|
310 | - '<br>' . $message . '<br>' . |
|
311 | - __( 'Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events' ) . |
|
307 | + 'content' => '<p>'. |
|
308 | + '<i class="simcal-icon-warning"></i> '. |
|
309 | + __('While trying to retrieve events, Google returned an error:', 'google-calendar-events'). |
|
310 | + '<br>'.$message.'<br>'. |
|
311 | + __('Please ensure that both your Google Calendar ID and API Key are valid and that the Google Calendar you want to display is public.', 'google-calendar-events'). |
|
312 | 312 | '</p>', |
313 | 313 | ) |
314 | 314 | ); |
315 | 315 | |
316 | - if ( ! empty( $error ) && ( $feed == $this->feed->type ) ) { |
|
316 | + if ( ! empty($error) && ($feed == $this->feed->type)) { |
|
317 | 317 | $error_notice->add(); |
318 | 318 | $has_errors = true; |
319 | 319 | } else { |
@@ -335,21 +335,21 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @param int $post_id |
337 | 337 | */ |
338 | - public function process_meta( $post_id ) { |
|
338 | + public function process_meta($post_id) { |
|
339 | 339 | |
340 | - $calendar_id = isset( $_POST['_google_calendar_id'] ) ? base64_encode( trim( $_POST['_google_calendar_id'] ) ): ''; |
|
341 | - update_post_meta( $post_id, '_google_calendar_id', $calendar_id ); |
|
340 | + $calendar_id = isset($_POST['_google_calendar_id']) ? base64_encode(trim($_POST['_google_calendar_id'])) : ''; |
|
341 | + update_post_meta($post_id, '_google_calendar_id', $calendar_id); |
|
342 | 342 | |
343 | - $search_query = isset( $_POST['_google_events_search_query'] ) ? sanitize_text_field( $_POST['_google_events_search_query'] ) : ''; |
|
344 | - update_post_meta( $post_id, '_google_events_search_query', $search_query ); |
|
343 | + $search_query = isset($_POST['_google_events_search_query']) ? sanitize_text_field($_POST['_google_events_search_query']) : ''; |
|
344 | + update_post_meta($post_id, '_google_events_search_query', $search_query); |
|
345 | 345 | |
346 | - $recurring = isset( $_POST['_google_events_recurring'] ) ? sanitize_key( $_POST['_google_events_recurring'] ) : 'show'; |
|
347 | - update_post_meta( $post_id, '_google_events_recurring', $recurring ); |
|
346 | + $recurring = isset($_POST['_google_events_recurring']) ? sanitize_key($_POST['_google_events_recurring']) : 'show'; |
|
347 | + update_post_meta($post_id, '_google_events_recurring', $recurring); |
|
348 | 348 | |
349 | - $max_results = isset( $_POST['_google_events_max_results'] ) ? absint( $_POST['_google_events_max_results'] ) : '2500'; |
|
350 | - update_post_meta( $post_id, '_google_events_max_results', $max_results ); |
|
349 | + $max_results = isset($_POST['_google_events_max_results']) ? absint($_POST['_google_events_max_results']) : '2500'; |
|
350 | + update_post_meta($post_id, '_google_events_max_results', $max_results); |
|
351 | 351 | |
352 | - $this->test_api_key_connection( $calendar_id ); |
|
352 | + $this->test_api_key_connection($calendar_id); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | } |