Ejemplo n.º 1
0
 /**
  * returns the items of static array $js
  *
  * @access public
  * @return HTML
  *
  **/
 public static function getJavaScripts($for = 'header')
 {
     if ($for == 'header') {
         $static =& CAT_Helper_Page::$js;
     } else {
         $static =& CAT_Helper_Page::$f_js;
     }
     // if there was some CSS added meanwhile...
     if ($for == 'footer' && count(CAT_Helper_Page::$css)) {
         $arr = CAT_Helper_Page::$css;
         CAT_Helper_Page::$css = array();
         self::_analyze_css($arr);
         // fixes paths
         $css = self::getCSS(NULL, true);
         $js = '<script type="text/javascript">';
         foreach ($css as $item) {
             $js .= '$("head").append("<link rel=\\"stylesheet\\" href=\\"' . $item . '\\" type=\\"text/css\\" media=\\"screen,projection\\" />");';
         }
         $js .= '</script>';
         $static[] = $js;
     }
     if (is_array($static) && count($static)) {
         $static = array_unique($static);
         return implode("\n", $static) . "\n";
     }
     return NULL;
 }