/**
  * Returns a normalized array of the controller's helper names and configuration.
  * @return array
  */
 protected function getNormalizedHelpers()
 {
     if (isset($this->controller->helpers)) {
         return Hash::normalize((array) $this->controller->helpers);
     }
     return array();
 }
 /**
  * Overrides the default i18n function in order to use
  * our custom Locale object and have our own set of functions.
  * @return array
  */
 protected function rebuildLocaleList()
 {
     $app = Strata::app();
     $original = Hash::normalize($app->getConfig("i18n.locales"));
     $newLocales = array();
     foreach ($original as $key => $config) {
         $newLocales[$key] = new Locale($key, $config);
     }
     return $newLocales;
 }
 /**
  * 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;
 }
Beispiel #4
0
 /**
  * Normalized the full list of attribute. This is not performed 'deep'.
  */
 private function normalizeAttributes()
 {
     $this->attributes = Hash::normalize($this->attributes);
 }
Beispiel #5
0
 /**
  * Goes through the list of localization configurations values in Strata's
  * configuration file.
  * @return array A list of instantiated Locale object.
  */
 protected function parseLocalesFromConfig()
 {
     $localeInfos = Hash::normalize((array) Strata::config("i18n.locales"));
     $locales = array();
     foreach ($localeInfos as $key => $config) {
         $locales[$key] = new Locale($key, $config);
     }
     return $locales;
 }
 /**
  * Normalizes the configuration cache. This will only run once
  * on the object. It is mainly a safegard against a badly configured
  * value cache.
  * @return null
  */
 protected function normalizeConfiguration()
 {
     if (!$this->isConfigurableNormalized) {
         $this->configuration = Hash::normalize($this->configuration);
     }
 }
 /**
  * Loads ~/config/strata.php, cleans up the data and saves it as
  * the active configuration of the current instance of the Strata object.
  * @return  array Configuration array
  */
 public static function parseProjectConfigFile()
 {
     $configFile = self::getProjectConfigurationFilePath();
     if (file_exists($configFile)) {
         $strata = (include $configFile);
         if (isset($strata) && count($strata)) {
             return Hash::normalize($strata);
         }
     }
 }