X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fplugins-dist%2Furls_etendues%2Furls%2Fhtml.php;fp=www%2Fplugins-dist%2Furls_etendues%2Furls%2Fhtml.php;h=900a885363417f88b3c954df772685a340524da2;hb=4f443dce95ff6f8221c189880a70c74ce1c1f238;hp=11e2ce8cc36fe2e832ae2f383b7db1dbedc5e5ef;hpb=4a628e9b277d3617535f99d663ca79fa2e891177;p=lhc%2Fweb%2Fwww.git diff --git a/www/plugins-dist/urls_etendues/urls/html.php b/www/plugins-dist/urls_etendues/urls/html.php index 11e2ce8c..900a8853 100644 --- a/www/plugins-dist/urls_etendues/urls/html.php +++ b/www/plugins-dist/urls_etendues/urls/html.php @@ -31,40 +31,45 @@ pouvez l'editer pour ne conserver que la partie concernant les URLS 'html'. */ -if (!defined("_ECRIRE_INC_VERSION")) return; // securiser +if (!defined('_ECRIRE_INC_VERSION')) { + return; +} // securiser # donner un exemple d'url pour le formulaire de choix define('URLS_HTML_EXEMPLE', 'article12.html'); // https://code.spip.net/@_generer_url_html -function _generer_url_html($type, $id, $args='', $ancre='') { - if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { +function _generer_url_html($type, $id, $args = '', $ancre = '') { + if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) { $url = $generer_url_externe($id, $args, $ancre); - if (NULL != $url) return $url; + if (null != $url) { + return $url; + } } - return _DIR_RACINE . $type . $id . '.html' . ($args ? "?$args" : '') .($ancre ? "#$ancre" : ''); + return _DIR_RACINE . $type . $id . '.html' . ($args ? "?$args" : '') . ($ancre ? "#$ancre" : ''); } // retrouver les parametres d'une URL dite "html" // https://code.spip.net/@urls_html_dist -function urls_html_dist($i, $entite, $args='', $ancre='') { +function urls_html_dist($i, $entite, $args = '', $ancre = '') { - if (is_numeric($i)) + if (is_numeric($i)) { return _generer_url_html($entite, $i, $args, $ancre); + } // recuperer les &debut_xx; - if (is_array($args)) + if (is_array($args)) { $contexte = $args; - else - parse_str($args,$contexte); + } else { + parse_str($args, $contexte); + } // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 - if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ - return array(array(),'404'); + if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') { + return array(array(), '404'); } - $url = $i; // voir s'il faut recuperer le id_* implicite et les &debut_xx; include_spip('inc/urls'); @@ -73,8 +78,10 @@ function urls_html_dist($i, $entite, $args='', $ancre='') { array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici // il n'est pas necessaire de forcer le fond en 4eme arg car l'url n'est pas query string // sauf si pas de fond connu - if ($entite) + if ($entite) { array_pop($r); + } + return $r; } @@ -86,22 +93,15 @@ function urls_html_dist($i, $entite, $args='', $ancre='') { */ // Si on est revenu en mode html, mais c'est une ancienne url_propre // on ne redirige pas, on assume le nouveau contexte (si possible) - $url_propre = isset($url) - ? $url - : (isset($_SERVER['REDIRECT_url_propre']) - ? $_SERVER['REDIRECT_url_propre'] - : (isset($_ENV['url_propre']) - ? $_ENV['url_propre'] - : '' - )); + $url_propre = $i; if ($url_propre) { - if ($GLOBALS['profondeur_url']<=0) - $urls_anciennes = charger_fonction('propres','urls'); - else - $urls_anciennes = charger_fonction('arbo','urls'); + if ($GLOBALS['profondeur_url'] <= 0) { + $urls_anciennes = charger_fonction('propres', 'urls'); + } else { + $urls_anciennes = charger_fonction('arbo', 'urls'); + } + return $urls_anciennes($url_propre, $entite, $contexte); } /* Fin du bloc compatibilite url-propres */ } - -?>