Advertisement
JAMKING

Untitled

Mar 6th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.39 KB | None | 0 0
  1. <?php
  2. function bfa_header_config($header_items) {
  3.  
  4. global $bfa_ata, $post;
  5.  
  6.  
  7. // Page Menu Bar
  8. if ( strpos($header_items,'%pages') !== FALSE OR strpos($header_items,'%page-center') !== FALSE
  9. OR strpos($header_items,'%page-right') !== FALSE ) {
  10.  
  11. // Since 3.5.2: New WP 3 menu system:
  12. if (function_exists('wp_nav_menu') AND has_nav_menu('menu1')) {
  13. if (strpos($header_items,'%pages') !== FALSE ) $alignment = "left";
  14. elseif (strpos($header_items,'%page-center') !== FALSE ) $alignment = "center";
  15. else $alignment = "right";
  16. $page_menu_bar = bfa_new_wp3_menus("menu1", $alignment );
  17.  
  18. // Old custom Atahualpa menu system:
  19. } else {
  20.  
  21. ob_start();
  22.  
  23. echo '<div id="menu1">';
  24.  
  25. // Left, Right or Centered
  26. if ( strpos($header_items,"%page-right") !== FALSE ) {
  27. echo '<ul id="rmenu2" class="dropdown clearfix rMenu-hor rMenu-hRight rMenu">' . "\n";
  28. } elseif ( strpos($header_items,"%page-center") !== FALSE ) {
  29. echo '<table cellpadding="0" cellspacing="0" style="margin: 0 auto"><tr><td align="center">
  30. <ul id="rmenu2" class="clearfix rMenu-hor rMenu">' . "\n";
  31. } else {
  32. echo '<ul id="rmenu2" class="clearfix rMenu-hor rMenu">' . "\n";
  33. }
  34.  
  35. // "Home" Link?
  36. if ( $bfa_ata['home_page_menu_bar'] != '' ) {
  37. echo '<li class="page_item';
  38. if (function_exists('is_front_page')) {
  39. if ( is_front_page() ) {
  40. echo ' current_page_item';
  41. }
  42. } elseif ( is_home() ) {
  43. echo ' current_page_item';
  44. }
  45. echo '"><a href="'; bloginfo('url'); echo '/" title="'; bloginfo('name'); echo '">' .
  46. $bfa_ata['home_page_menu_bar'] . '</a></li>' . "\n";
  47. }
  48.  
  49. // Empty setting "levels" same as 0
  50. if ( $bfa_ata['levels_page_menu_bar'] == '' ) {
  51. $bfa_ata['levels_page_menu_bar'] = 0;
  52. }
  53.  
  54. echo bfa_hor_pages($bfa_ata['sorting_page_menu_bar'], $bfa_ata['levels_page_menu_bar'],
  55. $bfa_ata['titles_page_menu_bar'], $bfa_ata['exclude_page_menu_bar']);
  56.  
  57. // Close table if centered
  58. if ( strpos($header_items,"%page-center") !== FALSE ) {
  59. echo '</ul></td></tr></table></div>' . "\n";
  60. } else {
  61. echo '</ul></div>' . "\n";
  62. }
  63.  
  64. $page_menu_bar = ob_get_contents();
  65.  
  66. ob_end_clean();
  67. }
  68.  
  69. }
  70.  
  71.  
  72.  
  73.  
  74. // Category Menu Bar
  75. if ( strpos($header_items,'%cats') !== FALSE OR strpos($header_items,'%cat-center') !== FALSE
  76. OR strpos($header_items,'%cat-right') !== FALSE ) {
  77.  
  78. // Since 3.5.2: New WP 3 menu system:
  79. if (function_exists('wp_nav_menu') AND has_nav_menu('menu2')) {
  80. if (strpos($header_items,'%cats') !== FALSE ) $alignment = "left";
  81. elseif (strpos($header_items,'%cat-center') !== FALSE ) $alignment = "center";
  82. else $alignment = "right";
  83. $cat_menu_bar = bfa_new_wp3_menus("menu2", $alignment );
  84.  
  85. // Old custom Atahualpa menu system:
  86. } else {
  87.  
  88. ob_start();
  89.  
  90. echo '<div id="menu2">';
  91.  
  92. if ( strpos($header_items,"%cat-right") !== FALSE ) {
  93. echo '<ul id="rmenu" class="dropdown clearfix rMenu-hor rMenu-hRight rMenu">' . "\n";
  94. } elseif ( strpos($header_items,"%cat-center") !== FALSE ) {
  95. echo '<table cellpadding="0" cellspacing="0" style="margin: 0 auto"><tr><td align="center">
  96. <ul id="rmenu" class="clearfix rMenu-hor rMenu">' . "\n";
  97. } else {
  98. echo '<ul id="rmenu" class="clearfix rMenu-hor rMenu">' . "\n";
  99. }
  100.  
  101. // Home Link?
  102. if ( $bfa_ata['home_cat_menu_bar'] != '' ) {
  103. echo '<li class="cat-item';
  104. if ( function_exists('is_front_page') ) {
  105. if ( is_front_page() OR is_home() ) {
  106. echo ' current-cat';
  107. }
  108. } elseif ( is_home() ) {
  109. echo ' current-cat';
  110. }
  111. echo '"><a href="'; bloginfo('url'); echo '/" title="'; bloginfo('name'); echo '">' .
  112. $bfa_ata['home_cat_menu_bar'] . '</a></li>' . "\n";
  113. }
  114.  
  115. // Empty setting "levels" same as 0
  116. if ( $bfa_ata['levels_cat_menu_bar'] == '' ) {
  117. $bfa_ata['levels_cat_menu_bar'] = 0;
  118. }
  119.  
  120. // Create menu list
  121. echo bfa_hor_cats($bfa_ata['sorting_cat_menu_bar'], $bfa_ata['order_cat_menu_bar'],
  122. $bfa_ata['levels_cat_menu_bar'], $bfa_ata['titles_cat_menu_bar'], $bfa_ata['exclude_cat_menu_bar']);
  123.  
  124. // Close table if centered
  125. if ( strpos($header_items,"%cat-center") !== FALSE ) {
  126. echo '</ul></td></tr></table></div>' . "\n";
  127. } else {
  128. echo '</ul></div>' . "\n";
  129. }
  130.  
  131. $cat_menu_bar = ob_get_contents();
  132.  
  133. ob_end_clean();
  134. }
  135. }
  136.  
  137.  
  138.  
  139.  
  140. // Logo Area
  141. if ( strpos($header_items,'%logo') !== FALSE ) {
  142.  
  143. ob_start();
  144.  
  145. echo '<table id="logoarea" cellpadding="0" cellspacing="0" border="0" width="100%"><tr>';
  146.  
  147. if ( $bfa_ata['show_search_box'] == "Yes" AND ($bfa_ata['show_posts_icon'] == "Yes" OR
  148. $bfa_ata['show_email_icon'] == "Yes" OR $bfa_ata['show_comments_icon'] == "Yes") ) {
  149. $header_rowspan = 'rowspan="2" ';
  150. } else {
  151. $header_rowspan = '';
  152. }
  153.  
  154. // Logo Icon for Wordpress and WPMU
  155. if ( $bfa_ata['logo'] != "" ) {
  156. echo '<td ' . $header_rowspan . 'valign="middle" class="logoarea-logo"><a href="';
  157. bloginfo('url'); echo '/"><img class="logo" src="';
  158.  
  159. // if this is WordPress MU
  160. if ( file_exists(ABSPATH."/wpmu-settings.php") ) {
  161. // two ways to figure out the upload path on WPMU, first try easy version 1, :
  162. $upload_path1 = ABSPATH . get_option('upload_path');
  163. // Try the hard way, version 2:
  164. $upload_path2 = str_replace('themes/' . get_option('stylesheet') .
  165. '/functions', '', $_SERVER['DOCUMENT_ROOT']) .
  166. '/wp-content/blogs.dir/' . $wpdb->blogid . '/files';
  167. // see if user has uploaded his own "logosymbol.gif" somewhere into his upload folder, version 1:
  168. $wpmu_logosymbol = m_find_in_dir($upload_path1,$bfa_ata['logo']); $upload_path = $upload_path1;
  169. // try version 2 if no logosymbol.gif was found:
  170. if ( !$wpmu_logosymbol ) {
  171. $wpmu_logosymbol = m_find_in_dir($upload_path2,$bfa_ata['logo']); $upload_path = $upload_path2;
  172. }
  173.  
  174. // if we found logosymbol.gif one way or another, figure out the public URL
  175. if ( $wpmu_logosymbol ) {
  176. $new_logosymbol = str_replace($upload_path,
  177. get_option('fileupload_url'), $wpmu_logosymbol);
  178. echo $new_logosymbol[0] . '" alt="'; bloginfo('name');
  179. // otherwise: print the one in the theme folder
  180. } else {
  181. bloginfo('template_directory'); echo '/images/' . $bfa_ata['logo'] .
  182. '" alt="'; bloginfo('name');
  183. }
  184.  
  185. // if this is Wordpress and not WPMU, print the logosymbol.gif in the theme folder right away
  186. } else {
  187. bloginfo('template_directory'); echo '/images/' . $bfa_ata['logo'] . '" alt="';
  188. bloginfo('name');
  189. }
  190.  
  191. echo '" /></a></td>';
  192. }
  193.  
  194.  
  195. // Blog title and description
  196. if ( $bfa_ata['blog_title_show'] == "Yes" OR $bfa_ata['blog_tagline_show'] == "Yes" ) {
  197.  
  198. echo '<td ' . $header_rowspan . 'valign="middle" class="logoarea-title">';
  199.  
  200. if ( $bfa_ata['blog_title_show'] == "Yes" ) {
  201. echo '<h' . $bfa_ata['h_blogtitle'] . ' class="blogtitle"><a href="';
  202. bloginfo('url'); echo '/">'; bloginfo('name'); echo '</a></h' . $bfa_ata['h_blogtitle'] . '>';
  203. }
  204.  
  205. if ( $bfa_ata['blog_tagline_show'] == "Yes" ) {
  206. echo '<p class="tagline">'; bloginfo('description'); echo '</p>';
  207. }
  208.  
  209. echo '</td>';
  210. }
  211.  
  212.  
  213.  
  214.  
  215. // is any feed icon or link active?
  216. if ( $bfa_ata['show_posts_icon'] == "Yes" OR $bfa_ata['show_email_icon'] == "Yes" OR
  217. $bfa_ata['show_comments_icon'] == "Yes" ) {
  218. echo '<td class="feed-icons" valign="middle" align="right"><div class="clearfix rss-box">';
  219. }
  220.  
  221.  
  222.  
  223. // COMMENT Feed link
  224. if ( $bfa_ata['show_comments_icon'] == "Yes" ) {
  225.  
  226. echo '<a class="comments-icon" ';
  227.  
  228. if ( $bfa_ata['nofollow'] == "Yes" ) {
  229. echo 'rel="nofollow" ';
  230. }
  231.  
  232. echo 'href="'; bloginfo('comments_rss2_url'); echo '" title="' .
  233. $bfa_ata['comment_feed_link_title'] . '">' . $bfa_ata['comment_feed_link'] . '</a>';
  234.  
  235. }
  236.  
  237.  
  238.  
  239. // Feedburner Email link
  240. if ( $bfa_ata['show_email_icon'] == "Yes" ) {
  241.  
  242. echo '<a class="email-icon" ';
  243.  
  244. if ( $bfa_ata['nofollow'] == "Yes" ) {
  245. echo 'rel="nofollow" ';
  246. }
  247.  
  248. echo 'href="http://' . ($bfa_ata['feedburner_old_new'] == 'New - at feedburner.google.com' ?
  249. 'feedburner.google.com/fb/a/mailverify?uri=' : 'www.feedburner.com/fb/a/emailverifySubmit?feedId=') .
  250. $bfa_ata['feedburner_email_id'] . '&amp;loc=' . get_locale() . '" title="' .
  251. $bfa_ata['email_subscribe_link_title'] . '">' . $bfa_ata['email_subscribe_link'] . '</a>';
  252.  
  253. }
  254.  
  255.  
  256.  
  257. // POSTS Feed link
  258. if ( $bfa_ata['show_posts_icon'] == "Yes" ) {
  259.  
  260. echo '<a class="posts-icon" ';
  261.  
  262. if ( $bfa_ata['nofollow'] == "Yes" ) {
  263. echo 'rel="nofollow" ';
  264. }
  265.  
  266. echo 'href="'; bloginfo('rss2_url'); echo '" title="' .
  267. $bfa_ata['post_feed_link_title'] . '">' .
  268. $bfa_ata['post_feed_link'] . '</a>';
  269.  
  270. }
  271.  
  272.  
  273.  
  274. if ( $bfa_ata['show_posts_icon'] == "Yes" OR $bfa_ata['show_email_icon'] == "Yes" OR
  275. $bfa_ata['show_comments_icon'] == "Yes" ) {
  276. echo '</div></td>';
  277. if ( $bfa_ata['show_search_box'] == "Yes" ) {
  278. echo '</tr><tr>';
  279. }
  280. }
  281.  
  282.  
  283.  
  284. // Search box
  285. if ( $bfa_ata['show_search_box'] == "Yes" ) {
  286. echo '<td valign="bottom" class="search-box" align="right"><div class="searchbox">
  287. <form method="get" class="searchform" action="'; bloginfo( 'url' ); echo '/">
  288. <div class="searchbox-form">' .
  289. // Check for WP 2.2 which doesn't know get_search_query
  290. (function_exists('get_search_query') ? '
  291. <input type="text" class="text inputblur" onfocus="this.value=\''.
  292. (get_search_query() ? get_search_query() : '' ).'\'"
  293. value="' . (get_search_query() ? get_search_query() : $bfa_ata['searchbox_text'] ) .
  294. '" onblur="this.value=\''.(get_search_query() ? get_search_query() : $bfa_ata['searchbox_text'] ).
  295. '\'" name="s" />' :
  296. '<input type="text" class="text inputblur" name="s" />') .
  297. '</div>
  298. </form>
  299. </div>
  300. </td>';
  301. }
  302.  
  303. echo '</tr></table>';
  304.  
  305. $logo_area = ob_get_contents();
  306.  
  307. ob_end_clean();
  308. }
  309.  
  310.  
  311.  
  312. // Header Image
  313. if ( strpos($header_items,'%image') !== FALSE ) {
  314.  
  315. ob_start();
  316.  
  317. $bfa_header_images = bfa_rotating_header_images();
  318.  
  319. echo '<div id="imagecontainer" class="header-image-container" style="background: url(' .
  320. $bfa_header_images[array_rand($bfa_header_images)] . ') ' . $bfa_ata['headerimage_alignment'] . ' no-repeat;">';
  321.  
  322. if ($bfa_ata['header_image_clickable'] == "Yes") {
  323. echo '<div class="clickable"><a class="divclick" title="';
  324. bloginfo('name'); echo '" href ="'; bloginfo('url'); echo '/">&nbsp;</a></div>';
  325. }
  326.  
  327. if ( $bfa_ata['header_opacity_left'] != 0 AND $bfa_ata['header_opacity_left'] != '' ) {
  328. echo '<div class="opacityleft">&nbsp;</div>';
  329. }
  330.  
  331. if ( $bfa_ata['header_opacity_right'] != 0 AND $bfa_ata['header_opacity_right'] != '' ) {
  332. echo '<div class="opacityright">&nbsp;</div>';
  333. }
  334. // END: If Header Opacity
  335.  
  336. if ( $bfa_ata['overlay_blog_title'] == "Yes" OR $bfa_ata['overlay_blog_tagline'] == "Yes" ) {
  337. echo '<div class="titleoverlay">';
  338. if ($bfa_ata['overlay_blog_title'] == "Yes") {
  339. echo '<h' . $bfa_ata['h_blogtitle'] . ' class="blogtitle"><a href="'; bloginfo('url'); echo '/">';
  340. bloginfo('name'); echo '</a></h' . $bfa_ata['h_blogtitle'] . '>';
  341. }
  342. if ($bfa_ata['overlay_blog_tagline'] == "Yes") {
  343. echo '<p class="tagline">'; bloginfo('description'); echo '</p>';
  344. }
  345. echo '</div>';
  346. }
  347.  
  348. echo '</div>';
  349.  
  350. $header_image = ob_get_contents();
  351.  
  352. ob_end_clean();
  353. }
  354.  
  355.  
  356.  
  357. // Horizontal bar 1
  358. if ( strpos($header_items,'%bar1') !== FALSE ) {
  359. $horizontal_bar1 = '<div class="horbar1">&nbsp;</div>';
  360. }
  361.  
  362.  
  363. // Horizontal bar 2
  364. if ( strpos($header_items,'%bar2') !== FALSE ) {
  365. $horizontal_bar2 = '<div class="horbar2">&nbsp;</div>';
  366. }
  367.  
  368.  
  369. $header_item_numbers = array(
  370. "%pages",
  371. "%page-center",
  372. "%page-right",
  373. "%cats",
  374. "%cat-center",
  375. "%cat-right",
  376. "%logo",
  377. "%image",
  378. "%bar1",
  379. "%bar2"
  380. );
  381.  
  382. $header_output = array(
  383. $page_menu_bar,
  384. $page_menu_bar,
  385. $page_menu_bar,
  386. $cat_menu_bar,
  387. $cat_menu_bar,
  388. $cat_menu_bar,
  389. $logo_area,
  390. $header_image,
  391. $horizontal_bar1,
  392. $horizontal_bar2
  393. );
  394.  
  395.  
  396. // Parse PHP code
  397. if ( strpos($header_items,'<?php ') !== FALSE ) {
  398. ob_start();
  399. eval('?>'.$header_items);
  400. $header_items = ob_get_contents();
  401. ob_end_clean();
  402. }
  403.  
  404.  
  405. $header_items = trim($header_items);
  406. #$header_items = str_replace(" ", "", $header_items);
  407. $final_header = str_replace($header_item_numbers, $header_output, $header_items);
  408.  
  409.  
  410. echo $final_header;
  411. }
  412. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement