public function __construct($id = 0)
 {
     $this->id = $id + 0;
     $this->read_manifest();
     parent::__construct();
     //on va chercher le contenu de la boite noire...
     $this->fetch_managed_datas();
 }
 public static function read_manifest()
 {
     global $base_path;
     $informations = array();
     @ini_set("zend.ze1_compatibility_mode", "0");
     $manifest = new domDocument();
     $module_path = realpath(dirname($base_path . "/cms/modules/" . str_replace("cms_module_", "", get_called_class()) . "/" . get_called_class() . ".class.php"));
     $manifest->load($module_path . "/manifest.xml");
     //on récupère le nom
     $name = $manifest->getElementsByTagName("name")->item(0);
     $informations['informations']['name'] = cms_module_root::charset_normalize($name->nodeValue, "utf-8");
     //on récupère le(les) auteur(s)
     $informations['informations']['author'] = array();
     $authors = $manifest->getElementsByTagName("author");
     for ($i = 0; $i < $authors->length; $i++) {
         $author = array();
         //on récupère son nom
         $author['name'] = cms_module_root::charset_normalize($authors->item($i)->getElementsByTagName('name')->item(0)->nodeValue, "utf-8");
         //on récupère son organisation
         $organisation = $authors->item($i)->getElementsByTagName("organisation");
         if ($organisation->length > 0) {
             $author['organisation'] = cms_module_root::charset_normalize($organisation->item(0)->nodeValue, "utf-8");
         }
         $informations['informations']['author'][] = $author;
     }
     //on récupère les dates
     $created_date = $manifest->getElementsByTagName("created_date")->item(0);
     $informations['informations']['created_date'] = cms_module_root::charset_normalize($created_date->nodeValue, "utf-8");
     $updated_date = $manifest->getElementsByTagName("updated_date");
     if ($updated_date->length > 0) {
         $informations['informations']['updated_date'] = cms_module_root::charset_normalize($updated_date->item(0)->nodeValue, "utf-8");
     }
     //on récupère la version
     $version = $manifest->getElementsByTagName("version")->item(0);
     $informations['informations']['version'] = cms_module_root::charset_normalize($version->nodeValue, "utf-8");
     // on récupère la langue par défaut du module...
     $informations['informations']['default_language'] = self::get_module_default_language($manifest);
     // administrable?
     $informations['informations']['managed'] = $manifest->getElementsByTagName("managed") && $manifest->getElementsByTagName("managed")->item(0)->nodeValue == "true" ? true : false;
     //fournisseur de liens?
     $informations['informations']['extension_form'] = $manifest->getElementsByTagName("extension_form") && $manifest->getElementsByTagName("extension_form")->item(0)->nodeValue == "true" ? true : false;
     @ini_set("zend.ze1_compatibility_mode", "0");
     //on récupère la listes des éléments utilisés par le module...
     $use = $manifest->getElementsbyTagName("use")->item(0);
     $informations['elements_used'] = self::read_elements_used($use);
     @ini_set("zend.ze1_compatibility_mode", "1");
     return $informations;
 }
 protected function fetch_managed_datas($type = "datasources")
 {
     parent::fetch_managed_datas($type);
 }
 protected function get_exported_datas()
 {
     $infos = parent::get_exported_datas();
     $infos['type'] = "filter";
     return $infos;
 }
Ejemplo n.º 5
0
 public function utf8_normalize($elem)
 {
     global $charset;
     if ($charset != "utf-8") {
         return cms_module_root::utf8_encode($elem);
     } else {
         return $elem;
     }
 }
 protected function fetch_managed_datas()
 {
     parent::fetch_managed_datas("datasources");
 }
Ejemplo n.º 7
0
 protected function obj2array($obj)
 {
     $array = array();
     if (is_object($obj)) {
         foreach ($obj as $key => $value) {
             if (is_object($value)) {
                 $value = cms_module_root::obj2array($value);
             }
             $array[$key] = $value;
         }
     } else {
         $array = $obj;
     }
     return $array;
 }