PageRenderTime 63ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/platform/core/library/library.templates.php

https://bitbucket.org/crypticrod/sr_wp_code
PHP | 255 lines | 165 code | 40 blank | 50 comment | 32 complexity | aea51b4d55e1a954ab460e58fe249811 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.1, GPL-3.0, LGPL-2.0, AGPL-3.0
  1. <?php
  2. /**
  3. * This file contains a library of common templates accessed by functions
  4. *
  5. * @package PageLines Core
  6. *
  7. **/
  8. // ======================================
  9. // = Sidebar Setup & Template Functions =
  10. // ======================================
  11. /**
  12. * Sidebar - Call & Markup
  13. *
  14. */
  15. function pagelines_draw_sidebar($id, $name, $default = null){?>
  16. <ul id="<?php echo 'list_'.$id; ?>" class="sidebar_widgets fix">
  17. <?php if (!dynamic_sidebar($name)){ pagelines_default_widget( $id, $name, $default); } ?>
  18. </ul>
  19. <?php }
  20. /**
  21. * Sidebar - Default Widget
  22. *
  23. */
  24. function pagelines_default_widget($id, $name, $default){
  25. if(isset($default) && !pagelines('sidebar_no_default')):
  26. get_template_part( $default );
  27. elseif(!pagelines('sidebar_no_default')):
  28. ?>
  29. <li class="widget-default no_<?php echo $id;?>">
  30. <h3 class="widget-title">Add Widgets (<?php echo $name;?>)</h3>
  31. <p>This is your <?php echo $name;?>. Edit this content that appears here in the <a href="<?php echo admin_url('widgets.php');?>">widgets panel</a> by adding or removing widgets in the <?php echo $name;?> area.
  32. </p>
  33. </li>
  34. <?php endif;
  35. }
  36. /**
  37. * Sidebar - Standard Sidebar Setup
  38. *
  39. */
  40. function pagelines_standard_sidebar($name, $description){
  41. return array(
  42. 'name'=> $name,
  43. 'description' => $description,
  44. 'before_widget' => '<li id="%1$s" class="%2$s widget fix"><div class="widget-pad">',
  45. 'after_widget' => '</div></li>',
  46. 'before_title' => '<h3 class="widget-title">',
  47. 'after_title' => '</h3>'
  48. );
  49. }
  50. /**
  51. * Javascript Confirmation
  52. *
  53. * @param string $name Function name, to be used in the input
  54. * @param string $text The text of the confirmation
  55. */
  56. function pl_action_confirm($name, $text){ ?>
  57. <script language="jscript" type="text/javascript">
  58. function <?php echo $name;?>(){
  59. var a = confirm ("<?php echo esc_js( $text );?>");
  60. if(a) return true;
  61. else return false;
  62. }
  63. </script>
  64. <?php }
  65. // Title and External Script Integration
  66. function pagelines_head_common(){
  67. /*
  68. Title Metatag
  69. */
  70. echo "\n<title>";
  71. if( pagelines_bbpress_forum() ){
  72. bb_title();
  73. }elseif(pagelines_is_buddypress_page()){
  74. bp_page_title();
  75. }else{
  76. if(is_front_page()) { echo get_bloginfo('name'); } else { wp_title(''); }
  77. }
  78. echo "</title>\n";
  79. if(!VDEV) { echo "<!-- Platform WordPress Framework By PageLines - www.PageLines.com -->\n\n";}
  80. /*
  81. Meta Images
  82. */
  83. if(pagelines_option('pagelines_favicon')){
  84. echo '<link rel="shortcut icon" href="'.pagelines_option('pagelines_favicon').'" type="image/x-icon" />';
  85. }
  86. if(pagelines_option('pagelines_touchicon')){
  87. echo '<link rel="apple-touch-icon" href="'.pagelines_option('pagelines_touchicon').'" />';
  88. }
  89. ?>
  90. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  91. <link rel="profile" href="http://gmpg.org/xfn/11" />
  92. <meta name="generator" content="WordPress <?php bloginfo('version'); // For stats in WordPress ?>" />
  93. <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
  94. <?php if(pagelines_option('gfonts')):?>
  95. <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=<?php print_pagelines_option('gfonts_families', 'molengo');?>">
  96. <?php endif;
  97. if( pagelines_bbpress_forum() ){ // Load bbPress headers
  98. bb_feed_head();
  99. bb_head();
  100. echo '<link rel="stylesheet" href="';
  101. bb_stylesheet_uri();
  102. echo '" type="text/css" />';
  103. // Enqueued Stuff doesn't show in bbPress
  104. // So we have to load the CSS manually....
  105. if(VPRO){
  106. echo '<link rel="stylesheet" id="pagelines-pro-css" href="';
  107. echo PAGELINES_PRO_ROOT.'/pro.css';
  108. echo '" type="text/css" />';
  109. }
  110. echo '<link rel="stylesheet" id="pagelines-bbpress-css" href="';
  111. bloginfo('stylesheet_url');
  112. echo '" type="text/css" />';
  113. }
  114. if(VPRO){
  115. wp_register_style('pagelines-pro', PAGELINES_PRO_ROOT.'/pro.css', array(), CORE_VERSION, 'all');
  116. wp_enqueue_style( 'pagelines-pro');
  117. }
  118. wp_register_style('pagelines-stylesheet', get_bloginfo('stylesheet_url'), array(), CORE_VERSION, 'all');
  119. wp_enqueue_style( 'pagelines-stylesheet');
  120. // Queue Common Javascript Libraries
  121. wp_enqueue_script("jquery");
  122. if ( is_single() || is_page() ) wp_enqueue_script( 'comment-reply' ); // This makes the comment box appear where the ‘reply to this comment’ link is
  123. }
  124. // Fix IE issues to the extent possible...
  125. function pagelines_fix_ie($imagestofix = ''){?>
  126. <?php if(pagelines('google_ie')):?>
  127. <!--[if lt IE 8]> <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script> <![endif]-->
  128. <?php endif;?>
  129. <!--[if IE 6]>
  130. <script src="<?php echo CORE_JS . '/ie.belatedpng.js';?>"></script>
  131. <script>DD_belatedPNG.fix('<?php echo $imagestofix;?>');</script>
  132. <![endif]-->
  133. <?php
  134. /*
  135. IE File Setting up with conditionals
  136. TODO Why doesnt WP allow you to conditionally enqueue scripts?
  137. */
  138. // If IE6 add the Internet Explorer 6 specific stylesheet
  139. global $wp_styles;
  140. wp_enqueue_style('ie6-style', THEME_CSS . '/ie6.css');
  141. $wp_styles->add_data( 'ie6-style', 'conditional', 'lte IE 6' );
  142. wp_enqueue_style('ie7-style', THEME_CSS . '/ie7.css');
  143. $wp_styles->add_data( 'ie7-style', 'conditional', 'IE 7' );
  144. }
  145. function pagelines_font_replacement( $default_font = ''){
  146. if(pagelines_option('typekit_script')){
  147. echo pagelines_option('typekit_script');
  148. }
  149. if(pagelines_option('fontreplacement')){
  150. global $cufon_font_path;
  151. if(pagelines_option('font_file')) $cufon_font_path = pagelines_option('font_file');
  152. elseif($default_font) $cufon_font_path = THEME_JS.'/'.$default_font;
  153. else $cufon_font_path = null;
  154. // ===============================
  155. // = Hook JS Libraries to Footer =
  156. // ===============================
  157. add_action('wp_footer', 'font_replacement_scripts');
  158. function font_replacement_scripts(){
  159. global $cufon_font_path;
  160. wp_register_script('cufon', CORE_JS.'/type.cufon.js', 'jquery', '1.09', true);
  161. wp_print_scripts('cufon');
  162. if(isset($cufon_font_path)){
  163. wp_register_script('cufon_font', $cufon_font_path, 'cufon');
  164. wp_print_scripts('cufon_font');
  165. }
  166. }
  167. add_action('wp_head', 'cufon_inline_script');
  168. function cufon_inline_script(){
  169. ?><script type="text/javascript"><?php
  170. if(pagelines('replace_font')):
  171. ?>jQuery(document).ready(function () {
  172. Cufon.replace('<?php echo pagelines("replace_font"); ?>', {hover: true});
  173. });<?php
  174. endif;
  175. ?></script><?php
  176. }
  177. }
  178. }
  179. /**
  180. * Does posts info
  181. *
  182. */
  183. function pagelines_do_posts_info(){
  184. if(is_category() || is_archive() || is_search()):?>
  185. <div class="current_posts_info">
  186. <?php if(is_search()):?>
  187. <?php _e("Search results for ", 'pagelines');?>
  188. <strong>"<?php the_search_query();?>"</strong>
  189. <?php elseif(is_category()):?>
  190. <?php _e("Currently viewing the category: ", 'pagelines');?>
  191. <strong>"<?php single_cat_title();?>"</strong>
  192. <?php elseif(is_tag()):?>
  193. <?php _e("Currently viewing the tag: ", 'pagelines');?>
  194. <strong>"<?php single_tag_title(''); ?>"</strong>
  195. <?php elseif(is_archive()):?>
  196. <?php if (is_author()) { ?>
  197. <?php _e('Posts by author:', 'pagelines'); ?>
  198. <strong><?php echo get_the_author_meta('display_name'); ?></strong>
  199. <?php } elseif (is_day()) { ?>
  200. <?php _e('From the daily archives:', 'pagelines'); ?>
  201. <strong><?php the_time('l, F j, Y'); ?></strong>
  202. <?php } elseif (is_month()) { ?>
  203. <?php _e('From the monthly archives:', 'pagelines'); ?>
  204. <strong><?php the_time('F Y'); ?></strong>
  205. <?php } elseif (is_year()) { ?>
  206. <?php _e('From the yearly archives:', 'pagelines'); ?>
  207. <strong><?php the_time('Y'); ?></strong>
  208. <?php } else {?>
  209. <?php _e("Viewing archives for ", 'pagelines');?>
  210. <strong>"<?php the_date();?>"</strong>
  211. <?php } ?>
  212. <?php endif;?>
  213. </div>
  214. <?php endif;
  215. }