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


PHP bp_locate_template函数代码示例

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


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

示例1: bp_get_template_part

 function bp_get_template_part($slug, $name = null)
 {
     // Execute code for this part
     do_action('get_template_part_' . $slug, $slug, $name);
     // Setup possible parts
     $templates = array();
     if (isset($name)) {
         $templates[] = $slug . '-' . $name . '.php';
     }
     $templates[] = $slug . '.php';
     // Allow template parts to be filtered
     $templates = apply_filters('bp_get_template_part', $templates, $slug, $name);
     // Return the part that is found
     return bp_locate_template($templates, true, false);
 }
开发者ID:vilmark,项目名称:vilmark_main,代码行数:15,代码来源:bp-follow-backpat.php

示例2: setup_edit_hooks

    /**
     * Hook this extension's Edit panel into BuddyPress, if necessary
     *
     * @since BuddyPress (1.8)
     */
    protected function setup_edit_hooks()
    {
        // Bail if not an edit screen
        if (!$this->is_screen_enabled('edit') || !bp_is_item_admin()) {
            return;
        }
        $screen = $this->screens['edit'];
        $position = isset($screen['position']) ? (int) $screen['position'] : 10;
        // Add the tab
        // @todo BP should be using bp_core_new_subnav_item()
        add_action('groups_admin_tabs', create_function('$current, $group_slug', '$selected = "";
			if ( "' . esc_attr($screen['slug']) . '" == $current )
				$selected = " class=\\"current\\"";
			echo "<li{$selected}><a href=\\"' . trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/{$group_slug}/admin/' . esc_attr($screen['slug'])) . '\\">' . esc_attr($screen['name']) . '</a></li>";'), $position, 2);
        // Catch the edit screen and forward it to the plugin template
        if (bp_is_groups_component() && bp_is_current_action('admin') && bp_is_action_variable($screen['slug'], 0)) {
            $this->call_edit_screen_save($this->group_id);
            add_action('groups_custom_edit_steps', array(&$this, 'call_edit_screen'));
            // Determine the proper template and save for later
            // loading
            if ('' !== bp_locate_template(array('groups/single/home.php'), false)) {
                $this->edit_screen_template = '/groups/single/home';
            } else {
                add_action('bp_template_content_header', create_function('', 'echo "<ul class=\\"content-header-nav\\">"; bp_group_admin_tabs(); echo "</ul>";'));
                add_action('bp_template_content', array(&$this, 'call_edit_screen'));
                $this->edit_screen_template = '/groups/single/plugins';
            }
            // We load the template at bp_screens, to give all
            // extensions a chance to load
            add_action('bp_screens', array($this, 'call_edit_screen_template_loader'));
        }
    }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:37,代码来源:bp-groups-classes.php

示例3: bp_get_plugin_sidebar

/**
 * @deprecated BuddyPress (1.7)
 */
