/**
  * Construct and initialize the main plugin class
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN);
     // register importers
     add_action('admin_init', array($this, 'admin_init'));
     // add the menu itme
     add_action('admin_menu', array($this, 'admin_menu'));
     add_action('admin_print_styles', array($this, 'admin_scripts'));
 }
 /**
  * Initializes the plugin
  *
  * @since 1.0
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN);
     // Hook for order status when payment is complete
     add_filter('woocommerce_payment_complete_order_status', array($this, 'handle_payment_complete_order_status'), 10, 2);
     // admin
     if (is_admin() && !defined('DOING_AJAX')) {
         // add general settings
         add_filter('woocommerce_general_settings', array($this, 'add_global_settings'));
     }
 }
 /**
  * Returns conditional dependencies based on the provider selected
  *
  * @since 1.0.0
  * @see SV_WC_Plugin::get_dependencies()
  * @return array of dependencies
  */
 protected function get_dependencies()
 {
     $dependencies = array();
     foreach ($this->get_providers() as $provider) {
         if ('twitter' === $provider->get_id() && $provider->is_enabled()) {
             $dependencies[] = 'curl';
         }
     }
     return array_merge(parent::get_dependencies(), $dependencies);
 }
 /**
  * Render a notice for the user to read the docs before adding add-ons
  *
  * @since 1.0.0
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     // show any dependency notices
     parent::add_admin_notices();
     $screen = get_current_screen();
     // only render on plugins or settings screen
     if ('plugins' === $screen->id || $this->is_plugin_settings()) {
         $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing Memberships! To get started, take a minute to %sread the documentation%s and then %ssetup a membership plan%s :)', self::TEXT_DOMAIN), '<a href="http://docs.woothemes.com/document/woocommerce-memberships/" target="_blank">', '</a>', '<a href="' . admin_url('edit.php?post_type=wc_membership_plan') . '">', '</a>'), 'get-started-notice', array('always_show_on_settings' => false, 'notice_class' => 'updated'));
     }
 }
 /**
  * Renders any admin notices
  *
  * @since 3.2.0
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_delayed_admin_notices()
 {
     parent::add_delayed_admin_notices();
     // onboarding!
     if (!get_option('wc_freshbooks_api_url')) {
         if (get_option('wc_freshbooks_upgraded_from_v2')) {
             $message = __('Thanks for upgrading to the latest WooCommerce FreshBooks plugin! Please double-check your %sinvoice settings%s.', self::TEXT_DOMAIN);
         } else {
             $message = __('Thanks for installing the WooCommerce FreshBooks plugin! To get started, please %sadd your FreshBooks API credentials%s. ', self::TEXT_DOMAIN);
         }
         $this->get_admin_notice_handler()->add_admin_notice(sprintf($message, '<a href="' . $this->get_settings_url() . '">', '</a>'), 'welcome-notice', array('notice_class' => 'updated'));
     }
 }
 /**
  * Checks if required PHP extensions are loaded and adds an admin notice
  * for any missing extensions.  Also plugin settings can be checked
  * as well.
  *
  * @since 2.1.1
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     parent::add_admin_notices();
     $this->add_file_permissions_notices();
 }
 /**
  * Checks if the configure-complus message needs to be rendered
  *
  * @since 1.5.3
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     parent::add_admin_notices();
     // on the plugin settings page render a notice if 3DSecure is enabled and mcrypt is not installed
     if ($this->is_plugin_settings()) {
         $wc_gateway_realex = new WC_Gateway_Realex();
         if ($wc_gateway_realex->is_enabled()) {
             $threedsecure = $wc_gateway_realex->get_threedsecure();
             if ($threedsecure->is_enabled() && !extension_loaded('mcrypt')) {
                 $message = sprintf(__('WooCommerce Realex Payment Gateway: 3DSecure: PHP extension %1$smcrypt%2$s not detected, 3DSecure will not be active and no liability shift will occur until you install the %3$smcrypt%4$s PHP extension.  Contact your host or server administrator to configure and install PHP mcrypt.', 'woocommerce-gateway-realex'), '<strong>', '</strong>', '<a href="http://www.php.net/manual/en/mcrypt.setup.php">', '</a>');
                 $this->get_admin_notice_handler()->add_admin_notice($message, 'mcrypt-missing');
             }
         }
     }
     // check ssl dependency
     $this->check_ssl();
 }
 /**
  * Render a notice for the user to read the docs before adding add-ons
  *
  * @since 1.0.0
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     // show any dependency notices
     parent::add_admin_notices();
     $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing Product Reviews Pro! Before getting started, please take a moment to %sread the documentation%s :) ', self::TEXT_DOMAIN), '<a href="http://docs.woothemes.com/document/woocommerce-product-reviews-pro/" target="_blank">', '</a>'), 'read-the-docs-notice', array('always_show_on_settings' => false, 'notice_class' => 'updated'));
 }
 /**
  * Return the plugin action links.  This will only be called if the plugin
  * is active.
  *
  * @since 1.0
  * @see SV_WC_Plugin::plugin_action_links()
  * @param array $actions associative array of action names to anchor tags
  * @return array associative array of plugin action links
  */
 public function plugin_action_links($actions)
 {
     $actions = parent::plugin_action_links($actions);
     // remove the configure plugin link if it exists, since we'll be adding a link per available gateway
     if (isset($actions['configure'])) {
         unset($actions['configure']);
     }
     // a configure link per gateway
     $custom_actions = array();
     foreach ($this->get_gateway_ids() as $gateway_id) {
         $custom_actions['configure_' . $gateway_id] = $this->get_settings_link($gateway_id);
     }
     // add the links to the front of the actions list
     return array_merge($custom_actions, $actions);
 }
 /**
  * Initializes the plugin
  *
  * @since 2.0
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN, array('dependencies' => array('dom', 'SimpleXML', 'xmlwriter')));
     // include required files
     add_action('sv_wc_framework_plugins_loaded', array($this, 'includes'));
     // admin
     if (is_admin() && !defined('DOING_AJAX')) {
         // tweak the CSS for the order notes so super-long Amazon transaction IDs fit properly
         add_action('admin_print_styles', array($this, 'render_embedded_styles'), 1);
     }
     // process the redirect from Amazon after a customer confirms their payment
     add_action('wp', array($this, 'process_redirect'));
 }
 /**
  * Render a notice for the user to select their desired export format
  *
  * @since 2.1
  * @see SV_WC_Plugin::render_admin_notices()
  */
 public function render_admin_notices()
 {
     // show any dependency notices
     parent::render_admin_notices();
     $settings = get_option('woocommerce_braintree_settings');
     // install notice
     if (empty($settings) && !$this->is_message_dismissed('install-notice')) {
         $this->add_dismissible_notice(sprintf(__('Thanks for installing the WooCommerce Braintree plugin! To start accepting payments, %sset your Braintree API credentials%s. Need help? See the %sdocumentation%s. ', self::TEXT_DOMAIN), '<a href="' . $this->get_settings_url() . '">', '</a>', '<a target="_blank" href="' . $this->get_documentation_url() . '">', '</a>'), 'install-notice');
     }
     // SSL check (only when enabled in production mode)
     if (isset($settings['enabled']) && 'yes' == $settings['enabled']) {
         if (isset($settings['environment']) && 'production' == $settings['environment']) {
             if ('no' === get_option('woocommerce_force_ssl_checkout') && !$this->is_message_dismissed('ssl-recommended-notice')) {
                 $this->add_dismissible_notice(__('WooCommerce is not being forced over SSL -- Braintree recommends forcing the checkout over SSL for maximum security. ', self::TEXT_DOMAIN), 'ssl-recommended-notice');
             }
         }
     }
 }
 /**
  * Render a notice for the user to read the docs before adding custom fields
  *
  * @since 1.1.4
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     // show any dependency notices
     parent::add_admin_notices();
     // add notice for selecting export format
     if ($this->is_plugin_settings()) {
         $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing Admin Custom Order Fields! Before you get started, please %sread the documentation%s', WC_Admin_Custom_Order_Fields::TEXT_DOMAIN), '<a href="' . $this->get_documentation_url() . '">', '</a>'), 'read-the-docs', array('always_show_on_settings' => false));
     }
 }
 /**
  * Setup main plugin class
  *
  * @since 1.0
  * @see SV_WC_Plugin::__construct()
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN);
     $this->includes();
     add_action('init', array($this, 'init'));
     add_action('init', array($this, 'include_template_functions'), 25);
     add_filter('woocommerce_product_tabs', array($this, 'setup_tabs'), 98);
     // allow the use of shortcodes within the tab content
     add_filter('woocommerce_tab_manager_tab_panel_content', 'do_shortcode');
 }
 /**
  * Checks if required PHP extensions are loaded and SSL is enabled. Adds an admin notice if either check fails.
  * Also gateway settings are checked as well.
  *
  * @since 1.2.3
  * @see SV_WC_Plugin::add_delayed_admin_notices()
  */
 public function add_delayed_admin_notices()
 {
     parent::add_delayed_admin_notices();
     // show a notice for any settings/configuration issues
     $this->add_ssl_required_admin_notice();
 }
 /**
  * Log messages to WooCommerce error log if logging is enabled
  *
  * /wp-content/woocommerce/logs/twilio-sms.txt
  *
  * @since 1.1
  * @param string $content message to log
  * @param string $_ unused
  */
 public function log($content, $_ = null)
 {
     if ('yes' == get_option('wc_twilio_sms_log_errors ')) {
         parent::log($content);
     }
 }
 /**
  * Render a notice for the user to read the docs before using the plugin
  *
  * @since 1.0.0
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     // show any dependency notices
     parent::add_admin_notices();
     $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing Order Status Manager! Before you get started, please take a moment to %sread through the documentation%s.', $this->text_domain), '<a href="' . $this->get_documentation_url() . '">', '</a>'), 'read-the-docs', array('always_show_on_settings' => false, 'notice_class' => 'updated'));
 }
 /**
  * Construct and initialize the main plugin class
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, array('dependencies' => array('mbstring')));
     // Initialize
     add_action('init', array($this, 'includes'));
 }
 /**
  * Construct and initialize the main plugin class
  *
  * @see SV_WC_Plugin::__construct()
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN);
     // include required files
     $this->includes();
     add_action('woocommerce_init', array($this, 'woocommerce_init'));
     add_action('sv_wc_framework_plugins_loaded', array($this, 'init'));
 }
 /**
  * Plugin constructor
  *
  * @see SV_WC_Plugin::__construct()
  */
 public function __construct()
 {
     parent::__construct(self::PLUGIN_ID, self::VERSION, self::TEXT_DOMAIN);
     // set the custom order number on the new order.  we hook into woocommerce_checkout_update_order_meta for orders which are created
     //  from the frontend, and we hook into woocommerce_process_shop_order_meta for admin-created orders.
     //  Note we use these actions rather than the more generic wp_insert_post action because we want to
     //  run after the order meta (including totals) are set so we can detect whether this is a free order
     add_action('woocommerce_checkout_update_order_meta', array($this, 'set_sequential_order_number'), 10, 2);
     add_action('woocommerce_process_shop_order_meta', array($this, 'set_sequential_order_number'), 15, 2);
     add_action('woocommerce_before_resend_order_emails', array($this, 'set_sequential_order_number'), 10, 1);
     // return our custom order number for display
     add_filter('woocommerce_order_number', array($this, 'get_order_number'), 10, 2);
     // order tracking page search by order number
     add_filter('woocommerce_shortcode_order_tracking_order_id', array($this, 'find_order_by_order_number'));
     // WC Subscriptions support: prevent unnecessary order meta from polluting parent renewal orders, and set order number for subscription orders
     add_filter('woocommerce_subscriptions_renewal_order_meta_query', array($this, 'subscriptions_remove_renewal_order_meta'), 10, 4);
     add_action('woocommerce_subscriptions_renewal_order_created', array($this, 'subscriptions_set_sequential_order_number'), 9, 4);
     if (is_admin()) {
         // keep the admin order search/order working properly
         add_filter('request', array($this, 'woocommerce_custom_shop_order_orderby'), 20);
         add_filter('woocommerce_shop_order_search_fields', array($this, 'custom_search_fields'));
         // sort by underlying _order_number on the Pre-Orders table
         add_filter('wc_pre_orders_edit_pre_orders_request', array($this, 'custom_orderby'));
         add_filter('wc_pre_orders_search_fields', array($this, 'custom_search_fields'));
         // inject our admin options
         add_filter('woocommerce_general_settings', array($this, 'admin_settings'));
         add_action('woocommerce_settings_start', array($this, 'admin_settings_js'));
         // roll my own Settings field error check, which isn't beautiful, but is important
         add_filter('pre_update_option_woocommerce_order_number_start', array($this, 'validate_order_number_start_setting'), 10, 2);
         // pre WC 2.1
         add_filter('wp_redirect', array($this, 'add_settings_error_msg'), 10, 2);
         // add support for the CSV export plugin
         add_filter('woocommerce_export_csv_extra_columns', array($this, 'export_csv_extra_columns'));
         add_action('woocommerce_settings_start', array($this, 'add_settings_errors'));
     }
 }
 /**
  * Convenience method to add delayed admin notices, which may depend upon
  * some setting being saved prior to determining whether to render
  *
  * @since 3.0.0
  * @see SV_WC_Plugin::add_delayed_admin_notices()
  */
 public function add_delayed_admin_notices()
 {
     parent::add_delayed_admin_notices();
     // notices for ssl requirement
     $this->add_ssl_admin_notices();
     // notices for currency issues
     $this->add_currency_admin_notices();
     // notices for subscriptions/pre-orders
     $this->add_integration_requires_tokenization_notices();
 }
 /**
  * Render a notice for the user to select their desired export format
  *
  * @since 3.4.0
  * @see SV_WC_Plugin::add_admin_notices()
  */
 public function add_admin_notices()
 {
     // show any dependency notices
     parent::add_admin_notices();
     // add notice for selecting export format
     $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing the Customer/Order CSV Export plugin! To get started, please %sset your export format%s. ', WC_Customer_Order_CSV_Export::TEXT_DOMAIN), '<a href="' . $this->get_settings_url() . '">', '</a>'), 'export-format-notice', array('always_show_on_settings' => false, 'notice_class' => 'updated'));
 }