예제 #1
1
*
* @since Customizr 3.0
*/
if (!function_exists('tc_get_file_class')) {
    function tc_get_file_class($file)
    {
        //find the name of the class=>after last occurence of '-' and remove .php
        $pos = strripos($haystack = $file, $needle = '-');
        //get the part of the string containing the class name
        $classname = substr($file, $pos + 1);
        //get rid of '.php'
        $classname = substr_replace($classname, '', -4, 4);
        return $classname;
    }
}
/**
* Allows WP apply_filter() function to accept up to 3 optional arguments
* 
*
* @since Customizr 3.0
*/
if (!function_exists('tc__f')) {
    function tc__f($filter, $arg1 = null, $arg2 = null, $arg3 = null)
    {
        return apply_filters($filter, $arg1, $arg2, $arg3);
    }
}
/* Loads the theme classes framework */
locate_template('inc/class-customizr-__.php', true, true);
tc__('customizr');
//fire the theme
 function __construct()
 {
     /* GET INFORMATIONS FROM STYLE.CSS */
     // get themedata version wp 3.4+
     if (function_exists('wp_get_theme')) {
         $tc_theme = wp_get_theme();
         $tc_base_data['prefix'] = $tc_base_data['Title'] = $tc_theme->get('Name');
         $tc_base_data['Version'] = $tc_theme->get('Version');
     } else {
         $tc_base_data = get_theme_data(TC_BASE . 'style.css');
         $tc_base_data['prefix'] = $tc_base_data['Title'];
     }
     /* CUSTOMIZR_VER is the Version */
     if (!defined('CUSTOMIZR_VER')) {
         define('CUSTOMIZR_VER', $tc_base_data['Version']);
     }
     /* TC_BASE is the root server path */
     if (!defined('TC_BASE')) {
         define('TC_BASE', get_template_directory() . '/');
     }
     /* TC_BASE_URL http url of the loaded template */
     if (!defined('TC_BASE_URL')) {
         define('TC_BASE_URL', get_template_directory_uri() . '/');
     }
     /* THEMENAME contains the Name of the currently loaded theme */
     if (!defined('THEMENAME')) {
         define('THEMENAME', $tc_base_data['Title']);
     }
     /* theme class groups instanciation */
     $groups = array('fire', 'main', 'header', 'content');
     foreach ($groups as $g) {
         tc__($g);
     }
 }
 /**
  *  load the meta boxes for pages, posts and attachment
  * @package Customizr
  * @since Customizr 3.0.4
  */
 function tc_load_meta_boxes()
 {
     //loads meta boxes
     tc__('admin', 'meta_boxes');
 }
    /**
     * Menu Rendering
     *
     * @package Customizr
     * @since Customizr 3.0
     */
    function tc_render_menu()
    {
        ?>
      <div class="navbar notresp span9 pull-left">

              <div class="navbar-inner" role="navigation">

                  <div class="row-fluid">

                    <div class="social-block span5"><?php 
        do_action('__social', 'tc_social_in_header');
        ?>
</div>

                    <h2 class="span7 inside site-description"><?php 
        bloginfo('description');
        ?>
</h2>
                  </div>

                  <div class="nav-collapse collapse">

                    <?php 
        wp_nav_menu(array('theme_location' => 'main', 'menu_class' => 'nav', 'fallback_cb' => array($this, 'tc_link_to_menu_editor'), 'walker' => tc__('header', 'nav_walker')));
        ?>
                  
                  </div><!-- /.nav-collapse collapse -->

              </div><!-- /.navbar-inner -->

          </div><!-- /.navbar notresp -->

          <div class="navbar resp">

              <div class="navbar-inner" role="navigation">

                  <div class="social-block"><?php 
        do_action('__social', 'tc_social_in_header');
        ?>
</div>

                      <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                      </button>

                 <div class="nav-collapse collapse">
                      <?php 
        wp_nav_menu(array('theme_location' => 'main', 'menu_class' => 'nav', 'fallback_cb' => array($this, 'tc_link_to_menu_editor'), 'walker' => tc__('header', 'nav_walker')));
        ?>
                 </div><!-- /.nav-collapse collapse -->

              </div><!-- /.navbar-inner -->
              
          </div><!-- /.navbar resp -->
    <?php 
    }