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


PHP bp_docs_get_docs_slug函数代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @since 1.0-beta
  */
 public function __construct()
 {
     global $bp;
     $bp_docs_tab_name = bp_docs_get_group_tab_name();
     if (!empty($bp->groups->current_group->id)) {
         $this->maybe_group_id = $bp->groups->current_group->id;
     } else {
         if (!empty($bp->groups->new_group_id)) {
             $this->maybe_group_id = $bp->groups->new_group_id;
         } else {
             $this->maybe_group_id = false;
         }
     }
     // Load the bp-docs setting for the group, for easy access
     $this->settings = bp_docs_get_group_settings($this->maybe_group_id);
     $this->group_enable = !empty($this->settings['group-enable']) ? true : false;
     $this->name = !empty($bp_docs_tab_name) ? $bp_docs_tab_name : __('Docs', 'bp-docs');
     $this->slug = bp_docs_get_docs_slug();
     $this->enable_create_step = $this->enable_create_step();
     $this->create_step_position = 18;
     $this->nav_item_position = 45;
     $this->visibility = 'public';
     $this->enable_nav_item = $this->enable_nav_item();
     // Create some default settings if the create step is skipped
     if (apply_filters('bp_docs_force_enable_at_group_creation', false)) {
         add_action('groups_created_group', array(&$this, 'enable_at_group_creation'));
     }
     // Backward compatibility for group-based Doc URLs
     add_action('bp_actions', array($this, 'url_backpat'));
 }
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:35,代码来源:integration-groups.php

示例2: slug_setting_markup

    public function slug_setting_markup()
    {
        global $bp;
        $slug = bp_docs_get_docs_slug();
        $is_in_wp_config = 1 === $bp->bp_docs->slug_defined_in_wp_config['slug'];
        ?>
		<input name="bp-docs-slug" id="bp-docs-slug" type="text" value="<?php 
        echo esc_html($slug);
        ?>
" <?php 
        if ($is_in_wp_config) {
            ?>
disabled="disabled" <?php 
        }
        ?>
/>
		<p class="description"><?php 
        _e("Change the slug used to build Docs URLs.", 'bp-docs');
        if ($is_in_wp_config) {
            ?>
 <?php 
            _e('You have already defined this value in <code>wp-config.php</code>, so it cannot be edited here.', 'bp-docs');
        }
        ?>
</p>

		<?php 
    }
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:28,代码来源:admin.php

示例3: 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

示例4: bp_docs_get_displayed_user_docs_edited_link

/**
 * Get the link to the Edited By tab of the displayed user
 *
 * @package BuddyPress_Docs
 * @since 1.9
 */
function bp_docs_get_displayed_user_docs_edited_link()
{
    return apply_filters('bp_docs_get_displayed_user_docs_edited_link', user_trailingslashit(trailingslashit(bp_displayed_user_domain() . bp_docs_get_docs_slug()) . BP_DOCS_EDITED_SLUG));
}
开发者ID:ExpectancyLearning,项目名称:buddypress-docs,代码行数:10,代码来源:templatetags.php

示例5: bp_docs_process_folder_create_cb

/**
 * Process folder creation from manage-folders.
 */
