forked from oeco/opendev-wptheme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathheader.php
280 lines (240 loc) · 11.5 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?php
$wpDomain=$_SERVER["HTTP_HOST"];
$domain='opendevelopmentmekong.net';
$preprod = false;
if (COUNTRY_NAME == 'cambodia'){$country='cambodia';$country_short='kh';$preprod=true;}
else if (COUNTRY_NAME == 'laos'){$country='laos';$country_short='la';$preprod=true;}
else if (COUNTRY_NAME == 'myanmar'){$country='myanmar';$country_short='mm';$preprod=true;}
else if (COUNTRY_NAME == 'thailand'){$country='thailand';$country_short='th';$preprod=true;}
else if (COUNTRY_NAME == 'vietnam'){$country='vietnam';$country_short='vn';$preprod=true;}
else {$country='mekong';$country_short='';}
setcookie("odm_transition_country", $country, time()+3600, "/", ".opendevelopmentmekong.net");
if ($wpDomain == '192.168.33.10'){
$ckanDomain='192.168.33.10:8081';
}
else {
$full_domain = $_SERVER['SERVER_NAME'];
$just_domain = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $_SERVER['HTTP_HOST']);
$ckanDomain = 'data.'.$just_domain;
}
?>
<!DOCTYPE html>
<html data-country="<?php echo $country; ?>" <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="<?php bloginfo('charset'); ?>" />
<?php if (have_posts()):while(have_posts()): the_post(); endwhile; endif;?>
<meta property="fb:app_id" content="1066174610071139">
<meta property="og:url" content="<?php echo get_permalink()?>" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property=og:title content="<?php the_title(); ?>" />
<meta property=og:description content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property=og:type content="<?php echo get_post_type(); ?>" />
<meta property=og:url content="<?php echo get_permalink()?>" />
<meta property="og:image:secure_url" content="<?php $img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full', false); echo $img_src[0]; ?>" />
<meta property="og:image:width" content="980" />
<meta property="og:image:height" content="560" />
<meta name=twitter:site content=<?php bloginfo('name'); ?> />
<meta name=twitter:title content="<?php the_title(); ?>" />
<meta name=twitter:description content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta name=twitter:image content="<?php $img_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full', false); echo $img_src[0]; ?>" />
<title><?php
global $page, $paged;
wp_title('|', true, 'right');
bloginfo('name');
$site_description = get_bloginfo('description', 'display');
if ($site_description && (is_home() || is_front_page())) {
echo " | $site_description";
}
if ($paged >= 2 || $page >= 2) {
echo ' | '.__('Page', 'jeo').max($paged, $page);
}
?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php $sit_name = str_replace('Open Development ', '', get_bloginfo('name')); ?>
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/img/favicon/<?php echo strtolower($sit_name); ?>-favicon.ico" type="image/x-icon" />
<?php wp_head(); ?>
</head>
<body <?php body_class(get_bloginfo('language')); ?>>
<div class="content_wrapper">
<header class="white"id="od-head">
<div class="organization">
<div class="six columns left_organization">
<div class="site-meta">
<?php opendev_logo(); ?>
</div>
</div>
<div class="language float-right">
<?php if(function_exists('qtranxf_generateLanguageSelectCode')){
qtranxf_generateLanguageSelectCode('image');
} ?>
</div>
<div class="right_organization">
<div class="search">
<div id="live-search">
<input type="text" placeholder="<?php _e('Search site... 🔍', 'opendev');?>" onfocus="this.placeholder=''" onblur="this.placeholder='<?php _e('Search site... 🔍', 'opendev');?>'" />
<img src="<?php bloginfo('stylesheet_directory');?>/img/loading.gif" alt="loading" id="loading" />
<div class="results-container"></div>
</div><!-- live-search -->
</div>
<div class="social">
<nav id="social-nav">
<?php
$fb = opendev_get_facebook_url();
if ($fb) :
?>
<a class="icon-facebook" href="<?php echo $fb; ?>" target="_blank" rel="external" title="Facebook"></a>
<?php
endif;
?>
<?php
$tw = opendev_get_twitter_url();
if ($tw) :
?>
<a class="icon-twitter" href="<?php echo $tw; ?>" target="_blank" rel="external" title="Twitter"></a>
<?php
endif;
?>
<?php
$contact_id = opendev_get_contact_page_id();
if ($contact_id) :
?>
<a class="icon-envelop" href="<?php echo get_permalink($contact_id); ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/img/envelop.svg"></a>
<?php
else:
?>
<?php
endif;
?>
</nav>
</div>
</div>
</div>
<!-- NEW NAV -->
<div class="contentNavigation">
<ul id="cNavNew" class="level1 clearfix current-site-mekong menu-<?php echo $country;?>">
<!-- build top topics nav -->
<?php if(function_exists('qtranxf_getLanguage')) buildStyledTopTopicNav(qtranxf_getLanguage());
else buildStyledTopTopicNav('en');
?>
<li class="one-line"><a class="library" href="http://<?php echo $ckanDomain; ?>/library_record<?php if ($country !='mekong') echo '?extras_odm_spatial_range=' . $country_short; ?>" target="_self"><?php _e("Publications library"); ?><span class="cNavState"></span></a>
</li>
<li class="one-line">
<a class="datahub" href="http://<?php echo $ckanDomain; ?><?php if ($country !='mekong' ) echo '/dataset?extras_odm_spatial_range=' . $country_short; ?>" target="_self"><?php _e("Data")?><span class="cNavState"></span></a>
<ul class="level2">
<li class="first"><a href="http://<?php echo $ckanDomain; ?><?php if ($country !='mekong') echo '/dataset?extras_odm_spatial_range=' . $country_short; ?>"target="_self"><?php _e("All records")?><span class="cNavState"></span></a></li>
<li class="by_country"><a href="#" target="_self"><?php _e("Records by country")?><span class="cNavState"></span></a>
<ul class="level3">
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_spatial_range=kh" target="_self"><?php _e("Cambodia")?><span class="cNavState"></span></a></li>
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_spatial_range=la" target="_self"><?php _e("Laos")?><span class="cNavState"></span></a></li>
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_spatial_range=mm" target="_self"><?php _e("Myanmar")?><span class="cNavState"></span></a></li>
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_spatial_range=th" target="_self"><?php _e("Thailand")?><span class="cNavState"></span></a></li>
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_spatial_range=vn" target="_self"><?php _e("Vietnam")?><span class="cNavState"></span></a></li>
<span class="border"></span>
</ul>
</li>
<li class="last by_country"><a href="#" target="_self"><?php _e("Records by language")?><span class="cNavState"></span></a>
<ul class="level3">
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_language=en" target="_self"><?php _e("English")?><span class="cNavState"></span></a></li>
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_language=km" target="_self"><?php _e("Khmer")?><span class="cNavState"></span></a></li>
<li class="first"><a href="http://<?php echo $ckanDomain; ?>/dataset?extras_odm_language=vi" target="_self"><?php _e("Vietnamese")?><span class="cNavState"></span></a></li>
<span class="border"></span>
</ul>
</li>
<span class="border"></span>
</ul>
</li>
<?php wp_nav_menu( array(
'menu' => 'country-specific-menu',
'container' => false,
'items_wrap' => '%3$s',
'fallback_cb' => false,
'walker' => new country_specific_sub_menus(),
)); ?>
</ul>
<!-- end nav new -->
<!-- #################### -->
</div>
<nav id="ms-nav">
<div class="container">
<div class="twelve columns">
<?php opendev_ms_nav(); ?>
</div>
</div>
</nav>
<?php
$options_msg = get_option('opendev_options');
if (isset($options_msg['notice_message']) && $options_msg['notice_message'] != '') {
?>
<nav id="notification-message">
<div class="container">
<div class="twelve columns">
<div class="notification-message-box">
<?php echo $options_msg['notice_message'];
?>
</div>
</div>
</div>
</nav>
<?php
} ?>
<?php if (!is_front_page()) {
?>
<nav id="main-breadcrumb">
<div class="container">
<div class="twelve columns">
<?php the_breadcrumb();
?>
</div>
</div>
</nav>
<?php
} ?>
</header>
<?php //Add Contact form button
if (!wp_is_mobile() && function_exists('button_user_feedback_form')) {
button_user_feedback_form();
}
?>
<div id="mainNav" class="mainNavOdc">
<div class="mainNav-logo">
<a href="/" target="_self">
<span class="icon-od-logo"></span>
</a>
</div>
<div class="mainNav-inner">
<ul id="mainNavElement" class="level1 clearfix">
<?php
if ( function_exists( 'wp_get_sites' )){
$get_all_sites = wp_get_sites();
$site_index[1] = "first";
$site_index[2] = "second";
$site_index[3] = "third";
$site_index[4] = "fourth";
$site_index[5] = "fift";
$site_index[6] = "last";
//H.E I have no idea what is used for (Christ did them)
$site_uid[1] = "uid-2";
$site_uid[2] = "uid-3";
$site_uid[3] = "uid-4";
$site_uid[4] = "uid-42";
$site_uid[5] = "uid-5";
$site_uid[6] = "uid-5142";
foreach ($get_all_sites as $site) {
$blog_id = $site["blog_id"];
$domain = get_site_url($blog_id);
$site_details = get_blog_details($blog_id, 1);
$country_name = str_replace('Open Development ', '', $site_details->blogname);
$site_name = str_replace('Open Development ', '', get_bloginfo('name'));
?>
<li class="<?php echo $site_index[$blog_id]?> <?php if (strtolower($country_name)=='mekong') echo 'jtop'; ?> <?php if ($country==strtolower($country_name)) echo 'act'; ?>">
<a class="toCkan" data-country="<?php echo strtolower($country_name)?>" href="<?php echo $domain;?>" target="_self" id="<?php echo $site_uid[$blog_id]?> "><?php _e($country_name, "opendev");?>
</a>
</li>
<?php } //end foreach
} ?>
</ul>
</div>
</div>