PluginProbe
WP Ultimate Post Grid / 2.6.0
WP Ultimate Post Grid v2.6.0
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.6.0, at helpers/giveaway.php

40 lines 1.5 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( '2017-11-16 10:00:00', new DateTimeZone( 'Europe/Brussels' ) );
9 $giveaway_end = new DateTime( '2017-11-24 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 '<a class="e-widget no-button" href="https://gleam.io/dY9yY/black-friday-2017" rel="nofollow">Black Friday Giveaway 2017</a>';
26 echo '<script type="text/javascript" src="https://js.gleam.io/e.js" async="true"></script>';
27 echo '</div>';
28 }
29
30 public function giveaway_notice()
31 {
32 $screen = get_current_screen();
33
34 if ( 'edit-wpupg_grid' === $screen->id ) {
35 echo '<div class="updated" style="padding: 10px;">';
36 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>!';
37 echo '</div>';
38 }
39 }
40 }