PluginProbe
Loading Page with Loading Screen / trunk
Loading Page with Loading Screen vtrunk
1.2.8 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 46 releases
loading-page / banner.php

banner.php in Loading Page with Loading Screen trunk, at banner.php

107 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $codepeople_promote_banner_plugins;
3 if ( empty( $codepeople_promote_banner_plugins ) ) {
4 $codepeople_promote_banner_plugins = array();
5 }
6 if ( ! function_exists( 'codepeople_add_promote_banner' ) ) {
7 function codepeople_add_promote_banner( $wp_admin_bar ) {
8 global $codepeople_promote_banner_plugins;
9
10 if (
11 empty( $codepeople_promote_banner_plugins ) ||
12 ! is_admin() ||
13 ! current_user_can( 'manage_options' )
14 ) {
15 return;
16 }
17
18 if( ! function_exists( 'get_current_screen' ) ) { return; }
19 $screen = get_current_screen();
20 if ( 'post' == $screen->post_type || 'page' == $screen->post_type ) {
21 return;
22 }
23
24 // Take action over the banner
25 if ( isset( $_POST['codepeople_promote_banner_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['codepeople_promote_banner_nonce'] ) ), __FILE__ ) ) {
26 if ( ! empty( $_POST['codepeople_promote_banner_plugin'] ) ) {
27 $_codepeople_promote_banner_plugin = sanitize_text_field( wp_unslash( $_POST['codepeople_promote_banner_plugin'] ) );
28 if ( ! empty( $codepeople_promote_banner_plugins[ $_codepeople_promote_banner_plugin ] ) ) {
29 set_transient( 'codepeople_promote_banner_' . $_codepeople_promote_banner_plugin, -1, 0 );
30 if (
31 ! empty( $_POST['codepeople_promote_banner_action'] ) &&
32 'set-review' == $_POST['codepeople_promote_banner_action'] &&
33 ! empty( $codepeople_promote_banner_plugins[ $_codepeople_promote_banner_plugin ]['plugin_url'] )
34 ) {
35 print '<script>document.location.href="' . str_replace( '&amp;', '&', esc_js( $codepeople_promote_banner_plugins[ $_codepeople_promote_banner_plugin ]['plugin_url'] ) ) . '";</script>'; // phpcs:ignore WordPress.Security.EscapeOutput
36 }
37 }
38 }
39 }
40
41 $minimum_days = 86400 * 7;
42 $now = time();
43
44 foreach ( $codepeople_promote_banner_plugins as $plugin_slug => $plugin_data ) {
45 $value = get_transient( 'codepeople_promote_banner_' . $plugin_slug );
46 if ( false === $value ) {
47 $value = $now;
48 set_transient( 'codepeople_promote_banner_' . $plugin_slug, $value, 0 );
49 }
50
51 if ( $minimum_days <= abs( $now - $value ) && 0 < $value * 1 ) {
52 ?>
53 <style>
54 #codepeople-review-banner{width:calc( 100% - 20px );width:-webkit-calc( 100% - 20px );width:-moz-calc( 100% - 20px );width:-o-calc( 100% - 20px );border:10px solid #1582AB;background:#FFF;display:table;}
55 #codepeople-review-banner form{float:left; padding:0 5px;}
56 #codepeople-review-banner .codepeople-review-banner-picture{width:120px;padding:10px 10px 10px 10px;float:left;text-align:center;}
57 #codepeople-review-banner .codepeople-review-banner-content{float: left;padding:10px;width: calc( 100% - 160px );width: -webkit-calc( 100% - 160px );width: -moz-calc( 100% - 160px );width: -o-calc( 100% - 160px );}
58 #codepeople-review-banner .codepeople-review-banner-buttons{padding-top:20px;}
59 #codepeople-review-banner .no-thank-button,
60 #codepeople-review-banner .main-button{height: 28px;border-width:1px;border-style:solid;border-radius:5px;text-decoration: none;}
61 #codepeople-review-banner .main-button{background: #0085ba;border-color: #0073aa #006799 #006799;-webkit-box-shadow: 0 1px 0 #006799;box-shadow: 0 1px 0 #006799;color: #fff;text-decoration: none;text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;}
62 #codepeople-review-banner .no-thank-button {color: #555;border-color: #cccccc;background: #f7f7f7;-webkit-box-shadow: 0 1px 0 #cccccc;box-shadow: 0 1px 0 #cccccc;vertical-align: top;}
63 #codepeople-review-banner .main-button:hover,#codepeople-review-banner .main-button:focus{background: #008ec2;border-color: #006799;color: #fff;}
64 #codepeople-review-banner .no-thank-button:hover,
65 #codepeople-review-banner .no-thank-button:focus{background: #fafafa;border-color: #999;color: #23282d;}
66 @media screen AND (max-width:760px)
67 {
68 #codepeople-review-banner{position:relative;top:50px;}
69 #codepeople-review-banner .codepeople-review-banner-picture{display:none;}
70 #codepeople-review-banner .codepeople-review-banner-content{width:calc( 100% - 20px );width:-webkit-calc( 100% - 20px );width:-moz-calc( 100% - 20px );width:-o-calc( 100% - 20px );}
71 }
72 </style>
73 <div id="codepeople-review-banner">
74 <div class="codepeople-review-banner-picture">
75 <img alt="" src="https://secure.gravatar.com/avatar/c0662edcefb5a4e2ab12803856ba2358?s=150&amp;d=mm&amp;r=g" style="width:80px;">
76 </div>
77 <div class="codepeople-review-banner-content">
78 <div class="codepeople-review-banner-text">
79 <p><strong>Want to help to the development of the "<?php print esc_html( $plugin_data['plugin_name'] ); ?>" plugin?</strong> The main features of this plugin are provided free of charge. We need your help to continue developing it and adding new features. If you want to help with the development please <span style="color:#1582AB;font-weight:bold;">add a review to support it</span>. Thank you!</p>
80 </div>
81 <div class="codepeople-review-banner-buttons">
82 <form method="post" target="_blank">
83 <button class="main-button" onclick="jQuery(this).closest('[id=\'codepeople-review-banner\']').hide();">Publish a Review</button>
84 <input type="hidden" name="codepeople_promote_banner_plugin" value="<?php echo esc_attr( $plugin_slug ); ?>" />
85 <input type="hidden" name="codepeople_promote_banner_action" value="set-review" />
86 <input type="hidden" name="codepeople_promote_banner_nonce" value="<?php echo esc_attr( wp_create_nonce( __FILE__ ) ); ?>" />
87 </form>
88 <form method="post">
89 <button class="no-thank-button">No Thanks</button>
90 <input type="hidden" name="codepeople_promote_banner_plugin" value="<?php echo esc_attr( $plugin_slug ); ?>" />
91 <input type="hidden" name="codepeople_promote_banner_action" value="not-thanks" />
92 <input type="hidden" name="codepeople_promote_banner_nonce" value="<?php echo esc_attr( wp_create_nonce( __FILE__ ) ); ?>" />
93 </form>
94 <div style="clear:both;display:block;"></div>
95 </div>
96 <div style="clear:both;"></div>
97 </div>
98 <div style="clear:both;"></div>
99 </div>
100 <?php
101 return;
102 }
103 }
104 }
105 add_action( 'admin_bar_menu', 'codepeople_add_promote_banner' );
106 } // End codepeople_promote_banner block
107