Advertisement
Guest User

load_theme_textdomain

a guest
Aug 21st, 2010
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. # functions.php
  2. <?php
  3. // Load the Webeo_Core class
  4. require_once TEMPLATEPATH . '/lib/webeo/Webeo_Core.class.php';
  5.  
  6. // Instantiate Webeo Themeframework
  7. add_action('after_setup_theme', create_function('', 'return Webeo_Core::getInstance()->init();'), 9);
  8. ?>
  9.  
  10.  
  11. # Webeo_Core.class.php
  12. <?php
  13. class Webeo_Core {
  14.  
  15.     // ...
  16.  
  17.     /**
  18.      * Constructor for singleton pattern
  19.      *
  20.      * @return void
  21.      */
  22.     private function __construct() {
  23.  
  24.     }
  25.    
  26.     /**
  27.      * Make clone private, so nobody can clone the instance
  28.      *
  29.      * @final
  30.      * @return void
  31.      */
  32.     final private function __clone() {
  33.  
  34.     }
  35.    
  36.     /**
  37.      * Get instance of Webeo_Core
  38.      * Singleton pattern
  39.      *
  40.      * @static
  41.      * @return Webeo_Core object
  42.      */
  43.     public static function getInstance() {
  44.         if (is_null(self::$_instance)) {
  45.             self::$_instance = new Webeo_Core();
  46.         }
  47.        
  48.         return self::$_instance;
  49.     }
  50.  
  51.     /**
  52.      * Initialize the framework
  53.      *
  54.      * @return void
  55.      */
  56.     public function init() {
  57.         if (self::$_initialized) {
  58.             return;
  59.         }
  60.  
  61.         // ...
  62.  
  63.         // FIXME
  64.         // Set namespace for this theme and define path to language files
  65.         $languages = ( is_dir( TEMPLATEPATH . '/languages' ) ) ? TEMPLATEPATH . '/languages' : TEMPLATEPATH;
  66.         load_theme_textdomain('webeo', $languages);
  67.  
  68.         // ...
  69.  
  70.         self::$_initialized = true;
  71.     }
  72. }
  73. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement