Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Page has a deprecated constructor in /hermes/bosnacweb04/bosnacweb04ad/b684/ipg.voxicaca/php/version_voxica/Class_ObjectPage.php on line 7

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Template has a deprecated constructor in /hermes/bosnacweb04/bosnacweb04ad/b684/ipg.voxicaca/php/version_voxica/Class_Template.php on line 2

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; BaseObject has a deprecated constructor in /hermes/bosnacweb04/bosnacweb04ad/b684/ipg.voxicaca/php/version_voxica/Class_BaseObject.php on line 3
LoadMap2(); } function LoadMap() { // $this->LoadJSON(dirname(__FILE__).'/images.json'); $a = parse_ini_file(dirname(__FILE__).'/images.ini'); foreach($a as $k=>$v) { $this->Options[$k] = $v; } } function LoadMap2() { $dir = dirname(__FILE__).'/../voxica/images/'; if(!file_exists($dir)) return; $files = scandir($dir, 0) or die('No Such Dir'); $a = null; foreach($files as $k=>$v) { if($v == '.' || $v == '..') continue; if(is_dir($dir.$v)) continue; //echo '@#'.$v; $ext = pathinfo($dir.$v, PATHINFO_EXTENSION); if($ext != 'jpg') continue; $this->Options[intval($v)] = ''.str_replace('.jpg', '', $v).''; } return $a; } } ?>Images = new ImageMap(); $this->Options['web'] = 'https://www.voxica.ca'; } function Run() { } function RunCatalogItem() { $topic = ''; if($this->Item == 'index') $this->RunMainPage(); else if($this->Item == 'feedback') { $topic = $this->CompileFeedbackTopics(dirname(__FILE__).'/topics/'); } else { $topic = $this->CompileTopics(dirname(__FILE__).'/topics/'); } $this->Options['page_topics'] = $topic; } function RunTopic() { // Здесь мы создаем по шаблону страницу топика одного //$topic = new Template('topic_item'); //$topic = $this->RetriveTopic(); //$this->Options['page_topics'] = '

Page '.$this->Item.' is under Construction! )))

@'.$topic; // Раздел смотрите также $this->SetHits(); $this->Options['page_topics'] = $this->RetriveTopic(); $this->RunTemplate('page'); } function RetriveTopic() { $this->UpdateTopicsList(); $topic_file = $this->DataSet[strtolower($this->Item)]; if($topic_file) return $this->LoadTopicFromFile($topic_file, 'topic_item'); //$this->Active = true; } function LoadTopicFromFile($topic_file, $topic_template) { if(!$topic_file) return ''; $obj = $this->LoadJSON($topic_file); $t = new Template($topic_template); $this->Options['title'] = $obj['title']; $b['header'] = $obj['title']; $b['date'] = $obj['date']; $s = $this->CompileInsideTemplate($this->LoadFile(str_replace('.json','_anno.txt', $topic_file))); if(strlen($s) > 300) $s = mb_substr($s, 0, 300, 'utf8'); $b['anno'] = trim($s).'...'; $b['text'] = $this->CompileInsideTemplate($this->LoadFile(str_replace('.json','_topic.txt', $topic_file))); $link = $this->TranslitIt($this->UriCompress($b['header'])); $b['link'] = 'читать далее'; $b['hlink'] = ''.$obj['title'].''; $b['htext'] = ''.$b['anno'].''; $b['hit_1'] = $this->Values['hit_1']; $b['hit_2'] = $this->Values['hit_2']; $b['hit_3'] = $this->Values['hit_3']; $t->Process($b); return $t->Text; } function SetHits() { if(!$this->DataSet) $this->UpdateTopicsList(); if(!$this->DataSet) return; $imax = count($this->DataSet); $a = array_values($this->DataSet); for($i = 0; $i < 3; $i++) { $r = rand(0, $imax-1); $topic_file = $a[$r]; $this->Values['hit_'.($i+1)] = $this->LoadTopicFromFile($topic_file, 'topic_hit'); } } function UpdateTopicsList() { // Здесь мы восстанавливаем по названию страницу топика $filename = dirname(__FILE__).'/topics_data.txt'; if(file_exists($filename)) { $handle = fopen($filename , "r+" ) or die ( "Не удалось открыть файл" ); $contents = fread($handle, filesize($filename)); fclose($handle); $this->DataSet = unserialize($contents); } else { $this->DataSet = $this->CompileMap(dirname(__FILE__).'/topics/'); $handle = fopen($filename , "w+" ) or die ( "Не удалось открыть файл" ); fputs($handle, serialize($this->DataSet)); fclose($handle); } } function CompileMap($dir) { $files = scandir($dir, 0); $a = null; $b = ''; foreach($files as $k=>$v) { if($v == '.' || $v == '..') continue; if(is_dir($dir.$v)) continue; $ext = pathinfo($dir.$v, PATHINFO_EXTENSION); if($ext != 'json') continue; $obj = $this->LoadJSON($dir.$v); $uri = $obj['title']; $b .= $v.'-'.$uri.'-'; $uri = $this->TranslitIt($uri); $uri = $this->UriCompress($uri); $uri = strtolower($uri); $b .= $uri."\r\n"; $a[$uri] = $dir.$v; } $this->SaveFile('log.txt', $b); return $a; } function CompileTopics($dir) { $t = new Template(''); if($this->TopicList) { $a = $this->JSONValues; if($a) foreach($a as $k=>$v) { if(!array_key_exists(str_replace('@','', $k), $this->TopicList)) { $file = dirname(__FILE__).'/'.$v; $obj = $this->LoadJSON($file); if($obj['active'] == 'false') continue; $t->SetTemplate('topic_list_template'); $b['header'] = $obj['title']; $b['date'] = $obj['date']; $s = $this->LoadFile(str_replace('.json','_anno.txt',dirname(__FILE__).'/'.$v)); $b['anno'] = $s; // $b['image'] = $this->Images->Options[intval($b)]; $b['link'] = 'читать далее'; $b['header'] = ''.$obj['title'].''; $t->Process($b); //$r .= $obj['title'].'
'; $r .= $t->Text.'
'; } } return $r; } //$t = new Template(''); $r = ''; $files = scandir($dir, 0); foreach($files as $k=>$v) { if($v == '.' || $v == '..') continue; if(is_dir($dir.$v)) continue; $obj = $this->LoadJSON($dir.$v); //$obj = json_decode($a, true); $this->Values = $obj; $t->SetTemplate('topic_list_template'); if($this->Values['active'] == 'false') continue; $this->Values['text'] = $this->CompileInsideTemplate($this->Values['text']); $t->Process($this->Values); $r .= $t->Text; //echo $k.'='.$obj.'
'; } return $r; } function CompileFeedbackTopics($dir) { $t = new Template(''); if($this->TopicList) { $a = $this->JSONValues; if($a) foreach($a as $k=>$v) { if(!array_key_exists(str_replace('@','', $k), $this->TopicList)) { $c = $this->LoadFile(dirname(__FILE__).'/'.$v); $r .= '

