PluginProbe
Timed Content / 2.9
Timed Content v2.9
2.99 trunk 1.0 1.1 1.2 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.10 2.11 2.12 2.15 2.2 2.3 2.3.1 2.4 2.5 2.5.1 2.50 2.51 2.52 All 67 releases
← All changes | timed-content.php +258 -48 2.42.9 View file →
@@ -4,17 +4,18 @@
4 4 Text Domain: timed-content
5 5 Domain Path: /lang
6 6 Plugin URI: http://wordpress.org/plugins/timed-content/
7 7 Description: Plugin to show or hide portions of a Page or Post based on specific date/time characteristics. These actions can either be processed either server-side or client-side, depending on the desired effect.
8 -Author: K. Tough
9 -Version: 2.4
8 +Author: K. Tough, Arno Welzel
9 +Version: 2.9
10 10 Author URI: http://wordpress.org/plugins/timed-content/
11 11 */
12 12 if ( !class_exists( "timedContentPlugin" ) ) {
13 13
14 - define( "TIMED_CONTENT_VERSION", "2.4" );
15 - define( "TIMED_CONTENT_PLUGIN_URL", plugins_url() . '/timed-content' );
16 - define( "TIMED_CONTENT_CLIENT_TAG", "timed-content-client" );
14 + define( "TIMED_CONTENT_VERSION", "2.9" );
15 + define( "TIMED_CONTENT_SLUG", "timed-content" );
16 + define( "TIMED_CONTENT_PLUGIN_URL", plugins_url() . '/' . TIMED_CONTENT_SLUG );
17 + define( "TIMED_CONTENT_CLIENT_TAG", "timed-content-client" );
17 18 define( "TIMED_CONTENT_SERVER_TAG", "timed-content-server" );
18 19 define( "TIMED_CONTENT_RULE_TAG", "timed-content-rule" );
19 20 define( "TIMED_CONTENT_ZERO_TIME", "1970-Jan-01 00:00:00 +000" ); // Start of Unix Epoch
20 21 define( "TIMED_CONTENT_END_TIME", "2038-Jan-19 03:14:07 +000" ); // End of Unix Epoch
@@ -35,14 +36,161 @@
35 36 * the possibility of name collisions with other plugins.
36 37 */
37 38 class timedContentPlugin {
38 39
40 + function __construct() {
41 + //constructor
42 +
43 + }
44 +
39 45 function timedContentPlugin() {
40 - //constructor
46 + self::__construct();
41 47
42 48 }
49 +
50 + /** https://core.trac.wordpress.org/ticket/25768
51 + *
52 + * Modified from the original patch to use the currently set
53 + * timezone from PHP, like PHP's date(), and to make the code
54 + * more readable.
55 + *
56 + * @param $j
57 + * @param $req_format
58 + * @param bool $i
59 + * @param bool $gmt
60 + * @return bool|string
61 + */
62 + function fix_date_i18n($j, $req_format, $i = false, $gmt = false)
63 + {
64 + /* @var $wp_locale WP_Locale */
65 + global $wp_locale;
66 + $timestamp = $i;
43 67
44 - /**
68 + // get current timestamp if $i is false
69 + if (false === $timestamp)
70 + {
71 + if ($gmt)
72 + $timestamp = time();
73 + else
74 + $timestamp = current_time('timestamp');
75 +
76 + // use debug parameter if current user is allowed to edit the post
77 + if(isset($_GET['tctest']) && current_user_can( "edit_post", $post->post_id)) {
78 + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $_GET['tctest']);
79 + if($dt != FALSE) $timestamp = $dt->getTimestamp();
80 + }
81 + }
82 +
83 + // get components of the date (timestamp) as array
84 + $date_components = getdate($timestamp);
85 +
86 + // numeric representation of a month, with leading zeros
87 + $date_month = $wp_locale->get_month($date_components['mon']);
88 + $date_month_abbrev = $wp_locale->get_month_abbrev($date_month);
89 + // numeric representation of the day of the week
90 + $date_weekday = $wp_locale->get_weekday($date_components['wday']);
91 + $date_weekday_abbrev = $wp_locale->get_weekday_abbrev($date_weekday);
92 + // get if hour is Ante meridiem or Post meridiem
93 + $meridiem = $date_components['hours'] >= 12 ? 'pm' : 'am';
94 + // lowercase Ante meridiem and Post meridiem hours
95 + $date_meridiem = $wp_locale->get_meridiem($meridiem);
96 + // uppercase Ante meridiem and Post meridiem
97 + $date_meridiem_capital = $wp_locale->get_meridiem(strtoupper($meridiem));
98 +
99 + // escape literals
100 + $date_weekday_abbrev = backslashit($date_weekday_abbrev);
101 + $date_month = backslashit($date_month);
102 + $date_weekday = backslashit($date_weekday);
103 + $date_month_abbrev = backslashit($date_month_abbrev);
104 + $date_meridiem = backslashit($date_meridiem);
105 + $date_meridiem_capital = backslashit($date_meridiem_capital);
106 +
107 + // the translated format string
108 + $translated_date_format_string = '';
109 + // the 2 arrays map a format literal to its translation (e. g. 'F' to the escaped month translation)
110 + $translate_formats = array('D', 'F', 'l', 'M', 'a', 'A', 'c', 'r');
111 + $translations = array(
112 + $date_weekday_abbrev, // D
113 + $date_month, // F
114 + $date_weekday, // l
115 + $date_month_abbrev, // M
116 + $date_meridiem, // a
117 + $date_meridiem_capital, // A
118 + 'Y-m-d\TH:i:sP', // c
119 + sprintf('%s, d %s Y H:i:s O', $date_weekday_abbrev, $date_month_abbrev), // r
120 + );
121 +
122 + // find each format literal that needs translation and replace it by its translation
123 + // respects the escaping
124 + // iterate $req_format from ending to beginning
125 + for ($i = strlen($req_format) - 1; $i > -1; $i--)
126 + {
127 + // test if current char is format literal that needs translation
128 + $translate_formats_index = array_search($req_format[$i], $translate_formats);
129 +
130 + if ($translate_formats_index !== false)
131 + {
132 + // counts the slashes (the escape char) in front of the current char
133 + $slashes_counter = 0;
134 +
135 + // count all slashes left-hand side of the current char
136 + for ($j = $i - 1; $j > -1; $j--)
137 + {
138 + if ($req_format[$j] == '\\')
139 + $slashes_counter++;
140 + else
141 + break;
142 + }
143 +
144 + // number of slashes is even
145 + if ($slashes_counter % 2 == 0)
146 + // current char is not escaped, therefore it is a format literal
147 + $translated_date_format_string = $translations[$translate_formats_index] . $translated_date_format_string;
148 + else
149 + // current char is escaped, therefore it is not a format literal, just add it unchanged
150 + $translated_date_format_string = $req_format[$i] . $translated_date_format_string;
151 + }
152 + else
153 + // current char is no a format literal, just add it unchanged
154 + $translated_date_format_string = $req_format[$i] . $translated_date_format_string;
155 + }
156 +
157 + $req_format = $translated_date_format_string;
158 +
159 + if ($gmt)
160 + // get GMT date string
161 + $date_formatted = gmdate($req_format, $timestamp);
162 + else
163 + {
164 + // get Wordpress time zone
165 + // $timezone_string = get_option('timezone_string');
166 + // Haha, just kidding. Let's get the currently set timezone, as God and Rasmus intended
167 + $timezone_string = date_default_timezone_get();
168 +
169 + if ($timezone_string)
170 + {
171 + // create time zone object
172 + $timezone_object = timezone_open($timezone_string);
173 + // create date object from time zone object
174 + $local_date_object = date_create(null, $timezone_object);
175 + // set time and date of $local_date_object to $timestamp
176 + $date_components = isset($date_components) ? $date_components : getdate($timestamp);
177 + date_date_set($local_date_object, $date_components['year'], $date_components['mon'], $date_components['mday']);
178 + date_time_set($local_date_object, $date_components['hours'], $date_components['minutes'], $date_components['seconds']);
179 + // format date according to the Wordpress time zone
180 + $date_formatted = date_format($local_date_object, $req_format);
181 + }
182 + else
183 + {
184 + // fall back if no Wordpress time zone set
185 + $date_formatted = date($req_format, $i);
186 + }
187 + }
188 +
189 + return $date_formatted;
190 + }
191 +
192 + /**
45 193 * Creates the Timed Content Rule post type and registers it with Wordpress
46 194 *
47 195 */
48 196 function timedContentRuleTypeInit()
@@ -80,10 +228,26 @@
80 228 'supports' => array( 'title' )
81 229 );
82 230 register_post_type( TIMED_CONTENT_RULE_TYPE, $args );
83 231 }
232 +
233 + /**
234 + * Filter to change sort order to title
235 + *
236 + * @param array $messages Array of currently defined messages for post types
237 + * @return mixed Array of messages with appropriate messages for Timed Content Rules added in
238 + */
239 + function timedContentPreGetPosts($query) {
240 + if($query->is_admin) {
241 + if ($query->get('post_type') == TIMED_CONTENT_RULE_TYPE)
242 + {
243 + $query->set('orderby', 'title');
244 + $query->set('order', 'ASC');
245 + }
246 + }
247 + return $query;
248 + }
84 249
85 -
86 250 /**
87 251 * Filter to customize CRUD messages for Timed Content Rules
88 252 *
89 253 * @param array $messages Array of currently defined messages for post types
@@ -437,12 +601,19 @@
437 601 $monthly_pattern_day = $args['monthly_pattern_day'];
438 602 $exceptions_dates = $args['exceptions_dates'];
439 603 //print_r($days_of_week);
440 604
605 + add_filter('date_i18n', array( &$this, "fix_date_i18n" ), 10, 4);
441 606 $temp_tz = date_default_timezone_get();
442 607 date_default_timezone_set( $timezone );
443 - $right_now_t = time();
608 + $right_now_t = current_time( 'timestamp', 1 );
444 609
610 + // use debug parameter if current user is allowed to edit the post
611 + if(isset($_GET['tctest']) && current_user_can( "edit_post", $post->post_id)) {
612 + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $_GET['tctest']);
613 + if($dt != FALSE) $right_now_t = $dt->getTimestamp();
614 + }
615 +
445 616 $instance_start = strtotime( $this->__datetimeToEnglish( $instance_start_date, $instance_start_time ) . " " . $timezone ); // Beginning of first occurrence
446 617 $instance_end = strtotime( $this->__datetimeToEnglish( $instance_end_date, $instance_end_time ) . " " . $timezone ); // End of first occurrence
447 618 $current = $instance_start;
448 619 $end_current = $instance_end;
@@ -456,9 +627,9 @@
456 627 $active_periods[$period_count]["start"] = date_i18n( TIMED_CONTENT_DT_FORMAT, $current );
457 628 $active_periods[$period_count]["end"] = date_i18n( TIMED_CONTENT_DT_FORMAT, $end_current );
458 629 if ( $right_now_t < $current ) {
459 630 $active_periods[$period_count]["status"] = "upcoming";
460 - $active_periods[$period_count]["time"] = sprintf( _x( '%s from now.', 'Human readable time difference', 'timed-content' ), human_time_diff( $current, $right_now_t ) );
631 + $active_periods[$period_count]["time"] = sprintf( _x( '%s from now.', 'Human readable time difference', 'timed-content' ), human_time_diff( $right_now_t, $current ) );
461 632 } elseif ( ( $current <= $right_now_t ) && ( $right_now_t <= $end_current ) ) {
462 633 $active_periods[$period_count]["status"] = "active";
463 634 $active_periods[$period_count]["time"] = __( "Right now!", 'timed-content' );
464 635 } else {
@@ -528,8 +699,9 @@
528 699 }
529 700
530 701 }
531 702 date_default_timezone_set( $temp_tz );
703 + remove_filter('date_i18n', array( &$this, "fix_date_i18n" ), 10, 4);
532 704 return $active_periods;
533 705 }
534 706
535 707 /**
@@ -821,8 +993,11 @@
821 993
822 994 $the_class = TIMED_CONTENT_CLIENT_TAG . $show_attr . $hide_attr ;
823 995 $the_tag = ( $display == "div" ? "div" : "span" );
824 996
997 + $the_filter = "timed_content_filter";
998 + $the_filter = apply_filters( "timed_content_filter_override", $the_filter );
999 +
825 1000 $the_HTML = "<"
826 1001 . $the_tag
827 1002 . " class='"
828 1003 . $the_class
@@ -827,9 +1002,9 @@
827 1002 . " class='"
828 1003 . $the_class
829 1004 . "'"
830 1005 . ( ( $show_attr != "" ) ? " style='display: none;'" : "" ) .">"
831 - . apply_filters( "timed_content_filter", $content )
1006 + . str_replace( ']]>', ']]&gt;', apply_filters( $the_filter, $content ) )
832 1007 . "</" . $the_tag . ">";
833 1008
834 1009 return $the_HTML;
835 1010 }
@@ -845,12 +1020,22 @@
845 1020 global $post;
846 1021 extract( shortcode_atts( array( 'show' => TIMED_CONTENT_ZERO_TIME , 'hide' => TIMED_CONTENT_END_TIME, 'debug' => 'false' ), $atts ) );
847 1022 $show_t = strtotime( $this->__datetimeToEnglish( $show ) );
848 1023 $hide_t = strtotime( $this->__datetimeToEnglish( $hide ) );
849 - $right_now_t = time();
1024 + $right_now_t = current_time( 'timestamp', 1 );
850 1025 $debug_message = "";
1026 +
1027 + // use debug parameter if current user is allowed to edit the post
1028 + if(isset($_GET['tctest']) && current_user_can( "edit_post", $post->post_id)) {
1029 + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $_GET['tctest']);
1030 + if($dt != FALSE) $right_now_t = $dt->getTimestamp();
1031 + }
1032 +
1033 + $the_filter = "timed_content_filter";
1034 + $the_filter = apply_filters( "timed_content_filter_override", $the_filter );
851 1035
852 1036 if ( ( $debug == "true" ) && ( current_user_can( "edit_post", $post->post_id ) ) ) {
1037 + add_filter('date_i18n', array( &$this, "fix_date_i18n" ), 10, 4);
853 1038 $temp_tz = date_default_timezone_get();
854 1039 date_default_timezone_set( get_option( 'timezone_string' ) );
855 1040
856 1041 $right_now = date_i18n( TIMED_CONTENT_DT_FORMAT, $right_now_t );
@@ -881,21 +1066,27 @@
881 1066 $debug_message .= "<p>" . sprintf( __( 'The %s attribute is currently set to', 'timed-content' ), "<code>hide</code>" ) . ": " . $hide . ",<br />\n"
882 1067 . __( 'The Timed Content plugin thinks the intended date/time is', 'timed-content') . ": " . date_i18n( TIMED_CONTENT_DT_FORMAT, $hide_t )
883 1068 . " (" . $hide_diff_str . ").</p>\n";
884 1069
885 - $debug_message .= "<p>" . __( 'Current Date/Time:', 'timed-content') . "&nbsp;" . $right_now . "</p>\n";
886 - $debug_message .= "<p>" . _x( 'Content:', "Noun", 'timed-content') . "&nbsp;" . $content . "</p>\n";
1070 + $debug_message .= "<p>" . __( 'Current Date/Time:', 'timed-content') . "&nbsp;" . $right_now . "<br />\n";
1071 + $debug_message .= __( 'Content Filter:', 'timed-content') . "&nbsp;" . $the_filter . "</p>\n";
1072 + $debug_message .= "<p>" . _x( 'Content:', "Noun", 'timed-content') . "&nbsp;" . $content . "</p>\n";
887 1073
888 1074 $debug_message .= "</div>\n";
889 1075
890 1076 date_default_timezone_set( $temp_tz );
1077 + remove_filter('date_i18n', array( &$this, "fix_date_i18n" ), 10, 4);
891 1078 }
892 -
893 - if ( ( $show_t <= $right_now_t ) && ( $right_now_t <= $hide_t ) )
894 - return $debug_message . apply_filters( "timed_content_filter", $content ) . "\n";
895 - else
896 - return $debug_message . "\n";
897 1079
1080 +
1081 + if ( ( $show_t <= $right_now_t ) && ( $right_now_t <= $hide_t ) ) {
1082 + do_action("timed_content_server_show", $post->ID, $show, $hide, $content);
1083 + return $debug_message . str_replace(']]>', ']]&gt;', apply_filters($the_filter, $content)) . "\n";
1084 + } else {
1085 + do_action("timed_content_server_hide", $post->ID, $show, $hide, $content);
1086 + return $debug_message . "\n";
1087 + }
1088 +
898 1089 }
899 1090
900 1091 /**
901 1092 * Processes the [timed-content-rule] shortcode.
@@ -904,14 +1095,26 @@
904 1095 * @param null $content
905 1096 * @return string
906 1097 */
907 1098 function rulesShowHTML( $atts, $content = null ) {
908 - extract( shortcode_atts( array( 'id' => '0' ), $atts ) );
1099 + global $post;
1100 + extract( shortcode_atts( array( 'id' => 0 ), $atts ) );
1101 + if ( !is_numeric( $id ) ) {
1102 + $page = get_page_by_title( $id, OBJECT, TIMED_CONTENT_RULE_TYPE );
1103 + if ( $page == null ) return;
1104 + $id = $page->ID;
1105 + }
909 1106 if ( TIMED_CONTENT_RULE_TYPE != get_post_type( $id ) ) return;
910 1107
911 1108 $prefix = TIMED_CONTENT_RULE_POSTMETA_PREFIX;
912 - $right_now_t = time();
1109 + $right_now_t = current_time( 'timestamp', 1 );
913 1110 $rule_is_active = false;
1111 +
1112 + // use debug parameter if current user is allowed to edit the post
1113 + if(isset($_GET['tctest']) && current_user_can( "edit_post", $post->post_id)) {
1114 + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $_GET['tctest']);
1115 + if($dt != FALSE) $right_now_t = $dt->getTimestamp();
1116 + }
914 1117
915 1118 $active_periods = $this->getRulePeriodsById( $id, false );
916 1119 $action_is_show = (bool) get_post_meta( $id, $prefix . 'action', true );
917 1120
@@ -920,13 +1123,19 @@
920 1123 $rule_is_active = true;
921 1124 break;
922 1125 }
923 1126 }
924 -
925 - if ( ( ( $rule_is_active == true ) && ( $action_is_show == true ) ) || ( ( $rule_is_active == false ) && ( $action_is_show == false ) ) )
926 - return apply_filters( "timed_content_filter", $content );
927 - else
928 - return "";
1127 +
1128 + $the_filter = "timed_content_filter";
1129 + $the_filter = apply_filters( "timed_content_filter_override", $the_filter );
1130 +
1131 + if ( ( ( $rule_is_active == true ) && ( $action_is_show == true ) ) || ( ( $rule_is_active == false ) && ( $action_is_show == false ) ) ) {
1132 + do_action("timed_content_rule_show", $post->ID, $id, $content);
1133 + return str_replace(']]>', ']]&gt;', apply_filters($the_filter, $content));
1134 + } else {
1135 + do_action("timed_content_rule_hide", $post->ID, $id, $content);
1136 + return "";
1137 + }
929 1138 }
930 1139
931 1140 /**
932 1141 * Enqueues the JavaScript code necessary for the functionality of the [timed-content-client] shortcode.
@@ -989,13 +1198,14 @@
989 1198 function addAdminHeaderCode() {
990 1199 if ( ( isset( $_GET['post_type'] ) && $_GET['post_type'] == TIMED_CONTENT_RULE_TYPE )
991 1200 || ( isset( $post_type ) && $post_type == TIMED_CONTENT_RULE_TYPE )
992 1201 || ( isset( $_GET['post'] ) && get_post_type( $_GET['post'] ) == TIMED_CONTENT_RULE_TYPE ) ) {
993 - wp_enqueue_style( 'timed-content-css', TIMED_CONTENT_CSS, false, TIMED_CONTENT_VERSION );
1202 + wp_enqueue_style( 'thickbox' );
1203 + wp_enqueue_style( 'timed-content-css', TIMED_CONTENT_CSS, false, TIMED_CONTENT_VERSION );
994 1204 // Enqueue the JavaScript file that manages the meta box UI
995 1205 wp_enqueue_script( 'timed-content-admin_js', TIMED_CONTENT_PLUGIN_URL . '/js/timed-content-admin.js', array( 'jquery' ), TIMED_CONTENT_VERSION );
996 1206 // Enqueue the JavaScript file that makes AJAX requests
997 - wp_enqueue_script( 'timed-content-ajax_js', TIMED_CONTENT_PLUGIN_URL . '/js/timed-content-ajax.js', array( 'jquery', 'jquery-ui-dialog' ), TIMED_CONTENT_VERSION );
1207 + wp_enqueue_script( 'timed-content-ajax_js', TIMED_CONTENT_PLUGIN_URL . '/js/timed-content-ajax.js', array( 'jquery', 'thickbox' ), TIMED_CONTENT_VERSION );
998 1208
999 1209 // Set up local variables used in the Admin JavaScript file
1000 1210 wp_localize_script( 'timed-content-admin_js', 'timedContentRuleAdmin', array(
1001 1211 'no_exceptions_label' => __( "- No exceptions set -", 'timed-content' ) ) );
@@ -1004,12 +1214,12 @@
1004 1214 wp_localize_script( 'timed-content-ajax_js', 'timedContentRuleAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ),
1005 1215 'start_label' => _x( 'Start', 'Scheduled Dates/Times dialog - Beginning of active period table header', 'timed-content' ),
1006 1216 'end_label' => _x( 'End', 'Scheduled Dates/Times dialog - End of active period table header', 'timed-content' ),
1007 1217 'dialog_label' => _x( 'Scheduled Dates/Times', 'Scheduled Dates/Times dialog - dialog header', 'timed-content' ),
1218 + 'button_loading_label' => __( 'Calculating Dates/Times', 'timed-content' ),
1219 + 'button_finished_label' => __( 'Show Projected Dates/Times', 'timed-content' ),
1008 1220 'dialog_width' => 800,
1009 1221 'dialog_height' => 500,
1010 - 'close_label' => _x( 'Close', 'Scheduled Dates/Times dialog - Close button HTML label', 'timed-content' ),
1011 - 'loadingimg' => TIMED_CONTENT_PLUGIN_URL . '/img/wpspin.gif',
1012 1222 'error' => __( "Error", 'timed-content' ),
1013 1223 'error_desc' => __( "Something unexpected has happened along the way. The specific details are below:", 'timed-content' ) ) );
1014 1224 }
1015 1225 }
@@ -1098,26 +1308,22 @@
1098 1308 * Display a dialog box for this plugin's associated TinyMCE plugin. Called from TinyMCE via AJAX.
1099 1309 *
1100 1310 */
1101 1311 function timedContentPluginGetTinyMCEDialog() {
1102 - include( "lib/jquery-ui-datetime-i18n.php" );
1312 + include("lib/jquery-ui-datetime-i18n.php");
1103 1313
1104 - wp_enqueue_style( 'timed-content-jquery-ui-css', TIMED_CONTENT_JQUERY_UI_CSS, false, TIMED_CONTENT_VERSION );
1105 - wp_enqueue_script( 'jquery-ui-datepicker' );
1106 - if( !( wp_script_is( 'timed-content-jquery-ui-datepicker-i18n-js', 'registered' ) ) ) {
1107 - wp_register_script( 'timed-content-jquery-ui-datepicker-i18n-js', TIMED_CONTENT_PLUGIN_URL . "/js/timed-content-datepicker-i18n.js", array( 'jquery', 'jquery-ui-datepicker' ), TIMED_CONTENT_VERSION );
1108 - wp_enqueue_script( 'timed-content-jquery-ui-datepicker-i18n-js' );
1109 - wp_localize_script( 'timed-content-jquery-ui-datepicker-i18n-js', 'TimedContentJQDatepickerI18n', $jquery_ui_datetime_datepicker_i18n );
1314 + wp_enqueue_style(TIMED_CONTENT_SLUG . '-jquery-ui-css', TIMED_CONTENT_JQUERY_UI_CSS);
1315 + wp_enqueue_script('jquery-ui-datepicker');
1316 + wp_register_style(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-css', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_CSS);
1317 + wp_enqueue_style(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-css');
1318 + wp_register_script(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-js', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_JS, array('jquery', 'jquery-ui-datepicker'), TIMED_CONTENT_VERSION);
1319 + wp_enqueue_script(TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-js');
1320 + if (!(wp_script_is(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', 'registered'))) {
1321 + wp_register_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', TIMED_CONTENT_PLUGIN_URL . "/js/content-protector-datetime-i18n.js", array('jquery', 'jquery-ui-datepicker', TIMED_CONTENT_SLUG . '-jquery-ui-timepicker-js'), TIMED_CONTENT_VERSION);
1322 + wp_enqueue_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js');
1323 + wp_localize_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', 'TimedContentJQDatepickerI18n', $jquery_ui_datetime_datepicker_i18n);
1324 + wp_localize_script(TIMED_CONTENT_SLUG . '-jquery-ui-datetime-i18n-js', 'TimedContentJQTimepickerI18n', $jquery_ui_datetime_timepicker_i18n);
1110 1325 }
1111 - wp_register_style( 'timed-content-jquery-ui-timepicker-css', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_CSS, array( TIMED_CONTENT_JQUERY_UI_CSS ), TIMED_CONTENT_VERSION );
1112 - wp_enqueue_style( 'timed-content-jquery-ui-timepicker-css' );
1113 - wp_register_script( 'timed-content-jquery-ui-timepicker-js', TIMED_CONTENT_JQUERY_UI_TIMEPICKER_JS, array( 'jquery', 'jquery-ui-datepicker' ), TIMED_CONTENT_VERSION );
1114 - wp_enqueue_script( 'timed-content-jquery-ui-timepicker-js' );
1115 - if( !( wp_script_is( 'timed-content-jquery-ui-timepicker-i18n-js', 'registered' ) ) ) {
1116 - wp_register_script( 'timed-content-jquery-ui-timepicker-i18n-js', TIMED_CONTENT_PLUGIN_URL . "/js/timed-content-timepicker-i18n.js", array( 'jquery', 'jquery-ui-datepicker', 'timed-content-jquery-ui-timepicker-js' ), TIMED_CONTENT_VERSION );
1117 - wp_enqueue_script( 'timed-content-jquery-ui-timepicker-i18n-js' );
1118 - wp_localize_script( 'timed-content-jquery-ui-timepicker-i18n-js', 'TimedContentJQTimepickerI18n', $jquery_ui_datetime_timepicker_i18n );
1119 - }
1120 1326
1121 1327 ob_start();
1122 1328 include( "tinymce_plugin/dialog.php" );
1123 1329 $content = ob_get_contents();
@@ -1240,9 +1446,10 @@
1240 1446 __( 'Rule Description/Schedule', 'timed-content' ),
1241 1447 "<div id=\"schedule_desc\" style=\"font-style: italic;\">"
1242 1448 . ( isset( $_GET['post'] ) && ( TIMED_CONTENT_RULE_TYPE === get_post_type( $_GET['post'] ) ) ? $this->getScheduleDescriptionById( intval( $_GET['post'] ) ) : $this->getScheduleDescriptionById( intval( 0 ) ) )
1243 1449 . "</div>"
1244 - . "<div style=\"padding-top: 10px;\"><input type=\"button\" class=\"button-primary\" id=\"timed_content_rule_test\" value=\"" . __( 'Show Projected Dates/Times', 'timed-content' ) . "\" /></div>",
1450 + . "<div id=\"tcr-dialogHolder\" style=\"display:none;\"></div>"
1451 + . "<div style=\"padding-top: 10px;\"><input type=\"button\" class=\"button button-primary\" id=\"timed_content_rule_test\" value=\"" . __( 'Show Projected Dates/Times', 'timed-content' ) . "\" /></div>",
1245 1452 TIMED_CONTENT_RULE_POSTMETA_PREFIX,
1246 1453 array( TIMED_CONTENT_RULE_TYPE ),
1247 1454 array() );
1248 1455 $ocf = new customFieldsInterface( "timed_content_rule_initial_event",
@@ -1274,8 +1481,9 @@
1274 1481 /* translators: date/time format for debugging messages. http://ca2.php.net/manual/en/function.date.php */
1275 1482 define( "TIMED_CONTENT_DT_FORMAT", __( "l, F jS, Y, g:i A T" , 'timed-content' ) );
1276 1483
1277 1484 }
1485 +
1278 1486 }
1279 1487
1280 1488 } //End Class timedContentPlugin
1281 1489
@@ -1293,9 +1501,9 @@
1293 1501 add_filter('timed_content_filter', 'convert_chars');
1294 1502 add_filter('timed_content_filter', 'wpautop');
1295 1503 add_filter('timed_content_filter', 'prepend_attachment');
1296 1504 add_filter('timed_content_filter', 'do_shortcode');
1297 -
1505 +
1298 1506 add_action( "plugins_loaded", array( &$timedContentPluginInstance, "i18nInit" ), 1 );
1299 1507 add_action( "init", array( &$timedContentPluginInstance, "timedContentRuleTypeInit" ), 2 );
1300 1508 add_action( "init", array( &$timedContentPluginInstance, "setUpCustomFields" ), 2 );
1301 1509 add_action( "wp_head", array( &$timedContentPluginInstance, "addHeaderCode" ), 1 );
@@ -1318,6 +1526,8 @@
1318 1526
1319 1527 add_shortcode( TIMED_CONTENT_CLIENT_TAG, array( &$timedContentPluginInstance, "clientShowHTML" ), 1 );
1320 1528 add_shortcode( TIMED_CONTENT_SERVER_TAG, array( &$timedContentPluginInstance, "serverShowHTML" ), 1 );
1321 1529 add_shortcode( TIMED_CONTENT_RULE_TAG, array( &$timedContentPluginInstance, "rulesShowHTML" ), 1 );
1530 +
1531 + add_filter('pre_get_posts', array( &$timedContentPluginInstance, "timedContentPreGetPosts") );
1322 1532 }
1323 1533 ?>