PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
<?php class CMS_Rewrite { public $rewritereplace = array( '([0-9]{4})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([0-9]{1,2})', '([^/]+)', '([0-9]+)', '([^/]+)', '([^/]+?)', '(.+)', ); public $queryreplace = array( 'year', 'month', 'day', 'hour', 'minute', 'second', 'name', 'p', 'author_name', 'pagename', 's', ); public $rewritecode = array( '%year%', '%month%', '%day%', '%hour%', '%minute%', '%second%', '%name%', '%id%', '%author%', '%pagename%', '%search%', ); public $permanent_links = array( 'default' => '?id=%id%', 'date' => '%year%/%month%/%day%/%name%', 'month' => '%year%/%month%/%name%', 'numeric' => 'archives/%id%', 'name' => '/%name%', // 'custom'=>(Configuration::get('BLOG_PERMANENT_LINK_CUSTOM')) ); public function preg_index($i) { return '{'.$i.'}'; } public function _generate_rewrite_rule($permanent_struct, $rewritecode, $queryreplace, $rewritereplace) { $struct = trim($permanent_struct, '/'); $struct = '/'.$struct.'/'; preg_match_all('/%.+?%/', $struct, $tokens); $num_tokens = count($tokens[0]); $pattern = $query_token = str_replace($rewritecode, $rewritereplace, $permanent_struct); $replacement = ''; for ($i = 0; $i < $num_tokens; ++$i) { $replacement .= '/'.str_replace($rewritecode, $queryreplace, $tokens[0][$i]).'/'.$this->preg_index($i + 1); } return array('replacement' => $replacement, 'pattern' => $pattern); } public function generate_rewrite_rule($permanent_struct) { return $this->_generate_rewrite_rule($permanent_struct, $this->rewritecode, $this->queryreplace, $this->rewritereplace); } public function getRequestPrefix() { return Yii::app()->cms->getRequestPrefix(); } public function getPage() { return Yii::app()->cms->getBlogPage(); } public function getDetailPage() { return Yii::app()->cms->getBlogDetailPage(); } public function getPermanentLink() { return Configuration::get('BLOG_PERMANENT_LINK'); } public function getCustomPermanentLink() { return Configuration::get('BLOG_PERMANENT_LINK_CUSTOM'); } public function __construct() { $this->permanent_links['custom'] = $this->getCustomPermanentLink(); for ($i = 0; $i < sizeof($this->queryreplace); ++$i) { //$this->queryreplace[$i] = $this->getRequestPrefix().$this->queryreplace[$i]; } $permanent_link = $this->getPermanentLink(); $blog_link_struct = ''; if (!isset($this->permanent_links[$permanent_link])) { $blog_link_struct = $this->permanent_links['default']; } else { $blog_link_struct = $this->permanent_links[$permanent_link]; } $this->permalink_structure = $blog_link_struct; } public function getRule() { return $this->generate_rewrite_rule($this->permalink_structure); } protected function _createURL($page, $permanent_struct, $params) { $rewritecode = array(); $rewritereplace = array(); foreach ($params as $key => $value) { $rewritecode[] = '%'.$key.'%'; $rewritereplace[] = $value; } $url = str_replace($rewritecode, $rewritereplace, $permanent_struct); $url = trim($url, '/'); return Yii::app()->url->createPageURL($page.'/'.$url); } public function createPermanentUrl($term, $params) { $fname = 'get_'.$term.'_permastruct'; $permanent_struct = ''; if (method_exists($this, $fname)) { $permanent_struct = $this->$fname(); } return $this->_createURL($this->getPage(), $permanent_struct, $params); } public function createUrl($id) { $news = SqlliteNews::model()->findByPk($id); $date_added = strtotime($news->date_added); $date = explode(' ', date('Y m d H i s', $date_added)); $params = array( 'year' => $date[0], 'month' => $date[1], 'day' => $date[2], 'hour' => $date[3], 'minute' => $date[4], 'second' => $date[5], 'name' => $news->unique_name, 'id' => $news->id, 'author' => $news->author_id, 'pagename' => $news->unique_name, 'search' => $news->unique_name, ); return $this->_createURL($this->getDetailPage(), $this->permalink_structure, $params); } public function get_search_permastruct() { if (isset($this->search_structure)) { return $this->search_structure; } if (!isset($this->search_base)) { $this->search_base = 'search'; } if (empty($this->permalink_structure)) { $this->search_structure = ''; return false; } $this->search_structure = $this->search_base.'/%search%'; return $this->search_structure; } public function get_tag_permastruct() { if (isset($this->tag_structure)) { return $this->tag_structure; } if (empty($this->permalink_structure)) { $this->tag_structure = ''; return false; } if (!isset($this->tag_base)) { $this->tag_base = 'tags'; } $this->tag_structure = $this->tag_base.'/%tag%'; return $this->tag_structure; } public function get_category_permastruct() { if (isset($this->category_structure)) { return $this->category_structure; } if (empty($this->permalink_structure)) { $this->category_structure = ''; return false; } if (!isset($this->category_base)) { $this->category_base = 'category'; } $this->category_structure = $this->category_base.'/%category%'; return $this->category_structure; } public function get_date_permastruct() { if (isset($this->date_structure)) { return $this->date_structure; } if (empty($this->permalink_structure)) { $this->date_structure = ''; return false; } // The date permalink must have year, month, and day separated by slashes. $endians = array('%year%/%month%/%day%', '%day%/%month%/%year%', '%month%/%day%/%year%'); $this->date_structure = ''; $date_endian = ''; foreach ($endians as $endian) { if (false !== strpos($this->permalink_structure, $endian)) { $date_endian = $endian; break; } } if (empty($date_endian)) { $date_endian = '%year%/%month%/%day%'; } // Do not allow the date tags and %post_id% to overlap in the permalink // structure. If they do, move the date tags to $front/date/. $front = ''; preg_match_all('/%.+?%/', $this->permalink_structure, $tokens); $tok_index = 1; foreach ((array) $tokens[0] as $token) { if ('%id%' == $token && ($tok_index <= 3)) { $front = $front.'date/'; break; } ++$tok_index; } $this->date_structure = $front.$date_endian; return $this->date_structure; } public function get_year_permastruct() { $structure = $this->get_date_permastruct(); if (empty($structure)) { return false; } $structure = str_replace('%month%', '', $structure); $structure = str_replace('%day%', '', $structure); $structure = preg_replace('#/+#', '/', $structure); return $structure; } public function get_month_permastruct() { $structure = $this->get_date_permastruct(); if (empty($structure)) { return false; } $structure = str_replace('%day%', '', $structure); $structure = preg_replace('#/+#', '/', $structure); return $structure; } public function get_day_permastruct() { return $this->get_date_permastruct(); } }
[+]
..
[+]
php-jwt
[-] Blowfish.php
[edit]
[+]
socialEmbed
[+]
mailchimp
[+]
swiftMailer
[-] CMS_Rewrite.php
[edit]
[+]
hosting
[-] general.php
[edit]
[-] ScreenShot.php
[edit]
[-] UrlManager.php
[edit]
[+]
payments
[-] Configuration.php
[edit]
[+]
twig-renderer-master
[-] Functions.php
[edit]
[+]
twig
[+]
addons
[+]
hoauth
[-] package.xml
[edit]
[-] PController.php
[edit]
[-] ETwigViewRenderer.php
[edit]
[+]
htmlpurifier
[-] Randomness.php
[edit]
[-] CSSParser.php
[edit]
[-] Mail.php
[edit]
[-] Rijndael.php
[edit]
[+]
components
[+]
rss
[-] WebApplication.php
[edit]
[-] passwordhash.php
[edit]
[-] DLDatabaseHelper.php
[edit]
[+]
Exceptions