private function rewriteStrataTaxonomy($taxonomyKey, $config)
 {
     try {
         $taxonomy = Taxonomy::factory(substr($taxonomyKey, 4));
         $localizedSlugs = array_merge(array($taxonomy->hasConfig("rewrite.slug") ? $taxonomy->getConfig("rewrite.slug") : $taxonomyKey), $taxonomy->extractConfig("i18n.{s}.rewrite.slug"));
         $this->addTaxonomyRewrites(implode("|", $localizedSlugs), $config->query_var);
     } catch (Exception $e) {
         Strata::app()->log("Tried to translate {$taxonomyKey}, but could not find the associated model.", "<magenta>Polyglot:UrlRewriter</magenta>");
     }
 }
 public static function factoryFromKey($wordpressKey)
 {
     if (preg_match('/_?cpt_(\\w+)/', $wordpressKey, $matches)) {
         return self::factory($matches[1]);
     } elseif (preg_match('/_?tax_(\\w+)/', $wordpressKey, $matches)) {
         return Taxonomy::factory($matches[1]);
     } elseif (preg_match('/_?(post|page)/', $wordpressKey, $matches)) {
         return self::factory($matches[1]);
     }
 }
 private function batchTaxonomyFileRegistrationAttempt($files = array())
 {
     foreach ($files as $filename) {
         try {
             $potentialClassName = basename(substr($filename, 0, -4));
             $model = Taxonomy::factory($potentialClassName);
             $this->attemptRuleExtraction($model);
         } catch (Exception $e) {
             // falure only means its not a Strata model.
         }
     }
 }
 /**
  * Gets the associated taxonomy objects.
  * @return array
  */
 public function getTaxonomies()
 {
     $tax = array();
     foreach (Hash::normalize($this->belongs_to) as $taxonomyName => $taxonomyConfig) {
         if (class_exists($taxonomyName)) {
             $tax[] = new $taxonomyName();
         } else {
             $tax[] = Taxonomy::factory($taxonomyName);
         }
     }
     return $tax;
 }