示例#1
0
 function __construct()
 {
     self::$instance =& $this;
     /* GETS INFORMATIONS FROM STYLE.CSS */
     // get themedata version wp 3.4+
     if (function_exists('wp_get_theme')) {
         //get WP_Theme object of customizr
         $tc_theme = wp_get_theme();
         //Get infos from parent theme if using a child theme
         $tc_theme = $tc_theme->parent() ? $tc_theme->parent() : $tc_theme;
         $tc_base_data['prefix'] = $tc_base_data['title'] = $tc_theme->name;
         $tc_base_data['version'] = $tc_theme->version;
         $tc_base_data['authoruri'] = $tc_theme->{'Author URI'};
     } else {
         $tc_base_data = call_user_func('get_' . 'theme_data', get_stylesheet_directory() . '/style.css');
         $tc_base_data['prefix'] = $tc_base_data['title'];
     }
     self::$theme_name = sanitize_file_name(strtolower($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 of the parent theme
     if (!defined('TC_BASE')) {
         define('TC_BASE', get_template_directory() . '/');
     }
     //TC_BASE_CHILD is the root server path of the child theme
     if (!defined('TC_BASE_CHILD')) {
         define('TC_BASE_CHILD', get_stylesheet_directory() . '/');
     }
     //TC_BASE_URL http url of the loaded parent theme
     if (!defined('TC_BASE_URL')) {
         define('TC_BASE_URL', get_template_directory_uri() . '/');
     }
     //TC_BASE_URL_CHILD http url of the loaded child theme
     if (!defined('TC_BASE_URL_CHILD')) {
         define('TC_BASE_URL_CHILD', get_stylesheet_directory_uri() . '/');
     }
     //THEMENAME contains the Name of the currently loaded theme
     if (!defined('THEMENAME')) {
         define('THEMENAME', $tc_base_data['title']);
     }
     //TC_WEBSITE is the home website of Customizr
     if (!defined('TC_WEBSITE')) {
         define('TC_WEBSITE', $tc_base_data['authoruri']);
     }
     //this is the structure of the Customizr code : groups => ('path' , 'class_suffix')
     $this->tc_core = apply_filters('tc_core', array('fire' => array(array('inc', 'init'), array('inc', 'utils_settings_map'), array('inc', 'utils'), array('inc', 'resources'), array('inc', 'widgets'), array('inc/admin', 'admin_init'), array('inc/admin', 'admin_page')), 'header' => array(array('inc/parts', 'header_main'), array('inc/parts', 'menu'), array('inc/parts', 'nav_walker')), 'content' => array(array('inc/parts', '404'), array('inc/parts', 'attachment'), array('inc/parts', 'breadcrumb'), array('inc/parts', 'comments'), array('inc/parts', 'featured_pages'), array('inc/parts', 'gallery'), array('inc/parts', 'headings'), array('inc/parts', 'no_results'), array('inc/parts', 'page'), array('inc/parts', 'post_thumbnails'), array('inc/parts', 'post'), array('inc/parts', 'post_list'), array('inc/parts', 'post_metas'), array('inc/parts', 'post_navigation'), array('inc/parts', 'sidebar'), array('inc/parts', 'slider')), 'footer' => array(array('inc/parts', 'footer_main')), 'addons' => apply_filters('tc_addons_classes', array())));
     //end of filters
     //check the context
     if (file_exists(sprintf('%sinc/init-pro.php', TC_BASE)) && 'customizr-pro' == self::$theme_name) {
         require_once sprintf('%sinc/init-pro.php', TC_BASE);
         self::$tc_option_group = 'tc_theme_options';
     } else {
         self::$tc_option_group = 'tc_theme_options';
     }
     //theme class groups instanciation
     $this->tc__($this->tc_core);
 }
示例#2
0
    function __construct () {
      self::$instance =& $this;

      /* GETS INFORMATIONS FROM STYLE.CSS */
      // get themedata version wp 3.4+
      if( function_exists( 'wp_get_theme' ) ) {
        //get WP_Theme object of customizr
        $tc_theme                     = wp_get_theme();

        //Get infos from parent theme if using a child theme
        $tc_theme = $tc_theme -> parent() ? $tc_theme -> parent() : $tc_theme;

        $tc_base_data['prefix']       = $tc_base_data['title'] = $tc_theme -> name;
        $tc_base_data['version']      = $tc_theme -> version;
        $tc_base_data['authoruri']    = $tc_theme -> {'Author URI'};
      }

      // get themedata for lower versions (get_stylesheet_directory() points to the current theme root, child or parent)
      else {
           $tc_base_data                = call_user_func('get_' .'theme_data', get_stylesheet_directory().'/style.css' );
           $tc_base_data['prefix']      = $tc_base_data['title'];
      }

      self::$theme_name                 = sanitize_file_name( strtolower($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 of the parent theme
      if( ! defined( 'TC_BASE' ) )            define( 'TC_BASE' , get_template_directory().'/' );
      //TC_BASE_CHILD is the root server path of the child theme
      if( ! defined( 'TC_BASE_CHILD' ) )      define( 'TC_BASE_CHILD' , get_stylesheet_directory().'/' );
      //TC_BASE_URL http url of the loaded parent theme
      if( ! defined( 'TC_BASE_URL' ) )        define( 'TC_BASE_URL' , get_template_directory_uri() . '/' );
      //TC_BASE_URL_CHILD http url of the loaded child theme
      if( ! defined( 'TC_BASE_URL_CHILD' ) )  define( 'TC_BASE_URL_CHILD' , get_stylesheet_directory_uri() . '/' );
      //THEMENAME contains the Name of the currently loaded theme
      if( ! defined( 'THEMENAME' ) )          define( 'THEMENAME' , $tc_base_data['title'] );
      //TC_WEBSITE is the home website of Customizr
      if( ! defined( 'TC_WEBSITE' ) )         define( 'TC_WEBSITE' , $tc_base_data['authoruri'] );


      //this is the structure of the Customizr code : groups => ('path' , 'class_suffix')
      $this -> tc_core = apply_filters( 'tc_core',
        array(
            'fire'      =>   array(
              array('inc' , 'init'),//defines default values (layout, socials, default slider...) and theme supports (after_setup_theme)
              array('inc' , 'plugins_compat'),//handles various plugins compatibilty (Jetpack, Bbpress, Qtranslate, Woocommerce, The Event Calendar ...)
              array('inc' , 'utils_settings_map'),//customizer setting map
              array('inc' , 'utils'),//helpers used everywhere
              array('inc' , 'resources'),//loads front stylesheets (skins) and javascripts
              array('inc' , 'widgets'),//widget factory
              array('inc/admin' , 'admin_init'),//loads admin style and javascript ressources. Handles various pure admin actions (no customizer actions)
              array('inc/admin' , 'admin_page')//creates the welcome/help panel including changelog and system config
            ),
            'admin'     => array(
              array('inc/admin' , 'customize'),//loads customizer actions and resources
              array('inc/admin' , 'meta_boxes')//loads the meta boxes for pages, posts and attachment : slider and layout settings
            ),
            //the following files/classes define the action hooks for front end rendering : header, main content, footer
            'header'    =>   array(
              array('inc/parts' , 'header_main'),
              array('inc/parts' , 'menu'),
              array('inc/parts' , 'nav_walker')
            ),
            'content'   =>  array(
              array('inc/parts', '404'),
              array('inc/parts', 'attachment'),
              array('inc/parts', 'breadcrumb'),
              array('inc/parts', 'comments'),
              array('inc/parts', 'featured_pages'),
              array('inc/parts', 'gallery'),
              array('inc/parts', 'headings'),
              array('inc/parts', 'no_results'),
              array('inc/parts', 'page'),
              array('inc/parts', 'post_thumbnails'),
              array('inc/parts', 'post'),
              array('inc/parts', 'post_list'),
              array('inc/parts', 'post_list_grid'),
              array('inc/parts', 'post_metas'),
              array('inc/parts', 'post_navigation'),
              array('inc/parts', 'sidebar'),
              array('inc/parts', 'slider')
            ),
            'footer'    => array(
              array('inc/parts', 'footer_main'),
            ),
            'addons'    => apply_filters( 'tc_addons_classes' , array() )
        )//end of array
      );//end of filter



      //check the context
      if ( file_exists( sprintf( '%sinc/init-pro.php' , TC_BASE ) ) && 'customizr-pro' == self::$theme_name )
        require_once( sprintf( '%sinc/init-pro.php' , TC_BASE ) );

      self::$tc_option_group = 'tc_theme_options';

      //set files to load according to the context : admin / front / customize
      add_filter( 'tc_get_files_to_load' , array( $this , 'tc_set_files_to_load' ) );

      //theme class groups instanciation
      $this -> tc__();
    }//end of __construct()