Exemplo n.º 1
0
 public function listPlugins()
 {
     $pathplugins = new backend_controller_plugins();
     /**
      * Si le dossier est accessible en lecture
      */
     if (!is_readable($pathplugins->directory_plugins())) {
         throw new exception('Plugin dir is not minimal permission');
     }
     $makefiles = new magixcjquery_files_makefiles();
     $dir = $makefiles->scanRecursiveDir($pathplugins->directory_plugins());
     if ($dir != null) {
         plugins_Autoloader::register();
         $list = '';
         foreach ($dir as $d) {
             if (file_exists($pathplugins->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) {
                 $pluginPath = $pathplugins->directory_plugins() . $d;
                 if ($makefiles->scanDir($pluginPath) != null) {
                     //Nom de la classe pour le test de la méthode
                     $class = 'plugins_' . $d . '_admin';
                     //Si la méthode run existe on ajoute le plugin dans le menu
                     if (method_exists($class, 'run')) {
                         $plugin[$class] = $d;
                     }
                 }
             }
         }
         return $plugin;
     }
 }
Exemplo n.º 2
0
 /**
  * @access private
  * @param $dir
  */
 private function cacheDir($dir)
 {
     $makefile = new magixcjquery_files_makefiles();
     $pathDir = $this->pathCacheDir($dir);
     if (file_exists($pathDir)) {
         $scandir = $makefile->scanDir($pathDir, array('.htaccess', '.gitignore'));
         $clean = '';
         if ($scandir != null) {
             foreach ($scandir as $file) {
                 $clean .= $makefile->removeFile($pathDir, $file);
             }
         }
     } else {
         $magixfire = new magixcjquery_debug_magixfire();
         $magixfire->magixFireError(new Exception('Error: var is not exist'));
     }
 }
Exemplo n.º 3
0
 /**
  * Scanne les plugins et vérifie si la fonction d'execution exist afin de l'intégrer dans le module
  * @access private
  * @param string $methodName
  * @return array|null
  */
 public function menu_item_plugin($methodName)
 {
     try {
         plugins_Autoloader::register();
         // Si le dossier est accessible en lecture
         if (!is_readable($this->directory_plugins())) {
             throw new exception('Error in load plugin: Plugin is not minimal permission');
         }
         $makefiles = new magixcjquery_files_makefiles();
         $dir = $makefiles->scanRecursiveDir($this->directory_plugins());
         if ($dir != null) {
             $data = '';
             $arrData = '';
             foreach ($dir as $d) {
                 if (file_exists($this->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) {
                     $pluginPath = $this->directory_plugins() . $d;
                     if ($makefiles->scanDir($pluginPath) != null) {
                         if (class_exists('plugins_' . $d . '_admin')) {
                             if (method_exists('plugins_' . $d . '_admin', $methodName)) {
                                 if (method_exists('plugins_' . $d . '_admin', 'setConfig')) {
                                     $class_name = $this->execute_plugins('plugins_' . $d . '_admin');
                                     $setConfig = $class_name->setConfig();
                                     if (array_key_exists('url', $setConfig)) {
                                         if (isset($setConfig['url']['name'])) {
                                             $data['name'] = $setConfig['url']['name'];
                                         } else {
                                             $data['name'] = $d;
                                         }
                                     }
                                     $data['url'] = $d;
                                 } else {
                                     $data['url'] = $d;
                                     $data['name'] = null;
                                 }
                                 $arrData[] = $data;
                             }
                         }
                     }
                 }
             }
             if (is_array($arrData)) {
                 $arr_item = $arrData;
             } else {
                 $arr_item = null;
             }
             return $arr_item;
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Exemplo n.º 4
0
 /**
  * Scanne les plugins et vérifie si la fonction createSitemap 
  * exist afin de l'intégrer dans le sitemap
  * @access private
  */
 private function writeplugin($idlang)
 {
     try {
         plugins_Autoloader::register();
         // Si le dossier est accessible en lecture
         if (!is_readable($this->directory_plugins())) {
             throw new exception('Error in writeplugin: Plugin is not minimal permission');
         }
         $makefiles = new magixcjquery_files_makefiles();
         $dir = $makefiles->scanRecursiveDir($this->directory_plugins());
         if ($dir != null) {
             foreach ($dir as $d) {
                 if (file_exists($this->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) {
                     $pluginPath = $this->directory_plugins() . $d;
                     if ($makefiles->scanDir($pluginPath) != null) {
                         if (class_exists('plugins_' . $d . '_admin')) {
                             $this->loadConfigPlugins('plugins_' . $d . '_admin', $idlang);
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
Exemplo n.º 5
0
 /**
  * @access public
  * Retourne un tableau avec les images sélectionné
  * @param string $directory
  * @param string $exclude
  * @param array $option
  * @return array|null
  * @throws Exception
  */
 public function scanImage($directory, $exclude, array $option = array('imgsize' => 'mini', 'reverse' => false))
 {
     $makeFiles = new magixcjquery_files_makefiles();
     if (file_exists($directory)) {
         $array_dir = $makeFiles->scanDir($directory, $exclude);
         if (is_array($option)) {
             switch ($option['imgsize']) {
                 case 'mini':
                     $imgsize = '/s_/';
                     break;
                 case 'medium':
                     $imgsize = '/m_/';
                     break;
                 default:
                     $imgsize = '/s_/';
                     break;
             }
             if ($array_dir != null) {
                 if (is_array($array_dir)) {
                     if ($option['reverse']) {
                         $tabs_files = preg_grep($imgsize, $array_dir, PREG_GREP_INVERT);
                     } else {
                         $tabs_files = preg_grep($imgsize, $array_dir);
                     }
                     return $tabs_files;
                 } else {
                     throw new Exception('Error scanImage :array_dir is not array');
                 }
             }
         } else {
             throw new Exception('Error scanImage :option is not array');
         }
     } else {
         return null;
     }
 }
Exemplo n.º 6
0
 /**
  * @access private
  * Scanne le dossier skin (public) et retourne les images ou capture des thèmes
  */
 private function scanTemplateDir($create)
 {
     $create->configLoad('local_' . backend_model_language::current_Language() . '.conf');
     $skin = $this->directory_skin();
     if (!is_readable($skin)) {
         throw new exception('skin is not minimal permission');
     }
     $makefiles = new magixcjquery_files_makefiles();
     $dir = $makefiles->scanRecursiveDir($skin, '.svn');
     $count = count($dir);
     if ($count == 0) {
         throw new exception('skin is not found');
     }
     if (!is_array($dir)) {
         throw new exception('skin is not array');
     }
     $template = null;
     foreach ($dir as $d) {
         if ($d == $this->load_theme()) {
             $btn_class = ' btn-primary';
             $btn_title = $create->getConfigVars('select');
         } else {
             $ctpl = '';
             $btn_class = ' btn-default';
             $btn_title = $create->getConfigVars('choose');
         }
         $themePath = self::directory_skin() . $d;
         if ($makefiles->scanDir($themePath) != null) {
             if (file_exists($themePath . '/screenshot.png')) {
                 $img = 'src="' . magixcjquery_html_helpersHtml::getUrl() . '/skin/' . $d . '/screenshot.png"';
                 $srcData = '';
             } else {
                 $img = 'src="' . magixcjquery_html_helpersHtml::getUrl() . '/skin/default/screenshot.png"';
                 $srcData = ' data-src="holder.js/260x180"';
             }
             $template .= '<li class="col-sm-4">';
             $template .= '<div class="thumbnail">';
             $template .= '<img ' . $img . $srcData . ' alt="' . $btn_title . '">';
             $template .= '<div class="caption">';
             $template .= '<h3>' . $d . '</h3>';
             $template .= '<p><a data-skin="' . $d . '" class="skin-tpl btn btn-large btn-block' . $btn_class . '" href="#">' . $btn_title . '</a></p>';
             $template .= '</div>';
             $template .= '</div>';
             $template .= '</li>';
         }
     }
     return $template;
 }