'.$c.'


'; continue; $file = dirname(__FILE__).'/'.$v; $obj = $this->LoadJSON($file); if($obj['active'] == 'false') continue; $t->SetTemplate('topic_list_template'); $b['header'] = $obj['title']; $b['date'] = $obj['date']; $b['anno'] = $this->LoadFile(str_replace('.json','_anno.txt',dirname(__FILE__).'/'.$v)); $b['link'] = 'читать далее'; $t->Process($b); //$r .= $obj['title'].'
'; $r .= $t->Text.'
'; } } return $r; } //$t = new Template(''); $r = ''; $files = scandir($dir, 0); foreach($files as $k=>$v) { if($v == '.' || $v == '..') continue; if(is_dir($dir.$v)) continue; $obj = $this->LoadJSON($dir.$v); //$obj = json_decode($a, true); $this->Values = $obj; $t->SetTemplate('topic_list_template'); if($this->Values['active'] == 'false') continue; $this->Values['text'] = $this->CompileInsideTemplate($this->Values['text']); $t->Process($this->Values); $r .= $t->Text; //echo $k.'='.$obj.'
'; } return $r; } function CompileInsideTemplate($code) { $r = ''; $t2 = new Template(''); $t2->SetTemplateCode($code); $t2->Process($this->Images->Options); $r = $t2->Text; unset($t2); return $r; } function RunMainPage() { // Заполняем Главную страницу $t = new Template('topics'); $a['micro'] = "12345"; $t->Process($a); $this->Options['topics'] = $t->Text; } function GetFileList() { // Get List of Files inside Dircetory $files = scandir(dirname(__FILE__).'/topics/', 1); } function RunTemplate($template) { $t = new Template($template); $t->GetKeys(); $a = $t->Keys; if($a) foreach($a as $k=>$v) { if(strpos($v, '_link') >= 1) { // Здесь обрабатывем ссылки вида {microzaim_link} превратится в Данные из файла microzaim.json $this->Values[$v] = $this->RunLink($v); continue; } $this->Values[$v] = $this->RunInnerTemplate($v); } foreach($this->Options as $k=>$v) { $this->Values[$k] = $this->Options[$k]; } $t->Process($this->Values); if($t->Text) $this->Text = $t->Text;//$t->Text; else $this->Text .= ' - '.$this->Item.' #Template '.$template; } function RunInnerTemplate($template) { $t = new Template($template); $t->GetKeys(); $a = $t->Keys; if($a) foreach($a as $k=>$v) { if(strpos($v, '_link') >= 1) { // Здесь обрабатывем ссылки вида {microzaim_link} превратится в Данные из файла microzaim.json $this->Options[$v] = $this->RunLink($v); continue; } //$this->Values[$v] = $this->RunInnerTemplate($v); } $t->Process($this->Options); return $t->Text; } function RunLink($link) { // проверяем наличие файла-меню для раздела $dir = dirname(__FILE__).'/tree/'; $item = str_replace('_link', '', $link); $file = $dir.$item.'.json'; if(file_exists($file)) { $obj = $this->LoadJSON($file); $s = ''.$obj['@title'].''; return $s; } } function UriCompress($str) { $tr = array( ". "=>"_", " "=>"_","\""=>"_","?"=>"","#"=>"_", "-"=>"", "."=>"","!"=>"","@"=>"_", """=>"" ); return strtr($str,$tr); } function TranslitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"Zh","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"C","Ч"=>"Ch", "Ш"=>"Sh","Щ"=>"Sch","Ъ"=>"","Ы"=>"Yi","Ь"=>"", "Э"=>"E","Ю"=>"U","Я"=>"Ya","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"y", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"u","я"=>"ya" ); return strtr($str,$tr); } function CheckMap($page) { /* Функции проверяет список материалов на сайте (статьи отзывы) и следит за давностью. Если материал устарел, переписывает сам файл на сайте и обновляет дату. Page - manages template for each topic page */ } }?>index@index0-0
10.619 ms