Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/google-calendar-events/google-calendar-events.php
+++ b/google-calendar-events/google-calendar-events.php
@@ -5,9 +5,11 @@
* Description: Display Google Calendar events on your WordPress site in real-time synchronization. Fully customizable and 100% mobile responsive.
* Author: Simple Calendar
* Author URI: https://simplecalendar.io
- * Version: 4.3.2
+ * Version: 4.3.3
* Text Domain: google-calendar-events
* Domain Path: /i18n
+ * License: GPLv2 or later
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
* @copyright 2013-2023 Xtendify Technologies. All rights reserved.
*/
@@ -21,7 +23,7 @@
$this_plugin_path = trailingslashit(dirname(__FILE__));
$this_plugin_dir = plugin_dir_url(__FILE__);
$this_plugin_constants = [
- 'SIMPLE_CALENDAR_VERSION' => '4.3.2',
+ 'SIMPLE_CALENDAR_VERSION' => '4.3.3',
'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
'SIMPLE_CALENDAR_URL' => $this_plugin_dir,
'SIMPLE_CALENDAR_ASSETS' => $this_plugin_dir . 'assets/',
@@ -42,7 +44,7 @@
// Check plugin requirements before loading plugin.
$this_plugin_checks = new SimCal_WP_Requirements('Simple Calendar', plugin_basename(__FILE__), [
'PHP' => '7.3',
- 'WordPress' => '4.2',
+ 'WordPress' => '5.3',
'Extensions' => ['curl', 'iconv', 'json', 'mbstring'],
]);
if ($this_plugin_checks->pass() === false) {
--- a/google-calendar-events/includes/abstracts/admin-page.php
+++ b/google-calendar-events/includes/abstracts/admin-page.php
@@ -159,7 +159,9 @@
$description = isset($sections[$section['id']]['description']) ? $sections[$section['id']]['description'] : '';
$default = $description ? '<p>' . $description . '</p>' : '';
- echo apply_filters('simcal_' . $this->option_group . '_' . $this->id . '_sections_callback', $default);
+ echo wp_kses_post(
+ apply_filters('simcal_' . $this->option_group . '_' . $this->id . '_sections_callback', $default),
+ );
}
/**
--- a/google-calendar-events/includes/abstracts/calendar.php
+++ b/google-calendar-events/includes/abstracts/calendar.php
@@ -827,10 +827,10 @@
// "location" (address) should work with an address, just a name or blank.
$params = [
'action' => 'TEMPLATE',
- 'text' => rawurlencode(strip_tags((string) $event->title)),
+ 'text' => rawurlencode(wp_strip_all_tags((string) $event->title)),
'dates' => $gcal_dt_string,
- 'details' => rawurlencode(strip_tags((string) $event->description)),
- 'location' => rawurlencode(strip_tags((string) ($event->start_location['address'] ?? ''))),
+ 'details' => rawurlencode(wp_strip_all_tags((string) $event->description)),
+ 'location' => rawurlencode(wp_strip_all_tags((string) ($event->start_location['address'] ?? ''))),
'trp' => 'false',
];
@@ -908,31 +908,31 @@
);
echo '<div class="' .
- $calendar_class .
+ esc_attr($calendar_class) .
'" ' .
'data-calendar-id="' .
- $this->id .
+ esc_attr($this->id) .
'" ' .
'data-timezone="' .
- $this->timezone .
+ esc_attr($this->timezone) .
'" ' .
'data-offset="' .
- $this->offset .
+ esc_attr($this->offset) .
'" ' .
'data-week-start="' .
- $this->week_starts .
+ esc_attr($this->week_starts) .
'" ' .
'data-calendar-start="' .
- $this->start .
+ esc_attr($this->start) .
'" ' .
'data-calendar-end="' .
- $this->end .
+ esc_attr($this->end) .
'" ' .
'data-events-first="' .
- $this->earliest_event .
+ esc_attr($this->earliest_event) .
'" ' .
'data-events-last="' .
- $this->latest_event .
+ esc_attr($this->latest_event) .
'"' .
'>';
@@ -1070,14 +1070,13 @@
// New calendars created after the cutoff always show the credit when no Pro add-on has a valid license.
if ('yes' == $poweredby || simcal_is_powered_by_mandatory($this->id)) {
$align = is_rtl() ? 'left' : 'right';
- echo '<small class="simcal-powered simcal-align-' .
- $align .
- '">' .
- sprintf(
- __('Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events'),
- simcal_get_url('home'),
- ) .
- '</small>';
+ $credit = sprintf(
+ /* translators: %s: URL to the Simple Calendar website */
+ __('Powered by <a href="%s" target="_blank">Simple Calendar</a>', 'google-calendar-events'),
+ esc_url(simcal_get_url('home')),
+ );
+
+ echo '<small class="simcal-powered simcal-align-' . esc_attr($align) . '">' . wp_kses_post($credit) . '</small>';
}
}
}
--- a/google-calendar-events/includes/admin/ajax.php
+++ b/google-calendar-events/includes/admin/ajax.php
@@ -242,9 +242,10 @@
// Verify this request comes from the add-ons licenses activation settings page.
$nonce = isset($_POST['nonce']) ? esc_attr($_POST['nonce']) : '';
if (!wp_verify_nonce($nonce, 'simcal_rating_nonce')) {
+ /* translators: %s: error details */
wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
}
- update_option('simple-calendar_admin_footer_text_rated', date('Y-m-d', time()));
+ update_option('simple-calendar_admin_footer_text_rated', gmdate('Y-m-d', time()));
}
/**
@@ -272,11 +273,13 @@
// Verify this request comes from the add-ons licenses activation settings page.
$nonce = isset($_POST['nonce']) ? esc_attr($_POST['nonce']) : '';
if (!wp_verify_nonce($nonce, 'simcal_license_manager')) {
+ /* translators: %s: error details */
wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
}
// Check for user capabilities.
if (!current_user_can('edit_posts')) {
wp_send_json_error(
+ /* translators: %s: error details */
sprintf(__('An error occurred: %s', 'google-calendar-events'), 'You don't have permission to make changes.'),
);
}
@@ -320,6 +323,7 @@
if (is_wp_error($response)) {
wp_send_json_error(
sprintf(
+ /* translators: %s: error message */
__('There was an error processing your request: %s', 'google-calendar-events'),
$response->get_error_message(),
),
@@ -360,12 +364,14 @@
// Verify this request comes from the add-ons licenses activation settings page.
if (empty($nonce) || !wp_verify_nonce($nonce, 'simcal_license_manager')) {
+ /* translators: %s: error details */
wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
}
// Check for user capabilities.
if (!current_user_can('edit_posts')) {
wp_send_json_error(
+ /* translators: %s: error details */
sprintf(__('An error occurred: %s', 'google-calendar-events'), 'You don't have permission to make changes.'),
);
}
--- a/google-calendar-events/includes/admin/bulk-actions.php
+++ b/google-calendar-events/includes/admin/bulk-actions.php
@@ -97,12 +97,12 @@
<script type="text/javascript">
jQuery( document ).ready( function() {
<?php foreach ($this->actions as $action_name => $action): ?>
- jQuery( '<option>' ).val( '<?php echo $action_name; ?>' ).text( '<?php echo $action[
- 'menu_text'
-]; ?>').appendTo( 'select[name="action"]' );
- jQuery( '<option>' ).val( '<?php echo $action_name; ?>' ).text( '<?php echo $action[
- 'menu_text'
-]; ?>').appendTo( 'select[name="action2"]' );
+ jQuery( '<option>' ).val( '<?php echo esc_js($action_name); ?>' ).text( '<?php echo esc_js(
+ $action['menu_text'],
+); ?>' ).appendTo( 'select[name="action"]' );
+ jQuery( '<option>' ).val( '<?php echo esc_js($action_name); ?>' ).text( '<?php echo esc_js(
+ $action['menu_text'],
+); ?>' ).appendTo( 'select[name="action2"]' );
<?php endforeach; ?>
} );
</script>
@@ -211,23 +211,14 @@
return;
}
- $post_ids_count = is_array($post_ids) ? count($post_ids) : 1;
-
if ($pagenow == 'edit.php' && $post_type == $this->bulk_action_post_type) {
if (isset($_REQUEST['success_action'])) {
- // Print notice in admin bar.
+ // Print notice in admin bar. Message must be a translated string literal at registration.
$message = $this->actions[$_REQUEST['success_action']]['admin_notice'];
- if (is_array($message)) {
- $message = sprintf(
- _n($message['single'], $message['plural'], $post_ids_count, 'google-calendar-events'),
- $post_ids_count,
- );
- }
-
$class = 'updated notice is-dismissible above-h2';
if (!empty($message)) {
- echo "<div class="{$class}"><p>{$message}</p></div>";
+ echo '<div class="' . esc_attr($class) . '"><p>' . esc_html($message) . '</p></div>';
}
}
}
--- a/google-calendar-events/includes/admin/fields/checkbox.php
+++ b/google-calendar-events/includes/admin/fields/checkbox.php
@@ -43,23 +43,30 @@
{
if (!empty($this->options) && count((array) $this->options) > 1) {
if (!empty($this->description)) {
- echo '<p class="description">' . wp_kses_post($this->description) . ' ' . $this->tooltip . '</p>';
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo '<p class="description">' .
+ wp_kses_post($this->description) .
+ ' ' .
+ wp_kses($this->tooltip, $allowed_tooltip) .
+ '</p>';
} ?>
- <fieldset class="<?php echo $this->class; ?>" <?php echo !empty($this->style) ? 'style="' . $this->style . '"' : ''; ?>>
+ <fieldset class="<?php echo esc_attr($this->class); ?>" <?php echo !empty($this->style)
+ ? 'style="' . esc_attr($this->style) . '"'
+ : ''; ?>>
<?php if (!empty($this->title)) {
- echo '<legend class="screen-reader-text"><span>' . $this->title . '</span></legend>';
+ echo '<legend class="screen-reader-text"><span>' . esc_html($this->title) . '</span></legend>';
} ?>
<ul>
<?php foreach ($this->options as $option => $name): ?>
<li>
- <label for="<?php echo $this->id . '-' . trim(strval($option)); ?>">
- <input name="<?php echo $this->name; ?>"
- id="<?php echo $this->id . '-' . trim(strval($option)); ?>"
+ <label for="<?php echo esc_attr($this->id . '-' . trim(strval($option))); ?>">
+ <input name="<?php echo esc_attr($this->name); ?>"
+ id="<?php echo esc_attr($this->id . '-' . trim(strval($option))); ?>"
class="simcal-field simcal-field-checkbox"
type="checkbox"
- value="<?php echo trim(strval($option)); ?>"
+ value="<?php echo esc_attr(trim(strval($option))); ?>"
<?php checked($this->value, 'yes', true); ?>
- <?php echo $this->attributes; ?>
+ <?php echo wp_kses_post($this->attributes); ?>
/><?php echo esc_attr($name); ?>
</label>
</li>
@@ -69,20 +76,23 @@
<?php
} else {
?>
- <span class="simcal-field-bool" <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>>
+ <span class="simcal-field-bool" <?php echo $this->style ? 'style="' . esc_attr($this->style) . '"' : ''; ?>>
<?php if (!empty($this->title)): ?>
- <span class="screen-reader-text"><?php echo $this->title; ?></span>
+ <span class="screen-reader-text"><?php echo esc_html($this->title); ?></span>
<?php endif; ?>
- <input name="<?php echo $this->name; ?>"
+ <input name="<?php echo esc_attr($this->name); ?>"
type="checkbox"
- id="<?php echo $this->id; ?>"
- class="simcal-field simcal-field-checkbox sc-chk-box <?php echo $this->class; ?>"
+ id="<?php echo esc_attr($this->id); ?>"
+ class="simcal-field simcal-field-checkbox sc-chk-box <?php echo esc_attr($this->class); ?>"
value="yes"
<?php checked($this->value, 'yes', true); ?>
- <?php echo $this->attributes; ?>/><?php echo !empty($this->text) ? $this->text : __('Yes', 'google-calendar-events'); ?>
- </span>
+ <?php echo wp_kses_post($this->attributes); ?>/><?php echo !empty($this->text)
+ ? esc_html($this->text)
+ : esc_html__('Yes', 'google-calendar-events'); ?>
+ </span>
<?php
- echo $this->tooltip;
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo wp_kses($this->tooltip, $allowed_tooltip);
if (!empty($this->description)) {
echo '<p class="description">' . wp_kses_post($this->description) . '</p>';
}
--- a/google-calendar-events/includes/admin/fields/date-picker.php
+++ b/google-calendar-events/includes/admin/fields/date-picker.php
@@ -71,19 +71,20 @@
if (!empty($this->description)) {
echo '<p class="description">' . wp_kses_post($this->description) . '</p>';
} ?>
- <div id="<?php echo $this->id; ?>"
- class="<?php echo $this->class; ?>"
- <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>
- <?php echo $this->attributes; ?>>
+ <div id="<?php echo esc_attr($this->id); ?>"
+ class="<?php echo esc_attr($this->class); ?>"
+ <?php echo $this->style ? 'style="' . esc_attr($this->style) . '"' : ''; ?>
+ <?php echo wp_kses_post($this->attributes); ?>>
<?php if (false === $this->range) { ?>
<i class="simcal-icon-calendar"></i>
<input type="<?php echo $this->inline === true ? 'text' : 'hidden'; ?>"
- name="<?php echo $this->name; ?>"
- value="<?php echo $this->value; ?>"
+ name="<?php echo esc_attr($this->name); ?>"
+ value="<?php echo esc_attr($this->value); ?>"
placeholder="..."
readonly="readonly" />
<?php if (true === $this->inline) {
- echo $this->tooltip;
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo wp_kses($this->tooltip, $allowed_tooltip);
}} ?>
</div>
<?php
--- a/google-calendar-events/includes/admin/fields/datetime-format.php
+++ b/google-calendar-events/includes/admin/fields/datetime-format.php
@@ -46,7 +46,7 @@
{
$this->subtype = isset($field['subtype']) ? $field['subtype'] : '';
$this->type_class = 'simcal-field-datetime-format simcal-field-' . $this->subtype . '-format-field';
- $this->timestamp = mktime(13, 10, 00, 1, 1, intval(date('Y', time())) + 1);
+ $this->timestamp = mktime(13, 10, 00, 1, 1, intval(gmdate('Y', time())) + 1);
parent::__construct($field);
@@ -67,15 +67,15 @@
*/
public function html()
{
- $id = $this->id ? ' id="' . $this->id . '" ' : '';
- $class = $this->class ? ' class="' . $this->class . '" ' : '';
- $style = $this->style ? ' style="' . $this->style . '" ' : '';
- $attr = $this->attributes;
+ $id = $this->id ? ' id="' . esc_attr($this->id) . '" ' : '';
+ $class = $this->class ? ' class="' . esc_attr($this->class) . '" ' : '';
+ $style = $this->style ? ' style="' . esc_attr($this->style) . '" ' : '';
+ $attr = wp_kses_post($this->attributes);
?>
- <div <?php echo $id . $class . $style . $attr; ?>>
+ <div <?php echo wp_kses_post($id . $class . $style . $attr); ?>>
<?php
if (!empty($this->description)) {
- echo '<p class="description">' . $this->description . '</p>';
+ echo '<p class="description">' . wp_kses_post($this->description) . '</p>';
}
$matches = array_unique(str_split($this->value));
@@ -89,11 +89,11 @@
}
?>
<input type="hidden"
- name="<?php echo $this->name; ?>"
- value="<?php echo trim($this->value); ?>" />
+ name="<?php echo esc_attr($this->name); ?>"
+ value="<?php echo esc_attr(trim($this->value)); ?>" />
<span>
- <em><?php _e('Preview', 'google-calendar-events'); ?>:</em>
- <code><?php echo date_i18n($this->value, $this->timestamp); ?></code>
+ <em><?php esc_html_e('Preview', 'google-calendar-events'); ?>:</em>
+ <code><?php echo esc_html(date_i18n($this->value, $this->timestamp)); ?></code>
</span>
</div>
<?php
@@ -193,18 +193,16 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-weekday">
- <?php _e('Weekday', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-weekday">
+ <label for="<?php echo esc_attr($this->id); ?>-weekday">
+ <?php esc_html_e('Weekday', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-weekday">
<option value="" data-preview=""></option>
- <option value="D" <?php selected('D', strpbrk('D', $this->value)); ?> data-preview="<?php echo date_i18n(
- 'D',
- $this->timestamp,
- ); ?>"><?php echo date_i18n('D', $this->timestamp); ?></option>
- <option value="l" <?php selected('l', strpbrk('l', $this->value)); ?> data-preview="<?php echo date_i18n(
- 'l',
- $this->timestamp,
- ); ?>"><?php echo date_i18n('l', $this->timestamp); ?></option>
+ <option value="D" <?php selected('D', strpbrk('D', $this->value)); ?> data-preview="<?php echo esc_attr(
+ date_i18n('D', $this->timestamp),
+ ); ?>"><?php echo esc_html(date_i18n('D', $this->timestamp)); ?></option>
+ <option value="l" <?php selected('l', strpbrk('l', $this->value)); ?> data-preview="<?php echo esc_attr(
+ date_i18n('l', $this->timestamp),
+ ); ?>"><?php echo esc_html(date_i18n('l', $this->timestamp)); ?></option>
</select>
</label>
</div>
@@ -221,18 +219,16 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-day">
- <?php _e('Day', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-day">
+ <label for="<?php echo esc_attr($this->id); ?>-day">
+ <?php esc_html_e('Day', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-day">
<option value="" data-preview=""></option>
- <option value="j" <?php selected('j', strpbrk('j', $this->value)); ?> data-preview="<?php echo date(
- 'j',
- $this->timestamp,
- ); ?>"><?php echo date('j', $this->timestamp); ?></option>
- <option value="d" <?php selected('d', strpbrk('d', $this->value)); ?> data-preview="<?php echo date(
- 'd',
- $this->timestamp,
- ); ?>"><?php echo date('d', $this->timestamp); ?></option>
+ <option value="j" <?php selected('j', strpbrk('j', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('j', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('j', $this->timestamp)); ?></option>
+ <option value="d" <?php selected('d', strpbrk('d', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('d', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('d', $this->timestamp)); ?></option>
</select>
</label>
</div>
@@ -249,26 +245,22 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-month">
- <?php _e('Month', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-month">
+ <label for="<?php echo esc_attr($this->id); ?>-month">
+ <?php esc_html_e('Month', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-month">
<option value="" data-preview=""></option>
- <option value="F" <?php selected('F', strpbrk('F', $this->value)); ?> data-preview="<?php echo date_i18n(
- 'F',
- $this->timestamp,
- ); ?>"><?php echo date_i18n('F', $this->timestamp); ?></option>
- <option value="M" <?php selected('M', strpbrk('M', $this->value)); ?> data-preview="<?php echo date_i18n(
- 'M',
- $this->timestamp,
- ); ?>"><?php echo date_i18n('M', $this->timestamp); ?></option>
- <option value="m" <?php selected('m', strpbrk('m', $this->value)); ?> data-preview="<?php echo date(
- 'm',
- $this->timestamp,
- ); ?>"><?php echo date('m', $this->timestamp); ?></option>
- <option value="n" <?php selected('n', strpbrk('n', $this->value)); ?> data-preview="<?php echo date(
- 'n',
- $this->timestamp,
- ); ?>"><?php echo date('n', $this->timestamp); ?></option>
+ <option value="F" <?php selected('F', strpbrk('F', $this->value)); ?> data-preview="<?php echo esc_attr(
+ date_i18n('F', $this->timestamp),
+ ); ?>"><?php echo esc_html(date_i18n('F', $this->timestamp)); ?></option>
+ <option value="M" <?php selected('M', strpbrk('M', $this->value)); ?> data-preview="<?php echo esc_attr(
+ date_i18n('M', $this->timestamp),
+ ); ?>"><?php echo esc_html(date_i18n('M', $this->timestamp)); ?></option>
+ <option value="m" <?php selected('m', strpbrk('m', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('m', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('m', $this->timestamp)); ?></option>
+ <option value="n" <?php selected('n', strpbrk('n', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('n', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('n', $this->timestamp)); ?></option>
</select>
</label>
</div>
@@ -285,18 +277,16 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-year">
- <?php _e('Year', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-year">
+ <label for="<?php echo esc_attr($this->id); ?>-year">
+ <?php esc_html_e('Year', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-year">
<option value="" data-preview=""></option>
- <option value="Y" <?php selected('Y', strpbrk('Y', $this->value)); ?> data-preview="<?php echo date(
- 'Y',
- $this->timestamp,
- ); ?>"><?php echo date('Y', $this->timestamp); ?></option>
- <option value="y" <?php selected('y', strpbrk('y', $this->value)); ?> data-preview="<?php echo date(
- 'y',
- $this->timestamp,
- ); ?>"><?php echo date('y', $this->timestamp); ?></option>
+ <option value="Y" <?php selected('Y', strpbrk('Y', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('Y', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('Y', $this->timestamp)); ?></option>
+ <option value="y" <?php selected('y', strpbrk('y', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('y', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('y', $this->timestamp)); ?></option>
</select>
</label>
</div>
@@ -313,26 +303,22 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-hours">
- <?php _e('Hours', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-hours">
+ <label for="<?php echo esc_attr($this->id); ?>-hours">
+ <?php esc_html_e('Hours', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-hours">
<option value="" data-preview=""></option>
- <option value="g" <?php selected('g', strpbrk('g', $this->value)); ?> data-preview="<?php echo date(
- 'g',
- $this->timestamp,
- ); ?>"><?php echo date('g', $this->timestamp) . ' (12h)'; ?></option>
- <option value="G" <?php selected('G', strpbrk('G', $this->value)); ?> data-preview="<?php echo date(
- 'G',
- $this->timestamp - 43200,
- ); ?>"><?php echo date('G', $this->timestamp - 43200) . ' (24h)'; ?></option>
- <option value="h" <?php selected('h', strpbrk('h', $this->value)); ?> data-preview="<?php echo date(
- 'h',
- $this->timestamp,
- ); ?>"><?php echo date('h', $this->timestamp) . ' (12h)'; ?></option>
- <option value="H" <?php selected('H', strpbrk('H', $this->value)); ?> data-preview="<?php echo date(
- 'H',
- $this->timestamp - 43200,
- ); ?>"><?php echo date('H', $this->timestamp - 43200) . ' (24h)'; ?></option>
+ <option value="g" <?php selected('g', strpbrk('g', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('g', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('g', $this->timestamp) . ' (12h)'); ?></option>
+ <option value="G" <?php selected('G', strpbrk('G', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('G', $this->timestamp - 43200),
+ ); ?>"><?php echo esc_html(gmdate('G', $this->timestamp - 43200) . ' (24h)'); ?></option>
+ <option value="h" <?php selected('h', strpbrk('h', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('h', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('h', $this->timestamp) . ' (12h)'); ?></option>
+ <option value="H" <?php selected('H', strpbrk('H', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('H', $this->timestamp - 43200),
+ ); ?>"><?php echo esc_html(gmdate('H', $this->timestamp - 43200) . ' (24h)'); ?></option>
</select>
</label>
</div>
@@ -349,14 +335,13 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-minutes">
- <?php _e('Minutes', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-minutes">
+ <label for="<?php echo esc_attr($this->id); ?>-minutes">
+ <?php esc_html_e('Minutes', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-minutes">
<option value="" data-preview=""></option>
- <option value="i" <?php selected('i', strpbrk('i', $this->value)); ?> data-preview="<?php echo date(
- 'i',
- $this->timestamp,
- ); ?>"><?php echo date('i', $this->timestamp); ?></option>
+ <option value="i" <?php selected('i', strpbrk('i', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('i', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('i', $this->timestamp)); ?></option>
</select>
</label>
</div>
@@ -373,18 +358,16 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-meridiem">
- <?php _e('Meridiem', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-meridiem">
+ <label for="<?php echo esc_attr($this->id); ?>-meridiem">
+ <?php esc_html_e('Meridiem', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-meridiem">
<option value="" data-preview=""></option>
- <option value="a" <?php selected('a', strpbrk('a', $this->value)); ?> data-preview="<?php echo date(
- 'a',
- $this->timestamp,
- ); ?>"><?php echo date('a', $this->timestamp); ?></option>
- <option value="A" <?php selected('A', strpbrk('A', $this->value)); ?> data-preview="<?php echo date(
- 'A',
- $this->timestamp,
- ); ?>"><?php echo date('A', $this->timestamp); ?></option>
+ <option value="a" <?php selected('a', strpbrk('a', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('a', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('a', $this->timestamp)); ?></option>
+ <option value="A" <?php selected('A', strpbrk('A', $this->value)); ?> data-preview="<?php echo esc_attr(
+ gmdate('A', $this->timestamp),
+ ); ?>"><?php echo esc_html(gmdate('A', $this->timestamp)); ?></option>
</select>
</label>
</div>
@@ -401,9 +384,9 @@
{
?>
<div>
- <label for="<?php echo $this->id; ?>-divider">
- <?php _ex('Divider', 'A character to separate two elements', 'google-calendar-events'); ?>
- <select name="" id="<?php echo $this->id; ?>-divider">
+ <label for="<?php echo esc_attr($this->id); ?>-divider">
+ <?php echo esc_html_x('Divider', 'A character to separate two elements', 'google-calendar-events'); ?>
+ <select name="" id="<?php echo esc_attr($this->id); ?>-divider">
<option value="" data-preview=""></option>
<option value="." <?php selected('.', strpbrk('.', $this->value)); ?> data-preview="." data-trim="true">.</option>
<option value=", " <?php selected(',', strpbrk(',', $this->value)); ?> data-preview=", " data-trim="true">,</option>
--- a/google-calendar-events/includes/admin/fields/license.php
+++ b/google-calendar-events/includes/admin/fields/license.php
@@ -101,18 +101,18 @@
<h3 class="sc_h5 sc_addon_item_title"><?php echo esc_html($this->title); ?></h3>
</div>
<?php if (!empty($this->card_description)) { ?>
- <p class="sc_text--body_b3 sc_addon_item_desc"><?php echo $this->card_description; ?></p>
+ <p class="sc_text--body_b3 sc_addon_item_desc"><?php echo wp_kses_post($this->card_description); ?></p>
<?php } ?>
<?php } ?>
- <div class="simcal-addon-manage-license-field" data-addon="<?php echo $this->addon; ?>">
+ <div class="simcal-addon-manage-license-field" data-addon="<?php echo esc_attr($this->addon); ?>">
<input
type="text"
- <?php echo $disabled; ?>
- name="<?php echo $this->name; ?>"
- id="<?php echo $this->id; ?>"
- value="<?php echo $this->value; ?>"
- class="<?php echo trim('sc_input sc_input_muted sc_input_full ' . $this->class); ?>"
+ <?php echo wp_kses_post($disabled); ?>
+ name="<?php echo esc_attr($this->name); ?>"
+ id="<?php echo esc_attr($this->id); ?>"
+ value="<?php echo esc_attr($this->value); ?>"
+ class="<?php echo esc_attr(trim('sc_input sc_input_muted sc_input_full ' . $this->class)); ?>"
/>
<div class="simcal-addon-manage-license-buttons">
@@ -120,7 +120,7 @@
class="sc_btn sc_btn--blue-loading simcal-addon-manage-license deactivate<?php echo $show_deactivate
? ''
: ' is_hidden'; ?>"
- data-add-on="<?php echo $this->addon; ?>"
+ data-add-on="<?php echo esc_attr($this->addon); ?>"
>
<span class="sc_btn_submit"><?php esc_html_e('Deactivate', 'google-calendar-events'); ?></span>
<span class="sc_btn_loading" aria-hidden="true">
@@ -135,7 +135,7 @@
class="sc_btn sc_btn--blue-loading simcal-addon-manage-license activate<?php echo $show_activate
? ''
: ' is_hidden'; ?>"
- data-add-on="<?php echo $this->addon; ?>"
+ data-add-on="<?php echo esc_attr($this->addon); ?>"
>
<span class="sc_btn_submit"><?php esc_html_e('Activate', 'google-calendar-events'); ?></span>
<span class="sc_btn_loading" aria-hidden="true">
@@ -148,7 +148,7 @@
<span class="error sc-error-notice is_hidden"></span>
<strong class="label sc_license_active_label<?php echo $show_active_label ? '' : ' is_hidden'; ?>">
- <?php _e('(active)', 'google-calendar-events'); ?>
+ <?php esc_html_e('(active)', 'google-calendar-events'); ?>
</strong>
</div>
</div>
--- a/google-calendar-events/includes/admin/fields/radio.php
+++ b/google-calendar-events/includes/admin/fields/radio.php
@@ -52,28 +52,28 @@
public function html()
{
?>
- <fieldset id="<?php echo $this->id; ?>"
- class="<?php echo $this->class; ?>"
- <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>>
+ <fieldset id="<?php echo esc_attr($this->id); ?>"
+ class="<?php echo esc_attr($this->class); ?>"
+ <?php echo $this->style ? 'style="' . esc_attr($this->style) . '"' : ''; ?>>
<?php
echo $this->description ? '<p class="description">' . wp_kses_post($this->description) . '</p>' : '';
if (!empty($this->title)): ?>
<legend class="screen-reader-text">
- <span><?php echo $this->title; ?></span>
+ <span><?php echo esc_html($this->title); ?></span>
</legend>
<?php endif;
?>
<ul <?php echo $this->inline === true ? 'class="simcal-field-radios-inline"' : ''; ?>>
<?php foreach ($this->options as $option => $name): ?>
<li>
- <label for="<?php echo $this->id . '-' . trim(strval($option)); ?>">
- <input name="<?php echo $this->name; ?>"
- id="<?php echo $this->id . '-' . trim(strval($option)); ?>"
+ <label for="<?php echo esc_attr($this->id . '-' . trim(strval($option))); ?>">
+ <input name="<?php echo esc_attr($this->name); ?>"
+ id="<?php echo esc_attr($this->id . '-' . trim(strval($option))); ?>"
class="simcal-field simcal-field-radio"
type="radio"
- value="<?php echo trim(strval($option)); ?>"
- <?php echo $this->attributes; ?>
+ value="<?php echo esc_attr(trim(strval($option))); ?>"
+ <?php echo wp_kses_post($this->attributes); ?>
<?php checked($option, $this->value, true); ?>
/>
<?php echo esc_attr($name); ?>
@@ -82,7 +82,9 @@
<?php endforeach; ?>
</ul>
- <?php echo $this->tooltip; ?>
+ <?php
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo wp_kses($this->tooltip, $allowed_tooltip);?>
</fieldset>
<?php
--- a/google-calendar-events/includes/admin/fields/select.php
+++ b/google-calendar-events/includes/admin/fields/select.php
@@ -97,15 +97,15 @@
}
?>
<select name="<?php
- echo $this->name;
+ echo esc_attr($this->name);
if ($this->multiselect === true) {
echo '[]';
}
?>"
- id="<?php echo $this->id; ?>"
- style="<?php echo $this->style; ?>"
- class="<?php echo $this->class; ?>"
- <?php echo $this->attributes; ?>
+ id="<?php echo esc_attr($this->id); ?>"
+ style="<?php echo esc_attr($this->style); ?>"
+ class="<?php echo esc_attr($this->class); ?>"
+ <?php echo wp_kses_post($this->attributes); ?>
<?php echo $this->multiselect === true ? ' multiple="multiple"' : ''; ?>>
<?php
if ($this->allow_void === true) {
@@ -118,12 +118,15 @@
} else {
$selected = selected($this->value, trim(strval($option)), false);
}
- echo '<option value="' . $option . '" ' . $selected . '>' . esc_attr($name) . '</option>';
+ echo '<option value="' . esc_attr($option) . '" ';
+ echo wp_kses_post($selected);
+ echo '>' . esc_attr($name) . '</option>';
}
?>
</select>
<?php
- echo $this->tooltip;
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo wp_kses($this->tooltip, $allowed_tooltip);
if (!empty($this->description)) {
echo '<p class="description">' . wp_kses_post($this->description) . '</p>';
--- a/google-calendar-events/includes/admin/fields/standard.php
+++ b/google-calendar-events/includes/admin/fields/standard.php
@@ -51,24 +51,25 @@
public function html()
{
?>
- <input type="<?php echo $this->subtype; ?>"
- name="<?php echo $this->name; ?>"
- id="<?php echo $this->id; ?>"
- value="<?php echo $this->value; ?>"
- class="<?php echo $this->class; ?>"<?php
-echo $this->style ? 'style="' . $this->style . '" ' : ' ';
-echo $this->placeholder ? 'placeholder="' . $this->placeholder . '"' : ' ';
-echo $this->attributes;
+ <input type="<?php echo esc_attr($this->subtype); ?>"
+ name="<?php echo esc_attr($this->name); ?>"
+ id="<?php echo esc_attr($this->id); ?>"
+ value="<?php echo esc_attr($this->value); ?>"
+ class="<?php echo esc_attr($this->class); ?>"<?php
+echo $this->style ? 'style="' . esc_attr($this->style) . '" ' : ' ';
+echo $this->placeholder ? 'placeholder="' . esc_attr($this->placeholder) . '"' : ' ';
+echo wp_kses_post($this->attributes);
?>/>
<?php
- echo $this->tooltip;
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo wp_kses($this->tooltip, $allowed_tooltip);
if (!empty($this->description)) {
echo '<p class="description">' . wp_kses_post($this->description) . '</p>';
}
if (is_string($this->validation) && !empty($this->validation)) {
- echo $this->validation;
+ echo wp_kses_post($this->validation);
}
}
}
--- a/google-calendar-events/includes/admin/fields/textarea.php
+++ b/google-calendar-events/includes/admin/fields/textarea.php
@@ -49,16 +49,17 @@
{
?>
<textarea
- name="<?php echo $this->name; ?>"
- id="<?php echo $this->id; ?>"
+ name="<?php echo esc_attr($this->name); ?>"
+ id="<?php echo esc_attr($this->id); ?>"
<?php
- echo $this->class ? 'class="' . $this->class . '" ' : '';
- echo $this->placeholder ? 'placeholder="' . $this->placeholder . '" ' : '';
- echo $this->style ? 'style="' . $this->style . '" ' : '';
- echo $this->attributes;
- ?>><?php echo $this->value; ?></textarea>
+ echo $this->class ? 'class="' . esc_attr($this->class) . '" ' : '';
+ echo $this->placeholder ? 'placeholder="' . esc_attr($this->placeholder) . '" ' : '';
+ echo $this->style ? 'style="' . esc_attr($this->style) . '" ' : '';
+ echo wp_kses_post($this->attributes);
+ ?>><?php echo esc_textarea($this->value); ?></textarea>
<?php
- echo $this->tooltip;
+ $allowed_tooltip = ['i' => ['class' => [], 'data-tip' => []]];
+ echo wp_kses($this->tooltip, $allowed_tooltip);
if (!empty($this->description)) {
echo '<p class="description">' . wp_kses_post($this->description) . '</p>';
--- a/google-calendar-events/includes/admin/metaboxes/settings.php
+++ b/google-calendar-events/includes/admin/metaboxes/settings.php
@@ -156,12 +156,18 @@
$feed_type = sanitize_title($default);
}
?>
- <label for="_feed_type"><span><?php _e('Event Source', 'google-calendar-events'); ?></span>
+ <label for="_feed_type"><span><?php esc_html_e('Event Source', 'google-calendar-events'); ?></span>
<select name="_feed_type" id="_feed_type">
<optgroup
- label="<?php _ex('Get events from', 'From which calendar source to load events from', 'google-calendar-events'); ?>">
+ label="<?php echo esc_attr_x(
+ 'Get events from',
+ 'From which calendar source to load events from',
+ 'google-calendar-events',
+ ); ?>">
<?php foreach ($feed_options as $feed => $name) { ?>
- <option value="<?php echo $feed; ?>" <?php selected($feed, $feed_type, true); ?>><?php echo $name; ?></option>
+ <option value="<?php echo esc_attr($feed); ?>" <?php selected($feed, $feed_type, true); ?>><?php echo esc_html(
+ $name,
+); ?></option>
<?php } ?>
</optgroup>
</select>
@@ -179,15 +185,15 @@
$calendar_type = sanitize_title($default);
}
?>
- <label for="_calendar_type"><span><?php _e('Calendar Type', 'google-calendar-events'); ?></span>
+ <label for="_calendar_type"><span><?php esc_html_e('Calendar Type', 'google-calendar-events'); ?></span>
<select name="_calendar_type" id="_calendar_type">
- <optgroup label="<?php _e('Calendar to use', 'google-calendar-events'); ?>">
+ <optgroup label="<?php esc_html_e('Calendar to use', 'google-calendar-events'); ?>">
<?php foreach ($calendar_options as $calendar => $name) { ?>
- <option value="<?php echo $calendar; ?>" <?php selected(
+ <option value="<?php echo esc_attr($calendar); ?>" <?php selected(
$calendar,
$calendar_type,
true,
-); ?>><?php echo $name; ?></option>
+); ?>><?php echo esc_html($name); ?></option>
<?php } ?>
</optgroup>
</select>
@@ -197,13 +203,15 @@
foreach ($calendar_views as $calendar => $views) {
$calendar_type_view = isset($calendar_view[$calendar]) ? $calendar_view[$calendar] : ''; ?>
- <label for="_calendar_view_<?php echo $calendar; ?>">
- <span><?php _e('View', 'google-calendar-events'); ?></span>
- <select name="_calendar_view[<?php echo $calendar; ?>]"
- id="_calendar_view_<?php echo $calendar; ?>">
- <optgroup label="<?php _e('View to display', 'google-calendar-events'); ?>">
+ <label for="_calendar_view_<?php echo esc_attr($calendar); ?>">
+ <span><?php esc_html_e('View', 'google-calendar-events'); ?></span>
+ <select name="_calendar_view[<?php echo esc_attr($calendar); ?>]"
+ id="_calendar_view_<?php echo esc_attr($calendar); ?>">
+ <optgroup label="<?php esc_html_e('View to display', 'google-calendar-events'); ?>">
<?php foreach ($views as $view => $name) { ?>
- <option value="<?php echo $view; ?>" <?php selected($view, $calendar_type_view, true); ?>><?php echo $name; ?></option>
+ <option value="<?php echo esc_attr($view); ?>" <?php selected($view, $calendar_type_view, true); ?>><?php echo esc_html(
+ $name,
+); ?></option>
<?php } ?>
</optgroup>
</select>
@@ -258,11 +266,19 @@
$icon = $tab['icon'] ? $tab['icon'] : 'simcal-icon-panel';
$class = $tab['class'] ? $tab['class'] : [];
- echo '<li class="' . $key . '-settings ' . $key . '-tab ' . implode(' ', $class) . '" data-tab="' . $key . '">';
+ echo '<li class="' .
+ esc_attr($key) .
+ '-settings ' .
+ esc_attr($key) .
+ '-tab ' .
+ esc_attr(implode(' ', $class)) .
+ '" data-tab="' .
+ esc_attr($key) .
+ '">';
echo '<a href="#' .
- $tab['target'] .
+ esc_attr($tab['target']) .
'"><i class="' .
- $icon .
+ esc_attr($icon) .
'" ></i> <span>' .
esc_html($tab['label']) .
'</span></a>';
@@ -285,13 +301,13 @@
<table>
<thead>
<tr>
- <th colspan="2"><?php _e('Event Settings', 'google-calendar-events'); ?></th>
+ <th colspan="2"><?php esc_html_e('Event Settings', 'google-calendar-events'); ?></th>
</tr>
</thead>
<tbody class="simcal-panel-section simcal-panel-section-events-range">
<tr class="simcal-panel-field">
<th>
- <label for="_calendar_begins"><?php _e('Calendar Start', 'google-calendar-events'); ?></label>
+ <label for="_calendar_begins"><?php esc_html_e('Calendar Start', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -324,92 +340,104 @@
<select name="_calendar_begins"
id="_calendar_begins"
class="simcal-field simcal-field-select simcal-field-inline simcal-field-switch-other">
- <optgroup label="<?php _e('Days', 'google-calendar-events'); ?>">
+ <optgroup label="<?php esc_html_e('Days', 'google-calendar-events'); ?>">
<option value="today"
data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
- <?php selected('today', $calendar_begins, true); ?>><?php _e('Today', 'google-calendar-events'); ?></option>
+ <?php selected('today', $calendar_begins, true); ?>><?php esc_html_e('Today', 'google-calendar-events'); ?></option>
<option value="now"
data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
- <?php selected('now', $calendar_begins, true); ?>><?php _e('Now', 'google-calendar-events'); ?></option>
+ <?php selected('now', $calendar_begins, true); ?>><?php esc_html_e('Now', 'google-calendar-events'); ?></option>
<option value="days_before"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'days_before',
$calendar_begins,
true,
- ); ?>><?php _e('Day(s) before today', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Day(s) before today', 'google-calendar-events'); ?></option>
<option value="days_after"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'days_after',
$calendar_begins,
true,
- ); ?>><?php _e('Day(s) after today', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Day(s) after today', 'google-calendar-events'); ?></option>
</optgroup>
- <optgroup label="<?php _e('Weeks', 'google-calendar-events'); ?>">
+ <optgroup label="<?php esc_html_e('Weeks', 'google-calendar-events'); ?>">
<option value="this_week"
data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
- <?php selected('this_week', $calendar_begins, true); ?>><?php _e('This week', 'google-calendar-events'); ?></option>
+ <?php selected(
+ 'this_week',
+ $calendar_begins,
+ true,
+ ); ?>><?php esc_html_e('This week', 'google-calendar-events'); ?></option>
<option value="weeks_before"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'weeks_before',
$calendar_begins,
true,
- ); ?>><?php _e('Week(s) before current', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Week(s) before current', 'google-calendar-events'); ?></option>
<option value="weeks_after"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'weeks_after',
$calendar_begins,
true,
- ); ?>><?php _e('Week(s) after current', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Week(s) after current', 'google-calendar-events'); ?></option>
</optgroup>
- <optgroup label="<?php _e('Months', 'google-calendar-events'); ?>">
+ <optgroup label="<?php esc_html_e('Months', 'google-calendar-events'); ?>">
<option value="this_month"
data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
- <?php selected('this_month', $calendar_begins, true); ?>><?php _e('This month', 'google-calendar-events'); ?></option>
+ <?php selected(
+ 'this_month',
+ $calendar_begins,
+ true,
+ ); ?>><?php esc_html_e('This month', 'google-calendar-events'); ?></option>
<option value="months_before"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'months_before',
$calendar_begins,
true,
- ); ?>><?php _e('Month(s) before current', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Month(s) before current', 'google-calendar-events'); ?></option>
<option value="months_after"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'months_after',
$calendar_begins,
true,
- ); ?>><?php _e('Month(s) after current', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Month(s) after current', 'google-calendar-events'); ?></option>
</optgroup>
- <optgroup label="<?php _e('Years', 'google-calendar-events'); ?>">
+ <optgroup label="<?php esc_html_e('Years', 'google-calendar-events'); ?>">
<option value="this_year"
data-hide-fields="_calendar_begins_custom_date,_calendar_begins_nth"
- <?php selected('this_year', $calendar_begins, true); ?>><?php _e('This year', 'google-calendar-events'); ?></option>
+ <?php selected(
+ 'this_year',
+ $calendar_begins,
+ true,
+ ); ?>><?php esc_html_e('This year', 'google-calendar-events'); ?></option>
<option value="years_before"
data-show-field="_calendar_begins_nth" <?php selected(
'years_before',
$calendar_begins,
true,
- ); ?>><?php _e('Year(s) before current', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Year(s) before current', 'google-calendar-events'); ?></option>
<option value="years_after"
data-hide-field="_calendar_begins_custom_date"
data-show-field="_calendar_begins_nth" <?php selected(
'years_after',
$calendar_begins,
true,
- ); ?>><?php _e('Year(s) after current', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Year(s) after current', 'google-calendar-events'); ?></option>
</optgroup>
- <optgroup label="<?php _e('Other', 'google-calendar-events'); ?>">
+ <optgroup label="<?php esc_html_e('Other', 'google-calendar-events'); ?>">
<option value="custom_date"
data-hide-field="_calendar_begins_nth"
data-show-field="_calendar_begins_custom_date" <?php selected(
'custom_date',
$calendar_begins,
true,
- ); ?>><?php _e('Specific date', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Specific date', 'google-calendar-events'); ?></option>
</optgroup>
</select>
<?php simcal_print_field([
@@ -421,7 +449,7 @@
'style' => 'custom_date' != $calendar_begins ? ['display' => 'none'] : '',
]); ?>
<i class="simcal-icon-help simcal-help-tip"
- data-tip="<?php _e(
+ data-tip="<?php esc_attr_e(
'The calendar default opening date. It will automatically adapt based on the chosen calendar type.',
'google-calendar-events',
); ?>"></i>
@@ -429,7 +457,7 @@
</tr>
<tr class="simcal-panel-field">
<th>
- <label for="_feed_earliest_event_date"><?php _e('Earliest Event', 'google-calendar-events'); ?></label>
+ <label for="_feed_earliest_event_date"><?php esc_html_e('Earliest Event', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -457,34 +485,34 @@
'calendar_start',
$earliest_event,
true,
- ); ?>><?php _e('Same as start date', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Same as start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Day(s) before start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Week(s) before start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Month(s) before start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Year(s) before start date', 'google-calendar-events'); ?></option>
</select>
<i class="simcal-icon-help simcal-help-tip"
- data-tip="<?php _e(
+ data-tip="<?php esc_attr_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>
@@ -492,7 +520,7 @@
</tr>
<tr class="simcal-panel-field">
<th>
- <label for="_feed_latest_event_date"><?php _e('Latest Event', 'google-calendar-events'); ?></label>
+ <label for="_feed_latest_event_date"><?php esc_html_e('Latest Event', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -520,34 +548,34 @@
'calendar_start',
$earliest_event,
true,
- ); ?>><?php _e('Day end of start date', 'google-calendar-events'); ?></option>
+ ); ?>><?php esc_html_e('Day end of start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Day(s) after start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Weeks(s) after start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Month(s) after start date', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Year(s) after start date', 'google-calendar-events'); ?></option>
</select>
<i class="simcal-icon-help simcal-help-tip"
- data-tip="<?php _e(
+ data-tip="<?php esc_attr_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>
@@ -572,14 +600,14 @@
<table>
<thead>
<tr>
- <th colspan="2"><?php _e('Miscellaneous', 'google-calendar-events'); ?></th>
+ <th colspan="2"><?php esc_html_e('Miscellaneous', 'google-calendar-events'); ?></th>
</tr>
</thead>
<tbody class="simcal-panel-section">
<tr class="simcal-panel-field">
<th>
- <label for="_display_ics_export"><?php _e('Export Calendar', 'google-calendar-events'); ?></label>
+ <label for="_display_ics_export"><?php esc_html_e('Export Calendar', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -648,7 +676,7 @@
</tr>
<tr class="simcal-panel-field">
<th>
- <label for="_calendar_is_static"><?php _e('Static Calendar', 'google-calendar-events'); ?></label>
+ <label for="_calendar_is_static"><?php esc_html_e('Static Calendar', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -670,7 +698,7 @@
</tr>
<tr class="simcal-panel-field">
<th>
- <label for="_no_events_message"><?php _e('No Events Message', 'google-calendar-events'); ?></label>
+ <label for="_no_events_message"><?php esc_html_e('No Events Message', 'google-calendar-events'); ?></label>
</th>
<td>
<?php simcal_print_field([
@@ -688,7 +716,7 @@
</tr>
<tr class="simcal-panel-field">
<th>
- <label for="_event_formatting"><?php _e('Event Formatting', 'google-calendar-events'); ?></label>
+ <label for="_event_formatting"><?php esc_html_e('Event Formatting', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -718,7 +746,7 @@
if (simcal_can_manage_powered_by($post->ID)): ?>
<tr class="simcal-panel-field">
<th>
- <label for="_poweredby"><?php _e('Powered By', 'google-calendar-events'); ?></label>
+ <label for="_poweredby"><?php esc_html_e('Powered By', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -757,13 +785,13 @@
<table>
<thead>
<tr>
- <th colspan="2"><?php _e('Date and Time', 'google-calendar-events'); ?></th>
+ <th colspan="2"><?php esc_html_e('Date and Time', 'google-calendar-events'); ?></th>
</tr>
</thead>
<tbody class="simcal-panel-section simcal-panel-datetime-formatting">
<tr class="simcal-panel-field">
<th>
- <label for="_calendar_timezone_setting"><?php _e('Timezone', 'google-calendar-events'); ?></label>
+ <label for="_calendar_timezone_setting"><?php esc_html_e('Timezone', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -787,10 +815,14 @@
'use_site',
$timezone_setting,
true,
- ); ?>><?php printf(_x('Site default', 'Use this site default setting', 'google-calendar-events') . ' (%s)', $timezone_default); ?></option>
+ ); ?>><?php echo esc_html(sprintf(_x('Site default', 'Use this site default setting', 'google-calendar-events') . ' (%s)', $timezone_default)); ?></option>
<?php if ($show_use_calendar) { ?>
<option id="use_calendar" value="use_calendar"
- data-show-field="_use_calendar_warning" <?php selected('use_calendar', $timezone_setting, true); ?>><?php _ex(
+ data-show-field="_use_calendar_warning" <?php selected(
+ 'use_calendar',
+ $timezone_setting,
+ true,
+ ); ?>><?php echo esc_html_x(
'Event source default',
'Use the calendar default setting',
'google-calendar-events',
@@ -801,7 +833,7 @@
'use_custom',
$timezone_setting,
true,
- ); ?>><?php _ex('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
+ ); ?>><?php echo esc_html_x('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
</select>
<select name="_feed_timezone"
id="_feed_timezone"
@@ -810,24 +842,26 @@
<?php echo wp_timezone_choice($timezone); ?>
</select>
<i class="simcal-icon-help simcal-help-tip"
- data-tip="<?php _e(
+ data-tip="<?php esc_attr_e(
'Using a different timezone may alter the date and time display of your calendar events. We recommended using the site default timezone.',
'google-calendar-events',
); ?>"></i>
<p id="_use_calendar_warning" style="display: none;" class="simcal-field">
- <span class="attention"><?php _e('Warning', 'google-calendar-events'); ?>:</span>
- <?php _e(
- 'Setting this to <code>Event source default</code> can at times cause unexpected results. Please test thoroughly.',
- 'google-calendar-events',
+ <span class="attention"><?php esc_html_e('Warning', 'google-calendar-events'); ?>:</span>
+ <?php echo wp_kses_post(
+ __(
+ 'Setting this to <code>Event source default</code> can at times cause unexpected results. Please test thoroughly.',
+ 'google-calendar-events',
+ ),
); ?>
<a href="http://docs.simplecalendar.io/timezone-settings/"
- target="_blank"><?php _e('See details.', 'google-calendar-events'); ?></a>
+ target="_blank"><?php esc_html_e('See details.', 'google-calendar-events'); ?></a>
</p>
</td>
</tr>
<tr class="simcal-panel-field">
<th>
- <label for="_calendar_date_format_setting"><?php _e('Date Format', 'google-calendar-events'); ?></label>
+ <label for="_calendar_date_format_setting"><?php esc_html_e('Date Format', 'google-calendar-events'); ?></label>
</th>
<td>
<?php
@@ -845,29 +879,29 @@
'use_site',
$date_format_setting,
true,
- ); ?>><?php _ex('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option>
+ ); ?>><?php echo esc_html_x('Site default', 'Use this site default setting', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php echo esc_html_x('Custom', 'Use a custom setting', 'google-calendar-events'); ?></option>
<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>
+ ); ?>><?php esc_html_e('Custom (PHP format)', 'google-calendar-events'); ?></option>
</select>
<i class="simcal-icon-help simcal-help-tip"
- data-tip="<?php _e(
+ data-tip="<?php esc_attr_e(
'This option sets how calendars display event dates. It is recommended to keep your site default setting.',
'google-calendar-events',
); ?>"></i>
<p id="_calendar_date_format_default"
style="<?php echo $date_format_setting != 'use_site' ? 'display: none;' : ''; ?>">
- <em><?php _e('Preview', 'google-calendar-events'); ?>:</em>
- <code><?