Version Description
Fixed: bug in adding events New: Notices
Download this release
Release Info
Developer | webdorado |
Plugin | Calendar by WD – Responsive Event Calendar |
Version | 1.4.28 |
Comparing to | |
See all releases |
Code changes from version 1.4.27 to 1.4.28
- calendar.php +12 -2
- calendar_functions.html.php +0 -9
- notices.php +34 -0
- readme.txt +4 -1
- spider_calendar_admin_class.php +47 -0
- spider_calendar_notices_class.php +220 -0
- style_for_cal/notices.css +54 -0
calendar.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
Plugin Name: Spider Event Calendar
|
4 |
Plugin URI: https://web-dorado.com/products/wordpress-calendar.html
|
5 |
Description: Spider Event Calendar is a highly configurable product which allows you to have multiple organized events. Spider Event Calendar is an extraordinary user friendly extension.
|
6 |
-
Version: 1.4.
|
7 |
Author: https://web-dorado.com/
|
8 |
License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
*/
|
10 |
-
$wd_spider_calendar_version="1.4.
|
11 |
// LANGUAGE localization.
|
12 |
function sp_calendar_language_load() {
|
13 |
load_plugin_textdomain('sp_calendar', FALSE, basename(dirname(__FILE__)) . '/languages');
|
@@ -608,6 +608,16 @@ add_action('wp_ajax_nopriv_spiderbigcalendar_day_widget', 'big_calendar_day_widg
|
|
608 |
add_action('wp_ajax_nopriv_spidercalendarbig', 'spiderbigcalendar');
|
609 |
add_action('wp_ajax_nopriv_spiderseemore', 'seemore');
|
610 |
add_action('wp_ajax_nopriv_window', 'php_window');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
// Add style head.
|
612 |
function add_button_style_calendar() {
|
613 |
echo '<script>var wdplugin_url = "' . plugins_url('', __FILE__) . '";</script>';
|
3 |
Plugin Name: Spider Event Calendar
|
4 |
Plugin URI: https://web-dorado.com/products/wordpress-calendar.html
|
5 |
Description: Spider Event Calendar is a highly configurable product which allows you to have multiple organized events. Spider Event Calendar is an extraordinary user friendly extension.
|
6 |
+
Version: 1.4.28
|
7 |
Author: https://web-dorado.com/
|
8 |
License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
*/
|
10 |
+
$wd_spider_calendar_version="1.4.28";
|
11 |
// LANGUAGE localization.
|
12 |
function sp_calendar_language_load() {
|
13 |
load_plugin_textdomain('sp_calendar', FALSE, basename(dirname(__FILE__)) . '/languages');
|
608 |
add_action('wp_ajax_nopriv_spidercalendarbig', 'spiderbigcalendar');
|
609 |
add_action('wp_ajax_nopriv_spiderseemore', 'seemore');
|
610 |
add_action('wp_ajax_nopriv_window', 'php_window');
|
611 |
+
|
612 |
+
//notices
|
613 |
+
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
|
614 |
+
require_once( 'spider_calendar_admin_class.php' );
|
615 |
+
include_once('spider_calendar_notices_class.php');
|
616 |
+
require_once('notices.php');
|
617 |
+
add_action( 'plugins_loaded', array( 'SC_Admin', 'get_instance' ) );
|
618 |
+
}
|
619 |
+
|
620 |
+
|
621 |
// Add style head.
|
622 |
function add_button_style_calendar() {
|
623 |
echo '<script>var wdplugin_url = "' . plugins_url('', __FILE__) . '";</script>';
|
calendar_functions.html.php
CHANGED
@@ -1323,9 +1323,6 @@ function html_add_spider_event($calendar_id, $cal_name) {
|
|
1323 |
if (form.date.value.search(/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/)) {
|
1324 |
alert('Invalid Date');
|
1325 |
}
|
1326 |
-
else if(form.date_end.value == "" && form.repeat_method.value != "no_repeat"){
|
1327 |
-
alert('Invalid date end');
|
1328 |
-
}
|
1329 |
else if (form.selhour_from.value == "" && form.selminute_from.value == "" && form.selhour_to.value == "" && form.selminute_to.value == "") {
|
1330 |
submitform(pressbutton);
|
1331 |
}
|
@@ -1834,12 +1831,6 @@ function html_edit_spider_event($row, $calendar_id, $id, $cal_name) {
|
|
1834 |
}
|
1835 |
if (form.date.value.search(/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/)) {
|
1836 |
alert('Invalid Date');
|
1837 |
-
}
|
1838 |
-
else if(form.date_end.value == "" && form.repeat_method.value != "no_repeat"){
|
1839 |
-
alert('Invalid date end');
|
1840 |
-
}
|
1841 |
-
else if (form.date.value.search(/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/)) {
|
1842 |
-
alert('Invalid Date');
|
1843 |
}
|
1844 |
else if (form.selhour_from.value == "" && form.selminute_from.value == "" && form.selhour_to.value == "" && form.selminute_to.value == "") {
|
1845 |
submitform(pressbutton);
|
1323 |
if (form.date.value.search(/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/)) {
|
1324 |
alert('Invalid Date');
|
1325 |
}
|
|
|
|
|
|
|
1326 |
else if (form.selhour_from.value == "" && form.selminute_from.value == "" && form.selhour_to.value == "" && form.selminute_to.value == "") {
|
1327 |
submitform(pressbutton);
|
1328 |
}
|
1831 |
}
|
1832 |
if (form.date.value.search(/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])/)) {
|
1833 |
alert('Invalid Date');
|
|
|
|
|
|
|
|
|
|
|
|
|
1834 |
}
|
1835 |
else if (form.selhour_from.value == "" && form.selminute_from.value == "" && form.selhour_to.value == "" && form.selminute_to.value == "") {
|
1836 |
submitform(pressbutton);
|
notices.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
function sc_admin_notices( $notices ) {
|
6 |
+
$one_week_support = add_query_arg( array( 'sc_admin_notice_ignore' => 'one_week_support' ) );
|
7 |
+
$notices['one_week_support'] = array(
|
8 |
+
'title' => __( 'Hey! How\'s It Going?', 'spider-event-calendar' ),
|
9 |
+
'msg' => __( 'Thank you for using WordPress Spider Calendar! We hope that you\'ve found everything you need, but if you have any questions:', 'spider-event-calendar' ),
|
10 |
+
'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="https://web-dorado.com/wordpress-spider-calendar/installing.html">' . __( 'Check out User Guide', 'spider-event-calendar' ) . '</a></li>
|
11 |
+
<li><span class="dashicons dashicons-sos"></span><a target="_blank" href="https://web-dorado.com/forum/spider-calendar-wordpress.html">' . __( 'Get Some Help' ,'spider-event-calendar' ) . '</a></li>
|
12 |
+
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __( 'Never show again' ,'spider-event-calendar' ) . '</a></li>',
|
13 |
+
'int' => 7
|
14 |
+
);
|
15 |
+
|
16 |
+
$two_week_review_ignore = add_query_arg( array( 'sc_admin_notice_ignore' => 'two_week_review' ) );
|
17 |
+
$two_week_review_temp = add_query_arg( array( 'sc_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14 ) );
|
18 |
+
$notices['two_week_review'] = array(
|
19 |
+
'title' => __( 'Leave A Review?', 'sc_admin_notice' ),
|
20 |
+
'msg' => __( 'We hope you\'ve enjoyed using WordPress Spider Calendar! Would you consider leaving us a review on WordPress.org?', 'sc_admin_notice' ),
|
21 |
+
'link' => '<li><span class="dashicons dashicons-external"></span><a href="https://wordpress.org/support/view/plugin-reviews/spider-event-calendar" target="_blank">' . __( 'Sure! I\'d love to!', 'sc_admin_notice' ) . '</a></li>
|
22 |
+
<li> <span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __( 'I\'ve already left a review', 'sc_admin_notice' ) . '</a></li>
|
23 |
+
<li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __( 'Maybe Later' ,'sc_admin_notice' ) . '</a></li>
|
24 |
+
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $two_week_review_ignore . '">' . __( 'Never show again' ,'sc_admin_notice' ) . '</a></li>',
|
25 |
+
|
26 |
+
'int' => 14
|
27 |
+
);
|
28 |
+
|
29 |
+
|
30 |
+
return $notices;
|
31 |
+
}
|
32 |
+
|
33 |
+
add_filter( 'sc_admin_notices', 'sc_admin_notices' );
|
34 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-calendar.html
|
|
4 |
Tags: calendar, calendars, event, event calendar, event manager, events calendar,calendar widget, event registration, event management,events, Kalender, agenda, calendario, availability calendar,o nline calendar, holiday calendar, scheduling, free calendar, Calender, upcoming events, event widget , event list, calendar localization, Organizer, editorial calendar, Interactive Calendar, news calendar, meeting, appointment, event tracking, event organizer, upcoming events widget, event page, event bookings, recurring, recurring events, conference, date, dates, schedule, times, venue, AJAX, responsive, shortcode, seminar, summit, reservation
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -141,6 +141,9 @@ Vietnamese (vi)
|
|
141 |
|
142 |
|
143 |
== Changelog ==
|
|
|
|
|
|
|
144 |
|
145 |
= 1.4.27 =
|
146 |
Fixed: Translation
|
4 |
Tags: calendar, calendars, event, event calendar, event manager, events calendar,calendar widget, event registration, event management,events, Kalender, agenda, calendario, availability calendar,o nline calendar, holiday calendar, scheduling, free calendar, Calender, upcoming events, event widget , event list, calendar localization, Organizer, editorial calendar, Interactive Calendar, news calendar, meeting, appointment, event tracking, event organizer, upcoming events widget, event page, event bookings, recurring, recurring events, conference, date, dates, schedule, times, venue, AJAX, responsive, shortcode, seminar, summit, reservation
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 1.4.28
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
141 |
|
142 |
|
143 |
== Changelog ==
|
144 |
+
= 1.4.28 =
|
145 |
+
Fixed: bug in adding events
|
146 |
+
New: Notices
|
147 |
|
148 |
= 1.4.27 =
|
149 |
Fixed: Translation
|
spider_calendar_admin_class.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class SC_Admin {
|
4 |
+
public static $instance = null;
|
5 |
+
protected $version = '1.4.28';
|
6 |
+
public $prefix = "sc_";
|
7 |
+
protected $notices = null;
|
8 |
+
public static function get_instance() {
|
9 |
+
if ( null == self::$instance ) {
|
10 |
+
self::$instance = new self;
|
11 |
+
}
|
12 |
+
|
13 |
+
return self::$instance;
|
14 |
+
}
|
15 |
+
|
16 |
+
private function __construct() {
|
17 |
+
$this->notices = new SC_Notices();
|
18 |
+
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
19 |
+
add_action( 'admin_notices', array($this, 'sc_admin_notices') );
|
20 |
+
}
|
21 |
+
|
22 |
+
function sc_admin_notices( ) {
|
23 |
+
// Notices filter and run the notices function.
|
24 |
+
|
25 |
+
$admin_notices = apply_filters( 'sc_admin_notices', array() );
|
26 |
+
$this->notices->admin_notice( $admin_notices );
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
31 |
+
public function admin_notice_ignore() {
|
32 |
+
|
33 |
+
$slug = ( isset( $_GET['sc_admin_notice_ignore'] ) ) ? $_GET['sc_admin_notice_ignore'] : '';
|
34 |
+
// If user clicks to ignore the notice, run this action
|
35 |
+
if ( isset($_GET['sc_admin_notice_ignore']) && current_user_can( 'manage_options' ) ) {
|
36 |
+
|
37 |
+
$admin_notices_option = get_option( 'sc_admin_notice', array() );
|
38 |
+
$admin_notices_option[ $_GET[ 'sc_admin_notice_ignore' ] ][ 'dismissed' ] = 1;
|
39 |
+
update_option( 'sc_admin_notice', $admin_notices_option );
|
40 |
+
$query_str = remove_query_arg( 'sc_admin_notice_ignore' );
|
41 |
+
wp_redirect( $query_str );
|
42 |
+
exit;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
?>
|
spider_calendar_notices_class.php
ADDED
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* SC_Notices Class
|
9 |
+
**/
|
10 |
+
class SC_Notices {
|
11 |
+
static $instance;
|
12 |
+
|
13 |
+
public static function instance() {
|
14 |
+
if ( ! isset( self::$instance ) ) {
|
15 |
+
self::$instance = new SC_Notices();
|
16 |
+
}
|
17 |
+
|
18 |
+
return self::$instance;
|
19 |
+
}
|
20 |
+
|
21 |
+
public $notice_spam = 0;
|
22 |
+
public $notice_spam_max = 1;
|
23 |
+
|
24 |
+
// Basic actions to run
|
25 |
+
public function __construct() {
|
26 |
+
|
27 |
+
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
28 |
+
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
29 |
+
|
30 |
+
// Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
|
31 |
+
add_action( 'admin_init', array( $this, 'admin_notice_temp_ignore' ) );
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
// Checks to ensure notices aren't disabled and the user has the correct permissions.
|
36 |
+
public function sc_admin_notice() {
|
37 |
+
|
38 |
+
$sc_settings = get_option( 'sc_admin_notice' );
|
39 |
+
if ( ! isset( $sc_settings['disable_admin_notices'] ) || ( isset( $sc_settings['disable_admin_notices'] ) && $sc_settings['disable_admin_notices'] == 0 ) ) {
|
40 |
+
if ( current_user_can( 'manage_options' ) ) {
|
41 |
+
return true;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
return false;
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
// Primary notice function that can be called from an outside function sending necessary variables
|
50 |
+
public function admin_notice( $admin_notices ) {
|
51 |
+
global $wd_spider_calendar_version;
|
52 |
+
// Check options
|
53 |
+
if ( ! $this->sc_admin_notice() ) {
|
54 |
+
return false;
|
55 |
+
}
|
56 |
+
|
57 |
+
foreach ( $admin_notices as $slug => $admin_notice ) {
|
58 |
+
// Call for spam protection
|
59 |
+
if ( $this->anti_notice_spam() ) {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
// Check for proper page to display on
|
64 |
+
if ( isset( $admin_notices[ $slug ]['pages'] ) && is_array( $admin_notices[ $slug ]['pages'] ) ) {
|
65 |
+
if ( ! $this->admin_notice_pages( $admin_notices[ $slug ]['pages'] ) ) {
|
66 |
+
return false;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
// Check for required fields
|
70 |
+
if ( ! $this->required_fields( $admin_notices[ $slug ] ) ) {
|
71 |
+
// Get the current date then set start date to either passed value or current date value and add interval
|
72 |
+
$current_date = current_time( "n/j/Y" );
|
73 |
+
$start = ( isset( $admin_notices[ $slug ]['start'] ) ? $admin_notices[ $slug ]['start'] : $current_date );
|
74 |
+
$start = date( "n/j/Y", strtotime( $start ) );
|
75 |
+
$date_array = explode( '/', $start );
|
76 |
+
$interval = ( isset( $admin_notices[ $slug ]['int'] ) ? $admin_notices[ $slug ]['int'] : 0 );
|
77 |
+
$date_array[1] += $interval;
|
78 |
+
$start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
79 |
+
|
80 |
+
// This is the main notices storage option
|
81 |
+
$admin_notices_option = get_option( 'sc_admin_notice', array() );
|
82 |
+
// Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
|
83 |
+
if ( ! array_key_exists( $slug, $admin_notices_option ) ) {
|
84 |
+
$admin_notices_option[ $slug ]['start'] = $start;
|
85 |
+
$admin_notices_option[ $slug ]['int'] = $interval;
|
86 |
+
update_option( 'sc_admin_notice', $admin_notices_option );
|
87 |
+
}
|
88 |
+
|
89 |
+
// Sanity check to ensure we have accurate information
|
90 |
+
// New date information will not overwrite old date information
|
91 |
+
$admin_display_check = ( isset( $admin_notices_option[ $slug ]['dismissed'] ) ? $admin_notices_option[ $slug ]['dismissed'] : 0 );
|
92 |
+
|
93 |
+
$admin_display_start = ( isset( $admin_notices_option[ $slug ]['start'] ) ? $admin_notices_option[ $slug ]['start'] : $start );
|
94 |
+
$admin_display_interval = ( isset( $admin_notices_option[ $slug ]['int'] ) ? $admin_notices_option[ $slug ]['int'] : $interval );
|
95 |
+
$admin_display_msg = ( isset( $admin_notices[ $slug ]['msg'] ) ? $admin_notices[ $slug ]['msg'] : '' );
|
96 |
+
$admin_display_title = ( isset( $admin_notices[ $slug ]['title'] ) ? $admin_notices[ $slug ]['title'] : '' );
|
97 |
+
$admin_display_link = ( isset( $admin_notices[ $slug ]['link'] ) ? $admin_notices[ $slug ]['link'] : '' );
|
98 |
+
$output_css = false;
|
99 |
+
// Ensure the notice hasn't been hidden and that the current date is after the start date
|
100 |
+
if ($admin_display_check == 0 && strtotime( $admin_display_start ) <= strtotime( $current_date )) {
|
101 |
+
|
102 |
+
// Get remaining query string
|
103 |
+
$query_str = esc_url( add_query_arg( 'sc_admin_notice_ignore', $slug ) );
|
104 |
+
|
105 |
+
// Admin notice display output
|
106 |
+
echo '<div class="update-nag sc-admin-notice">';
|
107 |
+
echo '<div class="sc-notice-logo"></div>';
|
108 |
+
echo ' <p class="sc-notice-title">';
|
109 |
+
echo $admin_display_title;
|
110 |
+
echo ' </p>';
|
111 |
+
echo ' <p class="sc-notice-body">';
|
112 |
+
echo $admin_display_msg;
|
113 |
+
echo ' </p>';
|
114 |
+
echo '<ul class="sc-notice-body sc-blue">
|
115 |
+
' . $admin_display_link . '
|
116 |
+
</ul>';
|
117 |
+
echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>';
|
118 |
+
echo '</div>';
|
119 |
+
|
120 |
+
$this->notice_spam += 1;
|
121 |
+
$output_css = true;
|
122 |
+
}
|
123 |
+
if ( $output_css ) {
|
124 |
+
wp_enqueue_style("sc-admin-notices", plugins_url('style_for_cal/notices.css', __FILE__), array(), $wd_spider_calendar_version);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
// Spam protection check
|
131 |
+
public function anti_notice_spam() {
|
132 |
+
|
133 |
+
if ( $this->notice_spam >= $this->notice_spam_max ) {
|
134 |
+
return true;
|
135 |
+
}
|
136 |
+
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
141 |
+
public function admin_notice_ignore() {
|
142 |
+
|
143 |
+
// If user clicks to ignore the notice, update the option to not show it again
|
144 |
+
if ( isset( $_GET['sc_admin_notice_ignore'] ) ) {
|
145 |
+
|
146 |
+
$admin_notices_option = get_option( 'sc_admin_notice', array() );
|
147 |
+
$admin_notices_option[ $_GET['sc_admin_notice_ignore'] ]['dismissed'] = 1;
|
148 |
+
update_option( 'sc_admin_notice', $admin_notices_option );
|
149 |
+
$query_str = remove_query_arg( 'sc_admin_notice_ignore' );
|
150 |
+
wp_redirect( $query_str );
|
151 |
+
exit;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
// Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
|
156 |
+
public function admin_notice_temp_ignore() {
|
157 |
+
|
158 |
+
// If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
|
159 |
+
if ( isset( $_GET['sc_admin_notice_temp_ignore'] ) ) {
|
160 |
+
|
161 |
+
$admin_notices_option = get_option( 'sc_admin_notice', array() );
|
162 |
+
|
163 |
+
$current_date = current_time( "n/j/Y" );
|
164 |
+
$date_array = explode( '/', $current_date );
|
165 |
+
$interval = ( isset( $_GET['sc_int'] ) ? $_GET['sc_int'] : 14 );
|
166 |
+
$date_array[1] += $interval;
|
167 |
+
$new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
168 |
+
|
169 |
+
$admin_notices_option[ $_GET['sc_admin_notice_temp_ignore'] ]['start'] = $new_start;
|
170 |
+
$admin_notices_option[ $_GET['sc_admin_notice_temp_ignore'] ]['dismissed'] = 0;
|
171 |
+
update_option( 'sc_admin_notice', $admin_notices_option );
|
172 |
+
$query_str = remove_query_arg( array( 'sc_admin_notice_temp_ignore', 'sc_int' ) );
|
173 |
+
wp_redirect( $query_str );
|
174 |
+
exit;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
public function admin_notice_pages( $pages ) {
|
179 |
+
|
180 |
+
foreach ( $pages as $key => $page ) {
|
181 |
+
if ( is_array( $page ) ) {
|
182 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == $page[0] && isset( $_GET['tab'] ) && $_GET['tab'] == $page[1] ) {
|
183 |
+
return true;
|
184 |
+
}
|
185 |
+
} else {
|
186 |
+
if ( $page == 'all' ) {
|
187 |
+
return true;
|
188 |
+
}
|
189 |
+
if ( get_current_screen()->id === $page ) {
|
190 |
+
return true;
|
191 |
+
}
|
192 |
+
if ( isset( $_GET['page'] ) && $_GET['page'] == $page ) {
|
193 |
+
return true;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Required fields check
|
202 |
+
public function required_fields( $fields ) {
|
203 |
+
if ( ! isset( $fields['msg'] ) || ( isset( $fields['msg'] ) && empty( $fields['msg'] ) ) ) {
|
204 |
+
return true;
|
205 |
+
}
|
206 |
+
|
207 |
+
if ( ! isset( $fields['title'] ) || ( isset( $fields['title'] ) && empty( $fields['title'] ) ) ) {
|
208 |
+
return true;
|
209 |
+
}
|
210 |
+
|
211 |
+
return false;
|
212 |
+
}
|
213 |
+
|
214 |
+
// Special parameters function that is to be used in any extension of this class
|
215 |
+
public function special_parameters( $admin_notices ) {
|
216 |
+
// Intentionally left blank
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
style_for_cal/notices.css
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.sc-admin-notice {
|
2 |
+
background: #fff;
|
3 |
+
border-top: 4px;
|
4 |
+
display: block;
|
5 |
+
min-height: 68px;
|
6 |
+
padding: 10px 40px 10px 125px;
|
7 |
+
position: relative;
|
8 |
+
}
|
9 |
+
.sc-admin-notice a {
|
10 |
+
color: #10738B;
|
11 |
+
}
|
12 |
+
.sc-notice-logo {
|
13 |
+
clear: both;
|
14 |
+
content: "";
|
15 |
+
display: block;
|
16 |
+
background-image: url("../images/spider.calendar.png");
|
17 |
+
background-size: 108px 107px;
|
18 |
+
background-repeat: no-repeat;
|
19 |
+
background-position: 0 45%;
|
20 |
+
width: 125px;
|
21 |
+
position: absolute;
|
22 |
+
top: 0;
|
23 |
+
bottom: 0;
|
24 |
+
left: 5px;
|
25 |
+
}
|
26 |
+
.sc-admin-notice > .dashicons {
|
27 |
+
color: #424242;
|
28 |
+
position: absolute;
|
29 |
+
right: 20px;
|
30 |
+
top: 40%;
|
31 |
+
}
|
32 |
+
.sc-notice-title {
|
33 |
+
font-size: 24px;
|
34 |
+
margin: 0;
|
35 |
+
}
|
36 |
+
.sc-notice-body {
|
37 |
+
font-weight: normal;
|
38 |
+
margin: 5px 0;
|
39 |
+
}
|
40 |
+
.sc-notice-body:after {
|
41 |
+
clear: both;
|
42 |
+
content: "";
|
43 |
+
display: block;
|
44 |
+
}
|
45 |
+
.sc-notice-body li {
|
46 |
+
float: left;
|
47 |
+
margin-right: 20px;
|
48 |
+
}
|
49 |
+
.sc-notice-body .dashicons {
|
50 |
+
font-size: 17px;
|
51 |
+
}
|
52 |
+
.sc-blue {
|
53 |
+
color: #10738B;
|
54 |
+
}
|