PluginProbe
WP Ultimate Post Grid / 2.8.2
WP Ultimate Post Grid v2.8.2
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / helpers / giveaway.php

giveaway.php in WP Ultimate Post Grid 2.8.2, at helpers/giveaway.php

39 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class WPUPG_Giveaway {
4
5 public function __construct()
6 {
7 $now = new DateTime();
8 $giveaway_start = new DateTime( '2018-11-06 10:00:00', new DateTimeZone( 'Europe/Brussels' ) );
9 $giveaway_end = new DateTime( '2018-11-22 10:00:00', new DateTimeZone( 'Europe/Brussels' ) );
10
11 if ( $giveaway_start < $now && $now < $giveaway_end ) {
12 add_action( 'admin_menu', array( $this, 'add_submenu_page' ), 99 );
13 add_action( 'admin_notices', array( $this, 'giveaway_notice' ) );
14 }
15 }
16
17 public function add_submenu_page()
18 {
19 add_submenu_page( 'edit.php?post_type=' . WPUPG_POST_TYPE, 'Giveaway', '~ Plugin Giveaway! ~', 'manage_options', 'wpupg_giveaway', array( $this, 'page_template' ) );
20 }
21
22 public function page_template() {
23 echo '<div class="wrap">';
24 echo '<h1>Plugin Giveaway</h1>';
25 echo '<script src="https://static.airtable.com/js/embed/embed_snippet_v1.js"></script><iframe class="airtable-embed airtable-dynamic-height" src="https://airtable.com/embed/shrJNq8xN0gOqfEiY?backgroundColor=green" frameborder="0" onmousewheel="" width="100%" height="1535" style="background: transparent; border: 1px solid #ccc;"></iframe>';
26 echo '</div>';
27 }
28
29 public function giveaway_notice()
30 {
31 $screen = get_current_screen();
32
33 if ( 'edit-wpupg_grid' === $screen->id ) {
34 echo '<div class="updated" style="padding: 10px;">';
35 echo '<strong>Feeling lucky?</strong> Win plugins in our <a href="' . esc_url( admin_url( 'edit.php?post_type=' . WPUPG_POST_TYPE . '&page=wpupg_giveaway' ) ) . '" target="_blank">Black Friday Giveaway</a>!';
36 echo '</div>';
37 }
38 }
39 }