WC_Gateway_Paypal_Buttons{} │ WC 1.0

Устарела с версии 0.5.0. Больше не поддерживается и может быть удалена. Используйте Automattic\WooCommerce\Gateways\PayPal\Buttons. This class will be removed in 11.0.0.

Handles PayPal Buttons.

Хуков нет.

Использование

$WC_Gateway_Paypal_Buttons = new WC_Gateway_Paypal_Buttons();
// use class methods

Методы

  1. public __construct( WC_Gateway_Paypal $gateway )
  2. public get_options()
  3. public get_common_options()
  4. public get_client_id()
  5. public get_page_type()
  6. public is_enabled()
  7. public get_current_page_for_app_switch()

Список изменений

Устарела с 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons instead. This class will be removed in 11.0.0.

Код WC_Gateway_Paypal_Buttons{} WC 11.2.2

class WC_Gateway_Paypal_Buttons {

	/**
	 * The delegated buttons instance.
	 *
	 * @var PayPalButtons
	 */
	private $buttons;

	/**
	 * Constructor.
	 *
	 * @param WC_Gateway_Paypal $gateway The gateway instance.
	 */
	public function __construct( WC_Gateway_Paypal $gateway ) {
		$this->buttons = new PayPalButtons( $gateway );
	}

	/**
	 * Get the options for the PayPal buttons.
	 *
	 * @return array
	 *
	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_options() instead. This method will be removed in 11.0.0.
	 */
	public function get_options() {
		wc_deprecated_function(
			__METHOD__,
			'10.5.0',
			'Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_options() instead.'
		);

		return $this->buttons->get_options();
	}

	/**
	 * Get the common attributes for the PayPal JS SDK script and modules.
	 *
	 * @return array
	 *
	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_common_options() instead. This method will be removed in 11.0.0.
	 */
	public function get_common_options() {
		wc_deprecated_function(
			__METHOD__,
			'10.5.0',
			'Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_common_options() instead.'
		);

		return $this->buttons->get_common_options();
	}

	/**
	 * Get the client-id for the PayPal buttons.
	 *
	 * @return string|null The PayPal client-id, or null if the request fails.
	 *
	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_client_id() instead. This method will be removed in 11.0.0.
	 */
	public function get_client_id() {
		wc_deprecated_function(
			__METHOD__,
			'10.5.0',
			'Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_client_id() instead.'
		);

		return $this->buttons->get_client_id();
	}

	/**
	 * Get the page type for the PayPal buttons.
	 *
	 * @return string
	 *
	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_page_type() instead. This method will be removed in 11.0.0.
	 */
	public function get_page_type() {
		wc_deprecated_function(
			__METHOD__,
			'10.5.0',
			'Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_page_type() instead.'
		);

		return $this->buttons->get_page_type();
	}

	/**
	 * Whether PayPal Buttons is enabled.
	 *
	 * @return bool
	 *
	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons::is_enabled() instead. This method will be removed in 11.0.0.
	 */
	public function is_enabled() {
		wc_deprecated_function(
			__METHOD__,
			'10.5.0',
			'Use Automattic\WooCommerce\Gateways\PayPal\Buttons::is_enabled() instead.'
		);

		return $this->buttons->is_enabled();
	}

	/**
	 * Get the current page URL, to be used for App Switch.
	 * Limited to checkout, cart, and product pages for security.
	 *
	 * @return string
	 *
	 * @deprecated 10.5.0 Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_current_page_for_app_switch() instead. This method will be removed in 11.0.0.
	 */
	public function get_current_page_for_app_switch() {
		wc_deprecated_function(
			__METHOD__,
			'10.5.0',
			'Use Automattic\WooCommerce\Gateways\PayPal\Buttons::get_current_page_for_app_switch() instead.'
		);

		return $this->buttons->get_current_page_for_app_switch();
	}
}