当前位置: 首页>>代码示例>>PHP>>正文


PHP bp_docs_is_doc_create函数代码示例

本文整理汇总了PHP中bp_docs_is_doc_create函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_docs_is_doc_create函数的具体用法?PHP bp_docs_is_doc_create怎么用?PHP bp_docs_is_doc_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bp_docs_is_doc_create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bp_docs_template_include

/**
 * Possibly intercept the template being loaded
 *
 * Listens to the 'template_include' filter and waits for a BP Docs post_type
 * to appear. When one is found, we look to see whether the current theme provides
 * its own version of the template; otherwise we fall back on the template shipped
 * with BuddyPress Docs.
 *
 * @since 1.2
 *
 * @param string $template
 *
 * @return string The path to the template file that is being used
 */
function bp_docs_template_include($template = '')
{
    if (bp_docs_is_single_doc() && ($new_template = bp_docs_locate_template('single-bp_doc.php'))) {
    } elseif (bp_docs_is_doc_create() && ($new_template = bp_docs_locate_template('single-bp_doc.php'))) {
    } elseif (is_post_type_archive(bp_docs_get_post_type_name()) && ($new_template = bp_docs_locate_template('archive-bp_doc.php'))) {
    }
    // Custom template file exists
    $template = !empty($new_template) ? $new_template : $template;
    return apply_filters('bp_docs_template_include', $template);
}
开发者ID:hscale,项目名称:webento,代码行数:24,代码来源:theme-bridge.php

示例2: 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');
     }
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:18,代码来源:component.php

示例3: rw_bp_docs_redirect_fallback

/**
 * Nach dem speichern eines neuen Artikels nicht automatisch auf die Lesen Seite wechseln.
 */
function rw_bp_docs_redirect_fallback($status, $url)
{
    if (function_exists('bp_docs_is_doc_create') && bp_docs_is_doc_create() && !empty($_POST['doc-edit-submit'])) {
        header("Location: " . $url . '/edit', true, $status);
        die;
    }
    return $status;
}
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:11,代码来源:rw_functions.php

示例4: bp_docs_folders_meta_box

/**
 * Add the meta box to the edit page.
 *
 * @since 1.9
 */
