Exemple #1
0
 public function scanServices($merge = true)
 {
     // Load file helper and read storage services directory
     loader::helper('file');
     $dirs = file_helper::scanFileNames(DOCPATH . 'libraries/storages');
     $services = array();
     // Loop through found directories
     foreach ($dirs as $service) {
         // Remove file extension
         $service = substr($service, 0, -4);
         if ($manifest = $this->getManifest($service)) {
             $services[$service] = $manifest;
             $services[$service]['default'] = 0;
         }
     }
     // Do we need to merge results with installed storage services?
     if ($merge) {
         // Loop through installed storage services
         foreach ($this->getServices() as $service) {
             if (isset($services[$service['keyword']])) {
                 $services[$service['keyword']]['service_id'] = $service['service_id'];
                 $services[$service['keyword']]['default'] = $service['default'];
             }
         }
     }
     // Order services
     ksort($services);
     return $services;
 }
Exemple #2
0
 public function scanCaptchas($merge = true)
 {
     // Load file helper and read captcha directory
     loader::helper('file');
     $dirs = file_helper::scanFileNames(DOCPATH . 'libraries/captchas');
     $captchas = array();
     // Loop through found directories
     foreach ($dirs as $captcha) {
         // Remove file extension
         $captcha = substr($captcha, 0, -4);
         if ($manifest = $this->getManifest($captcha)) {
             $captchas[$captcha] = $manifest;
             $captchas[$captcha]['default'] = 0;
         }
     }
     // Do we need to merge results with installed captchas?
     if ($merge) {
         // Loop through installed captchas
         foreach ($this->getCaptchas() as $captcha) {
             if (isset($captchas[$captcha['keyword']])) {
                 $captchas[$captcha['keyword']]['captcha_id'] = $captcha['captcha_id'];
                 $captchas[$captcha['keyword']]['default'] = $captcha['default'];
             }
         }
     }
     // Order captchas
     ksort($captchas);
     return $captchas;
 }
Exemple #3
0
 public function scanGateways($merge = true)
 {
     $gateways = array();
     // Load file helper and read gateways directory
     loader::helper('file');
     $dirs = file_helper::scanFileNames(DOCPATH . 'libraries/payments');
     // Loop through found directories
     foreach ($dirs as $gateway) {
         // Remove file extension
         $gateway = substr($gateway, 0, -4);
         if ($manifest = $this->getManifest($gateway)) {
             $gateways[$gateway] = $manifest;
         }
     }
     // Do we need to merge results with installed gateways?
     if ($merge) {
         // Loop through installed gateways
         foreach ($this->getGateways(false, false) as $gateway) {
             if (isset($gateways[$gateway['keyword']])) {
                 $gateways[$gateway['keyword']]['gateway_id'] = $gateway['gateway_id'];
                 $gateways[$gateway['keyword']]['name'] = $gateway['name'];
                 $gateways[$gateway['keyword']]['active'] = $gateway['active'];
             }
         }
     }
     // Order gateways
     ksort($gateways);
     return $gateways;
 }
Exemple #4
0
 public function delete($language)
 {
     loader::helper('file');
     $path = DOCPATH . 'languages/' . $language;
     // Delete files
     if (@is_dir($path)) {
         foreach (file_helper::scanFileNames($path) as $file) {
             @unlink($path . '/' . $file);
         }
         @rmdir($path);
     }
     return true;
 }
Exemple #5
0
 protected function getStylesheets($template, $cp = false)
 {
     // Do we have css cached?
     if (($output = $this->cache->item('asset_css_' . ($cp ? 'cp' : 'fe') . '_' . session::item('language') . '_' . $template)) === false) {
         $output = $this->readStylesheet(BASEPATH . 'assets/css/cp/system', 'reset.css');
         $output .= $this->readStylesheet(BASEPATH . 'externals/colorbox', 'style.css');
         $output .= $this->readStylesheet(BASEPATH . 'externals/tipsy', 'style.css');
         // Scan plugins
         foreach (config::item('plugins', 'core') as $plugin) {
             if ($plugin['keyword'] != 'system') {
                 $path = BASEPATH . 'assets/css/' . ($cp ? 'cp/' : '') . $plugin['keyword'];
                 if (is_dir($path)) {
                     $files = file_helper::scanFileNames($path);
                     // Scan css files
                     foreach ($files as $file) {
                         // Do we have a valid css file?
                         if (strtolower(substr($file, -4)) == '.css' && file_exists($path . '/' . $file)) {
                             // Read css file
                             $output .= $this->readStylesheet($path, $file);
                         }
                     }
                 }
             }
         }
         // Is this a control panel css?
         if ($cp) {
             $output .= $this->readStylesheet(BASEPATH . 'assets/css/cp/system', 'style.css');
         } else {
             // $output .= $this->readStylesheet(BASEPATH . 'templates/' . $template . '/css', 'style.css');
         }
         // Cache css output
         $this->cache->set('asset_css_' . ($cp ? 'cp' : 'fe') . '_' . session::item('language') . '_' . $template, $output, 60 * 60 * 24 * 30);
     }
     return $output;
 }