Example #1
0
 public function scanPlugins($merge = true, $escape = true)
 {
     // Load file helper and read plugins directory
     loader::helper('file');
     $dirs = file_helper::scanDirectoryNames(DOCPATH . 'plugins');
     $plugins = array();
     // Loop through found directories
     foreach ($dirs as $plugin) {
         if ($manifest = $this->getManifest($plugin, false, $escape)) {
             $plugins[$plugin] = $manifest;
         }
     }
     // Do we need to merge results with installed plugins?
     if ($merge) {
         // Loop through installed plugins
         foreach ($this->getPlugins($escape) as $plugin) {
             if (isset($plugins[$plugin['keyword']])) {
                 $plugins[$plugin['keyword']]['plugin_id'] = $plugin['plugin_id'];
                 $plugins[$plugin['keyword']]['name'] = $plugin['name'];
                 $plugins[$plugin['keyword']]['version_new'] = $plugins[$plugin['keyword']]['version'];
                 $plugins[$plugin['keyword']]['version'] = $plugin['version'];
                 $plugins[$plugin['keyword']]['system'] = $plugin['system'];
             }
         }
     }
     // Order plugins
     ksort($plugins);
     return $plugins;
 }
Example #2
0
 public function scanLanguages($merge = true)
 {
     // Load file helper and read languages directory
     loader::helper('file');
     $dirs = file_helper::scanDirectoryNames(DOCPATH . 'languages');
     $languages = array();
     // Loop through found directories
     foreach ($dirs as $language) {
         if ($manifest = $this->getManifest($language)) {
             $languages[$language] = $manifest;
             $languages[$language]['default'] = 0;
         }
     }
     // Do we need to merge results with installed languages?
     if ($merge) {
         // Loop through installed languages
         foreach ($this->getlanguages() as $language) {
             if (isset($languages[$language['keyword']])) {
                 $languages[$language['keyword']]['language_id'] = $language['language_id'];
                 $languages[$language['keyword']]['default'] = $language['default'];
             } elseif (!isset($languages[$language['keyword']])) {
                 $languages[$language['keyword']] = $language;
             }
         }
     }
     // Order languages
     ksort($languages);
     return $languages;
 }
Example #3
0
 public function scanTemplates($merge = true)
 {
     // Load file helper and read templates directory
     loader::helper('file');
     $dirs = file_helper::scanDirectoryNames(BASEPATH . 'templates');
     $templates = array();
     // Loop through found directories
     foreach ($dirs as $template) {
         if ($manifest = $this->getManifest($template)) {
             $templates[$template] = $manifest;
             $templates[$template]['default'] = 0;
         }
     }
     // Do we need to merge results with installed templates?
     if ($merge) {
         // Loop through installed templates
         foreach ($this->getTemplates() as $template) {
             if (isset($templates[$template['keyword']])) {
                 $templates[$template['keyword']]['template_id'] = $template['template_id'];
                 $templates[$template['keyword']]['default'] = $template['default'];
             }
         }
     }
     // Order templates
     ksort($templates);
     return $templates;
 }