Example #1
0
 /**
  * Checks if the software is activated or deactivated
  * @param  array $args
  * @return array
  */
 public function status($args)
 {
     $defaults = array('request' => 'status', 'product_id' => ASW()->asw_product_id, 'instance' => ASW()->asw_instance_id, 'platform' => ASW()->asw_domain);
     $args = wp_parse_args($defaults, $args);
     $target_url = self::create_software_api_url($args);
     $request = wp_remote_get($target_url);
     if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) {
         // Request failed
         return false;
     }
     $response = wp_remote_retrieve_body($request);
     return $response;
 }
		<div id="message" class="error">
			<p><?php 
        printf(__('The API Manager Example API License Key has not been activated, so the plugin is inactive! %sClick here%s to activate the license key and the plugin.', 'atos_text_domain'), '<a href="' . esc_url(admin_url('options-general.php?page=atos_sips_dashboard')) . '">', '</a>');
        ?>
</p>
		</div>
		<?php 
    }
}
// End of class
function ASW()
{
    return Atos_Sips::instance();
}
// Initialize the class instance only once
ASW();
/*
*
*
*/
load_plugin_textdomain('atos', false, dirname(plugin_basename(__FILE__)) . '/lang');
function woocommerce_gateway_atos_activation()
{
    if (!is_plugin_active('woocommerce/woocommerce.php')) {
        deactivate_plugins(plugin_basename(__FILE__));
        $message = sprintf(__("Désolé ! Pour utiliser l'extension de passerelle WooCommerce %s, vous devez installer et activer l'extension WooCommerce.", 'atos'), 'Atos Sips');
        wp_die($message, __('Extension Passerelle de Paiement Atos Sips', 'atos'), array('back_link' => true));
    }
}
register_activation_hook(__FILE__, 'woocommerce_gateway_atos_activation');
add_action('plugins_loaded', 'init_gateway_atos', 0);
 public function css_scripts()
 {
     wp_register_style(ASW()->asw_data_key . '-css', ASW()->plugin_url() . 'am/assets/css/admin-settings.css', array(), ASW()->version, 'all');
     wp_enqueue_style(ASW()->asw_data_key . '-css');
 }