private function replaceDefaultTaxonomySlug($url, $taxonomyDetails)
 {
     $localeCode = $this->currentLocale->getCode();
     if (Hash::check((array) $taxonomyDetails->i18n, "{$localeCode}.rewrite.slug")) {
         return Utility::replaceFirstOccurence(Hash::get($taxonomyDetails->i18n, "{$localeCode}.rewrite.slug"), $taxonomyDetails->rewrite['slug'], $url);
     }
     return $url;
 }
 protected function removeLocalizedRoutedSlugs($route, $model)
 {
     if (!$this->currentLocale->isDefault() && is_array($model->routed)) {
         $key = "i18n." . $this->currentLocale->getCode() . ".rewrite";
         if (Hash::check($model->routed, $key)) {
             foreach (Hash::get($model->routed, $key) as $rewriteKey => $rewriteUrl) {
                 if (Hash::check($model->routed, "rewrite.{$rewriteKey}")) {
                     $defaultValue = Hash::get($model->routed, "rewrite.{$rewriteKey}");
                     $route = Utility::replaceFirstOccurence($rewriteUrl, $defaultValue, $route);
                 }
             }
         }
     }
     return $route;
 }
 protected function extractLocalizedInformation()
 {
     foreach ($this->getLocales() as $locale) {
         $localeCode = $locale->getCode();
         foreach ($this->model->routed['rewrite'] as $routeKey => $routeUrl) {
             $localizedUrl = $routeUrl;
             $localizedPath = "i18n.{$localeCode}.rewrite.{$routeKey}";
             if (Hash::check($this->model->routed, $localizedPath)) {
                 $localizedUrl = Hash::get($this->model->routed, $localizedPath);
             }
             $route = $this->createRouteFor($routeKey, $localizedUrl, array($localizedUrl, $routeUrl));
             $this->addRoute($route);
             $this->queueRewrite($localizedUrl, $this->defaultSlug, $locale);
         }
     }
 }
 protected function extractLocalizedInformation()
 {
     if ($this->modelSupportsRewrites()) {
         foreach ($this->getLocales() as $locale) {
             $localeCode = $locale->getCode();
             $localizedSlug = $this->model->hasConfig("i18n.{$localeCode}.rewrite.slug") ? $this->model->getConfig("i18n.{$localeCode}.rewrite.slug") : $this->defaultSlug;
             foreach ($this->model->routed['rewrite'] as $routeKey => $routeUrl) {
                 $localizedUrl = $routeUrl;
                 $localizedPath = "i18n.{$localeCode}.rewrite.{$routeKey}";
                 if (Hash::check($this->model->routed, $localizedPath)) {
                     $localizedUrl = Hash::get($this->model->routed, $localizedPath);
                 }
                 $this->addRoute($this->createRouteFor($localizedUrl, $localizedSlug));
                 $this->queueRewrite($localizedUrl, $localizedSlug, $locale);
             }
         }
     }
 }
Beispiel #5
0
 /**
  * Returns the cookie parameter matching $key.
  * @param string $key The name of the cookie value
  * @return mixed
  */
 public function cookie($key)
 {
     return Hash::get($this->_COOKIE, $key);
 }
 /**
  * Fetches a value in the configuration array
  * @param string $key In dot-notation format
  * @return mixed
  */
 public function getConfig($key)
 {
     return Hash::get($this->getConfiguration(), $key);
 }