function bp_get_plugin_sidebar()
{
    _deprecated_function(__FUNCTION__, '1.7');
    bp_locate_template(array('plugin-sidebar.php'), true);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:8,代码来源:1.7.php

示例4: set_post_object

 /**
  * Set the Post object containing the email content template.
  *
  * Also sets the email's subject, content, and template from the Post, for convenience.
  *
  * @since 2.5.0
  *
  * @param WP_Post $post
  * @return BP_Email
  */
 public function set_post_object(WP_Post $post)
 {
     /**
      * Filters the new value of the email's "post object" property.
      *
      * @since 2.5.0
      *
      * @param WP_Post $post A Post.
      * @param BP_Email $this Current instance of the email type class.
      */
     $this->post_object = apply_filters('bp_email_set_post_object', $post, $this);
     if (is_a($this->post_object, 'WP_Post')) {
         $this->set_subject($this->post_object->post_title)->set_content_html($this->post_object->post_content)->set_content_plaintext($this->post_object->post_excerpt);
         ob_start();
         // Load the template.
         add_filter('bp_locate_template_and_load', '__return_true');
         bp_locate_template(bp_email_get_template($this->post_object), true, false);
         remove_filter('bp_locate_template_and_load', '__return_true');
         $this->set_template(ob_get_contents());
         ob_end_clean();
     }
     return $this;
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:33,代码来源:class-bp-email.php

示例5: setup_edit_hooks

 /**
  * Hook this extension's Edit panel into BuddyPress, if necessary.
  *
  * @since BuddyPress (1.8.0)
  */
 protected function setup_edit_hooks()
 {
     // Bail if not in a group
     if (!bp_is_group()) {
         return;
     }
     // Bail if not an edit screen
     if (!$this->is_screen_enabled('edit') || !bp_is_item_admin()) {
         return;
     }
     $screen = $this->screens['edit'];
     $position = isset($screen['position']) ? (int) $screen['position'] : 10;
     $position += 40;
     $current_group = groups_get_current_group();
     $admin_link = trailingslashit(bp_get_group_permalink($current_group) . 'admin');
     $subnav_args = array('name' => $screen['name'], 'slug' => $screen['slug'], 'parent_slug' => $current_group->slug . '_manage', 'parent_url' => trailingslashit(bp_get_group_permalink($current_group) . 'admin'), 'user_has_access' => bp_is_item_admin(), 'position' => $position, 'screen_function' => 'groups_screen_group_admin');
     // Should we add a menu to the Group's WP Admin Bar
     if (!empty($screen['show_in_admin_bar'])) {
         $subnav_args['show_in_admin_bar'] = true;
     }
     // Add the tab to the manage navigation
     bp_core_new_subnav_item($subnav_args);
     // Catch the edit screen and forward it to the plugin template
     if (bp_is_groups_component() && bp_is_current_action('admin') && bp_is_action_variable($screen['slug'], 0)) {
         $this->call_edit_screen_save($this->group_id);
         add_action('groups_custom_edit_steps', array(&$this, 'call_edit_screen'));
         // Determine the proper template and save for later
         // loading
         if ('' !== bp_locate_template(array('groups/single/home.php'), false)) {
             $this->edit_screen_template = '/groups/single/home';
         } else {
             add_action('bp_template_content_header', create_function('', 'echo "<ul class=\\"content-header-nav\\">"; bp_group_admin_tabs(); echo "</ul>";'));
             add_action('bp_template_content', array(&$this, 'call_edit_screen'));
             $this->edit_screen_template = '/groups/single/plugins';
         }
         // We load the template at bp_screens, to give all
         // extensions a chance to load
         add_action('bp_screens', array($this, 'call_edit_screen_template_loader'));
     }
 }
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:45,代码来源:class-bp-group-extension.php

示例6: bp_activity_recurse_comments

/**
 * Loops through a level of activity comments and loads the template for each
 *
 * Note: The recursion itself used to happen entirely in this function. Now it is
 * split between here and the comment.php template.
 *
 * @since BuddyPress (1.2)
 *
 * @todo remove $counter global
 *
 * @param object $comment The activity object currently being recursed
 *
 * @global object $activities_template {@link BP_Activity_Template}
 * @uses locate_template()
 */
function bp_activity_recurse_comments($comment)
{
    global $activities_template;
    if (empty($comment)) {
        return false;
    }
    if (empty($comment->children)) {
        return false;
    }
    echo apply_filters('bp_activity_recurse_comments_start_ul', '<ul>');
    foreach ((array) $comment->children as $comment_child) {
        // Put the comment into the global so it's available to filters
        $activities_template->activity->current_comment = $comment_child;
        $template = bp_locate_template('activity/comment.php', false, false);
        // Backward compatibility. In older versions of BP, the markup was
        // generated in the PHP instead of a template. This ensures that
        // older themes (which are not children of bp-default and won't
        // have the new template) will still work.
        if (!$template) {
            $template = BP_PLUGIN_DIR . '/bp-themes/bp-default/activity/comment.php';
        }
        load_template($template, false);
        unset($activities_template->activity->current_comment);
    }
    echo apply_filters('bp_activity_recurse_comments_end_ul', '</ul>');
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:41,代码来源:bp-activity-template.php

示例7: invite_anyone_create_screen_content

function invite_anyone_create_screen_content($event)
{
    if (!($template = function_exists('bp_locate_template') ? bp_locate_template('groups/single/invite-anyone.php', true) : locate_template('groups/single/invite-anyone.php', true))) {
        include_once 'templates/invite-anyone.php';
    }
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:6,代码来源:group-invites.php

示例8: bp_has_custom_activation_page

/**
 * Do we have a working custom activation page?
 *
 * @since 1.5.0
 *
 * @uses bp_get_activate_slug() To make sure there is a slug assigned to the page.
 * @uses bp_locate_template() To make sure a template exists to provide output.
 * @return boolean True if page and template exist, false if not.
 */
function bp_has_custom_activation_page()
{
    static $has_page = false;
    if (empty($has_page)) {
        $has_page = bp_get_activate_slug() && bp_locate_template(array('registration/activate.php', 'members/activate.php', 'activate.php'), false);
    }
    return (bool) $has_page;
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:17,代码来源:bp-members-template.php

示例9: bp_docs_container_class

?>

<div class="<?php 
bp_docs_container_class();
?>
">

<?php 
include apply_filters('bp_docs_header_template', bp_docs_locate_template('docs-header.php'));
?>

<?php 
if (current_user_can('bp_docs_manage_folders') && bp_docs_is_folder_manage_view()) {
    ?>
	<?php 
    bp_locate_template('docs/manage-folders.php', true);
} else {
    ?>

	<h2 class="directory-title">
		<?php 
    bp_docs_directory_breadcrumb();
    ?>
	</h2>

	<div class="docs-info-header">
		<?php 
    bp_docs_info_header();
    ?>
	</div>
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:30,代码来源:docs-loop.php

示例10: devb_aawire_post_update

function devb_aawire_post_update()
{
    global $bp;
    $is_wire_post = false;
    /* Check the nonce */
    check_admin_referer('post_update', '_wpnonce_post_update');
    if (!is_user_logged_in()) {
        echo '-1';
        exit(0);
    }
    if (empty($_POST['content'])) {
        echo '-1<div id="message"><p>' . __('Please enter some content to post.', 'buddypress') . '</p></div>';
        exit(0);
    }
    if (empty($_POST['object']) && function_exists('bp_activity_post_update')) {
        //this is what I have changed
        if (!bp_is_my_profile() && bp_is_user()) {
            $content = '@' . bp_get_displayed_user_username() . ' ' . $_POST['content'];
            $is_wire_post = true;
        } else {
            $content = $_POST['content'];
        }
        //let us get the last activity id, we will use it to reset user's last activity
        $last_update = bp_get_user_meta(bp_loggedin_user_id(), 'bp_latest_update', true);
        if ($is_wire_post) {
            add_filter('bp_activity_new_update_action', 'devb_aawire_filter_action');
        }
        $activity_id = bp_activity_post_update(array('content' => $content));
        if ($is_wire_post) {
            remove_filter('bp_activity_new_update_action', 'devb_aawire_filter_action');
            //add activity meta to remember that it was a wire post and we may use it in future
            if ($activity_id) {
                bp_activity_update_meta($activity_id, 'is_wire_post', 1);
            }
            //let us remember it for future
            //for 2.0 Let us add the mentioned user in the meta, so in future if we plan eo extend the wall beyond mention, we can do that easily
            bp_activity_update_meta($activity_id, 'wire_user_id', bp_displayed_user_id());
            //let us remember it for future
        }
        //reset the last update
        bp_update_user_meta(get_current_user_id(), 'bp_latest_update', $last_update);
        //end of my changes
    } elseif ($_POST['object'] == 'groups') {
        if (!empty($_POST['item_id']) && function_exists('groups_post_update')) {
            $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id']));
        }
    } else {
        $activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']);
    }
    if (!$activity_id) {
        echo '-1<div id="message"><p>' . __('There was a problem posting your update, please try again.', 'buddypress') . '</p></div>';
        exit(0);
    }
    if (bp_has_activities('include=' . $activity_id)) {
        ?>
     <?php 
        while (bp_activities()) {
            bp_the_activity();
            ?>
        <?php 
            bp_locate_template(array('activity/entry.php'), true);
            ?>
     <?php 
        }
        ?>
     <?php 
    }
    exit(0);
}
开发者ID:poweronio,项目名称:mbsite,代码行数:69,代码来源:bp-activity-as-wire.php

示例11: bp_core_render_email_template

/**
 * Find and render the template for Email posts (the Customizer and admin previews).
 *
 * Misuses the `template_include` filter which expects a string, but as we need to replace
 * the `{{{content}}}` token with the post's content, we use object buffering to load the
 * template, replace the token, and render it.
 *
 * The function returns an empty string to prevent WordPress rendering another template.
 *
 * @since 2.5.0
 *
 * @param string $template Path to template (probably single.php).
 * @return string
 */
function bp_core_render_email_template($template)
{
    if (get_post_type() !== bp_get_email_post_type() || !is_single()) {
        return $template;
    }
    /**
     * Filter template used to display Email posts.
     *
     * @since 2.5.0
     *
     * @param string $template Path to current template (probably single.php).
     */
    $email_template = apply_filters('bp_core_render_email_template', bp_locate_template(bp_email_get_template(get_queried_object()), false), $template);
    if (!$email_template) {
        return $template;
    }
    ob_start();
    include $email_template;
    $template = ob_get_contents();
    ob_end_clean();
    // Make sure we add a <title> tag so WP Customizer picks it up.
    $template = str_replace('<head>', '<head><title>' . esc_html_x('BuddyPress Emails', 'screen heading', 'buddypress') . '</title>', $template);
    echo str_replace('{{{content}}}', nl2br(get_post()->post_content), $template);
    /*
     * Link colours are applied directly in the email template before sending, so we
     * need to add an extra style here to set the colour for the Customizer or preview.
     */
    $settings = bp_email_get_appearance_settings();
    printf('<style>a { color: %s; }</style>', esc_attr($settings['highlight_color']));
    return '';
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:45,代码来源:bp-core-filters.php

示例12: ajax_update_activity_contents

 /**
  * This is where we actually save the activity update.
  */
 function ajax_update_activity_contents()
 {
     $bpfb_code = $activity = '';
     $aid = 0;
     $codec = new BpfbCodec();
     if (!empty($_POST['data']['bpfb_video_url'])) {
         $bpfb_code = $codec->create_video_tag($_POST['data']['bpfb_video_url']);
     }
     if (!empty($_POST['data']['bpfb_link_url'])) {
         $bpfb_code = $codec->create_link_tag($_POST['data']['bpfb_link_url'], $_POST['data']['bpfb_link_title'], $_POST['data']['bpfb_link_body'], $_POST['data']['bpfb_link_image']);
     }
     if (!empty($_POST['data']['bpfb_photos'])) {
         $images = $this->move_images($_POST['data']['bpfb_photos']);
         $bpfb_code = $codec->create_images_tag($images);
     }
     $bpfb_code = apply_filters('bpfb_code_before_save', $bpfb_code);
     // All done creating tags. Now, save the code
     $gid = (int) @$_POST['group_id'];
     if ($bpfb_code) {
         $content = @$_POST['content'] . "\n" . $bpfb_code;
         $content = apply_filters('bp_activity_post_update_content', $content);
         $aid = $gid ? groups_post_update(array('content' => $content, 'group_id' => $gid)) : bp_activity_post_update(array('content' => $content));
         global $blog_id;
         bp_activity_update_meta($aid, 'bpfb_blog_id', $blog_id);
     }
     if ($aid) {
         ob_start();
         if (bp_has_activities('include=' . $aid)) {
             while (bp_activities()) {
                 bp_the_activity();
                 if (function_exists('bp_locate_template')) {
                     bp_locate_template(array('activity/entry.php'), true);
                 } else {
                     locate_template(array('activity/entry.php'), true);
                 }
             }
         }
         $activity = ob_get_clean();
     }
     header('Content-type: application/json');
     echo json_encode(array('code' => $bpfb_code, 'id' => $aid, 'activity' => $activity));
     exit;
 }
开发者ID:pausaura,项目名称:agora_nodes,代码行数:46,代码来源:class_bpfb_binder.php

示例13: show_post_form

 public function show_post_form()
 {
     if (is_user_logged_in() && self::is_stream()) {
         bp_locate_template(array('activity/post-form.php'), true);
     }
 }
开发者ID:poweronio,项目名称:mbsite,代码行数:6,代码来源:bp-fblike-activity-stream.php

示例14: generate_activity_stream

    public function generate_activity_stream($atts, $content = null)
    {
        //allow to use all those args awesome!
        $atts = shortcode_atts(array('title' => 'Latest Activity', 'pagination' => 'true', 'display_comments' => 'threaded', 'include' => false, 'exclude' => false, 'in' => false, 'sort' => 'DESC', 'page' => 1, 'per_page' => 5, 'max' => false, 'scope' => false, 'user_id' => false, 'object' => false, 'action' => false, 'primary_id' => false, 'secondary_id' => false, 'search_terms' => false, 'use_compat' => bp_use_theme_compat_with_current_theme(), 'allow_posting' => false), $atts);
        extract($atts);
        //hide on user activity, activity directory and group activity
        if (is_user_logged_in() && (function_exists('bp_is_activity_component') && bp_is_activity_component() || function_exists('bp_is_group_home') && bp_is_group_home())) {
            return '';
        }
        ob_start();
        ?>
	
    <?php 
        if ($use_compat) {
            ?>
        <div id="buddypress">
    <?php 
        }
        ?>
		
	<?php 
        if ($title) {
            ?>
            <h3 class="activity-shortcode-title"><?php 
            echo $title;
            ?>
</h3>
        <?php 
        }
        ?>
    
		
        <?php 
        do_action('bp_before_activity_loop');
        ?>
			
		<?php 
        if ($allow_posting && is_user_logged_in()) {
            ?>

			<?php 
            bp_locate_template(array('activity/post-form.php'), true);
            ?>

		<?php 
        }
        ?>
			
        <?php 
        if (bp_has_activities($atts)) {
            ?>
            <div class="activity <?php 
            if (!$display_comments) {
                ?>
 hide-activity-comments<?php 
            }
            ?>
 shortcode-activity-stream">

                 <?php 
            if (empty($_POST['page'])) {
                ?>

                    <ul id="activity-stream" class="activity-list item-list">

                 <?php 
            }
            ?>

                 <?php 
            while (bp_activities()) {
                bp_the_activity();
                ?>

                    <?php 
                bp_get_template_part('activity/entry');
                ?>

                 <?php 
            }
            ?>

                 <?php 
            if (empty($_POST['page'])) {
                ?>
                    </ul>
                 <?php 
            }
            ?>
                
                <?php 
            if ($pagination) {
                ?>
                    <div class="pagination">
                        <div class="pag-count"><?php 
                bp_activity_pagination_count();
                ?>
</div>
                        <div class="pagination-links"><?php 
                bp_activity_pagination_links();
//.........这里部分代码省略.........
开发者ID:poweronio,项目名称:mbsite,代码行数:101,代码来源:bp-activity-as-shortcode.php

示例15: do_action

?>
			</select>
		</li>
	</ul>
</div><!-- .item-list-tabs -->

<?php 
do_action('bp_before_link_activity_post_form');
?>

<?php 
if (is_user_logged_in()) {
    ?>
	<?php 
    bp_links_locate_template(array('activity/post-form.php'), true);
}
?>

<?php 
do_action('bp_after_link_activity_post_form');
do_action('bp_before_link_activity_content');
?>

<div class="activity single-link">
	<?php 
bp_locate_template(array('activity/activity-loop.php'), true);
?>
</div><!-- .activity -->

<?php 
do_action('bp_after_link_activity_content');
开发者ID:OxBEEF,项目名称:merge-server,代码行数:31,代码来源:activity.php


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