// define( "CurrentLanguage", 'en' ); // define( "CurrentDirection", 'ltr' ); class ThemeTree { private $args; private $_GET; private $_POST; function __construct($args=array()) { global $current_user; $this->args = $args; $this->Method = array( 'GETs'=>$_GET, 'POSTs'=>$_POST, ); $this->IntegrationsFolder = 'Integrations'; $this->TempPath = get_template_directory(); $this->TempURL = get_template_directory(); $this->StylesURL = get_template_directory_uri()."/{$this->IntegrationsFolder}/styles/"; $this->StylesPath = get_template_directory()."/{$this->IntegrationsFolder}/styles/"; $this->folderpath = $this->TempPath."/{$this->IntegrationsFolder}/Layrs/*/"; $this->LayrsPath = $this->TempPath."/{$this->IntegrationsFolder}/Layrs/"; $this->Packages = array_filter(glob($this->folderpath), 'is_dir'); if( !class_exists('ThemeStatic') ) { require($this->TempPath.'/syntax.php'); } } public function AddTaxonomy($id, $ptypes=array(), $name, $rewrite=false, $hierarchical=true) { $labels = array( 'name' => __($name, 'PtypeLocalize' , 'post type general name'), ); register_taxonomy( $id, $ptypes, array( 'hierarchical' => $hierarchical, 'rewrite' => $rewrite, 'labels' => $labels ) ); } public function AddPType($name, $singlename, $plus='', $id, $public=true, $rewrite=false, $supports=array(), $position='') { $labels = array( 'name' => __( $name, 'post type general name', 'MycimaLocalize' ), 'singular_name' => __( $name, 'post type singular name', 'MycimaLocalize' ), 'menu_name' => __( $name, 'admin menu', 'MycimaLocalize' ), 'name_admin_bar' => __( $name, 'add new on admin bar', 'MycimaLocalize' ), ); $args = array( 'labels' => $labels, 'public' => $public, 'rewrite' => $rewrite, 'supports' => $supports, ); if( is_numeric($position) ) { $args['menu_position'] = $position; } register_post_type( $id, $args ); } public function Require($path, $vars=array()) { extract($vars); if( file_exists($path) ) { require($path); }else { echo '
Path is NOT exists :'.$path.'
'; } } public function Initialize() { do_action('Initialize'); do_action('AfterInitialize'); } } $ThemeTree = new ThemeTree(); add_action('init', array($ThemeTree, 'Initialize')); $ThemeStatic = new ThemeStatic(); $Layrs = $ThemeTree->Packages; foreach ($Layrs as $pack) { if( substr(basename($pack), 0, 1) != '@' and substr(basename($pack), 0, 1) != '#' ) { $CurrentURL = str_replace(get_template_directory(), get_template_directory_uri(), $pack); $CurrentURL = str_replace('#', urlencode('#'), $CurrentURL); $path = $pack.'setup.php'; $ThemeTree->Require($path, array('CurrentDir'=>$pack, 'CurrentURL'=>$CurrentURL)); } } global $ThemeTree; $ThemeTree->TemplatePart('home'); ?>