public function processForm(Form $form)
 {
     /** @var FileUpload $file */
     $file = $form->values->file;
     if ($file->size > 0) {
         $fileContent = file_get_contents($file->getTemporaryFile());
         $this->settingsDao->setWebmasterToolsName($file->getName());
         $this->settingsDao->setWebmasterTools($fileContent);
     }
 }
Пример #2
0
 /**
  * Constructs absolute URL from Request object.
  *
  * @param Request $appRequest
  * @param Nette\Http\Url $refUrl
  * @return NULL|string
  */
 public function constructUrl(Request $appRequest, Nette\Http\Url $refUrl)
 {
     if ($appRequest->presenterName == "Seo:Meta") {
         $action = $appRequest->parameters["action"];
         if ($action == "sitemap") {
             return "/sitemap.xml";
         } elseif ($action == "robots") {
             return "/robots.txt";
         } elseif ($action == "googleWebmasterTools" and $webmasterToolsName = $this->settingsDao->getWebmasterToolsName()) {
             return "/" . $webmasterToolsName;
         }
     }
     $id = isset($appRequest->parameters["id"]) ? $appRequest->parameters["id"] : NULL;
     $target = new Target($appRequest->presenterName, $appRequest->parameters["action"], $id);
     if ($this->defaultRoute == $target) {
         $slug = "/";
     } else {
         $slug = $this->routeDao->findCurrentSlugByTarget($target);
         if (!$slug) {
             return NULL;
         }
         $slug = "/" . $slug;
     }
     $parameters = $appRequest->parameters;
     unset($parameters["action"], $parameters["id"]);
     $url = clone $refUrl;
     $url->setPath($slug);
     $url->setQuery($parameters);
     return $url;
 }
Пример #3
0
 public function render()
 {
     $target = $this->currentTarget->getCurrentTarget();
     $meta = $target && $target->getMeta() ? $target->meta : NULL;
     $this->template->setFile(__DIR__ . "/MetaTags.latte");
     $targetTitle = $meta ? $meta->seoTitle : NULL;
     $baseTitle = $this->settingsDao->getBaseTitle();
     if ($baseTitle and $targetTitle) {
         $title = $targetTitle . " - " . $baseTitle;
     } else {
         $title = $targetTitle . $baseTitle;
     }
     $this->template->title = $title;
     $this->template->keywords = $meta ? $meta->seoKeywords : NULL;
     $this->template->description = $meta ? $meta->seoDescription : NULL;
     $this->template->robots = $meta ? $meta->seoRobots : NULL;
     $this->template->render();
 }
Пример #4
0
 public function processForm(Form $form)
 {
     $this->settingsDao->setRobots($form->values->robots);
 }
 public function processForm(Form $form)
 {
     $this->settingsDao->setBaseTitle($form->values->baseTitle);
 }
 public function renderRobots()
 {
     $this->template->robots = $this->settingsDao->getRobots();
 }
 public function render()
 {
     $this->template->setFile(__DIR__ . "/GoogleAnalytics.latte");
     $this->template->googleAnalyticsKey = $this->settingsDao->getGoogleAnalyticsKey();
     $this->template->render();
 }
 public function processForm(Form $form)
 {
     $this->settingsDao->setGoogleAnalyticsKey($form->values->key);
 }