Пример #1
0
 public function onRun()
 {
     $this->addCss('/plugins/radiantweb/problog/assets/css/problog_post.css');
     $this->addJs('/plugins/radiantweb/problog/assets/google-code-prettify/prettify.js');
     $this->addJs('/plugins/radiantweb/problog/assets/google-code-prettify/run_prettify.js?skin=sunburst');
     $this->getPost();
     if (!is_null($this->post) && ($this->post->published < 1 && !$this->user())) {
         return \Response::make($this->controller->run('404'), 404);
     }
     if (!is_null($this->post) && !$this->render_category) {
         /* set up metas for this post */
         $this->page['post_item'] = $this->post;
         $this->page->title = $this->post->meta_title ? $this->post->meta_title : $this->post->title;
         $this->page->meta_description = $this->post->meta_description ? $this->post->meta_description : $this->post->excerpt;
         $this->page->meta_keywords = $this->post->meta_keywords;
         $this->page['categories'] = $this->categories = CategoryModel::get();
         if ($this->post) {
             $this->page['author'] = $this->getAuthor($this->post->user_id);
         }
         $this->page['parentPage'] = $this->post->parent;
         $this->page['searchpage'] = $this->property('searchpage');
         $this->page['back'] = Request::header('referer');
         $this->page['url'] = Request::url();
         $settings = ProblogSettingsModel::instance();
         $this->page['sharethis'] = $settings->get('sharethis');
         $this->page['facebook'] = $settings->get('facebook');
         $this->page['twitter'] = $settings->get('twitter');
         $this->page['google'] = $settings->get('google');
         $this->page['embedly'] = $settings->get('embedly');
         if ($this->page['embedly']) {
             $this->addJs('/plugins/radiantweb/problog/assets/js/jquery.embedly.js');
             $this->addJs('/plugins/radiantweb/problog/assets/js/embedly.js');
         }
     }
 }
 public function getCategories()
 {
     return CategoryModel::get();
 }