function bp_docs_folders_meta_box()
{
    $doc_id = get_the_ID();
    $associated_group_id = bp_is_active('groups') ? bp_docs_get_associated_group_id($doc_id) : 0;
    if (!$associated_group_id && isset($_GET['group'])) {
        $group_id = BP_Groups_Group::get_id_from_slug(urldecode($_GET['group']));
        if (current_user_can('bp_docs_associate_with_group', $group_id)) {
            $associated_group_id = $group_id;
        }
    }
    // On the Create screen, respect the 'folder' $_GET param
    if (bp_docs_is_doc_create()) {
        $folder_id = bp_docs_get_current_folder_id();
    } else {
        $folder_id = bp_docs_get_doc_folder($doc_id);
    }
    ?>

	<div id="doc-folders" class="doc-meta-box">
		<div class="toggleable <?php 
    bp_docs_toggleable_open_or_closed_class();
    ?>
">
			<p id="folders-toggle-edit" class="toggle-switch">
				<span class="hide-if-js toggle-link-no-js"><?php 
    _e('Folders', 'bp-docs');
    ?>
</span>
				<a class="hide-if-no-js toggle-link" id="folders-toggle-link" href="#"><span class="show-pane plus-or-minus"></span><span class="toggle-title"><?php 
    _e('Folders', 'bp-docs');
    ?>
</span></a>
			</p>

			<div class="toggle-content">
				<table class="toggle-table" id="toggle-table-tags">
					<tr>
						<td class="desc-column">
							<label for="bp_docs_tag"><?php 
    _e('Select a folder for this Doc.', 'bp-docs');
    ?>
</label>
						</td>

						<td>
							<div class="existing-or-new-selector">
								<input type="radio" name="existing-or-new-folder" id="use-existing-folder" value="existing" checked="checked" />
								<label for="use-existing-folder" class="radio-label"><?php 
    _e('Use an existing folder', 'bp-docs');
    ?>
</label><br />
								<div class="selector-content">
									<?php 
    bp_docs_folder_selector(array('name' => 'bp-docs-folder', 'id' => 'bp-docs-folder', 'group_id' => $associated_group_id, 'selected' => $folder_id));
    ?>
								</div>
							</div>

							<div class="existing-or-new-selector" id="new-folder-block">
								<input type="radio" name="existing-or-new-folder" id="create-new-folder" value="new" />
								<label for="create-new-folder" class="radio-label"><?php 
    _e('Create a new folder', 'bp-docs');
    ?>
</label>
								<div class="selector-content">

									<?php 
    bp_docs_create_new_folder_markup(array('group_id' => $associated_group_id, 'selected' => $associated_group_id));
    ?>
								</div><!-- .selector-content -->
							</div>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>

	<?php 
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:85,代码来源:addon-folders.php

示例5: map_meta_cap

 /**
  * Give users the 'upload_files' cap, when appropriate
  *
  * @since 1.4
  *
  * @param array $caps The mapped caps
  * @param string $cap The cap being mapped
  * @param int $user_id The user id in question
  * @param $args
  * @return array $caps
  */
 public static function map_meta_cap($caps, $cap, $user_id, $args)
 {
     if ('upload_files' !== $cap) {
         return $caps;
     }
     $maybe_user = new WP_User($user_id);
     if (!is_a($maybe_user, 'WP_User') || empty($maybe_user->ID)) {
         return $caps;
     }
     $is_doc = false;
     // DOING_AJAX is not set yet, so we cheat
     $is_ajax = isset($_SERVER['REQUEST_METHOD']) && 'POST' === $_SERVER['REQUEST_METHOD'] && 'async-upload.php' === substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/') + 1);
     if ($is_ajax) {
         // Clean up referer
         $referer = $_SERVER['HTTP_REFERER'];
         $qp = strpos($referer, '?');
         if (false !== $qp) {
             $referer = substr($referer, 0, $qp);
         }
         $referer = trailingslashit($referer);
         // Existing Doc
         $item_id = self::get_doc_id_from_url($referer);
         if ($item_id) {
             $item = get_post($item_id);
             $is_doc = bp_docs_get_post_type_name() === $item->post_type;
         }
         // Create Doc
         if (!$is_doc) {
             $is_doc = $referer === bp_docs_get_create_link();
         }
     } else {
         $is_doc = bp_docs_is_existing_doc() || bp_docs_is_doc_create();
     }
     if ($is_doc) {
         $caps = array('exist');
         // Since we've already done the permissions check,
         // we can filter future current_user_can() checks on
         // this pageload
         add_filter('map_meta_cap', array(__CLASS__, 'map_meta_cap_supp'), 10, 4);
     }
     return $caps;
 }
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:53,代码来源:attachments.php

示例6: 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));
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:31,代码来源:bp-docs.php

