本文整理汇总了PHP中Posts::update_scheduled_posts_cronjob方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::update_scheduled_posts_cronjob方法的具体用法?PHP Posts::update_scheduled_posts_cronjob怎么用?PHP Posts::update_scheduled_posts_cronjob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Posts
的用法示例。
在下文中一共展示了Posts::update_scheduled_posts_cronjob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: undelete_post
/**
* function undelete_post
* This function reverts a post's status from 'deleted' to whatever
* it previously was.
**/
private function undelete_post($post_id)
{
$post = Post::get(array('id' => $post_id, 'status' => Post::status('any')));
if ($post->status == Post::status('deleted')) {
$post->status = $post->info->prior_status ? $post->info->prior_status : Post::status('draft');
unset($post->info->prior_status);
$post->update();
EventLog::log(sprintf(_t('Post %1$s (%2$s) restored.'), $post->id, $post->slug), 'info', 'content', 'habari');
//scheduled post
if ($post->status == Post::status('scheduled')) {
Posts::update_scheduled_posts_cronjob();
}
return true;
} else {
return false;
}
}
示例2: delete
/**
* function delete
* Deletes an existing post
*/
public function delete()
{
$allow = true;
$allow = Plugins::filter( 'post_delete_allow', $allow, $this );
if ( ! $allow ) {
return;
}
// invoke plugins
Plugins::act( 'post_delete_before', $this );
// delete all the tags associated with this post
Tags::save_associations( new Terms(), $this->id );
// Delete all comments associated with this post
if ( $this->comments->count() > 0 ) {
$this->comments->delete();
}
// Delete all info records associated with this post
$this->info->delete_all();
// Delete all post_tokens associated with this post
$this->delete_tokens();
$result = parent::deleteRecord( DB::table( 'posts' ), array( 'slug'=>$this->slug ) );
EventLog::log( sprintf( _t( 'Post %1$s (%2$s) deleted.' ), $this->id, $this->slug ), 'info', 'content', 'habari' );
//scheduled post
if ( $this->status == Post::status( 'scheduled' ) ) {
Posts::update_scheduled_posts_cronjob();
}
// invoke plugins on the after_post_delete action
Plugins::act( 'post_delete_after', $this );
return $result;
}