function bp_docs_process_folder_create_cb()
{
    if (!bp_docs_is_docs_component() && !bp_is_current_action(bp_docs_get_docs_slug())) {
        return;
    }
    if (!bp_docs_is_folder_manage_view()) {
        return;
    }
    if (empty($_POST['bp-docs-create-folder-submit'])) {
        return;
    }
    $nonce = isset($_POST['bp-docs-create-folder-nonce']) ? stripslashes($_POST['bp-docs-create-folder-nonce']) : '';
    $redirect_url = bp_get_requested_url();
    if (!wp_verify_nonce($nonce, 'bp-docs-create-folder')) {
        bp_core_add_message(__('There was a problem editing that folder. Please try again.', 'bp-docs'), 'error');
        bp_core_redirect($redirect_url);
        die;
    }
    $folder_args = array('name' => stripslashes($_POST['new-folder']));
    $parent = isset($_POST['new-folder-parent']) ? intval($_POST['new-folder-parent']) : null;
    if (!empty($parent)) {
        $folder_args['parent'] = $parent;
    }
    // If there's a parent, the parent's folder type takes precedence
    if (!empty($parent)) {
        $folder_args['group_id'] = bp_docs_get_folder_group($parent);
        $folder_args['user_id'] = bp_docs_get_folder_user($parent);
        // Otherwise, trust the values passed
    } else {
        // Type
        $folder_type = stripslashes($_POST['new-folder-type']);
        if ('global' === $folder_type) {
            // Nothing to do
        } else {
            if ('me' === $folder_type) {
                $folder_args['user_id'] = bp_loggedin_user_id();
            } else {
                if (is_numeric($folder_type)) {
                    // This is a group
                    $folder_args['group_id'] = intval($folder_type);
                }
            }
        }
    }
    // Create the folder
    // @todo permissions checks
    $success = bp_docs_create_folder($folder_args);
    if (!empty($success) && !is_wp_error($success)) {
        bp_core_add_message(__('Folder successfully created.', 'bp-docs'), 'success');
    } else {
        bp_core_add_message(__('There was a problem creating the folder. Please try again.', 'bp-docs'), 'error');
    }
    bp_core_redirect($redirect_url);
    die;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:58,代码来源:addon-folders.php

示例6: save


//.........这里部分代码省略.........
             // If there's a 'doc_id' value in the POST, use
             // the autodraft as a starting point
             if (isset($_POST['doc_id']) && 0 != $_POST['doc_id']) {
                 $post_id = (int) $_POST['doc_id'];
                 $r['ID'] = $post_id;
                 wp_update_post($r);
             } else {
                 $post_id = wp_insert_post($r);
             }
             if (!$post_id) {
                 $result['message'] = __('There was an error when creating the doc.', 'bp-docs');
                 $result['redirect'] = 'create';
             } else {
                 $this->doc_id = $post_id;
                 $the_doc = get_post($this->doc_id);
                 $this->doc_slug = $the_doc->post_name;
                 // A normal, successful save
                 $result['message'] = __('Doc successfully created!', 'bp-docs');
                 $result['redirect'] = 'single';
             }
         } else {
             $this->is_new_doc = false;
             $doc = bp_docs_get_current_doc();
             $this->doc_id = $doc->ID;
             $r['ID'] = $this->doc_id;
             // Make sure the post_name is set
             if (empty($r['post_name'])) {
                 $r['post_name'] = sanitize_title($r['post_title']);
             }
             // Make sure the post_name is unique
             $r['post_name'] = wp_unique_post_slug($r['post_name'], $this->doc_id, $r['post_status'], $this->post_type_name, $doc->post_parent);
             $this->doc_slug = $r['post_name'];
             // Save pre-update post data, for comparison by callbacks.
             $this->previous_revision = clone $doc;
             if (!wp_update_post($r)) {
                 $result['message'] = __('There was an error when saving the doc.', 'bp-docs');
                 $result['redirect'] = 'edit';
             } else {
                 // Remove the edit lock
                 delete_post_meta($this->doc_id, '_edit_lock');
                 delete_post_meta($this->doc_id, '_bp_docs_last_pinged');
                 // When the post has been autosaved, we need to leave a
                 // special success message
                 if (!empty($_POST['is_auto']) && $_POST['is_auto']) {
                     $result['message'] = __('You idled a bit too long while in Edit mode. In order to allow others to edit the doc you were working on, your changes have been autosaved. Click the Edit button to return to Edit mode.', 'bp-docs');
                 } else {
                     // A normal, successful save
                     $result['message'] = __('Doc successfully edited!', 'bp-docs');
                 }
                 $result['redirect'] = 'single';
             }
             $post_id = $this->doc_id;
         }
     }
     // If the Doc was successfully created, run some more stuff
     if (!empty($post_id)) {
         // Add to a group, if necessary
         if (!is_null($associated_group_id)) {
             bp_docs_set_associated_group_id($post_id, $associated_group_id);
         }
         // Make sure the current user is added as one of the authors
         wp_set_post_terms($post_id, $this->user_term_id, $this->associated_item_tax_name, true);
         // Save the last editor id. We'll use this to create an activity item
         update_post_meta($this->doc_id, 'bp_docs_last_editor', bp_loggedin_user_id());
         // Save settings
         bp_docs_save_doc_access_settings($this->doc_id);
         // Increment the revision count
         $revision_count = get_post_meta($this->doc_id, 'bp_docs_revision_count', true);
         update_post_meta($this->doc_id, 'bp_docs_revision_count', intval($revision_count) + 1);
     }
     // Provide a custom hook for plugins and optional components.
     // WP's default save_post isn't enough, because we need something that fires
     // only when we save from the front end (for things like taxonomies, which
     // the WP admin handles automatically)
     do_action('bp_docs_doc_saved', $this);
     do_action('bp_docs_after_save', $this->doc_id);
     $message_type = $result['redirect'] == 'single' ? 'success' : 'error';
     // Stuff data into a cookie so it can be accessed on next page load
     if ('error' === $message_type) {
         setcookie('bp-docs-submit-data', json_encode($_POST), time() + 30, '/');
     }
     $redirect_base = trailingslashit(bp_get_root_domain());
     if ($wp_rewrite->using_index_permalinks()) {
         $redirect_base .= 'index.php/';
     }
     $redirect_url = apply_filters('bp_docs_post_save_redirect_base', trailingslashit($redirect_base . bp_docs_get_docs_slug()));
     if ($result['redirect'] == 'single') {
         $redirect_url .= $this->doc_slug;
     } else {
         if ($result['redirect'] == 'edit') {
             $redirect_url .= $this->doc_slug . '/' . BP_DOCS_EDIT_SLUG;
         } else {
             if ($result['redirect'] == 'create') {
                 $redirect_url .= BP_DOCS_CREATE_SLUG;
             }
         }
     }
     $retval = array('message_type' => $message_type, 'message' => $result['message'], 'redirect_url' => $redirect_url);
     return $retval;
 }
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:101,代码来源:query-builder.php

