Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-content
/
plugins
/
woocommerce
/
includes
/
abstracts
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if (!defined('ABSPATH')) { exit; } require_once WC_ABSPATH . 'includes/legacy/abstract-wc-legacy-payment-token.php'; abstract class WC_Payment_Token extends WC_Legacy_Payment_Token { protected $data = array('gateway_id' => '', 'token' => '', 'is_default' => false, 'user_id' => 0, 'type' => ''); protected $type = ''; public function __construct($token = '') { parent::__construct($token); if (is_numeric($token)) { $this->set_id($token); } elseif (is_object($token)) { $token_id = $token->get_id(); if (!empty($token_id)) { $this->set_id($token->get_id()); } } else { $this->set_object_read(true); } $this->data_store = WC_Data_Store::load('payment-token'); if ($this->get_id() > 0) { $this->data_store->read($this); } } public function get_token($context = 'view') { return $this->get_prop('token', $context); } public function get_type($deprecated = '') { return $this->type; } public function get_display_name($deprecated = '') { return $this->get_type(); } public function get_user_id($context = 'view') { return $this->get_prop('user_id', $context); } public function get_gateway_id($context = 'view') { return $this->get_prop('gateway_id', $context); } public function get_is_default($context = 'view') { return $this->get_prop('is_default', $context); } public function set_token($token) { $this->set_prop('token', $token); } public function set_user_id($user_id) { $this->set_prop('user_id', absint($user_id)); } public function set_gateway_id($gateway_id) { $this->set_prop('gateway_id', $gateway_id); } public function set_default($is_default) { $this->set_prop('is_default', (bool) $is_default); } public function is_default() { return (bool) $this->get_prop('is_default', 'view'); } public function validate() { $token = $this->get_prop('token', 'edit'); if (empty($token)) { return false; } return true; } }