本文整理汇总了PHP中TribeEvents::getPostTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents::getPostTypes方法的具体用法?PHP TribeEvents::getPostTypes怎么用?PHP TribeEvents::getPostTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TribeEvents
的用法示例。
在下文中一共展示了TribeEvents::getPostTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_post
/**
* Run the caching functionality that is executed on save post.
*
* @param int $post_id The post_id.
* @param WP_Post $post The current post object being saved.
*/
public function save_post($post_id, $post)
{
if (in_array($post->post_type, TribeEvents::getPostTypes())) {
$this->cache->set_last_occurrence('save_post');
}
}
示例2: userCanEdit
/**
* Determine if the specified user can edit the specified post.
*
* @param int|null $id The current post ID.
* @param string $post_type The post type.
* @return bool Whether the use has the permissions to edit a given post.
* @author Nick Ciske
* @since 1.0
* @deprecated since version 3.1
*/
public function userCanEdit($id = null, $post_type = null)
{
// if we're talking about a specific post, use standard WP permissions
if ($id) {
return current_user_can('edit_post', $id);
}
if (empty($post_type) || !is_user_logged_in()) {
return FALSE;
}
// only supports Tribe Post Types
if (!in_array($post_type, TribeEvents::getPostTypes())) {
return false;
}
// admin override
if (is_super_admin() || current_user_can('manage_options')) {
return true;
}
return $this->allowUsersToEditSubmissions;
}