本文整理汇总了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;
}
示例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);
?>
示例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();
}
示例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