Phalcon Framework 3.2.2

SolrClientException: Solr HTTP Error 7: 'Couldn't connect to server'

/var/www/iLove2.0/apps/frontend/controllers/ConteudoController.php (231)
#0SolrClient->query(Object(SolrQuery))
/var/www/iLove2.0/apps/frontend/controllers/ConteudoController.php (231)
<?php
namespace Multiple\Frontend\Controllers;
 
use Phalcon\Mvc\Controller;
use Phalcon\Http\Request;
use Multiple\Frontend\Controllers\IndexController as IndexActions;
use Sunra\PhpSimple\HtmlDomParser;
 
class ConteudoController extends Controller
{
 
  public function parametros($dispatcher,$request){
    $params = [];
    $paramsLooks = [];
 
    $params["page"] = $dispatcher->getParam("page");
    $params["slug"] = $dispatcher->getParam("slug");
    $params["preview"] = $request->getQuery("preview");
 
    $paramsLooks["blogueira"] = explode(",",  $request->getQuery("blogueira"));
    $paramsLooks["ocasiao"]   = explode(",", $request->getQuery("ocasiao"));
    $paramsLooks["tendencia"] = explode(",", $request->getQuery("tendencia"));
    $paramsLooks["estacao"]   = explode(",", $request->getQuery("estacao"));
 
    if(count($paramsLooks)){
      $params["paramsLooks"] = $paramsLooks;
    }
 
    return $params;
  }
 
  public function catslook($materia){
 
    $catslooks = [];
 
    foreach ($materia->tendencia_nome_sm as $mat3){
      array_push($catslooks, array("nome"=>$mat3,"link"=>$this->helper->slugify($mat3),"tipo"=>"tendencia" ));
    }
    foreach ($materia->blogueira_nome_sm as $mat2){
      array_push($catslooks, array("nome"=>$mat2,"link"=>$this->helper->slugify($mat2),"tipo"=>"blogueira" ));
    }
    foreach ($materia->estacao_nome_sm as $mat){
      array_push($catslooks, array("nome"=>$mat,"link"=>$this->helper->slugify($mat),"tipo"=>"estacao" ));
    }
    foreach ($materia->ocasiao_nome_sm as $mat4){
      array_push($catslooks, array("nome"=>$mat4,"link"=>$this->helper->slugify($mat4),"tipo"=>"ocasiao" ));
    }
 
 
    return $catslooks;
  }
 
  public function apiConteudo($parametros,$offset){
    $materias = $this->materiasQry($parametros,$offset,false,true,true);
 
    $materias2 = [];
    $count = 0;
 
    if (!$materias["materias"]){
      return json_encode(array("erro"=>"não há mais materias para carregar"));
    }
 
    foreach ($materias["materias"] as $materiaz){
      $materias2[$count]["all"] = $materiaz;
      $materias2[$count]["content"] = $this->trataMateria($materiaz,$parametros);
      $materias2[$count]["link"]  = $this->helper->linkmaterias($materiaz);
      $materias2[$count]["tipo"] = $this->helper->tipoMateria($materiaz);
      $materias2[$count]["catslook"] = $this->catslook($materiaz);
      $count++;
    }
 
    if ($parametros["page"]=="look" || $parametros["page"]=="looks"){
      $ladolook = 0;
      if ($offset%2){
        $ladolook=1;
      }
      $looks = $this->view->getPartial("blocos/looks/look",['look'=>$materias2[0],"tipo"=>$ladolook]);
      return json_encode(array("conteudo"=>$looks));
    }
    else
    {
      $conteudo = $this->view->getPartial("blocos/conteudo",['materia'=>$materias2[0]]);
      return json_encode(array("conteudo"=>$conteudo));
    }
  }
 
  public function descriptionConteudo($parametros,$materias){
    if ($parametros["page"]=="moods"){
      return $this->tag->texto("moods-description-seo");
    }
    if ($parametros["page"]=="vitrines"){
      return $this->tag->texto("vitrines-description-seo");
    }
    if ($parametros["page"]=="looks"){
      return $this->tag->texto("looks-description-seo");
    }
    if ($parametros["page"]=="materias"){
      return $this->tag->texto("materias-description-seo");
    }
 
    return $materias[0]["all"]->post_descricao_t[0];
  }
 
  public function trataFacets($facets){
    $tendencias=[];
    $blogueiras=[];
    $estacoes=[];
    $ocasioes=[];
 
    foreach ($facets->tendencia_nome_sm as $tendencia => $cont){
      $tendenciastmp = array("nome"=>$tendencia,"slug"=>$this->helper->slugify($tendencia),"contagem"=>$cont);
      array_push($tendencias,$tendenciastmp);
    }
 
    foreach ($facets->blogueira_nome_sm as $blogueira => $cont){
      $blogueirastmp = array("nome"=>$blogueira,"slug"=>$this->helper->slugify($blogueira),"contagem"=>$cont);
      array_push($blogueiras,$blogueirastmp);
    }
 
    foreach ($facets->estacao_nome_sm as $estacao => $cont){
      $estacoestmp = array("nome"=>$estacao,"slug"=>$this->helper->slugify($estacao),"contagem"=>$cont);
      array_push($estacoes,$estacoestmp);
    }
 
    foreach ($facets->ocasiao_nome_sm as $ocasiao => $cont){
      $ocasioestmp = array("nome"=>$ocasiao,"slug"=>$this->helper->slugify($ocasiao),"contagem"=>$cont);
      array_push($ocasioes,$ocasioestmp);
    }
 
    return array("tendencias"=>$tendencias,"blogueiras"=>$blogueiras,"estacoes"=>$estacoes,"ocasioes"=>$ocasioes);
 
  }
  public function indexAction(){
    $this->view->page = $this->dispatcher->getParam("page");
    $this->view->slug = $this->dispatcher->getParam("slug");
 
    $request = new Request;
 
    $preview = ($request->getQuery("preview") ? true : false );
 
 
    $this->view->parametros = $this->parametros($this->dispatcher,$request);
    $this->view->tipoMaterias = $this->helper->tipoMateriaBypage($this->view->parametros);
 
    $this->view->url = $this->helper->url($this->view->parametros);
 
    $this->view->article = true;
 
    $materias = $this->materiasQry($this->view->parametros,0,$preview);
 
    $materias2 = [];
    $count = 0;
      foreach ($materias["materias"] as $materia){
        $materias2[$count]["all"] = $materia;
        $materias2[$count]["content"] = $this->trataMateria($materia,$this->view->parametros);
        $materias2[$count]["link"]  = $this->helper->linkmaterias($materia);
        $materias2[$count]["tipo"] = $this->helper->tipoMateria($materia);
        $materias2[$count]["catslook"] = $this->catslook($materia);
        $count++;
      }
 
    $this->view->materias = $materias2;
 
    $this->view->imageog = $this->tag->getUrlImage($this->view->materias[0]["all"]->post_imginterna_full_s,0,'noresize');
 
    $this->view->facets = $this->trataFacets($this->lookFacet());
 
    $this->view->description = $this->descriptionConteudo($this->view->parametros,$this->view->materias);
 
    $this->view->author = $this->view->materias[0]["all"]->post_author_s;
    $this->view->tipo =  $this->helper->tipoMateria($this->view->materias[0]["all"])["nome"];
 
    $this->view->tagog = implode(",",$this->view->materias[0]["all"]->categoriapost_nome_sm);
 
    //footer
      $this->view->dados = array (
      'novaslojasmarcas'     => $this->helper->footer(7),
      'footertopcategorias'  => $this->helper->footer(8),
      'footermarcas'      => $this->helper->footer(9),
      'footerlojas'      => $this->helper->footer(10)
    );
 
    if ($this->view->page=="look" || $this->view->page=="looks"){
      $this->view->pick("looks/index");
    }
    else{
      $this->view->render("conteudo","index");
    }
  }
 
  public function lookFacet(){
 
    $client = $this->helper->solrConnect('posts');
    $query = new \SolrQuery();
    $query->setQuery("post_status_i:1 AND post_tipo_s:Look AND -post_tipo_s:TrendIn");
    $query->setFacet(true);
    $query->setFacetMinCount(1);
    $query->addFacetField("{!ex=tdn}tendencia_nome_sm");
    $query->addFacetField("{!ex=blg}blogueira_nome_sm");
    $query->addFacetField("{!ex=est}estacao_nome_sm");
    $query->addFacetField("{!ex=oca}ocasiao_nome_sm");
 
    $response = $client->query($query)->getResponse();
 
    $facets   = $response->facet_counts->facet_fields;
 
    return $facets;
  }
 
  public function materiasQry($parametros,$offset=0,$preview,$agendamentoSort=false,$api=false){
 
    $client = $this->helper->solrConnect('posts');
 
    $slug= $parametros["slug"];
    $pagina = $parametros["page"];
    
    $blogueira = implode(" OR ",$parametros["paramsLooks"]["blogueira"]);
    $estacao = implode(" OR ",$parametros["paramsLooks"]["estacao"]);
    $ocasiao = implode(" OR ",$parametros["paramsLooks"]["ocasiao"]);
    $tendencia = implode(" OR ",$parametros["paramsLooks"]["tendencia"]);
 
    $query = new \SolrQuery();
    
    if($slug){
      $checkQuery = new \SolrQuery();
 
      $checkQuery->setQuery("post_status_i:1 AND post_slug_s:".$slug."^10");
      $checkQuery->addFilterQuery("post_tipo_s:".$this->getTipoByPage($pagina));
      $checkQuery->setRows(1);
 
      $checkResponse = $client->query($checkQuery)->getResponse()->response->docs;
 
      if(!$checkResponse){
        header("HTTP/1.0 404 Not Found");
        $this->view->pick("notfound/not-found-404");
        return false;
      }
    }
    
    $query->setQuery("post_status_i:1 AND -post_tipo_s:Look AND -post_tipo_s:TrendIn");
 
    if($pagina=="looks"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Look AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="materias"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Stories AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="vitrines"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Vitrine AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="moods"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Mood AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="look"){
      $query->setQuery("(post_status_i:1 AND post_tipo_s:Look AND post_slug_s:".$slug."^10) OR * AND post_status_i:1 AND -post_tipo_s:TrendIn AND post_tipo_s:Look");
    }
 
    $query->addFacetQuery("*:*");
 
    if ($tendencia){
      $query->addFilterQuery('{!tag=tdn}tendencia_nomeseo_sm:'.$tendencia);
    }
 
    if ($blogueira){
      $query->addFilterQuery('{!tag=blg}blogueira_nomeseo_sm:'.$blogueira);
    }
 
    if ($estacao){
      $query->addFilterQuery('{!tag=est}estacao_nomeseo_sm:'.$estacao);
    }
 
    if ($ocasiao){
      $query->addFilterQuery('{!tag=oca}ocasiao_nomeseo_sm:'.$ocasiao);
    }
 
    if($api && $slug){
      $query->addFilterQuery("-post_slug_s:".$slug);
    }
 
    if($slug && $pagina!="look" && $pagina!="looks" && !$api){
      $postStatus = (!$preview ?  "post_status_i:1 AND" : "");
      $query->setQuery("(".$postStatus." -post_tipo_s:Look AND post_slug_s:".$slug."^10) OR * AND ".$postStatus." -post_tipo_s:Look AND -post_tipo_s:TrendIn");
 
      $query->addFilterQuery("post_tipo_s:".$this->getTipoByPage($pagina));
    }
 
    $query->addParam("NOW", (round(microtime(true) * 1000) - 10800000));
 
    if(!$slug || $agendamentoSort){
      $query->addSortField("post_agendamento_dt",1);
    }
 
    if(!$preview){
      $query->addFilterQuery("post_agendamento_dt:[* TO NOW]");
    }
 
    $query->setFacet(true);
    $query->setFacetMinCount(1);
    $query->addFacetField("{!ex=tdn}tendencia_nome_sm");
    $query->addFacetField("{!ex=blg}blogueira_nome_sm");
    $query->addFacetField("{!ex=est}estacao_nome_sm");
    $query->addFacetField("{!ex=oca}ocasiao_nome_sm");
 
    $query->setRows(1);
 
    if($pagina=="look"){
      $query->setRows(2);
    }
    $query->setStart($offset);
 
    $response = $client->query($query)->getResponse();
 
    $materias = $response->response->docs;
    $facets   = $response->facet_counts->facet_fields;
 
    if (!$materias){
      return array("Error"=>"Nenhuma matéria encontrada");
    }
 
    return array("materias"=>$materias,"facets"=>$facets);
 
  }
 
  public function getTipoByPage($page){
 
    switch ($page) {
      case 'materia':
        $tipo = "Stories";
        break;
      case 'vitrine':
        $tipo = "Vitrine";
        break;
      case 'mood':
        $tipo = "Mood";
        break;  
      default:
        $tipo = "*";
        break;
    }
 
    return $tipo;
  }
 
 
  public function trataMateria($materia,$parametros=false){
    if ($parametros["page"]=="look" || $parametros["page"]=="looks"){
      return IndexActions::galeriasAction($materia->post_id_i,true);
    }
 
    $dom = HtmlDomParser::str_get_html($materia->post_content_t[0]);
    $galeriaImagems = $dom->find(".galeria");
    $galeriasProdutos = $dom->find(".galeriaProdutoTemp");
 
    if(count($galeriaImagems)){
      foreach ($galeriaImagems as $i => $galeriaImagem) {
        $galeria = $this->montaGaleriaImg($galeriaImagem->attr['data-lista']);
        $dom->find(".galeria",$i)->outertext = $galeria;
      }
    }
    if(count($galeriasProdutos)){
      foreach ($galeriasProdutos as $i => $galeriaProdutos){
        $id   = $galeriaProdutos->attr['data-galeria-id'];
        $tipo   = $galeriaProdutos->attr['data-tipo'];
        $qtd   = $galeriaProdutos->attr['data-qtd'];
 
        $galeria = $this->montaGaleria($id,$tipo,$qtd);
        $dom->find(".galeriaProdutoTemp",$i)->outertext = $galeria;
      }
    }
 
    return preg_replace('/(<[^>]+) style=".*?"/i', '$1', $dom);
  }
 
  function montaGaleriaImg($img){
 
    $img = rtrim($img,",");
 
    $images = explode(",",$img);
 
    $prefix = '<div class="owl-carousel owl-1-dot-materias">';
 
    foreach ($images as $imgs){
      $imgarr.= $this->galeriaimg($imgs);
    }
 
    $suffix = '</div>';
 
 
    return $prefix.$imgarr.$suffix;
  }
  public function galeriaimg($img){
    $img = trim($img);
    return "<div class='text-center'><img  class='inline-block' src='".$this->tag->getUrlImage($img,0,'noresize')."' /></div>";
  }
  function montaGaleria($id,$tipo,$qtd){
 
    $produtos = $this->getGaleria($id,$qtd,true);
 
    if ($tipo=="lista"){
      $prods = '<div class="ListaProdutos text-center">'.$this->view->getPartial("modulos/lista",[
        "lista"=> $produtos,
        "class"=>"produto col-sm-4 col-xs-8",
        "itemClass"=>"",
        "bloco"=>"produto/produto-noHeart",
        "qtdprod" => 1,
        "produtos" => array('produtos'=>1),
      ]).'</div>';
    }
 
    if ($tipo=="banner"){
      $prods = $this->view->getPartial("modulos/banner-produto",["lista"=> $produtos]);
    }
 
    return  $prods;
  }
  public function getGaleria($id,$qtd=99,$imgParceirto= false){
 
    $client = $this->helper->solrConnect('galeriaprodutos');
 
    $query = new \SolrQuery();
 
    $query->setQuery("galeriaproduto_galeriaid_s:".$id);
    $query->addFilterQuery('galeriaproduto_ativo_i:1');
    if($imgParceirto){
      $query->addFilterQuery("(produto_imagem_linkexterno_sm:* OR produto_imagem_link_sm:* ) AND produto_categoria_nomeseo_sm:*");
    }else{
      $query->addFilterQuery('(produto_imagem_link_sm:*)');
    }
 
    $query->addSortField("galeriaproduto_ordem_i",0);
 
    $query->setRows($qtd);
 
    $response = $client->query($query)->getResponse();
 
    $galeria = $response->response->docs;
 
    if (!$galeria){
      return array("Error"=>"Nenhuma galeria encontrada");
    }
 
    return $galeria;
  }
 
}
#1Multiple\Frontend\Controllers\ConteudoController->materiasQry(Array([page] => vitrine, [slug] => metalizados-na-decor, [preview] => (empty string), [paramsLooks] => Array([blogueira] => Array([0] => (empty string)), [ocasiao] => Array([0] => (empty string)), [tendencia] => Array([0] => (empty string)), [estacao] => Array([0] => (empty string)))), 0, false)
/var/www/iLove2.0/apps/frontend/controllers/ConteudoController.php (149)
<?php
namespace Multiple\Frontend\Controllers;
 
use Phalcon\Mvc\Controller;
use Phalcon\Http\Request;
use Multiple\Frontend\Controllers\IndexController as IndexActions;
use Sunra\PhpSimple\HtmlDomParser;
 
class ConteudoController extends Controller
{
 
  public function parametros($dispatcher,$request){
    $params = [];
    $paramsLooks = [];
 
    $params["page"] = $dispatcher->getParam("page");
    $params["slug"] = $dispatcher->getParam("slug");
    $params["preview"] = $request->getQuery("preview");
 
    $paramsLooks["blogueira"] = explode(",",  $request->getQuery("blogueira"));
    $paramsLooks["ocasiao"]   = explode(",", $request->getQuery("ocasiao"));
    $paramsLooks["tendencia"] = explode(",", $request->getQuery("tendencia"));
    $paramsLooks["estacao"]   = explode(",", $request->getQuery("estacao"));
 
    if(count($paramsLooks)){
      $params["paramsLooks"] = $paramsLooks;
    }
 
    return $params;
  }
 
  public function catslook($materia){
 
    $catslooks = [];
 
    foreach ($materia->tendencia_nome_sm as $mat3){
      array_push($catslooks, array("nome"=>$mat3,"link"=>$this->helper->slugify($mat3),"tipo"=>"tendencia" ));
    }
    foreach ($materia->blogueira_nome_sm as $mat2){
      array_push($catslooks, array("nome"=>$mat2,"link"=>$this->helper->slugify($mat2),"tipo"=>"blogueira" ));
    }
    foreach ($materia->estacao_nome_sm as $mat){
      array_push($catslooks, array("nome"=>$mat,"link"=>$this->helper->slugify($mat),"tipo"=>"estacao" ));
    }
    foreach ($materia->ocasiao_nome_sm as $mat4){
      array_push($catslooks, array("nome"=>$mat4,"link"=>$this->helper->slugify($mat4),"tipo"=>"ocasiao" ));
    }
 
 
    return $catslooks;
  }
 
  public function apiConteudo($parametros,$offset){
    $materias = $this->materiasQry($parametros,$offset,false,true,true);
 
    $materias2 = [];
    $count = 0;
 
    if (!$materias["materias"]){
      return json_encode(array("erro"=>"não há mais materias para carregar"));
    }
 
    foreach ($materias["materias"] as $materiaz){
      $materias2[$count]["all"] = $materiaz;
      $materias2[$count]["content"] = $this->trataMateria($materiaz,$parametros);
      $materias2[$count]["link"]  = $this->helper->linkmaterias($materiaz);
      $materias2[$count]["tipo"] = $this->helper->tipoMateria($materiaz);
      $materias2[$count]["catslook"] = $this->catslook($materiaz);
      $count++;
    }
 
    if ($parametros["page"]=="look" || $parametros["page"]=="looks"){
      $ladolook = 0;
      if ($offset%2){
        $ladolook=1;
      }
      $looks = $this->view->getPartial("blocos/looks/look",['look'=>$materias2[0],"tipo"=>$ladolook]);
      return json_encode(array("conteudo"=>$looks));
    }
    else
    {
      $conteudo = $this->view->getPartial("blocos/conteudo",['materia'=>$materias2[0]]);
      return json_encode(array("conteudo"=>$conteudo));
    }
  }
 
  public function descriptionConteudo($parametros,$materias){
    if ($parametros["page"]=="moods"){
      return $this->tag->texto("moods-description-seo");
    }
    if ($parametros["page"]=="vitrines"){
      return $this->tag->texto("vitrines-description-seo");
    }
    if ($parametros["page"]=="looks"){
      return $this->tag->texto("looks-description-seo");
    }
    if ($parametros["page"]=="materias"){
      return $this->tag->texto("materias-description-seo");
    }
 
    return $materias[0]["all"]->post_descricao_t[0];
  }
 
  public function trataFacets($facets){
    $tendencias=[];
    $blogueiras=[];
    $estacoes=[];
    $ocasioes=[];
 
    foreach ($facets->tendencia_nome_sm as $tendencia => $cont){
      $tendenciastmp = array("nome"=>$tendencia,"slug"=>$this->helper->slugify($tendencia),"contagem"=>$cont);
      array_push($tendencias,$tendenciastmp);
    }
 
    foreach ($facets->blogueira_nome_sm as $blogueira => $cont){
      $blogueirastmp = array("nome"=>$blogueira,"slug"=>$this->helper->slugify($blogueira),"contagem"=>$cont);
      array_push($blogueiras,$blogueirastmp);
    }
 
    foreach ($facets->estacao_nome_sm as $estacao => $cont){
      $estacoestmp = array("nome"=>$estacao,"slug"=>$this->helper->slugify($estacao),"contagem"=>$cont);
      array_push($estacoes,$estacoestmp);
    }
 
    foreach ($facets->ocasiao_nome_sm as $ocasiao => $cont){
      $ocasioestmp = array("nome"=>$ocasiao,"slug"=>$this->helper->slugify($ocasiao),"contagem"=>$cont);
      array_push($ocasioes,$ocasioestmp);
    }
 
    return array("tendencias"=>$tendencias,"blogueiras"=>$blogueiras,"estacoes"=>$estacoes,"ocasioes"=>$ocasioes);
 
  }
  public function indexAction(){
    $this->view->page = $this->dispatcher->getParam("page");
    $this->view->slug = $this->dispatcher->getParam("slug");
 
    $request = new Request;
 
    $preview = ($request->getQuery("preview") ? true : false );
 
 
    $this->view->parametros = $this->parametros($this->dispatcher,$request);
    $this->view->tipoMaterias = $this->helper->tipoMateriaBypage($this->view->parametros);
 
    $this->view->url = $this->helper->url($this->view->parametros);
 
    $this->view->article = true;
 
    $materias = $this->materiasQry($this->view->parametros,0,$preview);
 
    $materias2 = [];
    $count = 0;
      foreach ($materias["materias"] as $materia){
        $materias2[$count]["all"] = $materia;
        $materias2[$count]["content"] = $this->trataMateria($materia,$this->view->parametros);
        $materias2[$count]["link"]  = $this->helper->linkmaterias($materia);
        $materias2[$count]["tipo"] = $this->helper->tipoMateria($materia);
        $materias2[$count]["catslook"] = $this->catslook($materia);
        $count++;
      }
 
    $this->view->materias = $materias2;
 
    $this->view->imageog = $this->tag->getUrlImage($this->view->materias[0]["all"]->post_imginterna_full_s,0,'noresize');
 
    $this->view->facets = $this->trataFacets($this->lookFacet());
 
    $this->view->description = $this->descriptionConteudo($this->view->parametros,$this->view->materias);
 
    $this->view->author = $this->view->materias[0]["all"]->post_author_s;
    $this->view->tipo =  $this->helper->tipoMateria($this->view->materias[0]["all"])["nome"];
 
    $this->view->tagog = implode(",",$this->view->materias[0]["all"]->categoriapost_nome_sm);
 
    //footer
      $this->view->dados = array (
      'novaslojasmarcas'     => $this->helper->footer(7),
      'footertopcategorias'  => $this->helper->footer(8),
      'footermarcas'      => $this->helper->footer(9),
      'footerlojas'      => $this->helper->footer(10)
    );
 
    if ($this->view->page=="look" || $this->view->page=="looks"){
      $this->view->pick("looks/index");
    }
    else{
      $this->view->render("conteudo","index");
    }
  }
 
  public function lookFacet(){
 
    $client = $this->helper->solrConnect('posts');
    $query = new \SolrQuery();
    $query->setQuery("post_status_i:1 AND post_tipo_s:Look AND -post_tipo_s:TrendIn");
    $query->setFacet(true);
    $query->setFacetMinCount(1);
    $query->addFacetField("{!ex=tdn}tendencia_nome_sm");
    $query->addFacetField("{!ex=blg}blogueira_nome_sm");
    $query->addFacetField("{!ex=est}estacao_nome_sm");
    $query->addFacetField("{!ex=oca}ocasiao_nome_sm");
 
    $response = $client->query($query)->getResponse();
 
    $facets   = $response->facet_counts->facet_fields;
 
    return $facets;
  }
 
  public function materiasQry($parametros,$offset=0,$preview,$agendamentoSort=false,$api=false){
 
    $client = $this->helper->solrConnect('posts');
 
    $slug= $parametros["slug"];
    $pagina = $parametros["page"];
    
    $blogueira = implode(" OR ",$parametros["paramsLooks"]["blogueira"]);
    $estacao = implode(" OR ",$parametros["paramsLooks"]["estacao"]);
    $ocasiao = implode(" OR ",$parametros["paramsLooks"]["ocasiao"]);
    $tendencia = implode(" OR ",$parametros["paramsLooks"]["tendencia"]);
 
    $query = new \SolrQuery();
    
    if($slug){
      $checkQuery = new \SolrQuery();
 
      $checkQuery->setQuery("post_status_i:1 AND post_slug_s:".$slug."^10");
      $checkQuery->addFilterQuery("post_tipo_s:".$this->getTipoByPage($pagina));
      $checkQuery->setRows(1);
 
      $checkResponse = $client->query($checkQuery)->getResponse()->response->docs;
 
      if(!$checkResponse){
        header("HTTP/1.0 404 Not Found");
        $this->view->pick("notfound/not-found-404");
        return false;
      }
    }
    
    $query->setQuery("post_status_i:1 AND -post_tipo_s:Look AND -post_tipo_s:TrendIn");
 
    if($pagina=="looks"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Look AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="materias"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Stories AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="vitrines"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Vitrine AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="moods"){
      $query->setQuery("post_status_i:1 AND post_tipo_s:Mood AND -post_tipo_s:TrendIn");
    }
 
    if($pagina=="look"){
      $query->setQuery("(post_status_i:1 AND post_tipo_s:Look AND post_slug_s:".$slug."^10) OR * AND post_status_i:1 AND -post_tipo_s:TrendIn AND post_tipo_s:Look");
    }
 
    $query->addFacetQuery("*:*");
 
    if ($tendencia){
      $query->addFilterQuery('{!tag=tdn}tendencia_nomeseo_sm:'.$tendencia);
    }
 
    if ($blogueira){
      $query->addFilterQuery('{!tag=blg}blogueira_nomeseo_sm:'.$blogueira);
    }
 
    if ($estacao){
      $query->addFilterQuery('{!tag=est}estacao_nomeseo_sm:'.$estacao);
    }
 
    if ($ocasiao){
      $query->addFilterQuery('{!tag=oca}ocasiao_nomeseo_sm:'.$ocasiao);
    }
 
    if($api && $slug){
      $query->addFilterQuery("-post_slug_s:".$slug);
    }
 
    if($slug && $pagina!="look" && $pagina!="looks" && !$api){
      $postStatus = (!$preview ?  "post_status_i:1 AND" : "");
      $query->setQuery("(".$postStatus." -post_tipo_s:Look AND post_slug_s:".$slug."^10) OR * AND ".$postStatus." -post_tipo_s:Look AND -post_tipo_s:TrendIn");
 
      $query->addFilterQuery("post_tipo_s:".$this->getTipoByPage($pagina));
    }
 
    $query->addParam("NOW", (round(microtime(true) * 1000) - 10800000));
 
    if(!$slug || $agendamentoSort){
      $query->addSortField("post_agendamento_dt",1);
    }
 
    if(!$preview){
      $query->addFilterQuery("post_agendamento_dt:[* TO NOW]");
    }
 
    $query->setFacet(true);
    $query->setFacetMinCount(1);
    $query->addFacetField("{!ex=tdn}tendencia_nome_sm");
    $query->addFacetField("{!ex=blg}blogueira_nome_sm");
    $query->addFacetField("{!ex=est}estacao_nome_sm");
    $query->addFacetField("{!ex=oca}ocasiao_nome_sm");
 
    $query->setRows(1);
 
    if($pagina=="look"){
      $query->setRows(2);
    }
    $query->setStart($offset);
 
    $response = $client->query($query)->getResponse();
 
    $materias = $response->response->docs;
    $facets   = $response->facet_counts->facet_fields;
 
    if (!$materias){
      return array("Error"=>"Nenhuma matéria encontrada");
    }
 
    return array("materias"=>$materias,"facets"=>$facets);
 
  }
 
  public function getTipoByPage($page){
 
    switch ($page) {
      case 'materia':
        $tipo = "Stories";
        break;
      case 'vitrine':
        $tipo = "Vitrine";
        break;
      case 'mood':
        $tipo = "Mood";
        break;  
      default:
        $tipo = "*";
        break;
    }
 
    return $tipo;
  }
 
 
  public function trataMateria($materia,$parametros=false){
    if ($parametros["page"]=="look" || $parametros["page"]=="looks"){
      return IndexActions::galeriasAction($materia->post_id_i,true);
    }
 
    $dom = HtmlDomParser::str_get_html($materia->post_content_t[0]);
    $galeriaImagems = $dom->find(".galeria");
    $galeriasProdutos = $dom->find(".galeriaProdutoTemp");
 
    if(count($galeriaImagems)){
      foreach ($galeriaImagems as $i => $galeriaImagem) {
        $galeria = $this->montaGaleriaImg($galeriaImagem->attr['data-lista']);
        $dom->find(".galeria",$i)->outertext = $galeria;
      }
    }
    if(count($galeriasProdutos)){
      foreach ($galeriasProdutos as $i => $galeriaProdutos){
        $id   = $galeriaProdutos->attr['data-galeria-id'];
        $tipo   = $galeriaProdutos->attr['data-tipo'];
        $qtd   = $galeriaProdutos->attr['data-qtd'];
 
        $galeria = $this->montaGaleria($id,$tipo,$qtd);
        $dom->find(".galeriaProdutoTemp",$i)->outertext = $galeria;
      }
    }
 
    return preg_replace('/(<[^>]+) style=".*?"/i', '$1', $dom);
  }
 
  function montaGaleriaImg($img){
 
    $img = rtrim($img,",");
 
    $images = explode(",",$img);
 
    $prefix = '<div class="owl-carousel owl-1-dot-materias">';
 
    foreach ($images as $imgs){
      $imgarr.= $this->galeriaimg($imgs);
    }
 
    $suffix = '</div>';
 
 
    return $prefix.$imgarr.$suffix;
  }
  public function galeriaimg($img){
    $img = trim($img);
    return "<div class='text-center'><img  class='inline-block' src='".$this->tag->getUrlImage($img,0,'noresize')."' /></div>";
  }
  function montaGaleria($id,$tipo,$qtd){
 
    $produtos = $this->getGaleria($id,$qtd,true);
 
    if ($tipo=="lista"){
      $prods = '<div class="ListaProdutos text-center">'.$this->view->getPartial("modulos/lista",[
        "lista"=> $produtos,
        "class"=>"produto col-sm-4 col-xs-8",
        "itemClass"=>"",
        "bloco"=>"produto/produto-noHeart",
        "qtdprod" => 1,
        "produtos" => array('produtos'=>1),
      ]).'</div>';
    }
 
    if ($tipo=="banner"){
      $prods = $this->view->getPartial("modulos/banner-produto",["lista"=> $produtos]);
    }
 
    return  $prods;
  }
  public function getGaleria($id,$qtd=99,$imgParceirto= false){
 
    $client = $this->helper->solrConnect('galeriaprodutos');
 
    $query = new \SolrQuery();
 
    $query->setQuery("galeriaproduto_galeriaid_s:".$id);
    $query->addFilterQuery('galeriaproduto_ativo_i:1');
    if($imgParceirto){
      $query->addFilterQuery("(produto_imagem_linkexterno_sm:* OR produto_imagem_link_sm:* ) AND produto_categoria_nomeseo_sm:*");
    }else{
      $query->addFilterQuery('(produto_imagem_link_sm:*)');
    }
 
    $query->addSortField("galeriaproduto_ordem_i",0);
 
    $query->setRows($qtd);
 
    $response = $client->query($query)->getResponse();
 
    $galeria = $response->response->docs;
 
    if (!$galeria){
      return array("Error"=>"Nenhuma galeria encontrada");
    }
 
    return $galeria;
  }
 
}
#2Multiple\Frontend\Controllers\ConteudoController->indexAction(vitrine, vitrine, metalizados-na-decor, metalizados-na-decor)
#3Phalcon\Dispatcher->callActionMethod(Object(Multiple\Frontend\Controllers\ConteudoController), indexAction, Array([page] => vitrine, [nomeseo] => vitrine, [tipo] => metalizados-na-decor, [slug] => metalizados-na-decor))
#4Phalcon\Dispatcher->_dispatch()
#5Phalcon\Dispatcher->dispatch()
#6Phalcon\Mvc\Application->handle()
/var/www/iLove2.0/public/index.php (455)
<?php
 
error_reporting(E_ALL);
 
$debug = new \Phalcon\Debug();
$debug->listen();
 
use Phalcon\Loader;
use Phalcon\Mvc\Router;
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Application as BaseApplication;
 
define('APPLICATION_PATH', __DIR__ . '/../apps');
define('PUBLIC_PATH', __DIR__ );
define('XML_FOLDER', PUBLIC_PATH . '/xml/');
define('LOGS_FOLDER', __DIR__ . '/../logs/');
define('IMAGES_FOLDER', __DIR__ . '/images/');
define('SOLRADDR', "localhost");
 
ini_set('memory_limit','4000M');
 
date_default_timezone_set('America/Sao_Paulo');
 
class Application extends BaseApplication
{
    /**
     * Register the services here to make them general or register in the ModuleDefinition to make them module-specific
     */
    protected function registerServices()
    {
 
        $di = new FactoryDefault();
 
        $loader = new Loader();
 
        /**
         * We're a registering a set of directories taken from the configuration file
         */
 
        $loader->registerNamespaces(
            [
               "Cocur\Slugify"    => APPLICATION_PATH . "/../vendor/slugify/src",
               "Dotenv"    => APPLICATION_PATH . "/../vendor/vlucas/phpdotenv/src"
 
            ]
        );
 
        $loader
            ->registerDirs([__DIR__ . '/../apps/helpers/',__DIR__ . '/../apps/security/'])
            ->register();
 
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
 
        // Registering a router
        $di->set('router', function () {
 
            $router = new Router(false);
 
            $router->setDefaultModule("frontend");
 
            $router->notFound(array(
              'module' => 'frontend',
              "controller" => "notfound",
              "action" => "index",
              "page"  => "404"
            ));
 
 
            //DEFAULT FRONTEND ROUTES
            // $router->add('/:controller/:action', [
            //     'module'     => 'frontend',
            //     'controller' => 1,
            //     'action'     => 2,
            // ])->setName('frontend');
 
 
            $router->add("/produto/{loja:[a-z0-9\-]+}/{marca:[a-z0-9\-]+}/{nome:[a-z0-9\-]+}/{id:[a-z0-9\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "produto",
                "page"       => "produto",
                "nomeseo"    => "produto"
            ]);
 
            $router->add("/produto/{nome:[a-z0-9\-]+}/{id:[a-z0-9\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "produto",
                "page"       => "produto",
                "nomeseo"    => "produto"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria",
                "pagina"     => "0"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-]+}/{categoria2:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-_]+}/{categoria2:[a-z\-_]+}/{categoria3:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-_]+}/{categoria2:[a-z\-_]+}/{categoria3:[a-z\-_]+}/{categoria4:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet",
                "pagina"     => "0"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-_]+}/{categoria2:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}/{categoria4:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades",
                "pagina"     => "0"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}/{categoria4:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades"
            ]);
 
            $router->add("/loja/{loja}",[
                "module"     => "frontend",
                "controller" => "categoria",
                "action"     => "index",
                "page"       => "loja",
                "nomeseo"    => "loja",
                "lojas"      => 1,
                "pagina"     => "0",
 
            ])->setName("frontend-loja");
 
            $router->add("/loja/{loja}/{pagina}",[
                "module"     => "frontend",
                "controller" => "categoria",
                "action"     => "index",
                "page"       => "loja",
                "nomeseo"    => "loja",
                "lojas"      => 1,
                "pagina"     => 2,
 
            ])->setName("frontend-loja-pagina");
 
 
            $router->add("/",[
                "module"     => "frontend",
                "controller" => "index",
                "action"     => "index",
                "page"       => "home",
                "nomeseo"    => "home"
            ])->setName("frontend-home");
 
            $router->add("/([a-z0-9\-]+)",[
                "module"     => "frontend",
                "controller" => "categoria",
                "action"     => "index",
                "page"       => "marca",
                "nomeseo"    => "marca",
                "marcas"  => 1
            ])->setName("frontend-marca");
 
 
            $router->add("/busca",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "busca",
                "page"       => "busca",
                "nomeseo"    => "busca",
                "pagina"     => "0",
            ]);
 
             $router->add("/buscaFoward",[
                "action"     => "buscaFoward",
                "module"     => "frontend",
                "controller" => "busca",
                "page"       => "busca",
                "nomeseo"    => "busca",
                "pagina"     => "0",
            ]);
 
            $router->add("/sobre-nos",[
                "module"     => "frontend",
                "controller" => "welcome",
                "action"     => "index",
            ])->setName("frontend-home");
 
            $router->add("/not-found",[
                "module"     => "frontend",
                "controller" => "Notfound",
                "action"     => "index",
            ])->setName("frontend-notFound");
 
            $router->add("/marcas",[
                "module"     => "frontend",
                "controller" => "lojasmarcas",
                "action"     => "index",
                "page"       => "marcas",
                "nomeseo"    => "marcas"
            ])->setName("frontend-marcas");
 
            $router->add("/lojas",[
                "module"     => "frontend",
                "controller" => "lojasmarcas",
                "action"     => "index",
                "page"       => "lojas",
                "nomeseo"    => "lojas"
            ])->setName("frontend-lojas");
 
            $router->add("/cupom",[
                "module"     => "frontend",
                "controller" => "Cupom",
                "action"     => "index",
                "page"       => "cupons",
            ])->setName("frontend-cupom");
 
            $router->add("/cupom/{parceiro}",[
                "module"     => "frontend",
                "controller" => "Cupom",
                "action"     => "interno",
                "parceiro"   => 1,
                "page"       => "cupom",
            ])->setName("frontend-cupom-interno");
 
            $router->add("/vitrine/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "vitrine",
                "nomeseo"    => "vitrine",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
            $router->add("/materia/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "materia",
                "nomeseo"    => "materia",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
            $router->add("/looks",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "looks",
                "nomeseo"    => "looks",
                "pagina"     => "0"
            ]);
 
            $router->add("/materias",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "materias",
                "nomeseo"    => "materias",
                "pagina"     => "0"
            ]);
 
            $router->add("/vitrines",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "vitrines",
                "nomeseo"    => "vitrines",
                "pagina"     => "0"
            ]);
 
            $router->add("/moods",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "moods",
                "nomeseo"    => "moods",
                "pagina"     => "0"
            ]);
 
             $router->add("/look/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "look",
                "nomeseo"    => "look",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
             $router->add("/mood/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "mood",
                "nomeseo"    => "mood",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
            $router->add("/termos-de-uso",[
                "module"     => "frontend",
                "controller" => "politicas",
                "action"     => "index",
                "parceiro"   => 1
            ])->setName("frontend-cupom-interno");
 
            $router->add("/tags",[
                "module"     => "frontend",
                "controller" => "tags",
                "action"     => "index",
                "page"       => "tags",
                "nomeseo"    => "tags"
            ])->setName("frontend-tags");
 
 
            //API ROUTES
            $router->add("/api/:controller/:action/:params", [
                'module'     => 'api',
                'controller' => 1,
                'action'     => 2,
                'params'     => 3,
            ])->setName('api');
 
            $router->add("/api/:controller", [
                'module'     => 'api',
                'controller' => 1,
                'action'     => 'index',
            ])->setName('api');
 
            $router->add("/api", [
                'module'     => 'api',
                'controller' => 'index',
                'action'     => 'index',
            ])->setName('api');
 
 
            //BACKEND ROUTES
            $router->add("/backend/:controller/:action/:params", [
                'module'     => 'backend',
                'controller' => 1,
                'action'     => 2,
                'params'     => 3
            ])->setName('backend');
 
            $router->add("/backend/:controller", [
                'module'     => 'backend',
                'controller' => 1,
                'action'     => 'index',
 
            ])->setName('backend');
 
            $router->add("/backend", [
                'module'     => 'backend',
                'controller' => 'index',
                'action'     => 'index',
            ])->setName('backend');
 
            return $router;
        });
 
        $this->setDI($di);
    }
 
    public function main()
    {
 
        $this->registerServices();
 
        // Register the installed modules
        $this->registerModules([
            'frontend' => [
                'className' => 'Multiple\Frontend\Module',
                'path'      => '../apps/frontend/Module.php'
            ],
            'backend'  => [
                'className' => 'Multiple\Backend\Module',
                'path'      => '../apps/backend/Module.php'
            ],
            'api'  => [
                'className' => 'Multiple\api\Module',
                'path'      => '../apps/api/Module.php'
            ]
        ]);
 
        echo $this->handle()->getContent();
    }
}
 
$application = new Application();
$application->main();
#7Application->main()
/var/www/iLove2.0/public/index.php (460)
<?php
 
error_reporting(E_ALL);
 
$debug = new \Phalcon\Debug();
$debug->listen();
 
use Phalcon\Loader;
use Phalcon\Mvc\Router;
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Application as BaseApplication;
 
define('APPLICATION_PATH', __DIR__ . '/../apps');
define('PUBLIC_PATH', __DIR__ );
define('XML_FOLDER', PUBLIC_PATH . '/xml/');
define('LOGS_FOLDER', __DIR__ . '/../logs/');
define('IMAGES_FOLDER', __DIR__ . '/images/');
define('SOLRADDR', "localhost");
 
ini_set('memory_limit','4000M');
 
date_default_timezone_set('America/Sao_Paulo');
 
class Application extends BaseApplication
{
    /**
     * Register the services here to make them general or register in the ModuleDefinition to make them module-specific
     */
    protected function registerServices()
    {
 
        $di = new FactoryDefault();
 
        $loader = new Loader();
 
        /**
         * We're a registering a set of directories taken from the configuration file
         */
 
        $loader->registerNamespaces(
            [
               "Cocur\Slugify"    => APPLICATION_PATH . "/../vendor/slugify/src",
               "Dotenv"    => APPLICATION_PATH . "/../vendor/vlucas/phpdotenv/src"
 
            ]
        );
 
        $loader
            ->registerDirs([__DIR__ . '/../apps/helpers/',__DIR__ . '/../apps/security/'])
            ->register();
 
        require_once APPLICATION_PATH . '/../vendor/autoload.php';
 
        // Registering a router
        $di->set('router', function () {
 
            $router = new Router(false);
 
            $router->setDefaultModule("frontend");
 
            $router->notFound(array(
              'module' => 'frontend',
              "controller" => "notfound",
              "action" => "index",
              "page"  => "404"
            ));
 
 
            //DEFAULT FRONTEND ROUTES
            // $router->add('/:controller/:action', [
            //     'module'     => 'frontend',
            //     'controller' => 1,
            //     'action'     => 2,
            // ])->setName('frontend');
 
 
            $router->add("/produto/{loja:[a-z0-9\-]+}/{marca:[a-z0-9\-]+}/{nome:[a-z0-9\-]+}/{id:[a-z0-9\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "produto",
                "page"       => "produto",
                "nomeseo"    => "produto"
            ]);
 
            $router->add("/produto/{nome:[a-z0-9\-]+}/{id:[a-z0-9\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "produto",
                "page"       => "produto",
                "nomeseo"    => "produto"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria",
                "pagina"     => "0"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-]+}/{categoria2:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-_]+}/{categoria2:[a-z\-_]+}/{categoria3:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria"
            ]);
 
            $router->add("/categoria/{categoria:[a-z\-_]+}/{categoria2:[a-z\-_]+}/{categoria3:[a-z\-_]+}/{categoria4:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "categoria",
                "nomeseo"    => "categoria"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet",
                "pagina"     => "0"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-_]+}/{categoria2:[a-z\-_]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet"
            ]);
 
            $router->add("/outlet/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}/{categoria4:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "outlet",
                "nomeseo"    => "outlet"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades",
                "pagina"     => "0"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades"
            ]);
 
            $router->add("/novidades/{categoria:[a-z\-]+}/{categoria2:[a-z\-]+}/{categoria3:[a-z\-]+}/{categoria4:[a-z\-]+}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "categoria",
                "page"       => "novidades",
                "nomeseo"    => "novidades"
            ]);
 
            $router->add("/loja/{loja}",[
                "module"     => "frontend",
                "controller" => "categoria",
                "action"     => "index",
                "page"       => "loja",
                "nomeseo"    => "loja",
                "lojas"      => 1,
                "pagina"     => "0",
 
            ])->setName("frontend-loja");
 
            $router->add("/loja/{loja}/{pagina}",[
                "module"     => "frontend",
                "controller" => "categoria",
                "action"     => "index",
                "page"       => "loja",
                "nomeseo"    => "loja",
                "lojas"      => 1,
                "pagina"     => 2,
 
            ])->setName("frontend-loja-pagina");
 
 
            $router->add("/",[
                "module"     => "frontend",
                "controller" => "index",
                "action"     => "index",
                "page"       => "home",
                "nomeseo"    => "home"
            ])->setName("frontend-home");
 
            $router->add("/([a-z0-9\-]+)",[
                "module"     => "frontend",
                "controller" => "categoria",
                "action"     => "index",
                "page"       => "marca",
                "nomeseo"    => "marca",
                "marcas"  => 1
            ])->setName("frontend-marca");
 
 
            $router->add("/busca",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "busca",
                "page"       => "busca",
                "nomeseo"    => "busca",
                "pagina"     => "0",
            ]);
 
             $router->add("/buscaFoward",[
                "action"     => "buscaFoward",
                "module"     => "frontend",
                "controller" => "busca",
                "page"       => "busca",
                "nomeseo"    => "busca",
                "pagina"     => "0",
            ]);
 
            $router->add("/sobre-nos",[
                "module"     => "frontend",
                "controller" => "welcome",
                "action"     => "index",
            ])->setName("frontend-home");
 
            $router->add("/not-found",[
                "module"     => "frontend",
                "controller" => "Notfound",
                "action"     => "index",
            ])->setName("frontend-notFound");
 
            $router->add("/marcas",[
                "module"     => "frontend",
                "controller" => "lojasmarcas",
                "action"     => "index",
                "page"       => "marcas",
                "nomeseo"    => "marcas"
            ])->setName("frontend-marcas");
 
            $router->add("/lojas",[
                "module"     => "frontend",
                "controller" => "lojasmarcas",
                "action"     => "index",
                "page"       => "lojas",
                "nomeseo"    => "lojas"
            ])->setName("frontend-lojas");
 
            $router->add("/cupom",[
                "module"     => "frontend",
                "controller" => "Cupom",
                "action"     => "index",
                "page"       => "cupons",
            ])->setName("frontend-cupom");
 
            $router->add("/cupom/{parceiro}",[
                "module"     => "frontend",
                "controller" => "Cupom",
                "action"     => "interno",
                "parceiro"   => 1,
                "page"       => "cupom",
            ])->setName("frontend-cupom-interno");
 
            $router->add("/vitrine/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "vitrine",
                "nomeseo"    => "vitrine",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
            $router->add("/materia/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "materia",
                "nomeseo"    => "materia",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
            $router->add("/looks",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "looks",
                "nomeseo"    => "looks",
                "pagina"     => "0"
            ]);
 
            $router->add("/materias",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "materias",
                "nomeseo"    => "materias",
                "pagina"     => "0"
            ]);
 
            $router->add("/vitrines",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "vitrines",
                "nomeseo"    => "vitrines",
                "pagina"     => "0"
            ]);
 
            $router->add("/moods",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "moods",
                "nomeseo"    => "moods",
                "pagina"     => "0"
            ]);
 
             $router->add("/look/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "look",
                "nomeseo"    => "look",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
             $router->add("/mood/{slug}",[
                "action"     => "index",
                "module"     => "frontend",
                "controller" => "conteudo",
                "page"       => "mood",
                "nomeseo"    => "mood",
                "tipo"       => 1,
                "slug"       => 2
            ]);
 
            $router->add("/termos-de-uso",[
                "module"     => "frontend",
                "controller" => "politicas",
                "action"     => "index",
                "parceiro"   => 1
            ])->setName("frontend-cupom-interno");
 
            $router->add("/tags",[
                "module"     => "frontend",
                "controller" => "tags",
                "action"     => "index",
                "page"       => "tags",
                "nomeseo"    => "tags"
            ])->setName("frontend-tags");
 
 
            //API ROUTES
            $router->add("/api/:controller/:action/:params", [
                'module'     => 'api',
                'controller' => 1,
                'action'     => 2,
                'params'     => 3,
            ])->setName('api');
 
            $router->add("/api/:controller", [
                'module'     => 'api',
                'controller' => 1,
                'action'     => 'index',
            ])->setName('api');
 
            $router->add("/api", [
                'module'     => 'api',
                'controller' => 'index',
                'action'     => 'index',
            ])->setName('api');
 
 
            //BACKEND ROUTES
            $router->add("/backend/:controller/:action/:params", [
                'module'     => 'backend',
                'controller' => 1,
                'action'     => 2,
                'params'     => 3
            ])->setName('backend');
 
            $router->add("/backend/:controller", [
                'module'     => 'backend',
                'controller' => 1,
                'action'     => 'index',
 
            ])->setName('backend');
 
            $router->add("/backend", [
                'module'     => 'backend',
                'controller' => 'index',
                'action'     => 'index',
            ])->setName('backend');
 
            return $router;
        });
 
        $this->setDI($di);
    }
 
    public function main()
    {
 
        $this->registerServices();
 
        // Register the installed modules
        $this->registerModules([
            'frontend' => [
                'className' => 'Multiple\Frontend\Module',
                'path'      => '../apps/frontend/Module.php'
            ],
            'backend'  => [
                'className' => 'Multiple\Backend\Module',
                'path'      => '../apps/backend/Module.php'
            ],
            'api'  => [
                'className' => 'Multiple\api\Module',
                'path'      => '../apps/api/Module.php'
            ]
        ]);
 
        echo $this->handle()->getContent();
    }
}
 
$application = new Application();
$application->main();
KeyValue
_url/vitrine/metalizados-na-decor
KeyValue
REDIRECT_UNIQUE_IDWpKESGjotjzKWThQhxfarwAAACY
REDIRECT_STATUS200
UNIQUE_IDWpKESGjotjzKWThQhxfarwAAACY
HTTP_HOSTwww.ilovee.com.br
HTTP_ACCEPT_ENCODINGx-gzip, gzip, deflate
HTTP_USER_AGENTCCBot/2.0 (http://commoncrawl.org/faq/)
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
SERVER_SIGNATURE
SERVER_SOFTWAREApache/2.4.6 (CentOS) PHP/7.0.22
SERVER_NAMEwww.ilovee.com.br
SERVER_ADDR169.63.72.146
SERVER_PORT80
REMOTE_ADDR54.92.197.82
DOCUMENT_ROOT/var/www/iLove2.0/public
REQUEST_SCHEMEhttp
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT/var/www/iLove2.0/public
SERVER_ADMINwebmaster@localhost
SCRIPT_FILENAME/var/www/iLove2.0/public/index.php
REMOTE_PORT38076
REDIRECT_QUERY_STRING_url=/vitrine/metalizados-na-decor
REDIRECT_URL/vitrine/metalizados-na-decor
GATEWAY_INTERFACECGI/1.1
SERVER_PROTOCOLHTTP/1.0
REQUEST_METHODGET
QUERY_STRING_url=/vitrine/metalizados-na-decor
REQUEST_URI/vitrine/metalizados-na-decor
SCRIPT_NAME/index.php
PHP_SELF/index.php
REQUEST_TIME_FLOAT1519551560.439
REQUEST_TIME1519551560
SOLR_HOSTNAMElocalhost
SOLR_LOGINiloveesolaris
SOLR_PASSWORDfWVq5dNCBU0yeHST
SOLR_PORT8983
DB_HOSTlocalhost
DB_USERroot
DB_PASSWORDQb8Mqyfh
DB_NAMEilove2
DB_CHARSETutf8
#Path
0/var/www/iLove2.0/public/index.php
1/var/www/iLove2.0/vendor/autoload.php
2/var/www/iLove2.0/vendor/composer/autoload_real.php
3/var/www/iLove2.0/vendor/composer/ClassLoader.php
4/var/www/iLove2.0/vendor/composer/autoload_static.php
5/var/www/iLove2.0/vendor/guzzlehttp/psr7/src/functions_include.php
6/var/www/iLove2.0/vendor/guzzlehttp/psr7/src/functions.php
7/var/www/iLove2.0/vendor/league/uri-hostname-parser/src/functions_include.php
8/var/www/iLove2.0/vendor/league/uri-hostname-parser/src/functions.php
9/var/www/iLove2.0/vendor/league/uri-parser/src/functions_include.php
10/var/www/iLove2.0/vendor/league/uri-parser/src/functions.php
11/var/www/iLove2.0/vendor/guzzlehttp/promises/src/functions_include.php
12/var/www/iLove2.0/vendor/guzzlehttp/promises/src/functions.php
13/var/www/iLove2.0/vendor/league/uri-components/src/functions_include.php
14/var/www/iLove2.0/vendor/league/uri-components/src/functions.php
15/var/www/iLove2.0/vendor/league/uri-schemes/src/functions_include.php
16/var/www/iLove2.0/vendor/league/uri-schemes/src/functions.php
17/var/www/iLove2.0/vendor/league/uri-schemes/src/Schemes/deprecated.php
18/var/www/iLove2.0/vendor/league/uri-schemes/src/AbstractUri.php
19/var/www/iLove2.0/vendor/league/uri-interfaces/src/Uri.php
20/var/www/iLove2.0/vendor/league/uri-schemes/src/Data.php
21/var/www/iLove2.0/vendor/league/uri-schemes/src/File.php
22/var/www/iLove2.0/vendor/league/uri-schemes/src/Ftp.php
23/var/www/iLove2.0/vendor/league/uri-schemes/src/Http.php
24/var/www/iLove2.0/vendor/psr/http-message/src/UriInterface.php
25/var/www/iLove2.0/vendor/league/uri-schemes/src/Uri.php
26/var/www/iLove2.0/vendor/league/uri-schemes/src/UriException.php
27/var/www/iLove2.0/vendor/league/uri-parser/src/Exception.php
28/var/www/iLove2.0/vendor/league/uri-schemes/src/Ws.php
29/var/www/iLove2.0/vendor/guzzlehttp/guzzle/src/functions_include.php
30/var/www/iLove2.0/vendor/guzzlehttp/guzzle/src/functions.php
31/var/www/iLove2.0/vendor/league/uri-manipulations/src/functions_include.php
32/var/www/iLove2.0/vendor/league/uri-manipulations/src/Modifiers/functions.php
33/var/www/iLove2.0/vendor/league/uri-manipulations/src/functions.php
34/var/www/iLove2.0/vendor/mtdowling/jmespath.php/src/JmesPath.php
35/var/www/iLove2.0/vendor/swiftmailer/swiftmailer/lib/swift_required.php
36/var/www/iLove2.0/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
37/var/www/iLove2.0/vendor/aws/aws-sdk-php/src/functions.php
38/var/www/iLove2.0/apps/frontend/Module.php
39/var/www/iLove2.0/vendor/vlucas/phpdotenv/src/Dotenv.php
40/var/www/iLove2.0/vendor/vlucas/phpdotenv/src/Loader.php
41/var/www/iLove2.0/apps/helpers/StageVerification.php
42/var/www/iLove2.0/apps/frontend/controllers/ConteudoController.php
43/var/www/iLove2.0/apps/helpers/Helpers.php
44/var/www/iLove2.0/vendor/mobiledetect/mobiledetectlib/namespaced/Detection/MobileDetect.php
45/var/www/iLove2.0/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php
Memory
Usage2097152