Advertisement
Guest User

function_000000

a guest
Oct 1st, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 47.91 KB | None | 0 0
  1. <?php
  2. define('TEMPLATE_DOMAIN', 'bp-corp');
  3. define('EDITOR_BG_ENABLE', 'no'); //should be yes or no...
  4. define('USE_NEW_COMMENT_FORM','no');
  5. ////////////////////////////////////////////////////////////////////////////////
  6. // load text domain
  7. ////////////////////////////////////////////////////////////////////////////////
  8. load_theme_textdomain( TEMPLATE_DOMAIN, TEMPLATEPATH . '/languages/' );
  9.  
  10. ///////////////////////////////////////////////////////////////////////////////
  11. // Load Theme Styles and Javascripts
  12. ///////////////////////////////////////////////////////////////////////////////
  13. /*---------------------------load styles--------------------------------------*/
  14. if ( ! function_exists( 'devtheme_load_styles' ) ) :
  15. function devtheme_load_styles() {
  16. global $theme_version, $bp_existed;
  17. wp_enqueue_style( 'dev-base', get_template_directory_uri() . '/_inc/css/base.css', array(), $theme_version );
  18.  
  19. if($bp_existed):
  20. wp_enqueue_style( 'dev-bp-base', get_template_directory_uri() . '/_inc/css/bp-default.css', array( 'dev-base' ), $theme_version );
  21. wp_enqueue_style( 'dev-bp-css', get_template_directory_uri() . '/_inc/css/bp-css.css', array( 'dev-base' ), $theme_version );
  22. wp_enqueue_style( 'dev-bp-adminbar', get_template_directory_uri() . '/_inc/css/adminbar.css', array( 'dev-base' ), $theme_version );
  23. endif;
  24.  
  25. if( is_rtl() ):
  26. wp_enqueue_style( 'dev-rtl', get_template_directory_uri() . '/_inc/css/rtl.css', array( 'dev-base' ), $theme_version );
  27. endif;
  28.  
  29. if( file_exists( TEMPLATEPATH . '/_inc/css/custom.css' ) ):
  30. wp_enqueue_style( 'dev-custom', get_template_directory_uri() . '/_inc/css/custom.css', array( 'dev-base' ), $theme_version );
  31. endif;
  32.  
  33. // If the current theme is a child theme, enqueue its stylesheet
  34. if ( is_child_theme() && 'bp-corporate' == get_template() ) {
  35. if( file_exists( STYLESHEETPATH . '/_inc/css/child-style.css' ) ):
  36. wp_enqueue_style( 'dev-base-child', get_stylesheet_directory_uri() . '/_inc/css/child-style.css', array( 'dev-base' ), $theme_version );
  37. endif;
  38. }
  39.  
  40. ?>
  41.  
  42. <?php
  43. }
  44. endif;
  45. add_action( 'wp_enqueue_scripts', 'devtheme_load_styles' );
  46.  
  47. /*---------------------------load js scripts--------------------------------------*/
  48. if ( ! function_exists( 'devtheme_load_scripts' ) ) :
  49. function devtheme_load_scripts() {
  50. global $theme_version, $bp_existed;
  51. $home_featured_block_style = get_option('tn_buddycorp_home_featured_block_style');
  52. wp_enqueue_script("jquery");
  53. wp_enqueue_script('dev-dropmenu-js', get_template_directory_uri() . '/_inc/js/dropmenu.js', array( 'jquery' ), $theme_version );
  54. wp_enqueue_script('modernizr', get_template_directory_uri() . '/_inc/js/modernizr.js', array("jquery"), $theme_version );
  55. if( $home_featured_block_style == 'slideshow' ):
  56. wp_enqueue_script('dev-nivo-slider', get_template_directory_uri() . '/_inc/js/jquery.nivo.slider.js', array("jquery"), $theme_version );
  57. endif;
  58. if ( is_singular() && get_option( 'thread_comments' ) && comments_open() ) wp_enqueue_script( 'comment-reply' );
  59. }
  60. endif;
  61. add_action( 'wp_enqueue_scripts', 'devtheme_load_scripts' );
  62.  
  63.  
  64. ///////////////////////////////////////////////////////////////////////////
  65. // Update Notifications Notice
  66. ///////////////////////////////////////////////////////////////////////////
  67. if ( !function_exists( 'wdp_un_check' ) ) {
  68.   add_action( 'admin_notices', 'wdp_un_check', 5 );
  69.   add_action( 'network_admin_notices', 'wdp_un_check', 5 );
  70.   function wdp_un_check() {
  71.     if ( !class_exists( 'WPMUDEV_Update_Notifications' ) && current_user_can( 'edit_users' ) )
  72.       echo '<div class="error fade"><p>' . __('Please install the latest version of <a href="http://premium.wpmudev.org/project/update-notifications/" title="Download Now &raquo;">our free Update Notifications plugin</a> which helps you stay up-to-date with the most stable, secure versions of WPMU DEV themes and plugins. <a href="http://premium.wpmudev.org/wpmu-dev/update-notifications-plugin-information/">More information &raquo;</a>', 'wpmudev') . '</a></p></div>';
  73.   }
  74. }
  75.  
  76. ////////////////////////////////////////////////////////////////////////////////
  77. // browser detect
  78. ////////////////////////////////////////////////////////////////////////////////
  79. add_filter('body_class','browser_body_class');
  80. function browser_body_class($classes) {
  81. global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
  82.  
  83.     if($is_lynx) $classes[] = 'lynx';
  84.     elseif($is_gecko) $classes[] = 'gecko';
  85.     elseif($is_opera) $classes[] = 'opera';
  86.     elseif($is_NS4) $classes[] = 'ns4';
  87.     elseif($is_safari) $classes[] = 'safari';
  88.     elseif($is_chrome) $classes[] = 'chrome';
  89.     elseif($is_IE) $classes[] = 'ie';
  90.     else $classes[] = 'unknown';
  91.     if($is_iphone) $classes[] = 'iphone';
  92.     return $classes;
  93. }
  94.  
  95.  
  96. ////////////////////////////////////////////////////////////////////
  97. // IE CSS Hacks
  98. ///////////////////////////////////////////////////////////////////
  99. function wp_add_css_ie_tweak() {
  100. global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
  101. if( $is_IE ) { ?>
  102. <style type="text/css">
  103. .picture-activity-thumb { width: 100px; height: 100px; display: block; }
  104. img.feat-thumb { width: auto; max-width: 600px; height: auto !important; }
  105. </style>
  106. <?php }
  107. }
  108.  
  109. add_action('wp_head','wp_add_css_ie_tweak');
  110.  
  111.  
  112. ////////////////////////////////////////////////////////////////////////////////
  113. // Get Featured Post Image
  114. ////////////////////////////////////////////////////////////////////////////////
  115. function wp_custom_post_thumbnail($the_post_id='', $with_wrap='', $wrap_w='', $wrap_h='', $title='', $fetch_size='',$fetch_w='', $fetch_h='',$alt_class='') {
  116. // do global first
  117. global $wpdb, $post, $posts;
  118. $detect_post_id = $the_post_id;
  119. if($with_wrap == 'yes') {
  120. $before_wrap = "<div style='width: $wrap_w; height: $wrap_h; overflow: hidden;'>";
  121. $after_wrap = "</div>";
  122. }
  123. ?>
  124.  
  125. <?php if( get_the_post_thumbnail() != "" ) : ?>
  126.  
  127. <?php
  128. $image_id = get_post_thumbnail_id();
  129. if($fetch_size == 'original') {
  130. $image_url = wp_get_attachment_image_src($image_id,'large');
  131. } else {
  132. $image_url = wp_get_attachment_image_src($image_id,array($fetch_w,$fetch_h));
  133. }
  134. $image_url = $image_url[0];
  135. ?>
  136. <?php echo $before_wrap; ?>
  137. <img width="<?php echo $fetch_w; ?>" height="auto" class="feat-post-thumbnail <?php echo $alt_class; ?>" title="<?php the_title(); ?>" alt="" src="<?php echo $image_url; ?>">
  138. <?php echo $after_wrap; ?>
  139.  
  140.  
  141. <?php else: ?>
  142.  
  143. <?php
  144. $images = get_children(array(
  145. 'post_parent' => $the_post_id,
  146. 'post_type' => 'attachment',
  147. 'numberposts' => 1,
  148. 'post_mime_type' => 'image')); ?>
  149. <?php if ($images) : ?>
  150. <?php foreach($images as $image) :
  151. if($fetch_size == 'original') {
  152. $attachment= wp_get_attachment_image_src($image->ID,'large');
  153. } else {
  154. $attachment= wp_get_attachment_image_src($image->ID, array($fetch_w,$fetch_h));
  155. } ?>
  156. <?php echo $before_wrap; ?>
  157. <img width="<?php echo $fetch_w; ?>" height="auto" class="feat-post-attachment <?php echo $alt_class; ?>" title="<?php the_title(); ?>" alt="" src="<?php echo $attachment[0]; ?>">
  158. <?php echo $after_wrap; ?>
  159. <?php endforeach; ?>
  160.  
  161.  
  162. <?php elseif( !$images ): ?>
  163.  
  164. <?php
  165. $get_post_attachment = $wpdb->get_var("SELECT guid FROM " . $wpdb->prefix . "posts WHERE post_parent = '" . $detect_post_id . "' AND post_type = 'attachment' ORDER BY menu_order ASC LIMIT 1");
  166. // If images exist for this page
  167.  
  168. if($get_post_attachment) {  ?>
  169. <img width="<?php echo $fetch_w; ?>" height="auto" class="feat-post-wp <?php echo $alt_class; ?>" title="<?php the_title(); ?>" alt="" src="<?php echo $get_post_attachment; ?>">
  170.  
  171. <?php } else { ?>
  172.  
  173. <?php
  174. $first_img = '';
  175. ob_start();
  176. ob_end_clean();
  177. $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  178. $first_img = $matches[1][0]; ?>
  179.  
  180. <?php if($first_img) { ?>
  181. <?php echo $before_wrap; ?>
  182. <img width="<?php echo $fetch_w; ?>" height="auto" class="feat-post-regex <?php echo $alt_class; ?>" title="<?php the_title(); ?>" alt="" src="<?php echo $first_img; ?>">
  183. <?php echo $after_wrap; ?>
  184. <?php } ?>
  185.  
  186. <?php } ?>
  187.  
  188. <?php endif; ?>
  189.  
  190. <?php endif; ?>
  191.  
  192. <?php }
  193.  
  194. ////////////////////////////////////////////////////////////////////////////////
  195. // new code for wp 3.0+
  196. ////////////////////////////////////////////////////////////////////////////////
  197. if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
  198.     add_theme_support( 'post-thumbnails' );
  199.     set_post_thumbnail_size( 200, 150, true ); // Normal post thumbnails
  200.     add_image_size( 'single-post-thumbnail', 600, 9999 ); // Permalink thumbnail size
  201.  
  202.     // Add default posts and comments RSS feed links to head
  203.     add_theme_support( 'automatic-feed-links' );
  204.  
  205.     if(EDITOR_BG_ENABLE == 'yes') {
  206.     // This theme styles the visual editor with editor-style.css to match the theme style.
  207.     add_editor_style();
  208.     // This theme allows users to set a custom background
  209.     add_custom_background();
  210.     }
  211.  
  212.     add_theme_support( 'menus' ); // new nav menus for wp 3.0
  213.     if ( ! isset( $content_width ) ) $content_width = 600;
  214.  
  215.     }
  216.  
  217.  
  218. if ( function_exists( 'register_nav_menus' ) ) {
  219.     // This theme uses wp_nav_menu() in one location.
  220.     register_nav_menus( array(
  221.     'top-nav' => __( 'Top Navigation',TEMPLATE_DOMAIN ),
  222.     'main-nav' => __( 'Main Navigation',TEMPLATE_DOMAIN )
  223.     ) );
  224.  
  225.  
  226.  
  227. ///////////////////////////////////////////////////////////////////////////////
  228. // custom walker nav for mobile navigation
  229. ///////////////////////////////////////////////////////////////////////////////
  230. class description_custom_walker extends Walker_Nav_Menu
  231. {
  232.       function start_el(&$output, $item, $depth, $args)
  233.       {
  234.            global $wp_query;
  235.            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  236.  
  237.            $class_names = $value = '';
  238.  
  239.            $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  240.  
  241.            $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
  242.            $class_names = ' class="'. esc_attr( $class_names ) . '"';
  243.  
  244.            $output .= $indent . '';
  245.  
  246.  
  247.  
  248.            $prepend = '';
  249.            $append = '';
  250. //$description  = ! empty( $item->description ) ? '<span>'.esc_attr( $item->description ).'</span>' : '';
  251.  
  252.            if($depth != 0)
  253.            {
  254.                      $description = $append = $prepend = "";
  255.            }
  256.  
  257.             $item_output = $args->before;
  258.             $item_output .= "<option value='" . $item->url . "'>" . $item->title . "</option>";
  259.             $item_output .= $args->after;
  260.  
  261.             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  262.             }
  263. }
  264.  
  265.  
  266.  
  267. function bp_wp_custom_mobile_nav_menu($get_custom_location='', $get_default_menu=''){
  268. $options = array('walker' => new description_custom_walker(), 'theme_location' => "$get_custom_location", 'menu_id' => '', 'echo' => false, 'container' => false, 'container_id' => '', 'fallback_cb' => "$get_default_menu");
  269. $menu = wp_nav_menu($options);
  270. $menu_list = preg_replace( array( '#^<ul[^>]*>#', '#</ul>$#' ), '', $menu );
  271. return $menu_list;
  272. }
  273.  
  274. ///////////////////////////////////////////////////////////////////////////////
  275. // remove open ul to fit the custom bp navigation.php
  276. ///////////////////////////////////////////////////////////////////////////////
  277. function bp_wp_custom_nav_menu($get_custom_location='', $get_default_menu=''){
  278. $options = array('theme_location' => "$get_custom_location", 'menu_id' => '', 'echo' => false, 'container' => false, 'container_id' => '', 'fallback_cb' => "$get_default_menu");
  279. $menu = wp_nav_menu($options);
  280. $menu_list = preg_replace( array( '#^<ul[^>]*>#', '#</ul>$#' ), '', $menu );
  281. return $menu_list;
  282. }
  283.  
  284.  
  285. function revert_wp_menu_page($args) { //revert back to normal if in wp 3.0 and menu not set ?>
  286. <?php
  287.     global $bp;
  288.     $pages_args = array(
  289.         'depth'      => 0,
  290.         'echo'       => false,
  291.         'exclude'    => '',
  292.         'title_li'   => ''
  293.     );
  294.     $menu = wp_page_menu( $pages_args );
  295.     $menu = str_replace( array( '<div class="menu"><ul>', '</ul></div>' ), array( '', '' ), $menu );
  296.     echo $menu;
  297.  ?>
  298. <?php }
  299.  
  300.  
  301. if ( !function_exists( 'wp_dtheme_page_menu_args' ) ) :
  302. function wp_dtheme_page_menu_args( $args ) {
  303.     $args['show_home'] = true;
  304.     return $args;
  305. }
  306. add_filter( 'wp_page_menu_args', 'wp_dtheme_page_menu_args' );
  307. endif;
  308.  
  309.  
  310.  
  311. function revert_wp_mobile_menu_page() {
  312.   global $wpdb;
  313.   $qpage = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . "posts WHERE post_type='page' AND post_status='publish' ORDER by ID");
  314.   foreach ($qpage as $ipage ) {
  315.   echo "<option value='" . get_permalink( $ipage->ID ) . "'>" . $ipage->post_title . "</option>";
  316.   }
  317. }
  318.  
  319.  
  320. function revert_wp_menu_cat() { //revert back to normal if in wp 3.0 and menu not set ?>
  321. <?php wp_list_categories('orderby=id&show_count=0&use_desc_for_title=0&title_li='); ?>
  322. <?php }
  323. }  // end register_nav_menus check
  324.  
  325.  
  326. function get_mobile_navigation($type='', $nav_name='') {
  327.    $id = "{$type}-dropdown";
  328.   $js =<<<SCRIPT
  329. <script type="text/javascript">
  330.  jQuery(document).ready(function($){
  331.   $("select#{$id}").change(function(){
  332.     window.location.href = $(this).val();
  333.   });
  334.  });
  335. </script>
  336. SCRIPT;
  337.     echo $js;
  338.   echo "<select name=\"{$id}\" id=\"{$id}\">";
  339.   echo "<option>Where to?</option>"; ?>
  340. <?php echo bp_wp_custom_mobile_nav_menu($get_custom_location=$nav_name, $get_default_menu='revert_wp_mobile_menu_page'); ?>
  341. <?php echo "</select>"; }
  342.  
  343.  
  344.  
  345. ////////////////////////////////////////////////////////////////////////////////
  346. // includes
  347. ////////////////////////////////////////////////////////////////////////////////
  348. include( TEMPLATEPATH . '/_inc/functions/conditional-functions.php' );
  349. include( TEMPLATEPATH . '/_inc/functions/widgets-functions.php' );
  350.  
  351. ///////////////////////////////////////////////////////////////////////////
  352. // Custom footer code
  353. ///////////////////////////////////////////////////////////////////////////
  354. if ( ! function_exists( 'wp_network_footer' ) ) :
  355. function wp_network_footer() {
  356. global $blog_id, $current_site, $current_blog;
  357. if( is_multisite() ) {
  358. $current_site = get_current_site();
  359. $current_network_site = get_current_site_name(get_current_site());
  360. if ( function_exists( 'bp_exists' ) ) {
  361. $current_network_domain = bp_get_root_domain();
  362. } else {
  363. if(function_exists('network_home_url')) {
  364. $current_network_domain = network_home_url();
  365. } else {
  366. $current_network_domain = 'http://' . $current_site->domain . $current_site->path;
  367. }
  368. }
  369. if( BLOG_ID_CURRENT_SITE != $current_blog->blog_id && BP_ROOT_BLOG != $current_blog->blog_id ) { ?>
  370. <?php _e('Hosted by', TEMPLATE_DOMAIN); ?> <a target="_blank" title="<?php echo $current_network_site->site_name; ?>" href="<?php echo $current_network_domain; ?>"><?php echo $current_network_site->site_name; ?></a>
  371. <?php } ?>
  372. <?php
  373. }
  374. }
  375. endif;
  376.  
  377.  
  378. if($bp_existed == 'true') { // check if bp existed
  379. //load buddypress default functions//
  380. include( TEMPLATEPATH . '/bp-functions.php' );
  381. ///////////////////////////////////////////////////////////////////////
  382. /// check if is friend
  383. ///////////////////////////////////////////////////////////////////////
  384. function bp_displayed_user_is_friend() {
  385. global $bp;
  386. $friend_privacy_enable = get_option('tn_buddycorp_friend_privacy_status');
  387. $friend_privacy_redirect = get_option('tn_buddycorp_friend_privacy_redirect');
  388.  
  389. if($friend_privacy_enable == "enable") {
  390. if ( bp_is_user_activity() || bp_is_user_profile() || bp_is_member() ) {
  391. if ( ('is_friend' != BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $bp->displayed_user->id )) && (bp_loggedin_user_id() != bp_displayed_user_id()) ) {
  392. if ( !is_super_admin( bp_loggedin_user_id() ) ) {
  393. if($friend_privacy_redirect == '') {
  394. bp_core_redirect( $bp->root_domain );
  395. } else {
  396. bp_core_redirect( $friend_privacy_redirect );
  397. }
  398. }
  399. }
  400. }
  401. } //enable
  402. }
  403. add_filter('get_header','bp_displayed_user_is_friend',3);
  404.  
  405. ///////////////////////////////////////////////////////////////
  406. // check privacy
  407. ////////////////////////////////////////////////////////////////
  408. function check_if_privacy_on() {
  409. global $bp;
  410. $privacy_enable = get_option('tn_buddycorp_privacy_status');
  411. $privacy_redirect = get_option('tn_buddycorp_privacy_redirect');
  412. if($privacy_enable == "enable") {
  413. if ( bp_is_profile_component() || bp_is_activity_component() || bp_is_page( bp_get_root_slug( 'members' ) ) || bp_is_member() ) {
  414. if(!is_user_logged_in()) {
  415. if($privacy_redirect == '') {
  416. bp_core_redirect( $bp->root_domain . '/' . bp_get_root_slug( 'register' ) . '/' );
  417. } else {
  418. bp_core_redirect( $privacy_redirect );
  419. }
  420. }
  421. }
  422. } //off
  423. }
  424. add_filter('get_header','check_if_privacy_on',1);
  425.  
  426. function check_if_create_group_limit() {
  427. global $bp;
  428. $create_limit_enable = get_option('tn_buddycorp_create_group_status');
  429. $create_limit_redirect = get_option('tn_buddycorp_create_group_redirect');
  430. if($create_limit_enable == "yes") {
  431. if( bp_is_group_create() ) {
  432. if ( current_user_can( 'delete_others_posts' ) ) { //only admins and editors
  433. } else {
  434. if( $create_limit_redirect == '' ) {
  435. bp_core_redirect( $bp->root_domain . '/' );
  436. } else {
  437. bp_core_redirect( $create_limit_redirect );
  438. }
  439. }
  440. }
  441.  
  442. } //off
  443. }
  444. add_filter('get_header','check_if_create_group_limit',2);
  445.  
  446. ///////////////////////////////////////////////////////////////////////
  447. /// add like it facebook stream
  448. ///////////////////////////////////////////////////////////////////////
  449. function add_stream_facebooklike_button() { ?>
  450. <?php if(is_user_logged_in()) { ?>
  451. <p style="margin: 14px 0px; float:left; width: 100%; clear:both;"><iframe src="http://www.facebook.com/plugins/like.php?href=<?php bp_activity_thread_permalink() ?>&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; float: left; width: 100%; height: 30px; overflow:hidden;"></iframe>
  452. </p>
  453. <?php } ?>
  454. <?php }
  455.  
  456.  
  457. $tn_buddycorp_stream_facebook_like_status = get_option('tn_buddycorp_stream_facebook_like_status');
  458.  
  459. if($tn_buddycorp_stream_facebook_like_status == 'enable') {
  460. add_action('bp_activity_entry_content', 'add_stream_facebooklike_button');
  461. }
  462.  
  463.  
  464. } // end bp existed check
  465.  
  466.  
  467.  
  468. ///////////////////////////////////////////////////////////////
  469. // single wp adminbar css
  470. ////////////////////////////////////////////////////////////////
  471.  
  472. /* original code from jonas john */
  473. if( !function_exists('colourCreator') ) {
  474. function colourCreator($colour, $per)
  475. {
  476.     $colour = substr( $colour, 1 ); // Removes first character of hex string (#)
  477.     $rgb = ''; // Empty variable
  478.     $per = $per/100*255; // Creates a percentage to work with. Change the middle figure to control colour temperature
  479.  
  480.     if  ($per < 0 ) // Check to see if the percentage is a negative number
  481.     {
  482.         // DARKER
  483.         $per =  abs($per); // Turns Neg Number to Pos Number
  484.         for ($x=0;$x<3;$x++)
  485.         {
  486.             $c = hexdec(substr($colour,(2*$x),2)) - $per;
  487.             $c = ($c < 0) ? 0 : dechex($c);
  488.             $rgb .= (strlen($c) < 2) ? '0'.$c : $c;
  489.         }
  490.     }
  491.     else
  492.     {
  493.         // LIGHTER
  494.         for ($x=0;$x<3;$x++)
  495.         {
  496.             $c = hexdec(substr($colour,(2*$x),2)) + $per;
  497.             $c = ($c > 255) ? 'ff' : dechex($c);
  498.             $rgb .= (strlen($c) < 2) ? '0'.$c : $c;
  499.         }
  500.     }
  501.     return '#'.$rgb;
  502. }
  503.          }
  504.  
  505. if( !is_multisite() ) {
  506.  
  507. function buddypress_single_adminbar_css() {
  508. $ms_bg = get_option('tn_buddycorp_adminbar_bg_color');
  509. $ms_hover_bg = get_option('tn_buddycorp_adminbar_hover_bg_color');
  510. ?>
  511. <?php if( $ms_bg ) { print "<style type='text/css'>"; ?>
  512. div#wp-admin-bar, div#wpadminbar { z-index: 9999; background: <?php echo $ms_bg; ?> none !important; }
  513. div#wpadminbar .quicklinks > ul > li { border-right: 1px solid <?php echo colourCreator($ms_bg,-20); ?> !important; }
  514. #wpadminbar .quicklinks > ul > li > a, #wpadminbar .quicklinks > ul > li > .ab-empty-item, #wpadminbar .quicklinks .ab-top-secondary > li a {
  515.    border-right: 0px none !important;
  516.    border-left: 0px none !important;
  517. }
  518. #wpadminbar .ab-top-secondary {
  519.   background: <?php echo colourCreator($ms_bg,-10); ?> none !important;
  520. }
  521. #wpadminbar .quicklinks .ab-top-secondary > li {
  522.   border-left: 1px solid <?php echo colourCreator($ms_bg,20); ?> !important;
  523.   }
  524.  
  525. div#wp-admin-bar ul.main-nav li:hover, div#wp-admin-bar ul.main-nav li.sfhover, div#wp-admin-bar ul.main-nav li ul li.sfhover {
  526. background: <?php echo $ms_hover_bg; ?> none !important; }
  527. #wp-admin-bar .padder { background: transparent none !important; }
  528. <?php print "</style>"; ?>
  529. <?php } }
  530.  
  531. add_action('wp_enqueue_scripts', 'buddypress_single_adminbar_css'); // init global wp_head
  532. add_action('admin_enqueue_scripts', 'buddypress_single_adminbar_css'); // init global admin_head
  533.  
  534. }
  535.  
  536.  
  537.  
  538. ////////////////////////////////////////////////////////////////////////////////
  539. // wp 2.7 wp_list_comment
  540. ////////////////////////////////////////////////////////////////////////////////
  541.  
  542. function list_comments($comment, $args, $depth) {
  543. $GLOBALS['comment'] = $comment; ?>
  544. <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
  545. <div class="comment-body" id="div-comment-<?php comment_ID(); ?>">
  546. <?php if($bp_existed == 'true') { // check if bp existed  ?>
  547. <?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => 52, 'height' => 52, 'email' => $comment->comment_author_email ) ); ?>
  548. <?php } else { ?>
  549. <?php echo get_avatar( $comment, 52 ) ?>
  550. <?php } ?>
  551. <div class="comment-author vcard">
  552. <cite class="fn"><?php comment_author_link() ?></cite> <span class="says">-</span> <small><a href="#comment-<?php comment_ID() ?>"><?php comment_date(__('F jS, Y', TEMPLATE_DOMAIN)) ?> <?php _e("at",TEMPLATE_DOMAIN); ?> <?php comment_time() ?>
  553. </a></small>
  554. <div id="comment-text-<?php comment_ID(); ?>" class="comment_text">
  555. <?php if ($comment->comment_approved == '0') : ?>
  556. <em><?php _e('Your comment is awaiting moderation.', TEMPLATE_DOMAIN); ?></em>
  557. <?php endif; ?>
  558. <?php comment_text() ?>
  559. <div class="reply">
  560. <?php comment_reply_link(array_merge( $args, array('add_below'=> 'comment-text', 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  561. </div>
  562. </div>
  563. </div>
  564. </div>
  565. <?php
  566. }
  567.  
  568. ////////////////////////////////////////////////////////////////////////////////
  569. // wp 2.7 wp_list_pingback
  570. ////////////////////////////////////////////////////////////////////////////////
  571.  
  572. function list_pings($comment, $args, $depth) {
  573. $GLOBALS['comment'] = $comment; ?>
  574. <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>
  575. <?php }
  576.  
  577. add_filter('get_comments_number', 'comment_count', 0);
  578.  
  579. function comment_count( $count ) {
  580.     global $id;
  581.     $comment_chk_variable = get_comments('post_id=' . $id);
  582.     $comments_by_type = &separate_comments($comment_chk_variable);
  583.     return count($comments_by_type['comment']);
  584. }
  585.  
  586.  
  587. ////////////////////////////////////////////////////////////////////////////////
  588. // shorter string
  589. ////////////////////////////////////////////////////////////////////////////////
  590. function short_text($text='', $wordcount='') {
  591. $text_count = strlen( $text );
  592. if ( $text_count <= $wordcount ) {
  593. $text = $text;
  594. } else {
  595. $text = substr( $text, 0, $wordcount );
  596. $text = $text . '...';
  597. }
  598. return $text;
  599. }
  600.  
  601. ////////////////////////////////////////////////////////////////////////////////
  602. // WP-PageNavi
  603. ////////////////////////////////////////////////////////////////////////////////
  604. function custom_wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
  605.     global $request, $posts_per_page, $wpdb, $paged;
  606.     if(empty($prelabel)) {
  607.         $prelabel  = '<strong>&laquo;</strong>';
  608.     }
  609.     if(empty($nxtlabel)) {
  610.         $nxtlabel = '<strong>&raquo;</strong>';
  611.     }
  612.     $half_pages_to_show = round($pages_to_show/2);
  613.     if (!is_single()) {
  614.         if(!is_category()) {
  615.             preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches);
  616.         } else {
  617.             preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
  618.         }
  619.         $fromwhere = $matches[1];
  620.         $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
  621.         $max_page = ceil($numposts /$posts_per_page);
  622.         if(empty($paged)) {
  623.             $paged = 1;
  624.         }
  625.         if($max_page > 1 || $always_show) {
  626.             echo "$before <div class=\"wp-pagenavi\"><span class=\"pages\">Page $paged of $max_page:</span>";
  627.             if ($paged >= ($pages_to_show-1)) {
  628.                 echo '<a href="'.get_pagenum_link().'">&laquo; First</a>';
  629.             }
  630.             previous_posts_link($prelabel);
  631.             for($i = $paged - $half_pages_to_show; $i  <= $paged + $half_pages_to_show; $i++) {
  632.                 if ($i >= 1 && $i <= $max_page) {
  633.                     if($i == $paged) {
  634.                         echo "<strong class='current'>$i</strong>";
  635.                     } else {
  636.                         echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
  637.                     }
  638.                 }
  639.             }
  640.             next_posts_link($nxtlabel, $max_page);
  641.             if (($paged+$half_pages_to_show) < ($max_page)) {
  642.                 echo '<a href="'.get_pagenum_link($max_page).'">Last &raquo;</a>';
  643.             }
  644.             echo "</div> $after";
  645.         }
  646.     }
  647. }
  648.  
  649.  
  650.  
  651. ////////////////////////////////////////////////////////////////////////////////
  652. // Comment and pingback separate controls
  653. ////////////////////////////////////////////////////////////////////////////////
  654. $bm_trackbacks = array();
  655. $bm_comments = array();
  656. function split_comments( $source ) {
  657. if ( $source ) foreach ( $source as $comment ) {
  658. global $bm_trackbacks;
  659. global $bm_comments;
  660. if ( $comment->comment_type == 'trackback' || $comment->comment_type == 'pingback' ) {
  661. $bm_trackbacks[] = $comment;
  662. } else {
  663. $bm_comments[] = $comment;
  664. }
  665. }
  666. }
  667.  
  668. ////////////////////////////////////////////////////////////////////////////////
  669. // excerpt the_content()
  670. ////////////////////////////////////////////////////////////////////////////////
  671. function custom_the_excerpt($limit) {
  672.   $excerpt = explode(' ', get_the_excerpt(), $limit);
  673.   if (count($excerpt)>=$limit) {
  674.     array_pop($excerpt);
  675.     $excerpt = implode(" ",$excerpt).'...';
  676.   } else {
  677.     $excerpt = implode(" ",$excerpt);
  678.   }
  679.   $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
  680.   return $excerpt;
  681. }
  682.  
  683. function custom_the_content($limit) {
  684. global $id, $post;
  685.   $content = explode(' ', get_the_content(), $limit);
  686.   if (count($content)>=$limit) {
  687.     array_pop($content);
  688.     $content = implode(" ",$content).'...';
  689.   } else {
  690.     $content = implode(" ",$content);
  691.   }
  692.   $content = preg_replace('/\[.+\]/','', $content);
  693.   $content = apply_filters('the_content', $content);
  694.   $content = str_replace(']]>', ']]&gt;', $content);
  695.   $content = strip_tags($content, '<p>');
  696.   return $content . "<p><a href=\"". get_permalink() . "#more-$id\">" . __('...Click here to read more &raquo;', TEMPLATE_DOMAIN) . "</a></p>";
  697. }
  698.  
  699. ////////////////////////////////////////////////////////////////////////////////
  700. // excerpt features
  701. ////////////////////////////////////////////////////////////////////////////////
  702. function the_excerpt_feature($excerpt_length='', $allowedtags='', $filter_type='none', $use_more_link='', $more_link_text = '', $force_more_link=true, $fakeit=1, $fix_tags=true) {
  703.  
  704. if (preg_match('%^content($|_rss)|^excerpt($|_rss)%', $filter_type)) {
  705. $filter_type = 'the_' . $filter_type;
  706. }
  707. $text = apply_filters($filter_type, get_the_excerpt_feature($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit));
  708. $text = ($fix_tags) ? balanceTags($text) : $text;
  709. echo $text;
  710. }
  711.  
  712. function get_the_excerpt_feature($excerpt_length, $allowedtags, $use_more_link, $more_link_text, $force_more_link, $fakeit) {
  713. global $id, $post;
  714. $output = '';
  715. $output = $post->post_excerpt;
  716. if (!empty($post->post_password)) { // if there's a password
  717. if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
  718. $output = __('There is no excerpt because this is a protected post.', TEMPLATE_DOMAIN);
  719. return $output;
  720. }
  721. }
  722.  
  723. // If we haven't got an excerpt, make one.
  724. if ((($output == '') && ($fakeit == 1)) || ($fakeit == 2)) {
  725. $output = $post->post_content;
  726. $output = strip_tags($output, $allowedtags);
  727.  
  728. $output = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $output );
  729.  
  730. $blah = explode(' ', $output);
  731. if (count($blah) > $excerpt_length) {
  732. $k = $excerpt_length;
  733. $use_dotdotdot = 1;
  734. } else {
  735. $k = count($blah);
  736. $use_dotdotdot = 0;
  737. }
  738. $excerpt = '';
  739. for ($i=0; $i<$k; $i++) {
  740. $excerpt .= $blah[$i] . ' ';
  741. }
  742. // Display "more" link (use css class 'more-link' to set layout).
  743. if (($use_more_link && $use_dotdotdot) || $force_more_link) {
  744. $excerpt .= "<a href=\"". get_permalink() . "#more-$id\">" . __('<br />...Click here to read more &raquo;', TEMPLATE_DOMAIN) . "</a>";
  745. } else {
  746. $excerpt .= ($use_dotdotdot) ? '...' : '';
  747. }
  748. $output = $excerpt;
  749. } // end if no excerpt
  750. return $output;
  751. }
  752.  
  753. ///////////////////////////////////////////////////////////////////////////////
  754. // fetch post img
  755. //////////////////////////////////////////////////////////////////////////////
  756. function dez_get_attachment($the_post_id = '') {
  757. global $wpdb;
  758. $detect_post_id = $the_post_id;
  759. $post_attachment_query = "SELECT guid FROM " . $wpdb->prefix . "posts WHERE post_parent = '" . $detect_post_id . "' AND post_type = 'attachment' ORDER BY menu_order ASC LIMIT 1";
  760. $get_post_attachment = $wpdb->get_var($post_attachment_query);
  761. // If images exist for this page
  762. if(!$get_post_attachment) { ?>
  763. <img title="<h1><?php the_title(); ?></h1>" alt="" src="<?php get_template_directory_uri(); ?>/_inc/images/no-images.jpg">
  764. <?php } else {  ?>
  765. <img title="<h1><?php the_title(); ?></h1>" alt="" src="<?php echo $get_post_attachment; ?>">
  766. <?php }
  767. }
  768.  
  769.  
  770. ///////////////////////////////////////////////////////////////////////////////
  771. // Get total count of multiple categories
  772. //////////////////////////////////////////////////////////////////////////////
  773. function dev_multi_category_count($catslugs = '') {
  774. global $wpdb;
  775. $catslug_array = $catslugs;
  776. $slug_where = "cat_terms.term_id IN (" . $catslug_array . ")";
  777.  
  778. $sql =  "SELECT COUNT( DISTINCT cat_posts.ID ) AS post_count " .
  779.             "FROM   " . $wpdb->term_taxonomy . " AS cat_term_taxonomy INNER JOIN " . $wpdb->terms . " AS cat_terms ON " .
  780.                         "cat_term_taxonomy.term_id = cat_terms.term_id " .
  781.                     "INNER JOIN " . $wpdb->term_relationships . " AS cat_term_relationships ON " .
  782.                         "cat_term_taxonomy.term_taxonomy_id = cat_term_relationships.term_taxonomy_id " .
  783.                     "INNER JOIN " . $wpdb->posts . " AS cat_posts ON " .
  784.                         "cat_term_relationships.object_id = cat_posts.ID " .
  785.             "WHERE  cat_posts.post_status = 'publish' AND " .
  786.                     "cat_posts.post_type = 'post' AND " .
  787.                     "cat_term_taxonomy.taxonomy = 'category' AND " .
  788.                     $slug_where;
  789.  
  790. $post_count = $wpdb->get_var($sql);
  791. return $post_count;
  792.  
  793. }
  794.  
  795. ///////////////////////////////////////////////////////////////////////////////
  796. // get blogs posts and comments count
  797. //////////////////////////////////////////////////////////////////////////////
  798. function get_the_current_blog_post_count() {
  799. global $wpdb;
  800. $numposts = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "posts WHERE post_status = 'publish' AND post_type= 'post'");
  801. return $numposts;
  802. }
  803.  
  804. function get_the_current_blog_comment_count() {
  805. global $wpdb;
  806. $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "comments WHERE comment_approved = '1'");
  807. return $numcomms;
  808. }
  809. ///////////////////////////////////////////////////////////////
  810. // http and https detect function
  811. ////////////////////////////////////////////////////////////////
  812. function server_https_detect() {
  813. if($_SERVER['HTTPS']){
  814. $the_server_ssl = 'https://';
  815. } else {
  816. $the_server_ssl = 'http://';
  817. }
  818. return $the_server_ssl;
  819. }
  820. ///////////////////////////////////////////////////////////////////////////////
  821. /// Register the widget columns
  822. ///////////////////////////////////////////////////////////////////////////////
  823. function corporate_widgets_init() {
  824. global $bp_existed;
  825. $member_page_layout = get_option('tn_buddycorp_member_page_layout_style');
  826.  
  827. register_sidebar(
  828.     array(
  829.         'name' => __('left-column', TEMPLATE_DOMAIN),
  830.         'id'            => 'left-column',
  831.         'description'   => 'Left Column Widget',
  832.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  833.         'after_widget'  => '</div>',
  834.         'before_title'  => '<h2 class="widgettitle">',
  835.         'after_title'   => '</h2>'
  836.     )
  837. );
  838.  
  839. register_sidebar(
  840.     array(
  841.         'name' => __('center-column', TEMPLATE_DOMAIN),
  842.         'id'            => 'center-column',
  843.         'description'   => 'Center Column Widget',
  844.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  845.         'after_widget'  => '</div>',
  846.         'before_title'  => '<h2 class="widgettitle">',
  847.         'after_title'   => '</h2>'
  848.     )
  849. );
  850.  
  851. register_sidebar(
  852.     array(
  853.         'name' => __('right-column', TEMPLATE_DOMAIN),
  854.         'id'            => 'right-column',
  855.         'description'   => 'Right Column Widget',
  856.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  857.         'after_widget'  => '</div>',
  858.         'before_title'  => '<h2 class="widgettitle">',
  859.         'after_title'   => '</h2>'
  860.     )
  861. );
  862. register_sidebar(
  863.     array(
  864.         'name' => __('blog-sidebar', TEMPLATE_DOMAIN),
  865.         'id'            => 'blog-sidebar',
  866.         'description'   => 'Blog Sidebar Widget',
  867.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  868.         'after_widget'  => '</div>',
  869.         'before_title'  => '<h2 class="widgettitle">',
  870.         'after_title'   => '</h2>'
  871.     )
  872. );
  873.  
  874. register_sidebar(
  875.     array(
  876.         'name' => __('footer-left', TEMPLATE_DOMAIN),
  877.         'id'            => 'footer-left',
  878.         'description'   => 'Footer Left Widget',
  879.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  880.         'after_widget'  => '</div>',
  881.         'before_title'  => '<h2 class="widgettitle">',
  882.         'after_title'   => '</h2>'
  883.     )
  884. );
  885.  
  886.  
  887. register_sidebar(
  888.     array(
  889.         'name' => __('footer-center', TEMPLATE_DOMAIN),
  890.         'id'            => 'footer-center',
  891.         'description'   => 'Footer Center Widget',
  892.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  893.         'after_widget' => '</div>',
  894.         'before_title' => '<h2 class="widgettitle">',
  895.         'after_title' => '</h2>'
  896.     )
  897. );
  898.  
  899. register_sidebar(
  900.     array(
  901.         'name' => __('footer-right', TEMPLATE_DOMAIN),
  902.         'id'            => 'footer-right',
  903.         'description'   => 'Footer Right Widget',
  904.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  905.         'after_widget' => '</div>',
  906.         'before_title' => '<h2 class="widgettitle">',
  907.         'after_title' => '</h2>'
  908.     )
  909. );
  910.  
  911.  
  912.  
  913. if($bp_existed == 'true') {
  914.  
  915. if($member_page_layout == '3-column' || $member_page_layout == '') {
  916.  
  917. register_sidebar(
  918.     array(
  919.         'name' => __('buddypress-left', TEMPLATE_DOMAIN),
  920.         'id'            => 'buddypress-left',
  921.         'description'   => 'BuddyPress Left Widget',
  922.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  923.         'after_widget' => '</div>',
  924.         'before_title' => '<h2 class="widgettitle">',
  925.         'after_title' => '</h2>'
  926.     )
  927. );
  928.  
  929. register_sidebar(
  930.     array(
  931.         'name' => __('buddypress-right', TEMPLATE_DOMAIN),
  932.         'id'            => 'buddypress-right',
  933.         'description'   => 'BuddyPress Right Widget',
  934.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  935.         'after_widget' => '</div>',
  936.         'before_title' => '<h2 class="widgettitle">',
  937.         'after_title' => '</h2>'
  938.     )
  939. );
  940.  
  941.  
  942.  
  943. } else if($member_page_layout == '2-column') {
  944.  
  945. register_sidebar(
  946.     array(
  947.         'name' => __('buddypress-right', TEMPLATE_DOMAIN),
  948.         'id'            => 'buddypress-right',
  949.         'description'   => 'BuddyPress Right Widget',
  950.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  951.         'after_widget' => '</div>',
  952.         'before_title' => '<h2 class="widgettitle">',
  953.         'after_title' => '</h2>'
  954.     )
  955. );
  956.  
  957. } else if($member_page_layout == '1-column') {
  958.  
  959. }
  960.  
  961.  
  962. } // end bp_existed check
  963.  
  964. if ( class_exists( 'bbPress' ) ) {
  965. register_sidebar(array(
  966. 'name'=> __('BBPress Sidebar', TEMPLATE_DOMAIN),
  967. 'id'=> __('bbpress-sidebar', TEMPLATE_DOMAIN),
  968. 'description'=> __('BBPress Sidebar Widget', TEMPLATE_DOMAIN),
  969. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  970.         'after_widget' => '</div>',
  971.         'before_title' => '<h2 class="widgettitle">',
  972.         'after_title' => '</h2>'
  973. ));
  974. }
  975.  
  976. } //end functions
  977.  
  978. add_action( 'widgets_init', 'corporate_widgets_init' );
  979.  
  980.  
  981. ////////////////////////////////////////////////////////////////////////////////
  982. // add theme cms pages
  983. ////////////////////////////////////////////////////////////////////////////////
  984. function dev_remove_all_scripts() {
  985. wp_deregister_script('jquery');
  986. wp_deregister_script('jquery-ui-tabs');
  987. }
  988.  
  989. function buddycorp_head() { ?>
  990. <link href="<?php echo get_template_directory_uri(); ?>/_inc/admin/options-css.css" rel="stylesheet" type="text/css" />
  991. <?php if($_GET["page"] == "options-functions.php") { // only load when viewing theme option ?>
  992. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/_inc/js/jscolor.js"></script>
  993. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/_inc/js/jquery-ui-personalized-1.6rc2.min.js"></script>
  994. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/_inc/js/jquery.cookie.min.js"></script>
  995. <script type="text/javascript">
  996. jQuery.noConflict();
  997. var $jd = jQuery;
  998. $jd(document).ready(function(){
  999. $jd('ul#tabm').tabs({event: "click"});
  1000. });
  1001. </script>
  1002. <link href='http://fonts.googleapis.com/css?family=Cantarell' rel='stylesheet' type='text/css'/>
  1003. <link href='http://fonts.googleapis.com/css?family=Cardo' rel='stylesheet' type='text/css'/>
  1004. <link href='http://fonts.googleapis.com/css?family=Crimson+Text' rel='stylesheet' type='text/css'/>
  1005. <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'/>
  1006. <link href='http://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'/>
  1007. <link href='http://fonts.googleapis.com/css?family=IM+Fell+DW+Pica' rel='stylesheet' type='text/css'/>
  1008. <link href='http://fonts.googleapis.com/css?family=Josefin+Sans+Std+Light' rel='stylesheet' type='text/css'/>
  1009. <link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'/>
  1010. <link href='http://fonts.googleapis.com/css?family=Molengo' rel='stylesheet' type='text/css'/>
  1011. <link href='http://fonts.googleapis.com/css?family=Neuton' rel='stylesheet' type='text/css'/>
  1012. <link href='http://fonts.googleapis.com/css?family=Nobile' rel='stylesheet' type='text/css'/>
  1013. <link href='http://fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT' rel='stylesheet' type='text/css'/>
  1014. <link href='http://fonts.googleapis.com/css?family=Reenie+Beanie' rel='stylesheet' type='text/css'/>
  1015. <link href='http://fonts.googleapis.com/css?family=Tangerine' rel='stylesheet' type='text/css'/>
  1016. <link href='http://fonts.googleapis.com/css?family=Old+Standard+TT' rel='stylesheet' type='text/css'/>
  1017. <link href='http://fonts.googleapis.com/css?family=Volkorn' rel='stylesheet' type='text/css'/>
  1018. <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'/>
  1019. <link href='http://fonts.googleapis.com/css?family=Just+Another+Hand' rel='stylesheet' type='text/css'>
  1020. <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis+Light' rel='stylesheet' type='text/css'>
  1021. <link href='http://fonts.googleapis.com/css?family=Ubuntu:light,regular,bold' rel='stylesheet' type='text/css'>
  1022. <?php add_action('admin_head', 'dev_remove_all_scripts', 100); } ?>
  1023. <?php }
  1024.  
  1025. ////////////////////////////////////////////////////////////////////////////////
  1026. // CUSTOM IMAGE HEADER  - IF ON WILL BE SHOWN ELSE WILL HIDE
  1027. ////////////////////////////////////////////////////////////////////////////////
  1028.  
  1029. $header_enable = get_option('tn_buddycorp_header_on');
  1030. if($header_enable == 'enable') {
  1031.  
  1032. $custom_height = get_option('tn_buddycorp_image_height');
  1033. if($custom_height==''){ $custom_height='150'; } else { $custom_height = get_option('tn_buddycorp_image_height'); }
  1034.  
  1035. define('HEADER_TEXTCOLOR', '');
  1036. define('HEADER_IMAGE', ''); // %s is theme dir uri
  1037. define('HEADER_IMAGE_WIDTH', 988); //width is fixed
  1038. define('HEADER_IMAGE_HEIGHT', $custom_height);
  1039. define('NO_HEADER_TEXT', true );
  1040.  
  1041.  
  1042. function buddycorp_admin_header_style() { ?>
  1043. <style type="text/css">
  1044. #headimg { height: <?php echo HEADER_IMAGE_HEIGHT; ?>px !important; background: #fff url(<?php header_image() ?>) no-repeat; }
  1045. #headimg { height: <?php echo HEADER_IMAGE_HEIGHT; ?>px !important; width: <?php echo HEADER_IMAGE_WIDTH; ?>px !important; }
  1046. #headimg h1, #headimg #desc { display: none !important; }
  1047. </style>
  1048. <?php }
  1049.  
  1050. if (function_exists('add_custom_image_header')) {
  1051. add_custom_image_header('', 'buddycorp_admin_header_style');
  1052. }
  1053. }
  1054. //end check for header image
  1055. add_action('admin_head', 'buddycorp_head');
  1056.  
  1057. include( TEMPLATEPATH . '/_inc/functions/options-functions.php' );
  1058. ////////////////////////////////////////////////////////////////////////////////
  1059. // get members-login slug
  1060. ////////////////////////////////////////////////////////////////////////////////
  1061. function get_the_page_template_slug($tpl) {
  1062. global $wpdb;
  1063. $get_page_template = $wpdb->get_var("SELECT post_id FROM " . $wpdb->prefix . "postmeta WHERE meta_value = '". $tpl ."' AND meta_key = '_wp_page_template'");
  1064. $get_page_template_slug = $wpdb->get_var("SELECT post_name FROM " . $wpdb->prefix . "posts WHERE ID = '" . $get_page_template . "' AND post_type='page'");
  1065. return $get_page_template_slug;
  1066. }
  1067.  
  1068. ////////////////////////////////////////////////////////////////////////////////
  1069. // get google web font
  1070. ////////////////////////////////////////////////////////////////////////////////
  1071. function font_show(){
  1072. $bodytype = get_option('tn_buddycorp_body_font');
  1073. $headtype = get_option('tn_buddycorp_headline_font');
  1074.  
  1075. if ($bodytype == ""){ ?>
  1076. <?php } else if ($bodytype == "Cantarell, arial, serif" ){ ?>
  1077. <link href='http://fonts.googleapis.com/css?family=Cantarell' rel='stylesheet' type='text/css'/>
  1078. <?php } else if ($bodytype == "Cardo, arial, serif"){ ?>
  1079. <link href='http://fonts.googleapis.com/css?family=Cardo' rel='stylesheet' type='text/css'/>
  1080. <?php } else if ($bodytype == "Crimson Text, arial, serif"){ ?>
  1081. <link href='http://fonts.googleapis.com/css?family=Crimson+Text' rel='stylesheet' type='text/css'/>
  1082. <?php } else if ($bodytype == "Droid Sans, arial, serif"){ ?>
  1083. <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'/>
  1084. <?php } else if ($bodytype == "Droid Serif, arial, serif"){ ?>
  1085. <link href='http://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'/>
  1086. <?php } else if ($bodytype == "IM Fell DW Pica, arial, serif"){ ?>
  1087. <link href='http://fonts.googleapis.com/css?family=IM+Fell+DW+Pica' rel='stylesheet' type='text/css'/>
  1088. <?php } else if ($bodytype == "Josefin Sans Std Light, arial, serif"){ ?>
  1089. <link href='http://fonts.googleapis.com/css?family=Josefin+Sans+Std+Light' rel='stylesheet' type='text/css'/>
  1090. <?php } else if ($bodytype == "Lobster, arial, serif"){ ?>
  1091. <link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'/>
  1092. <?php } else if ($bodytype == "Molengo, arial, serif"){ ?>
  1093. <link href='http://fonts.googleapis.com/css?family=Molengo' rel='stylesheet' type='text/css'/>
  1094. <?php } else if ($bodytype == "Neuton, arial, serif"){ ?>
  1095. <link href='http://fonts.googleapis.com/css?family=Neuton' rel='stylesheet' type='text/css'/>
  1096. <?php } else if ($bodytype == "Nobile, arial, serif"){ ?>
  1097. <link href='http://fonts.googleapis.com/css?family=Nobile' rel='stylesheet' type='text/css'/>
  1098. <?php } else if ($bodytype == "OFL Sorts Mill Goudy TT, arial, serif"){ ?>
  1099. <link href='http://fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT' rel='stylesheet' type='text/css'/>
  1100. <?php } else if ($bodytype == "Reenie Beanie, arial, serif"){ ?>
  1101. <link href='http://fonts.googleapis.com/css?family=Reenie+Beanie' rel='stylesheet' type='text/css'/>
  1102. <?php } else if ($bodytype == "Tangerine, arial, serif"){ ?>
  1103. <link href='http://fonts.googleapis.com/css?family=Tangerine' rel='stylesheet' type='text/css'/>
  1104. <?php } else if ($bodytype == "Old Standard TT, arial, serif"){ ?>
  1105. <link href='http://fonts.googleapis.com/css?family=Old+Standard+TT' rel='stylesheet' type='text/css'/>
  1106. <?php } else if ($bodytype == "Volkorn, arial, serif"){ ?>
  1107. <link href='http://fonts.googleapis.com/css?family=Volkorn' rel='stylesheet' type='text/css'/>
  1108. <?php } else if ($bodytype == "Yanone Kaffessatz, arial, serif"){ ?>
  1109. <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'/>
  1110. <?php } else if ($bodytype == "Just Another Hand, arial, serif"){ ?>
  1111. <link href='http://fonts.googleapis.com/css?family=Just+Another+Hand' rel='stylesheet' type='text/css'>
  1112. <?php } else if ($bodytype == "Terminal Dosis Light, arial, serif"){ ?>
  1113. <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis+Light' rel='stylesheet' type='text/css'>
  1114. <?php } else if ($bodytype == "Ubuntu, arial, serif"){ ?>
  1115. <link href='http://fonts.googleapis.com/css?family=Ubuntu:light,regular,bold' rel='stylesheet' type='text/css'>
  1116. <?php }
  1117.  
  1118. if ($headtype == ""){ ?>
  1119. <?php } else if ($headtype == "Cantarell, arial, serif" ){ ?>
  1120. <link href='http://fonts.googleapis.com/css?family=Cantarell' rel='stylesheet' type='text/css'/>
  1121. <?php } else if ($headtype == "Cardo, arial, serif"){ ?>
  1122. <link href='http://fonts.googleapis.com/css?family=Cardo' rel='stylesheet' type='text/css'/>
  1123. <?php } else if ($headtype == "Crimson Text, arial, serif"){ ?>
  1124. <link href='http://fonts.googleapis.com/css?family=Crimson+Text' rel='stylesheet' type='text/css'/>
  1125. <?php } else if ($headtype == "Droid Sans, arial, serif"){ ?>
  1126. <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'/>
  1127. <?php } else if ($headtype == "Droid Serif, arial, serif"){ ?>
  1128. <link href='http://fonts.googleapis.com/css?family=Droid+Serif' rel='stylesheet' type='text/css'/>
  1129. <?php } else if ($headtype == "IM Fell DW Pica, arial, serif"){ ?>
  1130. <link href='http://fonts.googleapis.com/css?family=IM+Fell+DW+Pica' rel='stylesheet' type='text/css'/>
  1131. <?php } else if ($headtype == "Josefin Sans Std Light, arial, serif"){ ?>
  1132. <link href='http://fonts.googleapis.com/css?family=Josefin+Sans+Std+Light' rel='stylesheet' type='text/css'/>
  1133. <?php } else if ($headtype == "Lobster, arial, serif"){ ?>
  1134. <link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'/>
  1135. <?php } else if ($headtype == "Molengo, arial, serif"){ ?>
  1136. <link href='http://fonts.googleapis.com/css?family=Molengo' rel='stylesheet' type='text/css'/>
  1137. <?php } else if ($headtype == "Neuton, arial, serif"){ ?>
  1138. <link href='http://fonts.googleapis.com/css?family=Neuton' rel='stylesheet' type='text/css'/>
  1139. <?php } else if ($headtype == "Nobile, arial, serif"){ ?>
  1140. <link href='http://fonts.googleapis.com/css?family=Nobile' rel='stylesheet' type='text/css'/>
  1141. <?php } else if ($headtype == "OFL Sorts Mill Goudy TT, arial, serif"){ ?>
  1142. <link href='http://fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT' rel='stylesheet' type='text/css'/>
  1143. <?php } else if ($headtype == "Reenie Beanie, arial, serif"){ ?>
  1144. <link href='http://fonts.googleapis.com/css?family=Reenie+Beanie' rel='stylesheet' type='text/css'/>
  1145. <?php } else if ($headtype == "Tangerine, arial, serif"){ ?>
  1146. <link href='http://fonts.googleapis.com/css?family=Tangerine' rel='stylesheet' type='text/css'/>
  1147. <?php } else if ($headtype == "Old Standard TT, arial, serif"){ ?>
  1148. <link href='http://fonts.googleapis.com/css?family=Old+Standard+TT' rel='stylesheet' type='text/css'/>
  1149. <?php } else if ($headtype == "Volkorn, arial, serif"){ ?>
  1150. <link href='http://fonts.googleapis.com/css?family=Volkorn' rel='stylesheet' type='text/css'/>
  1151. <?php } else if ($headtype == "Yanone Kaffeesatz, arial, serif"){ ?>
  1152. <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'>
  1153. <?php } else if ($headtype == "Just Another Hand, arial, serif"){ ?>
  1154. <link href='http://fonts.googleapis.com/css?family=Just+Another+Hand' rel='stylesheet' type='text/css'>
  1155. <?php } else if ($headtype == "Terminal Dosis Light, arial, serif"){ ?>
  1156. <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis+Light' rel='stylesheet' type='text/css'>
  1157. <?php } else if ($headtype == "Ubuntu, arial, serif"){ ?>
  1158. <link href='http://fonts.googleapis.com/css?family=Ubuntu:light,regular,bold' rel='stylesheet' type='text/css'>
  1159. <?php }
  1160. }
  1161.  
  1162.  
  1163. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement