| @@ -1,355 +1,364 @@ | ||
| 1 | -=== Timed Content === | |
| 2 | - | |
| 3 | -Contributors: kjvtough, awelzel | |
| 4 | -Tags: marketing, marketing tool, post, page, date, time, timer, timed, show, hide, content, schedule, display | |
| 5 | -Requires at least: 3.8 | |
| 6 | -Tested up to: 5.0 | |
| 7 | -Stable tag: 2.51 | |
| 8 | -License: GPL2 | |
| 9 | - | |
| 10 | -Plugin to show or hide portions of a Page or Post based on specific date/time characteristics. | |
| 11 | - | |
| 12 | -== Description == | |
| 13 | - | |
| 14 | -The Timed Content plugin allows users to specify that a portion of a Page or Post should appear/be visible or disappear/be invisible based on given time characteristics. You can also make portions of a Post or Page be visible at certain dates and times; you can even set up a schedule! | |
| 15 | - | |
| 16 | -The plugin adds the following: | |
| 17 | - | |
| 18 | -* A "client-side" shortcode that allows the marking of content to appear or disappear after a given time interval; a "fade" effect is included. This functionality is intended to be used for special effects only, as content marked in this manner is still visible in the HTML source and, therefore, not a secure method of hiding content. | |
| 19 | -* Two "server-side" shortcodes that allow the marking of content to be visible only during specified date/time intervals. This functionality **can** be used as a secure method of hiding content, because the marked content will be included in the Page/Post **only** when viewed in the specified date/time intervals. | |
| 20 | - | |
| 21 | -A TinyMCE dialog is included to help users build the shortcodes. See the Screenshots tab for more info. | |
| 22 | - | |
| 23 | -== Installation == | |
| 24 | - | |
| 25 | -1. Extract the contents of the package to the `/wp-content/plugins/timed-content` directory | |
| 26 | -2. Activate the plugin through the 'Plugins' menu in WordPress | |
| 27 | - | |
| 28 | -== Frequently Asked Questions == | |
| 29 | - | |
| 30 | -= Old rules after updating to version 2.50 = | |
| 31 | - | |
| 32 | -In versions prior to 2.50 the date/time format was not handled very well which caused quite some confusion. Therefore version 2.50 now uses a fixed format similar to ISO 8601: yyyy-mm-dd HH:MM | |
| 33 | - | |
| 34 | -Existing shortcodes and rules containing dates in the format mm/dd/yyyy should still work, but when editing rules the date value is converted to the new format. | |
| 35 | - | |
| 36 | -To be sure, you should check your existing rules and shortcodes if you upgraded from a version below 2.50. | |
| 37 | - | |
| 38 | -= Using Timed Content in Gutenberg = | |
| 39 | - | |
| 40 | -If you want to use Timed Content with Gutenberg you have to add a "Classic" block. There is no way to show or hide other content blocks with Timed Content. | |
| 41 | - | |
| 42 | -== Screenshots == | |
| 43 | - | |
| 44 | -1. An example showing use of the `[timed-content-client]` shortcode. The "alarm clock" button on the editor menubar brings up a dialog box to help build the Timed Content shortcodes. | |
| 45 | -2. The "Add Timed Content shortcode" dialog showing the Client tab. Check the attribute you want to add and fill in the textboxes. | |
| 46 | -3. The "Add Timed Content shortcode" dialog showing the Server tab. Check the attribute you want to add, then click on the Date and Time textboxes. | |
| 47 | -4. The date and time pickers help you format a correct date and time. Here's the jQuery UI Datepicker in action. | |
| 48 | -5. The "Add Timed Content shortcode" dialog showing the Timed Content Rules tab. | |
| 49 | - | |
| 50 | -== Changelog == | |
| 51 | - | |
| 52 | -= 2.51 = | |
| 53 | - | |
| 54 | -* Fixed a bug for server side shortcodes with "hide" code, where the date/time was not parsed correctly. | |
| 55 | - | |
| 56 | -= 2.50 = | |
| 57 | - | |
| 58 | -* Major code refactoring and cleanup - please check your existing rules and shortcodes if they still work as expected and change them if needed! | |
| 59 | -* Increased minimum required WordPress version to 3.8 | |
| 60 | -* Date format for new shortcodes and rules is now always "yyyy-mm-dd HH:MM" (similar to ISO 8601) | |
| 61 | -* Existing dates in rules and shortcodes will be parsed as "mm/dd/yyyy HH:MM" if they contain slashes | |
| 62 | -* Time values containing "AM" or "PM" will still work but converted to 24h format internally | |
| 63 | - | |
| 64 | -= 2.15 = | |
| 65 | - | |
| 66 | -* Fixed 404 error caused by wrong URL for jquery date/time picker localization. | |
| 67 | -* Current date/time in TinyMCE dialog will be displayed as "yyyy-mm-dd HH:MM" as well. | |
| 68 | - | |
| 69 | -= 2.10 = | |
| 70 | - | |
| 71 | -* Fixed a problem with unexpected `p` elements inside server side timed content sections. | |
| 72 | - | |
| 73 | -= 2.9 = | |
| 74 | - | |
| 75 | -* Changed default sort order of the rules in the backend to the title. | |
| 76 | - | |
| 77 | -= 2.8 = | |
| 78 | - | |
| 79 | -* Added debug parameter `tctest`. | |
| 80 | - | |
| 81 | -= 2.7 = | |
| 82 | - | |
| 83 | -* Fixed deprecated class constructors. | |
| 84 | - | |
| 85 | -= 2.6 = | |
| 86 | - | |
| 87 | -* New action hooks. | |
| 88 | -* `[timed-content-rule]` shortcode now accepts a Timed Content Rule name as well as an ID. | |
| 89 | -* Streamlined i18n for date/time pickers (Use values available in Wordpress settings and `$wp_locale` when available, combined *-i18n.js files into one). | |
| 90 | -* Some developer docs in the `readme.txt` | |
| 91 | - | |
| 92 | -= 2.5.1 = | |
| 93 | - | |
| 94 | -* Fixed `current_time()` bug in __rulesShowHTML() introduced in 2.5. | |
| 95 | - | |
| 96 | -= 2.5 = | |
| 97 | - | |
| 98 | -* Removed dependency on jQuery UI Dialog; now uses Thickbox. | |
| 99 | -* Added and modified `fix_date_i18n()` from https://core.trac.wordpress.org/ticket/25768 to better handle DST and timezones with i18n. | |
| 100 | -* Added custom filter `timed_content_filter_override` so admins can modify/replace `timed_content_filter` if necessary. | |
| 101 | -* Using built-in spinner image now instead of `wpspin.gif` | |
| 102 | - | |
| 103 | -= 2.4 = | |
| 104 | - | |
| 105 | -* Removed `timed-content-admin-tinymce.js` (No need anymore; required JS variables now hooked directly into editor). Fixes incompatibility with OptimizePress. | |
| 106 | - | |
| 107 | -= 2.3.1 = | |
| 108 | - | |
| 109 | -* Fixed minor bugs related to Exception Dates. | |
| 110 | -* Optimized rule periods arrays (array only needs 'status' and 'time' when it's meant to be human-readable). | |
| 111 | -* Added custom filter `timed_content_filter` to emulate `apply_filter( 'the_content', ... )` functionality for content. | |
| 112 | - | |
| 113 | -= 2.3 = | |
| 114 | - | |
| 115 | -* Fixed bug when setting up weekly recurrence for Timed Content Rules. | |
| 116 | -* NEW! Exception Dates (dates on which your Timed Content Rule shouldn't run). | |
| 117 | - | |
| 118 | -= 2.2 = | |
| 119 | - | |
| 120 | -* Much improved i18n | |
| 121 | -* New Spanish translation - Many thanks to Andrew Kurtis and Jelena Kovacevic from WebHostingHub (Nueva traducción de español - Muchas gracias a Andrew Kurtis y Jelena Kovacevic desde WebHostingHub). | |
| 122 | - | |
| 123 | -= 2.1.5 = | |
| 124 | - | |
| 125 | -* Unified dashicons among all of my plugins. | |
| 126 | -* Minor improvements in TinyMCE dialog UI and Date/Time UI controls. | |
| 127 | - | |
| 128 | -= 2.1.4 = | |
| 129 | - | |
| 130 | -* Fixed TinyMCE editor button for TinyMCE 4.x. | |
| 131 | - | |
| 132 | -= 2.1.3 = | |
| 133 | - | |
| 134 | -* Removed support for PHP4 in `customFieldsInterface.php`. | |
| 135 | -* Fixed Wordpress version check for deciding which image to use for TinyMCE button. | |
| 136 | -* Fixed "Strict Standards" warning in PHP 5.4 in `__getNextWeek()`. | |
| 137 | - | |
| 138 | -= 2.1.2 = | |
| 139 | - | |
| 140 | -* Dashicons support for WP 3.8 + added. Support for old-style icons in Admin/TinyMCE is deprecated. | |
| 141 | -* Added versioning to all `wp_enqueue_style()` calls. | |
| 142 | - | |
| 143 | -= 2.1.1 = | |
| 144 | - | |
| 145 | -* CSS for JQuery UI now loaded locally as required by Wordpress plugin repository rules. | |
| 146 | -* Improved UX on TinyMCE dialog and Timed Content Rules detail page. | |
| 147 | - | |
| 148 | -= 2.1 = | |
| 149 | - | |
| 150 | -* Fixed inconsistency in how the days of week to repeat on were being set up between the front and back ends. | |
| 151 | -* Fixed variable scope bug that occurred on activation. | |
| 152 | -* Improved i18n. | |
| 153 | - | |
| 154 | -= 2.0 = | |
| 155 | - | |
| 156 | -* Added Timed Content Rules. | |
| 157 | -* Replaced AnyTime plugin with jQuery UI Timepicker (http://fgelinas.com/code/timepicker) and Wordpress's internal jQuery UI Datepicker. | |
| 158 | -* HTML code created by `[timed-content-client]` can now either be enclosed in either `<div>` or `<span>` tags. | |
| 159 | -* Debugging statements for `[timed-content-server]` now displayed on Post/Page (only if logged in and have the rights to edit that Post/Page - no more digging into the HTML source). | |
| 160 | -* Improved code documentation. | |
| 161 | - | |
| 162 | -= 1.2 = | |
| 163 | - | |
| 164 | -* Upgraded AnyTime jQuery plugin. | |
| 165 | -* `timed-content.js` is now always loaded (Size > 1KB, so not a lot of extra overhead); fixes bug when multiple/nested shortcodes are used. | |
| 166 | - | |
| 167 | -= 1.1 = | |
| 168 | - | |
| 169 | -* Fixed some internal filename discrepancies. | |
| 170 | - | |
| 171 | -= 1.0 = | |
| 172 | - | |
| 173 | -* Initial release. | |
| 174 | - | |
| 175 | -== Upgrade Notice == | |
| 176 | - | |
| 177 | -= 2.15 = | |
| 178 | - | |
| 179 | -* Fixed 404 errors caused by wrong URL for date/time picker localization. | |
| 180 | - | |
| 181 | -= 2.12 = | |
| 182 | - | |
| 183 | -Fixed a problem with date format for server side rules in TinyMCE plugin to make sure it is alway mm/dd/yyyy. | |
| 184 | - | |
| 185 | -= 2.10 = | |
| 186 | - | |
| 187 | -Fixed a problem with unexpected `p` elements inside server side timed content sections. Upgrade now | |
| 188 | - | |
| 189 | -= 2.5.1 = | |
| 190 | - | |
| 191 | -Fixed `current_time()` bug in __rulesShowHTML() introduced in 2.5. Upgrade now | |
| 192 | - | |
| 193 | -= 2.5 = | |
| 194 | - | |
| 195 | -Better handling od dates w/ i18n. Upgrade now | |
| 196 | - | |
| 197 | -= 2.4 = | |
| 198 | - | |
| 199 | -New version fixes incompatibility with OptimizePress. Upgrade now | |
| 200 | - | |
| 201 | -= 2.3 = | |
| 202 | - | |
| 203 | -Fixed bug when setting up weekly recurrence for Timed Content Rules. Upgrade now | |
| 204 | - | |
| 205 | -= 2.1.4 = | |
| 206 | - | |
| 207 | -Fixed TinyMCE button issue. Upgrade now | |
| 208 | - | |
| 209 | -= 2.1.3 = | |
| 210 | - | |
| 211 | -Fixed various minor bugs. Upgrade now | |
| 212 | - | |
| 213 | -= 2.1.2 = | |
| 214 | - | |
| 215 | -Dashicons support for WP 3.8 +. Upgrade once you've upgraded Wordpress to >= 3.8. | |
| 216 | - | |
| 217 | -= 2.1.1 = | |
| 218 | - | |
| 219 | -CSS for JQuery UI now loaded locally as required by Wordpress plugin repository rules. Upgrade now | |
| 220 | - | |
| 221 | -= 2.1 = | |
| 222 | - | |
| 223 | -Fixed bug in how the days of week to repeat on were being set up between the front and back ends. Upgrade now | |
| 224 | - | |
| 225 | -= 2.0 = | |
| 226 | - | |
| 227 | -New Timed Content Rules feature; AnyTime replaced due to licensing. Upgrade now. | |
| 228 | - | |
| 229 | -= 1.2 = | |
| 230 | - | |
| 231 | -AnyTime JavaScript library was outdated, breaking the Timed Content dialog box. Upgrade now. | |
| 232 | - | |
| 233 | -= 1.1 = | |
| 234 | - | |
| 235 | -Fixed some internal filename discrepancies, causing visual editor to break. Upgrade now. | |
| 236 | - | |
| 237 | -== Examples == | |
| 238 | - | |
| 239 | -`[timed-content-client show="1:00"]Show me after one minute. Since we don't want a fade-in, we can leave it out of the "show" attribute completely.[/timed-content-client]` | |
| 240 | - | |
| 241 | -`[timed-content-client show="1:00:1000"]Show me after one minute with a 1000 millisecond (1 second) fade-in.[/timed-content-client]` | |
| 242 | - | |
| 243 | -`[timed-content-client hide="1:00:1000"]Hide me after one minute with a 1000 millisecond (1 second) fade-out.[/timed-content-client]` | |
| 244 | - | |
| 245 | -`[timed-content-client show="1:00:500" hide="5:00:2000"]Show me after one minute with a 500 millisecond (a half-second) fade-in, then hide me after five minutes with a 2000 millisecond (2 seconds) fade-out.[/timed-content-client]` | |
| 246 | - | |
| 247 | -`[timed-content-server show="2013-Sep-13 20:30:00 -0600"]Show me starting at 8:30 PM Central Standard Time on September 13th, 2013. I will not be displayed before then.[/timed-content-server]` | |
| 248 | - | |
| 249 | -`[timed-content-server hide="2013-Sep-13 20:30:00 America/Chicago"]Hide me starting at 8:30 PM Central Daylight Time (i.e., the same timezone as Chicago) on September 13th, 2013. I will not be displayed after then[/timed-content-server]` | |
| 250 | - | |
| 251 | -`[timed-content-server show="2013-Sep-13 20:30:00 -0600" hide="2013-Sep-13 21:30:00 -0600"]Show me starting at 8:30 PM Central Standard Time on September 13th, 2013, then hide me an hour later. I will not be displayed before or after then.[/timed-content-server]` | |
| 252 | - | |
| 253 | -`[timed-content-rule id="164"]Display me based on the settings for the Timed Content Rule whoseID is 164.[/timed-content-rule]` | |
| 254 | - | |
| 255 | -== Usage == | |
| 256 | - | |
| 257 | -NOTE: All shortcodes can be built using the TinyMCE dialog. When in doubt, use the dialog to create correctly formed shortcodes. | |
| 258 | - | |
| 259 | -**The timed-content-client shortcode** | |
| 260 | - | |
| 261 | -`[timed-content-client show="mm:ss:fff" hide="mm:ss:fff"]Example Text[/timed-content-client]` | |
| 262 | - | |
| 263 | -* `show` - Specifies the time interval after loading the web page when the marked content should be displayed. The attribute consists of three parts, | |
| 264 | -separated by colons: `mm` - minutes, `ss` - seconds, and `fff` - if greater than `0`, a fade-in effect lasting `fff` milliseconds is applied. | |
| 265 | -* `hide` - Specifies the time interval after loading the web page when the marked content should be hidden. The attribute consists of three parts, | |
| 266 | -separated by colons: `mm` - minutes, `ss` - seconds, and `fff` - if greater than `0`, a fade-out effect lasting `fff` milliseconds is applied. | |
| 267 | - | |
| 268 | -Both attributes are optional, but at least one attribute must be included. Leading zeros (0) are optional. The shortcode's behaviour depends on which attributes are used: | |
| 269 | - | |
| 270 | -* `show` only - Marked content is initially not visible, then appears `mm` minutes and `ss` seconds after loading with a `fff` millisecond fade-in. | |
| 271 | -* `hide` only - Marked content is initially visible, then disappears `mm` minutes and `ss` seconds after loading with a `fff` millisecond fade-out. | |
| 272 | -* `show` and `hide` - Marked content is initially not visible, then appears according to the values set in `show`, then disappears according to the values set in `hide`. | |
| 273 | - | |
| 274 | -Your users must have JavaScript enabled for this shortcode to work. | |
| 275 | - | |
| 276 | -**The timed-content-server shortcode** | |
| 277 | - | |
| 278 | -`[timed-content-server show="datetime" hide="datetime" debug="true|false"]Example Text[/timed-content-server]` | |
| 279 | - | |
| 280 | -* `show` - Specifies the date/time when the marked content should start being included on the web page. | |
| 281 | -* `hide` - Specifies the date/time after which the marked content should stop being included on the web page. | |
| 282 | -* `debug` - If `true`, adds some debugging statements to the web page as HTML comments. Defaults to `false`. | |
| 283 | - | |
| 284 | -The date and time are expected to be yyyy-mm-dd HH:MM (similar to ISO 8601), for example `2019-04-07 15:30` for April 7, 2019, 15:30. For backward compatiblity old "human readable" date formats should also work, but these should not be used any longer! | |
| 285 | - | |
| 286 | -Both `show` and `hide` attributes are optional, but at least one attribute must be included. The shortcode's behaviour depends on which attributes are used: | |
| 287 | - | |
| 288 | -* `show` only - Marked content is outputted only after the date/time set here. | |
| 289 | -* `hide` only - Marked content is outputted only before the date/time set here. | |
| 290 | -* `show` and `hide` - Marked content is outputted only during the time period defined by the `show` and `hide` attributes. | |
| 291 | - | |
| 292 | -**The timed-content-rule shortcode** | |
| 293 | - | |
| 294 | -`[timed-content-rule id="{rule_id}|{rule_name}"]Example Text[/timed-content-rule]` | |
| 295 | - | |
| 296 | -You can find the correct shortcode from the Timed Content Rules overview page, or use the TinyMCE dialog. | |
| 297 | - | |
| 298 | -**Testing server side rules** | |
| 299 | - | |
| 300 | -For testing the behaviour of server side rules at specific times, you may use the GET parameter `tctest` in an URL, followed by date and time in the format `YYYY-MM-DD+hh:mm:ss`. This works only you are logged in with a user which has the right to edit the displayed page or post. For example: `http://mysite.example?tctest=2018-02-10+19:16:00` will show the content as if it was February 2, 2018 at 19:16. | |
| 301 | - | |
| 302 | -== Developer Documentation == | |
| 303 | - | |
| 304 | -**Action hooks** | |
| 305 | - | |
| 306 | -`add_action( "timed_content_server_show", "{function_name}", {priority_level}, 4 );` | |
| 307 | - | |
| 308 | -Fired when the `[timed-content-server]` shortcode is encountered *AND* the content is to be displayed based on the shortcode's show/hide attributes. Functions using this hook should accept the following arguments in order: | |
| 309 | - | |
| 310 | -* `$post_id` - the ID of the currently displayed Post/Page | |
| 311 | -* `$show` - the value of the `show` attribute. If not set, defaults to "1970-Jan-01 00:00:00 +000" | |
| 312 | -* `$hide` - the value of the `hide` attribute. If not set, defaults to "2038-Jan-19 03:14:07 +000" | |
| 313 | -* `$content` - The content enclosed by the shortcode | |
| 314 | - | |
| 315 | -`add_action( "timed_content_server_hide", "{function_name}", {priority_level}, 4 );` | |
| 316 | - | |
| 317 | -Fired when the `[timed-content-server]` shortcode is encountered *AND* the content is to be hidden based on the shortcode's show/hide attributes. Functions using this hook should accept the following arguments in order: | |
| 318 | - | |
| 319 | -* `$post_id` - the ID of the currently displayed Post/Page | |
| 320 | -* `$show` - the value of the `show` attribute. If not set, defaults to "1970-Jan-01 00:00:00 +000" | |
| 321 | -* `$hide` - the value of the `hide` attribute. If not set, defaults to "2038-Jan-19 03:14:07 +000" | |
| 322 | -* `$content` - The content enclosed by the shortcode | |
| 323 | - | |
| 324 | -`add_action( "timed_content_rule_show", "{function_name}", {priority_level}, 3 );` | |
| 325 | - | |
| 326 | -Fired when the `[timed-content-rule]` shortcode is encountered *AND* the content is to be displayed based on the Timed Content Rule's properties. Functions using this hook should accept the following arguments in order: | |
| 327 | - | |
| 328 | -* `$post_id` - the ID of the currently displayed Post/Page | |
| 329 | -* `$rule_id` - the ID of the Timed Content Rule being called. Use `get_post_meta( $rule_id )` to get the Rule's properties. | |
| 330 | -* `$content` - The content enclosed by the shortcode | |
| 331 | - | |
| 332 | -`add_action( "timed_content_rule_hide", "{function_name}", {priority_level}, 3 );` | |
| 333 | - | |
| 334 | -Fired when the `[timed-content-rule]` shortcode is encountered *AND* the content is to be hidden based on the Timed Content Rule's properties. Functions using this hook should accept the following arguments in order: | |
| 335 | - | |
| 336 | -* `$post_id` - the ID of the currently displayed Post/Page | |
| 337 | -* `$rule_id` - the ID of the Timed Content Rule being called. Use `get_post_meta( $rule_id )` to get the Rule's properties. | |
| 338 | -* `$content` - The content enclosed by the shortcode | |
| 339 | - | |
| 340 | -**Filter hooks** | |
| 341 | - | |
| 342 | -`timed_content_filter` | |
| 343 | - | |
| 344 | -Filter for any content enclosed by a Timed Content shortcode. Implements the same filters as `the_content`: | |
| 345 | - | |
| 346 | -* `wptexturize` | |
| 347 | -* `convert_smilies` | |
| 348 | -* `convert_chars` | |
| 349 | -* `wpautop` | |
| 350 | -* `prepend_attachment` | |
| 351 | -* `do_shortcode` | |
| 352 | - | |
| 353 | -`timed_content_filter_override` | |
| 354 | - | |
| 355 | -Replaces the `timed_content_filter` with another pre-existing filter to use for any content enclosed by a Timed Content shortcode. Any function hooked into this filter must return the name of a filter (as a string). | |
| 1 | +=== Timed Content === | |
| 2 | + | |
| 3 | +Contributors: kjvtough, awelzel | |
| 4 | +Tags: marketing, marketing tool, post, page, date, time, timer, timed, show, hide, content, schedule, display | |
| 5 | +Requires at least: 3.8 | |
| 6 | +Tested up to: 6.0 | |
| 7 | +Stable tag: 2.70 | |
| 8 | +License: GPL2 | |
| 9 | + | |
| 10 | +Plugin to show or hide portions of a Page or Post based on specific date/time characteristics. | |
| 11 | + | |
| 12 | +== Description == | |
| 13 | + | |
| 14 | +The Timed Content plugin allows users to specify that a portion of a Page or Post should appear/be visible or disappear/be invisible based on given time characteristics. You can also make portions of a Post or Page be visible at certain dates and times; you can even set up a schedule! | |
| 15 | + | |
| 16 | +The plugin adds the following: | |
| 17 | + | |
| 18 | +* A "client-side" shortcode that allows the marking of content to appear or disappear after a given time interval; a "fade" effect is included. This functionality is intended to be used for special effects only, as content marked in this manner is still visible in the HTML source and, therefore, not a secure method of hiding content. | |
| 19 | +* Two "server-side" shortcodes that allow the marking of content to be visible only during specified date/time intervals. This functionality **can** be used as a secure method of hiding content, because the marked content will be included in the Page/Post **only** when viewed in the specified date/time intervals. | |
| 20 | + | |
| 21 | +A TinyMCE dialog is included to help users build the shortcodes. See the Screenshots tab for more info. | |
| 22 | + | |
| 23 | +== Installation == | |
| 24 | + | |
| 25 | +1. Extract the contents of the package to the `/wp-content/plugins/timed-content` directory | |
| 26 | +2. Activate the plugin through the 'Plugins' menu in WordPress | |
| 27 | + | |
| 28 | +== Frequently Asked Questions == | |
| 29 | + | |
| 30 | += Old rules after updating to version 2.50 = | |
| 31 | + | |
| 32 | +In versions prior to 2.50 the date/time format was not handled very well which caused quite some confusion. Therefore version 2.50 now uses a fixed format similar to ISO 8601: yyyy-mm-dd HH:MM | |
| 33 | + | |
| 34 | +Existing shortcodes and rules containing dates in the format mm/dd/yyyy should still work, but when editing rules the date value is converted to the new format. | |
| 35 | + | |
| 36 | +To be sure, you should check your existing rules and shortcodes if you upgraded from a version below 2.50. | |
| 37 | + | |
| 38 | += Using Timed Content in Gutenberg = | |
| 39 | + | |
| 40 | +If you want to use Timed Content with Gutenberg you have to add a "Classic" block. There is no way to show or hide other content blocks with Timed Content. | |
| 41 | + | |
| 42 | +== Screenshots == | |
| 43 | + | |
| 44 | +1. An example showing use of the `[timed-content-client]` shortcode. The "alarm clock" button on the editor menubar brings up a dialog box to help build the Timed Content shortcodes. | |
| 45 | +2. The "Add Timed Content shortcode" dialog showing the Client tab. Check the attribute you want to add and fill in the textboxes. | |
| 46 | +3. The "Add Timed Content shortcode" dialog showing the Server tab. Check the attribute you want to add, then click on the Date and Time textboxes. | |
| 47 | +4. The date and time pickers help you format a correct date and time. Here's the jQuery UI Datepicker in action. | |
| 48 | +5. The "Add Timed Content shortcode" dialog showing the Timed Content Rules tab. | |
| 49 | + | |
| 50 | +== Changelog == | |
| 51 | + | |
| 52 | += 2.70 = | |
| 53 | + | |
| 54 | +* The number of calculated date/time values is limited to avoid too many values for very long periods. | |
| 55 | + | |
| 56 | += 2.69 = | |
| 57 | + | |
| 58 | +* Updated compatibility for WordPress 6.0 | |
| 59 | + | |
| 60 | += 2.68 = | |
| 61 | + | |
| 62 | +* Fixed a problem with shortcodes on pages without post object. | |
| 63 | + | |
| 64 | += 2.67 = | |
| 65 | + | |
| 66 | +* Refactor backend code to avoid errors in situations when there is no current post but a post is expected. | |
| 67 | + | |
| 68 | += 2.66 = | |
| 69 | + | |
| 70 | +* Updated compatibility information for WordPress 5.8. | |
| 71 | + | |
| 72 | += 2.65 = | |
| 73 | + | |
| 74 | +* Fixed a PHP warning which could occur if no exceptions are defined in a rule. | |
| 75 | + | |
| 76 | += 2.64 = | |
| 77 | + | |
| 78 | +* Fixed empty TinyMCE dialog. | |
| 79 | + | |
| 80 | += 2.62-2.63 = | |
| 81 | + | |
| 82 | +* Fixed PHP 7.3 compatibility issues. | |
| 83 | + | |
| 84 | += 2.61 = | |
| 85 | + | |
| 86 | +* Fixed PHP notice when using rules without exceptions. | |
| 87 | + | |
| 88 | += 2.60 = | |
| 89 | + | |
| 90 | +* Fixed broken handling of rule exceptions. | |
| 91 | +* Changed label for intervals in rule editor. | |
| 92 | + | |
| 93 | += 2.58 = | |
| 94 | + | |
| 95 | +* Changed the way how debug output is generated to the old variant without HTML sanitizing to make it easier to understand the output (thanks to Enrico Bacis for this). | |
| 96 | + | |
| 97 | += 2.57 = | |
| 98 | + | |
| 99 | +* Extended `debug` parameter: it's now also possible to show debug output only if content is hidden (thanks to Enrico Bacis for this). | |
| 100 | + | |
| 101 | += 2.56 = | |
| 102 | + | |
| 103 | +* Use of 'UTC' instead of '+0000' as default time zone to avoid problems with older PHP versions (eventhough you should better update to a supported PHP version). | |
| 104 | + | |
| 105 | += 2.55 = | |
| 106 | + | |
| 107 | +* Better handling of shortcodes with invalid timezones to avoid unhandled runtime exceptions. | |
| 108 | +* Improved debug output. | |
| 109 | + | |
| 110 | += 2.54 = | |
| 111 | + | |
| 112 | +* Default date values for new rules will now be in the correct format and not in the local date format of WordPress. | |
| 113 | + | |
| 114 | += 2.53 = | |
| 115 | + | |
| 116 | +* Added support for old shortcodes with localized date formats again. Every date/time which can be used in `strtotime()` should work now as well. | |
| 117 | +* Improved format of debug output. | |
| 118 | + | |
| 119 | += 2.52 = | |
| 120 | + | |
| 121 | +* Fixed a bug for server side shortcodes without or invalid "hide" attribute which did always hide the content. | |
| 122 | + | |
| 123 | += 2.51 = | |
| 124 | + | |
| 125 | +* Fixed a bug where the "hide" attribute of server side shortcodes did not get parsed correctly. | |
| 126 | + | |
| 127 | += 2.50 = | |
| 128 | + | |
| 129 | +* Major code refactoring and cleanup - please check your existing rules and shortcodes if they still work as expected and change them if needed! | |
| 130 | +* Increased minimum required WordPress version to 3.8 | |
| 131 | +* Date format for new shortcodes and rules is now always "yyyy-mm-dd HH:MM" (similar to ISO 8601) | |
| 132 | +* Existing dates in rules and shortcodes will be parsed as "mm/dd/yyyy HH:MM" if they contain slashes | |
| 133 | +* Time values containing "AM" or "PM" will still work but converted to 24h format internally | |
| 134 | + | |
| 135 | += 2.15 = | |
| 136 | + | |
| 137 | +* Fixed 404 error caused by wrong URL for jquery date/time picker localization. | |
| 138 | +* Current date/time in TinyMCE dialog will be displayed as "yyyy-mm-dd HH:MM" as well. | |
| 139 | + | |
| 140 | += 2.10 = | |
| 141 | + | |
| 142 | +* Fixed a problem with unexpected `p` elements inside server side timed content sections. | |
| 143 | + | |
| 144 | += 2.9 = | |
| 145 | + | |
| 146 | +* Changed default sort order of the rules in the backend to the title. | |
| 147 | + | |
| 148 | += 2.8 = | |
| 149 | + | |
| 150 | +* Added debug parameter `tctest`. | |
| 151 | + | |
| 152 | += 2.7 = | |
| 153 | + | |
| 154 | +* Fixed deprecated class constructors. | |
| 155 | + | |
| 156 | += 2.6 = | |
| 157 | + | |
| 158 | +* New action hooks. | |
| 159 | +* `[timed-content-rule]` shortcode now accepts a Timed Content Rule name as well as an ID. | |
| 160 | +* Streamlined i18n for date/time pickers (Use values available in Wordpress settings and `$wp_locale` when available, combined *-i18n.js files into one). | |
| 161 | +* Some developer docs in the `readme.txt` | |
| 162 | + | |
| 163 | += 2.5.1 = | |
| 164 | + | |
| 165 | +* Fixed `current_time()` bug in __rulesShowHTML() introduced in 2.5. | |
| 166 | + | |
| 167 | += 2.5 = | |
| 168 | + | |
| 169 | +* Removed dependency on jQuery UI Dialog; now uses Thickbox. | |
| 170 | +* Added and modified `fix_date_i18n()` from https://core.trac.wordpress.org/ticket/25768 to better handle DST and timezones with i18n. | |
| 171 | +* Added custom filter `timed_content_filter_override` so admins can modify/replace `timed_content_filter` if necessary. | |
| 172 | +* Using built-in spinner image now instead of `wpspin.gif` | |
| 173 | + | |
| 174 | += 2.4 = | |
| 175 | + | |
| 176 | +* Removed `timed-content-admin-tinymce.js` (No need anymore; required JS variables now hooked directly into editor). Fixes incompatibility with OptimizePress. | |
| 177 | + | |
| 178 | += 2.3.1 = | |
| 179 | + | |
| 180 | +* Fixed minor bugs related to Exception Dates. | |
| 181 | +* Optimized rule periods arrays (array only needs 'status' and 'time' when it's meant to be human-readable). | |
| 182 | +* Added custom filter `timed_content_filter` to emulate `apply_filter( 'the_content', ... )` functionality for content. | |
| 183 | + | |
| 184 | += 2.3 = | |
| 185 | + | |
| 186 | +* Fixed bug when setting up weekly recurrence for Timed Content Rules. | |
| 187 | +* NEW! Exception Dates (dates on which your Timed Content Rule shouldn't run). | |
| 188 | + | |
| 189 | += 2.2 = | |
| 190 | + | |
| 191 | +* Much improved i18n | |
| 192 | +* New Spanish translation - Many thanks to Andrew Kurtis and Jelena Kovacevic from WebHostingHub (Nueva traducción de español - Muchas gracias a Andrew Kurtis y Jelena Kovacevic desde WebHostingHub). | |
| 193 | + | |
| 194 | += 2.1.5 = | |
| 195 | + | |
| 196 | +* Unified dashicons among all of my plugins. | |
| 197 | +* Minor improvements in TinyMCE dialog UI and Date/Time UI controls. | |
| 198 | + | |
| 199 | += 2.1.4 = | |
| 200 | + | |
| 201 | +* Fixed TinyMCE editor button for TinyMCE 4.x. | |
| 202 | + | |
| 203 | += 2.1.3 = | |
| 204 | + | |
| 205 | +* Removed support for PHP4 in `customFieldsInterface.php`. | |
| 206 | +* Fixed Wordpress version check for deciding which image to use for TinyMCE button. | |
| 207 | +* Fixed "Strict Standards" warning in PHP 5.4 in `__getNextWeek()`. | |
| 208 | + | |
| 209 | += 2.1.2 = | |
| 210 | + | |
| 211 | +* Dashicons support for WP 3.8 + added. Support for old-style icons in Admin/TinyMCE is deprecated. | |
| 212 | +* Added versioning to all `wp_enqueue_style()` calls. | |
| 213 | + | |
| 214 | += 2.1.1 = | |
| 215 | + | |
| 216 | +* CSS for JQuery UI now loaded locally as required by Wordpress plugin repository rules. | |
| 217 | +* Improved UX on TinyMCE dialog and Timed Content Rules detail page. | |
| 218 | + | |
| 219 | += 2.1 = | |
| 220 | + | |
| 221 | +* Fixed inconsistency in how the days of week to repeat on were being set up between the front and back ends. | |
| 222 | +* Fixed variable scope bug that occurred on activation. | |
| 223 | +* Improved i18n. | |
| 224 | + | |
| 225 | += 2.0 = | |
| 226 | + | |
| 227 | +* Added Timed Content Rules. | |
| 228 | +* Replaced AnyTime plugin with jQuery UI Timepicker (http://fgelinas.com/code/timepicker) and Wordpress's internal jQuery UI Datepicker. | |
| 229 | +* HTML code created by `[timed-content-client]` can now either be enclosed in either `<div>` or `<span>` tags. | |
| 230 | +* Debugging statements for `[timed-content-server]` now displayed on Post/Page (only if logged in and have the rights to edit that Post/Page - no more digging into the HTML source). | |
| 231 | +* Improved code documentation. | |
| 232 | + | |
| 233 | += 1.2 = | |
| 234 | + | |
| 235 | +* Upgraded AnyTime jQuery plugin. | |
| 236 | +* `timed-content.js` is now always loaded (Size > 1KB, so not a lot of extra overhead); fixes bug when multiple/nested shortcodes are used. | |
| 237 | + | |
| 238 | += 1.1 = | |
| 239 | + | |
| 240 | +* Fixed some internal filename discrepancies. | |
| 241 | + | |
| 242 | += 1.0 = | |
| 243 | + | |
| 244 | +* Initial release. | |
| 245 | + | |
| 246 | +== Examples == | |
| 247 | + | |
| 248 | +`[timed-content-client show="1:00"]Show me after one minute. Since we don't want a fade-in, we can leave it out of the "show" attribute completely.[/timed-content-client]` | |
| 249 | + | |
| 250 | +`[timed-content-client show="1:00:1000"]Show me after one minute with a 1000 millisecond (1 second) fade-in.[/timed-content-client]` | |
| 251 | + | |
| 252 | +`[timed-content-client hide="1:00:1000"]Hide me after one minute with a 1000 millisecond (1 second) fade-out.[/timed-content-client]` | |
| 253 | + | |
| 254 | +`[timed-content-client show="1:00:500" hide="5:00:2000"]Show me after one minute with a 500 millisecond (a half-second) fade-in, then hide me after five minutes with a 2000 millisecond (2 seconds) fade-out.[/timed-content-client]` | |
| 255 | + | |
| 256 | +`[timed-content-server show="2013-09-13 20:30:00 -0600"]Show me starting at 8:30 PM Central Standard Time on September 13th, 2013. I will not be displayed before then.[/timed-content-server]` | |
| 257 | + | |
| 258 | +`[timed-content-server hide="2013-09-13 20:30:00 America/Chicago"]Hide me starting at 8:30 PM Central Daylight Time (i.e., the same timezone as Chicago) on September 13th, 2013. I will not be displayed after then[/timed-content-server]` | |
| 259 | + | |
| 260 | +`[timed-content-server show="2013-09-13 20:30:00 -0600" hide="2013-09-13 21:30:00 -0600"]Show me starting at 8:30 PM Central Standard Time on September 13th, 2013, then hide me an hour later. I will not be displayed before or after then.[/timed-content-server]` | |
| 261 | + | |
| 262 | +`[timed-content-rule id="164"]Display me based on the settings for the Timed Content Rule whoseID is 164.[/timed-content-rule]` | |
| 263 | + | |
| 264 | +== Usage == | |
| 265 | + | |
| 266 | +NOTE: All shortcodes can be built using the TinyMCE dialog. When in doubt, use the dialog to create correctly formed shortcodes. | |
| 267 | + | |
| 268 | +**The timed-content-client shortcode** | |
| 269 | + | |
| 270 | +`[timed-content-client show="mm:ss:fff" hide="mm:ss:fff"]Example Text[/timed-content-client]` | |
| 271 | + | |
| 272 | +* `show` - Specifies the time interval after loading the web page when the marked content should be displayed. The attribute consists of three parts, | |
| 273 | +separated by colons: `mm` - minutes, `ss` - seconds, and `fff` - if greater than `0`, a fade-in effect lasting `fff` milliseconds is applied. | |
| 274 | +* `hide` - Specifies the time interval after loading the web page when the marked content should be hidden. The attribute consists of three parts, | |
| 275 | +separated by colons: `mm` - minutes, `ss` - seconds, and `fff` - if greater than `0`, a fade-out effect lasting `fff` milliseconds is applied. | |
| 276 | + | |
| 277 | +Both attributes are optional, but at least one attribute must be included. Leading zeros (0) are optional. The shortcode's behaviour depends on which attributes are used: | |
| 278 | + | |
| 279 | +* `show` only - Marked content is initially not visible, then appears `mm` minutes and `ss` seconds after loading with a `fff` millisecond fade-in. | |
| 280 | +* `hide` only - Marked content is initially visible, then disappears `mm` minutes and `ss` seconds after loading with a `fff` millisecond fade-out. | |
| 281 | +* `show` and `hide` - Marked content is initially not visible, then appears according to the values set in `show`, then disappears according to the values set in `hide`. | |
| 282 | + | |
| 283 | +Your users must have JavaScript enabled for this shortcode to work. | |
| 284 | + | |
| 285 | +**The timed-content-server shortcode** | |
| 286 | + | |
| 287 | +`[timed-content-server show="datetime" hide="datetime" debug="true|false|when_hidden"]Example Text[/timed-content-server]` | |
| 288 | + | |
| 289 | +* `show` - Specifies the date/time when the marked content should start being included on the web page. | |
| 290 | +* `hide` - Specifies the date/time after which the marked content should stop being included on the web page. | |
| 291 | +* `debug` - If `true`, adds some debugging statements to the web page as HTML comments. If `when_hidden`, the debugging statements are added only when the content is hidden. Defaults to `false`. | |
| 292 | + | |
| 293 | +The date and time are expected to be yyyy-mm-dd HH:MM (similar to ISO 8601), for example `2019-04-07 15:30` for April 7, 2019, 15:30. For backward compatiblity old "human readable" date formats should also work, but these should not be used any longer! | |
| 294 | + | |
| 295 | +Both `show` and `hide` attributes are optional, but at least one attribute must be included. The shortcode's behaviour depends on which attributes are used: | |
| 296 | + | |
| 297 | +* `show` only - Marked content is outputted only after the date/time set here. | |
| 298 | +* `hide` only - Marked content is outputted only before the date/time set here. | |
| 299 | +* `show` and `hide` - Marked content is outputted only during the time period defined by the `show` and `hide` attributes. | |
| 300 | + | |
| 301 | +**The timed-content-rule shortcode** | |
| 302 | + | |
| 303 | +`[timed-content-rule id="{rule_id}|{rule_name}"]Example Text[/timed-content-rule]` | |
| 304 | + | |
| 305 | +You can find the correct shortcode from the Timed Content Rules overview page, or use the TinyMCE dialog. | |
| 306 | + | |
| 307 | +**Testing server side rules** | |
| 308 | + | |
| 309 | +For testing the behaviour of server side rules at specific times, you may use the GET parameter `tctest` in an URL, followed by date and time in the format `YYYY-MM-DD+hh:mm:ss`. This works only you are logged in with a user which has the right to edit the displayed page or post. For example: `http://mysite.example?tctest=2018-02-10+19:16:00` will show the content as if it was February 10, 2018 at 19:16. | |
| 310 | + | |
| 311 | +== Developer Documentation == | |
| 312 | + | |
| 313 | +**Action hooks** | |
| 314 | + | |
| 315 | +`add_action( "timed_content_server_show", "{function_name}", {priority_level}, 4 );` | |
| 316 | + | |
| 317 | +Fired when the `[timed-content-server]` shortcode is encountered *AND* the content is to be displayed based on the shortcode's show/hide attributes. Functions using this hook should accept the following arguments in order: | |
| 318 | + | |
| 319 | +* `$post_id` - the ID of the currently displayed Post/Page | |
| 320 | +* `$show` - the value of the `show` attribute. If not set, defaults to "1970-Jan-01 00:00:00 +000" | |
| 321 | +* `$hide` - the value of the `hide` attribute. If not set, defaults to "2038-Jan-19 03:14:07 +000" | |
| 322 | +* `$content` - The content enclosed by the shortcode | |
| 323 | + | |
| 324 | +`add_action( "timed_content_server_hide", "{function_name}", {priority_level}, 4 );` | |
| 325 | + | |
| 326 | +Fired when the `[timed-content-server]` shortcode is encountered *AND* the content is to be hidden based on the shortcode's show/hide attributes. Functions using this hook should accept the following arguments in order: | |
| 327 | + | |
| 328 | +* `$post_id` - the ID of the currently displayed Post/Page | |
| 329 | +* `$show` - the value of the `show` attribute. If not set, defaults to "1970-Jan-01 00:00:00 +000" | |
| 330 | +* `$hide` - the value of the `hide` attribute. If not set, defaults to "2038-Jan-19 03:14:07 +000" | |
| 331 | +* `$content` - The content enclosed by the shortcode | |
| 332 | + | |
| 333 | +`add_action( "timed_content_rule_show", "{function_name}", {priority_level}, 3 );` | |
| 334 | + | |
| 335 | +Fired when the `[timed-content-rule]` shortcode is encountered *AND* the content is to be displayed based on the Timed Content Rule's properties. Functions using this hook should accept the following arguments in order: | |
| 336 | + | |
| 337 | +* `$post_id` - the ID of the currently displayed Post/Page | |
| 338 | +* `$rule_id` - the ID of the Timed Content Rule being called. Use `get_post_meta( $rule_id )` to get the Rule's properties. | |
| 339 | +* `$content` - The content enclosed by the shortcode | |
| 340 | + | |
| 341 | +`add_action( "timed_content_rule_hide", "{function_name}", {priority_level}, 3 );` | |
| 342 | + | |
| 343 | +Fired when the `[timed-content-rule]` shortcode is encountered *AND* the content is to be hidden based on the Timed Content Rule's properties. Functions using this hook should accept the following arguments in order: | |
| 344 | + | |
| 345 | +* `$post_id` - the ID of the currently displayed Post/Page | |
| 346 | +* `$rule_id` - the ID of the Timed Content Rule being called. Use `get_post_meta( $rule_id )` to get the Rule's properties. | |
| 347 | +* `$content` - The content enclosed by the shortcode | |
| 348 | + | |
| 349 | +**Filter hooks** | |
| 350 | + | |
| 351 | +`timed_content_filter` | |
| 352 | + | |
| 353 | +Filter for any content enclosed by a Timed Content shortcode. Implements the same filters as `the_content`: | |
| 354 | + | |
| 355 | +* `wptexturize` | |
| 356 | +* `convert_smilies` | |
| 357 | +* `convert_chars` | |
| 358 | +* `wpautop` | |
| 359 | +* `prepend_attachment` | |
| 360 | +* `do_shortcode` | |
| 361 | + | |
| 362 | +`timed_content_filter_override` | |
| 363 | + | |
| 364 | +Replaces the `timed_content_filter` with another pre-existing filter to use for any content enclosed by a Timed Content shortcode. Any function hooked into this filter must return the name of a filter (as a string). | |