nombre = __('Add to Cart Button Custom Text', 'add-to-cart-custom-text'); $this->domain = 'add-to-cart-custom-text'; $this->gestor = 'options-general.php?page=add-to-cart'; $this->campos = false; $this->archivos = array('class', 'options'); $this->clases = array('EJR_Add_To_Cart', 'Opciones_EJR_Add_To_Cart'); $this->dirname = dirname (__FILE__); $this->carga_archivos($this->archivos, $this->campos); $this->carga_traducciones($this->domain); register_activation_hook (__FILE__, function () { set_transient ($this->domain . '-activado', true, 5); }, 10 ); add_action ('init', array($this, 'arranca_plugin'), 10); add_action ('admin_notices' , array( $this, 'aviso_ayuda'), 10); add_filter ('plugin_action_links', array($this, 'enlaces_accion'), 10, 2); } public function __clone () { _doing_it_wrong (__FUNCTION__, sprintf (__('You cannot clone instances of %s.', 'add-to-cart-custom-text'), get_class ($this)), '2.1.2'); } public function carga_archivos ($archivos, $campos) { foreach ($archivos as $archivo) require ($this->dirname . '/' . $archivo . '.php'); } public function arranca_plugin () { if ($this->woocommerce_activo()) foreach ($this->clases as $clase) new $clase; } private function woocommerce_activo () { if (!class_exists ('WooCommerce')) { add_action ('admin_notices', function () { ?>

' . __($this->nombre, 'add-to-cart-custom-text') . ''); ?>

domain . '-activado')) { ?>

' . $this->nombre . '' ); ?>

%s', $this->gestor, __('Settings')); ?>

dirname . '/lang/' . $domain . '-' . $locale . '.mo'); load_plugin_textdomain ($domain, false, $this->dirname . '/lang'); } public function enlaces_accion ($damelinks, $plugin) { static $addtocart; isset ($addtocart) or $addtocart = plugin_basename (__FILE__); if ($addtocart == $plugin) { $enlaces['settings'] = '' . __('Settings') . ''; $damelinks = array_merge ($enlaces, $damelinks); } return $damelinks; } public static function instancia () { if (null === self::$instancia) self::$instancia = new self(); return self::$instancia; } } endif; Plugin_EJR_Add_To_Cart::instancia();