Example #1
0
 public function deleteUploads()
 {
     $uploads_dir = MPATH_MEDIA . '/' . $this->context;
     if (MFolder::exists($uploads_dir)) {
         return;
     }
     MFolder::delete($uploads_dir);
 }
Example #2
0
 protected static function &_load($module_id = null)
 {
     /*if (self::$modules !== null) {
     			return self::$modules;
     		}*/
     mimport('framework.filesystem.folder');
     if (!MFolder::exists(MPATH_MODULES)) {
         self::$modules = 0;
         return self::$modules;
     }
     $folders = MFolder::folders(MPATH_MODULES);
     if (empty($folders)) {
         self::$modules = 0;
         return self::$modules;
     }
     self::$modules = array();
     foreach ($folders as $folder) {
         if (strpos($folder, 'quickicons')) {
             continue;
         }
         $mod = new stdClass();
         $mod->id = $folder;
         $mod->title = $folder;
         $mod->module = $folder;
         $mod->name = $folder;
         $mod->menuid = 0;
         $mod->position = $folder;
         $mod->user = 0;
         $mod->params = null;
         $mod->style = null;
         $mod->content = '';
         $mod->showtitle = 0;
         $mod->control = '';
         $params = MFactory::getWOption('widget_' . $folder . '_widget', false, $module_id);
         if ($params != null) {
             $mod->params = json_encode($params);
         }
         self::$modules[] = $mod;
     }
     return self::$modules;
 }
Example #3
0
 protected static function _load()
 {
     if (self::$plugins !== null) {
         return self::$plugins;
     }
     mimport('framework.filesystem.folder');
     if (!MFolder::exists(MPATH_PLUGINS)) {
         self::$plugins = array();
         return self::$plugins;
     }
     $folders = MFolder::folders(MPATH_PLUGINS);
     if (empty($folders)) {
         self::$plugins = array();
         return self::$plugins;
     }
     self::$plugins = array();
     foreach ($folders as $folder) {
         $folder = str_replace('plg_', '', $folder);
         list($type, $name) = explode('_', $folder);
         $plg = new stdClass();
         $plg->type = $type;
         $plg->name = $name;
         $plg->params = null;
         $xml_file = MPATH_MIWI . '/plugins/plg_' . $type . '_' . $name . '/' . $name . '.xml';
         if (file_exists($xml_file)) {
             $form = MForm::getInstance($folder . '_form', $xml_file, array(), false, 'config');
             $field_sets = $form->getFieldsets();
             if (!empty($field_sets)) {
                 $params = array();
                 foreach ($field_sets as $name => $field_set) {
                     foreach ($form->getFieldset($name) as $field) {
                         $field_name = $field->get('fieldname');
                         $field_value = $field->get('value');
                         $params[$field_name] = $field_value;
                     }
                 }
                 $plg->params = json_encode($params);
             }
         }
         self::$plugins[] = $plg;
     }
     return self::$plugins;
 }
Example #4
0
 public static function exists($lang, $basePath = MPATH_WP_PLG)
 {
     static $paths = array();
     // Return false if no language was specified
     if (!$lang) {
         return false;
     }
     if (is_admin()) {
         $path = "{$basePath}/miwi/languages/admin/{$lang}";
     } else {
         $path = "{$basePath}/miwi/languages/site/{$lang}";
     }
     // Return previous check results if it exists
     if (isset($paths[$path])) {
         return $paths[$path];
     }
     // Check if the language exists
     mimport('framework.filesystem.folder');
     $paths[$path] = MFolder::exists($path);
     return $paths[$path];
 }