@@ -57,7 +57,7 @@ |
||
57 | 57 | value="<?php echo $this->value; ?>" |
58 | 58 | class="<?php echo $this->class; ?>"<?php |
59 | 59 | echo $this->style ? 'style="' . $this->style . '" ' : ' '; |
60 | - echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' '; |
|
60 | + echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' '; |
|
61 | 61 | echo $this->attributes; ?>/> |
62 | 62 | <?php |
63 | 63 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param array $field |
37 | 37 | */ |
38 | - public function __construct( $field ) { |
|
38 | + public function __construct($field) { |
|
39 | 39 | |
40 | - $this->subtype = isset( $field['subtype'] ) ? esc_attr( $field['subtype'] ) : 'text'; |
|
41 | - $this->type_class = 'simcal-field-' . $this->subtype; |
|
40 | + $this->subtype = isset($field['subtype']) ? esc_attr($field['subtype']) : 'text'; |
|
41 | + $this->type_class = 'simcal-field-'.$this->subtype; |
|
42 | 42 | |
43 | - parent::__construct( $field ); |
|
43 | + parent::__construct($field); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | id="<?php echo $this->id; ?>" |
57 | 57 | value="<?php echo $this->value; ?>" |
58 | 58 | class="<?php echo $this->class; ?>"<?php |
59 | - echo $this->style ? 'style="' . $this->style . '" ' : ' '; |
|
60 | - echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' '; |
|
59 | + echo $this->style ? 'style="'.$this->style.'" ' : ' '; |
|
60 | + echo $this->placeholder ? 'placeholder="'.$this->placeholder.'"' : ' '; |
|
61 | 61 | echo $this->attributes; ?>/> |
62 | 62 | <?php |
63 | 63 | |
64 | 64 | echo $this->tooltip; |
65 | 65 | |
66 | - if ( ! empty( $this->description ) ) { |
|
67 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
66 | + if ( ! empty($this->description)) { |
|
67 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
68 | 68 | } |
69 | 69 | |
70 | - if ( is_string( $this->validation ) && ! empty ( $this->validation ) ) { |
|
70 | + if (is_string($this->validation) && ! empty ($this->validation)) { |
|
71 | 71 | echo $this->validation; |
72 | 72 | } |
73 | 73 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Abstracts\Field; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $field |
28 | 28 | */ |
29 | - public function __construct( $field ) { |
|
29 | + public function __construct($field) { |
|
30 | 30 | |
31 | 31 | $this->type_class = 'simcal-field-textarea'; |
32 | 32 | |
33 | - parent::__construct( $field ); |
|
33 | + parent::__construct($field); |
|
34 | 34 | |
35 | - if ( ! empty( $field['value'] ) ) { |
|
36 | - $this->value = esc_textarea( $field['value'] ); |
|
35 | + if ( ! empty($field['value'])) { |
|
36 | + $this->value = esc_textarea($field['value']); |
|
37 | 37 | } |
38 | - if ( ! empty( $field['default'] ) ) { |
|
39 | - $this->default = esc_textarea( $field['default'] ); |
|
38 | + if ( ! empty($field['default'])) { |
|
39 | + $this->default = esc_textarea($field['default']); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | name="<?php echo $this->name; ?>" |
53 | 53 | id="<?php echo $this->id; ?>" |
54 | 54 | <?php |
55 | - echo $this->class ? 'class="' . $this->class . '" ' : ''; |
|
56 | - echo $this->placeholder ? 'placeholder="' . $this->placeholder . '" ' : ''; |
|
57 | - echo $this->style ? 'style="' . $this->style . '" ' : ''; |
|
55 | + echo $this->class ? 'class="'.$this->class.'" ' : ''; |
|
56 | + echo $this->placeholder ? 'placeholder="'.$this->placeholder.'" ' : ''; |
|
57 | + echo $this->style ? 'style="'.$this->style.'" ' : ''; |
|
58 | 58 | echo $this->attributes; |
59 | - ?>><?php echo $this->value; ?></textarea> |
|
59 | + ?>><?php echo $this->value; ?></textarea> |
|
60 | 60 | <?php |
61 | 61 | |
62 | 62 | echo $this->tooltip; |
63 | 63 | |
64 | - if ( ! empty( $this->description ) ) { |
|
65 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
64 | + if ( ! empty($this->description)) { |
|
65 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | } |
@@ -146,11 +146,11 @@ |
||
146 | 146 | $links = array(); |
147 | 147 | $links['github'] = '<a href="' . simcal_get_url( 'github' ) . '" target="_blank" >GitHub</a>'; |
148 | 148 | $links['documentation'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
149 | - __( 'Documentation', 'google-calendar-events' ) . '</a>'; |
|
149 | + __( 'Documentation', 'google-calendar-events' ) . '</a>'; |
|
150 | 150 | $links['support'] = '<a href="' . simcal_get_url( 'support' ) . '" target="_blank" >' . |
151 | - __( 'Support', 'google-calendar-events' ) . '</a>'; |
|
151 | + __( 'Support', 'google-calendar-events' ) . '</a>'; |
|
152 | 152 | $links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'add-ons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
153 | - __( 'Add-ons', 'google-calendar-events' ) . '</a>'; |
|
153 | + __( 'Add-ons', 'google-calendar-events' ) . '</a>'; |
|
154 | 154 | |
155 | 155 | return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) ); |
156 | 156 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Admin; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -44,19 +44,19 @@ discard block |
||
44 | 44 | |
45 | 45 | self::$main_menu = 'edit.php?post_type=calendar'; |
46 | 46 | |
47 | - add_action( 'admin_menu', array( __CLASS__, 'add_menu_items' ) ); |
|
47 | + add_action('admin_menu', array(__CLASS__, 'add_menu_items')); |
|
48 | 48 | |
49 | - self::$plugin = plugin_basename( SIMPLE_CALENDAR_MAIN_FILE ); |
|
49 | + self::$plugin = plugin_basename(SIMPLE_CALENDAR_MAIN_FILE); |
|
50 | 50 | |
51 | 51 | new Welcome(); |
52 | 52 | |
53 | 53 | // Conditional redirect to welcome page on activation. |
54 | - add_action( 'admin_init', array( $this, 'admin_redirects' ) ); |
|
54 | + add_action('admin_init', array($this, 'admin_redirects')); |
|
55 | 55 | // Links and meta content in plugins page. |
56 | - add_filter( 'plugin_action_links_' . self::$plugin, array( __CLASS__, 'plugin_action_links' ), 10, 5 ); |
|
57 | - add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 ); |
|
56 | + add_filter('plugin_action_links_'.self::$plugin, array(__CLASS__, 'plugin_action_links'), 10, 5); |
|
57 | + add_filter('plugin_row_meta', array(__CLASS__, 'plugin_row_meta'), 10, 2); |
|
58 | 58 | // Custom text in admin footer. |
59 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); |
|
59 | + add_filter('admin_footer_text', array($this, 'admin_footer_text'), 1); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -68,41 +68,41 @@ discard block |
||
68 | 68 | |
69 | 69 | add_submenu_page( |
70 | 70 | self::$main_menu, |
71 | - __( 'Settings', 'google-calendar-events' ), |
|
72 | - __( 'Settings', 'google-calendar-events' ), |
|
71 | + __('Settings', 'google-calendar-events'), |
|
72 | + __('Settings', 'google-calendar-events'), |
|
73 | 73 | 'manage_options', |
74 | 74 | 'simple-calendar_settings', |
75 | - function () { |
|
76 | - $page = new Pages( 'settings' ); |
|
75 | + function() { |
|
76 | + $page = new Pages('settings'); |
|
77 | 77 | $page->html(); |
78 | 78 | } |
79 | 79 | ); |
80 | 80 | |
81 | 81 | add_submenu_page( |
82 | 82 | self::$main_menu, |
83 | - __( 'Add-ons', 'google-calendar-events' ), |
|
84 | - __( 'Add-ons', 'google-calendar-events' ), |
|
83 | + __('Add-ons', 'google-calendar-events'), |
|
84 | + __('Add-ons', 'google-calendar-events'), |
|
85 | 85 | 'manage_options', |
86 | 86 | 'simple-calendar_add_ons', |
87 | 87 | function() { |
88 | - $page = new Pages( 'add-ons' ); |
|
88 | + $page = new Pages('add-ons'); |
|
89 | 89 | $page->html(); |
90 | 90 | } |
91 | 91 | ); |
92 | 92 | |
93 | 93 | add_submenu_page( |
94 | 94 | self::$main_menu, |
95 | - __( 'Tools', 'google-calendar-events' ), |
|
96 | - __( 'Tools', 'google-calendar-events' ), |
|
95 | + __('Tools', 'google-calendar-events'), |
|
96 | + __('Tools', 'google-calendar-events'), |
|
97 | 97 | 'manage_options', |
98 | 98 | 'simple-calendar_tools', |
99 | - function () { |
|
100 | - $page = new Pages( 'tools' ); |
|
99 | + function() { |
|
100 | + $page = new Pages('tools'); |
|
101 | 101 | $page->html(); |
102 | 102 | } |
103 | 103 | ); |
104 | 104 | |
105 | - do_action( 'simcal_admin_add_menu_items' ); |
|
105 | + do_action('simcal_admin_add_menu_items'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return array |
117 | 117 | */ |
118 | - public static function plugin_action_links( $action_links, $file ) { |
|
118 | + public static function plugin_action_links($action_links, $file) { |
|
119 | 119 | |
120 | - if ( self::$plugin == $file ) { |
|
120 | + if (self::$plugin == $file) { |
|
121 | 121 | |
122 | 122 | $links = array(); |
123 | - $links['settings'] = '<a href="' . admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings' ) . '">' . __( 'Settings', 'google-calendar-events' ) . '</a>'; |
|
124 | - $links['feeds'] = '<a href="' . admin_url( 'edit.php?post_type=calendar' ) . '">' . __( 'Calendars', 'google-calendar-events' ) . '</a>'; |
|
123 | + $links['settings'] = '<a href="'.admin_url('edit.php?post_type=calendar&page=simple-calendar_settings').'">'.__('Settings', 'google-calendar-events').'</a>'; |
|
124 | + $links['feeds'] = '<a href="'.admin_url('edit.php?post_type=calendar').'">'.__('Calendars', 'google-calendar-events').'</a>'; |
|
125 | 125 | |
126 | - return apply_filters( 'simcal_plugin_action_links', array_merge( $links, $action_links ) ); |
|
126 | + return apply_filters('simcal_plugin_action_links', array_merge($links, $action_links)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return $action_links; |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return array |
141 | 141 | */ |
142 | - public static function plugin_row_meta( $meta_links, $file ) { |
|
142 | + public static function plugin_row_meta($meta_links, $file) { |
|
143 | 143 | |
144 | - if ( self::$plugin == $file ) { |
|
144 | + if (self::$plugin == $file) { |
|
145 | 145 | |
146 | 146 | $links = array(); |
147 | - $links['github'] = '<a href="' . simcal_get_url( 'github' ) . '" target="_blank" >GitHub</a>'; |
|
148 | - $links['documentation'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'docs' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
|
149 | - __( 'Documentation', 'google-calendar-events' ) . '</a>'; |
|
150 | - $links['support'] = '<a href="' . simcal_get_url( 'support' ) . '" target="_blank" >' . |
|
151 | - __( 'Support', 'google-calendar-events' ) . '</a>'; |
|
152 | - $links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'add-ons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' . |
|
153 | - __( 'Add-ons', 'google-calendar-events' ) . '</a>'; |
|
154 | - |
|
155 | - return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) ); |
|
147 | + $links['github'] = '<a href="'.simcal_get_url('github').'" target="_blank" >GitHub</a>'; |
|
148 | + $links['documentation'] = '<a href="'.simcal_ga_campaign_url(simcal_get_url('docs'), 'core-plugin', 'plugin-listing').'" target="_blank" >'. |
|
149 | + __('Documentation', 'google-calendar-events').'</a>'; |
|
150 | + $links['support'] = '<a href="'.simcal_get_url('support').'" target="_blank" >'. |
|
151 | + __('Support', 'google-calendar-events').'</a>'; |
|
152 | + $links['add-ons'] = '<a href="'.simcal_ga_campaign_url(simcal_get_url('add-ons'), 'core-plugin', 'plugin-listing').'" target="_blank" >'. |
|
153 | + __('Add-ons', 'google-calendar-events').'</a>'; |
|
154 | + |
|
155 | + return apply_filters('simcal_plugin_action_links', array_merge($meta_links, $links)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $meta_links; |
@@ -167,25 +167,25 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function admin_redirects() { |
169 | 169 | |
170 | - $transient = get_transient( '_simple-calendar_activation_redirect' ); |
|
170 | + $transient = get_transient('_simple-calendar_activation_redirect'); |
|
171 | 171 | |
172 | - if ( ! $transient || is_network_admin() || isset( $_GET['activate-multi'] ) || ! current_user_can( 'manage_options' ) ) { |
|
172 | + if ( ! $transient || is_network_admin() || isset($_GET['activate-multi']) || ! current_user_can('manage_options')) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - delete_transient( '_simple-calendar_activation_redirect' ); |
|
176 | + delete_transient('_simple-calendar_activation_redirect'); |
|
177 | 177 | |
178 | 178 | // Do not redirect if already on welcome page screen. |
179 | - if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], array( 'simple-calendar_about' ) ) ) { |
|
179 | + if ( ! empty($_GET['page']) && in_array($_GET['page'], array('simple-calendar_about'))) { |
|
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | $url = add_query_arg( |
184 | 184 | 'simcal_install', |
185 | - esc_attr( $transient ), |
|
186 | - admin_url( 'index.php?page=simple-calendar_about' ) |
|
185 | + esc_attr($transient), |
|
186 | + admin_url('index.php?page=simple-calendar_about') |
|
187 | 187 | ); |
188 | - wp_safe_redirect( $url ); |
|
188 | + wp_safe_redirect($url); |
|
189 | 189 | exit; |
190 | 190 | } |
191 | 191 | |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string|void |
202 | 202 | */ |
203 | - public function admin_footer_text( $footer_text ) { |
|
203 | + public function admin_footer_text($footer_text) { |
|
204 | 204 | |
205 | 205 | // Check to make sure we're on a SimpleCal admin page |
206 | 206 | $screen = simcal_is_admin_screen(); |
207 | - if ( $screen !== false ) { |
|
207 | + if ($screen !== false) { |
|
208 | 208 | |
209 | - if ( 'calendar' == $screen ) { |
|
209 | + if ('calendar' == $screen) { |
|
210 | 210 | |
211 | 211 | // Add Drip promo signup form (@see Newsletter meta box). |
212 | 212 | |
@@ -234,23 +234,23 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | // Change the footer text |
237 | - if ( ! get_option( 'simple-calendar_admin_footer_text_rated' ) ) { |
|
237 | + if ( ! get_option('simple-calendar_admin_footer_text_rated')) { |
|
238 | 238 | |
239 | 239 | $footer_text = sprintf( |
240 | - __( 'If you like <strong>Simple Calendar</strong> please leave us a %s★★★★★ rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events' ), |
|
241 | - '<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'google-calendar-events' ) . '">', '</a>' |
|
240 | + __('If you like <strong>Simple Calendar</strong> please leave us a %s★★★★★ rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events'), |
|
241 | + '<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="'.esc_attr__('Thanks :)', 'google-calendar-events').'">', '</a>' |
|
242 | 242 | ); |
243 | 243 | |
244 | 244 | $footer_text .= '<script type="text/javascript">'; |
245 | 245 | $footer_text .= "jQuery( 'a.simcal-rating-link' ).click( function() { |
246 | - jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url() . "', { action: 'simcal_rated' } ); |
|
246 | + jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url()."', { action: 'simcal_rated' } ); |
|
247 | 247 | jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) ); |
248 | 248 | });"; |
249 | 249 | $footer_text .= '</script>'; |
250 | 250 | |
251 | 251 | } else { |
252 | 252 | |
253 | - $footer_text = __( 'Thank you for using Simple Calendar!', 'google-calendar-events' ); |
|
253 | + $footer_text = __('Thank you for using Simple Calendar!', 'google-calendar-events'); |
|
254 | 254 | |
255 | 255 | } |
256 | 256 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use SimpleCalendar\Admin\Metaboxes as Metabox; |
10 | 10 | |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | |
47 | - $settings = get_option( 'simple-calendar_settings_calendars' ); |
|
48 | - if ( isset( $settings['general']['attach_calendars_posts'] ) ) { |
|
47 | + $settings = get_option('simple-calendar_settings_calendars'); |
|
48 | + if (isset($settings['general']['attach_calendars_posts'])) { |
|
49 | 49 | $this->post_types = $settings['general']['attach_calendars_posts']; |
50 | 50 | } |
51 | 51 | |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | new Metabox\Settings(); |
54 | 54 | new Metabox\Attach_Calendar(); |
55 | 55 | new Metabox\Newsletter(); |
56 | - do_action( 'simcal_load_meta_boxes' ); |
|
56 | + do_action('simcal_load_meta_boxes'); |
|
57 | 57 | |
58 | 58 | // Add meta boxes. |
59 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 ); |
|
59 | + add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 30); |
|
60 | 60 | |
61 | 61 | // Process meta boxes. |
62 | - add_action( 'simcal_save_settings_meta','\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2 ); |
|
63 | - add_action( 'simcal_save_attach_calendar_meta','\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2 ); |
|
62 | + add_action('simcal_save_settings_meta', '\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2); |
|
63 | + add_action('simcal_save_attach_calendar_meta', '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2); |
|
64 | 64 | |
65 | 65 | // Save meta boxes data. |
66 | - add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 ); |
|
66 | + add_action('save_post', array($this, 'save_meta_boxes'), 1, 2); |
|
67 | 67 | |
68 | 68 | // Uncomment this for debugging $_POST while saving a meta box. |
69 | 69 | // add_action( 'save_post', function() { echo '<pre>'; print_r( $_POST ); echo '</pre>'; die(); } ); |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | |
79 | 79 | add_meta_box( |
80 | 80 | 'simcal-calendar-settings', |
81 | - __( 'Calendar Settings', 'google-calendar-events' ), |
|
81 | + __('Calendar Settings', 'google-calendar-events'), |
|
82 | 82 | '\SimpleCalendar\Admin\Metaboxes\Settings::html', |
83 | 83 | 'calendar', |
84 | 84 | 'normal', |
85 | 85 | 'core' |
86 | 86 | ); |
87 | 87 | |
88 | - $addons = apply_filters( 'simcal_installed_addons', array() ); |
|
89 | - if ( empty( $addons ) ) { |
|
88 | + $addons = apply_filters('simcal_installed_addons', array()); |
|
89 | + if (empty($addons)) { |
|
90 | 90 | |
91 | 91 | add_meta_box( |
92 | 92 | 'simcal-newsletter', |
93 | - __( 'Get 20% off Google Calendar Pro!', 'google-calendar-events' ), |
|
93 | + __('Get 20% off Google Calendar Pro!', 'google-calendar-events'), |
|
94 | 94 | '\SimpleCalendar\Admin\Metaboxes\Newsletter::html', |
95 | 95 | 'calendar', |
96 | 96 | 'side', |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | add_meta_box( |
103 | 103 | 'simcal-get-shortcode', |
104 | - __( 'Calendar Shortcode', 'google-calendar-events' ), |
|
104 | + __('Calendar Shortcode', 'google-calendar-events'), |
|
105 | 105 | '\SimpleCalendar\Admin\Metaboxes\Get_Shortcode::html', |
106 | 106 | 'calendar', |
107 | 107 | 'side', |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | ); |
110 | 110 | |
111 | 111 | // Add meta box if there are calendars. |
112 | - if ( ( true == simcal_get_calendars() ) && ! empty( $this->post_types ) ) { |
|
113 | - foreach ( $this->post_types as $post_type ) { |
|
112 | + if ((true == simcal_get_calendars()) && ! empty($this->post_types)) { |
|
113 | + foreach ($this->post_types as $post_type) { |
|
114 | 114 | add_meta_box( |
115 | 115 | 'simcal-attach-calendar', |
116 | - __( 'Attach Calendar', 'google-calendar-events' ), |
|
116 | + __('Attach Calendar', 'google-calendar-events'), |
|
117 | 117 | '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::html', |
118 | 118 | $post_type, |
119 | 119 | 'side', |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | - do_action( 'simcal_add_meta_boxes' ); |
|
125 | + do_action('simcal_add_meta_boxes'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | - public function save_meta_boxes( $post_id, $post ) { |
|
138 | + public function save_meta_boxes($post_id, $post) { |
|
139 | 139 | |
140 | 140 | // $post_id and $post are required. |
141 | - if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) { |
|
141 | + if (empty($post_id) || empty($post) || self::$saved_meta_boxes) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | 145 | // Don't save meta boxes for revisions or autosaves. |
146 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
146 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
147 | 147 | return; |
148 | 148 | } |
149 | 149 | |
150 | 150 | // Check the nonce. |
151 | - if ( empty( $_POST['simcal_meta_nonce'] ) || ! wp_verify_nonce( $_POST['simcal_meta_nonce'], 'simcal_save_data' ) ) { |
|
151 | + if (empty($_POST['simcal_meta_nonce']) || ! wp_verify_nonce($_POST['simcal_meta_nonce'], 'simcal_save_data')) { |
|
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | 155 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
156 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
156 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Check user has permission to edit |
161 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
161 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | self::$saved_meta_boxes = true; |
172 | 172 | |
173 | 173 | // Check the post type. |
174 | - if ( 'calendar' == $post->post_type ) { |
|
175 | - do_action( 'simcal_save_settings_meta', $post_id, $post ); |
|
176 | - } elseif ( in_array( $post->post_type, $this->post_types ) ) { |
|
177 | - do_action( 'simcal_save_attach_calendar_meta', $post_id, $post ); |
|
174 | + if ('calendar' == $post->post_type) { |
|
175 | + do_action('simcal_save_settings_meta', $post_id, $post); |
|
176 | + } elseif (in_array($post->post_type, $this->post_types)) { |
|
177 | + do_action('simcal_save_attach_calendar_meta', $post_id, $post); |
|
178 | 178 | } |
179 | 179 | |
180 | - do_action( 'simcal_save_meta_boxes', $post_id, $post ); |
|
180 | + do_action('simcal_save_meta_boxes', $post_id, $post); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | } |
@@ -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 |
@@ -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 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param \WP_Post $post |
28 | 28 | */ |
29 | - public static function html( $post ) { |
|
30 | - simcal_print_shortcode_tip( $post->ID ); |
|
29 | + public static function html($post) { |
|
30 | + simcal_print_shortcode_tip($post->ID); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param int $post_id |
39 | 39 | * @param \WP_Post $post |
40 | 40 | */ |
41 | - public static function save( $post_id, $post ) { |
|
41 | + public static function save($post_id, $post) { |
|
42 | 42 | // This Meta Box does not have settings. |
43 | 43 | } |
44 | 44 |
@@ -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 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param \WP_Post $post |
28 | 28 | */ |
29 | - public static function html( $post ) { |
|
29 | + public static function html($post) { |
|
30 | 30 | simcal_newsletter_signup(); |
31 | 31 | } |
32 | 32 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param int $post_id |
39 | 39 | * @param \WP_Post $post |
40 | 40 | */ |
41 | - public static function save( $post_id, $post ) { |
|
41 | + public static function save($post_id, $post) { |
|
42 | 42 | // This meta box has no persistent settings. |
43 | 43 | } |
44 | 44 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Admin; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -106,43 +106,43 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param array $notice |
108 | 108 | */ |
109 | - public function __construct( $notice ) { |
|
109 | + public function __construct($notice) { |
|
110 | 110 | |
111 | - if ( ! empty( $notice['id'] ) && ! empty( $notice['content'] ) ) { |
|
111 | + if ( ! empty($notice['id']) && ! empty($notice['content'])) { |
|
112 | 112 | |
113 | 113 | // Content. |
114 | - $this->id = is_array( $notice['id'] ) ? array_map( 'sanitize_key', $notice['id'] ) : sanitize_key( $notice['id'] ); |
|
115 | - $this->content = wp_kses_post( $notice['content'] ); |
|
116 | - if ( ! empty( $notice['class'] ) ) { |
|
117 | - $this->class = is_array( $notice['class'] ) ? join( ' ', array_map( 'esc_attr', $notice['class'] ) ) : esc_attr( $notice['class'] ); |
|
114 | + $this->id = is_array($notice['id']) ? array_map('sanitize_key', $notice['id']) : sanitize_key($notice['id']); |
|
115 | + $this->content = wp_kses_post($notice['content']); |
|
116 | + if ( ! empty($notice['class'])) { |
|
117 | + $this->class = is_array($notice['class']) ? join(' ', array_map('esc_attr', $notice['class'])) : esc_attr($notice['class']); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Type. |
121 | 121 | $default = 'notice'; |
122 | - $type = isset( $notice['type'] ) ? esc_attr( $notice['type'] ) : $default; |
|
122 | + $type = isset($notice['type']) ? esc_attr($notice['type']) : $default; |
|
123 | 123 | $types = array( |
124 | 124 | 'error', |
125 | 125 | 'notice', |
126 | 126 | 'updated', |
127 | 127 | 'update-nag', |
128 | 128 | ); |
129 | - $this->type = in_array( $type, $types ) ? $type : $default; |
|
129 | + $this->type = in_array($type, $types) ? $type : $default; |
|
130 | 130 | |
131 | 131 | // Visibility. |
132 | - if ( ! empty( $notice['capability'] ) ) { |
|
133 | - $this->capability = esc_attr( $notice['capability'] ); |
|
132 | + if ( ! empty($notice['capability'])) { |
|
133 | + $this->capability = esc_attr($notice['capability']); |
|
134 | 134 | } |
135 | - if ( ! empty( $notice['screen'] ) ) { |
|
136 | - $this->screen = is_array( $notice['screen'] ) ? array_map( 'esc_attr', $notice['screens'] ) : array( esc_attr( $notice['screen'] ) ); |
|
135 | + if ( ! empty($notice['screen'])) { |
|
136 | + $this->screen = is_array($notice['screen']) ? array_map('esc_attr', $notice['screens']) : array(esc_attr($notice['screen'])); |
|
137 | 137 | } |
138 | - if ( ! empty( $notice['post'] ) ) { |
|
139 | - $this->post = is_array( $notice['post'] ) ? array_map( 'intval', $notice['post'] ) : array( intval( $notice['post'] ) ); |
|
138 | + if ( ! empty($notice['post'])) { |
|
139 | + $this->post = is_array($notice['post']) ? array_map('intval', $notice['post']) : array(intval($notice['post'])); |
|
140 | 140 | } |
141 | - if ( ! empty( $notice['dismissible'] ) ) { |
|
142 | - $this->dismissible = $notice['dismissible'] === false ? false: true; |
|
141 | + if ( ! empty($notice['dismissible'])) { |
|
142 | + $this->dismissible = $notice['dismissible'] === false ? false : true; |
|
143 | 143 | } |
144 | - if ( ! empty( $notice['visible'] ) ) { |
|
145 | - $this->visible = $notice['visible'] === false ? false: true; |
|
144 | + if ( ! empty($notice['visible'])) { |
|
145 | + $this->visible = $notice['visible'] === false ? false : true; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
@@ -154,16 +154,16 @@ discard block |
||
154 | 154 | * @since 3.0.0 |
155 | 155 | */ |
156 | 156 | public function add() { |
157 | - if ( ! empty( $this->id ) && ! empty( $this->content ) ) { |
|
158 | - $notices = get_option( 'simple-calendar_admin_notices', array() ); |
|
159 | - if ( is_array( $this->id ) ) { |
|
160 | - foreach ( $this->id as $k => $v ) { |
|
161 | - $notices[ $k ][ $v ] = $this; |
|
157 | + if ( ! empty($this->id) && ! empty($this->content)) { |
|
158 | + $notices = get_option('simple-calendar_admin_notices', array()); |
|
159 | + if (is_array($this->id)) { |
|
160 | + foreach ($this->id as $k => $v) { |
|
161 | + $notices[$k][$v] = $this; |
|
162 | 162 | } |
163 | 163 | } else { |
164 | - $notices[ $this->id ][] = $this; |
|
164 | + $notices[$this->id][] = $this; |
|
165 | 165 | } |
166 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
166 | + update_option('simple-calendar_admin_notices', $notices); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | * @since 3.0.0 |
174 | 174 | */ |
175 | 175 | public function remove() { |
176 | - if ( ! empty( $this->id ) && ! empty( $this->content ) ) { |
|
177 | - $notices = get_option( 'simple-calendar_admin_notices', array() ); |
|
178 | - if ( is_array( $this->id ) ) { |
|
179 | - foreach ( $this->id as $k => $v ) { |
|
180 | - unset( $notices[ $k ] ); |
|
176 | + if ( ! empty($this->id) && ! empty($this->content)) { |
|
177 | + $notices = get_option('simple-calendar_admin_notices', array()); |
|
178 | + if (is_array($this->id)) { |
|
179 | + foreach ($this->id as $k => $v) { |
|
180 | + unset($notices[$k]); |
|
181 | 181 | } |
182 | 182 | } else { |
183 | - unset( $notices[ $this->id ] ); |
|
183 | + unset($notices[$this->id]); |
|
184 | 184 | } |
185 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
185 | + update_option('simple-calendar_admin_notices', $notices); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | namespace SimpleCalendar\Admin; |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @since 3.0.0 |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'admin_init', array( $this, 'remove_notice' ), 10 ); |
|
29 | - add_action( 'admin_init', array( $this, 'process_notices' ), 40 ); |
|
28 | + add_action('admin_init', array($this, 'remove_notice'), 10); |
|
29 | + add_action('admin_init', array($this, 'process_notices'), 40); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -38,35 +38,35 @@ discard block |
||
38 | 38 | |
39 | 39 | $notices = $this->get_notices(); |
40 | 40 | |
41 | - if ( ! empty( $notices ) && is_array( $notices ) ) { |
|
41 | + if ( ! empty($notices) && is_array($notices)) { |
|
42 | 42 | |
43 | - foreach ( $notices as $group ) { |
|
44 | - foreach ( $group as $notice ) { |
|
43 | + foreach ($notices as $group) { |
|
44 | + foreach ($group as $notice) { |
|
45 | 45 | |
46 | - if ( $notice instanceof Notice ) { |
|
46 | + if ($notice instanceof Notice) { |
|
47 | 47 | |
48 | - if ( $notice->visible === false ) { |
|
48 | + if ($notice->visible === false) { |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | |
52 | - if ( ! empty( $notice->capability ) ) { |
|
53 | - if ( ! current_user_can( $notice->capability ) ) { |
|
52 | + if ( ! empty($notice->capability)) { |
|
53 | + if ( ! current_user_can($notice->capability)) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - if ( ! empty( $notice->screen ) && is_array( $notice->screen ) && function_exists( 'get_current_screen' ) ) { |
|
58 | + if ( ! empty($notice->screen) && is_array($notice->screen) && function_exists('get_current_screen')) { |
|
59 | 59 | $screen = get_current_screen(); |
60 | - if ( isset( $screen->id ) ) { |
|
61 | - if ( ! in_array( $screen->id, $notice->screen ) ) { |
|
60 | + if (isset($screen->id)) { |
|
61 | + if ( ! in_array($screen->id, $notice->screen)) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if ( ! empty( $notice->post ) && is_array( $notice->post ) ) { |
|
68 | - if ( isset( $_GET['post'] ) ) { |
|
69 | - if ( ! in_array( intval( $_GET['post'] ), $notice->post ) ) { |
|
67 | + if ( ! empty($notice->post) && is_array($notice->post)) { |
|
68 | + if (isset($_GET['post'])) { |
|
69 | + if ( ! in_array(intval($_GET['post']), $notice->post)) { |
|
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | } else { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - $this->add_notice( $notice ); |
|
77 | + $this->add_notice($notice); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -92,19 +92,19 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return void |
94 | 94 | */ |
95 | - public function add_notice( $notice ) { |
|
95 | + public function add_notice($notice) { |
|
96 | 96 | |
97 | - if ( $notice instanceof Notice ) { |
|
97 | + if ($notice instanceof Notice) { |
|
98 | 98 | |
99 | - add_action( 'admin_notices', $print_notice = function() use ( $notice ) { |
|
99 | + add_action('admin_notices', $print_notice = function() use ($notice) { |
|
100 | 100 | |
101 | - $name = is_array( $notice->id ) ? key( $notice->id ) : $notice->id; |
|
102 | - $url = add_query_arg( array( 'dismiss_simcal_notice' => $name ) ); |
|
101 | + $name = is_array($notice->id) ? key($notice->id) : $notice->id; |
|
102 | + $url = add_query_arg(array('dismiss_simcal_notice' => $name)); |
|
103 | 103 | $dismiss_link = $notice->dismissible === true |
104 | - ? sprintf( '<a class="dashicons-before dashicons-dismiss simcal-dismiss-notice" href="%1$s"></a>', $url ) |
|
104 | + ? sprintf('<a class="dashicons-before dashicons-dismiss simcal-dismiss-notice" href="%1$s"></a>', $url) |
|
105 | 105 | : ''; |
106 | 106 | |
107 | - echo '<div class="' . $notice->type . ' ' . $notice->class . ' simcal-admin-notice" data-notice-id="' . $name . '">' . $dismiss_link . $notice->content . '</div>'; |
|
107 | + echo '<div class="'.$notice->type.' '.$notice->class.' simcal-admin-notice" data-notice-id="'.$name.'">'.$dismiss_link.$notice->content.'</div>'; |
|
108 | 108 | } ); |
109 | 109 | |
110 | 110 | } |
@@ -121,27 +121,27 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function remove_notice( $notice = '' ) { |
|
124 | + public function remove_notice($notice = '') { |
|
125 | 125 | |
126 | 126 | $notices = $this->get_notices(); |
127 | 127 | $update = false; |
128 | 128 | |
129 | - if ( ! empty( $notice ) ) { |
|
130 | - if ( isset( $notices[ $notice ] ) ) { |
|
131 | - unset( $notices[ $notice ] ); |
|
129 | + if ( ! empty($notice)) { |
|
130 | + if (isset($notices[$notice])) { |
|
131 | + unset($notices[$notice]); |
|
132 | 132 | $update = true; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - if ( isset( $_GET['dismiss_simcal_notice'] ) ) { |
|
137 | - if ( isset( $notices[ $_GET['dismiss_simcal_notice'] ] ) ) { |
|
138 | - unset( $notices[ esc_attr( $_GET['dismiss_simcal_notice'] ) ] ); |
|
136 | + if (isset($_GET['dismiss_simcal_notice'])) { |
|
137 | + if (isset($notices[$_GET['dismiss_simcal_notice']])) { |
|
138 | + unset($notices[esc_attr($_GET['dismiss_simcal_notice'])]); |
|
139 | 139 | $update = true; |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - if ( $update === true ) { |
|
144 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
143 | + if ($update === true) { |
|
144 | + update_option('simple-calendar_admin_notices', $notices); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return void |
156 | 156 | */ |
157 | - public function show_notice( $notice ) { |
|
157 | + public function show_notice($notice) { |
|
158 | 158 | |
159 | 159 | $notices = $this->get_notices(); |
160 | 160 | |
161 | - if ( isset( $notices[ $notice ]->visible ) ) { |
|
162 | - $notices[ $notice ]->visible = true; |
|
163 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
161 | + if (isset($notices[$notice]->visible)) { |
|
162 | + $notices[$notice]->visible = true; |
|
163 | + update_option('simple-calendar_admin_notices', $notices); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return void |
175 | 175 | */ |
176 | - public function hide_notice( $notice ) { |
|
176 | + public function hide_notice($notice) { |
|
177 | 177 | |
178 | 178 | $notices = $this->get_notices(); |
179 | 179 | |
180 | - if ( isset( $notices[ $notice ]->visible ) ) { |
|
181 | - $notices[ $notice ]->visible = false; |
|
182 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
180 | + if (isset($notices[$notice]->visible)) { |
|
181 | + $notices[$notice]->visible = false; |
|
182 | + update_option('simple-calendar_admin_notices', $notices); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | public function get_notices() { |
194 | 194 | return apply_filters( |
195 | 195 | 'simcal_admin_notices', |
196 | - get_option( 'simple-calendar_admin_notices', array() ) |
|
196 | + get_option('simple-calendar_admin_notices', array()) |
|
197 | 197 | ); |
198 | 198 | } |
199 | 199 |