-
Notifications
You must be signed in to change notification settings - Fork 1
/
page-live-data.php
250 lines (227 loc) · 8.87 KB
/
page-live-data.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
<?php // phpcs:ignore
get_header();
$frontpage_id = get_option( 'page_on_front' );
?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div id="now" class="section current-talk lp-now-it-is lp-live-stream-it-is bg-color-pink text-color-pink--darker">
<div class="container">
<div class="row">
<div class="twelve columns">
<h2>Live stream</h2>
</div>
</div>
<div class="row">
<div class="ten columns offset-by-two">
<iframe src="https://www.crowdcast.io/e/wptranslationday4?navlinks=false&embed=true" width="800" height="600" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" allowFullScreen="true"></iframe>
</div>
</div>
<div class="row">
<div class="bgholder livebgholder"></div>
<div class="talk-holder">
</div>
</div>
<div class="row">
<div class="ten columns offset-by-two">
<div class="six columns viefulllinks" style="margin-top:0 !important;">
<h4><a href="https://wptranslationday.org/the-schedule/">View the full schedule for upcoming talks</a></h4>
</div>
<div class="six columns viefulllinks" style="margin-top:0 !important;">
<h4><a target="_blank" href="https://www.crowdcast.io/e/wptranslationday4/">Go to CrowdCast for full interaction</a></h4>
</div>
</div>
</div>
</div>
</div>
<div id="data" class="section live-data lp-live-data-it-is bg-color-blue text-color-blue--light">
<div class="container">
<div class="row">
<div class="twelve columns">
<h2 style="margin:0;" class="text-color-blue--lighter">Some of today's numbers:</h2>
</div>
<div class="bgholder streambgholder"></div>
</div>
<div class="row">
<div class="eight columns offset-by-four">
<h5 style="margin:0;">* data is refreshed every hour</h5>
</div>
</div>
<?php
// Get livedata stuff
$translators = gwtd3_get_translators();
$top120 = gwtd3_get_top120();
$wptranslations = gwtd3_get_wp_translations();
?>
<div class="jbsdata">
<div class="row" style="margin-top:2rem;">
<div class="eight columns minor offset-by-four">
<h3 style="font-weight:100 !important;" class="text-color-blue--lighter">Currently on the WP Polyglots team, we globally count:</h3>
</div>
</div>
<?php if ( intval( $translators->total_pte ) > 0 ) : ?>
<div class="row">
<div class="four columns major">
<h1 class="livedata-counter" data-value="<?php echo intval( $translators->total_pte ); ?>"><?php echo $translators->total_pte; ?></h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--light">PTE - Project Translation Editors</h3>
</div>
</div>
<?php endif; ?>
<?php if ( intval( $translators->new_pte ) > 0 ) : ?>
<div class="row">
<div class="four columns major">
<h1 class="text-color-blue--lighter livedata--exception-relativetopminus40 livedata-counter">
<span class="data-number" data-value="<?php echo intval( $translators->new_pte ); ?>">
+<?php echo $translators->new_pte; ?>
</span>
</h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--lighter livedata--exception-relativetopminus40">since the beginning of WPTD3</h3>
</div>
</div>
<?php endif; ?>
<?php if ( intval( $translators->total_contrib ) > 0 ) : ?>
<div class="row">
<div class="four columns major">
<h1 class="livedata-counter">
<span class="data-number" data-value="<?php echo intval( $translators->total_contrib ); ?>">
<?php echo $translators->total_contrib; ?>
</span>
</h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--light">Translators</h3>
</div>
</div>
<?php endif; ?>
<?php if ( intval( $translators->new_contrib ) > 0 ) : ?>
<div class="row">
<div class="four columns major">
<h1 class="text-color-blue--lighter livedata--exception-relativetopminus40 livedata-counter">
<span class="data-number" data-value="<?php echo intval( $translators->new_contrib ); ?>">
+<?php echo $translators->new_contrib; ?>
</span>
</h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--lighter livedata--exception-relativetopminus40">since the beginning of WPTD3</h3>
</div>
</div>
<?php endif; ?>
<?php if ( intval( $top120->total_translated_strings ) > 0 ) : ?>
<div class="row">
<div class="four columns major">
<?php
// Lets format this stuff a bit!
$n = intval( $top120->total_translated_strings );
if ($n < 1000000) {
$n_format = number_format($n);
} elseif ($n < 1000000000) {
$n_format_number = number_format($n / 1000000);
$n_format = '<span class="data-number" data-value="' . $n_format_number . '">' . number_format($n / 1000000) . '</span>' . '<abbr title="Millions">M</abbr>';
} else {
$n_format = number_format($n / 1000000000) . 'B';
}
?>
<h1 class="livedata-counter"><?php echo $n_format; ?></h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--light livedata--exception-mt1rem">Strings still waiting to be translated in the Top 120 plugins</h3>
</div>
</div>
<?php endif; ?>
<?php if ( intval( $top120->new_translated_strings ) < 0 ) : ?>
<div class="row">
<div class="four columns major">
<h1 class="text-color-blue--lighter livedata--exception-relativetopminus40 livedata-counter">
+<span class="data-number" data-value="<?php echo intval( $top120->new_translated_strings ); ?>"><?php echo str_replace("-", "", $top120->new_translated_strings); ?></span>
</h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--lighter livedata--exception-relativetopminus40">Strings translated in the Top 120 plugins since the beginning of WPTD3</h3>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="four columns major">
<h1 class="livedata-counter">
<span class="data-number" data-value="<?php echo intval( $wptranslations->total_translated_wp ); ?>">
<?php echo $wptranslations->total_translated_wp; ?>
</span>
</h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--light">Locales at 100% of WordPress 5.2</h3>
</div>
</div>
<?php if ( intval( $wptranslations->new_translated_wp ) > 0 ) : ?>
<div class="row">
<div class="four columns major">
<h1 class="text-color-blue--lighter livedata-counter">
<span class="data-number" data-value="<?php echo intval( $wptranslations->new_translated_wp ); ?>">
+<?php echo $wptranslations->new_translated_wp; ?>
</span>
</h1>
</div>
<div class="eight columns minor borderleft">
<h3 class="text-color-blue--lighter livedata--exception-relativetopminus40">since the beginning of WP Translation Day 4</h3>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div id="local-events-map"></div>
<?php
$args = array(
'post_type' => array( 'wptd_local_event' ),
'post_status' => array( 'publish' ),
'nopaging' => true,
'posts_per_page' => -1,
'orderby' => 'meta_value',
'meta_key' => 'continent_country_city',
'order' => 'ASC',
);
$query = new WP_Query( $args );
$markers = array();
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$continent = get_field( 'continent' );
$evenlink = get_field( 'announcement_url' );
$coordinates = get_field( 'coordinates' );
if ( ! empty( $coordinates['lat'] ) && ! empty( $coordinates['lng'] ) ) {
$markers[] = array(
'id' => get_the_id(),
'title' => get_the_title(),
'scale' => 0.5,
'selectable' => true,
'zoomLevel' => 5,
'scale' => 2,
'latitude' => floatval( $coordinates['lat'] ),
'longitude' => floatval( $coordinates['lng'] ),
'country' => esc_attr( get_field( 'country' ) ),
'city' => esc_attr( get_field( 'city' ) ),
'locale' => esc_attr( get_field( 'locale' ) ),
'utc_start_time' => esc_attr( get_field( 'utc_start_time' ) ),
'utc_end_time' => esc_attr( get_field( 'utc_end_time' ) ),
'link' => esc_attr( $evenlink ),
'organizer' => esc_attr( get_field( 'organizer_name' ) ),
);
}
}
?>
<script>
var markers = <?php echo json_encode( $markers ); ?>;
var map_pattern = '<?php echo get_stylesheet_directory_uri(); ?>/assets/images/map-pattern.png';
</script>
<?php
}
?>
<?php wp_reset_postdata(); ?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .wrap -->