/**
  * This method is charged to get the value of the property specified as the second argument for the module 
  * specified as the first argument.
  * @param string $module_name
  * @param string $property_name
  * @return the value of the property if everything went fine, false otherwise.
  */
 public function getModuleProperty($module_name, $property_name)
 {
     //Check if the two arguments are set:
     if (is_null($module_name) || empty($module_name)) {
         if (is_null($property_name) || empty($property_name)) {
             Kernel::setError('An error occured while getting an unspecified property of an unspecified module.');
             return false;
         } else {
             Kernel::setError('An error occured while getting an the property ' . $property_name . ' of an unspecified module.');
             return false;
         }
     } else {
         if (is_null($property_name) || empty($property_name)) {
             Kernel::setError('An error occured while getting an unspecified property of the module ' . $module_name . '.');
             return false;
         }
     }
     $applications = simplexml_load_file($this->getFile());
     $dom_applications = dom_import_simplexml($applications);
     //Initialize the return value to false if an error occurs:
     $property_value = false;
     /*------------------------------------------------------------------------------------------------------------------------*/
     //Parse all the applications:
     foreach ($dom_applications->getElementsByTagName('application') as $application) {
         //For each application, parse all of the modules and  check if the module is the one passed as the first argument:
         $module_number = 0;
         foreach ($application->getElementsByTagName('module') as $module) {
             if ($module->getElementsByTagName('name')->item(0)->nodeValue == $module_name) {
                 if (isset($dom_module_node)) {
                     //If the variable $dom_module_node is set, this means we've already found a module whose name
                     //matches the module name passed as the first argument. This means there are several modules
                     //with the same name.
                     exit('Plusieurs module ont le même nom');
                 } else {
                     $dom_module_node = $application->getElementsByTagName('module')->item($module_number);
                 }
             } else {
                 $module_number++;
             }
         }
     }
     //Check if the module we've found is the correct one:
     if ($dom_module_node->getElementsByTagName('name')->item(0)->nodeValue != $module_name) {
         exit('Module not found');
     }
     /*------------------------------------------------------------------------------------------------------------------------*/
     //Check if the property passed as the third argument exists:
     $dom_node_property = $dom_module_node->getElementsByTagName($property_name);
     if (!empty($dom_node_property)) {
         //Check if there is only one property which has the specified name:
         if ($dom_node_property->length > 1) {
             exit('');
         } else {
             //If everything is ok, get the property value:
             $property_value = $dom_node_property->item(0)->nodeValue;
         }
     }
     //Return the property value if the property exists and is unique, false otherwise:
     return $property_value;
 }
 /**
  *
  * @param string $param
  */
 public static function getDefault($param_to_search)
 {
     libxml_use_internal_errors(true);
     $param_value = '';
     //Get the xml configuration file as a DOM element:
     if (!($parameters = simplexml_load_file(ProjectConfiguration::guessRootDir() . '/config/' . self::getUserPrefix() . '_' . self::DEFAULT_PARAMS_FILE))) {
         Kernel::setError('Error while reading ' . self::getUserPrefix() . '_' . self::DEFAULT_PARAMS_FILE . ': the file probably doesn\'t exists');
         return false;
     }
     $dom_parameters = dom_import_simplexml($parameters);
     //For each parameter found,
     foreach ($dom_parameters->getElementsByTagName('param') as $param) {
         //Get the name and the value of the parameter:
         $param_name = $param->getElementsByTagName('name')->item(0)->nodeValue;
         //If the param is the one we're looking for:
         if ($param_to_search == $param_name) {
             return $param->getElementsByTagName('value')->item(0)->nodeValue;
         }
     }
     libxml_use_internal_errors(false);
     return $param_value;
 }