Advertisement
Guest User

theme.php file

a guest
Jan 25th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 97.98 KB | None | 0 0
  1. <?php
  2.  
  3. if ( !function_exists( 'mysite_document_title' ) ) :
  4. /**
  5.  *
  6.  */
  7. function mysite_document_title() {
  8.     global $wp_query;
  9.    
  10.     # Set up some default variables.
  11.     $doctitle = '';
  12.     $separator = ' |';
  13.     $post = $wp_query->get_queried_object();
  14.    
  15.     if ( is_front_page() ) {
  16.        
  17.         $seo_home_title = mysite_get_setting( 'seo_home_title' );
  18.         if( trim( $seo_home_title ) ) {
  19.             $doctitle = $seo_home_title;
  20.         } else {
  21.             $doctitle = get_bloginfo( 'name' ) . $separator . ' ' . get_bloginfo( 'description' );
  22.         }
  23.        
  24.     } else if( is_single() || is_attachment() ) {
  25.        
  26.         $post_title_format = mysite_get_setting( 'seo_post_title_format' );
  27.         $post_title_override = trim( get_post_meta( $post->ID, '_seo_title', true ) );
  28.         if( get_post_meta( $post->ID, '_seo_disable', true ) || !in_array( get_post_type( $post->ID ), mysite_seo_posttypecolumns() ) ) {
  29.             $doctitle = mysite_seo_replace( '%post_title%', $post );
  30.            
  31.         } else if ( !empty( $post_title_override ) ) {
  32.             $doctitle = $post_title_override;
  33.            
  34.         } else if ( trim( $post_title_format ) ) {
  35.             $doctitle = mysite_seo_replace( $post_title_format, $post );
  36.            
  37.         } else {
  38.             $doctitle = mysite_seo_replace( '%post_title%', $post );
  39.         }
  40.        
  41.     } else if ( is_page() ) {
  42.        
  43.         $page_title_format = mysite_get_setting( 'seo_page_title_format' );
  44.         $page_title_override = trim( get_post_meta( $post->ID, '_seo_title', true ) );
  45.         if( get_post_meta( $post->ID, '_seo_disable', true ) || !in_array( get_post_type( $post->ID ), mysite_seo_posttypecolumns() ) ) {
  46.             $doctitle = mysite_seo_replace( '%page_title%', $post );
  47.            
  48.         } else if ( !empty( $page_title_override ) ) {
  49.             $doctitle = $page_title_override;
  50.            
  51.         } else if ( trim( $page_title_format ) ) {
  52.             $doctitle = mysite_seo_replace( $page_title_format, $post );
  53.            
  54.         } else {
  55.             $doctitle = mysite_seo_replace( '%page_title%', $post );
  56.         }
  57.        
  58.     } else if ( is_category() ) {
  59.        
  60.         $category_title_format = mysite_get_setting( 'seo_category_title_format' );
  61.         if( trim( $category_title_format ) ) {
  62.             $doctitle = mysite_seo_replace( $category_title_format, $post );
  63.         } else {
  64.             $doctitle = mysite_seo_replace( '%category_title%', $post );
  65.         }
  66.        
  67.     } else if ( is_date() ) {
  68.        
  69.         $archive_title_format = mysite_get_setting( 'seo_archive_title_format' );
  70.         if( trim( $archive_title_format ) ) {
  71.             $doctitle = mysite_seo_replace( $archive_title_format, $post );
  72.         } else {
  73.             $doctitle = sprintf( __( 'Archive for %1$s', MYSITE_TEXTDOMAIN ), mysite_seo_replace( '%date%', $post ) );
  74.         }
  75.        
  76.     } else if ( is_tag() ) {
  77.        
  78.         $tag_title_format = mysite_get_setting( 'seo_tag_title_format' );
  79.         if( trim( $tag_title_format ) ) {
  80.             $doctitle = mysite_seo_replace( $tag_title_format, $post );
  81.         } else {
  82.             $doctitle = mysite_seo_replace( '%tag%', $post );
  83.         }
  84.        
  85.     } else if ( is_search() ) {
  86.        
  87.         $search_title_format = mysite_get_setting( 'seo_search_title_format' );
  88.         if( trim( $search_title_format ) ) {
  89.             $doctitle = mysite_seo_replace( $search_title_format, $post );
  90.         } else {
  91.             $doctitle = sprintf( __( 'Search results for &quot;%1$s&quot;', MYSITE_TEXTDOMAIN ), mysite_seo_replace( '%search%', $post ) );
  92.         }
  93.        
  94.     } else if( is_404() ) {
  95.  
  96.         $seo_404_title_format = mysite_get_setting( 'seo_404_title_format' );
  97.         if( trim( $seo_404_title_format ) ) {
  98.             $doctitle = mysite_seo_replace( $seo_404_title_format );
  99.         } else {
  100.             $doctitle = mysite_seo_replace( '%404_title%' );
  101.         }
  102.        
  103.     }
  104.    
  105.     if ( ( ( $page = $wp_query->get( 'paged' ) ) || ( $page = $wp_query->get( 'page' ) ) ) && $page > 1 ) {
  106.        
  107.         $seo_paged_format = mysite_get_setting( 'seo_paged_format' );
  108.         if( trim( $seo_paged_format ) ) {
  109.             $doctitle = $doctitle . str_replace( '%page%', $page, $seo_paged_format );
  110.         } else {
  111.             $doctitle = sprintf( __( '%1$s Page %2$s', MYSITE_TEXTDOMAIN ), $doctitle . $separator, number_format_i18n( $page ) );
  112.         }
  113.        
  114.     }
  115.    
  116.     # Apply the wp_title filters so we're compatible with plugins.
  117.     $doctitle = apply_filters( 'wp_title', $doctitle, '', '' );
  118.  
  119.     # Print the title to the screen.
  120.     echo apply_atomic( 'document_title', esc_attr( $doctitle ) );
  121. }
  122. endif;
  123.  
  124. if ( !function_exists( 'mysite_seo_meta' ) ) :
  125. /**
  126.  *
  127.  */
  128. function mysite_seo_meta() {
  129.    
  130.     global $wp_query;
  131.     $post = $wp_query->get_queried_object();
  132.     $currenturl = trim( $_SERVER['REQUEST_URI'] ,'/' );
  133.     $front_page = false;
  134.     $description = '';
  135.     $meta_description = '';
  136.     $meta_keywords = '';
  137.     $out = '';
  138.    
  139.     if( is_feed() )
  140.         return;
  141.    
  142.     # Check if page/post is excluded
  143.     $excluded = explode( ',', mysite_get_setting( 'seo_ex_pages' ) );
  144.     foreach( $excluded as $exedd ) {
  145.         $exedd = trim( $exedd );
  146.         if( $exedd )
  147.             if( stristr( $currenturl, $exedd ) )
  148.                 return;
  149.     }
  150.    
  151.     if ( is_front_page() ) {
  152.         $front_page = true;
  153.         $home_description = mysite_get_setting( 'seo_home_description' );
  154.         if( $home_description )
  155.             $description = $home_description;
  156.        
  157.     } else if ( is_singular() ) {
  158.        
  159.         if( get_post_meta( $post->ID, '_seo_disable', true ) || !in_array( get_post_type( $post->ID ), mysite_seo_posttypecolumns() ) )
  160.             return;
  161.            
  162.         $_seo_description = get_post_meta( $post->ID, '_seo_description', true );
  163.         if( trim( $_seo_description ) )
  164.             $description = $_seo_description;
  165.         else if( mysite_get_setting( 'seo_generate_descriptions' ) )
  166.             $description = mysite_seo_replace( '%excerpt%', $post );
  167.        
  168.     } else if( is_category() ) {
  169.         $description = substr( mysite_seo_replace( '%category_description%', $post ), 0, 155 );
  170.        
  171.     } else if( is_tag() ) {
  172.         $description = substr( mysite_seo_replace( '%tag_description%', $post ), 0, 155 );
  173.        
  174.     } else if ( is_author() ) {
  175.         $description = substr( mysite_seo_replace( '%post_author_description%', $post ), 0, 155 );
  176.     }
  177.    
  178.     $description_format = mysite_get_setting( 'seo_description_format' );
  179.     if( trim( $description_format ) ) {
  180.         $meta_description = $description_format;
  181.     } else {
  182.         $meta_description = '%description%';
  183.     }
  184.    
  185.     $replacements = array(
  186.         '%description%'         => $description,
  187.         '%blog_title%'          => get_bloginfo( 'name' ),
  188.         '%blog_description%'    => get_bloginfo( 'description' ),
  189.         '%wp_title%'            => ( !empty( $post->post_title ) ? stripslashes( $post->post_title ) : '' ),
  190.     );
  191.    
  192.     foreach ( $replacements as $var => $repl ) {
  193.         $meta_description = str_replace( $var, $repl, $meta_description );
  194.     }
  195.    
  196.     $meta_description = apply_atomic( 'meta_description', $meta_description );
  197.     if( !empty( $meta_description ) )
  198.         $out .= '<meta name="description" content="' . $meta_description . '" />' . "\r";
  199.        
  200.     $meta_keywords = mysite_get_seo_keywords( $args = array( 'posts' => $post, 'front_page' => $front_page, 'wp_query' => $wp_query ) );
  201.     $meta_keywords = apply_atomic( 'meta_keywords', $meta_keywords );
  202.     if( !empty( $meta_keywords ) )
  203.         $out .= '<meta name="keywords" content="' . $meta_keywords . '" />' . "\r";
  204.        
  205.     if ( ( is_category() && mysite_get_setting( 'seo_category_noindex' ) ) || ( !is_category() && is_archive() && !is_tag() && mysite_get_setting( 'seo_archive_noindex' ) ) || ( mysite_get_setting( 'seo_tags_noindex' ) && is_tag() ) )
  206.         $out .= '<meta name="robots" content="noindex,follow" />' . "\r";
  207.        
  208.     $post_meta = mysite_get_setting( 'seo_post_meta_tags' );
  209.     if ( is_single() && !empty( $post_meta ) )
  210.         $out .= stripcslashes( $post_meta ) . "\r";
  211.        
  212.     $page_meta = mysite_get_setting( 'seo_page_meta_tags' );
  213.     if ( is_page() && !empty( $page_meta ) || !empty( $post->ID ) && get_option('page_for_posts') == $post->ID )
  214.         $out .= stripcslashes( $page_meta ) . "\r";
  215.        
  216.     $home_meta = mysite_get_setting( 'seo_home_meta_tags' );
  217.     if ( $front_page && !empty( $home_meta ) )
  218.         $out .= stripcslashes( $home_meta ) . "\r";
  219.        
  220.     if( mysite_get_setting( 'seo_can' ) ) {
  221.         $url = mysite_canonical();
  222.         if ( $url ) {
  223.             $url = apply_atomic( 'canonical_url', $url );
  224.             $out .= '<link rel="canonical" href="' . $url . '" />' . "\r";
  225.         }
  226.     }
  227.            
  228.     echo $out;
  229. }
  230. endif;
  231.  
  232. if ( !function_exists( 'mysite_header_extras' ) ) :
  233. /**
  234.  *
  235.  */
  236. function mysite_header_extras() {
  237.     $out = '';
  238.     $header_links = '';
  239.     $sociables = '';
  240.     $header_text = mysite_get_setting( 'extra_header' );
  241.  
  242.     # If header-links has a menu assigned display it.
  243.     if ( has_nav_menu('header-links' ) ) {
  244.         $header_links = wp_nav_menu(
  245.             array(
  246.             'theme_location' => 'header-links',
  247.             'container_class' => 'header_links',
  248.             'container_id' => '',
  249.             'menu_class' => 'header_links_menu',
  250.             'fallback_cb' => false,
  251.             'echo' => false
  252.         ));
  253.     }
  254.  
  255.     # Display sociables in header.
  256.     $sociable = mysite_get_setting( 'sociable' );
  257.  
  258.     if( $sociable['keys'] != '#' ) {
  259.         $sociable_keys = explode( ',', $sociable['keys'] );
  260.  
  261.         foreach ( $sociable_keys as $key ) {
  262.             if( $key != '#' ) {
  263.  
  264.                 if( !empty( $sociable[$key]['custom'] ) )
  265.                     $sociable_icon = $sociable[$key]['custom'];
  266.  
  267.                 elseif( empty( $sociable[$key]['custom'] ) )
  268.                     $sociable_icon = THEME_IMAGES . '/sociables/' . $sociable[$key]['color'] . '/' . $sociable[$key]['icon'];
  269.  
  270.                 $sociable_link = ( !empty( $sociable[$key]['link'] ) ) ? $sociable[$key]['link'] : '#';
  271.  
  272.                 $sociables .= '<div class="social_icon ' . $sociable[$key]['color'] . '">';
  273.                 $sociables .= '<a href="' . esc_url( $sociable_link ) . '"><img src="' . esc_url( $sociable_icon ) . '" alt="' . ( isset( $sociable[$key]['alt'] ) ? $sociable[$key]['alt'] : '' ) . '" /></a>';
  274.                 $sociables .= '</div>';
  275.             }
  276.         }
  277.     }
  278.  
  279.     if( !empty( $header_links ) || !empty( $sociables ) || !empty( $header_text ) ) {
  280.         $out .= '<div id="header_extras">';
  281.         $out .= '<div id="header_extras_inner">';
  282.  
  283.         $out .= $header_links;
  284.  
  285.         if( !empty( $sociables ) ) {
  286.             $out .= '<div class="header_social">';
  287.             $out .= $sociables;
  288.             $out .= '</div>';
  289.         }
  290.  
  291.         if( !empty( $header_text ) ) {
  292.             $out .= '<div class="header_text">';
  293.             $out .= stripslashes( $header_text );
  294.             $out .= '</div>';
  295.         }
  296.  
  297.         $out .= '</div><!-- #header_extras_inner -->';
  298.         $out .= '</div><!-- #header_extras -->';
  299.     }
  300.  
  301.     echo apply_atomic_shortcode( 'header_extras', $out );
  302. }
  303. endif;
  304.  
  305. if ( !function_exists( 'mysite_sidebars' ) ) :
  306. /**
  307.  *
  308.  */
  309. function mysite_sidebars() {
  310.     # Register default widgetized areas
  311.     $sidebars = array(
  312.         'primary' => array(
  313.             'name' => __( 'Primary Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  314.             'desc' => __( 'The primary widget area', MYSITE_ADMIN_TEXTDOMAIN )
  315.         ),
  316.         'home' => array(
  317.             'name' => __( 'Homepage Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  318.             'desc' => __( 'The homepage widget area', MYSITE_ADMIN_TEXTDOMAIN )
  319.         ),
  320.         'footer1' => array(
  321.             'name' => __( 'First Footer Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  322.             'desc' => __( 'The first footer widget area', MYSITE_ADMIN_TEXTDOMAIN )
  323.         ),
  324.         'footer2' => array(
  325.             'name' => __( 'Second Footer Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  326.             'desc' => __( 'The second footer widget area', MYSITE_ADMIN_TEXTDOMAIN )
  327.         ),
  328.         'footer3' => array(
  329.             'name' => __( 'Third Footer Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  330.             'desc' => __( 'The third footer widget area', MYSITE_ADMIN_TEXTDOMAIN )
  331.         ),
  332.         'footer4' => array(
  333.             'name' => __( 'Fourth Footer Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  334.             'desc' => __( 'The fourth footer widget area', MYSITE_ADMIN_TEXTDOMAIN )
  335.         ),
  336.         'footer5' => array(
  337.             'name' => __( 'Fifth Footer Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  338.             'desc' => __( 'The fifth footer widget area', MYSITE_ADMIN_TEXTDOMAIN )
  339.         ),
  340.         'footer6' => array(
  341.             'name' => __( 'Sixth Footer Widget Area', MYSITE_ADMIN_TEXTDOMAIN ),
  342.             'desc' => __( 'The sixth footer widget area', MYSITE_ADMIN_TEXTDOMAIN )
  343.         )
  344.     );
  345.  
  346.     foreach ( $sidebars as $type => $sidebar ){
  347.         register_sidebar(array(
  348.             'name' => $sidebar['name'],
  349.             'id'=> $type,
  350.             'description' => $sidebar['desc'],
  351.             'before_widget' => '<div id="%1$s" class="widget %2$s">',
  352.             'after_widget' => '</div>',
  353.             'before_title' => '<h4 class="widgettitle">',
  354.             'after_title' => '</h4>',
  355.         ));
  356.     }
  357.    
  358.     # Register custom sidebars areas
  359.     $custom_sidebars = get_option( MYSITE_SIDEBARS );
  360.     if( !empty( $custom_sidebars ) ) {
  361.         foreach ( $custom_sidebars as $id => $name ) {
  362.             register_sidebar(array(
  363.                 'name' => $name,
  364.                 'id'=> "mysite_custom_sidebar_{$id}",
  365.                 'description' => $name,
  366.                 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  367.                 'after_widget' => '</div>',
  368.                 'before_title' => '<h4 class="widgettitle">',
  369.                 'after_title' => '</h4>',
  370.             ));
  371.         }
  372.     }
  373. }
  374. endif;
  375.  
  376. if ( !function_exists( 'mysite_widgets' ) ) :
  377. /**
  378.  *
  379.  */
  380. function mysite_widgets() {
  381.     # Load each widget file.
  382.     require_once( THEME_CLASSES . '/widget-flickr.php' );
  383.     require_once( THEME_CLASSES . '/widget-subnav.php' );
  384.     require_once( THEME_CLASSES . '/widget-twitter.php' );
  385.     require_once( THEME_CLASSES . '/widget-popular.php' );
  386.     require_once( THEME_CLASSES . '/widget-recent.php' );
  387.     require_once( THEME_CLASSES . '/widget-contact.php' );
  388.     require_once( THEME_CLASSES . '/widget-contact-form.php' );
  389.     require_once( THEME_CLASSES . '/widget-testimonial.php' );
  390.  
  391.     # Register each widget.
  392.     register_widget( 'MySite_Flickr_Widget' );
  393.     register_widget( 'MySite_SubNav_Widget' );
  394.     register_widget( 'MySite_Twitter_Widget' );
  395.     register_widget( 'MySite_PopularPost_Widget' );
  396.     register_widget( 'MySite_RecentPost_Widget' );
  397.     register_widget( 'MySite_Contact_Widget' );
  398.     register_widget( 'MySite_Contact_Form_Widget' );
  399.     register_widget( 'MySite_Testimonial_Widget' );
  400. }
  401. endif;
  402.  
  403. if ( !function_exists( 'mysite_get_sidebar' ) ) :
  404. /**
  405.  *
  406.  */
  407. function mysite_get_sidebar() {
  408.     wp_reset_query();
  409.    
  410.     global $wp_query;
  411.    
  412.     $sidebar = true;
  413.    
  414.     if( is_singular() ) {
  415.         $type = get_post_type();
  416.         $post_obj = $wp_query->get_queried_object();
  417.        
  418.         $dependencies = get_post_meta( $post_obj->ID, '_dependencies', true );
  419.         $dependencies = ( empty( $dependencies ) ) ? get_post_meta( $post_obj->ID, '_' . THEME_SLUG .'_dependencies', true ) : $dependencies;
  420.         $template = get_post_meta( $post_obj->ID, '_wp_page_template', true );
  421.         $_layout = get_post_meta( $post_obj->ID, '_layout', true );
  422.        
  423.         if( $type == 'page' && empty( $_layout ) ) {
  424.             $page_layout = mysite_get_setting( 'page_layout' );
  425.             if( !empty( $page_layout ) && $page_layout == 'full_width' )
  426.                 $sidebar = false;
  427.         }
  428.        
  429.         if( $type == 'post' && empty( $_layout ) ) {
  430.             $post_layout = mysite_get_setting( 'post_layout' );
  431.             if( !empty( $post_layout ) && $post_layout == 'full_width' )
  432.                 $sidebar = false;
  433.         }
  434.        
  435.         if( $_layout == 'full_width' )
  436.             $sidebar = false;
  437.            
  438.         if( strpos( $dependencies, 'fancy_portfolio' ) !== false || apply_atomic( 'fancy_portfolio', false ) == true )
  439.             $sidebar = false;
  440.            
  441.         if( ( $type == 'portfolio' ) && ( empty( $_layout ) ) )
  442.             $sidebar = false;
  443.  
  444.         if( $template == 'template-featuretour.php' )
  445.             $sidebar = false;
  446.            
  447.         if( strpos( $post_obj->post_content, '[portfolio' ) !== false && empty( $_layout ) )
  448.             $sidebar = false;
  449.     }
  450.    
  451.     if( ( is_front_page() ) && ( !is_active_sidebar( 'home' ) ) )
  452.         $sidebar = false;
  453.        
  454.     if( is_archive() && mysite_get_setting( 'archive_layout' ) == 'full_width' )
  455.         $sidebar = false;
  456.    
  457.     if( is_search() && mysite_get_setting( 'search_layout' ) == 'full_width' )
  458.         $sidebar = false;
  459.    
  460.     if( is_404() ) {
  461.         $four_04_layout = mysite_get_setting( 'four_04_layout' );
  462.         if( empty( $four_04_layout ) || $four_04_layout == 'full_width' )
  463.             $sidebar = false;
  464.     }
  465.        
  466.     $sidebar = apply_atomic( 'get_sidebar', $sidebar );
  467.  
  468.     if( $sidebar == true )
  469.         get_sidebar();
  470. }
  471. endif;
  472.  
  473. if ( !function_exists( 'mysite_dynamic_sidebar' ) ) :
  474. /**
  475.  *
  476.  */
  477. function mysite_dynamic_sidebar() {
  478.     wp_reset_query();
  479.    
  480.     global $wp_query, $post;
  481.    
  482.     $post_obj = $wp_query->get_queried_object();
  483.  
  484.     if( !empty( $post_obj->ID ) && !is_front_page() )
  485.         $custom = get_post_meta( $post_obj->ID, '_custom_sidebar', true );
  486.        
  487.     if( is_archive() )
  488.         $custom = mysite_get_setting( 'archive_custom_sidebar' );
  489.        
  490.     if( is_search() )
  491.         $custom = mysite_get_setting( 'search_custom_sidebar' );
  492.        
  493.     if( is_404() )
  494.         $custom = mysite_get_setting( 'four_04_custom_sidebar' );
  495.  
  496.     if( !is_front_page() && empty( $custom ) )
  497.         $sidebar = 'primary';
  498.  
  499.     if( !empty( $custom ) )
  500.         $sidebar = $custom;
  501.        
  502.     if( is_front_page() )
  503.         $sidebar = 'home';
  504.  
  505.     if( isset( $sidebar ) )
  506.         dynamic_sidebar( $sidebar );
  507. }
  508. endif;
  509.  
  510. if ( !function_exists( 'mysite_menus' ) ) :
  511. /**
  512.  *
  513.  */
  514. function mysite_menus() {
  515.     register_nav_menu( 'primary-menu', __( 'Primary Menu', MYSITE_ADMIN_TEXTDOMAIN ) );
  516.     register_nav_menu( 'header-links', __( 'Header Links', MYSITE_ADMIN_TEXTDOMAIN ) );
  517.     register_nav_menu( 'footer-links', __( 'Footer Links', MYSITE_ADMIN_TEXTDOMAIN ) );
  518. }
  519. endif;
  520.  
  521. if ( !function_exists( 'mysite_post_types' ) ) :
  522. /**
  523.  *
  524.  */
  525. function mysite_post_types() {
  526.     # Register post type portfolio
  527.     register_post_type('portfolio', array(
  528.         'labels' => array(
  529.             'name' => _x('Portfolios', 'post type general name', MYSITE_ADMIN_TEXTDOMAIN ),
  530.             'singular_name' => _x('Portfolio', 'post type singular name', MYSITE_ADMIN_TEXTDOMAIN ),
  531.             'add_new' => _x('Add New', 'portfolio', MYSITE_ADMIN_TEXTDOMAIN ),
  532.             'add_new_item' => __('Add New Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),
  533.             'edit_item' => __('Edit Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),
  534.             'new_item' => __('New Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),
  535.             'view_item' => __('View Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),
  536.             'search_items' => __('Search Portfolios', MYSITE_ADMIN_TEXTDOMAIN ),
  537.             'not_found' =>  __('No portfolios found', MYSITE_ADMIN_TEXTDOMAIN ),
  538.             'not_found_in_trash' => __('No portfolios found in Trash', MYSITE_ADMIN_TEXTDOMAIN ),
  539.             'parent_item_colon' => ''
  540.         ),
  541.         'singular_label' => __('Portfolio', MYSITE_ADMIN_TEXTDOMAIN ),
  542.         'public' => true,
  543.         'exclude_from_search' => true,
  544.         'show_ui' => true,
  545.         'capability_type' => 'post',
  546.         'hierarchical' => false,
  547.         'rewrite' => array( 'with_front' => false ),
  548.         'query_var' => false,
  549.         'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments' )
  550.     ));
  551.  
  552.     # Register taxonomy for portfolio
  553.     register_taxonomy('portfolio_category','portfolio',array(
  554.         'hierarchical' => true,
  555.         'labels' => array(
  556.             'name' => _x( 'Portfolio Categories', 'taxonomy general name', MYSITE_ADMIN_TEXTDOMAIN ),
  557.             'singular_name' => _x( 'Portfolio Category', 'taxonomy singular name', MYSITE_ADMIN_TEXTDOMAIN ),
  558.             'search_items' =>  __( 'Search Categories', MYSITE_ADMIN_TEXTDOMAIN ),
  559.             'popular_items' => __( 'Popular Categories', MYSITE_ADMIN_TEXTDOMAIN ),
  560.             'all_items' => __( 'All Categories', MYSITE_ADMIN_TEXTDOMAIN ),
  561.             'parent_item' => null,
  562.             'parent_item_colon' => null,
  563.             'edit_item' => __( 'Edit Portfolio Category', MYSITE_ADMIN_TEXTDOMAIN ),
  564.             'update_item' => __( 'Update Portfolio Category', MYSITE_ADMIN_TEXTDOMAIN ),
  565.             'add_new_item' => __( 'Add New Portfolio Category', MYSITE_ADMIN_TEXTDOMAIN ),
  566.             'new_item_name' => __( 'New Portfolio Category Name', MYSITE_ADMIN_TEXTDOMAIN ),
  567.             'separate_items_with_commas' => __( 'Separate Portfolio category with commas', MYSITE_ADMIN_TEXTDOMAIN ),
  568.             'add_or_remove_items' => __( 'Add or remove portfolio category', MYSITE_ADMIN_TEXTDOMAIN ),
  569.             'choose_from_most_used' => __( 'Choose from the most used portfolio category', MYSITE_ADMIN_TEXTDOMAIN )
  570.         ),
  571.         'show_ui' => true,
  572.         'query_var' => true,
  573.         'rewrite' => true,
  574.     ));
  575.    
  576.    
  577.     # Register post type testimonial
  578.     register_post_type('testimonial', array(
  579.         'labels' => array(
  580.             'name' => _x('Testimonials', 'post type general name', MYSITE_ADMIN_TEXTDOMAIN ),
  581.             'singular_name' => _x('Testimonial', 'post type singular name', MYSITE_ADMIN_TEXTDOMAIN ),
  582.             'add_new' => _x('Add New', 'testimonial', MYSITE_ADMIN_TEXTDOMAIN ),
  583.             'add_new_item' => __('Add New Testimonial', MYSITE_ADMIN_TEXTDOMAIN ),
  584.             'edit_item' => __('Edit Testimonial', MYSITE_ADMIN_TEXTDOMAIN ),
  585.             'new_item' => __('New Testimonial', MYSITE_ADMIN_TEXTDOMAIN ),
  586.             'view_item' => __('View Testimonial', MYSITE_ADMIN_TEXTDOMAIN ),
  587.             'search_items' => __('Search Testimonials', MYSITE_ADMIN_TEXTDOMAIN ),
  588.             'not_found' =>  __('No testimonials found', MYSITE_ADMIN_TEXTDOMAIN ),
  589.             'not_found_in_trash' => __('No testimonials found in Trash', MYSITE_ADMIN_TEXTDOMAIN ),
  590.             'parent_item_colon' => ''
  591.         ),
  592.         'singular_label' => __('Testimonial', MYSITE_ADMIN_TEXTDOMAIN ),
  593.         'public' => true,
  594.         'show_in_nav_menus'  => false,
  595.         'exclude_from_search' => true,
  596.         'show_ui' => true,
  597.         'capability_type' => 'post',
  598.         'hierarchical' => false,
  599.         'rewrite' => false,
  600.         'query_var' => false,
  601.         'supports' => array( 'title', 'page-attributes' )
  602.     ));
  603.  
  604.     # Register taxonomy for testimonial
  605.     register_taxonomy('testimonial_category','testimonial',array(
  606.         'hierarchical' => true,
  607.         'labels' => array(
  608.             'name' => _x( 'Testimonial Categories', 'taxonomy general name', MYSITE_ADMIN_TEXTDOMAIN ),
  609.             'singular_name' => _x( 'Testimonial Category', 'taxonomy singular name', MYSITE_ADMIN_TEXTDOMAIN ),
  610.             'search_items' =>  __( 'Search Categories', MYSITE_ADMIN_TEXTDOMAIN ),
  611.             'popular_items' => __( 'Popular Categories', MYSITE_ADMIN_TEXTDOMAIN ),
  612.             'all_items' => __( 'All Categories', MYSITE_ADMIN_TEXTDOMAIN ),
  613.             'parent_item' => null,
  614.             'parent_item_colon' => null,
  615.             'edit_item' => __( 'Edit Testimonial Category', MYSITE_ADMIN_TEXTDOMAIN ),
  616.             'update_item' => __( 'Update Testimonial Category', MYSITE_ADMIN_TEXTDOMAIN ),
  617.             'add_new_item' => __( 'Add New Testimonial Category', MYSITE_ADMIN_TEXTDOMAIN ),
  618.             'new_item_name' => __( 'New Testimonial Category Name', MYSITE_ADMIN_TEXTDOMAIN ),
  619.             'separate_items_with_commas' => __( 'Separate Testimonial category with commas', MYSITE_ADMIN_TEXTDOMAIN ),
  620.             'add_or_remove_items' => __( 'Add or remove testimonial category', MYSITE_ADMIN_TEXTDOMAIN ),
  621.             'choose_from_most_used' => __( 'Choose from the most used testimonial category', MYSITE_ADMIN_TEXTDOMAIN )
  622.         ),
  623.         'show_ui' => true,
  624.         'show_in_nav_menus' => false,
  625.         'query_var' => true,
  626.         'rewrite' => false,
  627.     ));
  628. }
  629. endif;
  630.  
  631. if ( !function_exists( 'mysite_portfolio_date' ) ) :
  632. /**
  633.  *
  634.  */
  635. function mysite_portfolio_date() {
  636.     global $post;
  637.    
  638.     $out = '';
  639.     $_date = get_post_meta( $post->ID, '_date', true );
  640.    
  641.     if( !empty( $_date ) )
  642.         $out .= '<p class="date">' . $_date . '</p>';
  643.        
  644.     echo apply_atomic( 'portfolio_date_single', $out );
  645. }
  646. endif;
  647.  
  648. if ( !function_exists( 'mysite_shortcodes_init' ) ) :
  649. /**
  650.  *
  651.  */
  652. function mysite_shortcodes_init() {
  653.     foreach( mysite_shortcodes() as $shortcodes )
  654.         require_once THEME_SHORTCODES . '/' . $shortcodes;
  655.        
  656.     if( is_admin() )
  657.         return;
  658.        
  659.     # Long posts should require a higher limit, see http://core.trac.wordpress.org/ticket/8553
  660.     @ini_set('pcre.backtrack_limit', 9000000);
  661.        
  662.     foreach( mysite_shortcodes() as $shortcodes ) {
  663.         $class = 'mysite' . ucfirst( preg_replace( '/[0-9-_]/', '', str_replace( '.php', '', $shortcodes ) ) );
  664.         $class_methods = get_class_methods( $class );
  665.  
  666.         foreach( $class_methods as $shortcode )
  667.             if( $shortcode[0] != '_' && $class != 'mysiteLayouts' )
  668.                 add_shortcode( $shortcode, array( $class, $shortcode ) );
  669.     }
  670. }
  671. endif;
  672.  
  673. if ( !function_exists( 'mysite_queryvars' ) ) :
  674. /**
  675.  *
  676.  */
  677. function mysite_queryvars( $query_vars ) {
  678.     $query_vars[] = 'gallery';
  679.     return $query_vars;
  680. }
  681. endif;
  682.  
  683. if ( !function_exists( 'mysite_rewrite_rules' ) ) :
  684. /**
  685.  *
  686.  */
  687. function mysite_rewrite_rules( $rules ) {
  688.     $newrules = array();
  689.     $newrules['(portfolio)/([^/]+)/gallery/([^/]+)/comment-page-([0-9]{1,})/?$'] = 'index.php?post_type=$matches[1]&name=$matches[2]&gallery=$matches[3]&cpage=$matches[4]';
  690.     $newrules['(portfolio)/([^/]+)/gallery/([^/]+)'] = 'index.php?post_type=$matches[1]&name=$matches[2]&gallery=$matches[3]';
  691.     return $newrules + $rules;
  692. }
  693. endif;
  694.  
  695. if ( !function_exists( 'mysite_color_variations' ) ) :
  696. /**
  697.  *
  698.  */
  699. function mysite_color_variations() {
  700.     $variations = array(
  701.         'red' => 'Red',
  702.         'orange' => 'Orange',
  703.         'yellow' => 'Yellow',
  704.         'green' => 'Green',
  705.         'olive' => 'Olive',
  706.         'teal' => 'Teal',
  707.         'blue' => 'Blue',
  708.         'deepblue' => 'Deepblue',
  709.         'purple' => 'Purple',
  710.         'hotpink' => 'Hotpink',
  711.         'slategrey' => 'Slategrey',
  712.         'mauve' => 'Mauve',
  713.         'pearl' => 'Pearl',
  714.         'steelblue' => 'Steelblue',
  715.         'mossgreen' => 'Mossgreen',
  716.         'wheat' => 'Wheat',
  717.         'coffee' => 'Coffee',
  718.         'copper' => 'Copper',
  719.         'silver' => 'Silver',
  720.         'black' => 'Black' );
  721.  
  722.     return $variations;
  723. }
  724. endif;
  725.  
  726. if ( !function_exists( 'mysite_header_scripts' ) ) :
  727. /**
  728.  *
  729.  */
  730. function mysite_header_scripts() {
  731.     global $is_IE;
  732.    
  733.     $script_header = apply_atomic_shortcode( 'script_header', '' );
  734.    
  735.     if( !empty( $script_header ) ) {
  736.         echo $script_header;
  737.         return;
  738.     }
  739.    
  740.     $document_style[] = '<style type="text/css">';
  741.    
  742.     if( $is_IE )
  743.         $document_style[] = '.noscript{visibility: collapse;}';
  744.     else
  745.         $document_style[] = '.noscript{visibility: hidden;}';
  746.        
  747.     $document_style[] = '.noscript_dn{display: none;}';
  748.    
  749.     $active_skin = apply_filters( 'mysite_active_skin', get_option( MYSITE_ACTIVE_SKIN ) );
  750.     $disable_cufon = apply_atomic( 'disable_cufon', mysite_get_setting( 'disable_cufon' ) );
  751.     if( !empty( $active_skin ) && empty( $disable_cufon ) ) {
  752.        
  753.         if( !empty( $active_skin['cufon_gradients_fonts'] ) )
  754.             $active_skin['fonts'] = array_merge( $active_skin['fonts'], $active_skin['cufon_gradients_fonts'] );
  755.        
  756.         $declarations = array_keys( $active_skin['fonts'] );
  757.         $join_declarations = join( ',', str_replace( 'jqueryslidemenu a', 'jqueryslidemenu a span', $declarations ) );
  758.         $document_style[] = "{$join_declarations}{opacity: 0;-ms-filter:\"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";}";
  759.     }
  760.     $document_style[] = '</style>';
  761.     $document_write = join( '', array_unique( $document_style ) );
  762.    
  763.     $nonce = home_url();
  764.     $image_resize = mysite_get_setting( 'image_resize' );
  765.     $skin_nt_writable = get_option( MYSITE_SKIN_NT_WRITABLE );
  766.    
  767. ?><link rel="stylesheet" href="<?php echo esc_url( THEME_URI . '/shortcodes.css' ); ?>" type="text/css" media="screen" />
  768. <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" />
  769. <?php if( is_array( $skin_nt_writable ) && in_array( str_replace( '.css', '', $active_skin['style_variations'] ), $skin_nt_writable ) ) :
  770. ?><link rel="stylesheet" href="<?php echo esc_url( THEME_JS . '/css.php' ); ?>" type="text/css" media="screen" /><?php
  771.     elseif( !empty( $active_skin['wpmu'] ) ) : global $blog_id;
  772. ?><link rel="stylesheet" href="<?php echo '/' . get_blog_option( $blog_id, 'upload_path' ) . '/styles/' . md5( THEME_NAME ) . 'muskin_' . $active_skin['style_variations']; ?>" type="text/css" media="screen" /><?php
  773.     else :
  774. ?><link rel="stylesheet" href="<?php echo esc_url( THEME_URI . '/styles/' . $active_skin['style_variations'] ); ?>" type="text/css" media="screen" /><?php
  775.     endif;
  776. ?>
  777.  
  778.    
  779. <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="<?php echo THEME_STYLES; ?>/_ie/ie6.css"> <![endif]-->
  780. <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="<?php echo THEME_STYLES; ?>/_ie/ie7.css"> <![endif]-->
  781. <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="<?php echo THEME_STYLES; ?>/_ie/ie8.css"> <![endif]-->
  782. <?php
  783. if( mysite_get_setting( 'favicon_url' ) ) : ?>
  784. <link rel="shortcut icon" href="<?php echo esc_url( mysite_get_setting( 'favicon_url' ) ) ?>" />
  785. <?php endif; ?>
  786. <?php if( mysite_get_setting( 'custom_css' ) ) :
  787. ?><style type="text/css">
  788. <?php echo stripslashes( mysite_get_setting( 'custom_css' ) ) . "\n"; ?>
  789. </style>
  790. <?php endif; ?>
  791.  
  792. <script type="text/javascript">
  793. /* <![CDATA[ */
  794.     var imageResize = "<?php echo mysite_get_setting( 'image_resize_type' ); ?>",
  795.         resizeDisabled = "<?php echo $image_resize[0]; ?>",
  796.         assetsUri = "<?php echo THEME_IMAGES_ASSETS; ?>",
  797.             imageNonce = "<?php echo wp_create_nonce( $nonce ); ?>",
  798.         disableSlidemenu = "<?php if(defined('DISABLE_SLIDEMENU')){echo 'true';}else{echo 'false';} ?>";
  799.         prettyphotoTheme = "<?php if(defined('PRETTYPHOTO_THEME')){echo PRETTYPHOTO_THEME;}else{echo 'pp_default';} ?>";
  800.     document.write('<?php echo $document_write; ?>');
  801. /* ]]> */
  802. </script>
  803. <?php
  804. }
  805. endif;
  806.  
  807. if ( !function_exists( 'mysite_logo' ) ) :
  808. /**
  809.  *
  810.  */
  811. function mysite_logo() {
  812.     $out = '';
  813.    
  814.     $display_logo = mysite_get_setting( 'display_logo' );
  815.    
  816.     if( $display_logo ) {
  817.         $logo_url = mysite_get_setting( 'logo_url' );
  818.        
  819.         if( $logo_url )
  820.             $logo = '<img src="' . esc_url( mysite_get_setting( 'logo_url' ) ) . '" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '"  />';
  821.            
  822.         elseif( !$logo_url ) {
  823.             $active_skin = apply_filters( 'mysite_active_skin', get_option( MYSITE_ACTIVE_SKIN ) );
  824.             $color_scheme = ( !empty( $active_skin['style_variations'] ) ) ? str_replace( '.css','', $active_skin['style_variations'] ) : '';
  825.            
  826.             if( @is_file( THEME_DIR . '/styles/' . $color_scheme . '/logo.png' ) )
  827.                 $logo = '<img src="'  . esc_url( THEME_URI ) . '/styles/' . $color_scheme . '/logo.png" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '" />';
  828.                
  829.             else
  830.                 $logo = '<img src="'  . esc_url( THEME_URI ) . '/images/logo.png" alt="' . esc_attr( get_bloginfo( 'name' ) ) . '" />';
  831.         }
  832.        
  833.     } elseif ( !$display_logo )
  834.         $logo = get_bloginfo( 'name' );
  835.        
  836.     if( !empty( $logo ) ) {
  837.         $class = ( !$display_logo ) ? ' class="site_title"' : ' class="site_logo"';
  838.         $out .= '<div class="logo">';
  839.         $out .= '<a rel="home" href="' . esc_url( home_url( '/' ) ) . '"' . $class . '>';
  840.         $out .= $logo;
  841.         $out .= '</a>';
  842.         $out .= '</div><!-- .logo -->';
  843.     }
  844.    
  845.     echo apply_atomic_shortcode( 'logo', $out );
  846. }
  847. endif;
  848.  
  849. if ( !function_exists( 'mysite_primary_menu' ) ) :
  850. /**
  851.  *
  852.  */
  853. function mysite_primary_menu() {
  854.     $out = '<div id="primary_menu">';
  855.    
  856.     ob_start(); mysite_primary_menu_begin();
  857.     $out .= ob_get_clean();
  858.        
  859.     $out .= wp_nav_menu(
  860.         array(
  861.         'theme_location' => 'primary-menu',
  862.         'container_class' => 'jqueryslidemenu',
  863.         'menu_class' => ( !has_nav_menu( 'primary-menu' ) ? 'jqueryslidemenu' : ''),
  864.         'echo' => false,
  865.         'walker' => ( has_nav_menu( 'primary-menu' ) ?  new mysiteDescriptionWalker() : '')
  866.     ));
  867.     $out .= '<div class="clearboth"></div>';
  868.    
  869.     ob_start(); mysite_primary_menu_end();
  870.     $out .= ob_get_clean();
  871.    
  872.     $out .= '</div><!-- #primary_menu -->';
  873.    
  874.     echo apply_atomic_shortcode( 'primary_menu', $out );
  875. }
  876. endif;
  877.  
  878. if ( !function_exists( 'mysite_teaser' ) ) :
  879. /**
  880.  *
  881.  */
  882. function mysite_teaser() {
  883.     global $author, $post;
  884.    
  885.     $out = '';
  886.     $teaser = '';
  887.    
  888.     if( is_front_page() ) {
  889.         $home_text = '';
  890.         $teaser_button = mysite_get_setting( 'teaser_button' );
  891.         $teaser_button_text = mysite_get_setting( 'teaser_button_text' );
  892.        
  893.         if( ( $teaser_button != 'disable' ) && ( !empty( $teaser_button_text ) ) ) {
  894.             if( $teaser_button == 'page' ) {
  895.                 $btn_page_id = mysite_get_setting( 'teaser_button_page' );
  896.                
  897.                 if( !empty( $btn_page_id ) )
  898.                     $btn_link = get_permalink( $btn_page_id );
  899.                 else
  900.                     $btn_link = '#';
  901.                    
  902.             } elseif( $teaser_button == 'custom' ) {
  903.                 $btn_link = ( mysite_get_setting( 'teaser_button_custom' ) )
  904.                 ? mysite_get_setting( 'teaser_button_custom' ) : '#';
  905.             }
  906.            
  907.             $home_text .= '<a class="button_link call_to_action alignright" href="' . esc_url( $btn_link ) . '"><span>' . stripslashes( $teaser_button_text ) . '</span></a>';
  908.         }
  909.        
  910.         $homepage_teaser_text = mysite_get_setting( 'homepage_teaser_text' );
  911.         if( !empty( $homepage_teaser_text ) ) {
  912.             if( preg_match('/\</', $homepage_teaser_text ) )
  913.                 $home_text .= stripslashes( $homepage_teaser_text );
  914.             else
  915.                 $home_text .= '<h3>' . stripslashes( $homepage_teaser_text ) . '</h3>';
  916.         }
  917.     }
  918.    
  919.     if( is_singular() ) {
  920.         $intro_text = get_post_meta( $post->ID, '_intro_text', true );
  921.         $blog_page = mysite_blog_page();
  922.        
  923.         if ( empty( $intro_text ) )
  924.             $intro_text = 'default';
  925.        
  926.         # Intro text post meta overide
  927.         if( $intro_text != 'default' ) {
  928.            
  929.             if( in_array( $intro_text, array( 'title_only', 'title_teaser', 'title_tweet' ) ) ) {
  930.                 if( ( is_singular( 'post' ) ) && ( is_numeric( $blog_page ) ) )
  931.                     $title = apply_atomic( 'teaser_single_title', get_the_title( $blog_page ) );
  932.                    
  933.                 elseif( is_singular( 'portfolio' ) )
  934.                     $title = __('Portfolio', MYSITE_TEXTDOMAIN );
  935.                
  936.                 else
  937.                     $title = get_the_title( $post->ID );
  938.             }
  939.            
  940.             if( $intro_text == 'custom' )
  941.                 $raw =  get_post_meta( $post->ID, '_intro_custom_html', true );
  942.            
  943.             if( $intro_text == 'title_teaser' )
  944.                 $text =  get_post_meta( $post->ID, '_intro_custom_text', true );
  945.                
  946.             if( $intro_text == 'title_tweet' ) {
  947.                 $twitter_id = mysite_get_setting( 'twitter_id' );
  948.                 $limit = '1';
  949.                 $twitter_type = 'teaser';
  950.                 $text = mysite_twitter_feed( $twitter_id, $limit, $twitter_type );
  951.             }
  952.            
  953.         # Default intro text options
  954.         } else {
  955.             $intro_options = mysite_get_setting('intro_options');
  956.            
  957.             if( in_array( $intro_options, array( 'title_only', 'title_teaser', 'title_tweet' ) ) ) {
  958.                 if( ( is_singular( 'post' ) ) && ( is_numeric( $blog_page ) ) )
  959.                     $title = apply_atomic( 'teaser_single_title', get_the_title( $blog_page ) );
  960.                    
  961.                 elseif( is_singular( 'portfolio' ) )
  962.                     $title = __('Portfolio', MYSITE_TEXTDOMAIN );
  963.                
  964.                 else
  965.                     $title = get_the_title( $post->ID );
  966.             }
  967.            
  968.             if( $intro_options == 'custom' )
  969.                 $raw =  mysite_get_setting('custom_teaser_html');
  970.            
  971.             if( $intro_options == 'title_teaser' )
  972.                 $text =  mysite_get_setting('custom_teaser');
  973.            
  974.             if( $intro_options == 'title_tweet' ) {
  975.                 $twitter_id = mysite_get_setting( 'twitter_id' );
  976.                 $limit = '1';
  977.                 $twitter_type = 'teaser';
  978.                 $text = mysite_twitter_feed( $twitter_id, $limit, $twitter_type );
  979.             }
  980.         }
  981.     }
  982.    
  983.     if ( is_search() ) {
  984.         $intro_options = mysite_get_setting( 'intro_options' );
  985.         if( $intro_options != 'disable' ) {
  986.             $title = __( 'Search', MYSITE_TEXTDOMAIN );
  987.             $text = sprintf( __('Search Results for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_search_query() . '&rsquo;');
  988.         }
  989.     }
  990.    
  991.     if ( is_archive() ) {
  992.         $intro_options = mysite_get_setting( 'intro_options' );
  993.         if( $intro_options != 'disable' ) {
  994.             $title =  __( 'Archives', MYSITE_TEXTDOMAIN );
  995.             if( is_category() ) {
  996.                 $text = sprintf( __('Category Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . single_cat_title('',false) . '&rsquo;');
  997.             } elseif ( is_tag () ) {
  998.                 $text = sprintf( __('All Posts Tagged Tag: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . single_tag_title('',false) . '&rsquo;');
  999.             } elseif ( is_day() ) {
  1000.                 $text = sprintf( __('Daily Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_the_time('F jS, Y') . '&rsquo;');
  1001.             } elseif ( is_month() ) {
  1002.                 $text = sprintf( __('Monthly Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_the_time('F, Y') . '&rsquo;');
  1003.             } elseif ( is_year() ) {
  1004.                 $text = sprintf( __('Yearly Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_the_time('Y') . '&rsquo;');
  1005.             } elseif ( is_author() ) {
  1006.                 $curauth = get_userdata( intval($author) );
  1007.                 $text = sprintf( __('Author Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . $curauth->nickname . '&rsquo;');
  1008.             } elseif ( is_tax() ) {
  1009.                 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
  1010.                 $text = sprintf( __('Archives for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . $term->name . '&rsquo;');
  1011.             }
  1012.         }
  1013.     }
  1014.    
  1015.     if( is_404() ) {
  1016.         $intro_options = mysite_get_setting( 'intro_options' );
  1017.         if( $intro_options != 'disable' ) {
  1018.             $title =  __( 'Not Found', MYSITE_TEXTDOMAIN );
  1019.         }
  1020.     }
  1021.    
  1022.     if( isset( $title ) )
  1023.         $teaser .= '<h1 class="intro_title"><span>' . $title . '</span></h1>';
  1024.    
  1025.     if( isset( $text ) )
  1026.         $teaser .= '<p class="teaser"><span>' . stripslashes( $text ) . '</span></p>';
  1027.        
  1028.     if( !empty( $home_text ) )
  1029.         $teaser = stripslashes( $home_text );
  1030.        
  1031.     if( isset( $raw ) )
  1032.         $teaser = stripslashes( $raw );
  1033.    
  1034.     if( !empty( $teaser ) ) {
  1035.         $out .= '<div id="intro">';
  1036.         $out .= '<div id="intro_inner">';
  1037.        
  1038.         if( isset( $raw ) )
  1039.             $out .= '<div class="raw_html_intro">';
  1040.        
  1041.         ob_start(); mysite_intro_begin();
  1042.         $out .= ob_get_clean();
  1043.        
  1044.         $out .= $teaser;
  1045.        
  1046.         ob_start(); mysite_intro_end( array( 'text' => ( !empty( $text ) ? true : false ), 'raw' => ( !empty( $raw ) ? true : false ) ) );
  1047.         $out .= ob_get_clean();
  1048.        
  1049.         $out .= '<div class="clearboth"></div>';
  1050.        
  1051.         if( isset( $raw ) )
  1052.             $out .= '</div><!-- #raw_html_intro -->';
  1053.            
  1054.         $out .= '</div><!-- #intro_inner -->';
  1055.         $out .= '</div><!-- #intro -->';
  1056.     }
  1057.    
  1058.     echo apply_atomic_shortcode( 'teaser', $out );
  1059. }
  1060. endif;
  1061.  
  1062. if ( !function_exists( 'mysite_breadcrumbs' ) ) :
  1063. /**
  1064.  *
  1065.  */
  1066. function mysite_breadcrumbs() {
  1067.     if( is_front_page() )
  1068.         return;
  1069.        
  1070.     global $wp_query;
  1071.    
  1072.     $post_obj = $wp_query->get_queried_object();
  1073.    
  1074.     if( !empty( $post_obj ) && !empty( $post_obj->ID ) && get_post_meta( $post_obj->ID, '_disable_breadcrumbs', true ) )
  1075.         return;
  1076.        
  1077.     $disable_breadcrumb = apply_atomic( 'disable_breadcrumb', mysite_get_setting( 'disable_breadcrumbs' ) );
  1078.    
  1079.     if( !empty( $disable_breadcrumb ) )
  1080.         return;
  1081.    
  1082.     $out = '<div id="breadcrumbs">';
  1083.     $out .= '<div id="breadcrumbs_inner">';
  1084.    
  1085.     $out .= breadcrumbs_plus();
  1086.    
  1087.     $out .= '</div><!-- #breadcrumbs_inner -->';
  1088.     $out .= '</div><!-- #breadcrumbs -->';
  1089.    
  1090.     echo apply_atomic( 'breadcrumbs', $out );
  1091. }
  1092. endif;
  1093.  
  1094.  
  1095. if ( !function_exists( 'mysite_post_title' ) ) :
  1096. /**
  1097.  *
  1098.  */
  1099. function mysite_post_title( $args = array() ) {
  1100.     global $post;
  1101.    
  1102.     $defaults = array(
  1103.         'shortcode' => false,
  1104.         'echo' => true
  1105.     );
  1106.    
  1107.     $args = wp_parse_args( $args, $defaults );
  1108.    
  1109.     extract( $args );
  1110.    
  1111.     if( is_page() && !$shortcode )
  1112.         return;
  1113.    
  1114.     $title = '';
  1115.    
  1116.     if( $shortcode && $type == 'blog_list' && $thumb == 'small' )
  1117.         $title = the_title( '<p class="post_title"><a href="' . esc_url( get_permalink() ) . '" title="' .
  1118.         esc_attr( the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">', '</a></p>', false );
  1119.        
  1120.     elseif( $shortcode && $type == 'blog_grid' && ( $column == 3 || $column == 4 ) )
  1121.         $title = the_title( '<h3 class="post_title"><a href="' . esc_url( get_permalink() ) . '" title="' .
  1122.         esc_attr( the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">', '</a></h3>', false );
  1123.            
  1124.     elseif( is_single() && !is_attachment() )
  1125.         $title = the_title( '<h2 class="post_title">', '</h2>', false );
  1126.        
  1127.     elseif( is_attachment() && mysite_get_setting ( 'intro_options' ) == 'disable' )
  1128.         $title = the_title( '<h2 class="post_title"><a href="' . esc_url( get_permalink() ) . '" title="' .
  1129.         esc_attr( the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">', '</a></h2>', false );
  1130.        
  1131.     elseif( !is_attachment() )
  1132.         $title = the_title( '<h2 class="post_title"><a href="' . esc_url( get_permalink() ) . '" title="' .
  1133.         esc_attr( the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">', '</a></h2>', false );
  1134.  
  1135.     if( $echo )
  1136.         echo apply_atomic( 'entry_title', $title );
  1137.     else
  1138.         return apply_atomic( 'entry_title', $title );
  1139. }
  1140. endif;
  1141.  
  1142. if ( !function_exists( 'mysite_page_title' ) ) :
  1143. /**
  1144.  *
  1145.  */
  1146. function mysite_page_title() {
  1147.     $title = '';
  1148.    
  1149.     if( is_404() ) return;
  1150.    
  1151.     $intro_options = mysite_get_setting( 'intro_options' );
  1152.    
  1153.     if ( is_search() ) {
  1154.         $title = sprintf( __('Search Results for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_search_query() . '&rsquo;');
  1155.     } elseif ( is_category() ) {
  1156.         $title = sprintf( __('Category Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . single_cat_title('',false) . '&rsquo;');
  1157.     } elseif ( is_tag () ) {
  1158.         $title = sprintf( __('All Posts Tagged Tag: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . single_tag_title('',false) . '&rsquo;');
  1159.     } elseif ( is_day() ) {
  1160.         $title = sprintf( __('Daily Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_the_time('F jS, Y') . '&rsquo;');
  1161.     } elseif ( is_month() ) {
  1162.         $title = sprintf( __('Monthly Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_the_time('F, Y') . '&rsquo;');
  1163.     } elseif ( is_year() ) {
  1164.         $title = sprintf( __('Yearly Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . get_the_time('Y') . '&rsquo;');
  1165.     } elseif ( is_author() ) {
  1166.         global $author;
  1167.         $curauth = get_userdata( intval($author) );
  1168.         $title = sprintf( __('Author Archive for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . $curauth->nickname . '&rsquo;');
  1169.     } elseif ( is_tax() ) {
  1170.         $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
  1171.         $title = sprintf( __('Archives for: %1$s', MYSITE_TEXTDOMAIN ), '&lsquo;' . $term->name . '&rsquo;');
  1172.     }
  1173.    
  1174.     if( !empty( $title ) && $intro_options == 'disable' )
  1175.         echo '<h1 class="page_title">' . $title . '</h1>';
  1176.        
  1177.     elseif( is_page() ) {
  1178.         global $wp_query;
  1179.        
  1180.         $post_obj = $wp_query->get_queried_object();
  1181.         $post_id = $post_obj->ID;
  1182.  
  1183.         $_layout = get_post_meta( $post_id, '_intro_text', true );
  1184.         $template = get_post_meta( $post_id, '_wp_page_template', true );
  1185.        
  1186.         if( $_layout == 'disable' && $template != 'template-featuretour.php' )
  1187.             echo the_title( '<h1 class="page_title">', '</h1>', false );
  1188.            
  1189.         elseif( $_layout == 'default' && $intro_options == 'disable' && $template != 'template-featuretour.php' )
  1190.             echo the_title( '<h1 class="page_title">', '</h1>', false );
  1191.     }
  1192.    
  1193. }
  1194. endif;
  1195.  
  1196. if ( !function_exists( 'mysite_home_content' ) ) :
  1197. /**
  1198.  *
  1199.  */
  1200. function mysite_home_content() {
  1201.     if( !is_front_page() )
  1202.         return;
  1203.    
  1204.     $out = '';
  1205.    
  1206.     if( mysite_get_setting( 'content' ) ) {
  1207.         $content = stripslashes( mysite_get_setting( 'content' ) );
  1208.         $content = apply_filters( 'the_content', $content );
  1209.        
  1210.         $out .= '<div class="page">';
  1211.         $out .= $content;
  1212.         $out .= '</div>';
  1213.     }
  1214.    
  1215.     echo apply_atomic_shortcode( 'home_content', $out );;
  1216. }
  1217. endif;
  1218.  
  1219. if ( !function_exists( 'mysite_excerpt_length_long' ) ) :
  1220. function mysite_excerpt_length_long( $length ) {
  1221.     return 60;
  1222. }
  1223. endif;
  1224.  
  1225. if ( !function_exists( 'mysite_excerpt_length_medium' ) ) :
  1226. function mysite_excerpt_length_medium( $length ) {
  1227.     return 30;
  1228. }
  1229. endif;
  1230.  
  1231. if ( !function_exists( 'mysite_excerpt_length_short' ) ) :
  1232. function mysite_excerpt_length_short( $length ) {
  1233.     return 20;
  1234. }
  1235. endif;
  1236.  
  1237. if ( !function_exists( 'mysite_excerpt_more' ) ) :
  1238. function mysite_excerpt_more( $more ) {
  1239.     return ' ...';
  1240. }
  1241. endif;
  1242.  
  1243. if ( !function_exists( 'mysite_read_more' ) ) :
  1244. function mysite_read_more() {
  1245.     global $post;
  1246.     $out = '<span class="post_more_link"><a class="post_more_link_a" href="' . esc_url( get_permalink( $post->ID ) ) . '">' . __( 'Read More', MYSITE_TEXTDOMAIN ) . '</a></span>';
  1247.     return $out;
  1248. }
  1249. endif;
  1250.  
  1251. if ( !function_exists( 'mysite_full_read_more' ) ) :
  1252. function mysite_full_read_more( $more_link, $more_link_text ) {
  1253.     global $post;
  1254.     $out = '<span class="post_more_link"><a class="post_more_link_a" href="' . esc_url( get_permalink( $post->ID ) ) . '#more-' . $post->ID . '">' . __( 'Read More', MYSITE_TEXTDOMAIN ) . '</a></span>';
  1255.     return '<!–start_raw–>' . $out . '<!–end_raw–>';
  1256. }
  1257. endif;
  1258.  
  1259. if ( !function_exists( 'mysite_post_content' ) ) :
  1260. /**
  1261.  *
  1262.  */
  1263. function mysite_post_content( $args = array() ) {
  1264.     global $mysite;
  1265.    
  1266.     extract( $args );
  1267.    
  1268.     $column = !empty( $column ) ? $column : '';
  1269.     $type = !empty( $type ) ? $type : '';
  1270.     $thumb = !empty( $thumb ) ? $thumb : '';
  1271.     $blog_layout = !empty( $blog_layout ) ? $blog_layout : '';
  1272.        
  1273.     if( $blog_layout == 'blog_layout2' || ( $type == 'blog_list' && $thumb == 'medium' ) )
  1274.         add_filter( 'excerpt_length', 'mysite_excerpt_length_medium', 999 );
  1275.    
  1276.     elseif( empty( $featured_post ) && $blog_layout != 'blog_layout1' && $column != 1 && $thumb != 'large' )
  1277.         add_filter( 'excerpt_length', 'mysite_excerpt_length_short', 999 );
  1278.  
  1279.     if( ( !empty( $mysite->is_blog ) && mysite_get_setting( 'display_full' ) ) || ( !empty( $post_content ) && $post_content == 'full' ) ) {
  1280.         global $more;
  1281.         $more = 0;
  1282.         the_content();
  1283.     } else {
  1284.         the_excerpt();
  1285.         $permalink = get_permalink( get_the_ID() );
  1286.        
  1287.         if( ( !empty( $disable ) && strpos( $disable, 'more' ) === false ) || empty( $disable ) )
  1288.             echo apply_filters( 'mysite_read_more', $permalink );
  1289.     }
  1290. }
  1291. endif;
  1292.  
  1293. if ( !function_exists( 'mysite_page_content' ) ) :
  1294. /**
  1295.  *
  1296.  */
  1297. function mysite_page_content() {
  1298.     if( !is_front_page() )
  1299.         return;
  1300.        
  1301.     if( mysite_get_setting( 'mainpage_content' ) ){
  1302.        
  1303.         $content = mysite_get_setting( 'mainpage_content' );
  1304.            
  1305.         $args = array( 'post_type'=>'page', 'post__in' => array( $content ) );
  1306.            
  1307.         $my_query = new WP_Query( $args );
  1308.            
  1309.         if ( $my_query->have_posts() ) {
  1310.             global $more;
  1311.             echo '<div class="' . join( ' ', get_post_class( 'page' ) ) . '">';
  1312.             while ( $my_query->have_posts() ) {
  1313.                 $my_query->the_post();
  1314.                 $more = 0;
  1315.                 the_content();
  1316.             }
  1317.             echo '</div>';
  1318.         }
  1319.        
  1320.         wp_reset_postdata();
  1321.     }
  1322. }
  1323. endif;
  1324.  
  1325. if ( !function_exists( 'mysite_featured_post' ) ) :
  1326. /**
  1327.  *
  1328.  */
  1329. function mysite_featured_post( $return = false ) {
  1330.     global $wp_query, $mysite;
  1331.    
  1332.     $paged = mysite_get_page_query();
  1333.     $layout = $mysite->layout['blog'];
  1334.    
  1335.     if( $paged != 1 )
  1336.         return;
  1337.        
  1338.     elseif( is_archive() )
  1339.         return;
  1340.  
  1341.     elseif( $layout['blog_layout'] != 'blog_layout3' )
  1342.         return;
  1343.        
  1344.     $temp = $wp_query;
  1345.     $wp_query= null;
  1346.     remove_filter( 'post_limits', 'my_post_limit' );
  1347.     $wp_query = new WP_Query();
  1348.    
  1349.     if( $return == false )
  1350.         $wp_query->query( array( 'posts_per_page' => $layout['featured'], 'post_type' => 'post', 'ignore_sticky_posts' => 1 ) );
  1351.     else
  1352.         return $wp_query->query( array( 'posts_per_page' => $layout['featured'], 'post_type' => 'post', 'ignore_sticky_posts' => 1 ) );
  1353.    
  1354.     ?><div id="post-<?php the_ID(); ?>" <?php post_class( $layout['post_class'] . ' featured_post_module' ); ?>><?php
  1355.    
  1356.     while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  1357.    
  1358.         <?php mysite_before_post( array( 'featured_post' => true, 'post_id' => get_the_ID() ) ); ?>
  1359.    
  1360.         <div class="<?php echo $layout['content_class']; ?>">
  1361.            
  1362.             <?php mysite_before_entry(); ?>
  1363.  
  1364.             <div class="post_excerpt">
  1365.                 <?php mysite_post_content( array( 'featured_post' => true, 'blog_layout' => $layout['blog_layout'] ) ); ?>
  1366.             </div>
  1367.            
  1368.             <?php mysite_after_entry(); ?>
  1369.    
  1370.         </div><!-- .content_class -->
  1371.        
  1372.     <?php endwhile;
  1373.    
  1374.     ?></div><div class="clearboth"></div><?php
  1375.    
  1376.     $wp_query = null;
  1377.     $wp_query = $temp;
  1378. }
  1379. endif;
  1380.  
  1381. if ( !function_exists( 'mysite_query_posts' ) ) :
  1382. /**
  1383.  *
  1384.  */
  1385. function mysite_query_posts() {
  1386.     global $wp_query, $mysite;
  1387.    
  1388.     $post_obj = $wp_query->get_queried_object();
  1389.     $exclude_categories = mysite_exclude_category_string();
  1390.     $blog_layout = $mysite->layout['blog']['blog_layout'];
  1391.     $mysite->offset = ( $blog_layout == 'blog_layout3' ) ? $mysite->layout['blog']['featured'] : false;
  1392.     $paged = mysite_get_page_query();
  1393.        
  1394.     if( !empty( $exclude_categories ) )        
  1395.         $query_string = "cat={$exclude_categories}&paged={$paged}";
  1396.     else
  1397.         $query_string = "paged={$paged}";
  1398.        
  1399.     if( !empty( $mysite->offset ) )
  1400.         $query_string = $query_string . "&offset={$mysite->offset}";
  1401.        
  1402.     if( isset( $mysite->is_blog ) )
  1403.         return query_posts( $query_string );
  1404.        
  1405.     if( is_archive() || is_search() ) {
  1406.        
  1407.         if( is_archive() )
  1408.             $mysite->archive = true;
  1409.         else if( is_search() )
  1410.             $mysite->search = true;
  1411.        
  1412.         $args = array_merge( $wp_query->query, array( 'post_type'=> 'post', 'category__not_in' => mysite_exclude_category_string( $minus = false ) ) );
  1413.         return query_posts( $args );
  1414.    
  1415.     } elseif( !empty( $post_obj->ID ) ){
  1416.         $blog_page = mysite_blog_page();
  1417.         if( $blog_page == $post_obj->ID ) {
  1418.             $mysite->is_blog = true;
  1419.             $mysite->blog_page = $post_obj->ID;
  1420.            
  1421.             if( !empty( $mysite->offset ) ) {
  1422.                 $mysite->posts_per_page = get_option( 'posts_per_page' );
  1423.                 add_filter( 'post_limits', 'my_post_limit' );
  1424.             }
  1425.            
  1426.             return query_posts( $query_string );
  1427.         }
  1428.        
  1429.     } elseif( ( is_front_page() && mysite_get_setting( 'frontpage_blog' ) ) || ( !empty( $post_obj->ID ) && get_option('page_for_posts') == $post_obj->ID ) ) {
  1430.         if( !empty( $mysite->offset ) ) {
  1431.             $mysite->posts_per_page = get_option( 'posts_per_page' );
  1432.             add_filter( 'post_limits', 'my_post_limit' );
  1433.         }
  1434.  
  1435.         $args = array_merge( $wp_query->query, array( 'post_type'=> 'post', 'paged'=> $paged, 'offset' => $mysite->offset, 'category__not_in' => mysite_exclude_category_string( $minus = false ) ) );
  1436.         return query_posts( $args );
  1437.     }
  1438.        
  1439.     return false;
  1440. }
  1441. endif;
  1442.  
  1443. if ( !function_exists( 'mysite_post_meta' ) ) :
  1444. /**
  1445.  *
  1446.  */
  1447. function mysite_post_meta( $args = array() ) {
  1448.     $defaults = array(
  1449.         'shortcode' => false,
  1450.         'echo' => true
  1451.     );
  1452.    
  1453.     $args = wp_parse_args( $args, $defaults );
  1454.    
  1455.     extract( $args );
  1456.    
  1457.     if( is_page() && !$shortcode ) return;
  1458.    
  1459.     $out = '';
  1460.     $meta_options = mysite_get_setting( 'disable_meta_options' );
  1461.     $_meta = ( is_array( $meta_options ) ) ? $meta_options : array();
  1462.     $meta_output = '';
  1463.    
  1464.     if( !in_array( 'date_meta', $_meta ) )
  1465.         $meta_output .= '[post_date text="' . __( '<em>Posted on:</em>', MYSITE_TEXTDOMAIN ) . ' "] ';
  1466.        
  1467.     if( !in_array( 'comments_meta', $_meta ) )
  1468.         $meta_output .= '[post_comments text="' . __( '<em>With:</em>', MYSITE_TEXTDOMAIN ) . ' "] ';
  1469.        
  1470.     if( !in_array( 'author_meta', $_meta ) )
  1471.         $meta_output .= '[post_author text="' . __( '<em>Posted by:</em>', MYSITE_TEXTDOMAIN ) . ' "] ';
  1472.    
  1473.     if( !empty( $meta_output ) )
  1474.         $out .='<p class="post_meta">' . $meta_output . '</p>';
  1475.    
  1476.     if( $echo )
  1477.         echo apply_atomic_shortcode( 'post_meta', $out );
  1478.     else
  1479.         return apply_atomic_shortcode( 'post_meta', $out );
  1480. }
  1481. endif;
  1482.  
  1483. if ( !function_exists( 'mysite_post_meta_bottom' ) ) :
  1484. /**
  1485.  *
  1486.  */
  1487. function mysite_post_meta_bottom() {
  1488.     if( is_page() ) return;
  1489.    
  1490.     $out = '';
  1491.     $meta_options = mysite_get_setting( 'disable_meta_options' );
  1492.     $_meta = ( is_array( $meta_options ) ) ? $meta_options : array();
  1493.     $meta_output = '';
  1494.  
  1495.     if( !in_array( 'categories_meta', $_meta ) )
  1496.         $meta_output .= '[post_terms taxonomy="category" text=' . __( '<em>Categories:</em>&nbsp;', MYSITE_TEXTDOMAIN ) . '] ';
  1497.  
  1498.     if( !in_array( 'tags_meta', $_meta ) )
  1499.         $meta_output .= '[post_terms text=' . __( '<em>Tags:</em>&nbsp;', MYSITE_TEXTDOMAIN ) . ']';
  1500.  
  1501.     if( !empty( $meta_output ) )
  1502.         $out .='<p class="post_meta_bottom">' . $meta_output . '</p>';
  1503.    
  1504.     echo apply_atomic_shortcode( 'post_meta_bottom', $out );
  1505. }
  1506. endif;
  1507.  
  1508. if ( !function_exists( 'mysite_before_post_sc' ) ) :
  1509. /**
  1510.  *
  1511.  */
  1512. function mysite_before_post_sc( $filter_args ) {
  1513.     $out = '';
  1514.    
  1515.     if( strpos( $filter_args['disable'], 'image' ) === false )
  1516.         $out .= mysite_get_post_image( $filter_args );
  1517.    
  1518.     if( strpos( $filter_args['disable'], 'title' ) === false )
  1519.         $out .= mysite_post_title( $filter_args );
  1520.    
  1521.     return $out;
  1522. }
  1523. endif;
  1524.  
  1525.  
  1526. if ( !function_exists( 'mysite_before_entry_sc' ) ) :
  1527. /**
  1528.  *
  1529.  */
  1530. function mysite_before_entry_sc( $filter_args ) {
  1531.     $out = '';
  1532.    
  1533.     if( strpos( $filter_args['disable'], 'meta' ) === false )
  1534.         $out .= mysite_post_meta( $filter_args );
  1535.    
  1536.     return $out;
  1537. }
  1538. endif;
  1539.  
  1540. if ( !function_exists( 'mysite_after_entry_sc' ) ) :
  1541. /**
  1542.  *
  1543.  */
  1544. function mysite_after_entry_sc( $filter_args ) {
  1545.    
  1546. }
  1547. endif;
  1548.  
  1549. if ( !function_exists( 'mysite_post_image' ) ) :
  1550. /**
  1551.  *
  1552.  */
  1553. function mysite_post_image( $args = array() ) {
  1554.     global $wp_query, $mysite;
  1555.    
  1556.     $post_obj = $wp_query->get_queried_object();
  1557.    
  1558.     extract( $args );
  1559.    
  1560.     # if portfolio post image disables
  1561.     $type = get_post_type();
  1562.     if( $type == 'portfolio' ) {
  1563.         $_fullsize = get_post_meta( get_the_ID(), '_fullsize', true );
  1564.         if( $_fullsize ) return;
  1565.     }
  1566.    
  1567.     # if featured image image disables
  1568.     if( is_single() ) {
  1569.         $_disable_post_image = get_post_meta( $post_obj->ID, '_disable_post_image', true );
  1570.         if( !empty( $_disable_post_image ) ) return;
  1571.     }
  1572.        
  1573.    
  1574.     $width = '';
  1575.     $height = '';
  1576.    
  1577.     $index = ( isset( $index ) ) ? $index : '';
  1578.     $post_layout = $mysite->layout['blog']['blog_layout'];
  1579.    
  1580.     if( !empty( $mysite->is_blog ) ) {
  1581.         $page_layout = mysite_get_setting( 'page_layout' );
  1582.         $_layout = get_post_meta( $mysite->blog_page, '_layout', true );
  1583.         $_layout = ( empty( $_layout ) ) ? $page_layout : $_layout;
  1584.         $img_layout = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images' ) );
  1585.        
  1586.     } elseif( !empty( $post_obj->ID ) && empty( $mysite->archive ) ) {
  1587.         $post_layout = mysite_get_setting( 'post_layout' );
  1588.         $_layout = get_post_meta( $post_obj->ID, '_layout', true );
  1589.         $_layout = ( empty( $_layout ) ) ? $post_layout : $_layout;
  1590.         $img_layout = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images'
  1591.         : ( empty( $_layout ) && $type == 'portfolio' ? 'images': 'big_sidebar_images' ) ) );
  1592.        
  1593.     } elseif( !empty( $mysite->archive ) ) {
  1594.         $_layout = mysite_get_setting( 'archive_layout' );
  1595.         $img_layout = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images' ) );
  1596.        
  1597.     } elseif( !empty( $mysite->search ) ) {
  1598.         $_layout = mysite_get_setting( 'search_layout' );
  1599.         $img_layout = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images' ) );
  1600.        
  1601.     } elseif( is_front_page() ) {
  1602.         $_layout = mysite_get_setting( 'homepage_layout' );
  1603.         $img_layout = ( $_layout == 'full_width' ? 'images' : ( $_layout == 'left_sidebar' ? 'small_sidebar_images' : 'big_sidebar_images' ) );
  1604.     }
  1605.    
  1606.     $img_class = ( is_single() ) ? 'single_post_image' : $mysite->layout['blog']['img_class'];
  1607.    
  1608.     $img_sizes = ( !empty( $featured_post ) ? 'one_column_blog'
  1609.     : ( $post_layout == 'blog_layout2' ? 'medium_post_list'
  1610.     : ( $post_layout == 'blog_layout1' ? 'one_column_blog' : 'two_column_blog'
  1611.     )));
  1612.    
  1613.     if( is_singular( 'portfolio' ) )
  1614.         $img_sizes = 'portfolio_single_full';
  1615.        
  1616.     elseif( isset( $mysite->layout['additional_images'] ) ) {
  1617.         if( is_single() )
  1618.             $img_sizes = 'one_column_blog';
  1619.            
  1620.         if( $img_sizes == 'one_column_blog' ) {
  1621.             if( $img_layout == 'images' ) $img_sizes = 'one_column_blog_full';
  1622.             if( $img_layout == 'big_sidebar_images' ) $img_sizes = 'one_column_blog_big';
  1623.             if( $img_layout == 'small_sidebar_images' ) $img_sizes = 'one_column_blog_small';
  1624.             $img_layout = 'additional_images';
  1625.         }
  1626.  
  1627.         if( $img_sizes == 'two_column_blog' ) {
  1628.             if( $img_layout == 'images' ) $img_sizes = 'two_column_blog_full';
  1629.             if( $img_layout == 'big_sidebar_images' ) $img_sizes = 'two_column_blog_big';
  1630.             if( $img_layout == 'small_sidebar_images' ) $img_sizes = 'two_column_blog_small';
  1631.             $img_layout = 'additional_images';
  1632.         }
  1633.        
  1634.     } elseif( is_single() ) {
  1635.         $img_sizes = 'one_column_blog';
  1636.        
  1637.     } else {
  1638.         $img_sizes = $img_sizes;
  1639.     }
  1640.    
  1641.     $width = $mysite->layout[$img_layout][$img_sizes][0];
  1642.     $height = $mysite->layout[$img_layout][$img_sizes][1];
  1643.    
  1644.     if( !empty( $post_obj->ID ) )
  1645.         $_featured_video = get_post_meta( $post_obj->ID, '_featured_video', true );
  1646.        
  1647.     elseif( !empty( $post_id ) )
  1648.         $_featured_video = get_post_meta( $post_id, '_featured_video', true );
  1649.    
  1650.     $args = array(
  1651.         'index' => $index,
  1652.         'width' => $width,
  1653.         'height' => $height,
  1654.         'img_class' => $img_class,
  1655.         'link_class' => 'blog_index_image_load',
  1656.         'video' => ( !empty( $_featured_video ) ? $_featured_video : false ),
  1657.         'inline_width' => ( $post_layout == 'blog_layout2' ? true : false ),
  1658.         'featured_post' => ( !empty( $featured_post ) ? true : false )
  1659.     );
  1660.    
  1661.     if( is_singular( 'portfolio' ) && $_layout == 'full_width' )
  1662.         $args = array_merge( $args, array( 'portfolio_full' => true ) );
  1663.    
  1664.     mysite_get_post_image( $args );
  1665. }
  1666. endif;
  1667.  
  1668. if ( !function_exists( 'mysite_page_navi' ) ) :
  1669. /**
  1670.  *
  1671.  */
  1672. function mysite_page_navi() {
  1673.     echo mysite_pagenavi();
  1674. }
  1675. endif;
  1676.  
  1677. if ( !function_exists( 'mysite_post_nav' ) ) :
  1678. /**
  1679.  *
  1680.  */
  1681. function mysite_post_nav() {
  1682.     $disable_post_nav = apply_atomic( 'disable_post_nav', mysite_get_setting( 'disable_post_nav' ) );
  1683.     if( !empty( $disable_post_nav ) )
  1684.         return;
  1685.    
  1686. ?><div class="post_nav_module">
  1687.     <div class="previous_post"><?php previous_post_link( '%link', '%title' ); ?></div>
  1688.     <div class="next_post"><?php next_post_link( '%link', '%title' ); ?></div>
  1689. </div><!-- #nav-below -->
  1690. <?php
  1691. }
  1692. endif;
  1693.  
  1694. if ( !function_exists( 'mysite_post_sociables' ) ) :
  1695. /**
  1696.  *
  1697.  */
  1698. function mysite_post_sociables() {
  1699.     $out = '';
  1700.    
  1701.     $social_bookmarks = mysite_get_setting( 'social_bookmarks' );
  1702.     $social_bookmarks_post = get_post_meta( get_the_ID(), '_disable_social_bookmarks', true );
  1703.    
  1704.     if( empty( $social_bookmarks ) && empty( $social_bookmarks_post ) ) {
  1705.         $out .= '<div class="share_this_module">';
  1706.        
  1707.         $out .= '<h3 class="share_this_title">' . __( 'Share this:', MYSITE_TEXTDOMAIN ) . '</h3>';
  1708.        
  1709.         $out .= '<div class="share_this_content">';
  1710.        
  1711.         $out .= mysite_sociable_bookmarks();
  1712.        
  1713.         $out .= '</div><!-- .share_this_content -->';
  1714.         $out .= '</div><!-- .share_this_module -->';
  1715.     }
  1716.    
  1717.     echo apply_filters( 'mysite_post_sociables', $out );
  1718. }
  1719. endif;
  1720.  
  1721. if ( !function_exists( 'mysite_about_author' ) ) :
  1722. /**
  1723.  *
  1724.  */
  1725. function mysite_about_author() {
  1726.     $disable_post_author = apply_atomic( 'disable_post_author', mysite_get_setting( 'disable_post_author' ) );
  1727.     if( !is_singular( 'post' ) || !empty( $disable_post_author ) )
  1728.         return;
  1729.        
  1730.     $out = '';
  1731.    
  1732.     if( get_the_author_meta( 'description' ) ) {
  1733.         $out .= '<div class="about_author_module">';
  1734.         $out .= '<h3 class="about_author_title">' . __( 'About the Author', MYSITE_TEXTDOMAIN ) . '</h3>';
  1735.         $out .= '<div class="about_author_content">';
  1736.        
  1737.         $out .= get_avatar( get_the_author_meta('user_email'), apply_filters( 'mysite_author_avatar_size', '80' ), THEME_IMAGES_ASSETS . '/author_gravatar_default.png' );
  1738.         $out .= '<p class="author_bio"><span class="author_name">' . esc_attr(get_the_author()) . '</span>' . get_the_author_meta( 'description' );
  1739.         $out .= '[fancy_link link="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '"]' . sprintf( __( 'View all posts by %s', MYSITE_TEXTDOMAIN ), get_the_author() ) . '[/fancy_link]';
  1740.         $out .= '</p><!-- .author_bio -->';
  1741.        
  1742.         $out .= '<div class="clearboth"></div>';
  1743.         $out .= '</div><!-- .about_author_content -->';
  1744.         $out .= '</div><!-- .about_author_module -->';
  1745.     }
  1746.    
  1747.     echo apply_atomic_shortcode( 'about_author', $out );
  1748. }
  1749. endif;
  1750.  
  1751. if ( !function_exists( 'mysite_like_module' ) ) :
  1752. /**
  1753.  *
  1754.  */
  1755. function mysite_like_module() {
  1756.     if( !is_singular( 'post' ) )
  1757.         return;
  1758.    
  1759.     $out = '';
  1760.     $popular_posts = '';
  1761.     $related_posts = '';
  1762.    
  1763.     $option = apply_atomic( 'post_like_module', mysite_get_setting( 'post_like_module' ) );
  1764.    
  1765.     if( $option == 'disable' )
  1766.         return;
  1767.    
  1768.     if( $option == 'column' ) {
  1769.        
  1770.         $popular_posts = mysite_popular_posts( array( 'showposts' => 3, 'module' => $option ) );
  1771.         $related_posts = mysite_related_posts( array( 'showposts' => 3, 'module' => $option ) );
  1772.        
  1773.         $out .= apply_filters( 'mysite_additional_posts_title', '<h3 class="additional_posts_title">' . __( 'Additional Posts', MYSITE_TEXTDOMAIN ) . '</h3>' );
  1774.        
  1775.         $out .= '<div class="one_half">';
  1776.         $out .= '<div class="additional_posts">';
  1777.         $out .= '<h4>' . __( 'Popular Posts', MYSITE_TEXTDOMAIN ) . '</h4>';
  1778.         $out .= $popular_posts;
  1779.         $out .= '</div>';
  1780.         $out .= '</div>';
  1781.        
  1782.         $out .= '<div class="one_half last">';
  1783.         $out .= '<div class="additional_posts">';
  1784.         $out .= '<h4>' . __( 'Related Posts', MYSITE_TEXTDOMAIN ) . '</h4>';
  1785.         $out .= $related_posts;
  1786.         $out .= '</div>';
  1787.         $out .= '</div>';
  1788.     }
  1789.    
  1790.     if( $option == 'tab' ) {
  1791.        
  1792.         $popular_posts = mysite_popular_posts( array( 'showposts' => 4, 'module' => $option ) );
  1793.         $related_posts = mysite_related_posts( array( 'showposts' => 4, 'module' => $option ) );
  1794.        
  1795.         $out .= '<div class="blog_tabs_container">';
  1796.        
  1797.         $out .= '<ul class="blog_tabs">';
  1798.         $out .= '<li><a href="#" class="current">' . __( 'Popular Posts', MYSITE_TEXTDOMAIN ) . '</a></li>';
  1799.         $out .= '<li><a href="#">' . __( 'Related Posts', MYSITE_TEXTDOMAIN ) . '</a></li>';
  1800.         $out .= '</ul>';
  1801.        
  1802.         $out .= '<div class="blog_tabs_content">' . $popular_posts . '</div>';
  1803.         $out .= '<div class="blog_tabs_content">' . $related_posts . '</div>';
  1804.        
  1805.         $out .= '</div>';
  1806.     }
  1807.    
  1808.     if ( !empty( $popular_posts ) || !empty( $related_posts ) )
  1809.         echo '<div class="additional_posts_module">' . $out . '</div>';
  1810.     else
  1811.         echo $out;
  1812. }
  1813. endif;
  1814.  
  1815. if ( !function_exists( 'mysite_popular_posts' ) ) :
  1816. /**
  1817.  *
  1818.  */
  1819. function mysite_popular_posts( $args = array() ) {
  1820.     global $post;
  1821.    
  1822.     $out = '';
  1823.    
  1824.     extract( $args );
  1825.  
  1826.     $popular_query = new WP_Query(array(
  1827.         'showposts' => $showposts,
  1828.         'nopaging' => 0,
  1829.         'orderby'=> 'comment_count',
  1830.         'post_status' => 'publish',
  1831.         'category__not_in' => array( mysite_exclude_category_string( $minus = false ) ),
  1832.         'ignore_sticky_posts' => 1
  1833.     ));
  1834.    
  1835.     if ( $popular_query->have_posts() ) {
  1836.        
  1837.         global $mysite;
  1838.         $img_sizes = ( $module == 'column' ) ? 'small_post_list' : 'additional_posts_grid';
  1839.         $_layout = get_post_meta( $post->ID, '_layout', true );
  1840.         if( empty( $_layout ) )
  1841.             $_layout = mysite_get_setting( 'post_layout' );
  1842.        
  1843.         $img_layout = ( $_layout == 'full_width' ? 'images'
  1844.         : ( $_layout == 'left_sidebar'
  1845.         ? 'small_sidebar_images' : 'big_sidebar_images' ) );
  1846.        
  1847.         $out .= ( $module == 'column' ? '<ul class="post_list small_post_list">'
  1848.         : '<div class="post_grid four_column_blog">'
  1849.         );
  1850.        
  1851.         $i=1;
  1852.         while ( $popular_query->have_posts() ) {
  1853.             $popular_query->the_post();
  1854.            
  1855.             $out .= ( $module == 'column' ? '<li class="post_list_module">'
  1856.             : '<div class="' . ( $i%$showposts == 0 ? 'one_fourth last'
  1857.             : 'one_fourth' ) . '">'
  1858.             );
  1859.            
  1860.             $out .= ( $module == 'tab' ? '<div class="post_grid_module">' : '' );
  1861.             $out .= mysite_get_post_image(array(
  1862.                 'width' => $mysite->layout[$img_layout][$img_sizes][0],
  1863.                 'height' => $mysite->layout[$img_layout][$img_sizes][1],
  1864.                 'img_class' => ( $module == 'tab' ? 'post_grid_image' : 'post_list_image' ),
  1865.                 'preload' => false,
  1866.                 'link_to' => get_permalink(),
  1867.                 'prettyphoto' => false,
  1868.                 'placeholder' => true,
  1869.                 'echo' => false,
  1870.                 'wp_resize' => ( mysite_get_setting( 'image_resize_type' ) == 'wordpress' ? true : false )
  1871.             ));
  1872.            
  1873.             $out .= '<div class="' . ( $module == 'tab' ? 'post_grid_content' : 'post_list_content' ) . '">';
  1874.             $out .= the_title( '<p class="post_title"><a href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">', '</a></p>', false );
  1875.            
  1876.             $out .= ( $module == 'column' ? '<p class="post_meta">' . apply_filters( 'mysite_widget_meta', do_shortcode( '[post_date]' ) ) . '</p>' : '' );
  1877.            
  1878.             $out .= '</div>';
  1879.             $out .= ( $module == 'column' ? '</li>' : '</div></div>' );
  1880.            
  1881.             $i++;
  1882.         }
  1883.        
  1884.         $out .= ( $module == 'column' ? '</ul>' : '</div>' );
  1885.     }
  1886.    
  1887.     wp_reset_postdata();
  1888.    
  1889.     if ( !empty( $out ) )
  1890.         return $out;
  1891.     else
  1892.         return false;
  1893. }
  1894. endif;
  1895.  
  1896. if ( !function_exists( 'mysite_related_posts' ) ) :
  1897. /**
  1898.  *
  1899.  */
  1900. function mysite_related_posts( $args = array() ) {
  1901.     global $post;
  1902.     $backup = $post;
  1903.    
  1904.     $out = '';
  1905.    
  1906.     extract( $args );
  1907.    
  1908.     $tags = wp_get_post_tags( $post->ID );
  1909.     $tagIDs = array();
  1910.     $related_post_found = false;
  1911.    
  1912.     if ( $tags ) {
  1913.         $tagcount = count( $tags );
  1914.         for ($i = 0; $i < $tagcount; $i++) {
  1915.             $tagIDs[$i] = $tags[$i]->term_id;
  1916.         }
  1917.         $related_query = new WP_Query(array(
  1918.             'tag__in' => $tagIDs,
  1919.             'post__not_in' => array( $post->ID ),
  1920.             'showposts'=>$showposts,
  1921.             'category__not_in' => array( mysite_exclude_category_string( $minus = false ) ),
  1922.             'ignore_sticky_posts' => 1
  1923.         ));
  1924.        
  1925.         if( $related_query->have_posts() )
  1926.             $related_post_found = true;
  1927.     }
  1928.    
  1929.     if( !$related_post_found )
  1930.         $related_query = new WP_Query(array( 'showposts' => $showposts,
  1931.             'nopaging' => 0,
  1932.             'post_status' => 'publish',
  1933.             'category__not_in' => array( mysite_exclude_category_string( $minus = false ) ),
  1934.             'ignore_sticky_posts' => 1
  1935.         ));
  1936.        
  1937.     if ( $related_query->have_posts() ) {
  1938.        
  1939.         global $mysite;
  1940.         $img_sizes = ( $module == 'column' ) ? 'small_post_list' : 'additional_posts_grid';
  1941.         $_layout = get_post_meta( $post->ID, '_layout', true );
  1942.         if( empty( $_layout ) )
  1943.             $_layout = mysite_get_setting( 'post_layout' );
  1944.            
  1945.         $img_layout = ( $_layout == 'full_width' ? 'images'
  1946.         : ( $_layout == 'left_sidebar'
  1947.         ? 'small_sidebar_images' : 'big_sidebar_images' ) );
  1948.  
  1949.         $out .= ( $module == 'column' ? '<ul class="post_list small_post_list">'
  1950.         : '<div class="post_grid four_column_blog">'
  1951.         );
  1952.        
  1953.         $i=1;
  1954.         while ( $related_query->have_posts() ) {
  1955.             $related_query->the_post();
  1956.  
  1957.             $out .= ( $module == 'column' ? '<li class="post_list_module">'
  1958.             : '<div class="' . ( $i%$showposts == 0 ? 'one_fourth last'
  1959.             : 'one_fourth' ) . '">'
  1960.             );
  1961.  
  1962.             $out .= ( $module == 'tab' ? '<div class="post_grid_module">' : '' );
  1963.             $out .= mysite_get_post_image(array(
  1964.                 'width' => $mysite->layout[$img_layout][$img_sizes][0],
  1965.                 'height' => $mysite->layout[$img_layout][$img_sizes][1],
  1966.                 'img_class' => ( $module == 'tab' ? 'post_grid_image' : 'post_list_image' ),
  1967.                 'preload' => false,
  1968.                 'link_to' => get_permalink(),
  1969.                 'prettyphoto' => false,
  1970.                 'placeholder' => true,
  1971.                 'echo' => false,
  1972.                 'wp_resize' => ( mysite_get_setting( 'image_resize_type' ) == 'wordpress' ? true : false )
  1973.             ));
  1974.            
  1975.             $out .= '<div class="' . ( $module == 'tab' ? 'post_grid_content' : 'post_list_content' ) . '">';
  1976.             $out .= the_title( '<p class="post_title"><a href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">', '</a></p>', false );
  1977.            
  1978.             $out .= ( $module == 'column' ? '<p class="post_meta">' . apply_filters( 'mysite_widget_meta', do_shortcode( '[post_date]' ) ) . '</p>' : '' );
  1979.            
  1980.             $out .= '</div>';
  1981.             $out .= ( $module == 'column' ? '</li>' : '</div></div>' );
  1982.  
  1983.             $i++;
  1984.         }
  1985.  
  1986.         $out .= ( $module == 'column' ? '</ul>' : '</div>' );
  1987.     }
  1988.    
  1989.     $post = $backup;
  1990.     wp_reset_postdata();
  1991.  
  1992.     if ( !empty( $out ) )
  1993.         return $out;
  1994.     else
  1995.         return false;
  1996. }
  1997. endif;
  1998.  
  1999. if ( !function_exists( 'mysite_footer_teaser' ) ) :
  2000. /**
  2001.  *
  2002.  */
  2003. function mysite_footer_teaser() {
  2004.     $out = '';
  2005.     $footer_teaser = '';
  2006.    
  2007.     if( ( mysite_get_setting( 'footer_teaser' ) ) && ( !is_front_page() ) ) {
  2008.         $footer_teaser = mysite_get_setting( 'footer_teaser' );
  2009.        
  2010.         if( strpos( $footer_teaser, '[' ) === false )
  2011.             $footer_teaser = '<p>' . stripslashes( $footer_teaser ) . '</p>';
  2012.         else
  2013.             $footer_teaser = stripslashes( $footer_teaser );
  2014.     }
  2015.    
  2016.     if( ( mysite_get_setting( 'homepage_footer_teaser' ) ) && ( is_front_page() ) ) {
  2017.         $footer_teaser = mysite_get_setting( 'homepage_footer_teaser' );
  2018.        
  2019.         if( strpos( $footer_teaser, '[' ) === false )
  2020.             $footer_teaser = '<p>' . stripslashes( $footer_teaser ) . '</p>';
  2021.         else
  2022.             $footer_teaser = stripslashes( $footer_teaser );
  2023.     }
  2024.    
  2025.     if( !empty( $footer_teaser ) ) {
  2026.        
  2027.         $out .= '<div id="outro">';
  2028.         $out .= '<div id="outro_inner">';
  2029.        
  2030.         $out .= $footer_teaser;
  2031.        
  2032.         $out .= '<div class="clearboth"></div>';
  2033.         $out .= '</div><!-- #outro_inner -->';
  2034.         $out .= '</div><!-- #outro -->';
  2035.     }
  2036.    
  2037.     echo apply_atomic_shortcode( 'footer_teaser', $out );
  2038. }
  2039. endif;
  2040.  
  2041. if ( !function_exists( 'mysite_sub_footer' ) ) :
  2042. /**
  2043.  *
  2044.  */
  2045. function mysite_sub_footer() {
  2046.     $out = '';
  2047.     $menu = '';
  2048.     $footer_text = '';
  2049.    
  2050.     if( mysite_get_setting( 'footer_text' ) ) {
  2051.         $footer_text = mysite_get_setting( 'footer_text' );
  2052.         $footer_text = stripslashes( $footer_text );
  2053.         $footer_text = '<div class="copyright_text">' . $footer_text . '</div>';
  2054.     }
  2055.    
  2056.     if ( has_nav_menu( 'footer-links' ) ) {
  2057.         $menu = wp_nav_menu(
  2058.             array(
  2059.             'theme_location' => 'footer-links',
  2060.             'container_class' => 'footer_links',
  2061.             'container_id' => '',
  2062.             'menu_class' => '',
  2063.             'fallback_cb' => '',
  2064.             'echo' => false
  2065.         ));
  2066.     }
  2067.    
  2068.    
  2069.     if( !empty( $footer_text ) || !empty( $menu ) ) {
  2070.         $out .= '<div id="sub_footer">';
  2071.         $out .= '<div id="sub_footer_inner">';
  2072.        
  2073.         $out .= $footer_text;
  2074.         $out .= $menu;
  2075.        
  2076.         $out .= '</div><!-- #sub_footer_inner -->';
  2077.         $out .= '</div><!-- #sub_footer -->';
  2078.        
  2079.     }
  2080.    
  2081.     echo apply_atomic_shortcode( 'sub_footer', $out );;
  2082. }
  2083. endif;
  2084.  
  2085. if ( !function_exists( 'mysite_print_cufon' ) ) :
  2086. /**
  2087.  *
  2088.  */
  2089. function mysite_print_cufon() {
  2090.  
  2091.     $active_cufon = apply_filters( 'mysite_active_skin', get_option( MYSITE_ACTIVE_SKIN ) );
  2092.     $disable_cufon = apply_atomic( 'disable_cufon', mysite_get_setting( 'disable_cufon' ) );
  2093.  
  2094.     if( empty( $active_cufon ) || !empty( $disable_cufon ) )
  2095.         return;
  2096.  
  2097.     $out = "<script type=\"text/javascript\">\r/* <![CDATA[ */\r";
  2098.  
  2099.     $out .= "\tvar ua = jQuery.browser;\r";
  2100.     $out .= "\tif( (!ua.msie) || (ua.version.substring(0,1) != '6' && ua.msie) ){";
  2101.  
  2102.     $out .= "\r\tCufon.now();";
  2103.  
  2104.     foreach( $active_cufon['fonts'] as $declaration => $font ) {
  2105.  
  2106.         if( $declaration == '.jqueryslidemenu a' )
  2107.         {
  2108.             # Load Cufon on top level items only
  2109.             $out .= "\r\tCufon.replace('.jqueryslidemenu>ul>li>a', { fontFamily: '{$font}', hover: true });";
  2110.  
  2111.             # Dynamically load cufon on drop downs
  2112.             $out .= "\r\tjQuery('.jqueryslidemenu>ul>li').hover(function(e) {
  2113.                 if( e.type == 'mouseenter' ) {
  2114.                     if( !jQuery(this).hasClass('cufon') ) {
  2115.                         id = jQuery(this).attr('id');
  2116.                         _class = jQuery(this).attr('class');
  2117.                         if(id){
  2118.                             Cufon.replace('#'+id+' a', { fontFamily: '{$font}' });
  2119.                         }else if(_class){
  2120.                             classMatch = _class.match(/page-item-([0-9]*)/);
  2121.                             Cufon.replace('.'+classMatch[0]+' a', { fontFamily: '{$font}' });
  2122.                         }
  2123.                         jQuery(this).addClass('cufon');
  2124.                     }
  2125.                 }
  2126.                
  2127.                 if ( (!ua.msie) || (ua.msie && ua.version.substring(0,1) >= '9') ){
  2128.                     if( e.type == 'mouseleave' ) {
  2129.                         setTimeout(function() {
  2130.                            Cufon.refresh('.jqueryslidemenu>ul>li>a');
  2131.                          }, 10);
  2132.                     }
  2133.                 }
  2134.                
  2135.              });";
  2136.  
  2137.         }
  2138.         else
  2139.         {
  2140.             $out .= "\r\tCufon.replace('{$declaration}', { fontFamily: '{$font}' });";
  2141.         }
  2142.     }
  2143.  
  2144.     if( !empty( $active_cufon['cufon_gradients'] ) )
  2145.         $out .= "\n" . $active_cufon['cufon_gradients'];
  2146.  
  2147.     $cufon_end = apply_atomic( 'cufon_end', '' );
  2148.     if( !empty( $cufon_end ) )
  2149.         $out .= $cufon_end;
  2150.  
  2151.     if( !empty( $active_cufon['cufon_gradients_fonts'] ) )
  2152.         $active_cufon['fonts'] = array_merge( $active_cufon['fonts'], $active_cufon['cufon_gradients_fonts'] );
  2153.  
  2154.     $declarations = array_keys( $active_cufon['fonts'] );
  2155.     $join_declarations = join( ',', str_replace( 'jqueryslidemenu a', 'jqueryslidemenu a span', $declarations ) );
  2156.  
  2157.     # Display cufon
  2158.     $out .= "
  2159.     if ( ua.msie && ua.version.substring(0,1) == '8' ){
  2160.         jQuery('{$join_declarations}').css('-ms-filter', '').css('filter', '');
  2161.     }else if( ua.msie && ua.version.substring(0,1) >= '9' ){
  2162.         jQuery('{$join_declarations}').css('opacity', '1');
  2163.     }else if(!ua.msie){
  2164.         jQuery('{$join_declarations}').css('opacity', '1');
  2165.     }";
  2166.  
  2167.     $cufon_after = apply_atomic( 'cufon_after', '' );
  2168.     if( !empty( $cufon_after ) )
  2169.         $out .= $cufon_after;
  2170.  
  2171.     $out .= "} \r/* ]]> */\r</script>";
  2172.  
  2173.     $out = preg_replace( "/(\r\n|\r|\n)\s*/i", '', $out );
  2174.  
  2175.     echo apply_atomic( 'print_cufon', $out );
  2176. }
  2177. endif;
  2178.  
  2179. if ( !function_exists( 'mysite_analytics' ) ) :
  2180. /**
  2181.  *
  2182.  */
  2183. function mysite_analytics() {
  2184.     $analytics = mysite_get_setting( 'analytics_code' );
  2185.  
  2186.     if( empty( $analytics ) )
  2187.         return;
  2188.    
  2189.     echo stripslashes( $analytics );
  2190. }
  2191. endif;
  2192.  
  2193. if ( !function_exists( 'mysite_image_preloading' ) ) :
  2194. /**
  2195.  *
  2196.  */
  2197. function mysite_image_preloading() {
  2198.    
  2199.     $out = "
  2200.     <script type=\"text/javascript\">
  2201.     /* <![CDATA[ */
  2202.    
  2203.     jQuery( '.blog_layout1' ).preloader({ imgSelector: '.blog_index_image_load span img', imgAppend: '.blog_index_image_load' });
  2204.     jQuery( '.blog_layout2' ).preloader({ imgSelector: '.blog_index_image_load span img', imgAppend: '.blog_index_image_load' });
  2205.     jQuery( '.blog_layout3' ).preloader({ imgSelector: '.blog_index_image_load span img', imgAppend: '.blog_index_image_load' });
  2206.     jQuery( '.single_post_module' ).preloader({ imgSelector: '.blog_index_image_load span img', imgAppend: '.blog_index_image_load' });
  2207.    
  2208.     jQuery( '.one_column_portfolio' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2209.     jQuery( '.two_column_portfolio' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2210.     jQuery( '.three_column_portfolio' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2211.     jQuery( '.four_column_portfolio' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2212.    
  2213.     jQuery( '.portfolio_gallery.large_post_list' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2214.     jQuery( '.portfolio_gallery.medium_post_list' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2215.     jQuery( '.portfolio_gallery.small_post_list' ).preloader({ imgSelector: '.portfolio_img_load span img', imgAppend: '.portfolio_img_load' });
  2216.    
  2217.     jQuery( '#main_inner' ).preloader({ imgSelector: '.portfolio_full_image span img', imgAppend: '.portfolio_full_image' });
  2218.     jQuery( '#main_inner' ).preloader({ imgSelector: '.blog_sc_image_load span img', imgAppend: '.blog_sc_image_load' });
  2219.     jQuery( '#main_inner' ).preloader({ imgSelector: '.fancy_image_load span img', imgAppend: '.fancy_image_load' });
  2220.     jQuery( '#intro_inner' ).preloader({ imgSelector: '.fancy_image_load span img', imgAppend: '.fancy_image_load' });
  2221.    
  2222.     /* ]]> */
  2223.     </script>";
  2224.  
  2225.     echo preg_replace( "/(\r\n|\r|\n)\s*/i", '', $out );
  2226.  
  2227. }
  2228. endif;
  2229.  
  2230. if ( !function_exists( 'mysite_custom_javascript' ) ) :
  2231. /**
  2232.  *
  2233.  */
  2234. function mysite_custom_javascript() {
  2235. $custom_js = mysite_get_setting( 'custom_js' );
  2236.  
  2237. if( empty( $custom_js ) )
  2238.     return;
  2239.    
  2240. ?><script type="text/javascript">
  2241. /* <![CDATA[ */
  2242.     <?php echo stripslashes( $custom_js ); ?>
  2243. /* ]]> */
  2244. </script>
  2245. <?php
  2246. }
  2247. endif;
  2248.  
  2249. if ( !function_exists( 'mysite_main_footer' ) ) :
  2250. /**
  2251.  *
  2252.  */
  2253. function mysite_main_footer() {
  2254.     $main_footer = apply_atomic_shortcode( 'main_footer', '' );
  2255.    
  2256.     if( !empty( $main_footer ) ) {
  2257.         echo $main_footer;
  2258.         return;
  2259.     }
  2260.    
  2261.     if( !mysite_get_setting( 'footer_disable' ) ) {
  2262.         $footer_column = mysite_get_setting( 'footer_columns' );
  2263.        
  2264.         if( is_numeric( $footer_column ) ) {
  2265.             $class = '';
  2266.            
  2267.             switch ( $footer_column ):
  2268.                 case 1:
  2269.                     $class = '';
  2270.                     break;
  2271.                 case 2:
  2272.                     $class = 'one_half';
  2273.                     break;
  2274.                 case 3:
  2275.                     $class = 'one_third';
  2276.                     break;
  2277.                 case 4:
  2278.                     $class = 'one_fourth';
  2279.                     break;
  2280.                 case 5:
  2281.                     $class = 'one_fifth';
  2282.                     break;
  2283.                 case 6:
  2284.                     $class = 'one_sixth';
  2285.                     break;
  2286.             endswitch;
  2287.             for( $i=1; $i<=$footer_column; $i++ ){
  2288.                 $last = ( $i == $footer_column ) ? ' last' : '' ;
  2289.  
  2290.                 echo '<div class="' . $class . $last . '">';
  2291.                 dynamic_sidebar( "footer{$i}" );
  2292.                 echo '</div>';
  2293.             }
  2294.  
  2295.         } else {
  2296.             switch( $footer_column ) :
  2297.                 case 'third_twothird':
  2298.                     echo '<div class="one_third">';
  2299.                     dynamic_sidebar( 'footer1' );
  2300.                     echo '</div>';
  2301.                     echo '<div class="two_third last">';
  2302.                     dynamic_sidebar( 'footer2' );
  2303.                     echo '</div>';
  2304.                     break;
  2305.                 case 'fourth_threefourth':
  2306.                     echo '<div class="one_fourth">';
  2307.                     dynamic_sidebar( 'footer1' );
  2308.                     echo '</div>';
  2309.                     echo '<div class="three_fourth last">';
  2310.                     dynamic_sidebar( 'footer2' );
  2311.                     echo '</div>';
  2312.                     break;
  2313.                 case 'fourth_fourth_half':
  2314.                     echo '<div class="one_fourth">';
  2315.                     dynamic_sidebar( 'footer1' );
  2316.                     echo '</div>';
  2317.                     echo '<div class="one_fourth">';
  2318.                     dynamic_sidebar( 'footer2' );
  2319.                     echo '</div>';
  2320.                     echo '<div class="one_half last">';
  2321.                     dynamic_sidebar( 'footer3' );
  2322.                     echo '</div>';
  2323.                     break;
  2324.                 case 'sixth_fivesixth':
  2325.                     echo '<div class="one_sixth">';
  2326.                     dynamic_sidebar( 'footer1' );
  2327.                     echo '</div>';
  2328.                     echo '<div class="five_sixth last">';
  2329.                     dynamic_sidebar( 'footer2' );
  2330.                     echo '</div>';
  2331.                     break;
  2332.                 case 'third_sixth_sixth_sixth_sixth':
  2333.                     echo '<div class="one_third">';
  2334.                     dynamic_sidebar( 'footer1' );
  2335.                     echo '</div>';
  2336.                     echo '<div class="one_sixth">';
  2337.                     dynamic_sidebar( 'footer2' );
  2338.                     echo '</div>';
  2339.                     echo '<div class="one_sixth">';
  2340.                     dynamic_sidebar( 'footer3' );
  2341.                     echo '</div>';
  2342.                     echo '<div class="one_sixth">';
  2343.                     dynamic_sidebar( 'footer4' );
  2344.                     echo '</div>';
  2345.                     echo '<div class="one_sixth last">';
  2346.                     dynamic_sidebar( 'footer5' );
  2347.                     echo '</div>';
  2348.                     break;
  2349.                 case 'half_sixth_sixth_sixth':
  2350.                     echo '<div class="one_half">';
  2351.                     dynamic_sidebar( 'footer1' );
  2352.                     echo '</div>';
  2353.                     echo '<div class="one_sixth">';
  2354.                     dynamic_sidebar( 'footer2' );
  2355.                     echo '</div>';
  2356.                     echo '<div class="one_sixth">';
  2357.                     dynamic_sidebar( 'footer3' );
  2358.                     echo '</div>';
  2359.                     echo '<div class="one_sixth last">';
  2360.                     dynamic_sidebar( 'footer4' );
  2361.                     echo '</div>';
  2362.                     break;
  2363.  
  2364.                 case 'twothird_third':
  2365.                     echo '<div class="two_third">';
  2366.                     dynamic_sidebar( 'footer1' );
  2367.                     echo '</div>';
  2368.                     echo '<div class="one_third last">';
  2369.                     dynamic_sidebar( 'footer2' );
  2370.                     echo '</div>';
  2371.                     break;
  2372.                 case 'threefourth_fourth':
  2373.                     echo '<div class="three_fourth">';
  2374.                     dynamic_sidebar( 'footer1' );
  2375.                     echo '</div>';
  2376.                     echo '<div class="one_fourth last">';
  2377.                     dynamic_sidebar( 'footer2' );
  2378.                     echo '</div>';
  2379.                     break;
  2380.                 case 'half_fourth_fourth':
  2381.                     echo '<div class="one_half">';
  2382.                     dynamic_sidebar( 'footer1' );
  2383.                     echo '</div>';
  2384.                     echo '<div class="one_fourth">';
  2385.                     dynamic_sidebar( 'footer2' );
  2386.                     echo '</div>';
  2387.                     echo '<div class="one_fourth last">';
  2388.                     dynamic_sidebar( 'footer3' );
  2389.                     echo '</div>';
  2390.                     break;
  2391.                 case 'fivesixth_sixth':
  2392.                     echo '<div class="five_sixth">';
  2393.                     dynamic_sidebar( 'footer1' );
  2394.                     echo '</div>';
  2395.                     echo '<div class="one_sixth last">';
  2396.                     dynamic_sidebar( 'footer2' );
  2397.                     echo '</div>';
  2398.                     break;
  2399.                 case 'sixth_sixth_sixth_sixth_third':
  2400.                     echo '<div class="one_sixth">';
  2401.                     dynamic_sidebar( 'footer1' );
  2402.                     echo '</div>';
  2403.                     echo '<div class="one_sixth">';
  2404.                     dynamic_sidebar( 'footer2' );
  2405.                     echo '</div>';
  2406.                     echo '<div class="one_sixth">';
  2407.                     dynamic_sidebar( 'footer3' );
  2408.                     echo '</div>';
  2409.                     echo '<div class="one_sixth">';
  2410.                     dynamic_sidebar( 'footer4' );
  2411.                     echo '</div>';
  2412.                     echo '<div class="one_third last">';
  2413.                     dynamic_sidebar("footer5");
  2414.                     echo '</div>';
  2415.                     break;
  2416.                 case 'sixth_sixth_sixth_half':
  2417.                     echo '<div class="one_sixth">';
  2418.                     dynamic_sidebar( 'footer1' );
  2419.                     echo '</div>';
  2420.                     echo '<div class="one_sixth">';
  2421.                     dynamic_sidebar( 'footer2' );
  2422.                     echo '</div>';
  2423.                     echo '<div class="one_sixth">';
  2424.                     dynamic_sidebar( 'footer3' );
  2425.                     echo '</div>';
  2426.                     echo '<div class="one_half last">';
  2427.                     dynamic_sidebar( 'footer4' );
  2428.                     echo '</div>';
  2429.                     break;
  2430.             endswitch;
  2431.         }
  2432.  
  2433.         echo '<div class="clearboth"></div>';
  2434.     }
  2435.    
  2436. }
  2437. endif;
  2438.  
  2439.  
  2440. if ( !function_exists( 'mysite_comment_tab' ) ) :
  2441. /**
  2442.  *
  2443.  */
  2444. function mysite_comment_tab() {
  2445.     global $post;
  2446.     $get_comments = get_comments( 'post_id=' . $post->ID );
  2447.     $comments_by_type = &separate_comments( $get_comments );
  2448.  
  2449. ?><div class="blog_tabs_container">
  2450.  
  2451.         <ul class="blog_tabs">
  2452.             <li><a href="#" class="current"><?php
  2453.             printf( _n( '%1$s Comment', '%1$s Comments', count( $comments_by_type['comment'] ), MYSITE_TEXTDOMAIN ),
  2454.             number_format_i18n( count( $comments_by_type['comment'] ) ) );
  2455.             ?></a></li>
  2456.             <li><a href="#" class=""><?php
  2457.             printf( _n( '%1$s Trackback', '%1$s Trackback', count( $comments_by_type['pings'] ), MYSITE_TEXTDOMAIN ),
  2458.             number_format_i18n( count( $comments_by_type['pings'] ) ) );
  2459.             ?></a></li>
  2460.         </ul><!-- .blog_tabs -->
  2461.  
  2462.         <div class="blog_tabs_content">
  2463.             <ol class="commentlist">
  2464.                 <?php wp_list_comments( array( 'type' => 'comment', 'callback' => 'mysite_comments_callback' ) ); ?>
  2465.             </ol>
  2466.  
  2467.             <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
  2468.                 <div class="comment-navigation paged-navigation">
  2469.                     <?php paginate_comments_links( mysite_portfolio_comment_url( $nav = true ) ); ?>
  2470.                 </div><!-- .comment-navigation -->
  2471.             <?php endif; ?>
  2472.  
  2473.         </div><!-- .blog_tabs_content -->
  2474.  
  2475.         <div class="blog_tabs_content">
  2476.             <ol class="commentlist trackbacks_pingbacks">
  2477.                 <?php wp_list_comments( array( 'type' => 'pings', 'callback' => 'mysite_pings_callback' ) ); ?>
  2478.             </ol>
  2479.         </div><!-- .blog_tabs_content -->
  2480.  
  2481.     </div><!-- .blog_tabs_container -->
  2482.  
  2483. <?php      
  2484. }
  2485. endif;
  2486.  
  2487. if ( !function_exists( 'mysite_comment_list' ) ) :
  2488. /**
  2489.  *
  2490.  */
  2491. function mysite_comment_list() {
  2492. echo apply_filters( 'mysite_comments_title', '<h3 id="comments-title">' . sprintf( _n( '1 Comment', '%1$s Comments', get_comments_number(), MYSITE_TEXTDOMAIN ), number_format_i18n( get_comments_number() ), get_the_title() ) . '</h3>', array( 'comments_number' => get_comments_number(), 'title' =>  get_the_title() ) );
  2493.  
  2494. ?><ol class="commentlist">
  2495.         <?php wp_list_comments( array( 'type' => 'all', 'callback' => 'mysite_comments_callback' ) ); ?>
  2496.     </ol>
  2497.  
  2498.     <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
  2499.         <div class="comment-navigation paged-navigation">
  2500.             <?php paginate_comments_links( mysite_portfolio_comment_url( $nav = true ) ); ?>
  2501.         </div><!-- .comment-navigation -->
  2502.     <?php endif; ?>
  2503.  
  2504. <?php
  2505. }
  2506. endif;
  2507.  
  2508. if ( !function_exists( 'mysite_comments_callback' ) ) :
  2509. /**
  2510.  *
  2511.  */
  2512. function mysite_comments_callback( $comment, $args, $depth ) {
  2513.     $GLOBALS['comment'] = $comment;
  2514.  
  2515.     $comment_type = get_comment_type( $comment->comment_ID );
  2516.     $author = esc_html( get_comment_author( $comment->comment_ID ) );
  2517.     $url = esc_url( get_comment_author_url( $comment->comment_ID ) );
  2518.     $default_avatar = ( 'pingback' == $comment_type || 'trackback' == $comment_type )
  2519.     ? THEME_IMAGES_ASSETS . "/gravatar_{$comment_type}.png"
  2520.     : THEME_IMAGES_ASSETS . '/gravatar_default.png';
  2521.  
  2522.     ?><li <?php comment_class() ?> id="comment-<?php comment_ID() ?>">
  2523.         <div id="div-comment-<?php comment_ID() ?>"><?php
  2524.  
  2525.         /* Display gravatar */
  2526.         $avatar = get_avatar( get_comment_author_email( $comment->comment_ID ), apply_filters( "mysite_avatar_size", '80' ), $default_avatar, $author );
  2527.  
  2528.         if ( $url )
  2529.             $avatar = '<a href="' . esc_url( $url ) . '" rel="external nofollow" title="' . esc_attr( $author ) . '">' . $avatar . '</a>';
  2530.  
  2531.         echo $avatar;
  2532.  
  2533.         ?><div class="comment-text"><?php
  2534.  
  2535.         /* Display link and cite if URL is set. */
  2536.         if ( $url )
  2537.             echo '<cite class="fn" title="' . esc_url( $url ) . '"><a href="' . esc_url( $url ) . '" title="' . esc_attr( $author ) . '" class="url" rel="external nofollow">' . $author . '</a></cite>';
  2538.         else
  2539.             echo '<cite class="fn">' . $author . '</cite>';
  2540.  
  2541.         /* Display comment date */
  2542.         ?><span class="date"><?php printf( __('%1$s', MYSITE_TEXTDOMAIN ), get_comment_date( __( apply_filters( "mysite_comment_date_format", 'F jS Y' ) ) ) ); ?></span>
  2543.  
  2544.         <?php if ( $comment->comment_approved == '0' ) : ?>
  2545.             <p class="alert moderation"><?php _e( 'Your comment is awaiting moderation.', MYSITE_TEXTDOMAIN ); ?></p>
  2546.                 <?php endif; ?>
  2547.  
  2548.                 <?php comment_text() ?>
  2549.  
  2550.                 <div class="comment-meta commentmetadata"><?php
  2551.                     comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) );
  2552.                     edit_comment_link( __( 'Edit', MYSITE_TEXTDOMAIN ), ' ' );
  2553.                 ?></div>
  2554.  
  2555.             </div><!-- .comment-text -->
  2556.  
  2557.         </div><!-- #div-comment-## -->
  2558. <?php
  2559. }
  2560. endif;
  2561.  
  2562. if ( !function_exists( 'mysite_pings_callback' ) ) :
  2563. /**
  2564.  *
  2565.  */
  2566. function mysite_pings_callback( $comment, $args, $depth ) {
  2567.     $GLOBALS['comment'] = $comment;
  2568. ?><li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  2569.     <cite><?php comment_author_link() ?></cite><span class="date"><?php comment_date('m-d-y'); ?></span><br />
  2570. <?php  
  2571. }
  2572. endif;
  2573.  
  2574. if ( !function_exists( 'mysite_comment_form_args' ) ) :
  2575. /**
  2576.  *
  2577.  */
  2578. function mysite_comment_form_args( $args ) {
  2579.     global $user_identity;
  2580.  
  2581.     $commenter = wp_get_current_commenter();
  2582.     $req = ( ( get_option( 'require_name_email' ) ) ? ' <span class="required">' . __( '*', MYSITE_TEXTDOMAIN ) . '</span> ' : '' );
  2583.        
  2584.     $fields = array(
  2585.         'redirect_to' => ( is_singular( 'portfolio' ) ? '<input type="hidden" name="redirect_to" value="' . mysite_portfolio_comment_url() . '" />' : '' ),
  2586.         'author' => '<p class="form-author"><input type="text" class="textfield" name="author" id="author" value="' . esc_attr( $commenter['comment_author'] ) . '" size="40" tabindex="1" /><label for="author" class="textfield_label">' . __( 'Name', MYSITE_TEXTDOMAIN ) . $req . '</label></p>',
  2587.         'email' => '<p class="form-email"><input type="text" class="textfield" name="email" id="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="40" tabindex="2" /><label for="email" class="textfield_label">' . __( 'Email', MYSITE_TEXTDOMAIN ) . $req . '</label></p>',
  2588.         'url' => '<p class="form-url"><input type="text" class="textfield" name="url" id="url" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="40" tabindex="3" /><label for="url" class="textfield_label">' . __( 'Website', MYSITE_TEXTDOMAIN ) . '</label></p>'
  2589.     );
  2590.  
  2591.     $args = array(
  2592.         'fields' => apply_filters( 'comment_form_default_fields', $fields ),
  2593.         'comment_field' => '<p class="form-textarea"><textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>',
  2594.         'must_log_in' => '<p class="alert">' . sprintf( __( 'You must be <a href="%1$s" title="Log in">logged in</a> to post a comment.', MYSITE_TEXTDOMAIN ), wp_login_url( get_permalink() ) ) . '</p><!-- .alert -->',
  2595.         'logged_in_as' => '<p class="log-in-out">' . sprintf( __( 'Logged in as <a href="%1$s" title="%2$s">%2$s</a>.', MYSITE_TEXTDOMAIN ), admin_url( 'profile.php' ), $user_identity ) . ' <a href="' . wp_logout_url( get_permalink() ) . '" title="' . __( 'Log out of this account', MYSITE_TEXTDOMAIN ) . '">' . __( 'Log out &raquo;', MYSITE_TEXTDOMAIN ) . '</a></p><!-- .log-in-out -->',
  2596.         'comment_notes_before' => '',
  2597.         'comment_notes_after' => '',
  2598.         'id_form' => 'commentform',
  2599.         'id_submit' => 'submit',
  2600.         'title_reply' => __( 'Leave a Reply', MYSITE_TEXTDOMAIN ),
  2601.         'title_reply_to' => __( 'Leave a Reply to %s', MYSITE_TEXTDOMAIN ),
  2602.         'cancel_reply_link' => __( 'Click here to cancel reply.', MYSITE_TEXTDOMAIN ),
  2603.         'label_submit' => __( 'Submit', MYSITE_TEXTDOMAIN ),
  2604.     );
  2605.  
  2606.     return $args;
  2607. }
  2608. endif;
  2609.  
  2610.  
  2611. if ( !function_exists( 'mysite_404' ) ) :
  2612. /**
  2613.  *
  2614.  */
  2615. function mysite_404( $post = false ) {
  2616. ?><div id="post-0" class="page error404 not_found">
  2617.    
  2618.     <?php $intro_options = mysite_get_setting( 'intro_options' );
  2619.     if( $intro_options == 'disable' && !is_search() ) :
  2620.     ?><h1 class="post_title"><?php _e( 'Not Found', MYSITE_TEXTDOMAIN ); ?></h1>
  2621.     <?php endif; ?>
  2622.    
  2623.     <div class="entry">
  2624.         <?php if( !$post ) :
  2625.         ?><p><?php _e( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', MYSITE_TEXTDOMAIN ); ?></p>
  2626.         <?php elseif( is_search() ) :
  2627.         ?><?php _e( 'Apologies, but no post could be found matching your criteria.', MYSITE_TEXTDOMAIN ); ?></p>
  2628.         <?php else :
  2629.         ?><?php _e( 'Apologies, but no post could be found matching your criteria. Perhaps searching will help.', MYSITE_TEXTDOMAIN ); ?></p>
  2630.         <?php endif; ?>
  2631.         <?php get_search_form(); ?>
  2632.     </div><!-- .entry -->
  2633. </div><!-- #post-0 -->
  2634.  
  2635. <script type="text/javascript">
  2636. /* <![CDATA[ */
  2637.     // focus on search field after it has loaded
  2638.     document.getElementById('s') && document.getElementById('s').focus();
  2639. /* ]]> */
  2640. </script>
  2641.  
  2642. <?php  
  2643. }
  2644. endif;
  2645.  
  2646. if ( !function_exists( 'mysite_archive' ) ) :
  2647. /**
  2648.  *
  2649.  */
  2650. function mysite_archive() {
  2651.     get_template_part( 'loop', 'archive' );
  2652. }
  2653. endif;
  2654.  
  2655. if ( !function_exists( 'mysite_search' ) ) :
  2656. /**
  2657.  *
  2658.  */
  2659. function mysite_search() {
  2660.     get_template_part( 'loop', 'search' );
  2661. }
  2662. endif;
  2663.  
  2664. if ( !function_exists( 'mysite_sitemap' ) ) :
  2665. /**
  2666.  *
  2667.  */
  2668. function mysite_sitemap() {
  2669. ?><div id="post-<?php the_ID(); ?>" <?php post_class( 'sitemap' ); ?>>
  2670.     <?php mysite_before_entry(); ?>
  2671.    
  2672.     <div class="entry">
  2673.     <h2><?php _e( 'Pages', MYSITE_TEXTDOMAIN );?></h2>
  2674.     <ul class="sitemap_list"><?php wp_list_pages('depth=0&sort_column=menu_order&title_li=' );
  2675.     ?></ul>
  2676.     <div class="divider top"><a href="#"><?php _e( 'Top', MYSITE_TEXTDOMAIN ); ?></a></div>
  2677.    
  2678.     <h2><?php _e( 'Category Archives', MYSITE_TEXTDOMAIN ); ?></h2>
  2679.     <ul class="sitemap_list"><?php
  2680.         wp_list_categories( array(
  2681.             'exclude'=> mysite_exclude_category_string( $minus = false ),
  2682.             'feed' => __( 'RSS', MYSITE_TEXTDOMAIN ),
  2683.             'show_count' => true, 'use_desc_for_title' => false,
  2684.             'title_li' => false
  2685.         ));
  2686.     ?></ul>
  2687.     <div class="divider top"><a href="#"><?php _e( 'Top', MYSITE_TEXTDOMAIN ); ?></a></div>
  2688.    
  2689.     <?php $archive_query = new WP_Query( array( 'showposts' => 1000, 'category__not_in' => array( mysite_exclude_category_string( $minus = false ) ) ) );
  2690.     ?><h2><?php _e( 'Blog Posts', MYSITE_TEXTDOMAIN ); ?></h2>
  2691.     <ul class="sitemap_list"><?php while ( $archive_query->have_posts() ) : $archive_query->the_post();
  2692.     ?><li><a href="<?php esc_url( the_permalink() ); ?>" rel="bookmark" title="<?php printf( __( "Permanent Link to %s", MYSITE_TEXTDOMAIN ), esc_attr( get_the_title() ) ); ?>"><?php the_title();
  2693.     ?></a> (<?php comments_number('0', '1', '%'); ?>)</li>
  2694.     <?php endwhile;
  2695.     ?></ul>
  2696.     <div class="divider top"><a href="#"><?php _e( 'Top', MYSITE_TEXTDOMAIN ); ?></a></div>
  2697.  
  2698.     <?php $portfolio_query = new WP_Query( array( 'post_type' => 'portfolio','showposts' => 1000 ) );
  2699.     ?><h2><?php _e( 'Portfolios', MYSITE_TEXTDOMAIN ); ?></h2>
  2700.     <ul class="sitemap_list"><?php while ( $portfolio_query->have_posts() ) : $portfolio_query->the_post();
  2701.     ?><li><a href="<?php esc_url( the_permalink() ); ?>" rel="bookmark" title="<?php printf( __( "Permanent Link to %s", MYSITE_TEXTDOMAIN ), esc_attr( get_the_title() ) ); ?>"><?php the_title();
  2702.     ?></a> (<?php comments_number('0', '1', '%'); ?>)</li>
  2703.     <?php endwhile;
  2704.     ?></ul>
  2705.     <div class="divider top"><a href="#"><?php _e( 'Top', MYSITE_TEXTDOMAIN ); ?></a></div>
  2706.  
  2707.     <h2><?php _e( 'Archives', MYSITE_TEXTDOMAIN ); ?></h2>
  2708.     <ul class="sitemap_list"><?php wp_get_archives( 'type=monthly&show_post_count=true' );
  2709.     ?></ul>
  2710.     <div class="divider top"><a href="#"><?php _e( 'Top', MYSITE_TEXTDOMAIN ); ?></a></div>
  2711.    
  2712.     <div class="clearboth"></div>
  2713.     <?php wp_link_pages( array( 'before' => '<div class="page_link">' . __( 'Pages:', MYSITE_TEXTDOMAIN ), 'after' => '</div>' ) ); ?>
  2714.     <?php edit_post_link( __( 'Edit', MYSITE_TEXTDOMAIN ), '<div class="edit_link">', '</div>' ); ?>
  2715.     </div><!-- .entry -->
  2716.                
  2717.     <?php mysite_after_entry(); ?>
  2718. </div><!-- #post-0 -->
  2719.  
  2720. <?php  
  2721. }
  2722. endif;
  2723.  
  2724. if ( !function_exists( 'mysite_password_form' ) ) :
  2725. /**
  2726.  *
  2727.  */
  2728. function mysite_password_form() {
  2729.     global $post;
  2730.     $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
  2731.     $output = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
  2732.     <p>' . __( 'This post is password protected. To view it please enter your password below:', MYSITE_TEXTDOMAIN ) . '</p>
  2733.     <p><label class="password_protect_label" for="' . $label . '">' . __( 'Password:', MYSITE_TEXTDOMAIN ) . '</label> <input class="password" name="post_password" id="' . $label . '" type="password" size="20" /> <input class="fancy_button password_protect_button" type="submit" name="Submit" value="' . esc_attr__( 'Submit', MYSITE_TEXTDOMAIN ) . '" /></p>
  2734.     </form>';
  2735.    
  2736.     return '<!–start_raw–>' . $output . '<!–end_raw–>';
  2737. }
  2738. endif;
  2739.  
  2740. if ( !function_exists( 'mysite_custom_bg' ) ) :
  2741. /**
  2742.  *
  2743.  */
  2744. function mysite_custom_bg() {
  2745.     global $post;
  2746.    
  2747.     $out = '';
  2748.    
  2749.     if( is_archive() )
  2750.         $custom_background = mysite_get_setting( 'archive_custom_background' );
  2751.        
  2752.     else if( is_search() )
  2753.         $custom_background = mysite_get_setting( 'search_custom_background' );
  2754.        
  2755.     else if( is_404() )
  2756.         $custom_background = mysite_get_setting( 'four_04_custom_background' );
  2757.        
  2758.     else if( !empty( $post->ID ) )
  2759.         $custom_background = get_post_meta( $post->ID, '_custom_background', true );
  2760.        
  2761.     if( !isset( $custom_background['full_bg'] ) || strtolower( $custom_background['url'] ) == 'none' ) {
  2762.        
  2763.         if( !empty( $custom_background['url'] ) && strtolower( $custom_background['url'] ) != 'none' )
  2764.             $out .= 'background-image: url("' . esc_url(stripslashes( $custom_background['url'] ) ) . '");';
  2765.            
  2766.         elseif( !empty( $custom_background['url'] ) && strtolower( $custom_background['url'] ) == 'none' )
  2767.             $out .= 'background-image: none;';
  2768.  
  2769.         if( !empty( $custom_background['background-color'] ) )
  2770.             $out .= 'background-color: ' . $custom_background['background-color'] . ';';
  2771.  
  2772.         if( !empty( $custom_background['background-repeat'] ) && !empty( $custom_background['url'] ) )
  2773.             $out .= 'background-repeat: ' . $custom_background['background-repeat'] . ';';
  2774.  
  2775.         if( !empty( $custom_background['background-attachment'] ) && !empty( $custom_background['url'] ) )
  2776.             $out .= 'background-attachment: ' . $custom_background['background-attachment'] . ';';
  2777.  
  2778.         if( !empty( $custom_background['background-position'] ) && !empty( $custom_background['url'] ) )
  2779.             $out .= 'background-position: ' . $custom_background['background-position'] . ';';
  2780.  
  2781.         if( !empty( $out ) ) {
  2782.             $out = "\r" . '<style type="text/css">body{' . $out . ' }</style>' . "\r";
  2783.         }
  2784.     }
  2785.    
  2786.     echo apply_atomic( 'custom_bg', $out );
  2787. }
  2788. endif;
  2789.  
  2790. if ( !function_exists( 'mysite_fullscreen_bg' ) ) :
  2791. /**
  2792.  *
  2793.  */
  2794. function mysite_fullscreen_bg() {
  2795.     global $post;
  2796.    
  2797.     $out = '';
  2798.    
  2799.     if( is_archive() )
  2800.         $custom_background = mysite_get_setting( 'archive_custom_background' );
  2801.        
  2802.     else if( is_search() )
  2803.         $custom_background = mysite_get_setting( 'search_custom_background' );
  2804.        
  2805.     else if( is_404() )
  2806.         $custom_background = mysite_get_setting( 'four_04_custom_background' );
  2807.        
  2808.     else if( !empty( $post->ID ) )
  2809.         $custom_background = get_post_meta( $post->ID, '_custom_background', true );
  2810.    
  2811.     if( empty( $custom_background['url'] ) ) {
  2812.         $custom_background = apply_filters( 'mysite_active_skin', get_option( MYSITE_ACTIVE_SKIN ) );
  2813.         $full_bg = ( isset( $custom_background['full_bg'] ) && is_array( $custom_background['full_bg'] ) ) ? $custom_background['full_bg'] : array();
  2814.         $custom_background['url'] = ( isset( $full_bg['url'] ) ? $full_bg['url'] : '' );
  2815.        
  2816.         if( in_array( 'fullbg', $full_bg ) )
  2817.             $custom_background['full_bg'] = true;
  2818.        
  2819.         if( in_array( 'fadebg', $full_bg ) )
  2820.             $custom_background['fade_bg'] = true;
  2821.     }
  2822.    
  2823.     if( !empty( $custom_background['url'] ) && strtolower( $custom_background['url'] ) != 'none' && isset( $custom_background['full_bg'] ) ) {
  2824.        
  2825.         # Get image size
  2826.         $url_info = parse_url( $custom_background['url'] );
  2827.         $image_path = ( isset( $url_info['path'] ) ) ? $url_info['path'] : '';
  2828.        
  2829.         if( is_multisite() && isset( $url_info['host'] ) && strpos( $url_info['host'], $_SERVER['SERVER_NAME'] ) !== false ) {
  2830.             global $blog_id;
  2831.             $image_path = explode( $_SERVER['SERVER_NAME'], $custom_background['url'] );
  2832.             if( strpos( $image, str_replace( 'files', '', get_blog_option( $blog_id, 'fileupload_url' ) ) ) !== false ) {
  2833.                 $image_path = $_SERVER['DOCUMENT_ROOT'] . $image_path[0];
  2834.             } else {
  2835.                 $image_path = $_SERVER['DOCUMENT_ROOT'] . $image_path[1];
  2836.             }
  2837.  
  2838.         } elseif( isset( $url_info['host'] ) && strpos( $url_info['host'], $_SERVER['SERVER_NAME'] ) !== false ) {
  2839.             $image_path = explode( $_SERVER['SERVER_NAME'], $custom_background['url'] );
  2840.             $image_path = $_SERVER['DOCUMENT_ROOT'] . $image_path[1];
  2841.         }
  2842.  
  2843.         $image_sizes = @getimagesize( $image_path );
  2844.  
  2845.         # If we cannot get the image locally, try for an external URL
  2846.         if ( empty( $image_sizes ) )
  2847.             $image_sizes = @getimagesize( $custom_background['url'] );
  2848.            
  2849.         # If we still cannot get image size see if it's in THEME_STYLES_DIR or if were on an MU install createing a skin from "_create_new.css"
  2850.         if ( empty( $image_sizes ) ) {
  2851.             if( is_multisite() && !isset( $url_info['host'] ) && strpos( $custom_background['url'], 'wp-content' ) !== false ) {
  2852.                 $image_sizes = @getimagesize( str_replace( '/wp-content/themes/' . THEME_SLUG . '/styles', '', THEME_STYLES_DIR ) . $custom_background['url'] );
  2853.                 $custom_background['url'] = str_replace( '/wp-content/themes/' . THEME_SLUG . '/styles', '', THEME_STYLES ) . $custom_background['url'];
  2854.             } else {
  2855.                 $image_sizes = @getimagesize( THEME_STYLES_DIR . '/' . $custom_background['url'] );
  2856.                 $custom_background['url'] = THEME_STYLES . '/' . $custom_background['url'];
  2857.             }
  2858.         }
  2859.        
  2860.         # Return if we can't get image sizes   
  2861.         if ( empty( $image_sizes ) )
  2862.             return;
  2863.            
  2864.            
  2865.         # Set body background to none
  2866.         $out .= '<style type="text/css">body{background-image: none;}</style>';
  2867.  
  2868.         # Check for background color override
  2869.         if( !empty( $custom_background['background-color'] ) )
  2870.             $out .= '<style type="text/css">body{background-color: ' . $custom_background['background-color'] . ';}</style>';
  2871.        
  2872.         $out .= "<script type=\"text/javascript\">\r/* <![CDATA[ */\r";
  2873.        
  2874.         # Resize on page load
  2875.         $out .= "
  2876.             var fullbg_url = '" .$custom_background['url']. "',
  2877.                 origDiv = '#fullbg',
  2878.                 origImg = '#fullbg img',
  2879.                 ratio = 768/1024,
  2880.                 winWidth = jQuery(window).width(),
  2881.                 winHeight = jQuery(window).height(),
  2882.                 winRatio = winHeight/winWidth;
  2883.                
  2884.             if (winRatio > ratio) {
  2885.                 var imgWidth = winHeight / ratio,
  2886.                     imgHeight = winHeight;
  2887.                    
  2888.             } else {
  2889.                 var imgWidth = winWidth,
  2890.                     imgHeight = winWidth * ratio;
  2891.             }
  2892.            
  2893.             var newcontent = document.createElement('div'),
  2894.                 insert = document.getElementById('body_inner');
  2895.            
  2896.             newcontent.id = origDiv.replace('#', '');
  2897.             insert.parentNode.insertBefore(newcontent, insert);
  2898.            
  2899.             var newcontent = document.getElementById(origDiv.replace('#', '')).innerHTML = '<img src=\"' +fullbg_url+ '\" alt=\"\" height=\"' +imgHeight+ '\" width=\"' +imgWidth+ '\" />';
  2900.            
  2901.             jQuery(origDiv).css('position', 'fixed');
  2902.             jQuery(origDiv).width(imgWidth);
  2903.             jQuery(origDiv).height(imgHeight);
  2904.         ";
  2905.        
  2906.         # Fade in background image if option is set
  2907.         if( isset( $custom_background['fade_bg'] ) ) {
  2908.             $out .= "
  2909.             jQuery(origDiv).css('display', 'none');
  2910.             jQuery(document).ready(function() {
  2911.                 jQuery('#fullbg').fadeIn();
  2912.             });
  2913.             ";
  2914.         }
  2915.        
  2916.         # Resize the image on browser resize
  2917.         $out .= "
  2918.         (function($){
  2919.             $(window).bind('resize', function() {
  2920.                 $(origDiv).resizeImg();
  2921.             });
  2922.            
  2923.             $.fn.resizeImg = function() {
  2924.                 var imgWidth = $(origImg).attr('width');
  2925.                 var imgHeight = $(origImg).attr('height');
  2926.                 var ratio = imgHeight/imgWidth;
  2927.                 var winWidth = $(window).width();
  2928.                 var winHeight = $(window).height();
  2929.             var winRatio = winHeight/winWidth;
  2930.                 if (winRatio > ratio) {
  2931.                     $(origDiv).height(winHeight);
  2932.                     $(origDiv).width(winHeight / ratio);
  2933.                     $(origImg).height(winHeight);
  2934.                     $(origImg).width(winHeight / ratio);
  2935.                 } else {
  2936.                     $(origDiv).width(winWidth);
  2937.                     $(origDiv).height(winWidth * ratio);
  2938.                     $(origImg).width(winWidth);
  2939.                     $(origImg).height(winWidth * ratio);
  2940.                 }
  2941.             };
  2942.         })(jQuery);
  2943.         ";
  2944.  
  2945.         $out .= "\r/* ]]> */\r</script>";
  2946.        
  2947.         # If javascript is disabled still display image
  2948.         # $out .= '<div class="fullbg noscript_dn"><img src="' . $custom_background['url'] . '" style="position: fixed;" alt="" height="' . $image_sizes[1] . '" width="' . $image_sizes[0] . '" /></div>';
  2949.  
  2950.         $out = preg_replace( "/(\r\n|\r|\n)\s*/i", '', $out ) . "\r";
  2951.     }
  2952.    
  2953.     echo apply_atomic( 'custom_fullbg', $out );
  2954. }
  2955. endif;
  2956.  
  2957. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement