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" style="display: none;"> |
89
|
|
|
<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Event Bubbles', 'google-calendar-events' ); ?></label></th> |
90
|
|
|
<td> |
91
|
|
|
<?php |
92
|
|
|
|
93
|
|
|
$bubbles = get_post_meta( $post_id, '_default_calendar_event_bubble_trigger', true ); |
94
|
|
|
|
95
|
|
|
simcal_print_field( array( |
96
|
|
|
'type' => 'radio', |
97
|
|
|
'inline' => 'inline', |
98
|
|
|
'name' => '_default_calendar_event_bubble_trigger', |
99
|
|
|
'id' => '_default_calendar_event_bubble_trigger', |
100
|
|
|
'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' ), |
101
|
|
|
'value' => $bubbles ? $bubbles : 'hover', |
102
|
|
|
'default' => 'hover', |
103
|
|
|
'options' => array( |
104
|
|
|
'click' => __( 'Click', 'google-calendar-events' ), |
105
|
|
|
'hover' => __( 'Hover', 'google-calendar-events' ), |
106
|
|
|
), |
107
|
|
|
) ); |
108
|
|
|
|
109
|
|
|
?> |
110
|
|
|
</td> |
111
|
|
|
</tr> |
112
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid" style="display: none;"> |
113
|
|
|
<th><label for="_default_calendar_trim_titles"><?php _e( 'Trim Event Titles', 'google-calendar-events' ); ?></label></th> |
114
|
|
|
<td> |
115
|
|
|
<?php |
116
|
|
|
|
117
|
|
|
$trim = get_post_meta( $post_id, '_default_calendar_trim_titles', true ); |
118
|
|
|
|
119
|
|
|
simcal_print_field( array( |
120
|
|
|
'type' => 'checkbox', |
121
|
|
|
'name' => '_default_calendar_trim_titles', |
122
|
|
|
'id' => '_default_calendar_trim_titles', |
123
|
|
|
'class' => array( |
124
|
|
|
'simcal-field-show-next', |
125
|
|
|
), |
126
|
|
|
'value' => 'yes' == $trim ? 'yes' : 'no', |
127
|
|
|
'attributes' => array( |
128
|
|
|
'data-show-next-if-value' => 'yes', |
129
|
|
|
), |
130
|
|
|
) ); |
131
|
|
|
|
132
|
|
|
simcal_print_field( array( |
133
|
|
|
'type' => 'standard', |
134
|
|
|
'subtype' => 'number', |
135
|
|
|
'name' => '_default_calendar_trim_titles_chars', |
136
|
|
|
'id' => '_default_calendar_trim_titles_chars', |
137
|
|
|
'tooltip' => __( 'Shorten event titles in calendar grid to a specified length in characters.', 'google-calendar-events' ), |
138
|
|
|
'class' => array( |
139
|
|
|
'simcal-field-tiny', |
140
|
|
|
), |
141
|
|
|
'value' => 'yes' == $trim ? strval( max( absint( get_post_meta( $post_id, '_default_calendar_trim_titles_chars', true ) ), 1 ) ) : '20', |
142
|
|
|
'attributes' => array( |
143
|
|
|
'min' => '1', |
144
|
|
|
), |
145
|
|
|
) ); |
146
|
|
|
|
147
|
|
|
?> |
148
|
|
|
</td> |
149
|
|
|
</tr> |
150
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
151
|
|
|
<th><label for="_default_calendar_list_grouped_span"><?php _e( 'Span', 'google-calendar-events' ); ?></label></th> |
152
|
|
|
<td> |
153
|
|
|
<?php |
154
|
|
|
|
155
|
|
|
$list_span = max( absint( get_post_meta( $post_id, '_default_calendar_list_range_span', true ) ), 1 ); |
156
|
|
|
|
157
|
|
|
simcal_print_field( array( |
158
|
|
|
'type' => 'standard', |
159
|
|
|
'subtype' => 'number', |
160
|
|
|
'name' => '_default_calendar_list_range_span', |
161
|
|
|
'id' => '_default_calendar_list_range_span', |
162
|
|
|
'class' => array( |
163
|
|
|
'simcal-field-tiny', |
164
|
|
|
'simcal-field-inline', |
165
|
|
|
), |
166
|
|
|
'value' => strval( $list_span ), |
167
|
|
|
'attributes' => array( |
168
|
|
|
'min' => '1', |
169
|
|
|
), |
170
|
|
|
) ); |
171
|
|
|
|
172
|
|
|
$list_type = get_post_meta( $post_id, '_default_calendar_list_range_type', true ); |
173
|
|
|
|
174
|
|
|
simcal_print_field( array( |
175
|
|
|
'type' => 'select', |
176
|
|
|
'name' => '_default_calendar_list_range_type', |
177
|
|
|
'id' => '_default_calendar_list_range_type', |
178
|
|
|
'tooltip' => __( 'Range of events to show on each calendar page.', 'google-calendar-events' ), |
179
|
|
|
'class' => array( |
180
|
|
|
'simcal-field-inline', |
181
|
|
|
), |
182
|
|
|
'value' => $list_type, |
183
|
|
|
'options' => array( |
184
|
|
|
'monthly' => __( 'Month(s)', 'google-calendar-events' ), |
185
|
|
|
'weekly' => __( 'Week(s)', 'google-calendar-events' ), |
186
|
|
|
'daily' => __( 'Day(s)', 'google-calendar-events' ), |
187
|
|
|
'events' => __( 'Event(s)', 'google-calendar-events' ), |
188
|
|
|
), |
189
|
|
|
) ); |
190
|
|
|
|
191
|
|
|
?> |
192
|
|
|
</td> |
193
|
|
|
</tr> |
194
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
195
|
|
|
<th><label for="_default_calendar_list_header"><?php _e( 'Hide Header', 'google-calendar-events' ); ?></label></th> |
196
|
|
|
<td> |
197
|
|
|
<?php |
198
|
|
|
|
199
|
|
|
$header = get_post_meta( $post_id, '_default_calendar_list_header', true ); |
200
|
|
|
|
201
|
|
|
simcal_print_field( array( |
202
|
|
|
'type' => 'checkbox', |
203
|
|
|
'name' => '_default_calendar_list_header', |
204
|
|
|
'id' => '_default_calendar_list_header', |
205
|
|
|
'tooltip' => __( 'You can use this to hide the month header for this calendar.', 'google-calendar-events' ), |
206
|
|
|
'value' => 'yes' == $header ? 'yes' : 'no', |
207
|
|
|
) ); |
208
|
|
|
|
209
|
|
|
?> |
210
|
|
|
</td> |
211
|
|
|
</tr> |
212
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-list" style="display: none;"> |
213
|
|
|
<th><label for="_default_calendar_compact_list"><?php _e( 'Compact List', 'google-calendar-events' ); ?></label></th> |
214
|
|
|
<td> |
215
|
|
|
<?php |
216
|
|
|
|
217
|
|
|
$compact = get_post_meta( $post_id, '_default_calendar_compact_list', true ); |
218
|
|
|
|
219
|
|
|
simcal_print_field( array( |
220
|
|
|
'type' => 'checkbox', |
221
|
|
|
'name' => '_default_calendar_compact_list', |
222
|
|
|
'id' => '_default_calendar_compact_list', |
223
|
|
|
'tooltip' => __( 'Make an events list more compact by grouping together events from different days in a single list.', 'google-calendar-events' ), |
224
|
|
|
'value' => 'yes' == $compact ? 'yes' : 'no', |
225
|
|
|
) ); |
226
|
|
|
|
227
|
|
|
?> |
228
|
|
|
</td> |
229
|
|
|
</tr> |
230
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
231
|
|
|
<th><label for="_default_calendar_limit_visible_events"><?php _e( 'Limit Visible Events', 'google-calendar-events' ); ?></label></th> |
232
|
|
|
<td> |
233
|
|
|
<?php |
234
|
|
|
|
235
|
|
|
$limit = get_post_meta( $post_id, '_default_calendar_limit_visible_events', true ); |
236
|
|
|
|
237
|
|
|
simcal_print_field( array( |
238
|
|
|
'type' => 'checkbox', |
239
|
|
|
'name' => '_default_calendar_limit_visible_events', |
240
|
|
|
'id' => '_default_calendar_limit_visible_events', |
241
|
|
|
'value' => 'yes' == $limit ? 'yes' : 'no', |
242
|
|
|
'class' => array( |
243
|
|
|
'simcal-field-show-next', |
244
|
|
|
), |
245
|
|
|
'attributes' => array( |
246
|
|
|
'data-show-next-if-value' => 'yes', |
247
|
|
|
) |
248
|
|
|
) ); |
249
|
|
|
|
250
|
|
|
$visible_events = absint( get_post_meta( $post_id, '_default_calendar_visible_events', true ) ); |
251
|
|
|
$visible_events = $visible_events > 0 ? $visible_events : 3; |
252
|
|
|
|
253
|
|
|
simcal_print_field( array( |
254
|
|
|
'type' => 'standard', |
255
|
|
|
'subtype' => 'number', |
256
|
|
|
'name' => '_default_calendar_visible_events', |
257
|
|
|
'id' => '_default_calendar_visible_events', |
258
|
|
|
'tooltip' => __( 'Limit the number of initial visible events on each day to a set maximum.', 'google-calendar-events' ), |
259
|
|
|
'class' => array( |
260
|
|
|
'simcal-field-tiny', |
261
|
|
|
), |
262
|
|
|
'value' => $visible_events, |
263
|
|
|
'attributes' => array( |
264
|
|
|
'min' => '1', |
265
|
|
|
) |
266
|
|
|
) ); |
267
|
|
|
|
268
|
|
|
?> |
269
|
|
|
</td> |
270
|
|
|
</tr> |
271
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
272
|
|
|
<th><label for="_default_calendar_event_bubbles_action"><?php _e( 'Expand Multi-day Events', 'google-calendar-events' ); ?></label></th> |
273
|
|
|
<td> |
274
|
|
|
<?php |
275
|
|
|
|
276
|
|
|
$post_meta = get_post_meta( $post_id ); |
277
|
|
|
|
278
|
|
|
if ( ! is_array( $post_meta ) && ! empty( $post_meta ) ) { |
279
|
|
|
$multi_day_value = 'current_day_only'; |
280
|
|
|
} else { |
281
|
|
|
$multi_day_value = get_post_meta( $post_id, '_default_calendar_expand_multi_day_events', true ); |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
simcal_print_field( array( |
285
|
|
|
'type' => 'select', |
286
|
|
|
'name' => '_default_calendar_expand_multi_day_events', |
287
|
|
|
'id' => '_default_calendar_expand_multi_day_events', |
288
|
|
|
'tooltip' => __( 'For events spanning multiple days, you can display them on each day of the event, ' . |
289
|
|
|
'only on the first day of the event, or on all days of the event, but only up to the current day. ' . |
290
|
|
|
'Third option applies to list views only.', 'google-calendar-events' ), |
291
|
|
|
'value' => $multi_day_value, |
292
|
|
|
'options' => array( |
293
|
|
|
'yes' => __( 'Yes, display on all days of event', 'google-calendar-events' ), |
294
|
|
|
'no' => __( 'No, display only on first day of event', 'google-calendar-events' ), |
295
|
|
|
'current_day_only' => __( 'No, display on all days of event up to current day (list view only)', 'google-calendar-events' ), |
296
|
|
|
), |
297
|
|
|
'default' => 'yes', |
298
|
|
|
) ); |
299
|
|
|
|
300
|
|
|
?> |
301
|
|
|
</td> |
302
|
|
|
</tr> |
303
|
|
|
</tbody> |
304
|
|
|
<?php |
305
|
|
|
|
306
|
|
|
// TODO Defaults repeated here and in process_meta(). Need to consolidate at some point. |
307
|
|
|
$settings = get_option( 'simple-calendar_settings_calendars' ); |
308
|
|
|
$default_theme = isset( $settings['default-calendar']['theme'] ) ? $settings['default-calendar']['theme'] : 'light'; |
309
|
|
|
$default_today_color = isset( $settings['default-calendar']['today_color'] ) ? $settings['default-calendar']['today_color'] : '#1e73be'; |
310
|
|
|
$default_days_events_color = isset( $settings['default-calendar']['days_events_color'] ) ? $settings['default-calendar']['days_events_color'] : '#000000'; |
311
|
|
|
|
312
|
|
|
?> |
313
|
|
|
<tbody class="simcal-panel-section"> |
314
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
315
|
|
|
<th><label for="_default_calendar_style_theme"><?php _e( 'Theme', 'google-calendar-events' ); ?></label></th> |
316
|
|
|
<td> |
317
|
|
|
<?php |
318
|
|
|
|
319
|
|
|
$saved = get_post_meta( $post_id, '_default_calendar_style_theme', true ); |
320
|
|
|
$value = ! $saved ? $default_theme : $saved; |
321
|
|
|
|
322
|
|
|
simcal_print_field( array( |
323
|
|
|
'type' => 'select', |
324
|
|
|
'name' => '_default_calendar_style_theme', |
325
|
|
|
'id' => '_default_calendar_style_theme', |
326
|
|
|
'value' => $value, |
327
|
|
|
'tooltip' => __( 'Choose a calendar theme to match your site theme.', 'google-calendar-events' ), |
328
|
|
|
'options' => array( |
329
|
|
|
'light' => __( 'Light', 'google-calendar-events' ), |
330
|
|
|
'dark' => __( 'Dark', 'google-calendar-events' ), |
331
|
|
|
), |
332
|
|
|
) ); |
333
|
|
|
|
334
|
|
|
?> |
335
|
|
|
</td> |
336
|
|
|
</tr> |
337
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
338
|
|
|
<th><label for="_default_calendar_style_today"><?php _e( 'Today', 'google-calendar-events' ); ?></label></th> |
339
|
|
|
<td> |
340
|
|
|
<?php |
341
|
|
|
|
342
|
|
|
$saved = get_post_meta( $post_id, '_default_calendar_style_today', true ); |
343
|
|
|
$value = ! $saved ? $default_today_color : $saved; |
344
|
|
|
|
345
|
|
|
simcal_print_field( array( |
346
|
|
|
'type' => 'standard', |
347
|
|
|
'subtype' => 'color-picker', |
348
|
|
|
'name' => '_default_calendar_style_today', |
349
|
|
|
'id' => '_default_calendar_style_today', |
350
|
|
|
'value' => $value, |
351
|
|
|
'tooltip' => __( "This option will set the background color for today's date. It will change the day number background and the border around the current day.", 'google-calendar-events' ), |
352
|
|
|
) ); |
353
|
|
|
|
354
|
|
|
?> |
355
|
|
|
</td> |
356
|
|
|
</tr> |
357
|
|
|
<tr class="simcal-panel-field simcal-default-calendar-grid simcal-default-calendar-list" style="display: none;"> |
358
|
|
|
<th><label for="_default_calendar_style_days_events"><?php _e( 'Days with Events', 'google-calendar-events' ); ?></label></th> |
359
|
|
|
<td> |
360
|
|
|
<?php |
361
|
|
|
|
362
|
|
|
$saved = get_post_meta( $post_id, '_default_calendar_style_days_events', true ); |
363
|
|
|
$value = ! $saved ? $default_days_events_color : $saved; |
364
|
|
|
|
365
|
|
|
simcal_print_field( array( |
366
|
|
|
'type' => 'standard', |
367
|
|
|
'subtype' => 'color-picker', |
368
|
|
|
'name' => '_default_calendar_style_days_events', |
369
|
|
|
'id' => '_default_calendar_style_days_events', |
370
|
|
|
'value' => $value, |
371
|
|
|
'tooltip' => __( 'This setting will modify the day number background for any days that have events on them.', 'google-calendar-events' ), |
372
|
|
|
) ); |
373
|
|
|
|
374
|
|
|
?> |
375
|
|
|
</td> |
376
|
|
|
</tr> |
377
|
|
|
|
378
|
|
|
</tbody> |
379
|
|
|
<?php |
380
|
|
|
|
381
|
|
|
?> |
382
|
|
|
</table> |
383
|
|
|
<?php |
384
|
|
|
|
385
|
|
|
} |
386
|
|
|
|
387
|
|
|
/** |
388
|
|
|
* Process meta fields. |
389
|
|
|
* |
390
|
|
|
* @since 3.0.0 |
391
|
|
|
* |
392
|
|
|
* @param int $post_id |
393
|
|
|
*/ |
394
|
|
|
public function process_meta( $post_id ) { |
|
|
|
|
395
|
|
|
|
396
|
|
|
// Theme. |
397
|
|
|
$theme = isset( $_POST['_default_calendar_style_theme'] ) ? sanitize_key( $_POST['_default_calendar_style_theme'] ) : 'light'; |
398
|
|
|
update_post_meta( $post_id, '_default_calendar_style_theme', $theme ); |
399
|
|
|
|
400
|
|
|
// Today color. |
401
|
|
|
$today_color = isset( $_POST['_default_calendar_style_today'] ) ? sanitize_text_field( $_POST['_default_calendar_style_today'] ) : '#1e73be'; |
402
|
|
|
update_post_meta( $post_id, '_default_calendar_style_today', $today_color ); |
403
|
|
|
|
404
|
|
|
// Days with events color. |
405
|
|
|
$days_events_color = isset( $_POST['_default_calendar_style_days_events'] ) ? sanitize_text_field( $_POST['_default_calendar_style_days_events'] ) : '#000000'; |
406
|
|
|
update_post_meta( $post_id, '_default_calendar_style_days_events', $days_events_color ); |
407
|
|
|
|
408
|
|
|
// List range span. |
409
|
|
|
$span = isset( $_POST['_default_calendar_list_range_span'] ) ? max( absint( $_POST['_default_calendar_list_range_span'] ), 1 ) : 1; |
410
|
|
|
update_post_meta( $post_id, '_default_calendar_list_range_span', $span ); |
411
|
|
|
|
412
|
|
|
// List range type. |
413
|
|
|
$group = isset( $_POST['_default_calendar_list_range_type'] ) ? sanitize_key( $_POST['_default_calendar_list_range_type'] ) : 'monthly'; |
414
|
|
|
update_post_meta( $post_id, '_default_calendar_list_range_type', $group ); |
415
|
|
|
|
416
|
|
|
// Hide header. |
417
|
|
|
$header = isset( $_POST['_default_calendar_list_header'] ) ? 'yes' : 'no'; |
418
|
|
|
update_post_meta( $post_id, '_default_calendar_list_header', $header ); |
419
|
|
|
|
420
|
|
|
// Compact list. |
421
|
|
|
$compact = isset( $_POST['_default_calendar_compact_list'] ) ? 'yes' : 'no'; |
422
|
|
|
update_post_meta( $post_id, '_default_calendar_compact_list', $compact ); |
423
|
|
|
|
424
|
|
|
// Limit number of initially visible daily events. |
425
|
|
|
$limit = isset( $_POST['_default_calendar_limit_visible_events'] ) ? 'yes' : 'no'; |
426
|
|
|
update_post_meta( $post_id, '_default_calendar_limit_visible_events', $limit ); |
427
|
|
|
$number = isset( $_POST['_default_calendar_visible_events'] ) ? absint( $_POST['_default_calendar_visible_events'] ) : 3; |
428
|
|
|
update_post_meta( $post_id, '_default_calendar_visible_events', $number ); |
429
|
|
|
|
430
|
|
|
// Grid event bubbles action. |
431
|
|
|
$bubbles = isset( $_POST['_default_calendar_event_bubble_trigger'] ) ? esc_attr( $_POST['_default_calendar_event_bubble_trigger'] ) : 'hover'; |
432
|
|
|
update_post_meta( $post_id, '_default_calendar_event_bubble_trigger', $bubbles ); |
433
|
|
|
|
434
|
|
|
// Trim event titles characters length. |
435
|
|
|
$trim = isset( $_POST['_default_calendar_trim_titles'] ) ? 'yes' : 'no'; |
436
|
|
|
update_post_meta( $post_id, '_default_calendar_trim_titles', $trim ); |
437
|
|
|
$chars = isset( $_POST['_default_calendar_trim_titles_chars'] ) ? max( absint( $_POST['_default_calendar_trim_titles_chars'] ), 1 ) : 20; |
438
|
|
|
update_post_meta( $post_id, '_default_calendar_trim_titles_chars', $chars ); |
439
|
|
|
|
440
|
|
|
// Expand multiple day events on each day. |
441
|
|
|
$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'] ) : 'yes'; |
442
|
|
|
update_post_meta( $post_id, '_default_calendar_expand_multi_day_events', $multi_day ); |
443
|
|
|
|
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
} |
447
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.