BP__组件

创建一个组件。

描述

来源

文件:bp-invites /类/ class-bp-invites-component.php

类BP\U组件扩展了BP\U组件{/***默认邀请扩展名。**@自BuddyBoss 1.0.0*@todo是否在任何地方使用?这是$Default_扩展名的副本吗?*@var string*/var$Default_component;/***默认邀请扩展名。**@自BuddyBoss 1.0.0*@var string*/public$Default_扩展名;/***自BuddyBoss 1.0.0*@varray*/public$forbidden_names;/***启动邀请组件创建过程。**@自BuddyBoss 1.0*/public function__construct(){parent::Start('invests',uuuu('Sent invests','BuddyBoss'),buddypress()->插件目录,数组('adminbar_myaccount_order'=>100,'search\u query\u arg'=>'invests\u search',)}/***Include invests component files.*@since BuddyBoss 1.0.0**@有关参数的说明,请参阅BP_component::includes()。*@param array$includes有关说明,请参阅BP_component::includes()。*/public function includes($includes=array()){$includes=array('filters','template','functions',;//条件包含。如果(bp_is_active('activity'){$includes[]='activity';}if(is_admin(){$includes[]='admin';})parent::includes($includes)}/***Late includes方法。**仅在特定页面上加载某些代码。**@因为BuddyBoss 1.0.0*/公共函数Late_includes{//{return;}//Bail if not on Settings component.if(!bp_is_invests_component()){return;}$actions=array('invests','send invests','send invests');//已验证的操作。if(is_user_logged_in()){if(!bp_current_action()| bp_is_current_action('invests')){require$this->path。'bp invests/actions/invests.php';//特定于post请求。}elseif(bp_is_post_request()&&in_数组(bp_current_action(),$actions,true)){require$this->path。'bp invests/actions/'.bp_current_action()。.php'}如果(是用户登录的()&&in_数组(bp_current_action(),数组('revoke invite'),true)){require$this->path。'bp invests/actions/'.bp_current_action()..php'}if(is_user_logged_in()&&in_array(bp_current_action(),array('revoke invite admin'),true)){require$this->path。'bp invests/actions/'.bp_current_action()..php'}屏幕-用户配置文件集成。if(bp_is_is_user()){require$this->path。'bp invests/screens/send invests.php';//子导航项.if(在_数组(bp_current_action(),$actions,true)中){require$this->path。'bp invests/screens/'.bp_current_action()。.php'}/***设置组件全局数据。**不推荐使用BP_invests_SLUG常量,此处仅用于*向后兼容性。**@因为BuddyBoss 1.0.0**@有关参数的说明,请参见BP_组件::setup_globals()。*@param array$args有关说明,请参见BP_组件::setup_globals()。*/public function setup_globals($args=array()){$bp=buddypress();//如果需要,请定义一个slug。如果(!defined('bp\u invests\u slug')){Define('bp\u invests\u slug',$this->id);//invests组件的所有全局变量。//请注意,此数组中包含全局表。$args=array('slug'=>bp\u invests\u slug',root\u slug'=>isset($bp->pages invests->slug)?$bp->pages->invites->slug:bp\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\为该组件设置规范堆栈。**自BuddyBoss 1.0.0.0.0*/公共函数设置\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\{return;}/***设置组件导航。**@自BuddyBoss 1.0.0以来**@有关参数的说明,请参见BP_组件::setup_nav()。*@param数组$main_nav可选。有关说明,请参见BP_组件::setup_nav()。*@param数组$sub_nav可选。有关说明,请参见BP_组件::setup_nav()。*/public function setup_nav($main_nav=array(),$sub_nav=array()){if(is_user_logged_in()){//确定要使用的用户。if(bp_displated_user_domain()){$user_domain=bp_displated_user_domain();}elseif(bp_loggedin user_domain()){$user_domain=bp_loggedin user_domain()}否则{$user_domain=false;}$navu name='Email_u}$slug=bp_get_invests_slug();if(!empty($user_domain)){$access=bp_core_can_edit_settings();$invests_link=trailingslashit($user_domain.$slug);if($access){if(true==bp_allow_user_to_发送邀请()){//将“发送邀请”添加到主导航。$main_nav=array('name'=>$nav\u name,'slug'=>$slug,'position'=>90,'screen\u function'=>'bp\u invests\u screen\u send\u invite','default\u subnav\u slug'=>'send invests','user\u拥有访问权'=>$access',item\u css\u id'=>$this->id,);//通过电子邮件添加邀请导航项。$sub nav[]=数组('name'=>('send invests','buddyboss'),'slug'=>'send invests','parent\u url'=>$invests\u link','parent\u slug'=>$slug',screen\u function'=>'bp\u invites_screen_send_invite', 'user_has_access' => $access, 'position' => 10, 'item_css_id' => 'invites-send-invite' ); // Add the Sent Invites nav item. $sub_nav[] = array( 'name' => __( 'Sent Invites', 'buddyboss' ), 'slug' => 'sent-invites', 'parent_url' => $invites_link, 'parent_slug' => $slug, 'screen_function' => 'bp_invites_screen_sent_invite', 'user_has_access' => $access, 'position' => 30, 'item_css_id' => 'invites-sent-invites' ); } } parent::setup_nav( $main_nav, $sub_nav ); } } } /** * Set up the component entries in the WordPress Admin Bar. * * @since BuddyBoss 1.0.0 * * @see BP_Component::setup_nav() for a description of the $wp_admin_nav * parameter array. * * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a description. */ public function setup_admin_bar( $wp_admin_nav = array() ) { // Menus for logged in user. if ( is_user_logged_in() ) { if ( true === bp_allow_user_to_send_invites() ) { // Setup the logged in user variables. $invites_link = trailingslashit( bp_loggedin_user_domain() . bp_get_invites_slug() ); $title = __( 'Email Invites', 'buddyboss' ); // Add the "My Account" sub menus. $wp_admin_nav[] = array( 'parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => $title, 'href' => $invites_link ); // Invite by Email $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-invites', 'title' => __( 'Send Invites', 'buddyboss' ), 'href' => $invites_link, 'position' => 10 ); // Sent Invites $wp_admin_nav[] = array( 'parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-sent', 'title' => __( 'Sent Invites', 'buddyboss' ), 'href' => $invites_link . 'sent-invites', 'position' => 20 ); } } parent::setup_admin_bar( $wp_admin_nav ); } /** * Set up the title for pages and . * * @since BuddyBoss 1.0.0 */ public function setup_title() { if ( bp_is_invites_component() ) { $bp = buddypress(); } parent::setup_title(); } public function register_post_types() { // Register invite custom post type. register_post_type( bp_get_invite_post_type(), apply_filters( 'bp_invite_post_type', array( 'description' => __( 'BuddyBoss Invites', 'buddyboss' ), 'labels' => bp_get_invite_post_type_labels(), 'public' => false, 'publicly_queryable' => bp_current_user_can( 'bp_moderate' ), 'query_var' => false, 'rewrite' => false, 'show_in_admin_bar' => false, 'show_in_menu' => false, 'map_meta_cap' => true, 'menu_icon' => 'dashicons-email', //'menu_position' => 27, 'show_in_rest' => true, 'capabilities' => array( 'create_posts' => 'do_not_allow', // false < WP 4.5, credit @Ewout ), 'show_ui' => bp_current_user_can( 'bp_moderate' ), 'supports' => bp_get_invite_post_type_supports(), ) ) ); parent::register_post_types(); } }</pre>
               </div>
               <p class="source-code-links"><span><a href="#" class="show-complete-source">展开完整的源代码</a><a href="#" class="less-complete-source">折叠完整的源代码</a></span></p>
              </section>
              <section class="changelog">
               <h3 id="ref-changelog" class="ref-context">变更日志<span id="ref-changelog-link" class="ref-context-link"></span></h3>
               <table>
                <caption class="screen-reader-text">
                 变更日志</caption>
                <thead>
                 <tr>
                  <th class="changelog-version">版本</th>
                  <th class="changelog-desc">描述</th>
                 </tr>
                </thead>
                <tbody>
                 <tr>
                  <td><a href="//www.zdfhmy.com/resources/reference/since/buddyboss.1.0.0/" alt="WordPress BuddyBoss 1.0.0">BuddyBoss 1.0.0</a></td>
                  <td>介绍。</td>
                 </tr>
                </tbody>
               </table>
              </section>
              <section class="related">
               <h2 id="ref-related" class="ref-context">相关的<span id="ref-related-link" class="ref-context-link"></span></h2>
               <article class="uses">
                <h3>使用</h3>
                <table id="uses-table">
                 <caption class="screen-reader-text">
                  使用</caption>
                 <thead>
                  <tr>
                   <th>使用</th>
                   <th class="related-desc">描述</th>
                  </tr>
                 </thead>
                 <tbody>
                  <tr>
                   <td><span>bp core/classes/class-bp-component.php:</span><a href="//www.zdfhmy.com/resources/reference/classes/bp_component/">BP_组件</a></td>
                   <td class="related-desc"><p>BuddyPress组件类。</p></td>
                  </tr>
                 </tbody>
                 <tbody></tbody>
                </table>
               </article>
              </section>
              <section class="class-methods">
               <h2 id="ref-methods" class="ref-context">方法<span id="ref-methods-link" class="ref-context-link"></span></h2>
               <ul>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/__construct/">__construct</a>—启动邀请组件创建过程。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/includes/">包括</a>-包括组件文件。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/late_includes/">迟交的费用包括</a>-后期包括方法。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/register_post_types/">注册\发布\类型</a></li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/rest_api_init/">rest\u api\u init</a>-初始化BuddybossRESTAPI。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/setup_admin_bar/">setup_admin_bar</a>-在WordPress管理栏中设置组件条目。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/setup_canonical_stack/">设置\u规范\u堆栈</a>-为此组件设置规范堆栈。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/setup_globals/">全球设置</a>-设置组件全局数据。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/setup_nav/">setup_nav</a>-设置组件导航。</li>
                <li><a href="//www.zdfhmy.com/resources/reference/classes/bp_invites_component/setup_title/">setup_title</a>-设置页面和的标题。</li>
               </ul>
              </section>
              <section class="ref-feedback-wrap">
               <h3>问题吗?</h3>
               <p>我们随时乐意为您提供代码或其他问题的帮助!搜索我们的<a href="//www.zdfhmy.com/resources/reference/">开发者文档</a>,<a href="//www.zdfhmy.com/my-account/?tab=helpscouttickets">联系支持</a>,或与我们的<a href="//www.zdfhmy.com/buddypress-developers/">销售团队</a>.</p>
              </section>
             </div>
            </div>
           </div>
          </div>
         </article>
        </main>
        <!-- #main -->
       </div>
       <!-- #primary -->
      </div>
      <!-- #primary -->
     </div>
     <!-- .bb-grid -->
    </div>
    <!-- .container -->
   </div>
   <!-- #content -->
   <footer class="footer-bottom bb-footer style-1">
    <div class="container flex">
     <div class="footer-bottom-left">
      <div class="copyright">
       ©2021•BuddyBoss</div>
     </div>
     <div class="footer-bottom-right push-right"></div>
    </div>
   </footer>
  </div>
  <!-- #page -->
 <div style="text-align:center;margin-bottom:5px;"><form action="http://www.baidu.com/baidu" target="_blank"><div bgcolor="#FFFFFF" style="text-align:center;"><input name="tn" type="hidden" value="baidu"><a href="http://www.baidu.com/"><img src="http://img.baidu.com/img/logo-80px.gif" width="80px" height="29px" alt="Baidu" align="bottom" border="0"></a><input type="text" name="word" size="30" placeholder="" value=""><input type="submit" value="百度搜索"></div></form></div><div id="so360" style="text-align:center;margin-bottom:5px;"><form action="https://www.so.com/" target="_blank" id="so360form"><img src="http://p1.qhimg.com/d/_onebox/search.png" width="100px" height="25px"> <input type="text" autocomplete="off" name="q" id="so360_keyword" placeholder="" value="">  <input type="submit" id="so360_submit" value="360搜索"> <input type="hidden" name="ie" value="gbk"><input type="hidden" name="src" value="zz"> <input type="hidden" name="site" value="so.com"> <input type="hidden" name="rg" value="1"></form></div><div id="sogou" style="text-align:center;margin-bottom:5px;"><form action="https://www.sogou.com/" target="_blank" id="so360form"><img src="https://www.sogou.com/web/index/images/logo_440x140.v.4.png" width="100px" height="25px"> <input type="text" autocomplete="off" name="q" id="sogou.com_keyword" placeholder="" value="">  <input type="submit" id="sogou_submit" value="搜 狗"> <input type="hidden" name="ie" value="gbk"><input type="hidden" name="src" value="zz"> <input type="hidden" name="site" value="so.com"> <input type="hidden" name="rg" value="1"></form></div></body>
</html>