@@ -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 | |
@@ -51,28 +51,28 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @param array $field |
53 | 53 | */ |
54 | - public function __construct( $field ) { |
|
54 | + public function __construct($field) { |
|
55 | 55 | |
56 | 56 | $class = 'simcal-field-select'; |
57 | 57 | |
58 | - $enhanced = isset( $field['enhanced'] ) ? $field['enhanced'] : ''; |
|
59 | - if ( 'enhanced' == $enhanced ) { |
|
58 | + $enhanced = isset($field['enhanced']) ? $field['enhanced'] : ''; |
|
59 | + if ('enhanced' == $enhanced) { |
|
60 | 60 | $this->enhanced = true; |
61 | 61 | $class .= ' simcal-field-select-enhanced'; |
62 | 62 | } |
63 | 63 | |
64 | - $multiselect = isset( $field['multiselect'] ) ? $field['multiselect'] : ''; |
|
65 | - if ( 'multiselect' == $multiselect ) { |
|
64 | + $multiselect = isset($field['multiselect']) ? $field['multiselect'] : ''; |
|
65 | + if ('multiselect' == $multiselect) { |
|
66 | 66 | $this->multiselect = true; |
67 | 67 | $class .= ' simcal-field-multiselect'; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $this->type_class = $class; |
71 | 71 | |
72 | - $allow_void = isset( $field['allow_void'] ) ? $field['allow_void'] : ''; |
|
72 | + $allow_void = isset($field['allow_void']) ? $field['allow_void'] : ''; |
|
73 | 73 | $this->allow_void = 'allow_void' == $allow_void ? true : false; |
74 | 74 | |
75 | - parent::__construct( $field ); |
|
75 | + parent::__construct($field); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function html() { |
84 | 84 | |
85 | - if ( $this->multiselect === true && ! is_array( $this->value ) ) { |
|
86 | - $this->value = explode( ',', $this->value ); |
|
85 | + if ($this->multiselect === true && ! is_array($this->value)) { |
|
86 | + $this->value = explode(',', $this->value); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | ?> |
90 | - <select name="<?php echo $this->name; ?><?php if ( $this->multiselect === true ) { echo '[]'; } ?>" |
|
90 | + <select name="<?php echo $this->name; ?><?php if ($this->multiselect === true) { echo '[]'; } ?>" |
|
91 | 91 | id="<?php echo $this->id; ?>" |
92 | 92 | style="<?php echo $this->style; ?>" |
93 | 93 | class="<?php echo $this->class; ?>" |
94 | 94 | <?php echo $this->attributes; ?> |
95 | - <?php echo ( $this->multiselect === true ) ? ' multiple="multiple"' : ''; ?>> |
|
95 | + <?php echo ($this->multiselect === true) ? ' multiple="multiple"' : ''; ?>> |
|
96 | 96 | <?php |
97 | 97 | |
98 | - if ( $this->allow_void === true ) { |
|
99 | - echo '<option value=""' . selected( '', $this->value, false ) . '></option>'; |
|
98 | + if ($this->allow_void === true) { |
|
99 | + echo '<option value=""'.selected('', $this->value, false).'></option>'; |
|
100 | 100 | } |
101 | 101 | |
102 | - foreach ( $this->options as $option => $name ) { |
|
103 | - if ( is_array( $this->value ) ) { |
|
104 | - $selected = selected( in_array( $option, $this->value ), true, false ); |
|
102 | + foreach ($this->options as $option => $name) { |
|
103 | + if (is_array($this->value)) { |
|
104 | + $selected = selected(in_array($option, $this->value), true, false); |
|
105 | 105 | } else { |
106 | - $selected = selected( $this->value, trim( strval( $option ) ), false ); |
|
106 | + $selected = selected($this->value, trim(strval($option)), false); |
|
107 | 107 | } |
108 | - echo '<option value="' . $option . '" ' . $selected . '>' . esc_attr( $name ) . '</option>'; |
|
108 | + echo '<option value="'.$option.'" '.$selected.'>'.esc_attr($name).'</option>'; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | ?> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | |
115 | 115 | echo $this->tooltip; |
116 | 116 | |
117 | - if ( ! empty( $this->description ) ) { |
|
118 | - echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>'; |
|
117 | + if ( ! empty($this->description)) { |
|
118 | + echo '<p class="description">'.wp_kses_post($this->description).'</p>'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } |
@@ -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 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | use SimpleCalendar\Abstracts\Feed; |
12 | 12 | use SimpleCalendar\Abstracts\Field; |
13 | 13 | |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -31,40 +31,40 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param \WP_Post $post |
33 | 33 | */ |
34 | - public static function html( $post ) { |
|
34 | + public static function html($post) { |
|
35 | 35 | |
36 | 36 | // @see Meta_Boxes::save_meta_boxes() |
37 | - wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' ); |
|
37 | + wp_nonce_field('simcal_save_data', 'simcal_meta_nonce'); |
|
38 | 38 | |
39 | 39 | ?> |
40 | 40 | <div class="simcal-panels-wrap"> |
41 | 41 | |
42 | 42 | <span class="simcal-box-handle"> |
43 | - <?php self::settings_handle( $post ); ?> |
|
43 | + <?php self::settings_handle($post); ?> |
|
44 | 44 | </span> |
45 | 45 | |
46 | 46 | <ul class="simcal-tabs"> |
47 | - <?php self::settings_tabs( $post ); ?> |
|
48 | - <?php do_action( 'simcal_settings_meta_tabs' ); ?> |
|
47 | + <?php self::settings_tabs($post); ?> |
|
48 | + <?php do_action('simcal_settings_meta_tabs'); ?> |
|
49 | 49 | </ul> |
50 | 50 | |
51 | 51 | <div class="simcal-panels"> |
52 | 52 | <div id="events-settings-panel" class="simcal-panel"> |
53 | - <?php self::events_settings_panel( $post ); ?> |
|
54 | - <?php do_action( 'simcal_settings_meta_events_panel', $post->ID ); ?> |
|
53 | + <?php self::events_settings_panel($post); ?> |
|
54 | + <?php do_action('simcal_settings_meta_events_panel', $post->ID); ?> |
|
55 | 55 | </div> |
56 | 56 | <div id="calendar-settings-panel" class="simcal-panel"> |
57 | - <?php do_action( 'simcal_settings_meta_calendar_panel', $post->ID ); ?> |
|
58 | - <?php self::calendar_settings_panel( $post ); ?> |
|
57 | + <?php do_action('simcal_settings_meta_calendar_panel', $post->ID); ?> |
|
58 | + <?php self::calendar_settings_panel($post); ?> |
|
59 | 59 | </div> |
60 | 60 | <?php |
61 | 61 | // Hook for additional settings panels. |
62 | - do_action( 'simcal_settings_meta_panels', $post->ID ); |
|
62 | + do_action('simcal_settings_meta_panels', $post->ID); |
|
63 | 63 | // Thus advanced panel is always the last one: |
64 | 64 | ?> |
65 | 65 | <div id="advanced-settings-panel" class="simcal-panel"> |
66 | - <?php self::advanced_settings_panel( $post ) ?> |
|
67 | - <?php do_action( 'simcal_settings_meta_advanced_panel', $post->ID ); ?> |
|
66 | + <?php self::advanced_settings_panel($post) ?> |
|
67 | + <?php do_action('simcal_settings_meta_advanced_panel', $post->ID); ?> |
|
68 | 68 | </div> |
69 | 69 | </div> |
70 | 70 | |
@@ -84,45 +84,45 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @param \WP_Post $post |
86 | 86 | */ |
87 | - private static function settings_handle( $post ) { |
|
87 | + private static function settings_handle($post) { |
|
88 | 88 | |
89 | 89 | $feed_options = $calendar_options = $calendar_views = array(); |
90 | 90 | |
91 | 91 | $feed_types = simcal_get_feed_types(); |
92 | - foreach ( $feed_types as $feed_type ) { |
|
92 | + foreach ($feed_types as $feed_type) { |
|
93 | 93 | |
94 | - $feed = simcal_get_feed( $feed_type ); |
|
94 | + $feed = simcal_get_feed($feed_type); |
|
95 | 95 | |
96 | - if ( $feed instanceof Feed ) { |
|
97 | - $feed_options[ $feed_type ] = $feed->name; |
|
96 | + if ($feed instanceof Feed) { |
|
97 | + $feed_options[$feed_type] = $feed->name; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | $calendar_types = simcal_get_calendar_types(); |
102 | - foreach ( $calendar_types as $calendar_type => $views ) { |
|
102 | + foreach ($calendar_types as $calendar_type => $views) { |
|
103 | 103 | |
104 | - $calendar = simcal_get_calendar( $calendar_type ); |
|
104 | + $calendar = simcal_get_calendar($calendar_type); |
|
105 | 105 | |
106 | - if ( $calendar instanceof Calendar ) { |
|
107 | - $calendar_options[ $calendar_type ] = $calendar->name; |
|
108 | - $calendar_views[ $calendar_type ] = $calendar->views; |
|
106 | + if ($calendar instanceof Calendar) { |
|
107 | + $calendar_options[$calendar_type] = $calendar->name; |
|
108 | + $calendar_views[$calendar_type] = $calendar->views; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - if ( $feed_options ) { |
|
112 | + if ($feed_options) { |
|
113 | 113 | |
114 | - if ( $feed_types = wp_get_object_terms( $post->ID, 'calendar_feed' ) ) { |
|
115 | - $feed_type = sanitize_title( current( $feed_types )->name ); |
|
114 | + if ($feed_types = wp_get_object_terms($post->ID, 'calendar_feed')) { |
|
115 | + $feed_type = sanitize_title(current($feed_types)->name); |
|
116 | 116 | } else { |
117 | - $feed_type = apply_filters( 'simcal_default_feed_type', 'google' ); |
|
117 | + $feed_type = apply_filters('simcal_default_feed_type', 'google'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | ?> |
121 | - <label for="_feed_type"><span><?php _e( 'Event Source', 'google-calendar-events' ); ?></span> |
|
121 | + <label for="_feed_type"><span><?php _e('Event Source', 'google-calendar-events'); ?></span> |
|
122 | 122 | <select name="_feed_type" id="_feed_type"> |
123 | - <optgroup label="<?php _ex( 'Get events from', 'From which calendar source to load events from', 'google-calendar-events' ) ?>"> |
|
124 | - <?php foreach ( $feed_options as $feed => $name ) { ?> |
|
125 | - <option value="<?php echo $feed; ?>" <?php selected( $feed, $feed_type, true ); ?>><?php echo $name; ?></option> |
|
123 | + <optgroup label="<?php _ex('Get events from', 'From which calendar source to load events from', 'google-calendar-events') ?>"> |
|
124 | + <?php foreach ($feed_options as $feed => $name) { ?> |
|
125 | + <option value="<?php echo $feed; ?>" <?php selected($feed, $feed_type, true); ?>><?php echo $name; ?></option> |
|
126 | 126 | <?php } ?> |
127 | 127 | </optgroup> |
128 | 128 | </select> |
@@ -131,40 +131,40 @@ discard block |
||
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | - if ( $calendar_options ) { |
|
134 | + if ($calendar_options) { |
|
135 | 135 | |
136 | - if ( $calendar_types = wp_get_object_terms( $post->ID, 'calendar_type' ) ) { |
|
137 | - $calendar_type = sanitize_title( current( $calendar_types )->name ); |
|
136 | + if ($calendar_types = wp_get_object_terms($post->ID, 'calendar_type')) { |
|
137 | + $calendar_type = sanitize_title(current($calendar_types)->name); |
|
138 | 138 | } else { |
139 | - $calendar_type = apply_filters( 'simcal_default_calendar_type', 'default-calendar' ); |
|
139 | + $calendar_type = apply_filters('simcal_default_calendar_type', 'default-calendar'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | ?> |
143 | - <label for="_calendar_type"><span><?php _e( 'Calendar', 'google-calendar-events' ); ?></span> |
|
143 | + <label for="_calendar_type"><span><?php _e('Calendar', 'google-calendar-events'); ?></span> |
|
144 | 144 | <select name="_calendar_type" id="_calendar_type"> |
145 | - <optgroup label="<?php _e( 'Calendar to use', 'google-calendar-events' ); ?>"> |
|
146 | - <?php foreach ( $calendar_options as $calendar => $name ) { ?> |
|
147 | - <option value="<?php echo $calendar; ?>" <?php selected( $calendar, $calendar_type, true ); ?>><?php echo $name; ?></option> |
|
145 | + <optgroup label="<?php _e('Calendar to use', 'google-calendar-events'); ?>"> |
|
146 | + <?php foreach ($calendar_options as $calendar => $name) { ?> |
|
147 | + <option value="<?php echo $calendar; ?>" <?php selected($calendar, $calendar_type, true); ?>><?php echo $name; ?></option> |
|
148 | 148 | <?php } ?> |
149 | 149 | </optgroup> |
150 | 150 | </select> |
151 | 151 | </label> |
152 | 152 | <?php |
153 | 153 | |
154 | - if ( $calendar_views ) { |
|
154 | + if ($calendar_views) { |
|
155 | 155 | |
156 | - $calendar_view = get_post_meta( $post->ID, '_calendar_view', true ); |
|
156 | + $calendar_view = get_post_meta($post->ID, '_calendar_view', true); |
|
157 | 157 | |
158 | - foreach ( $calendar_views as $calendar => $views ) { |
|
158 | + foreach ($calendar_views as $calendar => $views) { |
|
159 | 159 | |
160 | - $calendar_type_view = isset( $calendar_view[ $calendar ] ) ? $calendar_view[ $calendar ] : ''; |
|
160 | + $calendar_type_view = isset($calendar_view[$calendar]) ? $calendar_view[$calendar] : ''; |
|
161 | 161 | |
162 | 162 | ?> |
163 | - <label for="_calendar_view_<?php echo $calendar; ?>"><span><?php _e( 'View', 'google-calendar-events' ); ?></span> |
|
163 | + <label for="_calendar_view_<?php echo $calendar; ?>"><span><?php _e('View', 'google-calendar-events'); ?></span> |
|
164 | 164 | <select name="_calendar_view[<?php echo $calendar; ?>]" id="_calendar_view_<?php echo $calendar; ?>"> |
165 | - <optgroup label="<?php _e( 'View to display', 'google-calendar-events' ); ?>"> |
|
166 | - <?php foreach ( $views as $view => $name ) { ?> |
|
167 | - <option value="<?php echo $view; ?>" <?php selected( $view, $calendar_type_view, true ); ?>><?php echo $name; ?></option> |
|
165 | + <optgroup label="<?php _e('View to display', 'google-calendar-events'); ?>"> |
|
166 | + <?php foreach ($views as $view => $name) { ?> |
|
167 | + <option value="<?php echo $view; ?>" <?php selected($view, $calendar_type_view, true); ?>><?php echo $name; ?></option> |
|
168 | 168 | <?php } ?> |
169 | 169 | </optgroup> |
170 | 170 | </select> |
@@ -184,42 +184,42 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @param \WP_Post $post |
186 | 186 | */ |
187 | - private static function settings_tabs( $post ) { |
|
187 | + private static function settings_tabs($post) { |
|
188 | 188 | |
189 | 189 | // Hook to add more tabs. |
190 | - $tabs = apply_filters( 'simcal_settings_meta_tabs_li', array( |
|
190 | + $tabs = apply_filters('simcal_settings_meta_tabs_li', array( |
|
191 | 191 | 'events' => array( |
192 | - 'label' => __( 'Events', 'google-calendar-events' ), |
|
192 | + 'label' => __('Events', 'google-calendar-events'), |
|
193 | 193 | 'target' => 'events-settings-panel', |
194 | - 'class' => array( 'active' ), |
|
194 | + 'class' => array('active'), |
|
195 | 195 | 'icon' => 'simcal-icon-event', |
196 | 196 | ), |
197 | 197 | 'calendar' => array( |
198 | - 'label' => __( 'Appearance', 'google-calendar-events' ), |
|
198 | + 'label' => __('Appearance', 'google-calendar-events'), |
|
199 | 199 | 'target' => 'calendar-settings-panel', |
200 | 200 | 'class' => array(), |
201 | 201 | 'icon' => 'simcal-icon-calendar', |
202 | 202 | ), |
203 | - ), $post->ID ); |
|
203 | + ), $post->ID); |
|
204 | 204 | |
205 | 205 | // Always keep advanced tab as the last one. |
206 | 206 | $tabs['advanced'] = array( |
207 | - 'label' => __( 'Advanced', 'google-calendar-events' ), |
|
207 | + 'label' => __('Advanced', 'google-calendar-events'), |
|
208 | 208 | 'target' => 'advanced-settings-panel', |
209 | 209 | 'class' => array(), |
210 | 210 | 'icon' => 'simcal-icon-settings', |
211 | 211 | ); |
212 | 212 | |
213 | 213 | // Output the tabs as list items. |
214 | - foreach ( $tabs as $key => $tab ) { |
|
214 | + foreach ($tabs as $key => $tab) { |
|
215 | 215 | |
216 | - if ( isset( $tab['target'] ) && isset( $tab['label'] ) ) { |
|
216 | + if (isset($tab['target']) && isset($tab['label'])) { |
|
217 | 217 | |
218 | 218 | $icon = $tab['icon'] ? $tab['icon'] : 'simcal-icon-panel'; |
219 | 219 | $class = $tab['class'] ? $tab['class'] : array(); |
220 | 220 | |
221 | - echo '<li class="' . $key . '-settings ' . $key . '-tab ' . implode( ' ', $class ) . '" data-tab="' . $key . '">'; |
|
222 | - echo '<a href="#' . $tab['target'] . '"><i class="' . $icon . '" ></i> <span>' . esc_html( $tab['label'] ) . '</span></a>'; |
|
221 | + echo '<li class="'.$key.'-settings '.$key.'-tab '.implode(' ', $class).'" data-tab="'.$key.'">'; |
|
222 | + echo '<a href="#'.$tab['target'].'"><i class="'.$icon.'" ></i> <span>'.esc_html($tab['label']).'</span></a>'; |
|
223 | 223 | echo '</li>'; |
224 | 224 | } |
225 | 225 | } |
@@ -233,22 +233,22 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @param \WP_Post $post |
235 | 235 | */ |
236 | - private static function events_settings_panel( $post ) { |
|
236 | + private static function events_settings_panel($post) { |
|
237 | 237 | |
238 | 238 | ?> |
239 | 239 | <table> |
240 | 240 | <thead> |
241 | - <tr><th colspan="2"><?php _e( 'Events settings', 'google-calendar-events' ); ?></th></tr> |
|
241 | + <tr><th colspan="2"><?php _e('Events settings', 'google-calendar-events'); ?></th></tr> |
|
242 | 242 | </thead> |
243 | 243 | <tbody class="simcal-panel-section simcal-panel-section-events-range"> |
244 | 244 | <tr class="simcal-panel-field"> |
245 | - <th><label for="_calendar_begins"><?php _e( 'Calendar start', 'google-calendar-events' ); ?></label></th> |
|
245 | + <th><label for="_calendar_begins"><?php _e('Calendar start', 'google-calendar-events'); ?></label></th> |
|
246 | 246 | <td> |
247 | 247 | <?php |
248 | 248 | |
249 | - $calendar_begins = esc_attr( get_post_meta( $post->ID, '_calendar_begins', true ) ); |
|
250 | - $calendar_begins_nth = max( absint( get_post_meta( $post->ID, '_calendar_begins_nth', true ) ), 1 ); |
|
251 | - $calendar_begins_nth_show = in_array( $calendar_begins, array( |
|
249 | + $calendar_begins = esc_attr(get_post_meta($post->ID, '_calendar_begins', true)); |
|
250 | + $calendar_begins_nth = max(absint(get_post_meta($post->ID, '_calendar_begins_nth', true)), 1); |
|
251 | + $calendar_begins_nth_show = in_array($calendar_begins, array( |
|
252 | 252 | 'days_before', |
253 | 253 | 'days_after', |
254 | 254 | 'weeks_before', |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | 'months_after', |
258 | 258 | 'years_before', |
259 | 259 | 'years_after', |
260 | - ) ); |
|
260 | + )); |
|
261 | 261 | |
262 | - simcal_print_field( array( |
|
262 | + simcal_print_field(array( |
|
263 | 263 | 'type' => 'standard', |
264 | 264 | 'subtype' => 'number', |
265 | 265 | 'name' => '_calendar_begins_nth', |
266 | 266 | 'id' => '_calendar_begins_nth', |
267 | - 'value' => strval( $calendar_begins_nth ), |
|
267 | + 'value' => strval($calendar_begins_nth), |
|
268 | 268 | 'attributes' => array( |
269 | 269 | 'min' => '1', |
270 | 270 | ), |
@@ -272,97 +272,97 @@ discard block |
||
272 | 272 | 'simcal-field-inline', |
273 | 273 | 'simcal-field-tiny', |
274 | 274 | ), |
275 | - 'style' => ! $calendar_begins_nth_show ? array( 'display' => 'none' ) : '', |
|
276 | - ) ); |
|
275 | + 'style' => ! $calendar_begins_nth_show ? array('display' => 'none') : '', |
|
276 | + )); |
|
277 | 277 | |
278 | 278 | ?> |
279 | 279 | <select name="_calendar_begins" |
280 | 280 | id="_calendar_begins" |
281 | 281 | class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other"> |
282 | - <optgroup label="<?php _e( 'Days range', 'google-calendar-events' ); ?>"> |
|
282 | + <optgroup label="<?php _e('Days range', 'google-calendar-events'); ?>"> |
|
283 | 283 | <option value="today" |
284 | 284 | data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth" |
285 | - <?php selected( 'today', $calendar_begins, true ); ?>><?php _e( 'Today', 'google-calendar-events' ); ?></option> |
|
285 | + <?php selected('today', $calendar_begins, true); ?>><?php _e('Today', 'google-calendar-events'); ?></option> |
|
286 | 286 | <option value="now" |
287 | 287 | data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth" |
288 | - <?php selected( 'now', $calendar_begins, true ); ?>><?php _e( 'Now', 'google-calendar-events' ); ?></option> |
|
288 | + <?php selected('now', $calendar_begins, true); ?>><?php _e('Now', 'google-calendar-events'); ?></option> |
|
289 | 289 | <option value="days_before" |
290 | 290 | data-hide-field="_calendar_begins_custom_date" |
291 | - data-show-field="_calendar_begins_nth" <?php selected( 'days_before', $calendar_begins, true ); ?>><?php _e( 'Day(s) before today', 'google-calendar-events' ); ?></option> |
|
291 | + data-show-field="_calendar_begins_nth" <?php selected('days_before', $calendar_begins, true); ?>><?php _e('Day(s) before today', 'google-calendar-events'); ?></option> |
|
292 | 292 | <option value="days_after" |
293 | 293 | data-hide-field="_calendar_begins_custom_date" |
294 | - data-show-field="_calendar_begins_nth" <?php selected( 'days_after', $calendar_begins, true ); ?>><?php _e( 'Day(s) after today', 'google-calendar-events' ); ?></option> |
|
294 | + data-show-field="_calendar_begins_nth" <?php selected('days_after', $calendar_begins, true); ?>><?php _e('Day(s) after today', 'google-calendar-events'); ?></option> |
|
295 | 295 | </optgroup> |
296 | - <optgroup label="<?php _e( 'Weeks range', 'google-calendar-events' ); ?>"> |
|
296 | + <optgroup label="<?php _e('Weeks range', 'google-calendar-events'); ?>"> |
|
297 | 297 | <option value="this_week" |
298 | 298 | data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth" |
299 | - <?php selected( 'this_week', $calendar_begins, true ); ?>><?php _e( 'This week', 'google-calendar-events' ); ?></option> |
|
299 | + <?php selected('this_week', $calendar_begins, true); ?>><?php _e('This week', 'google-calendar-events'); ?></option> |
|
300 | 300 | <option value="weeks_before" |
301 | 301 | data-hide-field="_calendar_begins_custom_date" |
302 | - data-show-field="_calendar_begins_nth" <?php selected( 'weeks_before', $calendar_begins, true ); ?>><?php _e( 'Week(s) before current', 'google-calendar-events' ); ?></option> |
|
302 | + data-show-field="_calendar_begins_nth" <?php selected('weeks_before', $calendar_begins, true); ?>><?php _e('Week(s) before current', 'google-calendar-events'); ?></option> |
|
303 | 303 | <option value="weeks_after" |
304 | 304 | data-hide-field="_calendar_begins_custom_date" |
305 | - data-show-field="_calendar_begins_nth" <?php selected( 'weeks_after', $calendar_begins, true ); ?>><?php _e( 'Week(s) after current', 'google-calendar-events' ); ?></option> |
|
305 | + data-show-field="_calendar_begins_nth" <?php selected('weeks_after', $calendar_begins, true); ?>><?php _e('Week(s) after current', 'google-calendar-events'); ?></option> |
|
306 | 306 | </optgroup> |
307 | - <optgroup label="<?php _e( 'Months range', 'google-calendar-events' ); ?>"> |
|
307 | + <optgroup label="<?php _e('Months range', 'google-calendar-events'); ?>"> |
|
308 | 308 | <option value="this_month" |
309 | 309 | data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth" |
310 | - <?php selected( 'this_month', $calendar_begins, true ); ?>><?php _e( 'This month', 'google-calendar-events' ); ?></option> |
|
310 | + <?php selected('this_month', $calendar_begins, true); ?>><?php _e('This month', 'google-calendar-events'); ?></option> |
|
311 | 311 | <option value="months_before" |
312 | 312 | data-hide-field="_calendar_begins_custom_date" |
313 | - data-show-field="_calendar_begins_nth" <?php selected( 'months_before', $calendar_begins, true ); ?>><?php _e( 'Month(s) before current', 'google-calendar-events' ); ?></option> |
|
313 | + data-show-field="_calendar_begins_nth" <?php selected('months_before', $calendar_begins, true); ?>><?php _e('Month(s) before current', 'google-calendar-events'); ?></option> |
|
314 | 314 | <option value="months_after" |
315 | 315 | data-hide-field="_calendar_begins_custom_date" |
316 | - data-show-field="_calendar_begins_nth" <?php selected( 'months_after', $calendar_begins, true ); ?>><?php _e( 'Month(s) after current', 'google-calendar-events' ); ?></option> |
|
316 | + data-show-field="_calendar_begins_nth" <?php selected('months_after', $calendar_begins, true); ?>><?php _e('Month(s) after current', 'google-calendar-events'); ?></option> |
|
317 | 317 | </optgroup> |
318 | - <optgroup label="<?php _e( 'Years range', 'google-calendar-events' ); ?>"> |
|
318 | + <optgroup label="<?php _e('Years range', 'google-calendar-events'); ?>"> |
|
319 | 319 | <option value="this_year" |
320 | 320 | data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth" |
321 | - <?php selected( 'this_year', $calendar_begins, true ); ?>><?php _e( 'This year', 'google-calendar-events' ); ?></option> |
|
321 | + <?php selected('this_year', $calendar_begins, true); ?>><?php _e('This year', 'google-calendar-events'); ?></option> |
|
322 | 322 | <option value="years_before" |
323 | - data-show-field="_calendar_begins_nth" <?php selected( 'years_before', $calendar_begins, true ); ?>><?php _e( 'Year(s) before current', 'google-calendar-events' ); ?></option> |
|
323 | + data-show-field="_calendar_begins_nth" <?php selected('years_before', $calendar_begins, true); ?>><?php _e('Year(s) before current', 'google-calendar-events'); ?></option> |
|
324 | 324 | <option value="years_after" |
325 | 325 | data-hide-field="_calendar_begins_custom_date" |
326 | - data-show-field="_calendar_begins_nth" <?php selected( 'years_after', $calendar_begins, true ); ?>><?php _e( 'Year(s) after current', 'google-calendar-events' ); ?></option> |
|
326 | + data-show-field="_calendar_begins_nth" <?php selected('years_after', $calendar_begins, true); ?>><?php _e('Year(s) after current', 'google-calendar-events'); ?></option> |
|
327 | 327 | </optgroup> |
328 | - <optgroup label="<?php _e( 'Other', 'google-calendar-events' ); ?>"> |
|
328 | + <optgroup label="<?php _e('Other', 'google-calendar-events'); ?>"> |
|
329 | 329 | <option value="custom_date" |
330 | 330 | data-hide-field="_calendar_begins_nth" |
331 | - data-show-field="_calendar_begins_custom_date" <?php selected( 'custom_date', $calendar_begins, true ); ?>><?php _e( 'Specific date', 'google-calendar-events' ); ?></option> |
|
331 | + data-show-field="_calendar_begins_custom_date" <?php selected('custom_date', $calendar_begins, true); ?>><?php _e('Specific date', 'google-calendar-events'); ?></option> |
|
332 | 332 | </optgroup> |
333 | 333 | </select> |
334 | 334 | <?php |
335 | 335 | |
336 | - simcal_print_field( array( |
|
336 | + simcal_print_field(array( |
|
337 | 337 | 'type' => 'date-picker', |
338 | 338 | 'name' => '_calendar_begins_custom_date', |
339 | 339 | 'id' => '_calendar_begins_custom_date', |
340 | - 'value' => get_post_meta( $post->ID, '_calendar_begins_custom_date', true ), |
|
340 | + 'value' => get_post_meta($post->ID, '_calendar_begins_custom_date', true), |
|
341 | 341 | 'class' => array( |
342 | 342 | 'simcal-field-inline', |
343 | 343 | ), |
344 | - 'style' => 'custom_date' != $calendar_begins ? array( 'display' => 'none' ) : '', |
|
345 | - ) ); |
|
344 | + 'style' => 'custom_date' != $calendar_begins ? array('display' => 'none') : '', |
|
345 | + )); |
|
346 | 346 | |
347 | 347 | ?> |
348 | 348 | <i class="simcal-icon-help simcal-help-tip" |
349 | - data-tip="<?php _e( 'The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events' ); ?>"></i> |
|
349 | + data-tip="<?php _e('The calendar default opening date. It will automatically adapt based on the chosen calendar type.', 'google-calendar-events'); ?>"></i> |
|
350 | 350 | </td> |
351 | 351 | </tr> |
352 | 352 | <tr class="simcal-panel-field"> |
353 | - <th><label for="_feed_earliest_event_date"><?php _e( 'Earliest event', 'google-calendar-events' ); ?></label></th> |
|
353 | + <th><label for="_feed_earliest_event_date"><?php _e('Earliest event', 'google-calendar-events'); ?></label></th> |
|
354 | 354 | <td> |
355 | 355 | <?php |
356 | 356 | |
357 | - $earliest_event_saved = get_post_meta( $post->ID, '_feed_earliest_event_date', true ); |
|
358 | - $earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr( $earliest_event_saved ); |
|
357 | + $earliest_event_saved = get_post_meta($post->ID, '_feed_earliest_event_date', true); |
|
358 | + $earliest_event = false == $earliest_event_saved ? 'months_before' : esc_attr($earliest_event_saved); |
|
359 | 359 | |
360 | - simcal_print_field( array( |
|
360 | + simcal_print_field(array( |
|
361 | 361 | 'type' => 'standard', |
362 | 362 | 'subtype' => 'number', |
363 | 363 | 'name' => '_feed_earliest_event_date_range', |
364 | 364 | 'id' => '_feed_earliest_event_date_range', |
365 | - 'value' => strval( max( absint( get_post_meta( $post->ID, '_feed_earliest_event_date_range', true ) ), 1 ) ), |
|
365 | + 'value' => strval(max(absint(get_post_meta($post->ID, '_feed_earliest_event_date_range', true)), 1)), |
|
366 | 366 | 'attributes' => array( |
367 | 367 | 'min' => '1', |
368 | 368 | ), |
@@ -370,37 +370,37 @@ discard block |
||
370 | 370 | 'simcal-field-inline', |
371 | 371 | 'simcal-field-tiny', |
372 | 372 | ), |
373 | - 'style' => ( 'now' != $earliest_event ) && ( 'today' != $earliest_event ) ? array( 'display' => 'none' ) : '', |
|
374 | - ) ); |
|
373 | + 'style' => ('now' != $earliest_event) && ('today' != $earliest_event) ? array('display' => 'none') : '', |
|
374 | + )); |
|
375 | 375 | |
376 | 376 | ?> |
377 | 377 | <select name="_feed_earliest_event_date" |
378 | 378 | id="_feed_earliest_event_date" |
379 | 379 | class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other"> |
380 | - <option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Same as start date', 'google-calendar-events' ); ?></option> |
|
381 | - <option value="days_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'days_before', $earliest_event, true ); ?>><?php _e( 'Day(s) before start date', 'google-calendar-events' ); ?></option> |
|
382 | - <option value="weeks_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'weeks_before', $earliest_event, true ); ?>><?php _e( 'Week(s) before start date', 'google-calendar-events' ); ?></option> |
|
383 | - <option value="months_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'months_before', $earliest_event, true ); ?>><?php _e( 'Month(s) before start date', 'google-calendar-events' ); ?></option> |
|
384 | - <option value="years_before" data-show-field="_feed_earliest_event_date_range" <?php selected( 'years_before', $earliest_event, true ); ?>><?php _e( 'Year(s) before start date', 'google-calendar-events' ); ?></option> |
|
380 | + <option value="calendar_start" data-hide-field="_feed_earliest_event_date_range" <?php selected('calendar_start', $earliest_event, true); ?>><?php _e('Same as start date', 'google-calendar-events'); ?></option> |
|
381 | + <option value="days_before" data-show-field="_feed_earliest_event_date_range" <?php selected('days_before', $earliest_event, true); ?>><?php _e('Day(s) before start date', 'google-calendar-events'); ?></option> |
|
382 | + <option value="weeks_before" data-show-field="_feed_earliest_event_date_range" <?php selected('weeks_before', $earliest_event, true); ?>><?php _e('Week(s) before start date', 'google-calendar-events'); ?></option> |
|
383 | + <option value="months_before" data-show-field="_feed_earliest_event_date_range" <?php selected('months_before', $earliest_event, true); ?>><?php _e('Month(s) before start date', 'google-calendar-events'); ?></option> |
|
384 | + <option value="years_before" data-show-field="_feed_earliest_event_date_range" <?php selected('years_before', $earliest_event, true); ?>><?php _e('Year(s) before start date', 'google-calendar-events'); ?></option> |
|
385 | 385 | </select> |
386 | 386 | <i class="simcal-icon-help simcal-help-tip" |
387 | - data-tip="<?php _e( 'Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events' ); ?>"></i> |
|
387 | + data-tip="<?php _e('Set the date for the earliest possible event to show in calendar. There will not be events before this date.', 'google-calendar-events'); ?>"></i> |
|
388 | 388 | </td> |
389 | 389 | </tr> |
390 | 390 | <tr class="simcal-panel-field"> |
391 | - <th><label for="_feed_latest_event_date"><?php _e( 'Latest event', 'google-calendar-events' ); ?></label></th> |
|
391 | + <th><label for="_feed_latest_event_date"><?php _e('Latest event', 'google-calendar-events'); ?></label></th> |
|
392 | 392 | <td> |
393 | 393 | <?php |
394 | 394 | |
395 | - $latest_event_saved = get_post_meta( $post->ID, '_feed_latest_event_date', true ); |
|
396 | - $latest_event = false == $latest_event_saved ? 'years_after' : esc_attr( $latest_event_saved ); |
|
395 | + $latest_event_saved = get_post_meta($post->ID, '_feed_latest_event_date', true); |
|
396 | + $latest_event = false == $latest_event_saved ? 'years_after' : esc_attr($latest_event_saved); |
|
397 | 397 | |
398 | - simcal_print_field( array( |
|
398 | + simcal_print_field(array( |
|
399 | 399 | 'type' => 'standard', |
400 | 400 | 'subtype' => 'number', |
401 | 401 | 'name' => '_feed_latest_event_date_range', |
402 | 402 | 'id' => '_feed_latest_event_date_range', |
403 | - 'value' => strval( max( absint( get_post_meta( $post->ID, '_feed_latest_event_date_range', true ) ), 1 ) ), |
|
403 | + 'value' => strval(max(absint(get_post_meta($post->ID, '_feed_latest_event_date_range', true)), 1)), |
|
404 | 404 | 'attributes' => array( |
405 | 405 | 'min' => '1', |
406 | 406 | ), |
@@ -408,21 +408,21 @@ discard block |
||
408 | 408 | 'simcal-field-inline', |
409 | 409 | 'simcal-field-tiny', |
410 | 410 | ), |
411 | - 'style' => 'indefinite' != $latest_event ? array( 'display' => 'none' ) : '', |
|
412 | - ) ); |
|
411 | + 'style' => 'indefinite' != $latest_event ? array('display' => 'none') : '', |
|
412 | + )); |
|
413 | 413 | |
414 | 414 | ?> |
415 | 415 | <select name="_feed_latest_event_date" |
416 | 416 | id="_feed_latest_event_date" |
417 | 417 | class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other"> |
418 | - <option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected( 'calendar_start', $earliest_event, true ); ?>><?php _e( 'Day end of start date', 'google-calendar-events' ); ?></option> |
|
419 | - <option value="days_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'days_after', $latest_event, true ); ?>><?php _e( 'Day(s) after start date', 'google-calendar-events' ); ?></option> |
|
420 | - <option value="weeks_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'weeks_after', $latest_event, true ); ?>><?php _e( 'Weeks(s) after start date', 'google-calendar-events' ); ?></option> |
|
421 | - <option value="months_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'months_after', $latest_event, true ); ?>><?php _e( 'Month(s) after start date', 'google-calendar-events' ); ?></option> |
|
422 | - <option value="years_after" data-show-field="_feed_latest_event_date_range" <?php selected( 'years_after', $latest_event, true ); ?>><?php _e( 'Year(s) after start date', 'google-calendar-events' ); ?></option> |
|
418 | + <option value="calendar_start" data-hide-field="_feed_latest_event_date_range" <?php selected('calendar_start', $earliest_event, true); ?>><?php _e('Day end of start date', 'google-calendar-events'); ?></option> |
|
419 | + <option value="days_after" data-show-field="_feed_latest_event_date_range" <?php selected('days_after', $latest_event, true); ?>><?php _e('Day(s) after start date', 'google-calendar-events'); ?></option> |
|
420 | + <option value="weeks_after" data-show-field="_feed_latest_event_date_range" <?php selected('weeks_after', $latest_event, true); ?>><?php _e('Weeks(s) after start date', 'google-calendar-events'); ?></option> |
|
421 | + <option value="months_after" data-show-field="_feed_latest_event_date_range" <?php selected('months_after', $latest_event, true); ?>><?php _e('Month(s) after start date', 'google-calendar-events'); ?></option> |
|
422 | + <option value="years_after" data-show-field="_feed_latest_event_date_range" <?php selected('years_after', $latest_event, true); ?>><?php _e('Year(s) after start date', 'google-calendar-events'); ?></option> |
|
423 | 423 | </select> |
424 | 424 | <i class="simcal-icon-help simcal-help-tip" |
425 | - data-tip="<?php _e( 'Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events' ); ?>"></i> |
|
425 | + data-tip="<?php _e('Set the date for the latest possible event to show on calendar. There will not be events after this date.', 'google-calendar-events'); ?>"></i> |
|
426 | 426 | </td> |
427 | 427 | </tr> |
428 | 428 | </tbody> |
@@ -439,44 +439,44 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @param \WP_Post $post |
441 | 441 | */ |
442 | - private static function calendar_settings_panel( $post ) { |
|
442 | + private static function calendar_settings_panel($post) { |
|
443 | 443 | |
444 | 444 | ?> |
445 | 445 | <table> |
446 | 446 | <thead> |
447 | - <tr><th colspan="2"><?php _e( 'Miscellaneous', 'google-calendar-events' ); ?></th></tr> |
|
447 | + <tr><th colspan="2"><?php _e('Miscellaneous', 'google-calendar-events'); ?></th></tr> |
|
448 | 448 | </thead> |
449 | 449 | <tbody class="simcal-panel-section"> |
450 | 450 | <tr class="simcal-panel-field"> |
451 | - <th><label for="_calendar_is_static"><?php _e( 'Static calendar', 'google-calendar-events' ); ?></label></th> |
|
451 | + <th><label for="_calendar_is_static"><?php _e('Static calendar', 'google-calendar-events'); ?></label></th> |
|
452 | 452 | <td> |
453 | 453 | <?php |
454 | 454 | |
455 | - $fixed = get_post_meta( $post->ID, '_calendar_is_static', true ); |
|
455 | + $fixed = get_post_meta($post->ID, '_calendar_is_static', true); |
|
456 | 456 | |
457 | - simcal_print_field( array( |
|
457 | + simcal_print_field(array( |
|
458 | 458 | 'type' => 'checkbox', |
459 | 459 | 'name' => '_calendar_is_static', |
460 | 460 | 'id' => '_calendar_is_static', |
461 | - 'tooltip' => __( "Remove the navigation arrows and fix the calendar view to it's initial state.", 'google-calendar-events' ), |
|
461 | + 'tooltip' => __("Remove the navigation arrows and fix the calendar view to it's initial state.", 'google-calendar-events'), |
|
462 | 462 | 'value' => 'yes' == $fixed ? 'yes' : 'no', |
463 | - ) ); |
|
463 | + )); |
|
464 | 464 | |
465 | 465 | ?> |
466 | 466 | </td> |
467 | 467 | </tr> |
468 | 468 | <tr class="simcal-panel-field"> |
469 | - <th><label for="_no_events_message"><?php _e( 'No events message', 'google-calendar-events' ); ?></label></th> |
|
469 | + <th><label for="_no_events_message"><?php _e('No events message', 'google-calendar-events'); ?></label></th> |
|
470 | 470 | <td> |
471 | 471 | <?php |
472 | 472 | |
473 | - simcal_print_field( array( |
|
473 | + simcal_print_field(array( |
|
474 | 474 | 'type' => 'textarea', |
475 | 475 | 'name' => '_no_events_message', |
476 | 476 | 'id' => '_no_events_message', |
477 | - 'tooltip' => __( 'Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events' ), |
|
478 | - 'value' => get_post_meta( $post->ID, '_no_events_message', true ), |
|
479 | - ) ); |
|
477 | + 'tooltip' => __('Some calendars may display a message when no events are found. You can change the default message here.', 'google-calendar-events'), |
|
478 | + 'value' => get_post_meta($post->ID, '_no_events_message', true), |
|
479 | + )); |
|
480 | 480 | |
481 | 481 | ?> |
482 | 482 | </td> |
@@ -495,23 +495,23 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @param \WP_Post $post |
497 | 497 | */ |
498 | - private static function advanced_settings_panel( $post ) { |
|
498 | + private static function advanced_settings_panel($post) { |
|
499 | 499 | |
500 | 500 | ?> |
501 | 501 | <table> |
502 | 502 | <thead> |
503 | - <tr><th colspan="2"><?php _e( 'Date and Time', 'google-calendar-events' ); ?></th></tr> |
|
503 | + <tr><th colspan="2"><?php _e('Date and Time', 'google-calendar-events'); ?></th></tr> |
|
504 | 504 | </thead> |
505 | 505 | <tbody class="simcal-panel-section simcal-panel-datetime-formatting"> |
506 | 506 | <tr class="simcal-panel-field"> |
507 | - <th><label for="_calendar_timezone_setting"><?php _e( 'Timezone', 'google-calendar-events' ); ?></label></th> |
|
507 | + <th><label for="_calendar_timezone_setting"><?php _e('Timezone', 'google-calendar-events'); ?></label></th> |
|
508 | 508 | <td> |
509 | 509 | <?php |
510 | 510 | |
511 | 511 | $timezone_wordpress = simcal_get_wp_timezone(); |
512 | 512 | $timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC'; |
513 | - $timezone_setting = esc_attr( get_post_meta( $post->ID, '_feed_timezone_setting', true ) ); |
|
514 | - $timezone = esc_attr( get_post_meta( $post->ID, '_feed_timezone', true ) ); |
|
513 | + $timezone_setting = esc_attr(get_post_meta($post->ID, '_feed_timezone_setting', true)); |
|
514 | + $timezone = esc_attr(get_post_meta($post->ID, '_feed_timezone', true)); |
|
515 | 515 | $timezone = $timezone ? $timezone : $timezone_default; |
516 | 516 | |
517 | 517 | ?> |
@@ -519,51 +519,51 @@ discard block |
||
519 | 519 | id="_feed_timezone_setting" |
520 | 520 | class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next" |
521 | 521 | data-show-next-if-value="use_custom"> |
522 | - <option value="use_calendar" <?php selected( 'use_calendar', $timezone_setting, true ); ?>><?php _ex( 'Events source default', 'Use the calendar default setting', 'google-calendar-events' ); ?></option> |
|
523 | - <option value="use_site" <?php selected( 'use_site', $timezone_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', $timezone_default ); ?></option> |
|
524 | - <option value="use_custom" <?php selected( 'use_custom', $timezone_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option> |
|
522 | + <option value="use_calendar" <?php selected('use_calendar', $timezone_setting, true); ?>><?php _ex('Events source default', 'Use the calendar default setting', 'google-calendar-events'); ?></option> |
|
523 | + <option value="use_site" <?php selected('use_site', $timezone_setting, true); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events').' (%s)', $timezone_default); ?></option> |
|
524 | + <option value="use_custom" <?php selected('use_custom', $timezone_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option> |
|
525 | 525 | </select> |
526 | 526 | <select name="_feed_timezone" |
527 | 527 | id="_feed_timezone" |
528 | 528 | class="simcal-field simcal-field-select simcal-field-inline" |
529 | 529 | <?php echo 'use_custom' != $timezone_setting ? 'style="display: none;"' : ''; ?>> |
530 | - <?php echo wp_timezone_choice( $timezone ); ?> |
|
530 | + <?php echo wp_timezone_choice($timezone); ?> |
|
531 | 531 | </select> |
532 | - <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events' ); ?>"></i> |
|
532 | + <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events'); ?>"></i> |
|
533 | 533 | </td> |
534 | 534 | </tr> |
535 | 535 | <tr class="simcal-panel-field"> |
536 | - <th><label for="_calendar_date_format_setting"><?php _e( 'Date format', 'google-calendar-events' ); ?></label></th> |
|
536 | + <th><label for="_calendar_date_format_setting"><?php _e('Date format', 'google-calendar-events'); ?></label></th> |
|
537 | 537 | <td> |
538 | 538 | <?php |
539 | 539 | |
540 | - $date_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_setting', true ) ); |
|
541 | - $date_format_default = esc_attr( get_option( 'date_format' ) ); |
|
542 | - $date_format = esc_attr( get_post_meta( $post->ID, '_calendar_date_format', true ) ); |
|
543 | - $date_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_date_format_php', true ) ); |
|
540 | + $date_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_date_format_setting', true)); |
|
541 | + $date_format_default = esc_attr(get_option('date_format')); |
|
542 | + $date_format = esc_attr(get_post_meta($post->ID, '_calendar_date_format', true)); |
|
543 | + $date_format_php = esc_attr(get_post_meta($post->ID, '_calendar_date_format_php', true)); |
|
544 | 544 | $date_format_php = $date_format_php ? $date_format_php : $date_format_default; |
545 | 545 | |
546 | 546 | ?> |
547 | 547 | <select name="_calendar_date_format_setting" |
548 | 548 | id="_calendar_date_format_setting" |
549 | 549 | class="simcal-field simcal-field-select simcal-field-show-other"> |
550 | - <option value="use_site" data-show-field="_calendar_date_format_default" <?php selected( 'use_site', $date_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option> |
|
551 | - <option value="use_custom" data-show-field="_calendar_date_format" <?php selected( 'use_custom', $date_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option> |
|
552 | - <option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected( 'use_custom_php', $date_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option> |
|
550 | + <option value="use_site" data-show-field="_calendar_date_format_default" <?php selected('use_site', $date_format_setting, true); ?>><?php _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option> |
|
551 | + <option value="use_custom" data-show-field="_calendar_date_format" <?php selected('use_custom', $date_format_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option> |
|
552 | + <option value="use_custom_php" data-show-field="_calendar_date_format_php_field" <?php selected('use_custom_php', $date_format_setting, true); ?>><?php _e('Custom (PHP format)', 'google-calendar-events'); ?></option> |
|
553 | 553 | </select> |
554 | - <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i> |
|
554 | + <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('This option sets how calendars display event dates. It is recommended to keep your site default setting.', 'google-calendar-events'); ?>"></i> |
|
555 | 555 | <p id="_calendar_date_format_default" style="<?php echo $date_format_setting != 'use_site' ? 'display: none;' : ''; ?>"> |
556 | - <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em> |
|
557 | - <code><?php echo date_i18n( $date_format_default, time() ); ?></code> |
|
556 | + <em><?php _e('Preview', 'google-calendar-events') ?>:</em> |
|
557 | + <code><?php echo date_i18n($date_format_default, time()); ?></code> |
|
558 | 558 | </p> |
559 | - <?php simcal_print_field( array( |
|
559 | + <?php simcal_print_field(array( |
|
560 | 560 | 'type' => 'datetime-format', |
561 | 561 | 'subtype' => 'date', |
562 | 562 | 'name' => '_calendar_date_format', |
563 | 563 | 'id' => '_calendar_date_format', |
564 | 564 | 'value' => $date_format, |
565 | - 'style' => $date_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '', |
|
566 | - ) ); ?> |
|
565 | + 'style' => $date_format_setting != 'use_custom' ? array('display' => 'none') : '', |
|
566 | + )); ?> |
|
567 | 567 | <div class="simcal-field-datetime-format-php" id="_calendar_date_format_php_field" style="<?php echo $date_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>"> |
568 | 568 | <br> |
569 | 569 | <label for="_calendar_date_format_php"> |
@@ -572,70 +572,70 @@ discard block |
||
572 | 572 | id="_calendar_date_format_php" |
573 | 573 | class="simcal-field simcal-field-text simcal-field-small" |
574 | 574 | value="<?php echo $date_format_php; ?>" /> |
575 | - <?php printf( __( 'Enter a date format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?> |
|
575 | + <?php printf(__('Enter a date format using %s values.', 'google-calendar-events'), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>'); ?> |
|
576 | 576 | </label> |
577 | 577 | <p> |
578 | - <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em> |
|
579 | - <code><?php echo date_i18n( $date_format_php, time() ); ?></code> |
|
578 | + <em><?php _e('Preview', 'google-calendar-events') ?>:</em> |
|
579 | + <code><?php echo date_i18n($date_format_php, time()); ?></code> |
|
580 | 580 | </p> |
581 | 581 | </div> |
582 | 582 | </td> |
583 | 583 | </tr> |
584 | 584 | <tr class="simcal-panel-field"> |
585 | - <th><label for="_calendar_datetime_separator"><?php _e( 'Separator', 'google-calendar-events' ); ?></label></th> |
|
585 | + <th><label for="_calendar_datetime_separator"><?php _e('Separator', 'google-calendar-events'); ?></label></th> |
|
586 | 586 | <td> |
587 | 587 | <?php |
588 | 588 | |
589 | - $separator = get_post_meta( $post->ID, '_calendar_datetime_separator', true ); |
|
589 | + $separator = get_post_meta($post->ID, '_calendar_datetime_separator', true); |
|
590 | 590 | $separator = false == $separator ? '@' : $separator; |
591 | 591 | |
592 | - simcal_print_field( array( |
|
592 | + simcal_print_field(array( |
|
593 | 593 | 'type' => 'standard', |
594 | 594 | 'subtype' => 'text', |
595 | 595 | 'name' => '_calendar_datetime_separator', |
596 | 596 | 'id' => '_calendar_datetime_separator', |
597 | 597 | 'value' => $separator, |
598 | - 'tooltip' => __( 'Used to divide date and time when both are shown.', 'google-calendar-events' ), |
|
598 | + 'tooltip' => __('Used to divide date and time when both are shown.', 'google-calendar-events'), |
|
599 | 599 | 'class' => array( |
600 | 600 | 'simcal-field-tiny', |
601 | 601 | ), |
602 | - ) ); |
|
602 | + )); |
|
603 | 603 | |
604 | 604 | ?> |
605 | 605 | </td> |
606 | 606 | </tr> |
607 | 607 | <tr class="simcal-panel-field"> |
608 | - <th><label for="_calendar_time_format_setting"><?php _e( 'Time format', 'google-calendar-events' ); ?></label></th> |
|
608 | + <th><label for="_calendar_time_format_setting"><?php _e('Time format', 'google-calendar-events'); ?></label></th> |
|
609 | 609 | <td> |
610 | 610 | <?php |
611 | 611 | |
612 | - $time_format_setting = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_setting', true ) ); |
|
613 | - $time_format_default = esc_attr( get_option( 'time_format' ) ); |
|
614 | - $time_format = esc_attr( get_post_meta( $post->ID, '_calendar_time_format', true ) ); |
|
615 | - $time_format_php = esc_attr( get_post_meta( $post->ID, '_calendar_time_format_php', true ) ); |
|
612 | + $time_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_time_format_setting', true)); |
|
613 | + $time_format_default = esc_attr(get_option('time_format')); |
|
614 | + $time_format = esc_attr(get_post_meta($post->ID, '_calendar_time_format', true)); |
|
615 | + $time_format_php = esc_attr(get_post_meta($post->ID, '_calendar_time_format_php', true)); |
|
616 | 616 | $time_format_php = $time_format_php ? $time_format_php : $time_format_default; |
617 | 617 | |
618 | 618 | ?> |
619 | 619 | <select name="_calendar_time_format_setting" |
620 | 620 | id="_calendar_time_format_setting" |
621 | 621 | class="simcal-field simcal-field-select simcal-field-show-other"> |
622 | - <option value="use_site" data-show-field="_calendar_time_format_default" <?php selected( 'use_site', $time_format_setting, true ); ?>><?php _ex( 'Site default', 'Use this site default setting', 'google-calendar-events' ); ?></option> |
|
623 | - <option value="use_custom" data-show-field="_calendar_time_format" <?php selected( 'use_custom', $time_format_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option> |
|
624 | - <option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected( 'use_custom_php', $time_format_setting, true ); ?>><?php _e( 'Custom (PHP format)', 'google-calendar-events' ); ?></option> |
|
622 | + <option value="use_site" data-show-field="_calendar_time_format_default" <?php selected('use_site', $time_format_setting, true); ?>><?php _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option> |
|
623 | + <option value="use_custom" data-show-field="_calendar_time_format" <?php selected('use_custom', $time_format_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option> |
|
624 | + <option value="use_custom_php" data-show-field="_calendar_time_format_php_field" <?php selected('use_custom_php', $time_format_setting, true); ?>><?php _e('Custom (PHP format)', 'google-calendar-events'); ?></option> |
|
625 | 625 | </select> |
626 | - <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events' ); ?>"></i> |
|
626 | + <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('This option sets how calendars display event times. It is recommended to keep your site default setting.', 'google-calendar-events'); ?>"></i> |
|
627 | 627 | <p id="_calendar_time_format_default" style="<?php echo $time_format_setting != 'use_site' ? 'display: none;' : ''; ?>"> |
628 | - <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em> |
|
629 | - <code><?php echo date_i18n( $time_format_default, time() ); ?></code> |
|
628 | + <em><?php _e('Preview', 'google-calendar-events') ?>:</em> |
|
629 | + <code><?php echo date_i18n($time_format_default, time()); ?></code> |
|
630 | 630 | </p> |
631 | - <?php simcal_print_field( array( |
|
631 | + <?php simcal_print_field(array( |
|
632 | 632 | 'type' => 'datetime-format', |
633 | 633 | 'subtype' => 'time', |
634 | 634 | 'name' => '_calendar_time_format', |
635 | 635 | 'id' => '_calendar_time_format', |
636 | 636 | 'value' => $time_format, |
637 | - 'style' => $time_format_setting != 'use_custom' ? array( 'display' => 'none' ) : '', |
|
638 | - ) ); ?> |
|
637 | + 'style' => $time_format_setting != 'use_custom' ? array('display' => 'none') : '', |
|
638 | + )); ?> |
|
639 | 639 | <div class="simcal-field-datetime-format-php" id="_calendar_time_format_php_field" style="<?php echo $time_format_setting != 'use_custom_php' ? 'display: none;' : ''; ?>"> |
640 | 640 | <br> |
641 | 641 | <label for="_calendar_date_format_php"> |
@@ -644,24 +644,24 @@ discard block |
||
644 | 644 | id="_calendar_time_format_php" |
645 | 645 | class="simcal-field simcal-field-text simcal-field-small" |
646 | 646 | value="<?php echo $time_format_php; ?>"/> |
647 | - <?php printf( __( 'Enter a time format using %s values.', 'google-calendar-events' ), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>' ); ?> |
|
647 | + <?php printf(__('Enter a time format using %s values.', 'google-calendar-events'), '<a href="//php.net/manual/en/function.date.php" target="_blank">PHP</a>'); ?> |
|
648 | 648 | </label> |
649 | 649 | <p> |
650 | - <em><?php _e( 'Preview', 'google-calendar-events' ) ?>:</em> |
|
651 | - <code><?php echo date_i18n( $time_format_php, time() ); ?></code> |
|
650 | + <em><?php _e('Preview', 'google-calendar-events') ?>:</em> |
|
651 | + <code><?php echo date_i18n($time_format_php, time()); ?></code> |
|
652 | 652 | </p> |
653 | 653 | </div> |
654 | 654 | </td> |
655 | 655 | </tr> |
656 | 656 | <tr class="simcal-panel-field"> |
657 | - <th><label for="_calendar_week_starts_on_setting"><?php _e( 'Week starts on', 'google-calendar-events' ); ?></label></th> |
|
657 | + <th><label for="_calendar_week_starts_on_setting"><?php _e('Week starts on', 'google-calendar-events'); ?></label></th> |
|
658 | 658 | <td> |
659 | 659 | <?php |
660 | 660 | |
661 | - $week_starts_setting = esc_attr( get_post_meta( $post->ID, '_calendar_week_starts_on_setting', true ) ); |
|
662 | - $week_starts_default = esc_attr( get_option( 'start_of_week' ) ); |
|
663 | - $week_starts = intval( get_post_meta( $post->ID, '_calendar_week_starts_on', true ) ); |
|
664 | - $week_starts = is_numeric( $week_starts ) ? strval( $week_starts ) : $week_starts_default; |
|
661 | + $week_starts_setting = esc_attr(get_post_meta($post->ID, '_calendar_week_starts_on_setting', true)); |
|
662 | + $week_starts_default = esc_attr(get_option('start_of_week')); |
|
663 | + $week_starts = intval(get_post_meta($post->ID, '_calendar_week_starts_on', true)); |
|
664 | + $week_starts = is_numeric($week_starts) ? strval($week_starts) : $week_starts_default; |
|
665 | 665 | |
666 | 666 | ?> |
667 | 667 | <select |
@@ -669,39 +669,39 @@ discard block |
||
669 | 669 | id="_calendar_week_starts_on_setting" |
670 | 670 | class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next" |
671 | 671 | data-show-next-if-value="use_custom"> |
672 | - <option value="use_site" <?php selected( 'use_site', $week_starts_setting, true ); ?>><?php printf( _x( 'Site default', 'Use this site default setting', 'google-calendar-events' ) . ' (%s)', date_i18n( 'l', strtotime( "Sunday + $week_starts_default Days" ) ) ); ?></option> |
|
673 | - <option value="use_custom" <?php selected( 'use_custom', $week_starts_setting, true ); ?>><?php _ex( 'Custom', 'Use a custom setting', 'google-calendar-events' ); ?></option> |
|
672 | + <option value="use_site" <?php selected('use_site', $week_starts_setting, true); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events').' (%s)', date_i18n('l', strtotime("Sunday + $week_starts_default Days"))); ?></option> |
|
673 | + <option value="use_custom" <?php selected('use_custom', $week_starts_setting, true); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option> |
|
674 | 674 | </select> |
675 | 675 | <select |
676 | 676 | name="_calendar_week_starts_on" |
677 | 677 | id="_calendar_week_starts_on" |
678 | 678 | class="simcal-field simcal-field-select simcal-field-inline" |
679 | 679 | <?php echo 'use_custom' != $week_starts_setting ? 'style="display: none;"' : ''; ?>> |
680 | - <?php $day_names = simcal_get_calendar_names_i18n( 'day', 'full' ); ?> |
|
681 | - <?php for ( $i = 0; $i <= 6; $i++ ) : ?> |
|
682 | - <option value="<?php echo $i; ?>" <?php selected( $i, $week_starts, true ); ?>><?php echo $day_names[ $i ]; ?></option> |
|
680 | + <?php $day_names = simcal_get_calendar_names_i18n('day', 'full'); ?> |
|
681 | + <?php for ($i = 0; $i <= 6; $i++) : ?> |
|
682 | + <option value="<?php echo $i; ?>" <?php selected($i, $week_starts, true); ?>><?php echo $day_names[$i]; ?></option> |
|
683 | 683 | <?php endfor; ?> |
684 | 684 | </select> |
685 | - <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events' ); ?>"></i> |
|
685 | + <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('Some calendars may use this setting to display the start of the week. It is recommended to keep the site default setting.', 'google-calendar-events'); ?>"></i> |
|
686 | 686 | </td> |
687 | 687 | </tr> |
688 | 688 | </tbody> |
689 | 689 | </table> |
690 | 690 | <table> |
691 | 691 | <thead> |
692 | - <tr><th colspan="2"><?php _e( 'Cache', 'google-calendar-events' ); ?></th></tr> |
|
692 | + <tr><th colspan="2"><?php _e('Cache', 'google-calendar-events'); ?></th></tr> |
|
693 | 693 | </thead> |
694 | 694 | <tbody class="simcal-panel-section simcal-panel-section-cache"> |
695 | 695 | <?php |
696 | 696 | |
697 | - $cache_freq = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_amount', true ) ); |
|
698 | - $cache_unit = esc_attr( get_post_meta( $post->ID, '_feed_cache_user_unit', true ) ); |
|
697 | + $cache_freq = esc_attr(get_post_meta($post->ID, '_feed_cache_user_amount', true)); |
|
698 | + $cache_unit = esc_attr(get_post_meta($post->ID, '_feed_cache_user_unit', true)); |
|
699 | 699 | $cache_freq = $cache_freq ? $cache_freq : '2'; |
700 | 700 | $cache_unit = $cache_unit ? $cache_unit : '3600'; |
701 | 701 | |
702 | 702 | ?> |
703 | 703 | <tr class="simcal-panel-field"> |
704 | - <th><label for="_feed_cache_user_amount"><?php _ex( 'Refresh interval', 'Cache maximum interval', 'google-calendar-events' ); ?></label></th> |
|
704 | + <th><label for="_feed_cache_user_amount"><?php _ex('Refresh interval', 'Cache maximum interval', 'google-calendar-events'); ?></label></th> |
|
705 | 705 | <td> |
706 | 706 | <input type="number" |
707 | 707 | name="_feed_cache_user_amount" |
@@ -712,12 +712,12 @@ discard block |
||
712 | 712 | <select name="_feed_cache_user_unit" |
713 | 713 | id="_feed_cache_user_unit" |
714 | 714 | class="simcal-field simcalfield-select simcal-field-inline"> |
715 | - <option value="60" <?php selected( '60', $cache_unit, true ); ?>><?php _e( 'Minute(s)', 'google-calendar-events' ); ?></option> |
|
716 | - <option value="3600" <?php selected( '3600', $cache_unit, true ); ?>><?php _e( 'Hour(s)', 'google-calendar-events' ); ?></option> |
|
717 | - <option value="86400" <?php selected( '86400', $cache_unit, true ); ?>><?php _e( 'Day(s)', 'google-calendar-events' ); ?></option> |
|
718 | - <option value="604800" <?php selected( '604800', $cache_unit, true ); ?>><?php _e( 'Week(s)', 'google-calendar-events' ); ?></option> |
|
715 | + <option value="60" <?php selected('60', $cache_unit, true); ?>><?php _e('Minute(s)', 'google-calendar-events'); ?></option> |
|
716 | + <option value="3600" <?php selected('3600', $cache_unit, true); ?>><?php _e('Hour(s)', 'google-calendar-events'); ?></option> |
|
717 | + <option value="86400" <?php selected('86400', $cache_unit, true); ?>><?php _e('Day(s)', 'google-calendar-events'); ?></option> |
|
718 | + <option value="604800" <?php selected('604800', $cache_unit, true); ?>><?php _e('Week(s)', 'google-calendar-events'); ?></option> |
|
719 | 719 | </select> |
720 | - <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e( 'If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events' ); ?>"></i> |
|
720 | + <i class="simcal-icon-help simcal-help-tip" data-tip="<?php _e('If you add, edit or remove events in your calendar very often, you can set a lower interval to refresh the events displayed. Set a higher interval for best performance.', 'google-calendar-events'); ?>"></i> |
|
721 | 721 | </td> |
722 | 722 | </tr> |
723 | 723 | </tbody> |
@@ -736,21 +736,21 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return void |
738 | 738 | */ |
739 | - public static function print_panel_fields( $array, $post_id ) { |
|
739 | + public static function print_panel_fields($array, $post_id) { |
|
740 | 740 | |
741 | - foreach ( $array as $section => $fields ) : |
|
741 | + foreach ($array as $section => $fields) : |
|
742 | 742 | |
743 | - if ( $fields && is_array( $fields ) ) : |
|
743 | + if ($fields && is_array($fields)) : |
|
744 | 744 | |
745 | 745 | ?> |
746 | - <tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr( $section ); ?>"> |
|
747 | - <?php foreach ( $fields as $key => $field ) : |
|
746 | + <tbody class="simcal-panel-section simcal-panel-section-<?php echo esc_attr($section); ?>"> |
|
747 | + <?php foreach ($fields as $key => $field) : |
|
748 | 748 | |
749 | - $value = get_post_meta( $post_id, $key, true ); |
|
750 | - $field['value'] = $value ? $value : ( isset( $field['default'] ) ? $field['default'] : '' ); |
|
751 | - $the_field = simcal_get_field( $field ); ?> |
|
749 | + $value = get_post_meta($post_id, $key, true); |
|
750 | + $field['value'] = $value ? $value : (isset($field['default']) ? $field['default'] : ''); |
|
751 | + $the_field = simcal_get_field($field); ?> |
|
752 | 752 | |
753 | - <?php if ( $the_field instanceof Field ) : ?> |
|
753 | + <?php if ($the_field instanceof Field) : ?> |
|
754 | 754 | <tr class="simcal-panel-field"> |
755 | 755 | <th><label for="<?php echo $the_field->id ?>"><?php echo $the_field->title; ?></label></th> |
756 | 756 | <td><?php $the_field->html(); ?></td> |
@@ -777,30 +777,30 @@ discard block |
||
777 | 777 | * |
778 | 778 | * @return void |
779 | 779 | */ |
780 | - public static function save( $post_id, $post ) { |
|
780 | + public static function save($post_id, $post) { |
|
781 | 781 | |
782 | 782 | /* ====================== * |
783 | 783 | * Calendar type and view * |
784 | 784 | * ====================== */ |
785 | 785 | |
786 | 786 | // Unlink existing terms for feed type and calendar type. |
787 | - wp_delete_object_term_relationships( $post_id, array( |
|
787 | + wp_delete_object_term_relationships($post_id, array( |
|
788 | 788 | 'calendar_feed', |
789 | 789 | 'calendar_type', |
790 | - ) ); |
|
790 | + )); |
|
791 | 791 | |
792 | 792 | // Set the feed type as term. |
793 | - $feed_type = isset( $_POST['_feed_type'] ) ? sanitize_title( stripslashes( $_POST['_feed_type'] ) ) : apply_filters( 'simcal_default_feed_type', 'google' ); |
|
794 | - wp_set_object_terms( $post_id, $feed_type, 'calendar_feed' ); |
|
793 | + $feed_type = isset($_POST['_feed_type']) ? sanitize_title(stripslashes($_POST['_feed_type'])) : apply_filters('simcal_default_feed_type', 'google'); |
|
794 | + wp_set_object_terms($post_id, $feed_type, 'calendar_feed'); |
|
795 | 795 | |
796 | 796 | // Set the calendar type as a term. |
797 | - $calendar_type = isset( $_POST['_calendar_type'] ) ? sanitize_title( stripslashes( $_POST['_calendar_type'] ) ) : apply_filters( 'simcal_default_calendar_type', 'default-calendar' ); |
|
798 | - wp_set_object_terms( $post_id, $calendar_type, 'calendar_type' ); |
|
797 | + $calendar_type = isset($_POST['_calendar_type']) ? sanitize_title(stripslashes($_POST['_calendar_type'])) : apply_filters('simcal_default_calendar_type', 'default-calendar'); |
|
798 | + wp_set_object_terms($post_id, $calendar_type, 'calendar_type'); |
|
799 | 799 | // Set the calendar type view as post meta. |
800 | - $calendar_view = isset( $_POST['_calendar_view'] ) ? $_POST['_calendar_view'] : ''; |
|
801 | - if ( $calendar_view && is_array( $calendar_view ) ) { |
|
802 | - $views = array_map( 'sanitize_title', $calendar_view ); |
|
803 | - update_post_meta( $post_id, '_calendar_view', $views ); |
|
800 | + $calendar_view = isset($_POST['_calendar_view']) ? $_POST['_calendar_view'] : ''; |
|
801 | + if ($calendar_view && is_array($calendar_view)) { |
|
802 | + $views = array_map('sanitize_title', $calendar_view); |
|
803 | + update_post_meta($post_id, '_calendar_view', $views); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | /* ===================== * |
@@ -808,98 +808,98 @@ discard block |
||
808 | 808 | * ===================== */ |
809 | 809 | |
810 | 810 | // Calendar opening. |
811 | - $calendar_begins = isset( $_POST['_calendar_begins'] ) ? sanitize_key( $_POST['_calendar_begins'] ) : 'this_month'; |
|
812 | - update_post_meta( $post_id, '_calendar_begins', $calendar_begins ); |
|
813 | - $calendar_begins_nth = isset( $_POST['_calendar_begins_nth'] ) ? absint( $_POST['_calendar_begins_nth'] ) : 2; |
|
814 | - update_post_meta( $post_id, '_calendar_begins_nth', $calendar_begins_nth ); |
|
815 | - $calendar_begins_custom_date = isset( $_POST['_calendar_begins_custom_date'] ) ? sanitize_title( $_POST['_calendar_begins_custom_date'] ) : ''; |
|
816 | - update_post_meta( $post_id, '_calendar_begins_custom_date', $calendar_begins_custom_date ); |
|
811 | + $calendar_begins = isset($_POST['_calendar_begins']) ? sanitize_key($_POST['_calendar_begins']) : 'this_month'; |
|
812 | + update_post_meta($post_id, '_calendar_begins', $calendar_begins); |
|
813 | + $calendar_begins_nth = isset($_POST['_calendar_begins_nth']) ? absint($_POST['_calendar_begins_nth']) : 2; |
|
814 | + update_post_meta($post_id, '_calendar_begins_nth', $calendar_begins_nth); |
|
815 | + $calendar_begins_custom_date = isset($_POST['_calendar_begins_custom_date']) ? sanitize_title($_POST['_calendar_begins_custom_date']) : ''; |
|
816 | + update_post_meta($post_id, '_calendar_begins_custom_date', $calendar_begins_custom_date); |
|
817 | 817 | |
818 | 818 | // Feed earliest events date. |
819 | - $earliest_events = isset( $_POST['_feed_earliest_event_date'] ) ? sanitize_key( $_POST['_feed_earliest_event_date'] ) : ''; |
|
820 | - update_post_meta( $post_id, '_feed_earliest_event_date', $earliest_events ); |
|
821 | - $earliest_events_range = isset( $_POST['_feed_earliest_event_date_range'] ) ? max( absint( $_POST['_feed_earliest_event_date_range'] ), 1 ) : 1; |
|
822 | - update_post_meta( $post_id, '_feed_earliest_event_date_range', $earliest_events_range ); |
|
819 | + $earliest_events = isset($_POST['_feed_earliest_event_date']) ? sanitize_key($_POST['_feed_earliest_event_date']) : ''; |
|
820 | + update_post_meta($post_id, '_feed_earliest_event_date', $earliest_events); |
|
821 | + $earliest_events_range = isset($_POST['_feed_earliest_event_date_range']) ? max(absint($_POST['_feed_earliest_event_date_range']), 1) : 1; |
|
822 | + update_post_meta($post_id, '_feed_earliest_event_date_range', $earliest_events_range); |
|
823 | 823 | |
824 | 824 | // Feed latest events date. |
825 | - $latest_events = isset( $_POST['_feed_latest_event_date'] ) ? sanitize_key( $_POST['_feed_latest_event_date'] ) : ''; |
|
826 | - update_post_meta( $post_id, '_feed_latest_event_date', $latest_events ); |
|
827 | - $latest_events_range = isset( $_POST['_feed_latest_event_date_range'] ) ? max( absint( $_POST['_feed_latest_event_date_range'] ), 1 ) : 1; |
|
828 | - update_post_meta( $post_id, '_feed_latest_event_date_range', $latest_events_range ); |
|
825 | + $latest_events = isset($_POST['_feed_latest_event_date']) ? sanitize_key($_POST['_feed_latest_event_date']) : ''; |
|
826 | + update_post_meta($post_id, '_feed_latest_event_date', $latest_events); |
|
827 | + $latest_events_range = isset($_POST['_feed_latest_event_date_range']) ? max(absint($_POST['_feed_latest_event_date_range']), 1) : 1; |
|
828 | + update_post_meta($post_id, '_feed_latest_event_date_range', $latest_events_range); |
|
829 | 829 | |
830 | 830 | /* ======================= * |
831 | 831 | * Calendar settings panel * |
832 | 832 | * ======================= */ |
833 | 833 | |
834 | 834 | // Static calendar. |
835 | - $static = isset( $_POST['_calendar_is_static'] ) ? 'yes' : 'no'; |
|
836 | - update_post_meta( $post_id, '_calendar_is_static', $static ); |
|
835 | + $static = isset($_POST['_calendar_is_static']) ? 'yes' : 'no'; |
|
836 | + update_post_meta($post_id, '_calendar_is_static', $static); |
|
837 | 837 | |
838 | 838 | // No events message. |
839 | - $message = isset( $_POST['_no_events_message'] ) ? wp_kses_post( $_POST['_no_events_message'] ) : ''; |
|
840 | - update_post_meta( $post_id, '_no_events_message', $message ); |
|
839 | + $message = isset($_POST['_no_events_message']) ? wp_kses_post($_POST['_no_events_message']) : ''; |
|
840 | + update_post_meta($post_id, '_no_events_message', $message); |
|
841 | 841 | |
842 | 842 | /* ======================= * |
843 | 843 | * Advanced settings panel * |
844 | 844 | * ======================= */ |
845 | 845 | |
846 | 846 | // Timezone. |
847 | - $feed_timezone_setting = isset( $_POST['_feed_timezone_setting'] ) ? sanitize_key( $_POST['_feed_timezone_setting'] ) : 'use_calendar'; |
|
848 | - update_post_meta( $post_id, '_feed_timezone_setting', $feed_timezone_setting ); |
|
847 | + $feed_timezone_setting = isset($_POST['_feed_timezone_setting']) ? sanitize_key($_POST['_feed_timezone_setting']) : 'use_calendar'; |
|
848 | + update_post_meta($post_id, '_feed_timezone_setting', $feed_timezone_setting); |
|
849 | 849 | $default_timezone = simcal_get_wp_timezone(); |
850 | 850 | $feed_timezone = $default_timezone ? $default_timezone : 'UTC'; |
851 | - $feed_timezone = isset( $_POST['_feed_timezone'] ) ? sanitize_text_field( $_POST['_feed_timezone'] ) : $feed_timezone; |
|
852 | - update_post_meta( $post_id, '_feed_timezone', $feed_timezone ); |
|
851 | + $feed_timezone = isset($_POST['_feed_timezone']) ? sanitize_text_field($_POST['_feed_timezone']) : $feed_timezone; |
|
852 | + update_post_meta($post_id, '_feed_timezone', $feed_timezone); |
|
853 | 853 | |
854 | 854 | // Date format. |
855 | - $date_format_setting = isset( $_POST['_calendar_date_format_setting'] ) ? sanitize_key( $_POST['_calendar_date_format_setting'] ) : 'use_site'; |
|
856 | - update_post_meta( $post_id, '_calendar_date_format_setting', $date_format_setting ); |
|
857 | - $date_format = isset( $_POST['_calendar_date_format'] ) ? sanitize_text_field( trim( $_POST['_calendar_date_format'] ) ) : get_option( 'date_format' ); |
|
858 | - update_post_meta( $post_id, '_calendar_date_format', $date_format ); |
|
859 | - $date_format_php = isset( $_POST['_calendar_date_format_php'] ) ? sanitize_text_field( trim( $_POST['_calendar_date_format_php'] ) ) : get_option( 'date_format' ); |
|
860 | - update_post_meta( $post_id, '_calendar_date_format_php', $date_format_php ); |
|
855 | + $date_format_setting = isset($_POST['_calendar_date_format_setting']) ? sanitize_key($_POST['_calendar_date_format_setting']) : 'use_site'; |
|
856 | + update_post_meta($post_id, '_calendar_date_format_setting', $date_format_setting); |
|
857 | + $date_format = isset($_POST['_calendar_date_format']) ? sanitize_text_field(trim($_POST['_calendar_date_format'])) : get_option('date_format'); |
|
858 | + update_post_meta($post_id, '_calendar_date_format', $date_format); |
|
859 | + $date_format_php = isset($_POST['_calendar_date_format_php']) ? sanitize_text_field(trim($_POST['_calendar_date_format_php'])) : get_option('date_format'); |
|
860 | + update_post_meta($post_id, '_calendar_date_format_php', $date_format_php); |
|
861 | 861 | |
862 | 862 | // Time format. |
863 | - $time_format_setting = isset( $_POST['_calendar_time_format_setting'] ) ? sanitize_key( $_POST['_calendar_time_format_setting'] ) : 'use_site'; |
|
864 | - update_post_meta( $post_id, '_calendar_time_format_setting', $time_format_setting ); |
|
865 | - $time_format = isset( $_POST['_calendar_time_format'] ) ? sanitize_text_field( trim( $_POST['_calendar_time_format'] ) ) : get_option( 'time_format' ); |
|
866 | - update_post_meta( $post_id, '_calendar_time_format', $time_format ); |
|
867 | - $time_format_php = isset( $_POST['_calendar_time_format_php'] ) ? sanitize_text_field( trim( $_POST['_calendar_time_format_php'] ) ) : get_option( 'time_format' ); |
|
868 | - update_post_meta( $post_id, '_calendar_time_format_php', $time_format_php ); |
|
863 | + $time_format_setting = isset($_POST['_calendar_time_format_setting']) ? sanitize_key($_POST['_calendar_time_format_setting']) : 'use_site'; |
|
864 | + update_post_meta($post_id, '_calendar_time_format_setting', $time_format_setting); |
|
865 | + $time_format = isset($_POST['_calendar_time_format']) ? sanitize_text_field(trim($_POST['_calendar_time_format'])) : get_option('time_format'); |
|
866 | + update_post_meta($post_id, '_calendar_time_format', $time_format); |
|
867 | + $time_format_php = isset($_POST['_calendar_time_format_php']) ? sanitize_text_field(trim($_POST['_calendar_time_format_php'])) : get_option('time_format'); |
|
868 | + update_post_meta($post_id, '_calendar_time_format_php', $time_format_php); |
|
869 | 869 | |
870 | 870 | // Date-time separator. |
871 | - $datetime_separator = isset( $_POST['_calendar_datetime_separator'] ) ? sanitize_text_field( $_POST['_calendar_datetime_separator'] ) : ' '; |
|
872 | - update_post_meta( $post_id, '_calendar_datetime_separator', $datetime_separator ); |
|
871 | + $datetime_separator = isset($_POST['_calendar_datetime_separator']) ? sanitize_text_field($_POST['_calendar_datetime_separator']) : ' '; |
|
872 | + update_post_meta($post_id, '_calendar_datetime_separator', $datetime_separator); |
|
873 | 873 | |
874 | 874 | // Week start. |
875 | - $week_start_setting = isset( $_POST['_calendar_week_starts_on_setting'] ) ? sanitize_key( $_POST['_calendar_week_starts_on_setting'] ) : 'use_site'; |
|
876 | - update_post_meta( $post_id, '_calendar_week_starts_on_setting', $week_start_setting ); |
|
877 | - $week_start = isset( $_POST['_calendar_week_starts_on'] ) ? intval( $_POST['_calendar_week_starts_on'] ) : get_option( 'start_of_week' ); |
|
878 | - update_post_meta( $post_id, '_calendar_week_starts_on', $week_start ); |
|
875 | + $week_start_setting = isset($_POST['_calendar_week_starts_on_setting']) ? sanitize_key($_POST['_calendar_week_starts_on_setting']) : 'use_site'; |
|
876 | + update_post_meta($post_id, '_calendar_week_starts_on_setting', $week_start_setting); |
|
877 | + $week_start = isset($_POST['_calendar_week_starts_on']) ? intval($_POST['_calendar_week_starts_on']) : get_option('start_of_week'); |
|
878 | + update_post_meta($post_id, '_calendar_week_starts_on', $week_start); |
|
879 | 879 | |
880 | 880 | // Cache interval. |
881 | 881 | $cache = 7200; |
882 | - if ( isset( $_POST['_feed_cache_user_amount'] ) && isset( $_POST['_feed_cache_user_unit'] ) ) { |
|
883 | - $amount = is_numeric( $_POST['_feed_cache_user_amount'] ) ? absint( $_POST['_feed_cache_user_amount'] ) : 1; |
|
884 | - $unit = is_numeric( $_POST['_feed_cache_user_unit'] ) ? absint( $_POST['_feed_cache_user_unit'] ) : 3600; |
|
885 | - update_post_meta( $post_id, '_feed_cache_user_amount', $amount ); |
|
886 | - update_post_meta( $post_id, '_feed_cache_user_unit', $unit ); |
|
882 | + if (isset($_POST['_feed_cache_user_amount']) && isset($_POST['_feed_cache_user_unit'])) { |
|
883 | + $amount = is_numeric($_POST['_feed_cache_user_amount']) ? absint($_POST['_feed_cache_user_amount']) : 1; |
|
884 | + $unit = is_numeric($_POST['_feed_cache_user_unit']) ? absint($_POST['_feed_cache_user_unit']) : 3600; |
|
885 | + update_post_meta($post_id, '_feed_cache_user_amount', $amount); |
|
886 | + update_post_meta($post_id, '_feed_cache_user_unit', $unit); |
|
887 | 887 | $cache = $amount * $unit; |
888 | 888 | } |
889 | - update_post_meta( $post_id, '_feed_cache', $cache ); |
|
889 | + update_post_meta($post_id, '_feed_cache', $cache); |
|
890 | 890 | |
891 | 891 | /* ============= * |
892 | 892 | * Miscellaneous * |
893 | 893 | * ============= */ |
894 | 894 | |
895 | 895 | // Update version. |
896 | - update_post_meta( $post_id, '_calendar_version', SIMPLE_CALENDAR_VERSION ); |
|
896 | + update_post_meta($post_id, '_calendar_version', SIMPLE_CALENDAR_VERSION); |
|
897 | 897 | |
898 | 898 | // Action hook. |
899 | - do_action( 'simcal_process_settings_meta', $post_id ); |
|
899 | + do_action('simcal_process_settings_meta', $post_id); |
|
900 | 900 | |
901 | 901 | // Clear cache. |
902 | - simcal_delete_feed_transients( $post_id ); |
|
902 | + simcal_delete_feed_transients($post_id); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | } |