/** * Récupère un chemin de ressource (situé dans www) * * Ira chercher dans l'ordre de priorité dans * ./nom_theme/lang_COUNTRY/$path * ./nom_theme/lang/$path * ./nom_theme/$path * ./default/lang_COUNTRY/$path * ./default/lang/$path * ./default/$path * ./$path * * <code> * //on souhaites récupérer la feuille de style * $path = CopixURL::getRessource ('styles/copix.css'); * //$path == http://www.domaine.fr/chemin/vers/le/script/themes/nom_du_theme/styles/copix.css si le fichier existe * </code> * * @param string $resourcePath le chemin du fichier que l'on souhaites récupérer * www/$ressourcePath (doit représenter un fichier) * @return string le $ressourcePath complet en fonction des thèmes */ public static function getResource($pResourcePath) { static $calculated = array(); $theme = CopixTpl::getTheme(); $i18n = CopixConfig::instance()->i18n_path_enabled; $lang = CopixI18N::getLang(); $country = CopixI18N::getCountry(); $key = $theme . $i18n . $lang . $country . $pResourcePath; if (isset($calculated[$key])) { return $calculated[$key]; } list($resourcePath, $moduleName, $modulePath) = self::_parseResourcePath($pResourcePath); // Utilise CopixResource pour trouver la ressource return $calculated[$key] = CopixResource::findResourceUrl($resourcePath, $moduleName, $modulePath, $theme, $i18n, $lang, $country); }