-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-download.php
More file actions
538 lines (354 loc) · 14.7 KB
/
single-download.php
File metadata and controls
538 lines (354 loc) · 14.7 KB
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
<?php
/**
* EDD single download template.
*
* @since 0.1.0
* @package RealBigPlugins
*/
// Don't load directly
if ( ! defined( 'ABSPATH' ) ) {
die;
}
get_header();
the_post();
// Don't show the add to cart stuff here as well as the sidebar. Reduntant
remove_action( 'the_content', 'edd_after_download_content', 10 );
$primary_color = get_post_meta( get_the_ID(), '_rbm_primary_color', true );
$primary_color = ( $primary_color ) ? $primary_color : '#12538f';
$secondary_color = get_post_meta( get_the_ID(), '_rbm_secondary_color', true );
$secondary_color = ( $secondary_color ) ? $secondary_color : '#51a0e9';
?>
<style type="text/css">
:root {
--disclaimer: '<?php echo _x( 'All price options are billed yearly. You may cancel your subscription at any time.', 'Price Options Disclaimer Text', THEME_ID ); ?>';
--primary-color: <?php echo $primary_color; ?>;
--secondary-color: <?php echo $secondary_color; ?>;
}
</style>
<div class="container grid-container">
<div class="grid-x grid-margin-x grid-margin-y">
<main class="small-12 medium-7 cell">
<ul class="breadcrumbs">
<li><a href="/">Home</a></li>
<li><a href="/plugins">Plugins</a></li>
<li>
<span class="show-for-sr">Current: </span><?php the_title(); ?>
</li>
</ul>
<!--Hide for the moment
<div class="banner-image">
<?php //the_post_thumbnail( 'large' ); ?>
</div>-->
<div class="product-heading">
<div class="heading-row">
<?php the_post_thumbnail( 'thumbnail' ); ?>
<?php add_filter( 'the_title', 'rbp_alternate_download_title' ); ?>
<h1 class="title"><span itemprop="name"><?php the_title(); ?></span></h1>
<?php remove_filter( 'the_title', 'rbp_alternate_download_title' ); ?>
</div>
<?php if ( $subheading = rbm_fh_get_field( 'subheading' ) ) : ?>
<div class="heading-row">
<p class="subheading"><?php echo $subheading; ?></p>
</div>
<?php endif; ?>
</div>
<?php if ( has_blocks() ) : ?>
<div class="content">
<?php the_content(); ?>
</div>
<?php else : ?>
<div class="content">
<?php the_content(); ?>
</div>
<?php $features = rbm_fh_get_field( 'features' );
if ( ! empty( $features ) ) : ?>
<div class="features-section">
<?php
$index = 0;
foreach ( $features as $feature ) : ?>
<div class="feature">
<div class="row" data-equalizer data-equalize-on="medium">
<div class="feature-content small-12 medium-6 columns
<?php echo $index % 2 !== 0 ? 'medium-push-6' : ''; ?>" data-equalizer-watch>
<div class="medium-vertical-align">
<h3><strong><?php echo $feature['title']; ?></strong></h3>
<?php echo apply_filters( 'the_content', $feature['content'] ); ?>
</div>
</div>
<div class="feature-image small-12 medium-6 columns
<?php echo $index % 2 !== 0 ? 'medium-pull-6' : ''; ?>" data-equalizer-watch>
<div class="medium-vertical-align">
<a href="<?php echo wp_get_attachment_url( $feature['image'], 'full' ); ?>">
<?php echo wp_get_attachment_image( $feature['image'], 'full' ); ?>
</a>
</div>
</div>
</div>
</div>
<?php
$index ++;
endforeach; ?>
</div>
<?php endif; ?>
<?php $testimonials = rbm_fh_get_field( 'testimonials' );
if ( ! empty( $testimonials ) ) : ?>
<?php
$index = 1;
switch ( count( $testimonials ) ) {
case 1 :
$max_columns = 1;
break;
default :
$max_columns = 2;
break;
}
?>
<div class="testimonials-section">
<?php foreach ( $testimonials as $testimonial ) : ?>
<?php if ( $index == 1 ) : ?>
<div class="row">
<?php endif; ?>
<div
class="testimonial small-12 medium-6<?php echo ( count( $testimonials ) == 1 ) ? ' medium-offset-3' : ' columns'; ?>">
<div class="testimonial-container">
<div class="testimonial-top row">
<div class="small-9 columns testimonial-meta">
<?php echo get_avatar( $testimonial['gravatar_email'], 96, null, false, array(
'class' => 'alignleft',
) ); ?>
<h6 class="testimonial-name">
<strong>
<?php echo $testimonial['name']; ?>
</strong>
</h6>
<span class="testimonial-company">
<?php echo $testimonial['company']; ?>
</span>
</div>
<div class="small-3 columns testimonial-quotation-mark">
<span class="fa fa-4x fa-quote-left"></span>
</div>
</div>
<div class="testimonial-bottom row">
<div class="small-12 columns testimonial-content">
<blockquote><?php echo apply_filters( 'the_content', '"' . $testimonial['content'] . '"' ); ?></blockquote>
</div>
</div>
</div>
</div>
<?php if ( $index == $max_columns ) : ?>
</div>
<?php
$index = 1;
else :
$index ++;
endif;
endforeach;
if ( $index !== 1 ) : ?>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php $video_url = rbm_fh_get_field( 'video' );
if ( ! empty( $video_url ) ) : ?>
<div class="video-section">
<div class="row">
<div class="small-12 columns">
<div class="video-container">
<?php echo wp_oembed_get( $video_url ); ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</main>
<aside class="small-12 medium-5 cell">
<div class="aside-container">
<div id="download-buy" class="download-color-section<?php echo ( edd_is_bundled_product( get_the_ID() ) ) ? ' is-bundle' : ''; ?>">
<?php echo edd_get_purchase_link( array(
'download_id' => get_the_ID(),
'text' => sprintf( _x( 'Buy %s', 'Buy Button Text', THEME_ID ), get_the_title() ),
'class' => 'primary large',
) ); ?>
<div class="text-center">
<a href="/support/" class="support-link" title="Questions or concerns?">Questions or concerns?</a>
</div>
</div>
<ul class="accordion" data-accordion data-allow-all-closed="true" data-multi-expand="true">
<li class="accordion-item" data-accordion-item>
<!-- Accordion tab title -->
<a href="#" class="accordion-title">What's included</a>
<!-- Accordion tab content: it would start in the open state due to using the `is-active` state class. -->
<div class="accordion-content" data-tab-content>
<ul class="included-features">
<li>1 year of plugin updates</li>
<li>1 year of support</li>
<li>14-day money back guarantee</li>
</ul>
</div>
</li>
<li class="accordion-item" data-accordion-item>
<!-- Accordion tab title -->
<a href="#" class="accordion-title">Support</a>
<!-- Accordion tab content: it would start in the open state due to using the `is-active` state class. -->
<div class="accordion-content" data-tab-content>
<?php if ( $documentations = rbm_cpts_get_p2p_children( 'documentation' ) ) :
$documentation_link_text = _x( 'View plugin documentation', 'View Documentaion Link Text', THEME_ID );
$documentation = array_shift( $documentations );
?>
<a href="<?php echo get_permalink( $documentation ); ?>"
class="button secondary"
title="<?php echo $documentation_link_text; ?>">
<?php echo $documentation_link_text; ?>
</a>
<?php endif; ?>
<?php $support_link_text = _x( 'Contact support', 'Contact Support Link Text', THEME_ID ); ?>
<a href="/support/" class="button" title="<?php echo $support_link_text; ?>"><?php echo $support_link_text; ?></a>
</div>
</li>
<?php if ( get_post_meta( get_the_ID(), '_edd_sl_version', true ) || rbm_fh_get_field( 'requirements' ) ) : ?>
<li class="accordion-item is-active" data-accordion-item>
<!-- Accordion tab title -->
<a href="#" class="accordion-title">Details and Compatability</a>
<!-- Accordion tab content: it would start in the open state due to using the `is-active` state class. -->
<div class="accordion-content" data-tab-content>
<?php if ( class_exists( 'EDD_SL_Download' ) ) :
$sl_download = new EDD_SL_Download( get_the_ID() );
$current_version = $sl_download->get_version();
else :
$current_version = get_post_meta( get_the_ID(), '_edd_sl_version', true );
endif; ?>
<?php if ( $current_version ) : ?>
<div class="grid-x">
<div class="small-12 medium-5"><strong><?php echo _x( 'Version', 'Current Version Text', THEME_ID ); ?>: </strong></div>
<div class="small-12 medium-7">
<?php echo $current_version; ?>
<?php if ( $documentation && class_exists( 'EDD_SL_Download' ) ) :
$sl_download = new EDD_SL_Download( get_the_ID() );
?>
<?php if ( $changelog = $sl_download->get_changelog() ) :
$changelog_link_text = _x( 'Changelog', 'Changelog Link Text', THEME_ID );
?>
<br />
<a href="<?php echo get_permalink( $documentation ); ?>#changelog"
title="<?php echo $changelog_link_text; ?>">
<?php echo $changelog_link_text; ?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php
$readme = false;
if ( function_exists( 'rbm_get_readme' ) ) {
$readme = rbm_get_readme();
}
if ( $readme ) {
if ( function_exists( 'rbm_get_custom_readme_headers' ) && function_exists( 'rbm_get_readme_header' ) ) :
$custom_headers = rbm_get_custom_readme_headers();
$custom_headers = array_filter( $custom_headers, function( $key, $text ) {
if ( strpos( $key, 'tested' ) === false ) return false;
return true;
}, ARRAY_FILTER_USE_BOTH );
// The only default header for this in WP is for WP itself
// WP's official header text doesn't specify it is WordPress though, so we've added that here
$all_headers = array_unique( array_merge( array(
'WordPress' => 'tested',
), $custom_headers ) );
$found_headers = array_filter( $all_headers, function( $key, $text ) use ( $readme ) {
return array_key_exists( $key, $readme );
}, ARRAY_FILTER_USE_BOTH );
if ( ! empty( $found_headers ) ) : ?>
<div class="grid-x padding-x">
<div class="small-12 medium-5 cell">
<strong><?php echo _x( 'Tested With', 'Tested With Header', THEME_ID ); ?>:</strong>
</div>
<div class="small-12 medium-7 cell">
<ul class="tested-to">
<?php foreach ( $found_headers as $text => $key ) :
$value = rbm_get_readme_header( $key );
if ( ! $value ) continue;
if ( array_key_exists( $text, $custom_headers ) ) :
$text = preg_replace( '/tested up to/i', '', $text );
endif;
?>
<li><?php echo $text; ?> v<?php echo $value; ?></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php endif;
endif;
}
$requirements = rbm_fh_get_field( 'requirements' );
$found_headers = array();
if ( function_exists( 'rbm_get_custom_readme_headers' ) && function_exists( 'rbm_get_readme_header' ) ) :
$custom_headers = rbm_get_custom_readme_headers();
$custom_headers = array_filter( $custom_headers, function( $key, $text ) {
if ( strpos( $key, 'requires' ) === false ) return false;
return true;
}, ARRAY_FILTER_USE_BOTH );
// WP uses some not especially descriptive names for WP vs PHP headers, so this helps account for this
// The data has already been read via rbm_get_readme(), so we don't need to worry about the array keys below not matching
$all_headers = array_unique( array_merge( array(
//'Tested up to WordPress' => 'tested',
'WordPress' => 'requires',
'PHP' => 'requires_php',
), $custom_headers ) );
$found_headers = array_filter( $all_headers, function( $key, $text ) use ( $readme ) {
return array_key_exists( $key, $readme );
}, ARRAY_FILTER_USE_BOTH );
endif;
if ( ! empty( $found_headers ) || $requirements ) : ?>
<div class="grid-x padding-x">
<div class="small-12 medium-5 cell">
<strong><?php echo _x( 'Requirements', 'Requirements Header', THEME_ID ); ?>:</strong>
</div>
<div class="small-12 medium-7 cell">
<ul class="requirements">
<?php if ( ! empty( $found_headers ) ) :
$has_both_psp_pro_lite_requires = false;
// Account for displaying Requirements for Project Panorama Pro vs Lite
if ( in_array( 'requires_project_panorama_lite', $found_headers ) && in_array( 'requires_project_panorama', $found_headers ) ) {
$has_both_psp_pro_lite_requires = true;
unset( $found_headers[ array_search( 'requires_project_panorama_lite', $found_headers ) ] );
}
foreach ( $found_headers as $text => $key ) :
$value = rbm_get_readme_header( $key );
if ( ! $value ) continue;
if ( array_key_exists( $text, $custom_headers ) ) :
$text = preg_replace( '/Requires/i', '', $text );
endif; ?>
<?php if ( $key == 'requires_project_panorama' && $has_both_psp_pro_lite_requires ) :
$value = sprintf(
__( 'v%s or higher / Lite v%s or higher', 'real-big-plugins' ),
$value,
rbm_get_readme_header( 'requires_project_panorama_lite' )
);
else :
$value = sprintf( __( 'v%s or higher', 'real-big-plugins' ), $value );
endif; ?>
<li><?php echo $text; ?> <?php echo $value; ?></li>
<?php
endforeach;
else : ?>
<?php foreach ( $requirements as $item ) : ?>
<li><?php echo $item['requirement']; ?></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
</div>
<?php endif; ?>
</div>
</li>
<?php endif; ?>
</ul>
</div>
</aside>
</div>
</div>
<?php get_footer();