Skip to content
Snippets Groups Projects
Select Git revision
  • cebd322069fc2941e6148e1dac0c7da8885e0fc1
  • main default protected
  • revert-ffead0bd
  • feature/init
  • 1.1.8
  • 1.1.7
  • 1.1.6
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.2
  • 1.0.2-beta3
  • 1.0.2-beta2
  • 1.0.2-beta1
  • 1.0.1
  • 1.0.1-beta4
  • 1.0.1-beta3
  • 1.0.1-beta2
  • 1.0.1-beta1
  • 1.0.0
  • 1.0.0-beta6
24 results

Reminder.php

Blame
  • Reminder.php 1.43 KiB
    <?php
    
    namespace ReminderNamespace;
    
    class Reminder {
    
    	private $logo_url = 'logo-url';
    
    	public function __construct() {
    		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_reminder_script' ) );
    		add_action( 'admin_footer', array( $this, 'display_html_element' ) );
    	}
    
    	public function enqueue_reminder_script() {
    		if ( ! $this->is_plugin_activated() ) {
    			wp_enqueue_script(
    				'wpdesk-activation-reminder',
    				plugins_url( 'popup-javascript-file' ),
    				array(),
    				'script-version',
    				true
    			);
    
    			wp_enqueue_style(
    				'wpdesk-activation-reminder',
    				plugins_url( 'popup-css-file' ),
    				array(),
    				'script-version'
    			);
    		}
    	}
    
    	public function display_html_element() {
    		if ( ! $this->is_plugin_activated() ) {
    			$logo_url          = plugins_url( 'plugin-dir' . '/' . $this->logo_url );
    			$cookie_name       = md5( site_url() . 'plugin-dir' );
    			$subscriptions_url = admin_url( 'admin.php?page=wpdesk-licenses' );
    			$read_more_url     = 'https://flexibleshipping.com';
    			echo "<span class=\"wpdesk-activation-reminder\" data-plugin_title=\"plugin-title\" data-plugin_dir=\"plugin-dir\" data-logo_url=\"$logo_url\" data-cookie_name=\"$cookie_name\" data-subscriptions_url=\"$subscriptions_url\" data-buy_plugin_url=\"buy-plugin-url\" data-read_more_url=\"$read_more_url\"></span>";
    		}
    	}
    
    	private function is_plugin_activated() {
    		return get_option( 'api_plugin-dir_activated', '' ) === 'Activated';
    	}
    
    }
    
    new Reminder();