-
Notifications
You must be signed in to change notification settings - Fork 1
/
content-share.php
254 lines (236 loc) · 7.99 KB
/
content-share.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
<?php get_header(); ?>
<?php
$page_title = __('Share a map', 'jeo');
$map = false;
if($_GET['map_id']) {
$map = get_post($_GET['map_id']);
if($map && get_post_type($map->ID) == 'map')
$page_title = __('Share', 'jeo') . ' ' . get_the_title($map->ID);
else
$map = false;
}
// All maps
$maps = get_posts(array('post_type' => 'map', 'posts_per_page' => -1));
// Single map
if(!$map && count($maps) <= 1) {
$map = array_shift($maps);
$page_title = __('Share the map', 'jeo');
}
// check for layer count
$allow_layers = true;
$layers = false;
if($allow_layers) {
if(isset($_GET['layers'])) {
$layers = explode(',', $_GET['layers']);
} elseif($map) {
$layers = jeo_get_map_layers($map->ID);
if(count($layers) <= 1) {
$layers = false;
}
}
}
?>
<section id="content" class="share-page">
<div class="container">
<header class="share-title">
<!--<div class="share-title">
<!--<div class="twelve columns">-->
<h1><?php echo $page_title; ?></h1>
<!--</div>
</div>-->
</header>
</div>
<div class="container" class="share-page">
<div id="jeo-share-widget">
<div id="configuration">
<div class="container row">
<?php
if(count($maps) > 1 || ($map && $layers)) :
?>
<div class="section layer three columns">
<div class='inner'>
<?php if(!$map) : ?>
<h4>
<?php _e('Choose a map', 'jeo'); ?>
<a class='tip' href='#'>
?
<div class='popup arrow-left'>
<?php _e('Choose any map from the list', 'jeo'); ?>
</div>
</a>
</h4>
<div id='maps'>
<select id="map-select" data-placeholder="<?php _e('Select a map', 'jeo'); ?>" class="chzn-select">
<?php foreach($maps as $map) : ?>
<option value="<?php echo $map->ID; ?>"><?php echo get_the_title($map->ID); ?></option>
<?php endforeach; ?>
</select>
<?php if($allow_layers) : ?>
<a href="#" class="select-map-layers" style="display:block;margin-top:5px;"><?php _e('Select layers from this map', 'jeo'); ?></a>
<?php endif; ?>
</div>
<?php elseif($map && $layers) : ?>
<?php $map_id = $map->ID; ?>
<h4>
<?php if(!isset($_GET['layers'])) : ?>
<?php echo __('Select layers', 'jeo'); ?>
<?php else : ?>
<?php _e('Select layers', 'jeo'); ?>
<?php endif; ?>
<a class="tip" href="#">
?
<div class="popup arrow-left">
<?php _e('Choose any layers from the list', 'jeo'); ?>
</div>
</a>
</h4>
<div id="maps">
<?php if($layers) : ?>
<select id="layers-select" data-placeholder="<?php _e('Select layers', 'jeo'); ?>" data-mapid="<?php echo $map_id; ?>" class="chzn-select" multiple>
<?php foreach($layers as $layer) : ?>
<?php
if(!is_array($layer)) :
$l = array('id' => $layer, 'title' => $layer);
$layer = $l;
endif;
?>
<option value="<?php echo $layer['id']; ?>" selected><?php if($layer['title']) : echo $layer['title']; else : echo $layer['id']; endif; ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
<a class="clear-layers" href="#"><?php _e('Back to default layer configuration', 'jeo'); ?></a>
<?php if(count($maps) > 1) : ?>
<p><a class="button" href="<?php echo jeo_get_share_url(); ?>"><?php _e('View all maps', 'jeo'); ?></a></p>
<?php endif; ?>
</div>
<?php else : ?>
<h4> </h4>
<input type="hidden" id="map_id" name="map_id" value="<?php echo $map->ID; ?>" />
<p><a class="button" href="<?php echo jeo_get_share_url(); ?>"><?php _e('View all maps', 'jeo'); ?></a></p>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php
$taxonomies = jeo_get_share_widget_taxonomies();
?>
<div class="section two columns">
<div class="inner">
<h4>
<?php _e('Filter content', 'jeo'); ?>
<a class="tip" href="#">
?
<div class="popup arrow-left">
<?php _e('Filter the content displayed on the map through our options', 'jeo'); ?>
</div>
</a>
</h4>
<div id="map-content">
<select id="content-select" data-placeholder="<?php _e('Select content', 'jeo'); ?>" class="chzn-select">
<?php
if(isset($_GET['p'])) :
$post = get_post($_GET['p']);
if($post) : ?>
<optgroup label="<?php _e('Selected content', 'jeo'); ?>">
<option value="post&<?php echo $post->ID; ?>" selected><?php echo get_the_title($post->ID); ?></option>
</optgroup>
<?php endif; ?>
<?php endif; ?>
<optgroup label="<?php _e('General content', 'jeo'); ?>">
<option value="latest"><?php if(!isset($_GET['map_id'])) _e('Content from the map', 'jeo'); else _e('Latest content', 'jeo'); ?></option>
<option value="map-only"><?php _e('No content (map only)', 'jeo'); ?></option>
</optgroup>
<?php foreach($taxonomies as $taxonomy) :
$taxonomy = get_taxonomy($taxonomy);
if($taxonomy) :
$terms = get_terms($taxonomy->name);
if($terms) :
?>
<optgroup label="<?php echo __('By', 'jeo') . ' ' . strtolower($taxonomy->labels->name); ?>">
<?php foreach($terms as $term) : ?>
<option value="tax_<?php echo $taxonomy->name; ?>&<?php echo $term->slug; ?>"><?php echo $term->name; ?></option>
<?php endforeach; ?>
</optgroup>
<?php
endif;
endif;
endforeach; ?>
</select>
</div>
</div>
</div>
<div class='section size three columns'>
<div class='inner'>
<h4>
<?php _e('Width & Height', 'jeo'); ?>
<a class='tip' href='#'>
?
<div class='popup arrow-left'>
<?php _e('Select the width and height proportions you would like to embed to be.', 'jeo'); ?>
</div>
</a>
</h4>
<ul id='sizes' class='sizes clearfix'>
<li><a href='#' data-size='small' data-width='480' data-height='300'><?php _e('Small', 'jeo'); ?></a></li>
<li><a href='#' data-size='medium' data-width='600' data-height='400'><?php _e('Medium', 'jeo'); ?></a></li>
<li><a href='#' data-size='large' data-width='960' data-height='480' class='active'><?php _e('Large', 'jeo'); ?></a></li>
</ul>
</div>
</div>
<div class='section output two columns'>
<div class='inner'>
<h4>
<div class='popup arrow-right'>
</div>
<?php _e('HTML Output', 'jeo'); ?>
<a class='tip' href='#'>
?
<div class='popup arrow-left'>
<?php _e('Copy and paste this code into an HTML page to embed with it\'s current settings and location', 'jeo'); ?>
</div>
</a>
</h4>
<textarea id='output'></textarea>
</div>
</div>
<div class="section social two columns">
<div class="inner">
<h4>
<div class="popup arrow-right">
</div>
<?php _e('Share', 'jeo'); ?>
<a class="tip" href="#">
?
<div class="popup arrow-left">
<?php _e('Share this map, with it\'s current settings and location, on your social network', 'jeo'); ?>
</div>
</a>
</h4>
</div>
<p id="jeo-share-social" class="links">
<a href="#" class="facebook"><span class="lsf"></span></a>
<a href="#" class="twitter"><span class="lsf"></span></a>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<!--<div class="twelve columns">-->
<h2 class="preview-title"><?php _e('Map preview', 'jeo'); ?></h2>
<!--</div>
</div>-->
<div id="embed-container">
<div class="content" id="widget-content">
<!-- iframe goes here
</div>-->
</div>
</div>
</section>
<script type="text/javascript">
jQuery(document).ready(function($) {
jeo_share_widget.controls();
});
</script>
<?php get_footer(); ?>