wp-content-copy-protector
Last commit date
css
20 hours ago
images
20 hours ago
js
20 hours ago
languages
20 hours ago
admin-core.php
20 hours ago
deactivation-survey.php
20 hours ago
notifications.php
20 hours ago
preventer-index.php
20 hours ago
readme.txt
20 hours ago
right-click-protection.jpg
20 hours ago
the_globals.php
20 hours ago
watermark-adv.jpg
20 hours ago
watermarking-adv-examples.png
20 hours ago
notifications.php
161 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | // Exit if accessed directly. |
| 4 | exit; |
| 5 | } |
| 6 | // Use your own prefix, i use "wccp_free_", replace it; |
| 7 | $wccp_free_icon_path = plugins_url( '/images/icon-128x128.png' , __FILE__); |
| 8 | $wccp_free_rating_url = "https://wordpress.org/support/plugin/wp-content-copy-protector/reviews/"; |
| 9 | $wccp_free_activation_time = 604800; // 7 days in seconds |
| 10 | $wccp_free_file_version = 2.1; |
| 11 | $wccp_free_development_mode = false; // Put yes to allow development mode, you will see the rating notice without timers |
| 12 | |
| 13 | /** |
| 14 | * @since 1.9 |
| 15 | * @version 1.9 |
| 16 | * @class wccp_free_Notification |
| 17 | */ |
| 18 | |
| 19 | if ( ! class_exists( 'wccp_free_Notification' ) ) : |
| 20 | |
| 21 | class wccp_free_Notification { |
| 22 | |
| 23 | /* * * * * * * * * * |
| 24 | * Class constructor |
| 25 | * * * * * * * * * */ |
| 26 | public function __construct() { |
| 27 | |
| 28 | $this->_hooks(); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Hook into actions and filters |
| 33 | * @since 1.0.0 |
| 34 | * @version 1.2.1 |
| 35 | */ |
| 36 | private function _hooks() { |
| 37 | add_action( 'admin_init', array( $this, 'wccp_free_review_notice' ) ); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Ask users to review our plugin on wordpress.org |
| 42 | * |
| 43 | * @since 1.0.11 |
| 44 | * @return boolean false |
| 45 | * @version 1.1.3 |
| 46 | */ |
| 47 | public function wccp_free_review_notice() { |
| 48 | |
| 49 | global $wccp_free_file_version, $wccp_free_activation_time, $wccp_free_development_mode; |
| 50 | |
| 51 | $this->wccp_free_review_dismissal(); |
| 52 | |
| 53 | $this->wccp_free_review_pending(); |
| 54 | |
| 55 | $wccp_free_activation_time = get_site_option( 'wccp_free_active_time' ); |
| 56 | |
| 57 | $review_dismissal = get_site_option( 'wccp_free_review_dismiss' ); |
| 58 | |
| 59 | if ($review_dismissal == 'yes' && !$wccp_free_development_mode) return; |
| 60 | |
| 61 | if ( !$wccp_free_activation_time && !$wccp_free_development_mode ) : |
| 62 | |
| 63 | $wccp_free_activation_time = time(); // Reset Time to current time. |
| 64 | add_site_option( 'wccp_free_active_time', $wccp_free_activation_time ); |
| 65 | |
| 66 | endif; |
| 67 | if ($wccp_free_development_mode) $wccp_free_activation_time = 432001; //This variable used to show the message always for testing purposes only |
| 68 | // 432000 = 5 Days in seconds. |
| 69 | if ( time() - $wccp_free_activation_time > 432000 ) : |
| 70 | |
| 71 | wp_enqueue_style( 'wccp_free_review_stlye', plugins_url( '/css/style-review.css', __FILE__ ), array(), $wccp_free_file_version ); |
| 72 | add_action( 'admin_notices' , array( $this, 'wccp_free_review_notice_message' ) ); |
| 73 | |
| 74 | endif; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Check and Dismiss review message. |
| 79 | * |
| 80 | * @since 1.9 |
| 81 | */ |
| 82 | private function wccp_free_review_dismissal() { |
| 83 | |
| 84 | if ( ! is_admin() || |
| 85 | ! current_user_can( 'manage_options' ) || |
| 86 | ! isset( $_GET['_wpnonce'] ) || |
| 87 | ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wccp_free_review-nonce' ) || |
| 88 | ! isset( $_GET['wccp_free_review_dismiss'] ) ) : |
| 89 | |
| 90 | return; |
| 91 | endif; |
| 92 | |
| 93 | add_site_option( 'wccp_free_review_dismiss', 'yes' ); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Set time to current so review notice will popup after 14 days |
| 98 | * |
| 99 | * @since 1.9 |
| 100 | */ |
| 101 | private function wccp_free_review_pending() { |
| 102 | |
| 103 | if ( ! is_admin() || |
| 104 | ! current_user_can( 'manage_options' ) || |
| 105 | ! isset( $_GET['_wpnonce'] ) || |
| 106 | ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'wccp_free_review-nonce' ) || |
| 107 | ! isset( $_GET['wccp_free_review_later'] ) ) : |
| 108 | |
| 109 | return; |
| 110 | endif; |
| 111 | |
| 112 | // Reset Time to current time. |
| 113 | update_site_option( 'wccp_free_active_time', time() ); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Review notice message |
| 118 | * |
| 119 | * @since 1.0.11 |
| 120 | */ |
| 121 | public function wccp_free_review_notice_message() { |
| 122 | |
| 123 | $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; |
| 124 | $scheme = ( wp_parse_url( $request_uri, PHP_URL_QUERY ) ) ? '&' : '?'; |
| 125 | $url = $request_uri . $scheme . 'wccp_free_review_dismiss=yes'; |
| 126 | $dismiss_url = wp_nonce_url( $url, 'wccp_free_review-nonce' ); |
| 127 | |
| 128 | $_later_link = $request_uri . $scheme . 'wccp_free_review_later=yes'; |
| 129 | $later_url = wp_nonce_url( $_later_link, 'wccp_free_review-nonce' ); |
| 130 | |
| 131 | global $wccp_free_icon_path; |
| 132 | |
| 133 | global $wccp_free_rating_url; |
| 134 | ?> |
| 135 | |
| 136 | <div class="wccp_free_review-notice"> |
| 137 | <div class="wccp_free_review-thumbnail"> |
| 138 | <img src="<?php echo esc_url( $wccp_free_icon_path ); ?>" alt=""> |
| 139 | </div> |
| 140 | <div class="wccp_free_review-text"> |
| 141 | <h3><?php esc_html_e( 'Leave A Review?', 'wp-content-copy-protector' ) ?></h3> |
| 142 | <p><?php echo wp_kses( __( 'We hope you\'ve enjoyed using WP copy Protection :) Would you mind taking a few minutes to write a review on WordPress.org?<br>Just writing simple "thank you" will make us happy!', 'wp-content-copy-protector' ), array( 'br' => array() ) ) ?></p> |
| 143 | <ul class="wccp_free_review-ul"> |
| 144 | <li><a href="<?php echo esc_url( $wccp_free_rating_url ); ?>" target="_blank"><span class="dashicons dashicons-external"></span><?php esc_html_e( 'Sure! I\'d love to!', 'wp-content-copy-protector' ) ?></a></li> |
| 145 | <li><a href="<?php echo esc_url( $dismiss_url ) ?>"><span class="dashicons dashicons-smiley"></span><?php esc_html_e( 'I\'ve already left a review', 'wp-content-copy-protector' ) ?></a></li> |
| 146 | <li><a href="<?php echo esc_url( $later_url ) ?>"><span class="dashicons dashicons-calendar-alt"></span><?php esc_html_e( 'Will Rate Later', 'wp-content-copy-protector' ) ?></a></li> |
| 147 | <li><a href="<?php echo esc_url( $dismiss_url ) ?>"><span class="dashicons dashicons-dismiss"></span><?php esc_html_e( 'Hide Forever', 'wp-content-copy-protector' ) ?></a></li></ul> |
| 148 | </div> |
| 149 | </div> |
| 150 | <?php |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | endif; |
| 155 | $wccp_free_admincore = ''; |
| 156 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only reading the current admin screen slug, nothing is processed or saved. |
| 157 | if ( isset( $_GET['page'] ) ) $wccp_free_admincore = sanitize_key( wp_unslash( $_GET['page'] ) ); |
| 158 | if($wccp_free_admincore != 'wccpoptionspro') { |
| 159 | new wccp_free_Notification(); |
| 160 | } |
| 161 | ?> |