|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Default Calendar - Admin |
|
4
|
|
|
* |
|
5
|
|
|
* @package SimpleCalendar/Feeds |
|
6
|
|
|
*/ |
|
7
|
|
|
namespace SimpleCalendar\Calendars\Admin; |
|
8
|
|
|
|
|
9
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
10
|
|
|
exit; |
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Google Calendar feed admin. |
|
15
|
|
|
* |
|
16
|
|
|
* @since 3.0.0 |
|
17
|
|
|
*/ |
|
18
|
|
|
class Default_Calendar_Admin { |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Hook in tabs. |
|
22
|
|
|
* |
|
23
|
|
|
* @since 3.0.0 |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct() { |
|
26
|
|
|
|
|
27
|
|
|
if ( simcal_is_admin_screen() !== false ) { |
|
|
|
|
|
|
28
|
|
|
add_action( 'simcal_settings_meta_calendar_panel', array( $this, 'add_settings_meta_calendar_panel' ), 10, 1 ); |
|
29
|
|
|
} |
|
30
|
|
|
add_action( 'simcal_process_settings_meta', array( $this, 'process_meta' ), 10, 1 ); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Feed settings page fields. |
|
35
|
|
|
* |
|
36
|
|
|
* @since 3.0.0 |
|
37
|
|
|
* |
|
38
|
|
|
* @return array |
|
39
|
|
|
*/ |
|
40
|
|
|
public function settings_fields() { |
|
41
|
|
|
/*return array( |
|
42
|
|
|
'name' => __( 'Default Calendar', 'google-calendar-events' ), |
|
43
|
|
|
'description' => '', |
|
44
|
|
|
'fields' => array( |
|
45
|
|
|
'theme' => array( |
|
46
|
|
|
'type' => 'select', |
|
47
|
|
|
'title' => __( 'Default theme', 'google-calendar-events' ), |
|
48
|
|
|
'default' => 'light', |
|
49
|
|
|
'options' => array( |
|
50
|
|
|
'light' => __( 'Light', 'google-calendar-events' ), |
|
51
|
|
|
'dark' => __( 'Dark', 'google-calendar-events' ), |
|
52
|
|
|
), |
|
53
|
|
|
), |
|
54
|
|
|
'today_color' => array( |
|
55
|
|
|
'type' => 'standard', |
|
56
|
|
|
'subtype' => 'color-picker', |
|
57
|
|
|
'title' => __( 'Today default color', 'google-calendar-events' ), |
|
58
|
|
|
'default' => '#FF0000', |
|
59
|
|
|
), |
|
60
|
|
|
'days_events_color' => array( |
|
61
|
|
|
'type' => 'standard', |
|
62
|
|
|
'subtype' => 'color-picker', |
|
63
|
|
|
'title' => __( 'Days with events color', 'google-calendar-events' ), |
|
64
|
|
|
'default' => '#000000', |
|
65
|
|
|
), |
|
66
|
|
|
), |
|
67
|
|
|
);*/ |
|
68
|
|
|
|
|
69
|
|
|
return array(); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Extend the calendar section panel of the settings meta box. |
|
74
|
|
|
* |
|
75
|
|
|
* @since 3.0.0 |
|
76
|
|
|
* |
|
77
|
|
|
* @param int $post_id |
|
78
|
|
|
*/ |
|
79
|
|
|
public function add_settings_meta_calendar_panel( $post_id ) { |
|
80
|
|
|
|
|
81
|
|
|
?> |
|
82
|
|
|
<table id="default-calendar-settings"> |
|
83
|
|
|
<thead> |
|
84
|
|
|
<tr><th colspan="2"><?php _e( 'Default calendar', 'google-calendar-events' ); ?></th></tr> |
|
85
|
|
|
</thead> |
|
86
|
|
|
<tbody class="simcal-panel-section"> |
|
87
|
|
|
|
|
88
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
|
89
|
|
|
<th></th> |
|
90
|
|
|
<td> |
|
91
|
|
|
<p class="description"> |
|
92
|
|
|
<?php _e( "Tip: If calendar styles appear to be missing and/or navigation isn't working, try going to", 'google-calendar-events' ); ?> |
|
93
|
|
|
<a href="<?php echo esc_url( add_query_arg( array ( 'page' => 'simple-calendar_settings', 'tab' => 'advanced' ), admin_url( 'admin.php' ) ) ); ?>"> |
|
|
|
|
|
|
94
|
|
|
<?php _e( 'Calendars → Settings → Advanced', 'google-calendar-events' ); ?></a> |
|
95
|
|
|
<?php _e( 'and enable', 'google-calendar-events' ); ?> <strong><?php _e( 'Always Enqueue', 'google-calendar-events' ); ?></strong>. |
|
96
|
|
|
</p> |
|
97
|
|
|
</td> |
|
98
|
|
|
</tr> |
|
99
|
|
|
|
|
100
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;"> |
|
101
|
|
|
<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event bubbles', 'google-calendar-events' ); ?></label></th> |
|
102
|
|
|
<td> |
|
103
|
|
|
<?php |
|
104
|
|
|
|
|
105
|
|
|
$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true ); |
|
106
|
|
|
|
|
107
|
|
|
simcal_print_field( array( |
|
108
|
|
|
'type' => 'radio', |
|
109
|
|
|
'inline' => 'inline', |
|
110
|
|
|
'name' => '_default_calendar_event_bubble_trigger', |
|
111
|
|
|
'id' => '_default_calendar_event_bubble_trigger', |
|
112
|
|
|
'tooltip' => __( 'Open event bubbles in calendar grid by clicking or hovering on event titles. On mobile devices it will always default to tapping.', 'google-calendar-events' ), |
|
113
|
|
|
'value' => $bubbles ? $bubbles : 'hover', |
|
114
|
|
|
'default' => 'hover', |
|
115
|
|
|
'options' => array( |
|
116
|
|
|
'click' => __( 'Click', 'google-calendar-events' ), |
|
117
|
|
|
'hover' => __( 'Hover', 'google-calendar-events' ), |
|
118
|
|
|
), |
|
119
|
|
|
) ); |
|
120
|
|
|
|
|
121
|
|
|
?> |
|
122
|
|
|
</td> |
|
123
|
|
|
</tr> |
|
124
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;"> |
|
125
|
|
|
<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim event titles', 'google-calendar-events' ); ?></label></th> |
|
126
|
|
|
<td> |
|
127
|
|
|
<?php |
|
128
|
|
|
|
|
129
|
|
|
$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true ); |
|
130
|
|
|
|
|
131
|
|
|
simcal_print_field( array( |
|
132
|
|
|
'type' => 'checkbox', |
|
133
|
|
|
'name' => '_default_calendar_trim_titles', |
|
134
|
|
|
'id' => '_default_calendar_trim_titles', |
|
135
|
|
|
'class' => array( |
|
136
|
|
|
'simcal-field-show-next', |
|
137
|
|
|
), |
|
138
|
|
|
'value' => 'yes' == $trim ? 'yes' : 'no', |
|
139
|
|
|
'attributes' => array( |
|
140
|
|
|
'data-show-next-if-value' => 'yes', |
|
141
|
|
|
), |
|
142
|
|
|
) ); |
|
143
|
|
|
|
|
144
|
|
|
simcal_print_field( array( |
|
145
|
|
|
'type' => 'standard', |
|
146
|
|
|
'subtype' => 'number', |
|
147
|
|
|
'name' => '_default_calendar_trim_titles_chars', |
|
148
|
|
|
'id' => '_default_calendar_trim_titles_chars', |
|
149
|
|
|
'tooltip' => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ), |
|
150
|
|
|
'class' => array( |
|
151
|
|
|
'simcal-field-tiny', |
|
152
|
|
|
), |
|
153
|
|
|
'value' => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20', |
|
154
|
|
|
'attributes' => array( |
|
155
|
|
|
'min' => '1', |
|
156
|
|
|
), |
|
157
|
|
|
) ); |
|
158
|
|
|
|
|
159
|
|
|
?> |
|
160
|
|
|
</td> |
|
161
|
|
|
</tr> |
|
162
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
|
163
|
|
|
<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th> |
|
164
|
|
|
<td> |
|
165
|
|
|
<?php |
|
166
|
|
|
|
|
167
|
|
|
$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 ); |
|
168
|
|
|
|
|
169
|
|
|
simcal_print_field( array( |
|
170
|
|
|
'type' => 'standard', |
|
171
|
|
|
'subtype' => 'number', |
|
172
|
|
|
'name' => '_default_calendar_list_range_span', |
|
173
|
|
|
'id' => '_default_calendar_list_range_span', |
|
174
|
|
|
'class' => array( |
|
175
|
|
|
'simcal-field-tiny', |
|
176
|
|
|
'simcal-field-inline', |
|
177
|
|
|
), |
|
178
|
|
|
'value' => strval( $list_span ), |
|
179
|
|
|
'attributes' => array( |
|
180
|
|
|
'min' => '1', |
|
181
|
|
|
), |
|
182
|
|
|
) ); |
|
183
|
|
|
|
|
184
|
|
|
$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true ); |
|
185
|
|
|
|
|
186
|
|
|
simcal_print_field( array( |
|
187
|
|
|
'type' => 'select', |
|
188
|
|
|
'name' => '_default_calendar_list_range_type', |
|
189
|
|
|
'id' => '_default_calendar_list_range_type', |
|
190
|
|
|
'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ), |
|
191
|
|
|
'class' => array( |
|
192
|
|
|
'simcal-field-inline', |
|
193
|
|
|
), |
|
194
|
|
|
'value' => $list_type, |
|
195
|
|
|
'options' => array( |
|
196
|
|
|
'monthly' => __( 'Month(s)', 'google-calendar-events' ), |
|
197
|
|
|
'weekly' => __( 'Week(s)', 'google-calendar-events' ), |
|
198
|
|
|
'daily' => __( 'Day(s)', 'google-calendar-events' ), |
|
199
|
|
|
'events' => __( 'Event(s)', 'google-calendar-events' ), |
|
200
|
|
|
), |
|
201
|
|
|
) ); |
|
202
|
|
|
|
|
203
|
|
|
?> |
|
204
|
|
|
</td> |
|
205
|
|
|
</tr> |
|
206
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
|
207
|
|
|
<th><label for="_default_calendar_list_header"><?php _e( 'Hide header', 'google-calendar-events' ); ?></label></th> |
|
208
|
|
|
<td> |
|
209
|
|
|
<?php |
|
210
|
|
|
|
|
211
|
|
|
$header = get_post_meta( $post_id, '_default_calendar_list_header', true ); |
|
212
|
|
|
|
|
213
|
|
|
simcal_print_field( array( |
|
214
|
|
|
'type' => 'checkbox', |
|
215
|
|
|
'name' => '_default_calendar_list_header', |
|
216
|
|
|
'id' => '_default_calendar_list_header', |
|
217
|
|
|
'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ), |
|
218
|
|
|
'value' => 'yes' == $header ? 'yes' : 'no', |
|
219
|
|
|
) ); |
|
220
|
|
|
|
|
221
|
|
|
?> |
|
222
|
|
|
</td> |
|
223
|
|
|
</tr> |
|
224
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
|
225
|
|
|
<th><label for="_default_calendar_compact_list"><?php _e( 'Compact list', 'google-calendar-events' ); ?></label></th> |
|
226
|
|
|
<td> |
|
227
|
|
|
<?php |
|
228
|
|
|
|
|
229
|
|
|
$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true ); |
|
230
|
|
|
|
|
231
|
|
|
simcal_print_field( array( |
|
232
|
|
|
'type' => 'checkbox', |
|
233
|
|
|
'name' => '_default_calendar_compact_list', |
|
234
|
|
|
'id' => '_default_calendar_compact_list', |
|
235
|
|
|
'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ), |
|
236
|
|
|
'value' => 'yes' == $compact ? 'yes' : 'no', |
|
237
|
|
|
) ); |
|
238
|
|
|
|
|
239
|
|
|
?> |
|
240
|
|
|
</td> |
|
241
|
|
|
</tr> |
|
242
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
|
243
|
|
|
<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit visible events', 'google-calendar-events' ); ?></label></th> |
|
244
|
|
|
<td> |
|
245
|
|
|
<?php |
|
246
|
|
|
|
|
247
|
|
|
$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true ); |
|
248
|
|
|
|
|
249
|
|
|
simcal_print_field( array( |
|
250
|
|
|
'type' => 'checkbox', |
|
251
|
|
|
'name' => '_default_calendar_limit_visible_events', |
|
252
|
|
|
'id' => '_default_calendar_limit_visible_events', |
|
253
|
|
|
'value' => 'yes' == $limit ? 'yes' : 'no', |
|
254
|
|
|
'class' => array( |
|
255
|
|
|
'simcal-field-show-next', |
|
256
|
|
|
), |
|
257
|
|
|
'attributes' => array( |
|
258
|
|
|
'data-show-next-if-value' => 'yes', |
|
259
|
|
|
) |
|
260
|
|
|
) ); |
|
261
|
|
|
|
|
262
|
|
|
$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) ); |
|
263
|
|
|
$visible_events = $visible_events > 0 ? $visible_events : 3; |
|
264
|
|
|
|
|
265
|
|
|
simcal_print_field( array( |
|
266
|
|
|
'type' => 'standard', |
|
267
|
|
|
'subtype' => 'number', |
|
268
|
|
|
'name' => '_default_calendar_visible_events', |
|
269
|
|
|
'id' => '_default_calendar_visible_events', |
|
270
|
|
|
'tooltip' => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ), |
|
271
|
|
|
'class' => array( |
|
272
|
|
|
'simcal-field-tiny', |
|
273
|
|
|
), |
|
274
|
|
|
'value' => $visible_events, |
|
275
|
|
|
'attributes' => array( |
|
276
|
|
|
'min' => '1', |
|
277
|
|
|
) |
|
278
|
|
|
) ); |
|
279
|
|
|
|
|
280
|
|
|
?> |
|
281
|
|
|
</td> |
|
282
|
|
|
</tr> |
|
283
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
|
284
|
|
|
<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand multi-day events', 'google-calendar-events' ); ?></label></th> |
|
285
|
|
|
<td> |
|
286
|
|
|
<?php |
|
287
|
|
|
|
|
288
|
|
|
$post_meta = get_post_meta( $post_id ); |
|
289
|
|
|
|
|
290
|
|
|
if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) { |
|
291
|
|
|
$multi_day_value = 'current_day_only'; |
|
292
|
|
|
} else { |
|
293
|
|
|
$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true ); |
|
294
|
|
|
} |
|
295
|
|
|
|
|
296
|
|
|
simcal_print_field( array( |
|
297
|
|
|
'type' => 'select', |
|
298
|
|
|
'name' => '_default_calendar_expand_multi_day_events', |
|
299
|
|
|
'id' => '_default_calendar_expand_multi_day_events', |
|
300
|
|
|
'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' . |
|
301
|
|
|
'only on the first day of the event, or on all days of the event, but only up to the current day. ' . |
|
|
|
|
|
|
302
|
|
|
'Third option applies to list views only.', 'google-calendar-events' ), |
|
|
|
|
|
|
303
|
|
|
'value' => $multi_day_value, |
|
304
|
|
|
'options' => array( |
|
305
|
|
|
'yes' => __( 'Yes, display on all days of event', 'google-calendar-events' ), |
|
306
|
|
|
'no' => __( 'No, display only on first day of event', 'google-calendar-events' ), |
|
307
|
|
|
'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ), |
|
308
|
|
|
), |
|
309
|
|
|
'default' => 'current_day_only', |
|
310
|
|
|
) ); |
|
311
|
|
|
|
|
312
|
|
|
?> |
|
313
|
|
|
</td> |
|
314
|
|
|
</tr> |
|
315
|
|
|
</tbody> |
|
316
|
|
|
<?php |
|
317
|
|
|
|
|
318
|
|
|
$settings = get_option( 'simple-calendar_settings_calendars' ); |
|
319
|
|
|
$default_theme = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light'; |
|
320
|
|
|
$default_today_color = /*isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] :*/ '#1e73be'; |
|
321
|
|
|
$default_days_events_color = /*isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] :*/ '#000000'; |
|
322
|
|
|
|
|
323
|
|
|
?> |
|
324
|
|
|
<tbody class="simcal-panel-section"> |
|
325
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
|
326
|
|
|
<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th> |
|
327
|
|
|
<td> |
|
328
|
|
|
<?php |
|
329
|
|
|
|
|
330
|
|
|
$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true ); |
|
331
|
|
|
$value = ! $saved ? $default_theme : $saved; |
|
332
|
|
|
|
|
333
|
|
|
simcal_print_field( array( |
|
334
|
|
|
'type' => 'select', |
|
335
|
|
|
'name' => '_default_calendar_style_theme', |
|
336
|
|
|
'id' => '_default_calendar_style_theme', |
|
337
|
|
|
'value' => $value, |
|
338
|
|
|
'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ), |
|
339
|
|
|
'options' => array( |
|
340
|
|
|
'light' => __( 'Light', 'google-calendar-events' ), |
|
341
|
|
|
'dark' => __( 'Dark', 'google-calendar-events' ), |
|
342
|
|
|
), |
|
343
|
|
|
) ); |
|
344
|
|
|
|
|
345
|
|
|
?> |
|
346
|
|
|
</td> |
|
347
|
|
|
</tr> |
|
348
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
|
349
|
|
|
<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th> |
|
350
|
|
|
<td> |
|
351
|
|
|
<?php |
|
352
|
|
|
|
|
353
|
|
|
$saved = get_post_meta( $post_id, '_default_calendar_style_today', true ); |
|
354
|
|
|
$value = ! $saved ? $default_today_color : $saved; |
|
355
|
|
|
|
|
356
|
|
|
simcal_print_field( array( |
|
357
|
|
|
'type' => 'standard', |
|
358
|
|
|
'subtype' => 'color-picker', |
|
359
|
|
|
'name' => '_default_calendar_style_today', |
|
360
|
|
|
'id' => '_default_calendar_style_today', |
|
361
|
|
|
'value' => $value, |
|
362
|
|
|
) ); |
|
363
|
|
|
|
|
364
|
|
|
?> |
|
365
|
|
|
</td> |
|
366
|
|
|
</tr> |
|
367
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
|
368
|
|
|
<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with events', 'google-calendar-events' ); ?></label></th> |
|
369
|
|
|
<td> |
|
370
|
|
|
<?php |
|
371
|
|
|
|
|
372
|
|
|
$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true ); |
|
373
|
|
|
$value = ! $saved ? $default_days_events_color : $saved; |
|
374
|
|
|
|
|
375
|
|
|
simcal_print_field( array( |
|
376
|
|
|
'type' => 'standard', |
|
377
|
|
|
'subtype' => 'color-picker', |
|
378
|
|
|
'name' => '_default_calendar_style_days_events', |
|
379
|
|
|
'id' => '_default_calendar_style_days_events', |
|
380
|
|
|
'value' => $value, |
|
381
|
|
|
) ); |
|
382
|
|
|
|
|
383
|
|
|
?> |
|
384
|
|
|
</td> |
|
385
|
|
|
</tr> |
|
386
|
|
|
|
|
387
|
|
|
</tbody> |
|
388
|
|
|
<?php |
|
389
|
|
|
|
|
390
|
|
|
?> |
|
391
|
|
|
</table> |
|
392
|
|
|
<?php |
|
393
|
|
|
|
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
|
|
/** |
|
397
|
|
|
* Process meta fields. |
|
398
|
|
|
* |
|
399
|
|
|
* @since 3.0.0 |
|
400
|
|
|
* |
|
401
|
|
|
* @param int $post_id |
|
402
|
|
|
*/ |
|
403
|
|
|
public function process_meta( $post_id ) { |
|
404
|
|
|
|
|
405
|
|
|
// Theme. |
|
406
|
|
|
$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light'; |
|
407
|
|
|
update_post_meta( $post_id, '_default_calendar_style_theme', $theme ); |
|
408
|
|
|
|
|
409
|
|
|
// Today color. |
|
410
|
|
|
$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#FF000'; |
|
411
|
|
|
update_post_meta( $post_id, '_default_calendar_style_today', $today_color ); |
|
412
|
|
|
|
|
413
|
|
|
// Days with events color. |
|
414
|
|
|
$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000'; |
|
415
|
|
|
update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color ); |
|
416
|
|
|
|
|
417
|
|
|
// List range span. |
|
418
|
|
|
$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1; |
|
419
|
|
|
update_post_meta( $post_id, '_default_calendar_list_range_span', $span ); |
|
420
|
|
|
|
|
421
|
|
|
// List range type. |
|
422
|
|
|
$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly'; |
|
423
|
|
|
update_post_meta( $post_id, '_default_calendar_list_range_type', $group ); |
|
424
|
|
|
|
|
425
|
|
|
// Hide header. |
|
426
|
|
|
$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no'; |
|
427
|
|
|
update_post_meta( $post_id, '_default_calendar_list_header', $header ); |
|
428
|
|
|
|
|
429
|
|
|
// Compact list. |
|
430
|
|
|
$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no'; |
|
431
|
|
|
update_post_meta( $post_id, '_default_calendar_compact_list', $compact ); |
|
432
|
|
|
|
|
433
|
|
|
// Limit number of initially visible daily events. |
|
434
|
|
|
$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no'; |
|
435
|
|
|
update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit ); |
|
436
|
|
|
$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3; |
|
437
|
|
|
update_post_meta( $post_id, '_default_calendar_visible_events', $number ); |
|
438
|
|
|
|
|
439
|
|
|
// Grid event bubbles action. |
|
440
|
|
|
$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover'; |
|
441
|
|
|
update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles ); |
|
442
|
|
|
|
|
443
|
|
|
// Trim event titles characters length. |
|
444
|
|
|
$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no'; |
|
445
|
|
|
update_post_meta( $post_id, '_default_calendar_trim_titles', $trim ); |
|
446
|
|
|
$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20; |
|
447
|
|
|
update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars ); |
|
448
|
|
|
|
|
449
|
|
|
// Expand multiple day events on each day. |
|
450
|
|
|
$multi_day = isset( $_POST['_default_calendar_expand_multi_day_events'] ) && ! empty( $_POST['_default_calendar_expand_multi_day_events'] ) ? sanitize_key( $_POST['_default_calendar_expand_multi_day_events'] ) : 'current_day_only'; |
|
451
|
|
|
update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day ); |
|
452
|
|
|
|
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
} |
|
456
|
|
|
|