includes/template.php
changeset 1069 d54e7620bd3e
parent 1068 4bcefa85649c
parent 1061 4ef865b5f497
child 1072 604213a07ce0
equal deleted inserted replaced
1068:4bcefa85649c 1069:d54e7620bd3e
    20   var $page_initted = false;
    20   var $page_initted = false;
    21   var $elements = false;
    21   var $elements = false;
    22   var $page_id = false;
    22   var $page_id = false;
    23   var $namespace = false;
    23   var $namespace = false;
    24   var $js_preload = array();
    24   var $js_preload = array();
       
    25   var $js_append = '';
    25   
    26   
    26   /**
    27   /**
    27    * Page action conditions
    28    * Page action conditions
    28    * @var array
    29    * @var array
    29    */
    30    */
   468       
   469       
   469     $this->js_preload = array_values(array_merge($this->js_preload, $files));
   470     $this->js_preload = array_values(array_merge($this->js_preload, $files));
   470   }
   471   }
   471   
   472   
   472   /**
   473   /**
       
   474    * Queue some HTML to be inserted after the Javascript runtime.
       
   475    * @param string HTML glob
       
   476    */
       
   477   
       
   478   function add_header_js($html)
       
   479   {
       
   480     $this->js_append .= "$html\n    ";
       
   481   }
       
   482   
       
   483   /**
   473    * Global, only-called-once init. Goes to all themes.
   484    * Global, only-called-once init. Goes to all themes.
   474    */
   485    */
   475   
   486   
   476   function init_global_vars()
   487   function init_global_vars()
   477   {
   488   {
   555       {
   566       {
   556         enano_init();
   567         enano_init();
   557         window.onload = function(e) {  };
   568         window.onload = function(e) {  };
   558       }
   569       }
   559     </script>
   570     </script>
       
   571     $this->js_append
   560 JSEOF;
   572 JSEOF;
   561     }
   573     }
   562     else
   574     else
   563     {
   575     {
   564       $cdnpath = cdnPath;
   576       $cdnpath = cdnPath;
   602       {
   614       {
   603         enano_init();
   615         enano_init();
   604         window.onload = function(e) {  };
   616         window.onload = function(e) {  };
   605       }
   617       }
   606     //]]></script>
   618     //]]></script>
       
   619     $this->js_append
   607 JSEOF;
   620 JSEOF;
   608     }
   621     }
   609   
   622   
   610     
   623     
   611     $this->assign_bool(array(
   624     $this->assign_bool(array(
  1755       
  1768       
  1756       if ( !$params )
  1769       if ( !$params )
  1757         $params = false;
  1770         $params = false;
  1758       $escape = !empty($escape);
  1771       $escape = !empty($escape);
  1759       
  1772       
  1760       $result = makeUrlNS($namespace, $page_id, $params, $escape);
  1773       $result = makeUrlNS($namespace, sanitize_page_id($page_id), $params, $escape);
  1761       
  1774       
  1762       if ( !$post_eval )
  1775       if ( !$post_eval )
  1763       {
  1776       {
  1764         $result = str_replace('\\', '\\\\', $result);
  1777         $result = str_replace('\\', '\\\\', $result);
  1765         $result = str_replace('\'', '\\\'', $result);
  1778         $result = str_replace('\'', '\\\'', $result);