/** * @before _secure, memberLayout */ public function index() { $this->seo(array("title" => "Dashboard", "view" => $this->getLayoutView())); $view = $this->getActionView(); $websites = Website::all(array("user_id = ?" => $this->user->id), array("*"), "created", "desc", 10, 1); $referers = Referer::all(array("user_id = ?" => $this->user->id), array("*"), "created", "desc", 10, 1); $view->set(array("websites" => $websites, "referers" => $referers)); }
/** * Parse referer URL * * @param string $refererUrl * @param string $pageUrl * @return Referer */ public function parse($refererUrl, $pageUrl = null) { $refererParts = $this->parseUrl($refererUrl); if (!$refererParts) { return Referer::createInvalid(); } $pageUrlParts = $this->parseUrl($pageUrl); //print_r($refererParts); if ($pageUrlParts && $pageUrlParts['host'] === $refererParts['host'] || in_array($refererParts['host'], $this->internalHosts)) { return Referer::createInternal(); } $referer = $this->lookup($refererParts['host'], $refererParts['path']); if (!$referer) { return Referer::createUnknown(); } $searchTerm = null; if (is_array($referer['parameters'])) { parse_str($refererParts['query'], $queryParts); //foreach ($queryParts as $key => $parameter) { $searchTerm = isset($queryParts['q']) ? $queryParts['q'] : $searchTerm; //} } return Referer::createKnown($referer['medium'], $referer['source'], $searchTerm); }
<?php /** * Template para exibição de todos os detalhes de um evento */ use TiagoGouvea\PLib; get_header(); if (!is_user_logged_in()) { // Registrar visita $visitante = Referer::getVisitante(); // Se não for Bot, registrar no banco de visualizações de evento if (!$visitante->bot) { Referer::registrarVisitaEvento($visitante, $post->ID); } } // Precisando saber quais dados existem? /* @var $evento Evento */ $evento = get_the_evento(); //echo "<pre>";var_dump($evento);echo "</pre>"; if ($evento == null) { die('Variável $evento está null.... :('); } ?> <div class="center pull-left" style="margin-bottom:20px;"> <div id="content" class="clearfix"> <div class="content_left"> <div class=""> <h1>
/** * @before _secure, _admin */ public function shortUrl($ref_id) { $this->seo(array("title" => "Submit Your FakeReferer", "view" => $this->getLayoutView())); $view = $this->getActionView(); $referer = \Referer::first(array("id = ?" => $ref_id)); if (!$referer) { $this->redirect("/admin"); } if (RequestMethods::post("action") == "approve") { $url = RequestMethods::post("url"); if (!$url) { return; } switch ($referer->referer) { case 'twitter': // User will automatically enter short url $referer->short_url = $url; $referer->live = true; break; default: $googl = Registry::get("googl"); $object = $googl->shortenURL("http://trafficmonitor.ca/fakereferer/index/" . base64_encode($url)); $referer->short_url = $object->id; $referer->live = true; break; } $referer->save(); $view->set("success", 'Referer Approved. See <a href="/fakereferer/all">Manage</a>'); } $view->set("referer", $referer); }