Changeset 1791260
- Timestamp:
- 12/22/2017 12:37:39 PM (8 years ago)
- Location:
- postpone-posts
- Files:
-
- 12 added
- 2 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (added)
-
assets/banner.svg (added)
-
assets/icon-128x128.png (added)
-
assets/icon-256x256.png (added)
-
assets/icon.svg (added)
-
trunk/languages (added)
-
trunk/languages/postpone-posts-de_DE.mo (added)
-
trunk/languages/postpone-posts-de_DE.po (added)
-
trunk/languages/postpone-posts-de_DE_formal.mo (added)
-
trunk/languages/postpone-posts-de_DE_formal.po (added)
-
trunk/languages/postpone-posts.pot (added)
-
trunk/postpone-posts.php (modified) (20 diffs)
-
trunk/readme.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
postpone-posts/trunk/postpone-posts.php
r1788282 r1791260 4 4 Plugin URI; https://github.com/ekleinod/postpone-posts 5 5 Description: Postpones all future (planned) posts by a selectable number of days. 6 Version: 0.2.06 Version: 1.0.0 7 7 Author: Ekkart Kleinod 8 8 Author URI: http://www.edgesoft.de/ 9 9 License: GPL-3.0 10 10 License URI: https://opensource.org/licenses/GPL-3.0 11 Text Domain: postpone-posts 12 Domain Path: /languages 11 13 12 14 Postpone Posts is a wordpress plugin that postpones all future (planned) posts by a selectable number of days. … … 121 123 get_current_screen()->add_help_tab(array( 122 124 'id' => 'overview', 123 'title' => __('Overview', self::ID), 124 'content' => sprintf('<p>%s</p>', sprintf(__('You can postpone all future posts shown in the box by the given number of days. The number of days has to be between %d and %d.', self::ID), self::DAYS_MIN, self::DAYS_MAX)), 125 'title' => __('Overview', 'postpone-posts'), 126 'content' => sprintf('<p>%s</p>', sprintf(__('You can postpone all future posts shown in the box by the given number of days. The number of days has to be between %d and %d.', 'postpone-posts'), 127 number_format_i18n(self::DAYS_MIN), 128 number_format_i18n(self::DAYS_MAX))), 125 129 )); 126 130 … … 169 173 } else { 170 174 171 self::printError(__('Unrecognized action.', self::ID));175 self::printError(__('Unrecognized action.', 'postpone-posts')); 172 176 self::showDaysInputPage($futurePosts); 173 177 … … 215 219 <input type="hidden" name="page" value="<?php echo($plugin_page); ?>" /> 216 220 217 <p><?php echo( __('You can postpone all future posts shown in the box by the given number of days.', self::ID)) ?></p>218 219 <h2><?php echo( __('Postpone settings', self::ID)); ?></h2>221 <p><?php echo(esc_html__('You can postpone all future posts shown in the box by the given number of days.', 'postpone-posts')) ?></p> 222 223 <h2><?php echo(esc_html__('Postpone settings', 'postpone-posts')); ?></h2> 220 224 221 225 <p> 222 <label for="<?php echo(self::INPUT_FIELD_DAYS); ?>" class="label-responsive"><?php echo( __('Days to postpone:', self::ID)); ?></label>226 <label for="<?php echo(self::INPUT_FIELD_DAYS); ?>" class="label-responsive"><?php echo(esc_html__('Days to postpone', 'postpone-posts')); ?>:</label> 223 227 <input type="number" name="<?php echo(self::INPUT_FIELD_DAYS); ?>" id="<?php echo(self::INPUT_FIELD_DAYS); ?>" min="<?php echo(self::DAYS_MIN); ?>" max="<?php echo(self::DAYS_MAX); ?>" value="<?php echo(get_option(self::NAME_OPTION_DAYS)); ?>" autofocus="autofocus" /> 224 228 </p> 225 229 226 <h2><?php echo( __('Affected posts (display only)', self::ID)); ?></h2>227 228 <textarea rows="5" cols="60" disabled="disabled" readonly="readonly" placeholder="<?php echo( __('No posts to postpone.', self::ID)); ?>"><?php230 <h2><?php echo(esc_html__('Affected posts (display only)', 'postpone-posts')); ?></h2> 231 232 <textarea rows="5" cols="60" disabled="disabled" readonly="readonly" placeholder="<?php echo(esc_html__('No posts to postpone.', 'postpone-posts')); ?>"><?php 229 233 230 234 foreach ($thePosts as $post) { … … 241 245 $submit_args['disabled'] = 'disabled'; 242 246 } 243 submit_button( 'Preview Postponing', 'primary large', self::ACTION_PREVIEW, true, $submit_args);247 submit_button(esc_html__('Preview Postponing', 'postpone-posts'), 'primary large', self::ACTION_PREVIEW, true, $submit_args); 244 248 245 249 ?> … … 268 272 <input type="hidden" name="<?php echo(self::INPUT_FIELD_DAYS); ?>" value="<?php echo($theInput); ?>" /> 269 273 270 <p><?php echo( __('Start postponing by clicking "Postpone Posts". You can cancel the operation by clicking "Cancel".', self::ID)) ?></p>271 272 <h2><?php echo( __('Preview', self::ID)); ?></h2>273 274 <p> Days to postpone: <?php echo($theInput); ?></p>274 <p><?php echo(esc_html__('Start postponing by clicking "Postpone Posts". You can cancel the operation by clicking "Cancel".', 'postpone-posts')) ?></p> 275 276 <h2><?php echo(esc_html__('Preview', 'postpone-posts')); ?></h2> 277 278 <p><?php echo(esc_html__('Days to postpone', 'postpone-posts')); ?>: <?php echo($theInput); ?></p> 275 279 276 280 <table> 277 281 <thead> 278 282 <tr> 279 <th> Date</th>280 <th> Postpone to</th>281 <th> Title</th>283 <th><?php echo(esc_html__('Date', 'postpone-posts')); ?></th> 284 <th><?php echo(esc_html__('Postpone to', 'postpone-posts')); ?></th> 285 <th><?php echo(esc_html__('Title', 'postpone-posts')); ?></th> 282 286 </tr> 283 287 </thead> 284 288 <tfoot> 285 289 <tr> 286 <th> Date</th>287 <th> Postpone to</th>288 <th> Title</th>290 <th><?php echo(esc_html__('Date', 'postpone-posts')); ?></th> 291 <th><?php echo(esc_html__('Postpone to', 'postpone-posts')); ?></th> 292 <th><?php echo(esc_html__('Title', 'postpone-posts')); ?></th> 289 293 </tr> 290 294 </tfoot> … … 320 324 $submit_args['disabled'] = 'disabled'; 321 325 } 322 submit_button( 'Postpone Posts', 'primary large', self::ACTION_POSTPONE, true, $submit_args);326 submit_button(esc_html__('Postpone Posts', 'postpone-posts'), 'primary large', self::ACTION_POSTPONE, true, $submit_args); 323 327 324 328 ?> … … 331 335 332 336 <?php 333 submit_button( 'Cancel', 'secondary large', self::ACTION_CANCEL);337 submit_button(esc_html__('Cancel', 'postpone-posts'), 'secondary large', self::ACTION_CANCEL); 334 338 ?> 335 339 </form> … … 347 351 private static function showActionPage($thePosts, $theInput) { 348 352 349 echo('<ul>'); 350 351 $count_success = 0; 352 $count_error = 0; 353 354 foreach ($thePosts as $post) { 355 356 $postUpdate = self::getUpdatePost($post, $theInput); 357 358 $post_id = wp_update_post($postUpdate, true); 359 360 if (!is_wp_error($post_id)) { 361 362 $message = '✓'; 363 $count_success++; 364 365 } else { 366 367 $message = sprintf('✗: %s', implode('.', $post_id->get_error_messages())); 368 $count_error++; 369 370 } 371 372 echo(sprintf("<li>Postponing from %s (GMT: %s) to %s (GMT: %s) for %s - %s</li>\n", 373 self::formatDateShort($post->post_date), 374 self::formatDateShort($post->post_date_gmt), 375 self::formatDateShort($postUpdate['post_date']), 376 self::formatDateShort($postUpdate['post_date_gmt']), 377 $post->post_title, 378 $message 379 )); 380 381 } 382 383 echo('</ul>'); 384 385 echo(sprintf("<p>Finished postponing with %d successfully postponed posts and %d errors.</p>\n", $count_success, $count_error)); 353 ?> 354 355 <ul> 356 357 <?php 358 359 $count_success = 0; 360 $count_error = 0; 361 362 foreach ($thePosts as $post) { 363 364 $postUpdate = self::getUpdatePost($post, $theInput); 365 366 $post_id = wp_update_post($postUpdate, true); 367 368 if (!is_wp_error($post_id)) { 369 370 $message = '✓'; 371 $count_success++; 372 373 } else { 374 375 $message = sprintf('✗: %s', implode('.', $post_id->get_error_messages())); 376 $count_error++; 377 378 } 379 380 ?> 381 382 <li><?php echo(sprintf(esc_html__('Postponing from %s (GMT: %s) to %s (GMT: %s) for %s - %s', 'postpone-posts'), 383 self::formatDateShort($post->post_date), 384 self::formatDateShort($post->post_date_gmt), 385 self::formatDateShort($postUpdate['post_date']), 386 self::formatDateShort($postUpdate['post_date_gmt']), 387 $post->post_title, 388 $message 389 )); ?></li> 390 391 <?php 392 393 } 394 395 ?> 396 397 </ul> 398 399 <p> 400 <?php echo(esc_html__('Finished postponing:', 'postpone-posts')); ?> 401 <?php echo(sprintf(_n( 402 '%d successfully postponed post and', 403 '%d successfully postponed posts and', 404 $count_success, 405 'postpone-posts' 406 ), 407 number_format_i18n($count_success))); ?> 408 <?php echo(sprintf(_n( 409 '%d error', 410 '%d errors', 411 $count_error, 412 'postpone-posts' 413 ), 414 number_format_i18n($count_error))); ?> 415 </p> 416 417 <?php 386 418 387 419 } … … 438 470 439 471 $postDate = new DateTime($theDate); 440 return $postDate->format("Y-m-d");472 return date_i18n(get_option('date_format'), $postDate->getTimestamp()); 441 473 442 474 } … … 477 509 add_settings_section( 478 510 self::ID_SETTINGS_SECTION_DAYS, // section id 479 __('Basic configuration', self::ID), // title511 __('Basic configuration', 'postpone-posts'), // title 480 512 'PostponePosts::showSettingsSectionDays', // function to display settings section 481 513 self::ID_SETTING_GROUP // option group id … … 484 516 add_settings_field( 485 517 self::ID_SETTINGS_FIELD_DAYS, // field id (only used internally) 486 __('Days to postpone', self::ID), // title518 __('Days to postpone', 'postpone-posts'), // title 487 519 'PostponePosts::showSettingsFieldDays', // function to display field input form 488 520 self::ID_SETTING_GROUP, // option group id … … 494 526 'max_value' => self::DAYS_MAX, 495 527 'default_value' => self::OPTION_DAYS_DEFAULT, 496 'description' => __('Default number of days to postpone. Can be overriden for each postponing operation.', self::ID)528 'description' => __('Default number of days to postpone. Can be overriden for each postponing operation.', 'postpone-posts') 497 529 ] 498 530 ); … … 510 542 ?> 511 543 512 <p><?php echo( __('Set the default number of days to postpone in this section.', self::ID)); ?></p>544 <p><?php echo(esc_html__('Set the default number of days to postpone in this section.', 'postpone-posts')); ?></p> 513 545 514 546 <?php … … 571 603 <h1><?php echo(esc_html(get_admin_page_title())); ?></h1> 572 604 573 <p><?php echo(sprintf( __('%s postpones all future (planned) posts by a selectable number of days.'), self::PLUGIN_NAME)); ?></p>605 <p><?php echo(sprintf(esc_html__('%s postpones all future (planned) posts by a selectable number of days.', 'postpone-posts'), self::PLUGIN_NAME)); ?></p> 574 606 575 607 <form action="options.php" method="post"> … … 636 668 self::ID_SETTINGS_FIELD_DAYS, 637 669 self::ID_SETTINGS_FIELD_DAYS, 638 sprintf( __('"%s" is no numeric value.', self::ID), $theInput)670 sprintf(esc_html__('"%s" is no numeric value.', 'postpone-posts'), $theInput) 639 671 ); 640 672 return false; … … 646 678 self::ID_SETTINGS_FIELD_DAYS, 647 679 self::ID_SETTINGS_FIELD_DAYS, 648 sprintf( __('"%d" is smaller than the minimal number of days (%d).', self::ID), $theInput, self::DAYS_MIN)680 sprintf(esc_html__('"%d" is smaller than the minimal number of days (%d).', 'postpone-posts'), number_format_i18n($theInput), number_format_i18n(self::DAYS_MIN)) 649 681 ); 650 682 return false; … … 656 688 self::ID_SETTINGS_FIELD_DAYS, 657 689 self::ID_SETTINGS_FIELD_DAYS, 658 sprintf( __('"%d" is larger than the maximal number of days (%d).', self::ID), $theInput, self::DAYS_MAX)690 sprintf(esc_html__('"%d" is larger than the maximal number of days (%d).', 'postpone-posts'), number_format_i18n($theInput), number_format_i18n(self::DAYS_MAX)) 659 691 ); 660 692 return false; … … 664 696 return true; 665 697 698 } 699 700 /** 701 * Load plugin textdomain. 702 */ 703 function loadTextdomain() { 704 load_plugin_textdomain('postpone-posts', false, dirname(plugin_basename(__FILE__)) . '/languages'); 666 705 } 667 706 … … 678 717 add_action('admin_menu', 'PostponePosts::addOptionsPage'); 679 718 719 add_action('plugins_loaded', 'PostponePosts::loadTextdomain'); 720 680 721 add_filter('contextual_help', 'PostponePosts::addContextHelp', 5, 3); 681 722 -
postpone-posts/trunk/readme.txt
r1788282 r1791260 6 6 Tested up to: 4.9.1 7 7 Requires PHP: 5.2.4 8 Stable tag: 0.2.08 Stable tag: 1.0.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 == Description == 16 16 17 Imagine you wrote a lot of p lanned posts that will be published in the future. Now an event occurs that forces you to react for one or more days. Either there are overlapping posts or you have to postpone (i.e. reschedule) all your future posts.17 Imagine you wrote a lot of posts that you planned to publish in the future. Now an event occurs that forces you to change your plans. Either there are overlapping posts or you have to postpone (i.e. reschedule) all your future posts. 18 18 19 19 This is where *Postpone Posts* comes in handy. It takes all planned posts and postpones them by a selectable number of days. … … 34 34 = Can I postpone just some posts? = 35 35 36 No, currently there is no selection of posts to postpone.36 No, you can only postpone all planned posts. 37 37 38 38 … … 47 47 == Changelog == 48 48 49 = 0.2.0 =49 = 1.0.0 = 50 50 51 * first stable version 52 * basic functionality 51 53 * settings page for default number of days to postpone 52 * improved error messages 53 * consolidated texts and titles 54 55 = 0.1.0 = 56 57 * first version of the plugin 58 * basic functionality 54 * localization and internationalization 55 * banner and icon 59 56 * not tested against misuse concerning roles, capabilities etc. (see ToDo) 60 57 … … 62 59 == Upgrade Notice == 63 60 64 = 0.2.0 = 65 66 * no special upgrade procedure needed 67 68 = 0.1.0 = 69 70 * first version, no upgrade possible 61 = 1.0.0 = 71 62 72 63 … … 86 77 * nicer preview of postpone dates and posts on start page 87 78 * interactive preview of postpone dates and posts on start page 88 * localization89 79 * better context help 90 80 … … 94 84 * can only users postpone their own posts? 95 85 * can admin postpone all posts? 96 97 = Technics =98 99 * use WP functions for displaying special texts
Note: See TracChangeset
for help on using the changeset viewer.