Example #1
0
 /**
  * @return bool
  */
 public static function register()
 {
     if (self::$registered === true) {
         /*
          * Autoloader already registered
          */
         return false;
     }
     // Set registered
     self::$registered = true;
     return spl_autoload_register(array(__CLASS__, "autoload"));
 }
/**
 * Called when plugin is activated
 */
function mollie_wc_plugin_activation_hook()
{
    // WooCommerce plugin not activated
    if (!is_plugin_active('woocommerce/woocommerce.php')) {
        $title = sprintf(__('Could not activate plugin %s', 'mollie-payments-for-woocommerce'), 'Mollie Payments for WooCommerce');
        $message = '' . '<h1><strong>' . $title . '</strong></h1><br/>' . 'WooCommerce plugin not activated. Please activate WooCommerce plugin first.';
        wp_die($message, $title, array('back_link' => true));
        return;
    }
    // Register Mollie autoloader
    Mollie_WC_Autoload::register();
    $status_helper = Mollie_WC_Plugin::getStatusHelper();
    if (!$status_helper->isCompatible()) {
        $title = 'Could not activate plugin ' . Mollie_WC_Plugin::PLUGIN_TITLE;
        $message = '<h1><strong>Could not activate plugin ' . Mollie_WC_Plugin::PLUGIN_TITLE . '</strong></h1><br/>' . implode('<br/>', $status_helper->getErrors());
        wp_die($message, $title, array('back_link' => true));
        return;
    }
}