Changeset 59686 in spip-zone for _plugins_/ajax_nav/ajax_nav_insert_head.php
- Timestamp:
- Mar 24, 2012, 4:47:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/ajax_nav/ajax_nav_insert_head.php
r58261 r59686 2 2 function ajax_nav_insert_head($flux) { 3 3 4 $options = unserialize($GLOBALS['meta']['ajax_nav_config']); 4 $res = sql_select('valeur', 'spip_meta', 'nom="ajax_nav_config"'); 5 $options = array(); 6 if (sql_count($res) == 1) { 7 $options = sql_fetch($res); 8 $options = unserialize($options['valeur']); 5 9 6 function prepare($options) { 7 $options = preg_replace("/[^a-zA-Z0-9\-\_]+/", "', ", $options); 8 $options = preg_replace("/([a-zA-Z0-9\-\_]+)/", "'$1", $options); 9 $options = preg_replace("/([^'])$/", "$1'", $options); 10 return $options; 10 /* evite les problemes lors de mises a jour du plugin */ 11 if ( ! $options['autoReplaceDivs'] ) { 12 $options['autoReplaceDivs'] = 'on'; 13 } 14 } 15 16 function prepare($option) { 17 $option = preg_replace("/[^a-zA-Z0-9\-\_]+/", "', ", $option); 18 $option = preg_replace("/([a-zA-Z0-9\-\_]+)/", "'$1", $option); 19 $option = preg_replace("/([^'])$/", "$1'", $option); 20 return $option; 11 21 } 12 22 … … 20 30 $flux .= "<script type='text/javascript' src='" . find_in_path("lib/modernizr.js") . "'></script>"; 21 31 } 32 33 $auto_replace_divs = ($options["autoReplaceDivs"] == "on") ? 'true' : 'false'; 22 34 23 35 $flux .= "<script type='text/javascript'> … … 42 54 pagesToAjaxify: [" . prepare($options["pagesToAjaxify"]) . "], 43 55 ajaxDivs: [" . prepare($options["ajaxDivs"]) . "], 44 localizedDivs: [" . prepare($options["localizedDivs"]) . "] 56 localizedDivs: [" . prepare($options["localizedDivs"]) . "], 57 autoReplaceDivs: " . $auto_replace_divs . " 45 58 }; 46 59 AjaxNav();
Note: See TracChangeset
for help on using the changeset viewer.