403Webshell
Server IP : 104.21.14.103  /  Your IP : 3.146.176.172
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/proc/self/root/proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Automation/Integrations/WooCommerce/Fields/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Automation/Integrations/WooCommerce/Fields/CustomerFieldsFactory.php
<?php declare(strict_types = 1);

namespace MailPoet\Automation\Integrations\WooCommerce\Fields;

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


use MailPoet\Automation\Engine\Data\Field;
use MailPoet\Automation\Integrations\WooCommerce\Payloads\CustomerPayload;

class CustomerFieldsFactory {
  /** @var CustomerOrderFieldsFactory */
  private $customerOrderFieldsFactory;

  /** @var CustomerReviewFieldsFactory */
  private $customerReviewFieldsFactory;

  public function __construct(
    CustomerOrderFieldsFactory $customerOrderFieldsFactory,
    CustomerReviewFieldsFactory $customerReviewFieldsFactory
  ) {
    $this->customerOrderFieldsFactory = $customerOrderFieldsFactory;
    $this->customerReviewFieldsFactory = $customerReviewFieldsFactory;
  }

  /** @return Field[] */
  public function getFields(): array {
    return array_merge(
      [
        new Field(
          'woocommerce:customer:billing-company',
          Field::TYPE_STRING,
          __('Billing company', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_billing_company() : null;
          }
        ),
        new Field(
          'woocommerce:customer:billing-phone',
          Field::TYPE_STRING,
          __('Billing phone', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_billing_phone() : null;
          }
        ),
        new Field(
          'woocommerce:customer:billing-city',
          Field::TYPE_STRING,
          __('Billing city', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_billing_city() : null;
          }
        ),
        new Field(
          'woocommerce:customer:billing-postcode',
          Field::TYPE_STRING,
          __('Billing postcode', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_billing_postcode() : null;
          }
        ),
        new Field(
          'woocommerce:customer:billing-state',
          Field::TYPE_STRING,
          __('Billing state/county', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_billing_state() : null;
          }
        ),
        new Field(
          'woocommerce:customer:billing-country',
          Field::TYPE_ENUM,
          __('Billing country', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_billing_country() : null;
          },
          [
            'options' => $this->getBillingCountryOptions(),
          ]
        ),
        new Field(
          'woocommerce:customer:shipping-company',
          Field::TYPE_STRING,
          __('Shipping company', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_shipping_company() : null;
          }
        ),
        new Field(
          'woocommerce:customer:shipping-phone',
          Field::TYPE_STRING,
          __('Shipping phone', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_shipping_phone() : null;
          }
        ),
        new Field(
          'woocommerce:customer:shipping-city',
          Field::TYPE_STRING,
          __('Shipping city', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_shipping_city() : null;
          }
        ),
        new Field(
          'woocommerce:customer:shipping-postcode',
          Field::TYPE_STRING,
          __('Shipping postcode', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_shipping_postcode() : null;
          }
        ),
        new Field(
          'woocommerce:customer:shipping-state',
          Field::TYPE_STRING,
          __('Shipping state/county', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_shipping_state() : null;
          }
        ),
        new Field(
          'woocommerce:customer:shipping-country',
          Field::TYPE_ENUM,
          __('Shipping country', 'mailpoet'),
          function (CustomerPayload $payload) {
            $customer = $payload->getCustomer();
            return $customer ? $customer->get_shipping_country() : null;
          },
          [
            'options' => $this->getShippingCountryOptions(),
          ]
        ),
      ],
      $this->customerOrderFieldsFactory->getFields(),
      $this->customerReviewFieldsFactory->getFields()
    );
  }

  private function getBillingCountryOptions(): array {
    $options = [];
    foreach (WC()->countries->get_allowed_countries() as $code => $name) {
      $options[] = ['id' => $code, 'name' => $name];
    }
    return $options;
  }

  private function getShippingCountryOptions(): array {
    $options = [];
    foreach (WC()->countries->get_shipping_countries() as $code => $name) {
      $options[] = ['id' => $code, 'name' => $name];
    }
    return $options;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit