function _getCategoryLink($catName) { $catName = Helper::clean_string($catName); $pageNumber = 1; return $this->getCategoryLink('category', $catName, $pageNumber); //see CategoryLink trait }
function addBrandLinkIntoProductItem($productItem) { $filename = Helper::clean_string($productItem['brand']); $productItem['brandLink'] = $this->getCategoryLink('brand', $filename); //permalink trait return $productItem; }
function getCatLink($item, $catType) { if ($catType == 'Category') { $link = $this->getCategoryLink('brand', Helper::clean_string($item['brand']), 1); return '<a title="' . $item['brand'] . '" href="' . $link . '">' . $item['brand'] . '</a>'; } if ($catType == 'Brand') { $link = $this->getCategoryLink('category', Helper::clean_string($item['category']), 1); return '<a title="' . $item['category'] . '" href="' . $link . '">' . $item['category'] . '</a>'; } }
function getCatLink($item) { if ($this->catType == 'Category') { $link = HOME_URL . 'brand/' . Helper::clean_string($item['brand']) . FORMAT; return '<a title="' . $item['brand'] . '" href="' . $link . '">' . $item['brand'] . '</a>'; } if ($this->catType == 'Brand') { $link = HOME_URL . 'category/' . Helper::clean_string($item['category']) . FORMAT; return '<a title="' . $item['category'] . '" href="' . $link . '">' . $item['category'] . '</a>'; } }
public function update() { $json = $this->run(); if ($json->updated == 'YES') { $name = $json->_id; $city = Helper::clean_string($json->city); $state = strtolower($json->state_code); $url = Env::cinema_url() . $state . '/' . $city . '/' . $name; //retorna a url para acesso e o status assim o cliente pode testar o status antes de fazer uma requisicao. $cinema = new stdClass(); $cinema->url = $url; $cinema->status = $json->status; return $cinema; } }
function getBrandLink($brand) { //echo HOME_URL . 'brand/' . Helper::clean_string( $brand ) . FORMAT; echo $this->getCategoryLink('brand', Helper::clean_string($brand), 1); }
function getBrandLink($brand) { echo HOME_URL . 'brand/' . Helper::clean_string($brand) . FORMAT; }
function getCategorySlug() { return Helper::clean_string($this->productDetail['category']); }
function getCategoryLink($catName) { $catName = Helper::clean_string($catName); return HOME_URL . 'cat/' . $catName . FORMAT; }
function _getCategoryLink($catName) { $catName = Helper::clean_string($catName); return $this->getCategoryLink('category', $catName) . FORMAT; //see CategoryLink trait }
private function notify_invalid_cinemas() { if (count($this->_cinemas) == 0) { Log::write("Não achou cinemas para " . $this->_state); return; } $invalid = array_filter($this->_cinemas, function ($var) { return empty($var->id) || empty($var->address); }); $cinemas = array(); foreach ($invalid as $key => $value) { $uf = Helper::clean_string($value->state_code); $cidade = Helper::clean_string($value->city); $nome = Helper::clean_string($value->name); $cinema = "{$uf}/{$cidade}/{$nome}"; $cinemas[] = $cinema; } Sendmail::to_admin("Cinemas Incompletos", $cinemas); }
function xtest_clean_string() { echo Helper::clean_string('São Paulo'); }
function categoryLink($catName) { $catName = Helper::clean_string($catName); return $this->getCategoryLink('category', $catName, 1); }
private function new_template($dir, Cinema $cinema) { $nome = $cinema->name; $class = Helper::clean_string($nome, -1, '_'); $file = $class . '.php'; $tid = $cinema->id; //se ja tem uma classe para o cinema descarta entao //pesquisa classe com mesmo nome recursivo a partir do diretorio do estado... if (!Helper::recursive_file_exists($file, $dir)) { $temp_uf = $cinema->state_code; $cinema = $this->geo_cinema($cinema); $endereco = $cinema->address; $telefone = $cinema->phone; $url = $cinema->url; $lat = $cinema->lat; $long = $cinema->long; $cidade = $cinema->city; $estado = $cinema->state; $uf = $cinema->state_code; //esse if deve evitar o compartamente do google de procurar cinemas proximos tipo colocar volta redonda dentro de sp if (empty($uf)) { //se caiu aqui é pq o geocode do endereco do cine falhou entao usa a uf temp pelo menos para colocar o cine no dir correto $uf = $temp_uf; $path = $dir . $uf . '/'; } else { //bug do google maps if (Helper::clean_string($uf) == 'sao-paulo') { $uf = 'SP'; } $path = $dir . $uf . '/' . Helper::clean_string($cinema->city); } $path = strtolower($path); $this->create_dir($path); $tpl = Env::path('helper/CinemaClass.tpl'); if (!is_file($tpl)) { Log::write("Não achou {$tpl}"); exit(1); } //a classe do cinema fica sempre em cinema/uf/cidade/file.php $file = $path . '/' . $file; $handle = fopen($file, 'w'); if ($handle == false) { Log::write("Erro criando {$file}"); exit(1); } $cinema_class = file_get_contents($tpl); $content = str_replace("%class", $class, $cinema_class); $content = str_replace("%nome", $nome, $content); $content = str_replace("%id", $tid, $content); $content = str_replace("%endereco", $endereco, $content); $content = str_replace("%telefone", $telefone, $content); $content = str_replace("%cidade", $cidade, $content); $content = str_replace("%estado", $estado, $content); $content = str_replace("%uf", $uf, $content); $content = str_replace("%lat", $lat, $content); $content = str_replace("%long", $long, $content); $content = str_replace("%url", $url, $content); fwrite($handle, $content); fclose($handle); //guarda todos os novos cinemas criados para depois notificar via email para o admin controlar... //se não achou a cidade do cinema via geolocation vai colocar em um lugar errado, entao tem q notificar... $cinema_path = str_replace(Env::path(), "", $file); if (empty($cidade)) { $this->invalid_cinemas[] = $cinema_path; } else { $this->new_cinemas[] = $cinema_path; } } }