示例7: flush_rewrite_rules

 function flush_rewrite_rules()
 {
     if (!is_admin()) {
         return;
     }
     if (!is_super_admin()) {
         return;
     }
     global $wp_rewrite;
     // Check to see whether our rules have been registered yet, by
     // finding a Docs rule and then comparing it to the registered rules
     $test_rewrite = null;
     foreach ($wp_rewrite->extra_rules_top as $rewrite => $rule) {
         if (0 === strpos($rewrite, bp_docs_get_docs_slug())) {
             $test_rewrite = $rewrite;
             $test_rule = $rule;
             break;
         }
     }
     $registered_rules = get_option('rewrite_rules');
     if ($test_rewrite && is_array($registered_rules) && (!isset($registered_rules[$test_rewrite]) || $test_rule !== $registered_rules[$test_rewrite])) {
         flush_rewrite_rules();
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:24,代码来源:bp-docs.php

示例8: bp_docs_get_tag_link

/**
 * Get an archive link for a given tag
 *
 * Optional arguments:
 *  - 'tag' 	The tag linked to. This one is required
 *  - 'type' 	'html' returns a link; anything else returns a URL
 *
 * @since 1.0-beta
 *
 * @param array $args Optional arguments
 * @return array $filters
 */
function bp_docs_get_tag_link($args = array())
{
    global $bp;
    $defaults = array('tag' => false, 'type' => 'html');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (bp_is_user()) {
        $current_action = bp_current_action();
        $item_docs_url = bp_displayed_user_domain() . bp_docs_get_docs_slug() . '/';
        if (empty($current_action) || BP_DOCS_STARTED_SLUG == $current_action) {
            $item_docs_url = bp_docs_get_displayed_user_docs_started_link();
        } elseif (BP_DOCS_EDITED_SLUG == $current_action) {
            $item_docs_url = bp_docs_get_displayed_user_docs_edited_link();
        }
    } elseif (bp_is_active('groups') && ($current_group = groups_get_current_group())) {
        /*
         * Pass the group object to bp_get_group_permalink() so that it works
         * when $groups_template may not be set, like during AJAX requests.
         */
        $item_docs_url = trailingslashit(bp_get_group_permalink($current_group) . bp_docs_get_docs_slug());
    } else {
        $item_docs_url = bp_docs_get_archive_link();
    }
    $url = apply_filters('bp_docs_get_tag_link_url', add_query_arg('bpd_tag', urlencode($tag), $item_docs_url), $args, $item_docs_url);
    if ($type != 'html') {
        return apply_filters('bp_docs_get_tag_link_url', $url, $tag, $type);
    }
    $html = '<a href="' . $url . '" title="' . sprintf(__('Docs tagged %s', 'bp-docs'), esc_attr($tag)) . '">' . esc_html($tag) . '</a>';
    return apply_filters('bp_docs_get_tag_link', $html, $url, $tag, $type);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:42,代码来源:addon-taxonomy.php

示例9: bp_docs_edit_doc_title

			<input type="text" id="doc-title" name="doc[title]" class="long" value="<?php 
bp_docs_edit_doc_title();
?>
" />
		</div>

		<?php 
if (bp_docs_is_existing_doc()) {
    ?>
			<div id="doc-content-permalink">
				<label for="doc-permalink"><?php 
    _e('Permalink', 'bp-docs');
    ?>
</label>
				<code><?php 
    echo trailingslashit(bp_get_root_domain()) . bp_docs_get_docs_slug() . '/';
    ?>
</code><input type="text" id="doc-permalink" name="doc[permalink]" class="long" value="<?php 
    bp_docs_edit_doc_slug();
    ?>
" />
			</div>
		<?php 
}
?>

		<?php 
do_action('bp_docs_before_doc_edit_content', $doc_id);
?>

		<div id="doc-content-textarea">
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:31,代码来源:edit.php

示例10: bp_docs_is_docs_component

/**
 * Is this the BP Docs component?
 */
function bp_docs_is_docs_component()
{
    $retval = false;
    $p = get_queried_object();
    if (is_post_type_archive(bp_docs_get_post_type_name())) {
        $retval = true;
    } else {
        if (isset($p->post_type) && bp_docs_get_post_type_name() == $p->post_type) {
            $retval = true;
        } else {
            if (bp_is_current_component(bp_docs_get_docs_slug())) {
                // This covers cases where we're looking at the Docs component of a user
                $retval = true;
            }
        }
    }
    return $retval;
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:21,代码来源:functions.php

示例11: bp_docs_get_tag_link_multitag

/**
 * Get an archive link for a given tag
 *
 * Optional arguments:
 *  - 'tag' 	The tag linked to. This one is required
 *  - 'type' 	'html' returns a link; anything else returns a URL
 *  - 'tags'    The selected tags
 *
 * @param array $args Optional arguments
 * @return array $filters
 */
function bp_docs_get_tag_link_multitag($args = array())
{
    global $bp;
    $defaults = array('tag' => false, 'type' => 'html', 'tags' => array());
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (bp_is_user()) {
        $current_action = bp_current_action();
        $item_docs_url = bp_displayed_user_domain() . bp_docs_get_docs_slug() . '/';
        if (empty($current_action) || BP_DOCS_STARTED_SLUG == $current_action) {
            $item_docs_url = bp_docs_get_displayed_user_docs_started_link();
        } elseif (BP_DOCS_EDITED_SLUG == $current_action) {
            $item_docs_url = bp_docs_get_displayed_user_docs_edited_link();
        }
    } elseif (bp_is_active('groups') && ($current_group = groups_get_current_group())) {
        /*
         * Pass the group object to bp_get_group_permalink() so that it works
         * when $groups_template may not be set, like during AJAX requests.
         */
        $item_docs_url = trailingslashit(bp_get_group_permalink($current_group) . bp_docs_get_docs_slug());
    } else {
        $item_docs_url = bp_docs_get_archive_link();
    }
    $bdp_tags = $tags;
    if (in_array($tag, $bdp_tags)) {
        // Remove because tag is selected
        $tag_key = array_search($tag, $bdp_tags);
        if ($tag_key !== FALSE) {
            unset($bdp_tags[$tag_key]);
        }
    } else {
        $bdp_tags[] = urlencode($tag);
    }
    if (!empty($_REQUEST['bool'])) {
        $item_docs_url = add_query_arg('bool', $_REQUEST['bool'], $item_docs_url);
    } else {
        /*
         * If not exist boolean argument, default add "and" condition
         */
        $item_docs_url = add_query_arg('bool', 'and', $item_docs_url);
    }
    $bdp_tags = implode(',', array_filter($bdp_tags));
    $url = apply_filters('bp_docs_get_tag_link_url', add_query_arg('bpd_tag', $bdp_tags, $item_docs_url), $args, $item_docs_url);
    if ($type != 'html') {
        return apply_filters('bp_docs_get_tag_link_url', $url, $tag, $type);
    }
    $html = '<a href="' . $url . '" title="' . sprintf(__('Docs tagged %s', 'bp-docs'), esc_attr($tag)) . '">' . esc_html($tag) . '</a>';
    return apply_filters('bp_docs_get_tag_link', $html, $url, $tag, $type);
}
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:60,代码来源:addon-taxonomy.php

示例12: setup_single_doc_subnav

 /**
  * When looking at a single doc, this adds the appropriate subnav item.
  *
  * Other navigation items are added in BP_Docs_Component. We add this item here because it's
  * not until later in the load order when we can be certain whether we're viewing a
  * single Doc.
  *
  * @since 1.2
  */
 function setup_single_doc_subnav()
 {
     global $bp;
     if (bp_is_user() && !empty($bp->bp_docs->current_view) && in_array($bp->bp_docs->current_view, array('single', 'edit', 'history', 'delete'))) {
         $doc = bp_docs_get_current_doc();
         if (!empty($doc)) {
             bp_core_new_subnav_item(array('name' => $doc->post_title, 'slug' => $doc->post_name, 'parent_url' => trailingslashit(bp_loggedin_user_domain() . bp_docs_get_docs_slug()), 'parent_slug' => bp_docs_get_docs_slug(), 'screen_function' => array($bp->bp_docs, 'template_loader'), 'position' => 30, 'user_has_access' => true));
         }
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:19,代码来源:integration-users.php

示例13: bp_docs_get_mydocs_link

/**
 * Get the link to the My Docs tab of the logged in user
 *
 * @package BuddyPress_Docs
 * @since 1.2
 */
function bp_docs_get_mydocs_link()
{
    return apply_filters('bp_docs_get_mydocs_link', trailingslashit(bp_loggedin_user_domain() . bp_docs_get_docs_slug()));
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:10,代码来源:templatetags.php


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