403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.147.46.136
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/AutomaticEmails/WooCommerce/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/AutomaticEmails/WooCommerce/WooCommerce.php
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing

namespace MailPoet\AutomaticEmails\WooCommerce;

if (!defined('ABSPATH')) exit;


use MailPoet\AutomaticEmails\AutomaticEmails;
use MailPoet\WooCommerce\Helper as WooCommerceHelper;
use MailPoet\WP\Functions as WPFunctions;
use MailPoet\WP\Notice;

class WooCommerce {
  const SLUG = 'woocommerce';
  const EVENTS_FILTER = 'mailpoet_woocommerce_events';

  /** @var WooCommerceHelper */
  private $woocommerceHelper;

  /** @var string[] */
  public $availableEvents = [
    'AbandonedCart',
    'FirstPurchase',
    'PurchasedInCategory',
    'PurchasedProduct',
  ];

  /** @var bool */
  private $woocommerceEnabled;

  /** @var WPFunctions */
  private $wp;

  /** @var WooCommerceEventFactory */
  private $eventFactory;

  public function __construct(
    WPFunctions $wp,
    WooCommerceHelper $woocommerceHelper,
    WooCommerceEventFactory $eventFactory
  ) {
    $this->wp = $wp;
    $this->woocommerceHelper = $woocommerceHelper;
    $this->woocommerceEnabled = $this->isWoocommerceEnabled();
    $this->eventFactory = $eventFactory;
  }

  public function init() {
    $this->wp->addFilter(
      AutomaticEmails::FILTER_PREFIX . self::SLUG,
      [
        $this,
        'setupGroup',
      ]
    );
    $this->wp->addFilter(
      self::EVENTS_FILTER,
      [
        $this,
        'setupEvents',
      ]
    );
  }

  public function setupGroup() {
    return [
      'slug' => self::SLUG,
      'title' => __('WooCommerce', 'mailpoet'),
      'description' => __('Automatically send an email based on your customers’ purchase behavior. Enhance your customer service and start increasing sales with WooCommerce follow up emails.', 'mailpoet'),
      'events' => $this->wp->applyFilters(self::EVENTS_FILTER, []),
    ];
  }

  public function setupEvents($events) {
    $customEventDetails = (!$this->woocommerceEnabled) ? [
      'actionButtonTitle' => __('WooCommerce is required', 'mailpoet'),
      'actionButtonLink' => 'https://wordpress.org/plugins/woocommerce/',
    ] : [];

    foreach ($this->availableEvents as $event) {
      $eventInstance = in_array($event, $this->availableEvents, true)
        ? $this->eventFactory->createEvent($event)
        : null;

      if (!$eventInstance) {
        $this->displayEventWarning($event);
        continue;
      }

      if (method_exists($eventInstance, 'init')) {
        $eventInstance->init();
      } else {
        $this->displayEventWarning($event);
        continue;
      }

      if (method_exists($eventInstance, 'getEventDetails')) {
        $eventDetails = array_merge($eventInstance->getEventDetails(), $customEventDetails);
      } else {
        $this->displayEventWarning($event);
        continue;
      }
      $events[] = $eventDetails;
    }

    return $events;
  }

  public function isWoocommerceEnabled() {
    return $this->woocommerceHelper->isWooCommerceActive();
  }

  private function displayEventWarning($event) {
    $notice = sprintf('%s %s',
      // translators: %s is the name of the event.
      sprintf(__('WooCommerce %s event is misconfigured.', 'mailpoet'), $event),
      __('Please contact our technical support for assistance.', 'mailpoet')
    );
    Notice::displayWarning($notice);
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit