| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | === Timed Content === |
| 2 | 2 | |
| 3 | 3 | Contributors: kjvtough, awelzel |
| 4 | 4 | Tags: marketing, marketing tool, post, page, date, time, timer, timed, show, hide, content, schedule, display |
| 5 | -Requires at least: 2.0.2 | |
| 6 | -Tested up to: 5.0 | |
| 7 | -Stable tag: 2.15 | |
| 5 | +Requires at least: 3.8 | |
| 6 | +Tested up to: 6.0 | |
| 7 | +Stable tag: 2.70 | |
| 8 | 8 | License: GPL2 |
| 9 | 9 | |
| 10 | 10 | Plugin to show or hide portions of a Page or Post based on specific date/time characteristics. |
| 11 | 11 | |
| @@ -21,42 +21,122 @@ | ||
| 21 | 21 | A TinyMCE dialog is included to help users build the shortcodes. See the Screenshots tab for more info. |
| 22 | 22 | |
| 23 | 23 | == Installation == |
| 24 | 24 | |
| 25 | -**Note:** `XXX` refers to the current version release. | |
| 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 | |
| 26 | 27 | |
| 27 | -= Automatic method = | |
| 28 | +== Frequently Asked Questions == | |
| 28 | 29 | |
| 29 | -1. Click 'Add New' on the 'Plugins' page. | |
| 30 | -1. Upload `timed-content-XXX.zip` using the file uploader on the page | |
| 30 | += Old rules after updating to version 2.50 = | |
| 31 | 31 | |
| 32 | -= Manual method = | |
| 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 | 33 | |
| 34 | -1. Unzip `timed-content-XXX.zip` and upload the `timed-content` folder to the `/wp-content/plugins/` directory | |
| 35 | -1. Activate the plugin through the 'Plugins' menu in WordPress | |
| 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. | |
| 36 | 35 | |
| 37 | -== Frequently Asked Questions == | |
| 36 | +To be sure, you should check your existing rules and shortcodes if you upgraded from a version below 2.50. | |
| 38 | 37 | |
| 39 | -No "frequent" questions as of yet, but come ask away in the Support forum. | |
| 38 | += Using Timed Content in Gutenberg = | |
| 40 | 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 | + | |
| 41 | 42 | == Screenshots == |
| 42 | 43 | |
| 43 | -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. All of the Admin-side screenshots are from Wordpress 3.7, but the functionality is the same for 3.8. | |
| 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. | |
| 44 | 45 | 2. The "Add Timed Content shortcode" dialog showing the Client tab. Check the attribute you want to add and fill in the textboxes. |
| 45 | 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. |
| 46 | 47 | 4. The date and time pickers help you format a correct date and time. Here's the jQuery UI Datepicker in action. |
| 47 | 48 | 5. The "Add Timed Content shortcode" dialog showing the Timed Content Rules tab. |
| 48 | -6. You can use both shortcodes together and with other shortcodes supported by your Wordpress installation. | |
| 49 | -7. The Timed Content Rules overview page. Timed Content Rules allow you to set up a schedule for showing/hiding your content. | |
| 50 | -8. Editing a Timed Content Rule. Here, you can see the jQuery UI Timepicker in action. | |
| 51 | -9. Check the Scheduled Dates/Times to verify when your rule will be active. | |
| 52 | -10. An example showing use of the `[timed-content-server]` shortcode with `debug` set to `true`. You'll only see it if you're logged in and it's on a Page/Post you can edit (Your regular visitors won't see this at all). | |
| 53 | 49 | |
| 54 | 50 | == Changelog == |
| 55 | 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 | + | |
| 56 | 135 | = 2.15 = |
| 57 | 136 | |
| 58 | -* Fixed 404 errors caused by wrong URL for date/time picker localization. | |
| 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. | |
| 59 | 139 | |
| 60 | 140 | = 2.10 = |
| 61 | 141 | |
| 62 | 142 | * Fixed a problem with unexpected `p` elements inside server side timed content sections. |
| @@ -162,66 +242,8 @@ | ||
| 162 | 242 | = 1.0 = |
| 163 | 243 | |
| 164 | 244 | * Initial release. |
| 165 | 245 | |
| 166 | -== Upgrade Notice == | |
| 167 | - | |
| 168 | -= 2.12 = | |
| 169 | - | |
| 170 | -Fixed a problem with date format for server side rules in TinyMCE plugin to make sure it is alway mm/dd/yyyy. | |
| 171 | - | |
| 172 | -= 2.10 = | |
| 173 | - | |
| 174 | -Fixed a problem with unexpected `p` elements inside server side timed content sections. Upgrade now | |
| 175 | - | |
| 176 | -= 2.5.1 = | |
| 177 | - | |
| 178 | -Fixed `current_time()` bug in __rulesShowHTML() introduced in 2.5. Upgrade now | |
| 179 | - | |
| 180 | -= 2.5 = | |
| 181 | - | |
| 182 | -Better handling od dates w/ i18n. Upgrade now | |
| 183 | - | |
| 184 | -= 2.4 = | |
| 185 | - | |
| 186 | -New version fixes incompatibility with OptimizePress. Upgrade now | |
| 187 | - | |
| 188 | -= 2.3 = | |
| 189 | - | |
| 190 | -Fixed bug when setting up weekly recurrence for Timed Content Rules. Upgrade now | |
| 191 | - | |
| 192 | -= 2.1.4 = | |
| 193 | - | |
| 194 | -Fixed TinyMCE button issue. Upgrade now | |
| 195 | - | |
| 196 | -= 2.1.3 = | |
| 197 | - | |
| 198 | -Fixed various minor bugs. Upgrade now | |
| 199 | - | |
| 200 | -= 2.1.2 = | |
| 201 | - | |
| 202 | -Dashicons support for WP 3.8 +. Upgrade once you've upgraded Wordpress to >= 3.8. | |
| 203 | - | |
| 204 | -= 2.1.1 = | |
| 205 | - | |
| 206 | -CSS for JQuery UI now loaded locally as required by Wordpress plugin repository rules. Upgrade now | |
| 207 | - | |
| 208 | -= 2.1 = | |
| 209 | - | |
| 210 | -Fixed bug in how the days of week to repeat on were being set up between the front and back ends. Upgrade now | |
| 211 | - | |
| 212 | -= 2.0 = | |
| 213 | - | |
| 214 | -New Timed Content Rules feature; AnyTime replaced due to licensing. Upgrade now. | |
| 215 | - | |
| 216 | -= 1.2 = | |
| 217 | - | |
| 218 | -AnyTime JavaScript library was outdated, breaking the Timed Content dialog box. Upgrade now. | |
| 219 | - | |
| 220 | -= 1.1 = | |
| 221 | - | |
| 222 | -Fixed some internal filename discrepancies, causing visual editor to break. Upgrade now. | |
| 223 | - | |
| 224 | 246 | == Examples == |
| 225 | 247 | |
| 226 | 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]` |
| 227 | 249 | |
| @@ -230,13 +252,13 @@ | ||
| 230 | 252 | `[timed-content-client hide="1:00:1000"]Hide me after one minute with a 1000 millisecond (1 second) fade-out.[/timed-content-client]` |
| 231 | 253 | |
| 232 | 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]` |
| 233 | 255 | |
| 234 | -`[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]` | |
| 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]` | |
| 235 | 257 | |
| 236 | -`[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]` | |
| 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]` | |
| 237 | 259 | |
| 238 | -`[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]` | |
| 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]` | |
| 239 | 261 | |
| 240 | 262 | `[timed-content-rule id="164"]Display me based on the settings for the Timed Content Rule whoseID is 164.[/timed-content-rule]` |
| 241 | 263 | |
| 242 | 264 | == Usage == |
| @@ -261,14 +283,16 @@ | ||
| 261 | 283 | Your users must have JavaScript enabled for this shortcode to work. |
| 262 | 284 | |
| 263 | 285 | **The timed-content-server shortcode** |
| 264 | 286 | |
| 265 | -`[timed-content-server show="datetime" hide="datetime" debug="true|false"]Example Text[/timed-content-server]` | |
| 287 | +`[timed-content-server show="datetime" hide="datetime" debug="true|false|when_hidden"]Example Text[/timed-content-server]` | |
| 266 | 288 | |
| 267 | -* `show` - Specifies the date/time when the marked content should start being included on the web page. The attribute consists of `datetime` - a human-readable date/time description. The plugin uses PHP's <a href="http://www.php.net/manual/en/function.strtotime.php">strtotime</a> function to process dates/times, so anything it can understand can be used. | |
| 268 | -* `hide` - Specifies the date/time after which the marked content should stop being included on the web page. The attribute consists of `datetime` - a human-readable date/time description. The plugin uses PHP's <a href="http://www.php.net/manual/en/function.strtotime.php">strtotime</a> function to process dates/times, so anything it can understand can be used. | |
| 269 | -* `debug` - If `true`, adds some debugging statements to the web page as HTML comments. Defaults to `false`. | |
| 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`. | |
| 270 | 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 | + | |
| 271 | 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: |
| 272 | 296 | |
| 273 | 297 | * `show` only - Marked content is outputted only after the date/time set here. |
| 274 | 298 | * `hide` only - Marked content is outputted only before the date/time set here. |
| @@ -281,9 +305,9 @@ | ||
| 281 | 305 | You can find the correct shortcode from the Timed Content Rules overview page, or use the TinyMCE dialog. |
| 282 | 306 | |
| 283 | 307 | **Testing server side rules** |
| 284 | 308 | |
| 285 | -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. | |
| 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. | |
| 286 | 310 | |
| 287 | 311 | == Developer Documentation == |
| 288 | 312 | |
| 289 | 313 | **Action hooks** |