本文整理汇总了PHP中bp_docs_is_doc_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_docs_is_doc_edit函数的具体用法?PHP bp_docs_is_doc_edit怎么用?PHP bp_docs_is_doc_edit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_docs_is_doc_edit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_docs_edit_lock_redirect
/**
* Prevent a user from visiting the Edit page if it's locked.
*
* @since 1.6.0
*/
function bp_docs_edit_lock_redirect()
{
if (!bp_docs_is_doc_edit()) {
return;
}
$doc_id = get_queried_object_id();
$lock = bp_docs_check_post_lock($doc_id);
if (!empty($lock) && $lock != bp_loggedin_user_id()) {
$bounce = bp_docs_get_doc_link($doc_id);
wp_redirect($bounce);
}
}
示例2: bp_docs_doc_link
?>
>
<a href="<?php
bp_docs_doc_link();
?>
"><?php
_e('Read', 'bp-docs');
?>
</a>
</li>
<?php
if (bp_docs_current_user_can('edit')) {
?>
<li<?php
if (bp_docs_is_doc_edit()) {
?>
class="current"<?php
}
?>
>
<a href="<?php
bp_docs_doc_edit_link();
?>
"><?php
_e('Edit', 'bp-docs');
?>
</a>
</li>
<?php
}
示例3: bp_docs_attachment_item_markup
function bp_docs_attachment_item_markup($attachment_id, $format = 'full')
{
$markup = '';
$att_url = bp_docs_get_attachment_url($attachment_id);
$attachment = get_post($attachment_id);
$att_base = basename(get_attached_file($attachment_id));
$doc_url = bp_docs_get_doc_link($attachment->post_parent);
$attachment_ext = preg_replace('/^.+?\\.([^.]+)$/', '$1', $att_url);
if ('full' === $format) {
$attachment_delete_html = '';
if (current_user_can('bp_docs_edit') && (bp_docs_is_doc_edit() || bp_docs_is_doc_create())) {
$attachment_delete_url = wp_nonce_url($doc_url, 'bp_docs_delete_attachment_' . $attachment_id);
$attachment_delete_url = add_query_arg(array('delete_attachment' => $attachment_id), $attachment_delete_url);
$attachment_delete_html = sprintf('<a href="%s" class="doc-attachment-delete confirm button">%s</a> ', $attachment_delete_url, __('Delete', 'buddypress'));
}
$markup = sprintf('<li id="doc-attachment-%d"><span class="doc-attachment-mime-icon doc-attachment-mime-%s"></span><a href="%s" title="%s">%s</a>%s</li>', $attachment_id, $attachment_ext, $att_url, esc_attr($att_base), esc_html($att_base), $attachment_delete_html);
} else {
$markup = sprintf('<li id="doc-attachment-%d"><span class="doc-attachment-mime-icon doc-attachment-mime-%s"></span><a href="%s" title="%s">%s</a></li>', $attachment_id, $attachment_ext, $att_url, esc_attr($att_base), esc_html($att_base));
}
return $markup;
}
示例4: enqueue_styles
/**
* Loads styles
*
* @package BuddyPress Docs
* @since 1.0-beta
*/
function enqueue_styles()
{
global $bp;
// Load the main CSS only on the proper pages
if (in_array(bp_docs_get_docs_slug(), $this->slugstocheck) || bp_docs_is_docs_component()) {
wp_enqueue_style('bp-docs-css', $this->includes_url . 'css/screen.css');
}
if (bp_docs_is_doc_edit() || bp_docs_is_doc_create()) {
wp_enqueue_style('bp-docs-edit-css', $this->includes_url . 'css/edit.css');
wp_enqueue_style('thickbox');
}
}
示例5: is_docs
/**
* Are we looking at something that needs docs theme compatability?
*
* @since 1.3
*/
public function is_docs()
{
// Bail if not looking at the docs component
if (!bp_docs_is_docs_component()) {
return;
}
add_filter('bp_get_template_stack', array($this, 'add_plugin_templates_to_stack'));
add_filter('bp_get_buddypress_template', array($this, 'query_templates'));
if (bp_docs_is_global_directory()) {
bp_update_is_directory(true, 'docs');
do_action('bp_docs_screen_index');
add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'directory_content'));
} else {
if (bp_docs_is_existing_doc()) {
if (bp_docs_is_doc_history()) {
$this->single_content_template = 'docs/single/history';
add_filter('bp_force_comment_status', '__return_false');
} else {
if (bp_docs_is_doc_edit()) {
$this->single_content_template = 'docs/single/edit';
add_filter('bp_force_comment_status', '__return_false');
} else {
$this->single_content_template = 'docs/single/index';
add_filter('bp_docs_allow_comment_section', '__return_false');
}
}
add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'single_content'));
} else {
if (bp_docs_is_doc_create()) {
add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'create_content'));
}
}
}
}
示例6: enqueue_scripts
function enqueue_scripts()
{
if (bp_docs_is_doc_edit() || bp_docs_is_doc_create()) {
wp_enqueue_script('bp-docs-attachments', plugins_url(BP_DOCS_PLUGIN_SLUG . '/includes/js/attachments.js'), array('media-editor', 'media-views'), false, true);
}
}
示例7: enable_more_buttons_2
function enable_more_buttons_2($buttons)
{
if (bp_docs_is_doc_edit() or bp_docs_is_doc_create()) {
$buttons = array('formatselect', 'fontsizeselect', 'undo', 'redo', 'removeformat', 'searchreplace', 'charmap', 'hr', 'link', 'unlink', 'anchor', 'wp_page', 'tabindent', 'image', 'media', 'visualblocks');
}
return $buttons;
}
示例8: is_docs
/**
* Are we looking at something that needs docs theme compatability?
*
* @since 1.3
*/
public function is_docs()
{
$is_docs = bp_docs_is_docs_component();
if (bp_is_active('groups') && bp_is_group() && bp_is_current_action(buddypress()->bp_docs->slug)) {
$is_docs = true;
}
// Bail if not looking at the docs component
if (!$is_docs) {
return;
}
add_filter('bp_get_template_stack', array($this, 'add_plugin_templates_to_stack'));
add_filter('bp_get_buddypress_template', array($this, 'query_templates'));
add_filter('bp_use_theme_compat_with_current_theme', 'bp_docs_do_theme_compat');
if (bp_docs_is_global_directory() || bp_docs_is_mygroups_directory()) {
bp_update_is_directory(true, 'docs');
do_action('bp_docs_screen_index');
add_action('bp_template_include_reset_dummy_post_data', array($this, 'directory_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'directory_content'));
} else {
if (bp_docs_is_existing_doc()) {
if (bp_docs_is_doc_history()) {
$this->single_content_template = 'docs/single/history';
add_filter('bp_force_comment_status', '__return_false');
} else {
if (bp_docs_is_doc_edit()) {
$this->single_content_template = 'docs/single/edit';
add_filter('bp_force_comment_status', '__return_false');
} else {
$this->single_content_template = 'docs/single/index';
add_filter('bp_docs_allow_comment_section', '__return_false');
// Necessary as of BP 1.9.2
remove_action('bp_replace_the_content', 'bp_theme_compat_toggle_is_page', 9999);
}
}
add_action('bp_template_include_reset_dummy_post_data', array($this, 'single_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'single_content'));
} else {
if (bp_docs_is_doc_create()) {
add_action('bp_template_include_reset_dummy_post_data', array($this, 'create_dummy_post'));
add_filter('bp_replace_the_content', array($this, 'create_content'));
}
}
}
}
示例9: protect_doc_access
/**
* Protects group docs from unauthorized access
*
* @since 1.2
*/
function protect_doc_access()
{
// What is the user trying to do?
if (bp_docs_is_doc_read()) {
$action = 'bp_docs_read';
} else {
if (bp_docs_is_doc_create()) {
$action = 'bp_docs_create';
} else {
if (bp_docs_is_doc_edit()) {
$action = 'bp_docs_edit';
} else {
if (bp_docs_is_doc_history()) {
$action = 'bp_docs_view_history';
}
}
}
}
if (!isset($action)) {
return;
}
if (!current_user_can($action)) {
$redirect_to = bp_docs_get_doc_link();
bp_core_no_access(array('mode' => 2, 'redirect' => $redirect_to));
}
}
示例10: enqueue_scripts
function enqueue_scripts()
{
if (bp_docs_is_doc_edit() || bp_docs_is_doc_create()) {
wp_enqueue_script('bp-docs-attachments', plugins_url(BP_DOCS_PLUGIN_SLUG . '/includes/js/attachments.js'), array('media-editor', 'media-views', 'bp-docs-js'), false, true);
wp_localize_script('bp-docs-attachments', 'bp_docs_attachments', array('upload_title' => __('Upload File', 'bp-docs'), 'upload_button' => __('OK', 'bp-docs')));
}
}
示例11: enqueue_scripts
/**
* Loads JavaScript
*
* @package BuddyPress Docs
* @since 1.0-beta
*/
function enqueue_scripts()
{
wp_register_script('bp-docs-js', plugins_url('buddypress-docs/includes/js/bp-docs.js'), array('jquery'));
// This is for edit/create scripts
if (bp_docs_is_doc_edit() || bp_docs_is_doc_create() || !empty($this->query->current_view) && ('edit' == $this->query->current_view || 'create' == $this->query->current_view)) {
require_once ABSPATH . '/wp-admin/includes/post.php';
wp_enqueue_script('common');
wp_enqueue_script('jquery-color');
wp_enqueue_script('editor');
wp_enqueue_script('utils');
wp_register_script('bp-docs-idle-js', plugins_url('buddypress-docs/includes/js/idle.js'), array('jquery', 'bp-docs-js'));
wp_enqueue_script('bp-docs-idle-js');
wp_register_script('jquery-colorbox', plugins_url('buddypress-docs/lib/js/colorbox/jquery.colorbox-min.js'), array('jquery'));
wp_enqueue_script('jquery-colorbox');
// Edit mode requires bp-docs-js to be dependent on TinyMCE, so we must
// reregister bp-docs-js with the correct dependencies
wp_deregister_script('bp-docs-js');
wp_register_script('bp-docs-js', plugins_url('buddypress-docs/includes/js/bp-docs.js'), array('jquery', 'editor'));
wp_register_script('word-counter', site_url() . '/wp-admin/js/word-count.js', array('jquery'));
wp_enqueue_script('bp-docs-edit-validation', plugins_url('buddypress-docs/includes/js/edit-validation.js'), array('jquery'));
}
// Only load our JS on the right sorts of pages. Generous to account for
// different item types
if (in_array(BP_DOCS_SLUG, $this->slugstocheck) || bp_docs_is_single_doc() || bp_docs_is_global_directory()) {
wp_enqueue_script('bp-docs-js');
wp_enqueue_script('comment-reply');
wp_localize_script('bp-docs-js', 'bp_docs', array('still_working' => __('Still working?', 'bp-docs')));
}
}
示例12:
<?php
if (bp_docs_is_doc_edit() || bp_docs_is_doc_create()) {
?>
<?php
bp_docs_media_buttons('doc_content');
}
?>
<ul id="doc-attachments-ul">
<?php
foreach (bp_docs_get_doc_attachments() as $attachment) {
?>
<?php
echo bp_docs_attachment_item_markup($attachment->ID);
}
?>
</ul>
示例13: bp_docs_is_doc_read
/**
* Is the current page a single Doc 'read' view?
*
* By process of elimination.
*
* @since 1.2
* @return bool
*/
function bp_docs_is_doc_read()
{
$is_doc_read = false;
if (bp_docs_is_single_doc() && !bp_docs_is_doc_edit() && (!function_exists('bp_docs_is_doc_history') || !bp_docs_is_doc_history())) {
$is_doc_read = true;
}
return apply_filters('bp_docs_is_doc_read', $is_doc_read);
}
示例14: protect_doc_access
/**
* Protects group docs from unauthorized access
*
* @since 1.2
* @uses bp_docs_current_user_can() This does most of the heavy lifting
*/
function protect_doc_access()
{
// What is the user trying to do?
if (bp_docs_is_doc_read()) {
$action = 'read';
} else {
if (bp_docs_is_doc_create()) {
$action = 'create';
} else {
if (bp_docs_is_doc_edit()) {
$action = 'edit';
} else {
if (bp_docs_is_doc_history()) {
$action = 'view_history';
}
}
}
}
if (!isset($action)) {
return;
}
if (!bp_docs_current_user_can($action)) {
$redirect_to = wp_get_referer();
if (!$redirect_to || trailingslashit($redirect_to) == trailingslashit(wp_guess_url())) {
$redirect_to = bp_get_root_domain();
}
switch ($action) {
case 'read':
$message = __('You are not allowed to read that Doc.', 'bp-docs');
break;
case 'create':
$message = __('You are not allowed to create Docs.', 'bp-docs');
break;
case 'edit':
$message = __('You are not allowed to edit that Doc.', 'bp-docs');
break;
case 'view_history':
$message = __('You are not allowed to view that Doc\'s history.', 'bp-docs');
break;
}
bp_core_add_message($message, 'error');
bp_core_redirect($redirect_to);
}
}
示例15: bp_docs_is_doc_read
<?php
global $class;
$is_group_single_doc = '';
if (function_exists('bp_docs_is_doc_edit')) {
//fix boss code with rw_bp_doc_single_group_id()
$is_group_single_doc = (bp_docs_is_doc_edit() || bp_docs_is_doc_read() || bp_docs_is_doc_create() || bp_docs_is_doc_history()) && rw_bp_doc_single_group_id(false);
}
if ($is_group_single_doc) {
$class .= ' group-single';
}
?>
<?php
// Boxed layout cover
if (boss_get_option('boss_cover_profile')) {
if (boss_get_option('boss_layout_style') == 'boxed' && (!bp_is_current_component('events') || bp_is_current_component('events') && 'profile' == bp_current_action())) {
// show here for boxed and if not Events Manager page or if it is My Profile of Events
if (bp_is_user()) {
echo buddyboss_cover_photo("user", bp_displayed_user_id());
}
}
}
?>
<?php
if (bp_is_current_component('groups') && !bp_is_group() && !bp_is_user()) {
?>
<div class="dir-page-entry">
<div class="inner-padding">
<header class="group-header page-header">