private function getSeo() { $ReadSeo = new WsPosts(); switch ($this->File) { case 'artigo': $Admin = isset($_SESSION['userlogin']['user_level']) && $_SESSION['userlogin']['user_level'] == 3 ? true : false; $Check = $Admin ? '' : 'post_status = 1 AND '; $ReadSeo->setPost_name($this->Link); $ReadSeo->Query("WHERE {$Check} #post_name#"); if (!$ReadSeo->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->getResult()[0]); $this->seoData = (array) $ReadSeo->getResult()[0]; $this->Data = [$post_title . ' - ' . SITENAME, $post_content, HOME . "/artigo/{$post_name}", HOME . "/uploads/{$post_cover}"]; //post:: post_views $ReadSeo->setPost_id($post_id); $ReadSeo->setPost_views($post_views + 1); $ReadSeo->setPost_last_views(date('Y-m-d H:i:s')); $ReadSeo->update(); } break; case 'index': $this->Data = [SITENAME . ' - Seu Guia de empresas, eventos e baladas!', SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; default: $this->Data = ['404 Oppss, Nada encontrado!', SITEDESC, HOME . '/404', INCLUDE_PATH . '/images/site.png']; break; } if ($this->Data) { $this->setTags(); } }
private function Update() { $WsPosts = new WsPosts(); $this->Data['post_views'] = null; $this->Data['post_last_views'] = null; $this->Data['post_id'] = $this->Post; $this->Data['post_date'] = date('Y-m-d H:i:s'); $this->Data['post_cover'] = isset($this->Data['post_cover']) ? $this->Data['post_cover'] : null; $WsPosts->setThis((object) $this->Data); $result = $WsPosts->update(); $this->Message($this->Data['post_title'], "atualizado", true, $result); }