コード例 #1
0
ファイル: c_global.php プロジェクト: Rabotyahoff/xml_engine
 function __construct($engine_root, $site_root)
 {
     $this->engine_root = $engine_root;
     $this->site_root = $site_root;
     $this->themes_site_root = $this->site_root . 'themes/';
     $this->cache_site_root = $this->site_root . '_cache/';
     $this->themes_engine_root = $this->engine_root . 'themes/';
     $xml_text = '';
     $xml_text = file_get_contents($this->site_root . '_settings.xml');
     $this->o_settings = new c_xml($xml_text);
     $this->settings_array = $this->o_settings->toArray();
     //print_r($this->settings_array);die;
     $this->site_name = $this->settings_array['site']['name']['.'];
     $this->site_root_url = $this->settings_array['site']['root_url']['.'];
     $this->engine_root_url = $this->settings_array['engine']['root_url']['.'];
     $this->res_site_url = $this->site_root_url . 'res/';
     $this->res_engine_url = $this->engine_root_url . 'res/';
     $this->res_site_root = $this->site_root . 'res/';
     $this->res_engine_root = $this->engine_root . 'res/';
     /*Begin загрузка структуры сайта*/
     $xml_text = file_get_contents($this->site_root . '_site/_main.xml');
     //основная часть сайта
     $this->o_site = new c_xml($xml_text);
     /*Begin добавление в структуру сайта информации из плагинов*/
     //подгружаются только item'ы
     $no_file = array('.', '..', '_main.xml');
     $d = dir($this->site_root . '_site');
     while (false !== ($entry = $d->read())) {
         if (!in_array($entry, $no_file) && strtolower(substr($entry, -4)) == '.xml') {
             $xml_text = file_get_contents($this->site_root . '_site/' . $entry);
             $this->o_site->addItemsFromXML(new c_xml($xml_text), true);
         }
     }
     $d->close();
     /*End добавление в структуру сайта информации из плагинов*/
     //$this->site_array=$this->o_site->toArray();// создаётся в check_site_rights()
     //print_r($this->o_site->toArray());die;
     /*End загрузка структуры сайта*/
     global $o_params;
     $this->o_params = new c_params(true);
     $o_params = $this->o_params;
     $this->url_params = explode('/', $this->o_params->get_any_param('page'));
     $this->current_url = $this->site_root_url . implode('/', $this->url_params);
     $this->is_ajax = $_REQUEST['ajax'] == 1;
 }