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(); } }
/** * <b>Contagem de Views:</b> Realiza uma contagem ao post informado. * @param INT $post_id */ public static function ContPostViews($post_id) { $WsPosts = new WsPosts(); $WsPosts->setPost_id($post_id); extract((array) $WsPosts->Execute()->find()); $WsPosts->setPost_views($post_views + 1); $WsPosts->setPost_last_views(date('Y-m-d H:i:s')); $WsPosts->Execute()->update($WsPosts->Execute()->getDados(), 'post_id'); return $post_url; }
<?php $Read = new WsPosts(); $category_id = Check::CatByName("convenios"); switch ($method) { case "GET": //retorna todos os itens if (isset($id)) { $Read->setPost_id($id); $Read->setPost_status('1'); $Read->Execute()->find(); Check::JsonReturn($Read->Execute()->getResult(), 'Convênio não encontrado!', '404'); } else { $Read->Execute()->Query("post_status = 1 AND (post_category = :cat OR post_cat_parent = :cat) ORDER BY post_title DESC", "cat={$category_id}"); Check::JsonReturn($Read->Execute()->getResult(), 'Nenhuma convênio cadastrada!', '204'); } break; case "POST": if (!empty($request->post_id)) { //update $Read->setThis($request); $Read->Execute()->update(NULL, 'post_id'); echo json_encode($request); } else { //salvar $Read->setThis($request); $insert = $Read->Execute()->insert(); if ($insert) { $request->post_id = (int) $Read->Execute()->MaxFild("post_id"); } echo json_encode($request);
private function UpdateImage() { if (is_array($this->Data['post_cover'])) { $WsPosts = new WsPosts(); $WsPosts->setPost_id($this->Post); $WsPosts->Execute()->find(); $this->deletaImagem('../uploads/' . $WsPosts->Execute()->getResult()->post_cover); $upload = new Upload(); $upload->Image($this->Data['post_cover'], $this->Data['post_name']); } if (isset($upload) && $upload->getResult()) { $this->Data['post_cover'] = $upload->getResult(); $this->Update(); } else { unset($this->Data['post_cover']); if (!empty($upload) && $upload->getError()) { WSErro("<b>ERRO AO ENVIAR CAPA: </b>" . $upload->getError(), E_USER_WARNING); } $this->Update(); } }
unset($post['SendPostForm']); require_once '_models/AdminPost.class.php'; $cadastra = new AdminPost(); $cadastra->ExeUpdate($postid, $post); WSErro($cadastra->getError()[0], $cadastra->getError()[1]); if (!empty($_FILES['gallery_covers']['tmp_name'])) { $sendGallery = new AdminPost(); $sendGallery->gbSend($_FILES['gallery_covers'], $postid); } if (!empty($_FILES['files']['tmp_name'])) { $sendFiles = new AdminPost(); $sendFiles->flSend($_FILES['files'], $postid); } } else { $WsPosts = new WsPosts(); $WsPosts->setPost_id($postid); $WsPosts->Execute()->find(); if (!$WsPosts->Execute()->getResult()) { header('Location: painel.php?exe=posts/index&empty=true'); } else { $post = (array) $WsPosts->Execute()->getResult(); $post['post_date'] = date('d/m/Y H:i:s', strtotime($post['post_date'])); } } if (!empty($_SESSION['errCapa'])) { WSErro($_SESSION['errCapa'], E_USER_WARNING); unset($_SESSION['errCapa']); } $checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN); if ($checkCreate && empty($cadastra)) { WSErro("O post <b>{$post['post_title']}</b> foi cadastrado com sucesso no sistema!", WS_ACCEPT);
private function getSeo() { switch ($this->File) { //SEO:: ARTIGO case 'artigo': $Admin = isset($_SESSION['userlogin']['user_level']) && $_SESSION['userlogin']['user_level'] == 3 ? true : false; $Check = $Admin ? '' : 'post_status = 1 AND '; $ReadSeo = new WsPosts(); $ReadSeo->setPost_name($this->Link); $ReadSeo->Execute()->Query("{$Check} #post_name#"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->Execute()->getResult()[0]); $this->seoData = (array) $ReadSeo->Execute()->getResult()[0]; $this->Data = [$post_title . ' - ' . SITENAME, $post_content, HOME . "/artigo/{$post_name}", HOME . "/uploads/{$post_cover}"]; //post:: conta viws do post $ReadSeo->setPost_id($post_id); $ReadSeo->setPost_views($post_views + 1); $ReadSeo->setPost_last_views(date('Y-m-d H:i:s')); $ReadSeo->Execute()->update($ReadSeo->Execute()->getDados(), 'post_id'); } break; //SEO:: CATEGORIA //SEO:: CATEGORIA case 'categoria': $ReadSeo = new WsCategories(); $ReadSeo->setCategory_name($this->Link); $ReadSeo->Execute()->Query("#category_name#"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->Execute()->getResult()[0]); $this->seoData = (array) $ReadSeo->Execute()->getResult()[0]; $this->Data = [$category_title . ' - ' . SITENAME, $category_content, HOME . "/categoria/{$category_name}", INCLUDE_PATH . '/images/site.png']; //categories:: conta views da categoria $ReadSeo->setCategory_id($category_id); $ReadSeo->setCategory_views($category_views + 1); $ReadSeo->setCategory_last_view(date('Y-m-d H:i:s')); $ReadSeo->Execute()->update($ReadSeo->Execute()->getDados(), 'category_id'); } break; //SEO::PESQUISA //SEO::PESQUISA case 'pesquisa': $ReadSeo = new WsPosts(); $ReadSeo->Execute()->Query("post_status = 1 AND (post_title LIKE '%' :link '%' OR post_content LIKE '%' :link '%')", "link={$this->Link}"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { $this->seoData['count'] = $ReadSeo->Execute()->getRowCount(); $this->Data = ["Pesquisa por: \"{$this->Link}\"" . ' - ' . SITENAME, "Sua pesquisa por {$this->Link} retornou {$this->seoData['count']} resultados!", HOME . "/pesquisa/{$this->Link}", INCLUDE_PATH . '/images/site.png']; } break; //SEO:: EMPRESAS //SEO:: EMPRESAS case 'empresas': $Name = ucwords(str_replace("-", " ", $this->Link)); $this->seoData = ['empresa_link' => $this->Link, 'empresa_cat' => $Name]; $this->Data = ["Empresas {$this->Link}" . SITENAME, "Confira o guia completo de sua cidade, e encontra empresas {$this->Link}", HOME . '/empresas/' . $this->Link, INCLUDE_PATH . '/images/site.png']; break; //SEO:: EMPRESA SINGLE //SEO:: EMPRESA SINGLE case 'empresa': $Admin = isset($_SESSION['userlogin']['user_level']) && $_SESSION['userlogin']['user_level'] == 3 ? true : false; $Check = $Admin ? '' : 'empresa_status = 1 AND '; $ReadSeo = new AppEmpresas(); $ReadSeo->setEmpresa_name($this->Link); $ReadSeo->Execute()->Query("{$Check} #empresa_name#"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->Execute()->getResult()[0]); $this->seoData = (array) $ReadSeo->Execute()->getResult()[0]; $this->Data = [$empresa_title . ' - ' . SITENAME, $empresa_sobre, HOME . "/empresa/{$empresa_name}", HOME . "/uploads/{$empresa_capa}"]; //empresa:: conta views da empresa $ReadSeo->setEmpresa_id($empresa_id); $ReadSeo->setEmpresa_views($empresa_views + 1); $ReadSeo->setEmpresa_last_view(date('Y-m-d H:i:s')); $ReadSeo->Execute()->update($ReadSeo->Execute()->getDados(), 'empresa_id'); } break; //SEO:: CADASTRA EMPRESA //SEO:: CADASTRA EMPRESA case 'cadastra-empresa': $this->Data = ["Cadastre sua Empresa - " . SITENAME, "Página modelo para cadastro de empresas via Front-End do curso Work Series - PHP Orientado a Objetos!", HOME . '/cadastra-empresa/' . $this->Link, INCLUDE_PATH . '/images/site.png']; break; //SEO:: INDEX //SEO:: INDEX case 'index': $this->Data = [SITENAME . ' - Seu Guia de empresas, eventos e baladas!', SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; //SEO:: 404 //SEO:: 404 default: $this->Data = ['404 Oppss, Nada encontrado!', SITEDESC, HOME . '/404', INCLUDE_PATH . '/images/site.png']; break; } if ($this->Data) { $this->setTags(); } }
private function getSeo() { switch ($this->File) { //SEO:: ARTIGO case 'artigo': $Admin = isset($_SESSION['userlogin']['user_level']) && $_SESSION['userlogin']['user_level'] == 3 ? true : false; $Check = $Admin ? '' : 'post_status = 1 AND '; $ReadSeo = new WsPosts(); $ReadSeo->setPost_name($this->Link); $ReadSeo->Execute()->Query("{$Check} #post_name#"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->Execute()->getResult()[0]); $this->seoData = (array) $ReadSeo->Execute()->getResult()[0]; $this->Data = [$post_title . ' - ' . SITENAME, $post_content, HOME . "/artigo/{$post_name}", HOME . "/uploads/{$post_cover}"]; //post:: conta viws do post $ReadSeo->setPost_id($post_id); $ReadSeo->setPost_views($post_views + 1); $ReadSeo->setPost_last_views(date('Y-m-d H:i:s')); $ReadSeo->Execute()->update($ReadSeo->Execute()->getDados(), 'post_id'); } break; //SEO:: NOTICIAS //SEO:: NOTICIAS case 'noticias': $ReadSeo = new WsPosts(); $ReadSeo->setPost_type($this->Link); $ReadSeo->Execute()->Query("#post_type#"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->Execute()->getResult()[0]); $this->seoData = (array) $ReadSeo->Execute()->getResult(); $this->Data = [$post_type . ' - ' . SITENAME, $post_content, HOME . "/noticias/{$post_type}", INCLUDE_PATH . '/images/site.png']; } break; //SEO:: CATEGORIA //SEO:: CATEGORIA case 'categoria': $ReadSeo = new WsCategories(); $ReadSeo->setCategory_name($this->Link); $ReadSeo->Execute()->Query("#category_name#"); if (!$ReadSeo->Execute()->getResult()) { $this->seoData = null; $this->seoTags = null; } else { extract((array) $ReadSeo->Execute()->getResult()[0]); $this->seoData = (array) $ReadSeo->Execute()->getResult()[0]; $this->Data = [$category_title . ' - ' . SITENAME, $category_content, HOME . "/categoria/{$category_name}", INCLUDE_PATH . '/images/site.png']; //categories:: conta views da categoria $ReadSeo->setCategory_id($category_id); $ReadSeo->setCategory_views($category_views + 1); $ReadSeo->setCategory_last_view(date('Y-m-d H:i:s')); $ReadSeo->Execute()->update($ReadSeo->Execute()->getDados(), 'category_id'); } break; //SEO::PESQUISA //SEO::PESQUISA case 'pesquisa': $ReadSeo = new WsPosts(); $ReadSeo->Execute()->Query("post_status = 1 AND (post_title LIKE '%' :link '%' OR post_content LIKE '%' :link '%')", "link={$this->Link}"); if (!$ReadSeo->Execute()->getResult()) { $this->Data = ["Pesquisa por: \"{$this->Link}\"" . ' - ' . SITENAME, "Sua pesquisa por {$this->Link} retornou {$this->seoData['count']} resultados!", HOME . "/pesquisa/{$this->Link}", INCLUDE_PATH . '/images/site.png']; $this->seoTags = null; } else { $this->seoData['count'] = $ReadSeo->Execute()->getRowCount(); $this->Data = ["Pesquisa por: \"{$this->Link}\"" . ' - ' . SITENAME, "Sua pesquisa por {$this->Link} retornou {$this->seoData['count']} resultados!", HOME . "/pesquisa/{$this->Link}", INCLUDE_PATH . '/images/site.png']; } break; //SEO:: INDEX //SEO:: INDEX case 'index': $this->Data = [SITENAME . ' - ' . SITEDESC, SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; case 'pages': switch ($this->Link) { //SEO:: Contato case 'contato': $this->Data = [SITENAME . ' - Fale conosco', SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; //SEO:: membros //SEO:: membros case 'membros': $this->Data = [SITENAME . ' - Parceiros da causa.', SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; //SEO:: institucional //SEO:: institucional case 'institucional': $this->Data = [SITENAME . ' - Institucional.', SITEDESC, HOME, INCLUDE_PATH . '/images/site.png']; break; //SEO:: 404 //SEO:: 404 default: $this->Data = ['404 Oppss, Nada encontrado!', SITEDESC, HOME . '/404', INCLUDE_PATH . '/images/site.png']; break; } break; //SEO:: 404 //SEO:: 404 default: $this->Data = ['404 Oppss, Nada encontrado!', SITEDESC, HOME . '/404', INCLUDE_PATH . '/images/site.png']; break; } if ($this->Data) { $this->setTags(); } }