コード例 #1
0
ファイル: storage.php プロジェクト: soremi/tutornavi
 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;
 }
コード例 #2
0
ファイル: gateways.php プロジェクト: soremi/tutornavi
 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;
 }
コード例 #3
0
ファイル: captchas.php プロジェクト: soremi/tutornavi
 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;
 }
コード例 #4
0
ファイル: plugins.php プロジェクト: soremi/tutornavi
 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;
 }
コード例 #5
0
ファイル: templates.php プロジェクト: soremi/tutornavi
 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;
 }
コード例 #6
0
ファイル: languages.php プロジェクト: soremi/tutornavi
 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;
 }
コード例 #7
0
ファイル: local.php プロジェクト: soremi/tutornavi
 public function resize($file, $dimensions, $suffix = '', $method = 'preserve')
 {
     // Set dimensions
     if (!is_array($dimensions) && $dimensions != '') {
         $dimensions = explode('x', $dimensions);
     }
     if ($dimensions) {
         // Load image library
         loader::library('image');
         // Set source
         if (!$this->image->setSource(BASEPATH . $this->relativePath . '/' . $file['path'] . '/' . $file['name'] . ($file['suffix'] != '' ? '_' . $file['suffix'] : '') . '.' . $file['extension'])) {
             $this->setError($this->image->getError());
             return false;
         }
         // Set target
         if (!$this->image->setTarget(BASEPATH . $this->relativePath . '/' . $file['path'] . '/' . $file['name'] . ($suffix != '' ? '_' . $suffix : '') . '.' . $file['extension'])) {
             $this->setError($this->image->getError());
             return false;
         }
         // Resize image
         if (!$this->image->resize($dimensions[0], $dimensions[1], $method)) {
             $this->setError($this->image->getError());
             return false;
         }
         $thumb = $this->image->getData();
     } else {
         $source = BASEPATH . $this->relativePath . '/' . $file['path'] . '/' . $file['name'] . ($file['suffix'] != '' ? '_' . $file['suffix'] : '') . '.' . $file['extension'];
         $target = BASEPATH . $this->relativePath . '/' . $file['path'] . '/' . $file['name'] . ($suffix != '' ? '_' . $suffix : '') . '.' . $file['extension'];
         loader::helper('file');
         $thumb = array('path' => $file['path'], 'name' => $file['name'], 'suffix' => $suffix, 'extension' => $file['extension'], 'size' => $file['size'], 'width' => $file['width'], 'height' => $file['height']);
         return file_helper::copy($source, $target) ? $thumb : false;
     }
     return $thumb;
 }
コード例 #8
0
ファイル: load.php プロジェクト: soremi/tutornavi
 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;
 }