Exemplo n.º 1
0
 /**
  * Load and return the feed_language dropdown options
  *
  * @return array
  */
 public function getFeedLanguageOptions()
 {
     $pluginPath = PluginManager::instance()->getPluginPath(Plugin::KODERHUT_RSSFEEDSTER_NS);
     $path = $pluginPath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'language_codes.yaml';
     if (!File::exists($path)) {
         return [];
     }
     $languages = YamlParser::parseFile($path);
     $languages = is_array($languages) ? array_flip($languages) : [];
     return $languages;
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @access  protected
  */
 protected function __construct()
 {
     $plugins_cache_id = '';
     $plugin_manifest = [];
     $plugin_settings = [];
     // Get Plugins List
     $plugins_list = Config::get('system.plugins');
     // If Plugins List isnt empty then create plugin cache ID
     if (is_array($plugins_list) && count($plugins_list) > 0) {
         // Go through...
         foreach ($plugins_list as $plugin) {
             if (File::exists($_plugin = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
                 $plugins_cache_id .= filemtime($_plugin);
             }
         }
         // Create Unique Cache ID for Plugins
         $plugins_cache_id = md5('plugins' . ROOT_DIR . PLUGINS_PATH . $plugins_cache_id);
     }
     // Get plugins list from cache or scan plugins folder and create new plugins cache item
     if (Cache::driver()->contains($plugins_cache_id)) {
         Config::set('plugins', Cache::driver()->fetch($plugins_cache_id));
     } else {
         // If Plugins List isnt empty
         if (is_array($plugins_list) && count($plugins_list) > 0) {
             // Go through...
             foreach ($plugins_list as $plugin) {
                 if (File::exists($_plugin_manifest = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
                     $plugin_manifest = Yaml::parseFile($_plugin_manifest);
                 }
                 if (File::exists($_plugin_settings = PLUGINS_PATH . '/' . $plugin . '/settings.yml')) {
                     $plugin_settings = Yaml::parseFile($_plugin_settings);
                 }
                 $_plugins_config[File::name($_plugin_manifest)] = array_merge($plugin_manifest, $plugin_settings);
             }
             Config::set('plugins', $_plugins_config);
             Cache::driver()->save($plugins_cache_id, $_plugins_config);
         }
     }
     // Include enabled plugins
     if (is_array(Config::get('plugins')) && count(Config::get('plugins')) > 0) {
         foreach (Config::get('plugins') as $plugin_name => $plugin) {
             if (Config::get('plugins.' . $plugin_name . '.enabled')) {
                 include_once PLUGINS_PATH . '/' . $plugin_name . '/' . $plugin_name . '.php';
             }
         }
     }
     // Run Actions on plugins_loaded
     Action::run('plugins_loaded');
 }
Exemplo n.º 3
0
 /**
  * Template factory
  *
  *  <code>
  *      $template = Template::factory('templates_path');
  *  </code>
  *
  * @param string|Fenom\ProviderInterface $source path to templates or custom provider
  * @param string $compile_dir path to compiled files
  * @param int|array $options
  * @throws InvalidArgumentException
  * @return Fenom
  */
 public static function factory($source, $compile_dir = '/tmp', $options = 0)
 {
     // Create fenom cache directory if its not exists
     !Dir::exists(CACHE_PATH . '/fenom/') and Dir::create(CACHE_PATH . '/fenom/');
     // Create Unique Cache ID for Theme
     $theme_config_file = THEMES_PATH . '/' . Config::get('system.theme') . '/' . Config::get('system.theme') . '.yml';
     $theme_cache_id = md5('theme' . ROOT_DIR . $theme_config_file . filemtime($theme_config_file));
     // Set current them options
     if (Cache::driver()->contains($theme_cache_id)) {
         Config::set('theme', Cache::driver()->fetch($theme_cache_id));
     } else {
         $theme_config = Yaml::parseFile($theme_config_file);
         Config::set('theme', $theme_config);
         Cache::driver()->save($theme_cache_id, $theme_config);
     }
     $compile_dir = CACHE_PATH . '/fenom/';
     $options = Config::get('system.fenom');
     $fenom = parent::factory($source, $compile_dir, $options);
     $fenom->assign('config', Config::getConfig());
     return $fenom;
 }
Exemplo n.º 4
0
 /**
  * Constructor.
  *
  * @access  protected
  */
 protected function __construct()
 {
     static::$config['site'] = Yaml::parseFile(CONFIG_PATH . '/' . 'site.yml');
     static::$config['system'] = Yaml::parseFile(CONFIG_PATH . '/' . 'system.yml');
 }
Exemplo n.º 5
0
 /**
  * [getFields description]
  *
  * @param  [string] $filename The template name
  *
  * @return [type]           [description]
  */
 private function getFields($filename)
 {
     $fields = [];
     $fullPath = $this->getDir() . 'forms/' . $filename . '.yaml';
     if (file_exists($fullPath)) {
         $fields = \Yaml::parseFile($fullPath);
     }
     $defaultFieldsPath = $this->getDir() . 'forms/_default.yaml';
     if (file_exists($defaultFieldsPath)) {
         $defaultFields = \Yaml::parseFile();
         foreach ($defaultFields['fields'] as $name => $field) {
             $fields['fields'][$name] = $field;
         }
     }
     return $fields;
 }