function index($search = '', $search2 = '') { $html = ''; $content_type = 'text/javascript'; header("Content-type: {$content_type}"); $app = $this->config->item('nts_app'); $assets_dir = isset($GLOBALS['NTS_CONFIG'][$app]['ASSETS_DIR']) ? $GLOBALS['NTS_CONFIG'][$app]['ASSETS_DIR'] : ci_base_url('assets'); $css = array($assets_dir . '/bootstrap/css/_bootstrap.css', $assets_dir . '/css/lpr.css'); $js = array($assets_dir . '/bootstrap/js/bootstrap.min.js', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true', 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js', $assets_dir . '/js/lpr.js', $assets_dir . '/js/hc-load.js'); if (!(isset($GLOBALS['NTS_IS_PLUGIN']) && $GLOBALS['NTS_IS_PLUGIN'] == 'wordpress')) { array_unshift($js, $assets_dir . '/js/jquery-1.8.3.min.js'); } if ($search2) { $target = ci_site_url(array('front/start', $search, $search2)); } else { $target = ci_site_url(array('front/start', $search)); } $html .= <<<EOT var hc_target = "{$target}"; EOT; if (!$search) { $html .= <<<EOT var lpr_search = hc_get_param('lpr-search'); var lpr_search2 = hc_get_param('lpr-search2'); if( lpr_search && lpr_search2 ) \thc_target = hc_target + '/' + lpr_search + '/' + lpr_search2; else if( lpr_search ) \thc_target = hc_target + '/' + lpr_search; EOT; } $html .= <<<EOT function hc_get_param( name ) { \tname = name.replace(/[\\[]/,"\\\\[").replace(/[\\]]/,"\\\\]"); \tvar regexS = "[\\?&]"+name+"=([^&#]*)"; \tvar regex = new RegExp( regexS ); \tvar results = regex.exec( window.location.href ); \tif( results == null ) \t\treturn ""; \telse \t\treturn results[1]; } function hc_if_loaded( src, targetelement, targetattr ) { \tvar allsuspects = document.getElementsByTagName(targetelement); \tvar skip_me = false; \tfor( var i = allsuspects.length; i >= 0; i-- ) \t{ \t\tif( allsuspects[i] && (allsuspects[i].getAttribute(targetattr) != null) && (allsuspects[i].getAttribute(targetattr).indexOf(src) != -1) ) \t\t{ \t\t\tskip_me = true; \t\t\tbreak; \t\t} \t} \treturn skip_me; } function hc_get_js( src ) { \tif( ! hc_if_loaded(src, 'script', 'src') ) \t{ \t\tdocument.writeln('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>'); \t} } function hc_append_js( src ) { \tif( ! hc_if_loaded(src, 'script', 'src') ) \t{ \t\tvar fileref=document.createElement('script') \t\tfileref.setAttribute("type","text/javascript") \t\tfileref.setAttribute("src", src) \t\tdocument.getElementsByTagName('head')[0].appendChild( fileref ); \t} } function hc_get_css( src ) { \tif( ! hc_if_loaded(src, 'link', 'href') ) \t{ \t\tvar fileref = document.createElement('link'); \t\tfileref.setAttribute( 'rel', 'stylesheet' ); \t\tfileref.setAttribute( 'type', 'text/css' ); \t\tfileref.setAttribute( 'href', src ); \t\tdocument.getElementsByTagName('head')[0].appendChild( fileref ); \t} } EOT; reset($css); foreach ($css as $f) { $html .= "hc_get_css('{$f}');\n"; } foreach ($js as $f) { $html .= "hc_get_js('{$f}');\n"; } $html .= <<<EOT EOT; /* also include js init */ $js_init = $this->load->view('front_js', '', true); $html .= $js_init; echo $html; exit; }
<?php if (defined('NTS_DEVELOPMENT') && NTS_DEVELOPMENT) { $assets_dir = NTS_DEVELOPMENT . '/assets'; $assets_web_dir = 'http://localhost/'; } else { $assets_dir = dirname(__FILE__) . '/../../../assets'; $assets_web_dir = ci_base_url(''); } require $assets_dir . '/files.php'; $inline = isset($GLOBALS['NTS_INLINE']) && $GLOBALS['NTS_INLINE'] ? TRUE : FALSE; $style_loaded = isset($GLOBALS['NTS_STYLE_LOADED']) && $GLOBALS['NTS_STYLE_LOADED'] ? TRUE : FALSE; if (!$inline) { ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php echo isset($page_title) ? $page_title : ''; ?> </title> <?php if (isset($force_head) && $force_head) { require $force_head; } ?> <?php
echo ci_base_url('assets/css/lpr.css'); ?> " rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<?php echo ci_base_url('assets/js/jquery-1.8.3.min.js'); ?> "></script> <script type="text/javascript" src="<?php echo ci_base_url('assets/bootstrap/js/bootstrap.min.js'); ?> "></script> <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?v=3.exp&sensor=true"></script> <script type="text/javascript" src="//google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js"></script> <script type="text/javascript" src="<?php echo ci_base_url('assets/js/lpr.js'); ?> "></script> </head> <body> <?php } ?> <div class="hc"> <?php if ($message) { ?> <div class="alert alert-info"> <?php