示例7: user_can

 /**
  * Determine whether a user can edit the group doc in question
  *
  * @since 1.0-beta
  *
  * @param bool $user_can The default perms passed from bp_docs_user_can_edit()
  * @param str $action At the moment, 'edit', 'manage', 'create', 'read'
  * @param int $user_id The user id whose perms are being tested
  * @param int $doc_id Optional. The id of the doc being checked. Defaults to current
  */
 function user_can($user_can, $action, $user_id, $doc_id = false)
 {
     global $bp, $post;
     // If a doc_id is provided, check it against the current post before querying
     if ($doc_id && isset($post->ID) && $doc_id == $post->ID) {
         $doc = $post;
     }
     if (empty($post->ID)) {
         $doc = !empty($bp->bp_docs->current_post) ? $bp->bp_docs->current_post : false;
     }
     // Keep on trying to set up a post
     if (empty($doc)) {
         $doc = bp_docs_get_current_doc();
     }
     // If we still haven't got a post by now, query based on doc id
     if (empty($doc) && !empty($doc_id)) {
         $doc = get_post($doc_id);
     }
     if (!empty($doc)) {
         $doc_settings = bp_docs_get_doc_settings($doc->ID);
         // Manage settings don't always get set on doc creation, so we need a default
         if (empty($doc_settings['manage'])) {
             $doc_settings['manage'] = 'creator';
         }
         // Likewise with view_history
         if (empty($doc_settings['view_history'])) {
             $doc_settings['view_history'] = 'anyone';
         }
         // Likewise with read_comments
         if (empty($doc_settings['read_comments'])) {
             $doc_settings['read_comments'] = 'anyone';
         }
     } else {
         if (bp_docs_is_doc_create() && 'manage' == $action) {
             // Anyone can do anything during doc creation
             return true;
         }
     }
     // Default to the current group, but get the associated doc if not
     $group_id = bp_get_current_group_id();
     if (!$group_id && !empty($doc)) {
         $group_id = bp_docs_get_associated_group_id($doc->ID, $doc);
         $group = groups_get_group(array('group_id' => $group_id));
     }
     if (!$group_id) {
         return $user_can;
     }
     switch ($action) {
         case 'associate_with_group':
             $group_settings = bp_docs_get_group_settings($group_id);
             // Provide a default value for legacy backpat
             if (empty($group_settings['can-create'])) {
                 $group_settings['can-create'] = 'member';
             }
             if (!empty($group_settings['can-create'])) {
                 switch ($group_settings['can-create']) {
                     case 'admin':
                         if (groups_is_user_admin($user_id, $group_id)) {
                             $user_can = true;
                         }
                         break;
                     case 'mod':
                         if (groups_is_user_mod($user_id, $group_id) || groups_is_user_admin($user_id, $group_id)) {
                             $user_can = true;
                         }
                         break;
                     case 'member':
                     default:
                         if (groups_is_user_member($user_id, $group_id)) {
                             $user_can = true;
                         }
                         break;
                 }
             }
             break;
         case 'read':
         case 'delete':
             // Delete and Edit are the same for the time being
         // Delete and Edit are the same for the time being
         case 'edit':
         default:
             // Delete defaults to Edit for now
             if ('delete' == $action) {
                 $action = 'edit';
             }
             // Make sure there's a default
             if (empty($doc_settings[$action])) {
                 if (!empty($group_id)) {
                     $doc_settings[$action] = 'group-members';
                 } else {
//.........这里部分代码省略.........
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:101,代码来源:integration-groups.php

示例8: map_meta_cap

 /**
  * Give users the 'edit_post' and 'upload_files' cap, when appropriate
  *
  * @since 1.4
  *
  * @param array $caps The mapped caps
  * @param string $cap The cap being mapped
  * @param int $user_id The user id in question
  * @param $args
  * @return array $caps
  */
 public static function map_meta_cap($caps, $cap, $user_id, $args)
 {
     if ('upload_files' !== $cap && 'edit_post' !== $cap) {
         return $caps;
     }
     $maybe_user = new WP_User($user_id);
     if (!is_a($maybe_user, 'WP_User') || empty($maybe_user->ID)) {
         return $caps;
     }
     $is_doc = false;
     // DOING_AJAX is not set yet, so we cheat
     $is_ajax = isset($_SERVER['REQUEST_METHOD']) && 'POST' === $_SERVER['REQUEST_METHOD'] && 'async-upload.php' === substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], '/') + 1);
     if ($is_ajax) {
         // WordPress sends the 'media-form' nonce, which we use
         // as an initial screen
         $nonce = isset($_REQUEST['_wpnonce']) ? stripslashes($_REQUEST['_wpnonce']) : '';
         $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : '';
         if (wp_verify_nonce($nonce, 'media-form') && $post_id) {
             $post = get_post($post_id);
             // The dummy Doc created during the Create
             // process should pass this test, in addition to
             // existing Docs
             $is_doc = isset($post->post_type) && bp_docs_get_post_type_name() === $post->post_type;
         }
     } else {
         $is_doc = bp_docs_is_existing_doc() || bp_docs_is_doc_create();
     }
     if ($is_doc) {
         $caps = array('exist');
         // Since we've already done the permissions check,
         // we can filter future current_user_can() checks on
         // this pageload
         add_filter('map_meta_cap', array(__CLASS__, 'map_meta_cap_supp'), 10, 4);
     }
     return $caps;
 }
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:47,代码来源:attachments.php

示例9: 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')));
     }
 }
开发者ID:hscale,项目名称:webento,代码行数:35,代码来源:component.php

示例10: bp_docs_create_button

/**
 * Echoes the Create A Doc button
 *
 * @since 1.2
 */
function bp_docs_create_button()
{
    if (!bp_docs_is_doc_create() && bp_docs_current_user_can('create')) {
        echo '<a class="button" id="bp-create-doc-button" href="' . bp_docs_get_create_link() . '">' . __("Create New Doc", 'bp-docs') . '</a>';
    }
}
开发者ID:hscale,项目名称:webento,代码行数:11,代码来源:templatetags.php

示例11:

<?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>
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:18,代码来源:attachments.php

示例12: 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 (bp_docs_current_user_can('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;
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:21,代码来源:templatetags.php

示例13: 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);
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:50,代码来源:bp-docs.php

示例14: 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">
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:31,代码来源:buddypress-sidewide.php

示例15: 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'));
             }
         }
     }
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:42,代码来源:theme-bridge.php


注:本文中的bp_docs_is_doc_create函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。