Plugin Directory

Changeset 1791260


Ignore:
Timestamp:
12/22/2017 12:37:39 PM (8 years ago)
Author:
ekleinod
Message:

files for version 1.0.0

Location:
postpone-posts
Files:
12 added
2 edited

Legend:

Unmodified
Added
Removed
  • postpone-posts/trunk/postpone-posts.php

    r1788282 r1791260  
    44Plugin URI; https://github.com/ekleinod/postpone-posts
    55Description: Postpones all future (planned) posts by a selectable number of days.
    6 Version: 0.2.0
     6Version: 1.0.0
    77Author: Ekkart Kleinod
    88Author URI: http://www.edgesoft.de/
    99License: GPL-3.0
    1010License URI: https://opensource.org/licenses/GPL-3.0
     11Text Domain: postpone-posts
     12Domain Path: /languages
    1113
    1214Postpone Posts is a wordpress plugin that postpones all future (planned) posts by a selectable number of days.
     
    121123            get_current_screen()->add_help_tab(array(
    122124                '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))),
    125129            ));
    126130
     
    169173                        } else {
    170174
    171                             self::printError(__('Unrecognized action.', self::ID));
     175                            self::printError(__('Unrecognized action.', 'postpone-posts'));
    172176                            self::showDaysInputPage($futurePosts);
    173177
     
    215219                    <input type="hidden" name="page" value="<?php echo($plugin_page); ?>" />
    216220
    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>
    220224
    221225                    <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>
    223227                        <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" />
    224228                    </p>
    225229
    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)); ?>"><?php
     230                    <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
    229233
    230234                    foreach ($thePosts as $post) {
     
    241245                            $submit_args['disabled'] = 'disabled';
    242246                        }
    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);
    244248
    245249                    ?>
     
    268272                    <input type="hidden" name="<?php echo(self::INPUT_FIELD_DAYS); ?>" value="<?php echo($theInput); ?>" />
    269273
    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>
    275279
    276280                    <table>
    277281                        <thead>
    278282                            <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>
    282286                            </tr>
    283287                        </thead>
    284288                        <tfoot>
    285289                            <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>
    289293                            </tr>
    290294                        </tfoot>
     
    320324                            $submit_args['disabled'] = 'disabled';
    321325                        }
    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);
    323327
    324328                    ?>
     
    331335
    332336                    <?php
    333                         submit_button('Cancel', 'secondary large', self::ACTION_CANCEL);
     337                        submit_button(esc_html__('Cancel', 'postpone-posts'), 'secondary large', self::ACTION_CANCEL);
    334338                    ?>
    335339                </form>
     
    347351        private static function showActionPage($thePosts, $theInput) {
    348352
    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 = '&check;';
    363                     $count_success++;
    364 
    365                 } else {
    366 
    367                     $message = sprintf('&cross;: %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 = '&check;';
     371                            $count_success++;
     372
     373                        } else {
     374
     375                            $message = sprintf('&cross;: %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
    386418
    387419        }
     
    438470
    439471            $postDate = new DateTime($theDate);
    440             return $postDate->format("Y-m-d");
     472            return date_i18n(get_option('date_format'), $postDate->getTimestamp());
    441473
    442474        }
     
    477509            add_settings_section(
    478510                    self::ID_SETTINGS_SECTION_DAYS, // section id
    479                     __('Basic configuration', self::ID), // title
     511                    __('Basic configuration', 'postpone-posts'), // title
    480512                    'PostponePosts::showSettingsSectionDays', // function to display settings section
    481513                    self::ID_SETTING_GROUP // option group id
     
    484516            add_settings_field(
    485517                    self::ID_SETTINGS_FIELD_DAYS, // field id (only used internally)
    486                     __('Days to postpone', self::ID), // title
     518                    __('Days to postpone', 'postpone-posts'), // title
    487519                    'PostponePosts::showSettingsFieldDays', // function to display field input form
    488520                    self::ID_SETTING_GROUP, // option group id
     
    494526                        'max_value' => self::DAYS_MAX,
    495527                        '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')
    497529                    ]
    498530            );
     
    510542            ?>
    511543
    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>
    513545
    514546            <?php
     
    571603                    <h1><?php echo(esc_html(get_admin_page_title())); ?></h1>
    572604
    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>
    574606
    575607                    <form action="options.php" method="post">
     
    636668                        self::ID_SETTINGS_FIELD_DAYS,
    637669                        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)
    639671                );
    640672                return false;
     
    646678                        self::ID_SETTINGS_FIELD_DAYS,
    647679                        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))
    649681                );
    650682                return false;
     
    656688                        self::ID_SETTINGS_FIELD_DAYS,
    657689                        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))
    659691                );
    660692                return false;
     
    664696            return true;
    665697
     698        }
     699
     700        /**
     701         * Load plugin textdomain.
     702         */
     703        function loadTextdomain() {
     704            load_plugin_textdomain('postpone-posts', false, dirname(plugin_basename(__FILE__)) . '/languages');
    666705        }
    667706
     
    678717    add_action('admin_menu', 'PostponePosts::addOptionsPage');
    679718
     719    add_action('plugins_loaded', 'PostponePosts::loadTextdomain');
     720
    680721    add_filter('contextual_help', 'PostponePosts::addContextHelp', 5, 3);
    681722
  • postpone-posts/trunk/readme.txt

    r1788282 r1791260  
    66Tested up to: 4.9.1
    77Requires PHP: 5.2.4
    8 Stable tag: 0.2.0
     8Stable tag: 1.0.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1515== Description ==
    1616
    17 Imagine you wrote a lot of planned 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.
     17Imagine 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.
    1818
    1919This is where *Postpone Posts* comes in handy. It takes all planned posts and postpones them by a selectable number of days.
     
    3434= Can I postpone just some posts? =
    3535
    36 No, currently there is no selection of posts to postpone.
     36No, you can only postpone all planned posts.
    3737
    3838
     
    4747== Changelog ==
    4848
    49 = 0.2.0 =
     49= 1.0.0 =
    5050
     51* first stable version
     52* basic functionality
    5153* 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
    5956* not tested against misuse concerning roles, capabilities etc. (see ToDo)
    6057
     
    6259== Upgrade Notice ==
    6360
    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 =
    7162
    7263
     
    8677* nicer preview of postpone dates and posts on start page
    8778* interactive preview of postpone dates and posts on start page
    88 * localization
    8979* better context help
    9080
     
    9484    * can only users postpone their own posts?
    9585    * 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.