Exemplo n.º 1
0
function awpcp_modules_manager()
{
    static $instance = null;
    if (is_null($instance)) {
        $instance = new AWPCP_ModulesManager(awpcp(), awpcp_licenses_manager(), awpcp_modules_updater(), awpcp()->settings);
    }
    return $instance;
}
function awpcp_update_license_status_request_handler()
{
    return new AWPCP_UpdateLicenseStatusRequestHandler(awpcp_licenses_manager(), awpcp_modules_manager(), awpcp_request());
}
Exemplo n.º 3
0
 public function license($args)
 {
     $setting = $args['setting'];
     $module_name = $args['module_name'];
     $module_slug = $args['module_slug'];
     $this->licenses_manager = awpcp_licenses_manager();
     $license = $this->get_option($setting->name);
     echo '<input id="' . $setting->name . '" class="regular-text" type="text" name="awpcp-options[' . $setting->name . ']" value="' . esc_attr($license) . '">';
     if (!empty($license)) {
         if ($this->licenses_manager->is_license_valid($module_name, $module_slug)) {
             echo '<input class="button-secondary" type="submit" name="awpcp-deactivate-' . $module_slug . '-license" value="' . __('Deactivate License', 'AWPCP') . '"/>';
             echo '<br>Status: <span class="awpcp-license-status awpcp-license-valid">' . __('active', 'AWPCP') . '</span>.';
         } else {
             if ($this->licenses_manager->is_license_inactive($module_name, $module_slug)) {
                 echo '<input class="button-secondary" type="submit" name="awpcp-activate-' . $module_slug . '-license" value="' . __('Activate License', 'AWPCP') . '"/>';
                 echo '<br>Status: <span class="awpcp-license-status awpcp-license-inactive">' . __('inactive', 'AWPCP') . '</span>.';
             } else {
                 if ($this->licenses_manager->is_license_expired($module_name, $module_slug)) {
                     echo '<input class="button-secondary" type="submit" name="awpcp-check-' . $module_slug . '-license" value="' . __('Check License', 'AWPCP') . '"/>';
                     echo '<br>Status: <span class="awpcp-license-status awpcp-license-expired">' . __('expired', 'AWPCP') . '</span>.';
                 } else {
                     echo '<br>Status: <span class="awpcp-license-status awpcp-license-invalid">' . __('invalid', 'AWPCP') . '</span>. Please contact customer support.';
                 }
             }
         }
         wp_nonce_field('awpcp-update-license-status-nonce', 'awpcp-update-license-status-nonce');
     }
 }