コード例 #1
0
 /**
  * Show a form where users can enter their license key
  * Takes Multisites into account
  *
  * @param bool $embedded
  * @return null
  */
 public function show_license_form($embedded = true)
 {
     // For non-multisites, always show the license form
     if (!is_multisite()) {
         parent::show_license_form($embedded);
         return;
     }
     // Plugin is network activated
     if ($this->is_network_activated) {
         // We're on the network admin
         if (is_network_admin()) {
             parent::show_license_form($embedded);
         } else {
             // We're not in the network admin area, show a notice
             parent::show_license_form_heading();
             if (is_super_admin()) {
                 echo "<p>" . sprintf(__('%s is network activated, you can manage your license in the <a href="%s">network admin license page</a>.', $this->product->get_text_domain()), $this->product->get_item_name(), $this->product->get_license_page_url()) . "</p>";
             } else {
                 echo "<p>" . sprintf(__('%s is network activated, please contact your site administrator to manage the license.', $this->product->get_text_domain()), $this->product->get_item_name()) . "</p>";
             }
         }
     } else {
         if (false == is_network_admin()) {
             parent::show_license_form($embedded);
         }
     }
 }