-
Notifications
You must be signed in to change notification settings - Fork 0
/
content-share.php
277 lines (249 loc) · 8.69 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?php get_header(); ?>
<?php
$page_title = __('Share a map', 'jeo-blank');
$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">
<header class="single-post-header">
<div class="container">
<div class="twelve columns">
<h1><?php echo $page_title; ?></h1>
</div>
</div>
</header>
<div id="jeo-share-widget">
<div id="configuration">
<div class="container row">
<?php
if(count($maps) > 1 || ($map && $layers)) :
?>
<div class="section layer four columns">
<div class='inner'>
<?php if(!$map) : ?>
<h4>
<?php _e('Choose a map', 'jeo-blank'); ?>
<a class='tip' href='#'>
?
<span class="popup arrow-left">
<?php _e('Choose any map from the list', 'jeo-blank'); ?>
</span>
</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-blank'); ?></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="#">
?
<span class="popup arrow-left">
<?php _e('Choose any layers from the list', 'jeo'); ?>
</span>
</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 remove_query_arg('map_id'); ?>"><?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-blank'); ?></a></p>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php
$taxonomies = jeo_get_share_widget_taxonomies();
?>
<div class="section four columns">
<div class="inner">
<h4>
<?php _e('Filter content', 'jeo-blank'); ?>
<a class="tip" href="#">
?
<span class="popup arrow-left">
<?php _e('Filter the content displayed on the map through our options', 'jeo-blank'); ?>
</span>
</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-blank'); ?>">
<option value="latest"><?php if(!isset($_GET['map_id'])) _e('Content from the map', 'jeo-blank'); else _e('Latest content', 'jeo'); ?></option>
<option value="map-only"><?php _e('No content (map only)', 'jeo-blank'); ?></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 four columns'>
<div class='inner'>
<h4>
<?php _e('Width & Height', 'jeo-blank'); ?>
<a class='tip' href='#'>
?
<span class="popup arrow-left">
<?php _e('Select the width and height proportions you would like to embed to be.', 'jeo-blank'); ?>
</span>
</a>
</h4>
<ul id='sizes' class='sizes clearfix'>
<li><a href='#' data-size='small' data-width='480' data-height='300'><?php _e('Small', 'jeo-blank'); ?></a></li>
<li><a href='#' data-size='medium' data-width='600' data-height='400'><?php _e('Medium', 'jeo-blank'); ?></a></li>
<li><a href='#' data-size='large' data-width='960' data-height='480' class='active'><?php _e('Large', 'jeo-blank'); ?></a></li>
</ul>
</div>
</div>
</div>
<div class="container row">
<div class='section output four columns'>
<div class='inner'>
<h4>
<div class='popup arrow-right'>
</div>
<?php _e('HTML Output', 'jeo-blank'); ?>
<a class='tip' href='#'>
?
<span 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-blank'); ?>
</span>
</a>
</h4>
<textarea id="output"></textarea>
</div>
</div>
<div class='section output four columns'>
<div class='inner'>
<h4>
<div class='popup arrow-right'>
</div>
<?php _e('URL', 'jeo-blank'); ?>
<a class='tip' href='#'>
?
<span class="popup arrow-left">
<?php _e('Get the original to use as a link or a custom embed.', 'jeo-blank'); ?>
</span>
</a>
</h4>
<input type="text" id="url-output" />
</div>
</div>
<div class="section social four columns">
<div class="inner">
<h4>
<div class="popup arrow-right">
</div>
<?php _e('Share', 'jeo-blank'); ?>
<a class="tip" href="#">
?
<span class="popup arrow-left">
<?php _e('Share this map, with it\'s current settings and location, on your social network', 'jeo-blank'); ?>
</span>
</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 class="container">
<div class="twelve columns">
<h2 class="preview-title"><?php _e('Map preview', 'jeo'); ?></h2>
</div>
</div>
<div id="embed-container" class="bblanco">
<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(); ?>