banner.php
14 hours ago
cp-feedback.php
14 hours ago
cp_admin_int_edition.inc.php
14 hours ago
cpabc_appointments_admin_addbk.inc.php
14 hours ago
cpabc_appointments_admin_int.inc.php
14 hours ago
cpabc_appointments_admin_int_bookings_list.inc.php
14 hours ago
cpabc_appointments_admin_int_calendar_list.inc.php
14 hours ago
cpabc_appointments_admin_int_edit_booking.inc.php
14 hours ago
cpabc_apps_go.inc.php
14 hours ago
cpabc_apps_on.inc.php
14 hours ago
cpabc_publish_wizzard.inc.php
14 hours ago
cpabc_scheduler.inc.php
14 hours ago
index.html
14 hours ago
banner.php
105 lines
| 1 | <?php |
| 2 | global $codepeople_promote_banner_plugins; |
| 3 | if(empty($codepeople_promote_banner_plugins)) $codepeople_promote_banner_plugins = array(); |
| 4 | if(!function_exists( 'codepeople_add_promote_banner' )) |
| 5 | { |
| 6 | function codepeople_add_promote_banner($wp_admin_bar) |
| 7 | { |
| 8 | global $codepeople_promote_banner_plugins; |
| 9 | |
| 10 | if( empty($codepeople_promote_banner_plugins) || !is_admin() ) return; |
| 11 | |
| 12 | $screen = get_current_screen(); |
| 13 | if ( ($screen->post_type == 'page' || $screen->post_type == 'post') && $screen->base == 'post') return; |
| 14 | |
| 15 | // Take action over the banner |
| 16 | if(isset($_POST['codepeople_promote_banner_nonce']) && wp_verify_nonce($_POST['codepeople_promote_banner_nonce'], __FILE__)) |
| 17 | { |
| 18 | $codepeople_promote_banner_plugin = sanitize_key($_POST['codepeople_promote_banner_plugin']); |
| 19 | if( |
| 20 | !empty($codepeople_promote_banner_plugin) && |
| 21 | !empty($codepeople_promote_banner_plugins[$codepeople_promote_banner_plugin]) |
| 22 | ) |
| 23 | { |
| 24 | set_transient( 'codepeople_promote_banner_'.$codepeople_promote_banner_plugin, -1, 0); |
| 25 | if( |
| 26 | !empty($_POST['codepeople_promote_banner_action']) && |
| 27 | $_POST['codepeople_promote_banner_action'] == 'set-review' && |
| 28 | !empty($codepeople_promote_banner_plugins[$codepeople_promote_banner_plugin]['plugin_url']) |
| 29 | ) |
| 30 | { |
| 31 | print '<script>document.location.href="'.esc_js($codepeople_promote_banner_plugins[$codepeople_promote_banner_plugin]['plugin_url']).'";</script>'; |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | $minimum_days = 86400*7; |
| 37 | $now = time(); |
| 38 | |
| 39 | foreach($codepeople_promote_banner_plugins as $plugin_slug => $plugin_data ) |
| 40 | { |
| 41 | $value = get_transient( 'codepeople_promote_banner_'.$plugin_slug ); |
| 42 | if( $value === false ) |
| 43 | { |
| 44 | $value = $now; |
| 45 | set_transient( 'codepeople_promote_banner_'.$plugin_slug, $value, 0 ); |
| 46 | } |
| 47 | |
| 48 | if($minimum_days <= abs($now-$value) && 0<$value) |
| 49 | { |
| 50 | ?> |
| 51 | <style> |
| 52 | #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;} |
| 53 | #codepeople-review-banner form{float:left; padding:0 5px;} |
| 54 | #codepeople-review-banner .codepeople-review-banner-picture{width:120px;padding:10px 10px 10px 10px;float:left;text-align:center;} |
| 55 | #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 );} |
| 56 | #codepeople-review-banner .codepeople-review-banner-buttons{padding-top:20px;} |
| 57 | #codepeople-review-banner .no-thank-button, |
| 58 | #codepeople-review-banner .main-button{height: 28px;border-width:1px;border-style:solid;border-radius:5px;text-decoration: none;} |
| 59 | #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;} |
| 60 | #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;} |
| 61 | #codepeople-review-banner .main-button:hover,#codepeople-review-banner .main-button:focus{background: #008ec2;border-color: #006799;color: #fff;} |
| 62 | #codepeople-review-banner .no-thank-button:hover, |
| 63 | #codepeople-review-banner .no-thank-button:focus{background: #fafafa;border-color: #999;color: #23282d;} |
| 64 | @media screen AND (max-width:760px) |
| 65 | { |
| 66 | #codepeople-review-banner{position:relative;top:50px;} |
| 67 | #codepeople-review-banner .codepeople-review-banner-picture{display:none;} |
| 68 | #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 );} |
| 69 | } |
| 70 | </style> |
| 71 | <div id="codepeople-review-banner"> |
| 72 | <div class="codepeople-review-banner-picture"> |
| 73 | <img alt="" src="https://secure.gravatar.com/avatar/c0662edcefb5a4e2ab12803856ba2358?s=150&d=mm&r=g" style="width:80px;"> |
| 74 | </div> |
| 75 | <div class="codepeople-review-banner-content"> |
| 76 | <div class="codepeople-review-banner-text"> |
| 77 | <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> |
| 78 | </div> |
| 79 | <div class="codepeople-review-banner-buttons"> |
| 80 | <form method="post" target="_blank"> |
| 81 | <button class="main-button" onclick="jQuery(this).closest('[id=\'codepeople-review-banner\']').hide();">Publish a Review</button> |
| 82 | <input type="hidden" name="codepeople_promote_banner_plugin" value="<?php echo esc_attr($plugin_slug); ?>" /> |
| 83 | <input type="hidden" name="codepeople_promote_banner_action" value="set-review" /> |
| 84 | <input type="hidden" name="codepeople_promote_banner_nonce" value="<?php echo esc_attr(wp_create_nonce(__FILE__)); ?>" /> |
| 85 | </form> |
| 86 | <form method="post"> |
| 87 | <button class="no-thank-button">No Thanks</button> |
| 88 | <input type="hidden" name="codepeople_promote_banner_plugin" value="<?php echo esc_attr($plugin_slug); ?>" /> |
| 89 | <input type="hidden" name="codepeople_promote_banner_action" value="not-thanks" /> |
| 90 | <input type="hidden" name="codepeople_promote_banner_nonce" value="<?php echo esc_attr(wp_create_nonce(__FILE__)); ?>" /> |
| 91 | </form> |
| 92 | <div style="clear:both;display:block;"></div> |
| 93 | </div> |
| 94 | <div style="clear:both;"></div> |
| 95 | </div> |
| 96 | <div style="clear:both;"></div> |
| 97 | </div> |
| 98 | <?php |
| 99 | return; |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | add_action( 'admin_bar_menu', 'codepeople_add_promote_banner' ); |
| 104 | } // End codepeople_promote_banner block |
| 105 | ?> |