Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. <?php
  2. /* * **************************************
  3. * Main.php
  4. *
  5. * The main template file, that loads the header, footer and sidebar
  6. * apart from loading the appropriate rtMedia template
  7. * *************************************** */
  8. // by default it is not an ajax request
  9. global $rt_ajax_request;
  10. $rt_ajax_request = false;
  11.  
  12. //todo sanitize and fix $_SERVER variable usage
  13. // check if it is an ajax request
  14.  
  15. $_rt_ajax_request = rtm_get_server_var( 'HTTP_X_REQUESTED_WITH', 'FILTER_SANITIZE_STRING' );
  16. if ( 'xmlhttprequest' === strtolower( $_rt_ajax_request ) ) {
  17. $rt_ajax_request = true;
  18. }
  19. ?>
  20.  
  21. <div id="buddypress" class="buddypress-wrap bp-dir-hori-nav">
  22. <div id="buddypress-rtmedia">
  23.  
  24. <section class="wrapper">
  25.  
  26. <?php
  27. //if it's not an ajax request, load headers
  28. if ( ! $rt_ajax_request ) {
  29. // if this is a BuddyPress page, set template type to
  30. // buddypress to load appropriate headers
  31. if ( class_exists ( 'BuddyPress' ) && ! bp_is_blog_page () && apply_filters( 'rtm_main_template_buddypress_enable', true ) ) {
  32. $template_type = 'buddypress' ;
  33. } else {
  34. $template_type = '' ;
  35. }
  36. //get_header( $template_type );
  37.  
  38. if ( $template_type == 'buddypress' ) {
  39. //load buddypress markup
  40. if ( bp_displayed_user_id () ) {
  41.  
  42. //if it is a buddypress member profile
  43. ?>
  44.  
  45.  
  46. <main id="content">
  47.  
  48. <div class="breadcrumbs">
  49. <?php esc_attr_e('You are here:', 'onecommunity'); ?> <a href="<?php echo home_url(); ?>"><?php esc_attr_e('Home', 'onecommunity'); ?></a> / <a href="<?php echo home_url(); ?>/members"><?php esc_attr_e('Members', 'onecommunity'); ?></a> / <span class="current"><?php the_title(); ?></span>
  50. </div>
  51.  
  52. <?php bp_nouveau_member_hook( 'before', 'home_content' ); ?>
  53.  
  54. <div id="item-header" role="complementary" data-bp-item-id="<?php echo esc_attr( bp_displayed_user_id() ); ?>" data-bp-item-component="members" class="users-header single-headers">
  55.  
  56. <?php bp_nouveau_member_header_template_part(); ?>
  57.  
  58. </div><!-- #item-header -->
  59.  
  60. <div class="clear"></div>
  61.  
  62. <div class="bp-wrap">
  63. <?php if ( ! bp_nouveau_is_object_nav_in_sidebar() ) : ?>
  64.  
  65. <?php bp_get_template_part( 'members/single/parts/item-nav' ); ?>
  66.  
  67. <?php endif; ?>
  68.  
  69. <div id="item-body" class="item-body">
  70.  
  71. <nav id="subnav" class="bp-navs bp-subnavs no-ajax user-subnav user-rtmedia">
  72. <ul class="subnav">
  73. <?php rtmedia_sub_nav(); ?>
  74. </ul>
  75. </nav>
  76.  
  77. <?php rtmedia_load_template(); ?>
  78.  
  79. </div><!-- #item-body -->
  80. </div><!-- // .bp-wrap -->
  81.  
  82. <?php bp_nouveau_member_hook( 'after', 'home_content' ); ?>
  83.  
  84. </main><!-- content -->
  85.  
  86. <?php bp_get_template_part( 'members/single/profile-sidebar' ); ?>
  87.  
  88.  
  89. <?php } else if ( bp_is_group () ) {
  90.  
  91. //not a member profile, but a group
  92. ?>
  93.  
  94. <main id="content">
  95.  
  96. <div class="breadcrumbs">
  97. <?php esc_attr_e('You are here:', 'onecommunity'); ?> <a href="<?php echo home_url(); ?>"><?php esc_attr_e('Home', 'onecommunity'); ?></a> / <a href="<?php echo home_url(); ?>/groups"><?php esc_attr_e('Groups', 'onecommunity'); ?></a> / <span class="current"><?php the_title(); ?></span>
  98. </div>
  99.  
  100. <?php if (bp_has_groups()) : while (bp_groups()) : bp_the_group(); ?>
  101.  
  102. <?php bp_nouveau_group_hook( 'before', 'home_content' ); ?>
  103.  
  104. <div id="item-header" role="complementary" data-bp-item-id="<?php bp_group_id(); ?>" data-bp-item-component="groups" class="groups-header single-headers">
  105.  
  106. <?php bp_nouveau_group_header_template_part(); ?>
  107.  
  108. </div><!-- #item-header -->
  109.  
  110. <div class="bp-wrap">
  111.  
  112. <?php if ( ! bp_nouveau_is_object_nav_in_sidebar() ) : ?>
  113.  
  114. <?php bp_get_template_part( 'groups/single/parts/item-nav' ); ?>
  115.  
  116. <?php endif; ?>
  117.  
  118. <div id="item-body" class="item-body">
  119.  
  120. <nav id="subnav" class="bp-navs bp-subnavs no-ajax user-rtmedia">
  121. <ul class="subnav">
  122. <?php rtmedia_sub_nav(); ?>
  123. </ul>
  124. </nav>
  125.  
  126. <?php rtmedia_load_template(); ?>
  127.  
  128. </div><!-- #item-body -->
  129.  
  130. </div><!-- // .bp-wrap -->
  131.  
  132. <?php bp_nouveau_group_hook( 'after', 'home_content' ); ?>
  133.  
  134. </main><!-- content -->
  135.  
  136.  
  137. <?php bp_get_template_part( 'groups/single/group-sidebar' ); ?>
  138.  
  139. <?php endwhile; endif; // group/profile if/else
  140. }
  141. } else { ////if BuddyPress
  142.  
  143.  
  144.  
  145. }
  146. } // if ajax
  147. // include the right rtMedia template
  148. rtmedia_load_template () ;
  149.  
  150. if ( ! $rt_ajax_request ) {
  151. if ( function_exists ( "bp_displayed_user_id" ) && $template_type == 'buddypress' && (bp_displayed_user_id () || bp_is_group ()) ) {
  152. if ( bp_is_group () ) {
  153. do_action ( 'bp_after_group_media' ) ;
  154. do_action ( 'bp_after_group_body' ) ;
  155. }
  156. if ( bp_displayed_user_id () ) {
  157. do_action ( 'bp_after_member_media' ) ;
  158. do_action ( 'bp_after_member_body' ) ;
  159. }
  160. }
  161. ?>
  162.  
  163. <?php
  164. if ( function_exists ( "bp_displayed_user_id" ) && $template_type == 'buddypress' && (bp_displayed_user_id () || bp_is_group ()) ) {
  165. if ( bp_is_group () ) {
  166. do_action( 'bp_after_group_home_content' );
  167. }
  168. if ( bp_displayed_user_id () ) {
  169. do_action( 'bp_after_member_home_content' );
  170. }
  171. }
  172. }
  173. //close all markup
  174. ?>
  175.  
  176. </section><!-- wrapper -->
  177. </div><!--#buddypress-rtmedia-->
  178. </div><!-- byddypress -->
  179. <?php
  180. //get_sidebar($template_type);
  181. //get_footer($template_type);
  182. // if ajax
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement