コード例 #1
0
 public function init()
 {
     Stripe_Checkout_Pro_Licenses::get_instance();
     Stripe_Checkout_Scripts::get_instance();
     Stripe_Checkout_Shortcodes::get_instance();
     if (is_admin()) {
         Stripe_Checkout_Admin::get_instance();
         Stripe_Checkout_Pro_Admin::get_instance();
         //Stripe_Checkout_Upgrade_Link::get_instance();
         Stripe_Checkout_Notices::get_instance();
         Stripe_Checkout_System_Status::get_instance();
     } else {
         Stripe_Checkout_Misc::get_instance();
     }
     // Need to leave outside of is_admin check or the AJAX will not work properly
     Stripe_Checkout_Pro_Functions::get_instance();
 }
 public function license_field($id, $product)
 {
     $value = $this->get_setting_value($id);
     $item = '';
     $html = '<div class="sc-license-wrap">' . "\n";
     $html .= '<input type="text" class="sc-license-input regular-text" id="' . esc_attr($this->get_setting_id($id)) . '" ' . 'name="' . esc_attr($this->get_setting_id($id)) . '" value="' . trim(esc_attr($value)) . '"/>' . "\n";
     $license = get_option('sc_license');
     $license_action = '';
     $button_text = '';
     // Add button on side of input
     if (!empty($license) && $license == 'valid' && !(null === $value)) {
         $license_action = 'deactivate_license';
         $button_text = __('Deactivate', 'sc');
     } else {
         $license_action = 'activate_license';
         $button_text = __('Activate', 'sc');
     }
     $html .= '<button class="sc-license-action button" data-sc-action="' . $license_action . '" ' . 'data-sc-item="' . esc_attr($product) . '">' . $button_text . '</button>';
     if (!empty($license) && !(null === $value)) {
         $valid = Stripe_Checkout_Pro_Licenses::check_license($value, $product);
         $license_class = '';
         $valid_message = '';
         if ($valid == 'valid') {
             $license_class = 'sc-valid';
             $valid_message = __('License is valid and active.', 'sc');
         } else {
             if ($valid == 'notfound') {
                 $license_class = 'sc-invalid';
                 $valid_message = __('License service could not be found. Please contact support for additional help.', 'sc');
             } else {
                 $license_class = 'sc-inactive';
                 $valid_message = __('License is inactive.', 'sc');
             }
         }
     } else {
         $license_class = 'sc-inactive';
         $valid_message = __('License is inactive.', 'sc');
     }
     $html .= '<span class="sc-spinner spinner"></span>';
     $html .= '<span class="sc-license-message ' . $license_class . '">' . $valid_message . '</span>';
     $html .= '</div>';
     echo $html;
 }
コード例 #3
0
 /**
  * Return an instance of this class.
  *
  * @since     1.0.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }