當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wp_revisions_to_keep函數代碼示例

本文整理匯總了PHP中wp_revisions_to_keep函數的典型用法代碼示例。如果您正苦於以下問題:PHP wp_revisions_to_keep函數的具體用法?PHP wp_revisions_to_keep怎麽用?PHP wp_revisions_to_keep使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wp_revisions_to_keep函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wp_revisions_enabled

/**
 * Determine if revisions are enabled for a given post.
 *
 * @since 3.6.0
 *
 * @param WP_Post $post The post object.
 * @return bool True if number of revisions to keep isn't zero, false otherwise.
 */
function wp_revisions_enabled($post)
{
    return wp_revisions_to_keep($post) !== 0;
}
開發者ID:AndreyLanko,項目名稱:perevorot-prozorro-wp,代碼行數:12,代碼來源:revision.php

示例2: post_submit_meta_box


//.........這裏部分代碼省略.........
<?php 
    }
    ?>

</div><!-- .misc-pub-section -->

<?php 
    /* translators: Publish box date format, see http://php.net/date */
    $datef = __('M j, Y @ H:i');
    if (0 != $post->ID) {
        if ('future' == $post->post_status) {
            // scheduled for publishing at a future date
            $stamp = __('Scheduled for: <b>%1$s</b>');
        } elseif ('publish' == $post->post_status || 'private' == $post->post_status) {
            // already published
            $stamp = __('Published on: <b>%1$s</b>');
        } elseif ('0000-00-00 00:00:00' == $post->post_date_gmt) {
            // draft, 1 or more saves, no date specified
            $stamp = __('Publish <b>immediately</b>');
        } elseif (time() < strtotime($post->post_date_gmt . ' +0000')) {
            // draft, 1 or more saves, future date specified
            $stamp = __('Schedule for: <b>%1$s</b>');
        } else {
            // draft, 1 or more saves, date specified
            $stamp = __('Publish on: <b>%1$s</b>');
        }
        $date = date_i18n($datef, strtotime($post->post_date));
    } else {
        // draft (no saves, and thus no date specified)
        $stamp = __('Publish <b>immediately</b>');
        $date = date_i18n($datef, strtotime(current_time('mysql')));
    }
    if (!empty($args['args']['revisions_count'])) {
        $revisions_to_keep = wp_revisions_to_keep($post);
        ?>
<div class="misc-pub-section misc-pub-revisions">
<?php 
        if ($revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count']) {
            echo '<span title="' . esc_attr(sprintf(__('Your site is configured to keep only the last %s revisions.'), number_format_i18n($revisions_to_keep))) . '">';
            printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '+</b>');
            echo '</span>';
        } else {
            printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '</b>');
        }
        ?>
	<a class="hide-if-no-js" href="<?php 
        echo esc_url(get_edit_post_link($args['args']['revision_id']));
        ?>
"><span aria-hidden="true"><?php 
        _ex('Browse', 'revisions');
        ?>
</span> <span class="screen-reader-text"><?php 
        _e('Browse revisions');
        ?>
</span></a>
</div>
<?php 
    }
    if ($can_publish) {
        // Contributors don't get to choose the date of publish
        ?>
<div class="misc-pub-section curtime misc-pub-curtime">
	<span id="timestamp">
	<?php 
        printf($stamp, $date);
        ?>
開發者ID:SayenkoDesign,項目名稱:ividf,代碼行數:67,代碼來源:meta-boxes.php

示例3: revisions_meta_box

    /**
     * Render metabox listing CSS revisions and the themes that correspond to the revisions.
     * Called by safecss_admin
     *
     * @global $post
     * @param array $safecss_post
     * @uses wp_revisions_to_keep
     * @uses WP_Query
     * @uses wp_post_revision_title
     * @uses esc_html
     * @uses add_query_arg
     * @uses menu_page_url
     * @uses wp_reset_query
     * @return string
     */
    static function revisions_meta_box($safecss_post)
    {
        $show_all_revisions = isset($_GET['show_all_rev']);
        if (function_exists('wp_revisions_to_keep')) {
            $max_revisions = wp_revisions_to_keep((object) $safecss_post);
        } else {
            $max_revisions = defined('WP_POST_REVISIONS') && is_numeric(WP_POST_REVISIONS) ? (int) WP_POST_REVISIONS : 25;
        }
        $posts_per_page = $show_all_revisions ? $max_revisions : 6;
        $revisions = new WP_Query(array('posts_per_page' => $posts_per_page, 'post_type' => 'revision', 'post_status' => 'inherit', 'post_parent' => $safecss_post['ID'], 'orderby' => 'date', 'order' => 'DESC'));
        if ($revisions->have_posts()) {
            ?>
			<ul class="post-revisions"><?php 
            global $post;
            while ($revisions->have_posts()) {
                $revisions->the_post();
                ?>
<li>
					<?php 
                echo wp_post_revision_title($post);
                if (!empty($post->post_excerpt)) {
                    echo ' (' . esc_html($post->post_excerpt) . ')';
                }
                ?>
				</li><?php 
            }
            ?>
</ul><?php 
            if ($revisions->found_posts > 6 && !$show_all_revisions) {
                ?>
				<br>
				<a href="<?php 
                echo add_query_arg('show_all_rev', 'true', menu_page_url('editcss', false));
                ?>
"><?php 
                esc_html_e('Show all', 'jetpack');
                ?>
</a>
				<?php 
            }
        }
        wp_reset_query();
    }
開發者ID:pcuervo,項目名稱:wp-carnival,代碼行數:58,代碼來源:custom-css.php

示例4: __

                    $stamp = __('Schedule for: <b>%1$s</b>');
                } else {
                    // draft, 1 or more saves, date specified
                    $stamp = __('Publish on: <b>%1$s</b>');
                }
            }
        }
    }
    $date = date_i18n($datef, strtotime($post->post_date));
} else {
    // draft (no saves, and thus no date specified)
    $stamp = __('Publish <b>immediately</b>');
    $date = date_i18n($datef, strtotime(current_time('mysql')));
}
if (!empty($args['args']['revisions_count'])) {
    $revisions_to_keep = wp_revisions_to_keep($post);
    ?>
        <div class="misc-pub-section misc-pub-revisions">
            <?php 
    if ($revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count']) {
        echo '<span title="' . esc_attr(sprintf(__('Your site is configured to keep only the last %s revisions.'), number_format_i18n($revisions_to_keep))) . '">';
        printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '+</b>');
        echo '</span>';
    } else {
        printf(__('Revisions: %s'), '<b>' . number_format_i18n($args['args']['revisions_count']) . '</b>');
    }
    ?>
            <a class="hide-if-no-js" href="<?php 
    echo esc_url(get_edit_post_link($args['args']['revision_id']));
    ?>
"><span aria-hidden="true"><?php 
開發者ID:johnulist,項目名稱:framework,代碼行數:31,代碼來源:minor.php


注:本文中的wp_revisions_to_keep函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。