PageRenderTime 49ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/eclipse/core/actions/global-actions.php

https://github.com/Bochet/festival_lgbt
PHP | 222 lines | 155 code | 21 blank | 46 comment | 46 complexity | 537af1fa6d3e62f51532aff341a94081 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Global actions used by response.
  4. *
  5. * Author: Tyler Cunningham
  6. * Copyright: Š 2012
  7. * {@link http://cyberchimps.com/ CyberChimps LLC}
  8. *
  9. * Released under the terms of the GNU General Public License.
  10. * You should have received a copy of the GNU General Public License,
  11. * along with this software. In the main directory, see: /licensing/
  12. * If not, see: {@link http://www.gnu.org/licenses/}.
  13. *
  14. * @package response
  15. * @since 1.0
  16. */
  17. /**
  18. * response global actions
  19. */
  20. add_action( 'response_loop', 'response_loop_content' );
  21. add_action( 'response_post_byline', 'response_post_byline_content' );
  22. add_action( 'response_mobile_post_byline', 'response_mobile_post_byline_content' );
  23. add_action( 'response_edit_link', 'response_edit_link_content' );
  24. add_action( 'response_post_tags', 'response_post_tags_content' );
  25. add_action( 'response_post_bar', 'response_post_bar_content' );
  26. add_action( 'response_fb_like_plus_one', 'response_fb_like_plus_one_content' );
  27. /**
  28. * Check for post format type, apply filter based on post format name for easy modification.
  29. *
  30. * @since 1.0
  31. */
  32. function response_loop_content($content) {
  33. global $options, $ec_themeslug, $post; //call globals
  34. if (is_single()) {
  35. $post_formats = $options->get($ec_themeslug.'_single_post_formats');
  36. $featured_images = $options->get($ec_themeslug.'_single_show_featured_images');
  37. $excerpts = $options->get($ec_themeslug.'_single_show_excerpts');
  38. }
  39. elseif (is_archive()) {
  40. $post_formats = $options->get($ec_themeslug.'_archive_post_formats');
  41. $featured_images = $options->get($ec_themeslug.'_archive_show_featured_images');
  42. $excerpts = $options->get($ec_themeslug.'_archive_show_excerpts');
  43. }
  44. else {
  45. $post_formats = $options->get($ec_themeslug.'_post_formats');
  46. $featured_images = $options->get($ec_themeslug.'_show_featured_images');
  47. $excerpts = $options->get($ec_themeslug.'_show_excerpts');
  48. }
  49. if (get_post_format() == '') {
  50. $format = "default";
  51. }
  52. else {
  53. $format = get_post_format();
  54. } ?>
  55. <?php ob_start(); ?>
  56. <!--Call @response Meta hook-->
  57. <div class="row">
  58. <div class="byline three columns"><?php response_post_byline(); ?></div>
  59. <div class="entry nine columns">
  60. <h2 class="posts_title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  61. <?php
  62. if ( has_post_thumbnail() && $featured_images == '1' ) {
  63. echo '<div class="featured-image">';
  64. echo '<a href="' . get_permalink($post->ID) . '" >';
  65. the_post_thumbnail();
  66. echo '</a>';
  67. echo '</div>';
  68. }
  69. ?>
  70. <?php response_mobile_post_byline(); ?>
  71. <?php
  72. if ($excerpts == '1' && !is_single() ) {
  73. the_excerpt();
  74. }
  75. else {
  76. the_content(__('<img class="continue_img" src="' .get_bloginfo('template_directory'). '/images/continue.png"> Continue Reading', 'response'));
  77. }
  78. ?>
  79. <div class='clear'>&nbsp;</div>
  80. <!--Begin @response link pages hook-->
  81. <?php response_link_pages(); ?>
  82. <!--End @response link pages hook-->
  83. <!--Begin @response post edit link hook-->
  84. <?php response_edit_link(); ?>
  85. <!--End @response post edit link hook-->
  86. </div><!--end entry-->
  87. </div><!--end row-->
  88. <?php
  89. $content = ob_get_clean();
  90. $content = apply_filters( 'response_post_formats_'.$format.'_content', $content );
  91. echo $content;
  92. }
  93. /**
  94. * Sets the post byline information (author, date, category).
  95. *
  96. * @since 1.0
  97. */
  98. function response_post_byline_content() {
  99. global $options, $ec_themeslug; //call globals.
  100. if (is_single()) {
  101. $hidden = $options->get($ec_themeslug.'_single_hide_byline');
  102. $post_formats = $options->get($ec_themeslug.'_single_post_formats');
  103. }
  104. elseif (is_archive()) {
  105. $hidden = $options->get($ec_themeslug.'_archive_hide_byline');
  106. $post_formats = $options->get($ec_themeslug.'_archive_post_formats');
  107. }
  108. else {
  109. $hidden = $options->get($ec_themeslug.'_hide_byline');
  110. $post_formats = $options->get($ec_themeslug.'_post_formats');
  111. }
  112. if (get_post_format() == '') {
  113. $format = "default";
  114. }
  115. else {
  116. $format = get_post_format();
  117. }?>
  118. <?php if ($post_formats != '0') : ?>
  119. <div class="postformats hide-on-phones"><!--begin format icon-->
  120. <img src="<?php echo get_template_directory_uri(); ?>/images/formats/<?php echo $format ;?>.png" alt="formats" />
  121. </div><!--end format-icon-->
  122. <?php endif; ?>
  123. <div class="meta hide-on-phones">
  124. <ul>
  125. <li class="metadate"><?php if (($hidden[$ec_themeslug.'_hide_date']) != '0'):?><a href="<?php the_permalink() ?>"><?php echo get_the_date(); ?></a><?php endif;?></li>
  126. <li class="metacomments"><?php if (($hidden[$ec_themeslug.'_hide_comments']) != '0'):?><?php comments_popup_link( __('No Comments', 'response' ), __('1 Comment', 'response' ), __('% Comments' , 'response' )); //need a filer here ?><?php endif;?></li>
  127. <li class="metaauthor"><?php if (($hidden[$ec_themeslug.'_hide_author']) != '0'):?><?php the_author_posts_link(); ?><?php endif;?></li>
  128. <li class="metacat"><?php if (($hidden[$ec_themeslug.'_hide_categories']) != '0'):?> <?php the_category(', ') ?><?php endif;?></li>
  129. <li class="metatags"><?php response_post_tags(); ?></li>
  130. </ul>
  131. </div> <?php
  132. }
  133. /**
  134. * Sets the responsive post byline information (author, date, category).
  135. *
  136. * @since 1.0
  137. */
  138. function response_mobile_post_byline_content() {
  139. global $options, $ec_themeslug; //call globals.
  140. if (is_single()) {
  141. $hidden = $options->get($ec_themeslug.'_single_hide_byline');
  142. $post_formats = $options->get($ec_themeslug.'_single_post_formats');
  143. }
  144. elseif (is_archive()) {
  145. $hidden = $options->get($ec_themeslug.'_archive_hide_byline');
  146. $post_formats = $options->get($ec_themeslug.'_archive_post_formats');
  147. }
  148. else {
  149. $hidden = $options->get($ec_themeslug.'_hide_byline');
  150. $post_formats = $options->get($ec_themeslug.'_post_formats');
  151. }
  152. if (get_post_format() == '') {
  153. $format = "default";
  154. }
  155. else {
  156. $format = get_post_format();
  157. }?>
  158. <div class="meta-mobile show-on-phones">
  159. <ul><?php if ($post_formats != '0') : ?>
  160. <li class="postformats show-on-phones"><img src="<?php echo get_template_directory_uri(); ?>/images/formats/<?php echo $format ;?>.png" alt="formats" />
  161. </li><?php endif; ?>
  162. <li class="metadate"><?php if (($hidden[$ec_themeslug.'_hide_date']) != '0'):?><?php printf( __( '', 'response' )); ?><a href="<?php the_permalink() ?>"><?php echo get_the_date(); ?></a><?php endif;?></li>
  163. <li class="metacomments"><?php if (($hidden[$ec_themeslug.'_hide_comments']) != '0'):?><?php comments_popup_link( __('No Comments', 'response' ), __('1 Comment', 'response' ), __('% Comments' , 'response' )); //need a filer here ?><?php endif;?></li>
  164. <li class="metaauthor"><?php if (($hidden[$ec_themeslug.'_hide_author']) != '0'):?><?php printf( __( '', 'response' )); ?><?php the_author_posts_link(); ?><?php endif;?></li>
  165. <li class="metacat"><?php if (($hidden[$ec_themeslug.'_hide_categories']) != '0'):?><?php printf( __( '', 'response' )); ?> <?php the_category(', ') ?><?php endif;?></li>
  166. <li class="metatags"><?php response_post_tags(); ?></li>
  167. </ul>
  168. </div> <?php
  169. }
  170. /**
  171. * Sets up the WP edit link
  172. *
  173. * @since 1.0
  174. */
  175. function response_edit_link_content() {
  176. edit_post_link('Edit', '<p>', '</p>');
  177. }
  178. /**
  179. * Sets up the tag area
  180. *
  181. * @since 1.0
  182. */
  183. function response_post_tags_content() {
  184. global $options, $ec_themeslug;
  185. if (is_single()) {
  186. $hidden = $options->get($ec_themeslug.'_single_hide_byline');
  187. }
  188. elseif (is_archive()) {
  189. $hidden = $options->get($ec_themeslug.'_archive_hide_byline');
  190. }
  191. else {
  192. $hidden = $options->get($ec_themeslug.'_hide_byline');
  193. }?>
  194. <?php if (has_tag() AND ($hidden[$ec_themeslug.'_hide_tags']) != '0'):?>
  195. <?php the_tags('', ', ', ''); ?>
  196. <?php endif;
  197. }
  198. /**
  199. * End
  200. */
  201. ?>