includes/template.php
changeset 1069 d54e7620bd3e
parent 1068 4bcefa85649c
parent 1061 4ef865b5f497
child 1072 604213a07ce0
--- a/includes/template.php	Fri Jul 17 20:48:53 2009 -0400
+++ b/includes/template.php	Fri Jul 31 19:15:48 2009 -0400
@@ -22,6 +22,7 @@
   var $page_id = false;
   var $namespace = false;
   var $js_preload = array();
+  var $js_append = '';
   
   /**
    * Page action conditions
@@ -470,6 +471,16 @@
   }
   
   /**
+   * Queue some HTML to be inserted after the Javascript runtime.
+   * @param string HTML glob
+   */
+  
+  function add_header_js($html)
+  {
+    $this->js_append .= "$html\n    ";
+  }
+  
+  /**
    * Global, only-called-once init. Goes to all themes.
    */
   
@@ -557,6 +568,7 @@
         window.onload = function(e) {  };
       }
     </script>
+    $this->js_append
 JSEOF;
     }
     else
@@ -604,6 +616,7 @@
         window.onload = function(e) {  };
       }
     //]]></script>
+    $this->js_append
 JSEOF;
     }
   
@@ -1757,7 +1770,7 @@
         $params = false;
       $escape = !empty($escape);
       
-      $result = makeUrlNS($namespace, $page_id, $params, $escape);
+      $result = makeUrlNS($namespace, sanitize_page_id($page_id), $params, $escape);
       
       if ( !$post_eval )
       {