Beispiel #1
0
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />

{meta}

<link rel="stylesheet" type="text/css" href="<?php 
echo get_theme_path();
?>
style.css" />

<?php 
do_action('head');
?>
</head>
<body class="{body_class} <?php 
body_classes();
?>
">

<div id="header-container">
    <div id="header">
        <h1>520Frame</h1>
		<div id="nav">
			
		</div>
        <div class="clear"></div>
    </div>
</div><!-- CLOSE HEADER WRAPPER -->
<div class="container">
		<?php 
global $post;
$post_type = get_post_type($post->ID);
if (($stylesheet_id = get_post_meta($post->ID, $post_type . '_stylesheet', True)) !== False && ($stylesheet_url = wp_get_attachment_url($stylesheet_id)) !== False) {
    ?>
		<link rel="stylesheet" href="<?php 
    echo $stylesheet_url;
    ?>
" type="text/css" media="all">
		<?php 
}
?>

	</head>
	<body ontouchstart class="<?php 
echo body_classes();
?>
">
		<div class="container">
			<div class="row">
				<div id="header" class="row-border-bottom-top">
					<h1 class="span9"><a href="<?php 
echo bloginfo('url');
?>
"><?php 
echo bloginfo('name');
?>
</a></h1>
					<?php 
$options = get_option(THEME_OPTIONS_NAME);
?>
 public function frame_data($data, $user, $node)
 {
     /* BENCHMARK */
     $this->benchmark->mark('func_template_data_start');
     // back stage toggle
     $data['backstage_toggle'] = backstage_toggle($data['admin_page'], $user);
     // ANALYTICS - dont output if site admin or super admin logged in, or if in dev mode
     if (in_array($user['user_type'], array('super_admin', 'admin_user')) or 1 == $this->config->item('dev')) {
         $data['ga'] = '';
     } else {
         $data['ga'] = "<script type='text/javascript'>var _gaq = _gaq || [];_gaq.push(['_setAccount', '" . $this->config->item('ga') . "']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>";
     }
     // NODE CREATOR
     $creator = array();
     if (isset($node['user_id'])) {
         $creator = $this->node_model->get_node($node['user_id'], 'user');
     }
     $data['creator'] = $creator;
     // HEAD INCLUDES
     $data['css'] = css_files($data['admin_page']);
     $data['fonts'] = fonts();
     // no follow and index so Google doesn't crawl the development server
     $data['no_follow'] = no_follow();
     // date formats
     $data['date_formats'] = $this->config->item('date_format');
     // JAVASCRIPT INCLUDES
     // admin js
     if (!isset($data['admin_js'])) {
         $data['admin_js'] = '';
     }
     // global values
     // open script
     $jsgl = '';
     $jsgl .= "<script type='text/javascript'>\n";
     $jsgl .= "if (window.focus)\n";
     $jsgl .= "{\n";
     // colours
     foreach ($this->config->item('colours') as $name => $hex) {
         $jsgl .= $name . "='" . $hex . "';\n";
     }
     // responsive image array
     $jsgl .= "var rimg_ids=Array();";
     // responsive image load function - needs to be in the head so image can be replaced immediately at the point of load
     $jsgl .= "function source_response(id,load_size)";
     $jsgl .= "{";
     $jsgl .= "    var src=\$(id).attr('src');";
     $jsgl .= "    \$(id).attr('src',src.replace('s300.','s'+load_size+'.'));";
     $jsgl .= "}";
     // close script
     $jsgl .= "}\n";
     $jsgl .= "</script>\n";
     $data['js_global'] = $jsgl;
     // footer includes
     $js = "<script src='/js/global.js'></script>";
     // audio player if this is an audio page
     if (1 == $node["audio"]) {
         $js .= "<script src='/js/yahoo_player.js' type='text/javascript'></script>";
     }
     // background image - loaded last as they are often large and just for decoration
     $data['background_image'] = '';
     if (strlen($this->config->item('background'))) {
         $data['background_image'] = "<style>html{" . $this->config->item('background') . "}</style>";
     }
     // facebook
     if (1 == $node['social']) {
         $js .= "<div id='fb-root'></div>";
         $js .= "<script>(function(d, s, id) {";
         $js .= "  var js, fjs = d.getElementsByTagName(s)[0];";
         $js .= "  if (d.getElementById(id)) return;";
         $js .= "  js = d.createElement(s); js.id = id;";
         $js .= "  js.src = '//connect.facebook.net/en_GB/all.js#xfbml=1';";
         $js .= "  fjs.parentNode.insertBefore(js, fjs);";
         $js .= "}(document, 'script', 'facebook-jssdk'));</script>";
     }
     // image upload
     // set in the image upload controller
     if (!isset($data['image_upload_js'])) {
         $data['image_upload_js'] = '';
     }
     // jquery ui
     if (1 == $node['jquery_ui']) {
         $js .= "<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js'></script>";
     }
     // large files js
     if (isset($node['large_files']) && 1 == $node['large_files']) {
         $js .= "<script src='/js/jquery.uploadifive.min.js' type='text/javascript'></script>";
     }
     // map
     $map_types = $this->config->item('map_types');
     if (1 == $node['map'] or in_array($node['type'], $map_types)) {
         $map_query_string = $this->config->item('map_qs');
         if (!strlen($map_query_string)) {
             die("to use a map you need to set a query value in config - add item 'map_qs' with the values for your map");
         }
         $js .= "<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js" . $map_query_string . "'></script>";
     }
     // modernizr
     if ($this->config->item('modernizr')) {
         $js .= "<script src='/js/modernizr253.js'></script>";
     }
     // node specific js file
     if (1 == $node['javascript']) {
         $js .= "<script src='/js/" . $node['url'] . ".js'></script>";
     }
     // pinterest
     if (1 == $node['pinterest']) {
         $js .= "<script type='text/javascript' src='//assets.pinterest.com/js/pinit.js'></script>";
     }
     // responsive src replace
     $js .= "<script type='text/javascript'>";
     $js .= "\tfor (x=0;x<rimg_ids.length;x++)";
     $js .= "\t{";
     $js .= "\t\tsource_response('#img'+rimg_ids[x][0],rimg_ids[x][1]);";
     $js .= "\t}";
     $js .= "</script>";
     // shivs
     if ($this->config->item('html5shiv')) {
         $js .= "<!--[if lt IE 9]> <script src='http://html5shiv.googlecode.com/svn/trunk/html5.js'></script> <![endif]-->";
     }
     if ($this->config->item('html_canvas')) {
         $js .= "<!--[if lt IE 9]> <script src='/js/excanvas.js'></script> <![endif]-->";
     }
     // video player is the player js and the control values
     $vidjs = '';
     $video_div = '';
     $video_player = '';
     $other_videos = array();
     if (strlen($node['video_src']) > 0 or 1 == $node["video"] && isset($this->data['node_details']['video_src']) && strlen($this->data['node_details']['video_src']) > 0) {
         $this->load->model('video_model');
         $video_div .= "<div id='vid_player' class='vid_player'>";
         $video_div .= "<div id='mp'>the video content doesn't appear to be working - please try again later, or check your javascript (js) settings as video does not work without javascript</div>";
         $video_div .= "</div>";
         if (strlen($node['video_src']) > 0) {
             $video_player = $this->video_model->video_player($node['video_src'], "youtube", $this->config->item('video_config'));
         } else {
             $video_player = $this->video_model->video_player($this->data['node_details']['video_src'], $this->data['node_details']['video_host'], $this->config->item('video_config'));
         }
         $js .= "<script type='text/javascript' src='/js/jwplayer/jwplayer.js'></script>";
         $js .= "<script type='text/javascript' src='/js/jwplayer/control.js'></script>";
         $other_videos = $this->video_model->get_other_videos($node);
     }
     // also set the video player stuff here
     $data['video_player'] = $video_player;
     $data['video_div'] = $video_div;
     $data['other_videos'] = $other_videos;
     $data['javascript'] = $js;
     // HEADER BASKET
     // header basket - do this first as subsequent calculations are based on things that happen in here
     $data['header_basket'] = '';
     if (1 == $this->config->item('show_header_basket')) {
         $this->load->model('basket_model');
         $data['header_basket'] = "<div id='header_basket'>" . $this->basket_model->header_basket() . "</div>";
     }
     // LARGE FILES
     if (1 == $node['large_files']) {
         $this->load->model('file_upload_model');
         $data['file_upload'] = $this->file_upload_model->file_upload_field('hello');
     }
     // LOGIN AND LOGOUT FORMS
     if (is_numeric($user['user_id'])) {
         $data['login_form'] = '';
         $data['logout_form'] = $this->engage_model->logout_form($node['url']);
     } else {
         $data['login_form'] = $this->engage_model->login_form();
         $data['logout_form'] = '';
     }
     // MESSAGE - for feedback to the user on reload - also clear from session
     $mes = "<div id='mback'>";
     $hidden = 0;
     if (0 == $node['visible'] && (is_numeric($user['user_id']) && $node['user_id'] == $user['user_id'])) {
         $hidden = 1;
     }
     if (strlen($this->session->userdata('message')) > 0 or 1 == $hidden) {
         // get and unset
         if (1 == $hidden) {
             $mes .= "<span id='hidden_message' class='red'>!!! this page is currently invisible - you are able to see it because it is yours or you are admin !!!</span>";
         }
         $mes .= $this->session->userdata('message');
         $this->session->set_userdata('message', '');
         // fade in to show that something happened when the same action was performed twice
         $mes .= "<script type='text/javascript'>";
         $mes .= "if (window.focus)";
         $mes .= "{";
         $mes .= "\$('#mback').css('opacity',0).animate({'opacity':'+=1'},500);";
         $mes .= "}";
         $mes .= "</script>";
     }
     $mes .= "</div>";
     $data['message'] = $mes;
     // NAVIGATION
     $nav = '';
     $nav_nodes = $this->node_model->get_nodes(array('category_id' => 502));
     foreach ($nav_nodes as $n) {
         // list nodes
         $list_nodes = array();
         if ('page' == $n['type']) {
             $n_details = $this->node_model->get_node($n['id'], 'page');
             $list_nodes = json_decode($n_details['node_list'], true);
         }
         // selected logic, also uses the node type to highlight when looking at specifics
         if ($n['id'] == $node['id'] or is_array($list_nodes) && in_array($node['type'], $list_nodes)) {
             $extra_class = ' nsel ';
         } else {
             $extra_class = '';
         }
         // a bit of tab text for the home page - not it's long title
         if (1 == method_exists($this->project_data_array_model, 'set_nav_name')) {
             $text = $this->project_data_array_model->set_nav_name($n);
             $url = "/" . $n['url'];
         } else {
             if (6 == $n['id']) {
                 if (strlen($this->config->item('home_nav')) ? $text = $this->config->item('home_nav') : ($text = 'home')) {
                 }
                 $url = '/';
             } else {
                 $text = $n['name'];
                 $url = "/" . $n['url'];
             }
         }
         // the nav link itself
         $nav .= "<a href='" . $url . "'>";
         $nav .= "<span class='n " . $extra_class . "'>";
         $nav .= $text;
         $nav .= "</span>";
         $nav .= "</a> ";
     }
     $data['nav'] = $nav;
     // NEWSLETTER, sign up form - usually in the frame somewhere
     $data['newsletter'] = $this->newsletter_model->get_newsletter_form();
     // NODE LIST
     $data['node_list'] = array();
     $nodes_list = json_decode($this->node['node_list'], true);
     if (count($nodes_list) > 0) {
         // do something special for a blog list as we need the html too, but just if it's blogs alone
         if (1 == count($nodes_list) && 'blog' == $nodes_list[0]) {
             $data['node_list'] = $this->node_model->get_nodes(array('type' => 'blog', 'visible' => 1), 1);
         } else {
             $query = $this->db->select('*')->from('node')->where(array('visible' => 1))->where_in('type', $nodes_list)->order_by('name');
             $res = $query->get();
             $data['node_list'] = $res->result_array();
         }
     }
     // and for the map
     $data['map_node_list'] = array();
     $map_nodes_list = json_decode($this->node['node_list'], true);
     if (count($map_nodes_list) > 0) {
         $query = $this->db->select('*')->from('node')->where(array('latitude !=' => 999, 'visible' => 1))->where_in('type', $map_nodes_list)->order_by('name');
         $res = $query->get();
         $data['map_node_list'] = $res->result_array();
     }
     // PAGE FORMATTING - body, title, h1 etc
     // body tag
     $data['body_classes'] = body_classes($data['admin_page']);
     $data['body_map_onload'] = body_map_onload($data['admin_page'], count($data['map_node_list']), $node['map']);
     // facebook metas
     $data['fbog'] = $this->share_model->fbogs($node, $this->data);
     // h1 - NB this may well be over-ridden in template project specific
     if (isset($this->data['image_node']) ? $h1 = $this->data['image_node']['name'] : ($h1 = $node['name'])) {
     }
     $data['h1'] = $h1;
     // live warning
     $data['live_warning'] = '';
     if (1 == $this->config->item('live_warning')) {
         $data['live_warning'] .= "<div id='live_warning'>site now live - please login to the live site for ongoing changes: <a href='" . $this->config->item('live_domain') . "/login'>login here</a></div>";
     }
     // ie page covering conditionals
     $data['ie'] = ie_tags();
     // title
     if (isset($this->data['image_node']) && isset($this->data['individual_image'])) {
         $data['title'] = "<title>" . $this->data['individual_image']['image_name'] . ", an image belonging to " . $this->data['image_node']['human_type'] . " " . $this->data['image_node']['name'] . " at " . $this->config->item('site_name') . "</title>";
     } else {
         $data['title'] = "<title>" . $node['name'] . " " . $node['human_type'] . " at " . $this->config->item('site_name') . "</title>";
     }
     // SEARCH
     if (is_numeric($this->config->item('header_search')) ? $header_search = $this->config->item('header_search') : ($header_search = 1)) {
     }
     $sf = "";
     if (1 == $header_search) {
         $sf = form_open('search/search_reload');
         $sf .= "<input id='search_input' class='form_field' type='text' name='search_input' value='" . get_value(null, 'search_input') . "' x-webkit-speech />";
         $sf .= "<input id='search_submit' class='submit' type='submit' name='submit' value='search'/>";
         $sf .= "</form>";
     }
     $data['search_form'] = $sf;
     // SKIP TO CONTENT
     $data['skip']['start'] = "<a id='skip_link' class='hide_text' href='#content_skipper'>skip to content</a>";
     $data['skip']['end'] = "<a id='content_skipper'></a>";
     // SOCIAL MEDIA - site wide, i.e. links to site social media pages, displays social media widgets
     // facebook face pile / like box
     // twitter widget
     $data['twidget'] = $this->share_model->twidget();
     // USER WELCOME MESSAGE - finish profile etc. if required in the config of this site
     $wm = '';
     // make a message to welcome the user
     $data['complete'] = 1;
     if (1 == $this->config->item('welcome_encouragement')) {
         $data['complete'] = $this->engage_model->profile_complete($user);
         if (is_numeric($user['user_id'])) {
             if (0 == $data['complete']) {
                 $name = $user['user_name'];
                 $complete = "<a href='/my-profile'>complete your profile</a>";
             } else {
                 //$name=$user['display_name']." [".$user['user_name']."]";
                 $name = $user['display_name'];
                 $complete = "";
             }
             $data['welcome'] = "Hi, <a href='/" . $user['user_name'] . "'>" . $name . "</a>" . $complete;
         } else {
             $data['welcome'] = '';
         }
     } else {
         $data['welcome'] = '';
     }
     // build the engage message
     if ($data['welcome'] != '') {
         $wm = "<div id='htop_engage'>";
         $wm .= "<span id='welcome_user'>" . $welcome . "</span>";
         $wm .= "</div>";
     }
     $data['welcome_message'] = $wm;
     /* BENCHMARK */
     $this->benchmark->mark('func_adminspcifics_template_data_end');
     /* BENCHMARK */
     $this->benchmark->mark('func_template_data_end');
     return $data;
 }