public function DisplayWordpressPost()
 {
     Phalanx::loadController('LoginController');
     $loginController = new LoginController();
     $this->isLoggedIn = $loginController->isLoggedIn();
     Phalanx::loadClasses('public.Posts', 'public.PostComments');
     $post = Posts::GetWPPostData($this->get->post_id, $this->session->user->id, true);
     $slug = mb_strtolower(preg_replace('/--+/u', '-', preg_replace('/[^\\w\\-]+/u', '-', $post->content->post_title)));
     if ($slug != $this->get->slug) {
         Request::redirect_301(HOST . "site/post/{$this->get->post_id}-{$slug}");
     }
     $v = new Views();
     $v->title = $post->content->post_title;
     $v->content = $post->content->post_content;
     $v->comments = $post->comments;
     $v->comments_array = PostComments::get($post->post_id);
     $v->replies = $post->replies;
     $v->post_id = $post->post_id;
     $v->rating = $post->rating;
     $v->when = Date::RelativeTime($post->content->post_date);
     $v->my_rating = $p->my_rating;
     $v->current_user = $this->session->user->login;
     $v->is_favorite = $p->is_favorite;
     $content = $v->render("post_body_wp.phtml");
     $template = new Template("default");
     $template->og = new stdClass();
     $template->og->title = $v->title;
     $template->og->description = substr(strip_tags($content), 0, 250);
     //$template->og->img = MEDIA_DIR . 'images/avatar/big/' . $profile_data->aditional_info->avatar;
     if (!$this->isLoggedIn) {
         $template->show_login_bar = true;
     }
     $v = new Views($template);
     $v->data = new stdClass();
     $v->data->post = $content;
     $v->display("single_post_display.phtml");
 }
Example #2
0
 public function DisplayProfileFromShortURL()
 {
     Request::redirect_301(HOST . 'perfil/' . $this->get->username);
 }