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

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

https://github.com/Bochet/festival_lgbt
PHP | 392 lines | 266 code | 58 blank | 68 comment | 118 complexity | 3e109beadad5e752004317b792c2ff92 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Header 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 header actions
  19. */
  20. add_action( 'response_after_head_tag', 'response_font' );
  21. add_action( 'response_head_tag', 'response_html_attributes' );
  22. add_action( 'response_head_tag', 'response_meta_tags' );
  23. add_action( 'response_head_tag', 'response_title_tag' );
  24. add_action( 'response_head_tag', 'response_link_rel' );
  25. add_action( 'response_header_sitename', 'response_header_sitename_content');
  26. add_action( 'response_header_site_description', 'response_header_site_description_content' );
  27. add_action( 'response_header_social_icons', 'response_header_social_icons_content' );
  28. add_action( 'response_logo_menu', 'response_logo_menu_content');
  29. add_action( 'response_description_icons', 'response_description_icons_content');
  30. add_action( 'response_navigation', 'response_nav' );
  31. add_action( 'response_404_content', 'response_404_content_handler' );
  32. /**
  33. * Establishes the theme font family.
  34. *
  35. * @since 1.0
  36. */
  37. function response_font() {
  38. global $ec_themeslug, $options; //Call global variables
  39. $family = apply_filters( 'response_default_font_family', 'Helvetica, serif' );
  40. if ($options->get($ec_themeslug.'_font') == "" ) {
  41. $font = apply_filters( 'response_default_font', 'Arial' );
  42. }
  43. else {
  44. $font = $options->get($ec_themeslug.'_font');
  45. } ?>
  46. <body style="font-family:'<?php echo ereg_replace("[^A-Za-z0-9]", " ", $font ); ?>', <?php echo $family; ?>" <?php body_class(); ?> > <?php
  47. }
  48. /**
  49. * Establishes the theme HTML attributes
  50. *
  51. * @since 1.0
  52. */
  53. function response_html_attributes() { ?>
  54. <!doctype html>
  55. <!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
  56. <!--[if IE 7 ]> <html class="ie7"> <![endif]-->
  57. <!--[if IE 8 ]> <html class="ie8"> <![endif]-->
  58. <!--[if IE 9 ]> <html class="ie9"> <![endif]-->
  59. <!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
  60. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>>
  61. <head profile="http://gmpg.org/xfn/11"> <?php
  62. }
  63. /**
  64. * Establishes the theme META tags (including SEO options)
  65. *
  66. * @since 1.0
  67. */
  68. function response_meta_tags() { ?>
  69. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <?php
  70. global $ec_themeslug, $options, $post; //Call global variables
  71. if(!$post) return; // in case of 404 page or something
  72. $title = get_post_meta($post->ID, 'seo_title' , true);
  73. $pagedescription = get_post_meta($post->ID, 'seo_description' , true);
  74. $keywords = get_post_meta($post->ID, 'seo_keywords' , true); ?>
  75. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  76. <meta name="distribution" content="global" />
  77. <meta name="language" content="<?php bloginfo( 'language' ); ?>" />
  78. <!-- Set the viewport width to device width for mobile -->
  79. <meta name="viewport" content="initial-scale=1.0; maximum-scale=3.0; width=device-width"/><?php
  80. if ($options->get($ec_themeslug.'_home_title') != '' AND is_front_page()) { ?>
  81. <meta name='title' content='<?php echo ($options->get($ec_themeslug.'_home_title')) ;?>'/> <?php
  82. }
  83. if ($options->get($ec_themeslug.'_home_description') != '' AND is_front_page()) { ?>
  84. <meta name='description' content='<?php echo ($options->get($ec_themeslug.'_home_description')) ;?>' /> <?php
  85. }
  86. if ($options->get($ec_themeslug.'_home_keywords') != '' AND is_front_page()) { ?>
  87. <meta name='keywords' content=' <?php echo ($options->get($ec_themeslug.'_home_keywords')) ; ?>' /> <?php
  88. }
  89. if ($title != '' AND !is_front_page()) {
  90. echo "<meta name='title' content='$title' />";
  91. }
  92. if ($pagedescription != '' AND !is_front_page()) {
  93. echo "<meta name='description' content='echo $pagedescription'/>";
  94. }
  95. if ($keywords != '' AND !is_front_page()) {
  96. echo "<meta name='keywords' content='$keywords'/>";
  97. }
  98. }
  99. /**
  100. * Establishes the theme title tags.
  101. *
  102. * @since 1.0
  103. */
  104. function response_title_tag() {
  105. echo '<title>';
  106. wp_title( ' - ' );
  107. echo '</title>';
  108. }
  109. /**
  110. * Sets the header link rel attributes
  111. *
  112. * @since 1.0
  113. */
  114. function response_link_rel() {
  115. global $ec_themeslug, $options; //Call global variables
  116. $favicon = $options->get($ec_themeslug.'_favicon'); //Calls the favicon URL from the theme options
  117. ?>
  118. <?php if( $options->get($ec_themeslug.'_favicon_toggle') == true ): ?>
  119. <link rel="shortcut icon" href="<?php echo stripslashes($favicon['url']); ?>" type="image/x-icon" />
  120. <?php endif; ?>
  121. <?php if( $options->get($ec_themeslug.'_apple_touch_toggle') == true && is_array( $options->get($ec_themeslug.'_apple_touch') ) ): ?>
  122. <!-- For apple touch icon -->
  123. <?php $apple_icon = $options->get($ec_themeslug.'_apple_touch'); ?>
  124. <link rel="apple-touch-icon" href="<?php echo $apple_icon['url']; ?>"/>
  125. <?php endif; ?>
  126. <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
  127. <?php if( $options->get($ec_themeslug.'_font') == "" ):
  128. $font = apply_filters( 'response_default_font', 'Arial' );
  129. else:
  130. $font = $options->get( $ec_themeslug.'_font' );
  131. endif;
  132. if( $font == 'Actor' ||
  133. $font == 'Coda' ||
  134. $font == 'Maven Pro' ||
  135. $font == 'Metrophobic' ||
  136. $font == 'News Cycle' ||
  137. $font == 'Nobile' ||
  138. $font == 'Tenor Sans' ||
  139. $font == 'Quicksand' ||
  140. $font == 'Ubuntu') :
  141. // Check if SSL is present, if so then use https othereise use http
  142. $protocol = is_ssl() ? 'https' : 'http';
  143. ?>
  144. <link href='<?php echo $protocol; ?>://fonts.googleapis.com/css?family=<?php echo $font ; ?>' rel='stylesheet' type='text/css' />
  145. <?php endif;
  146. }
  147. /**
  148. * Header left content (sitename or logo)
  149. *
  150. * @since 1.0
  151. */
  152. function response_header_sitename_content() {
  153. global $ec_themeslug, $options; //Call global variables
  154. $logo = $options->get($ec_themeslug.'_logo'); //Calls the logo URL from the theme options
  155. if( $url = $options->get($ec_themeslug.'_logo_url_toggle' ) == 1 )
  156. {
  157. $url = $options->get($ec_themeslug.'_logo_url') != '' ? $options->get($ec_themeslug.'_logo_url') : get_home_url();
  158. }
  159. else {
  160. $url = get_home_url();
  161. }
  162. if ($options->get($ec_themeslug.'_custom_logo') == '1' && $logo['url'] != '') { ?>
  163. <div id="logo">
  164. <a href="<?php echo $url; ?>/"><img src="<?php echo stripslashes($logo['url']); ?>" alt="logo"></a>
  165. </div> <?php
  166. }
  167. else{ ?>
  168. <h1 class="sitename"><a href="<?php echo $url; ?>/"><?php bloginfo('name'); ?></a></h1>
  169. <?php
  170. }
  171. }
  172. function response_header_site_description_content() {
  173. global $ec_themeslug, $options; ?>
  174. <div id="description">
  175. <h1 class="description"><?php bloginfo('description'); ?>&nbsp;</h1>
  176. </div> <?php
  177. }
  178. /**
  179. * Description/Icons
  180. *
  181. * @since 1.0
  182. */
  183. function response_description_icons_content() {
  184. ?>
  185. <div id="subheader">
  186. <div class="container">
  187. <div class="row">
  188. <div class="five columns">
  189. <!-- Begin @Core header description hook -->
  190. <?php response_header_site_description(); ?>
  191. <!-- End @Core header description hook -->
  192. </div>
  193. <div class="seven columns">
  194. <!-- Begin @Core header social icon hook -->
  195. <?php response_header_social_icons(); ?>
  196. <!-- End @Core header contact social icon hook -->
  197. </div>
  198. </div><!--end row-->
  199. </div>
  200. </div>
  201. <?php
  202. }
  203. /**
  204. * Logo/Menu
  205. *
  206. * @since 1.0
  207. */
  208. function response_logo_menu_content() {
  209. global $ec_themename;
  210. ?>
  211. <div id="header">
  212. <div class="container">
  213. <div class="row">
  214. <div class="five columns"">
  215. <!-- Begin @Core header sitename hook -->
  216. <?php response_header_sitename(); ?>
  217. <!-- End @Core header sitename hook -->
  218. </div>
  219. <div class="seven columns">
  220. <div id="nav">
  221. <?php wp_nav_menu( array(
  222. 'items_wrap' => '<ul id="nav_menu">%3$s</ul>',
  223. 'fallback_cb' => $ec_themename.'_menu_fallback',
  224. 'theme_location' => 'header-menu' // Setting up the location for the main-menu, Main Navigation.
  225. )
  226. );
  227. ?>
  228. </div>
  229. </div>
  230. </div><!--end row-->
  231. </div>
  232. </div>
  233. <?php
  234. }
  235. /**
  236. * Social icons
  237. *
  238. * @since 1.0
  239. */
  240. function response_header_social_icons_content() {
  241. global $options, $ec_themeslug; //call globals
  242. // Get template directory uri into variable for further use.
  243. $template_dir = get_template_directory_uri();
  244. $facebook = $options->get($ec_themeslug.'_facebook');
  245. $hidefacebook = $options->get($ec_themeslug.'_hide_facebook_icon');
  246. $twitter = $options->get($ec_themeslug.'_twitter');;
  247. $hidetwitter = $options->get($ec_themeslug.'_hide_twitter_icon');;
  248. $gplus = $options->get($ec_themeslug.'_gplus');
  249. $hidegplus = $options->get($ec_themeslug.'_hide_gplus_icon');
  250. $flickr = $options->get($ec_themeslug.'_flickr');
  251. $hideflickr = $options->get($ec_themeslug.'_hide_flickr');
  252. $pinterest = $options->get($ec_themeslug.'_pinterest');
  253. $hidepinterest = $options->get($ec_themeslug.'_hide_pinterest');
  254. $linkedin = $options->get($ec_themeslug.'_linkedin');
  255. $hidelinkedin = $options->get($ec_themeslug.'_hide_linkedin');
  256. $youtube = $options->get($ec_themeslug.'_youtube');
  257. $hideyoutube = $options->get($ec_themeslug.'_hide_youtube');
  258. $googlemaps = $options->get($ec_themeslug.'_googlemaps');
  259. $hidegooglemaps = $options->get($ec_themeslug.'_hide_googlemaps');
  260. $email = $options->get($ec_themeslug.'_email');
  261. $hideemail = $options->get($ec_themeslug.'_hide_email');
  262. $rss = $options->get($ec_themeslug.'_rsslink');
  263. $hiderss = $options->get($ec_themeslug.'_hide_rss_icon');
  264. $folder = 'default';
  265. ?>
  266. <div id="social">
  267. <div class="icons">
  268. <?php if ($hidefacebook == '1' AND $facebook != '' OR $hidefacebook == '' AND $facebook != '' ):?>
  269. <a href="<?php echo $facebook ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/facebook.png" alt="Facebook" /></a>
  270. <?php endif;?>
  271. <?php if ($hidefacebook == '1' AND $facebook == '' OR $hidefacebook == '' AND $facebook == '' ):?>
  272. <a href="http://facebook.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/facebook.png" alt="Facebook" /></a>
  273. <?php endif;?>
  274. <?php if ($hidetwitter == '1' AND $twitter != '' OR $hidetwitter == '' AND $twitter != '' ):?>
  275. <a href="<?php echo $twitter ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/twitter.png" alt="Twitter" /></a>
  276. <?php endif;?>
  277. <?php if ($hidetwitter == '1' AND $twitter == '' OR $hidetwitter == '' AND $twitter == '' ):?>
  278. <a href="http://twitter.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/twitter.png" alt="Twitter" /></a>
  279. <?php endif;?>
  280. <?php if ($hidegplus == '1' AND $gplus != '' OR $hidegplus == '' AND $gplus != '' ):?>
  281. <a href="<?php echo $gplus ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/gplus.png" alt="Gplus" /></a>
  282. <?php endif;?>
  283. <?php if ($hidegplus == '1' AND $gplus == '' OR $hidegplus == '' AND $gplus == '' ):?>
  284. <a href="https://plus.google.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/gplus.png" alt="Gplus" /></a>
  285. <?php endif;?>
  286. <?php if ($hideflickr == '1' AND $flickr != '' ):?>
  287. <a href="<?php echo $flickr ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/flickr.png" alt="Flickr" /></a>
  288. <?php endif;?>
  289. <?php if ($hideflickr == '1' AND $flickr == '' ):?>
  290. <a href="https://flickr.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/flickr.png" alt="Flickr" /></a>
  291. <?php endif;?>
  292. <?php if ($hidepinterest == '1' AND $pinterest != '' ):?>
  293. <a href="<?php echo $pinterest ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/pinterest.png" alt="Pinterest" /></a>
  294. <?php endif;?>
  295. <?php if ($hidepinterest == '1' AND $pinterest == '' ):?>
  296. <a href="https://pinterest.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/pinterest.png" alt="Pinterest" /></a>
  297. <?php endif;?>
  298. <?php if ($hidelinkedin == '1' AND $linkedin != '' ):?>
  299. <a href="<?php echo $linkedin ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/linkedin.png" alt="LinkedIn" /></a>
  300. <?php endif;?>
  301. <?php if ($hidelinkedin == '1' AND $linkedin == '' ):?>
  302. <a href="http://linkedin.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/linkedin.png" alt="LinkedIn" /></a>
  303. <?php endif;?>
  304. <?php if ($hideyoutube == '1' AND $youtube != '' ):?>
  305. <a href="<?php echo $youtube ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/youtube.png" alt="YouTube" /></a>
  306. <?php endif;?>
  307. <?php if ($hideyoutube == '1' AND $youtube == '' ):?>
  308. <a href="http://youtube.com" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/youtube.png" alt="YouTube" /></a>
  309. <?php endif;?>
  310. <?php if ($hidegooglemaps == '1' AND $googlemaps != ''):?>
  311. <a href="<?php echo $googlemaps ?>" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/googlemaps.png" alt="Google Maps" /></a>
  312. <?php endif;?>
  313. <?php if ($hidegooglemaps == '1' AND $googlemaps == ''):?>
  314. <a href="http://google.com/maps" target="_blank" rel="me"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/googlemaps.png" alt="Google Maps" /></a>
  315. <?php endif;?>
  316. <?php if ($hideemail == '1' AND $email != ''):?>
  317. <a href="mailto:<?php echo $email ?>" target="_blank"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/email.png" alt="E-mail" /></a>
  318. <?php endif;?>
  319. <?php if ($hideemail == '1' AND $email == ''):?>
  320. <a href="mailto:no@way.com" target="_blank"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/email.png" alt="E-mail" /></a>
  321. <?php endif;?>
  322. <?php if ($hiderss == '1' and $rss != '' OR $hiderss == '' and $rss != '' ):?>
  323. <a href="<?php echo $rss ?>" target="_blank"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/rss.png" alt="RSS" /></a>
  324. <?php endif;?>
  325. <?php if ($hiderss == '1' and $rss == '' OR $hiderss == '' and $rss == '' ):?>
  326. <a href="<?php bloginfo('rss2_url'); ?>" target="_blank"><img src="<?php echo $template_dir; ?>/images/social/<?php echo $folder; ?>/rss.png" alt="RSS" /></a>
  327. <?php endif;?>
  328. </div><!--end icons-->
  329. </div><!--end social--> <?php
  330. }
  331. /**
  332. * End
  333. */
  334. ?>