PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/code/cake/app/webroot/cp/wp-content/plugins/commentpress-core/themes/commentpress-theme/sidebar.php

https://github.com/DigitalPaulScholtenProject/DPSP-Platform
PHP | 294 lines | 100 code | 138 blank | 56 comment | 9 complexity | 91dd45e771f47ffb0dce4ee230d38e84 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. // declare access to globals
  3. global $commentpress_core;
  4. // init tab order
  5. $_tab_order = array( 'comments', 'activity', 'contents' );
  6. // if we have the plugin enabled and the method exists...
  7. if (
  8. is_object( $commentpress_core ) AND
  9. method_exists( $commentpress_core, 'get_sidebar_order' )
  10. ) {
  11. // get order from plugin options
  12. $_tab_order = $commentpress_core->get_sidebar_order();
  13. }
  14. //print_r( $_tab_order ); die();
  15. ?><!-- sidebar.php -->
  16. <div id="sidebar">
  17. <div id="sidebar_inner">
  18. <ul id="sidebar_tabs">
  19. <?php
  20. // -----------------------------------------------------------------------------
  21. // SIDEBAR HEADERS
  22. // -----------------------------------------------------------------------------
  23. foreach( $_tab_order AS $_tab ) {
  24. switch ( $_tab ) {
  25. // Comments Header
  26. case 'comments':
  27. ?><li id="comments_header" class="sidebar_header">
  28. <h2><a href="#comments_sidebar"><?php
  29. // set default link name
  30. $_comments_title = apply_filters(
  31. // filter name
  32. 'cp_tab_title_comments',
  33. // default value
  34. __( 'Comments', 'commentpress-core' )
  35. );
  36. echo $_comments_title;
  37. ?></a></h2>
  38. <?php
  39. // init
  40. $_min = '';
  41. // if we have the plugin enabled...
  42. if ( is_object( $commentpress_core ) ) {
  43. // show the minimise all button
  44. $_min = $commentpress_core->get_minimise_all_button( 'comments' );
  45. }
  46. // show the minimise all button
  47. echo $_min;
  48. ?>
  49. </li>
  50. <?php
  51. break;
  52. // Activity Header
  53. case 'activity':
  54. // do we want to show activity tab?
  55. if ( commentpress_show_activity_tab() ) {
  56. // set default link name
  57. $_activity_title = apply_filters(
  58. // filter name
  59. 'cp_tab_title_activity',
  60. // default value
  61. __( 'Activity', 'commentpress-core' )
  62. );
  63. ?>
  64. <li id="activity_header" class="sidebar_header">
  65. <h2><a href="#activity_sidebar"><?php echo $_activity_title; ?></a></h2>
  66. <?php
  67. // if we have the plugin enabled...
  68. if ( is_object( $commentpress_core ) ) {
  69. // show the minimise all button
  70. echo $commentpress_core->get_minimise_all_button( 'activity' );
  71. }
  72. ?>
  73. </li>
  74. <?php
  75. } else {
  76. // ignore activity
  77. }
  78. break;
  79. // Contents Header
  80. case 'contents':
  81. ?>
  82. <li id="toc_header" class="sidebar_header">
  83. <h2><a href="#toc_sidebar"><?php
  84. // set default link name
  85. $_toc_title = apply_filters(
  86. // filter name
  87. 'cp_tab_title_toc',
  88. // default value
  89. __( 'Contents', 'commentpress-core' )
  90. );
  91. echo $_toc_title;
  92. ?></a></h2>
  93. </li>
  94. <?php
  95. break;
  96. } // end switch
  97. } // end foreach
  98. ?>
  99. </ul>
  100. <?php
  101. // -----------------------------------------------------------------------------
  102. // THE SIDEBARS THEMSELVES
  103. // -----------------------------------------------------------------------------
  104. // plugin global
  105. global $commentpress_core, $post;
  106. // if we have the plugin enabled...
  107. if ( is_object( $commentpress_core ) ) {
  108. // check commentable status
  109. $commentable = $commentpress_core->is_commentable();
  110. // is it commentable?
  111. if ( $commentable ) {
  112. // until WordPress supports a locate_theme_file() function, use filter
  113. $include = apply_filters(
  114. 'cp_template_comments_sidebar',
  115. get_template_directory() . '/assets/templates/comments_sidebar.php'
  116. );
  117. // get comments sidebar
  118. include( $include );
  119. }
  120. //JVDP, we only need comments section
  121. // // until WordPress supports a locate_theme_file() function, use filter
  122. // $include = apply_filters(
  123. // 'cp_template_toc_sidebar',
  124. // get_template_directory() . '/assets/templates/toc_sidebar.php'
  125. // );
  126. // // always include TOC
  127. // include( $include );
  128. // // do we want to show activity tab?
  129. // if ( commentpress_show_activity_tab() ) {
  130. // // until WordPress supports a locate_theme_file() function, use filter
  131. // $include = apply_filters(
  132. // 'cp_template_activity_sidebar',
  133. // get_template_directory() . '/assets/templates/activity_sidebar.php'
  134. // );
  135. // // get activity sidebar
  136. // include( $include );
  137. // }
  138. } else {
  139. // default sidebar when plugin not active...
  140. ?><div id="toc_sidebar">
  141. <div class="sidebar_header">
  142. <h2><?php echo $_toc_title; ?></h2>
  143. </div>
  144. <div class="sidebar_minimiser">
  145. <div class="sidebar_contents_wrapper">
  146. <ul>
  147. <?php wp_list_pages('sort_column=menu_order&title_li='); ?>
  148. </ul>
  149. </div><!-- /sidebar_contents_wrapper -->
  150. </div><!-- /sidebar_minimiser -->
  151. </div><!-- /toc_sidebar -->
  152. <?php
  153. } // end check for plugin
  154. ?>
  155. </div><!-- /sidebar_inner -->
  156. </div><!-- /sidebar -->