The requested content cannot be loaded.
Please try again later.
The requested content cannot be loaded.
Please try again later.
- * echo News::Breadcrumbs();
- *
- *
- */
- public static function Breadcrumbs($item, $opt)
- {
- if ($item['parent'] != "")
- {
- $news = News::$news->select('[slug="'.$item['parent'].'"]', null);
- $item['parent_name'] = $news['name'];
- }
-
- // Display view
- return View::factory('news/views/frontend/breadcrumbs')
- ->assign('item', $item)
- ->assign('opt', $opt)
- ->render();
- }
-
- /**
- * Get News content by id
- * @author Pronin Andrey / KANekT
- *
- *
- * echo News::ContentById(1, true);
- *
- *
- * @return string
- */
- public static function ContentById($id, $short=false) {
- return News::getContentById($id, $short);
- }
-
- private static function getContentById($id, $short=false) {
- if($short) {
- $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.short.news.txt'));
- } else {
- $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.news.txt'));
- }
-
- return $content;
- }
-
- /**
- * Get tags
- * @author Romanenko Sergey / Awilum
- *
- *
- * echo News::Tags();
- *
- *
- * @return string
- */
- public static function Tags($slug = null) {
-
- // Display view
- return View::factory('news/views/frontend/tags')
- ->assign('tags', News::getTagsArray($slug))
- ->render();
-
- }
-
- /**
- * Get tags array
- * @author Romanenko Sergey / Awilum
- *
- * @return array
- */
- private static function getTagsArray($slug = null) {
-
- // Init vars
- $tags = array();
- $tags_string = '';
-
- if ($slug == null) {
- $posts = News::$news->select('[status="published"]', 'all');
- } else {
- $posts = News::$news->select('[status="published" and slug="'.$slug.'"]', 'all');
- }
-
- foreach($posts as $post) {
- $tags_string .= $post['tags'].',';
- }
-
- $tags_string = substr($tags_string, 0, strlen($tags_string)-1);
-
- // Explode tags in tags array
- $tags = explode(',', $tags_string);
-
- // Remove empty array elementss
- foreach ($tags as $key => $value) {
- if ($tags[$key] == '') {
- unset($tags[$key]);
- }
- }
-
- // Trim tags
- array_walk($tags, create_function('&$val', '$val = trim($val);'));
-
- // Get unique tags
- $tags = array_unique($tags);
-
- // Return tags
- return $tags;
- }
-
- /**
- * Get related news
- *
- *
- * echo News::Related();
- *
- *
- * @return string
- */
- public static function Related($limit = null) {
- News::$news = new Table('news');
-
- $uri = Uri::segments();
- if($uri[0] == 'news') {
- if (isset($uri[2]))
- {
- News::$slug = $uri[2];
- }
- if (isset($uri[1]))
- {
- News::$slug = $uri[1];
- }
- }
- return News::getRelated($limit);
- }
-
- /**
- * Get related posts
- * @author Romanenko Sergey / Awilum
- *
- * @return string
- */
- private static function getRelated($limit = null) {
-
- $related_posts = array();
- $tags = News::getTagsArray(News::$slug);
-
- foreach($tags as $tag) {
-
- $query = '[status="published" and contains(keywords, "'.$tag.'") and slug!="'.News::$slug.'"]';
-
- if ($result = Arr::subvalSort(News::$news->select($query, ($limit == null) ? 'all' : (int)$limit), 'date', 'DESC')) {
- $related_posts = $result;
- }
- }
-
- // Display view
- return View::factory('news/views/frontend/related')
- ->assign('related_posts', $related_posts)
- ->render();
-
- }
-
-
- /**
- * Get Children News
- *
- * @return string
- */
- public static function Children($slug)
- {
- $child = Arr::subvalSort(News::$news->select('[parent="'.$slug.'"]', 'all'), 'date', 'DESC');
-
- if ($child != null)
- {
- return View::factory('news/views/frontend/children')
- ->assign('items', $child)
- ->render();
- }
-
- return '';
- }
-
- public static function title(){
- return News::$meta['title'];
- }
-
- public static function keywords(){
- return News::$meta['keywords'];
- }
-
- public static function description(){
- return News::$meta['description'];
- }
-
- public static function content(){
- $content = Filter::apply('content', News::$template);
- return $content;
- }
-
- public static function template() {
- if (News::$_news['template'] == '') return Option::get('news_template'); else return News::$_news['template'];
- }
-
- private static function error404() {
- if (BACKEND == false) {
- News::$template = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . '1.page.txt'));
- News::$meta['title'] = 'error404';
- Response::status(404);
- }
- }
-
- private static function hits($id, $hits) {
- if (Session::exists('hits'.$id) == false) {
- $hits++;
- if(News::$news->updateWhere('[id='.$id.']', array('hits' => $hits))) {
- Session::set('hits'.$id, 1);
- }
- }
-
- return $hits;
- }
-
- /**
- * current page
- * pages all
- * site_url
- * limit pages
- */
- public static function paginator($current, $pages, $urls, $sections = 1, $limit_pages=10) {
-
- $content = '';
- if (is_array($urls))
- {
- $url = $urls[0];
- $req = $urls[1];
- }
- else{
- $url = $urls;
- $req = '';
- }
- if ($pages > 1) {
-
- // pages count > limit pages
- if ($pages > $limit_pages) {
- $start = ($current <= 6) ? 1 : $current-3;
- $finish = (($pages-$limit_pages) > $current) ? ($start + $limit_pages - 1) : $pages;
- } else {
- $start = 1;
- $finish = $pages;
- }
-
- // pages list
- $content .= '
+ * echo News::Breadcrumbs();
+ *
+ *
+ */
+ public static function Breadcrumbs($item, $opt)
+ {
+ if ($item['parent'] != "")
+ {
+ $news = News::$news->select('[slug="'.$item['parent'].'"]', null);
+ $item['parent_name'] = $news['name'];
+ }
+
+ // Display view
+ return View::factory('news/views/frontend/breadcrumbs')
+ ->assign('item', $item)
+ ->assign('opt', $opt)
+ ->render();
+ }
+
+ /**
+ * Get News content by id
+ * @author Pronin Andrey / KANekT
+ *
+ *
+ * echo News::ContentById(1, true);
+ *
+ *
+ * @return string
+ */
+ public static function ContentById($id, $short=false) {
+ return News::getContentById($id, $short);
+ }
+
+ private static function getContentById($id, $short=false) {
+ if($short) {
+ $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.short.news.txt'));
+ } else {
+ $content = Text::toHtml(File::getContent(STORAGE . DS . 'news' . DS . $id . '.news.txt'));
+ }
+
+ return $content;
+ }
+
+ /**
+ * Get tags
+ * @author Romanenko Sergey / Awilum
+ *
+ *
+ * echo News::Tags();
+ *
+ *
+ * @return string
+ */
+ public static function Tags($slug = null) {
+
+ // Display view
+ return View::factory('news/views/frontend/tags')
+ ->assign('tags', News::getTagsArray($slug))
+ ->render();
+
+ }
+
+ /**
+ * Get tags array
+ * @author Romanenko Sergey / Awilum
+ *
+ * @return array
+ */
+ private static function getTagsArray($slug = null) {
+
+ // Init vars
+ $tags = array();
+ $tags_string = '';
+
+ if ($slug == null) {
+ $posts = News::$news->select('[status="published"]', 'all');
+ } else {
+ $posts = News::$news->select('[status="published" and slug="'.$slug.'"]', 'all');
+ }
+
+ foreach($posts as $post) {
+ $tags_string .= $post['tags'].',';
+ }
+
+ $tags_string = substr($tags_string, 0, strlen($tags_string)-1);
+
+ // Explode tags in tags array
+ $tags = explode(',', $tags_string);
+
+ // Remove empty array elementss
+ foreach ($tags as $key => $value) {
+ if ($tags[$key] == '') {
+ unset($tags[$key]);
+ }
+ }
+
+ // Trim tags
+ array_walk($tags, create_function('&$val', '$val = trim($val);'));
+
+ // Get unique tags
+ $tags = array_unique($tags);
+
+ // Return tags
+ return $tags;
+ }
+
+ /**
+ * Get related news
+ *
+ *
+ * echo News::Related();
+ *
+ *
+ * @return string
+ */
+ public static function Related($limit = null) {
+ News::$news = new Table('news');
+
+ $uri = Uri::segments();
+ if($uri[0] == 'news') {
+ if (isset($uri[2]))
+ {
+ News::$slug = $uri[2];
+ }
+ if (isset($uri[1]))
+ {
+ News::$slug = $uri[1];
+ }
+ }
+ return News::getRelated($limit);
+ }
+
+ /**
+ * Get related posts
+ * @author Romanenko Sergey / Awilum
+ *
+ * @return string
+ */
+ private static function getRelated($limit = null) {
+
+ $related_posts = array();
+ $tags = News::getTagsArray(News::$slug);
+
+ foreach($tags as $tag) {
+
+ $query = '[status="published" and contains(keywords, "'.$tag.'") and slug!="'.News::$slug.'"]';
+
+ if ($result = Arr::subvalSort(News::$news->select($query, ($limit == null) ? 'all' : (int)$limit), 'date', 'DESC')) {
+ $related_posts = $result;
+ }
+ }
+
+ // Display view
+ return View::factory('news/views/frontend/related')
+ ->assign('related_posts', $related_posts)
+ ->render();
+
+ }
+
+
+ /**
+ * Get Children News
+ *
+ * @return string
+ */
+ public static function Children($slug)
+ {
+ $child = Arr::subvalSort(News::$news->select('[parent="'.$slug.'"]', 'all'), 'date', 'DESC');
+
+ if ($child != null)
+ {
+ return View::factory('news/views/frontend/children')
+ ->assign('items', $child)
+ ->render();
+ }
+
+ return '';
+ }
+
+ public static function title(){
+ return News::$meta['title'];
+ }
+
+ public static function keywords(){
+ return News::$meta['keywords'];
+ }
+
+ public static function description(){
+ return News::$meta['description'];
+ }
+
+ public static function content(){
+ $content = Filter::apply('content', News::$template);
+ return $content;
+ }
+
+ public static function template() {
+ if (News::$_news['template'] == '') return Option::get('news_template'); else return News::$_news['template'];
+ }
+
+ private static function error404() {
+ if (BACKEND == false) {
+ News::$template = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . '1.page.txt'));
+ News::$meta['title'] = 'error404';
+ Response::status(404);
+ }
+ }
+
+ private static function hits($id, $hits) {
+ if (Session::exists('hits'.$id) == false) {
+ $hits++;
+ if(News::$news->updateWhere('[id='.$id.']', array('hits' => $hits))) {
+ Session::set('hits'.$id, 1);
+ }
+ }
+
+ return $hits;
+ }
+
+ /**
+ * current page
+ * pages all
+ * site_url
+ * limit pages
+ */
+ public static function paginator($current, $pages, $urls, $sections = 1, $limit_pages=10) {
+
+ $content = '';
+ if (is_array($urls))
+ {
+ $url = $urls[0];
+ $req = $urls[1];
+ }
+ else{
+ $url = $urls;
+ $req = '';
+ }
+ if ($pages > 1) {
+
+ // pages count > limit pages
+ if ($pages > $limit_pages) {
+ $start = ($current <= 6) ? 1 : $current-3;
+ $finish = (($pages-$limit_pages) > $current) ? ($start + $limit_pages - 1) : $pages;
+ } else {
+ $start = 1;
+ $finish = $pages;
+ }
+
+ // pages list
+ $content .= '- | - | - | - | - | - | - - | -
- -'; - } else { - $dash = Html::arrow('right').' '; - } - ?> - | -- '_blank', 'rel' => 'children_'.$item['parent'])); - ?> - | -- - | -- - | -- - | -- - | -- - | -
+ | + | + | + | + | + | + + | +
+ -'; + } else { + $dash = Html::arrow('right').' '; + } + ?> + | ++ '_blank', 'rel' => 'children_'.$item['parent'])); + ?> + | ++ + | ++ + | ++ + | ++ + | ++ + | +