Submit
Path:
~
/
/
var
/
softaculous
/
sitepad
/
editor
/
site-data
/
plugins
/
kkart-pro
/
includes
/
rest-api
/
Controllers
/
Version3
/
File Content:
class-kkart-rest-customers-controller.php
<?php /** * REST API Customers controller * * Handles requests to the /customers endpoint. * * @package Kkart\RestApi * @since 2.6.0 */ defined( 'ABSPATH' ) || exit; /** * REST API Customers controller class. * * @package Kkart\RestApi * @extends KKART_REST_Customers_V2_Controller */ class KKART_REST_Customers_Controller extends KKART_REST_Customers_V2_Controller { /** * Endpoint namespace. * * @var string */ protected $namespace = 'kkart/v3'; /** * Get formatted item data. * * @param KKART_Data $object KKART_Data instance. * * @since 3.0.0 * @return array */ protected function get_formatted_item_data( $object ) { $data = $object->get_data(); $format_date = array( 'date_created', 'date_modified' ); // Format date values. foreach ( $format_date as $key ) { // Date created is stored UTC, date modified is stored WP local time. $datetime = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[ $key ]->getTimestamp() ) ) : $data[ $key ]; $data[ $key ] = kkart_rest_prepare_date_response( $datetime, false ); $data[ $key . '_gmt' ] = kkart_rest_prepare_date_response( $datetime ); } return array( 'id' => $object->get_id(), 'date_created' => $data['date_created'], 'date_created_gmt' => $data['date_created_gmt'], 'date_modified' => $data['date_modified'], 'date_modified_gmt' => $data['date_modified_gmt'], 'email' => $data['email'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'role' => $data['role'], 'username' => $data['username'], 'billing' => $data['billing'], 'shipping' => $data['shipping'], 'is_paying_customer' => $data['is_paying_customer'], 'avatar_url' => $object->get_avatar_url(), 'meta_data' => $data['meta_data'], ); } /** * Get the Customer's schema, conforming to JSON Schema. * * @return array */ public function get_item_schema() { $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'customer', 'type' => 'object', 'properties' => array( 'id' => array( 'description' => __( 'Unique identifier for the resource.', 'kkart' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( 'description' => __( "The date the customer was created, in the site's timezone.", 'kkart' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( 'description' => __( 'The date the customer was created, as GMT.', 'kkart' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( 'description' => __( "The date the customer was last modified, in the site's timezone.", 'kkart' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( 'description' => __( 'The date the customer was last modified, as GMT.', 'kkart' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'email' => array( 'description' => __( 'The email address for the customer.', 'kkart' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'first_name' => array( 'description' => __( 'Customer first name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'last_name' => array( 'description' => __( 'Customer last name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'role' => array( 'description' => __( 'Customer role.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'username' => array( 'description' => __( 'Customer login name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_user', ), ), 'password' => array( 'description' => __( 'Customer password.', 'kkart' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'billing' => array( 'description' => __( 'List of billing address data.', 'kkart' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( 'description' => __( 'First name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( 'description' => __( 'Last name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( 'description' => __( 'Company name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( 'description' => __( 'Address line 1', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( 'description' => __( 'Address line 2', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( 'description' => __( 'City name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( 'description' => __( 'ISO code or name of the state, province or district.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( 'description' => __( 'Postal code.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( 'description' => __( 'ISO code of the country.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( 'description' => __( 'Email address.', 'kkart' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( 'description' => __( 'Phone number.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( 'description' => __( 'List of shipping address data.', 'kkart' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( 'description' => __( 'First name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( 'description' => __( 'Last name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( 'description' => __( 'Company name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( 'description' => __( 'Address line 1', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( 'description' => __( 'Address line 2', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( 'description' => __( 'City name.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( 'description' => __( 'ISO code or name of the state, province or district.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( 'description' => __( 'Postal code.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( 'description' => __( 'ISO code of the country.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'is_paying_customer' => array( 'description' => __( 'Is the customer a paying customer?', 'kkart' ), 'type' => 'bool', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'avatar_url' => array( 'description' => __( 'Avatar URL.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( 'description' => __( 'Meta data.', 'kkart' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( 'description' => __( 'Meta ID.', 'kkart' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( 'description' => __( 'Meta key.', 'kkart' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( 'description' => __( 'Meta value.', 'kkart' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), ), ), ), ), ); return $this->add_additional_fields_schema( $schema ); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
class-kkart-rest-controller.php
15901 bytes
0644
class-kkart-rest-coupons-controller.php
465 bytes
0644
class-kkart-rest-crud-controller.php
21621 bytes
0644
class-kkart-rest-customer-downloads-controller.php
537 bytes
0644
class-kkart-rest-customers-controller.php
10321 bytes
0644
class-kkart-rest-data-continents-controller.php
10996 bytes
0644
class-kkart-rest-data-controller.php
4787 bytes
0644
class-kkart-rest-data-countries-controller.php
6722 bytes
0644
class-kkart-rest-data-currencies-controller.php
6191 bytes
0644
class-kkart-rest-network-orders-controller.php
506 bytes
0644
class-kkart-rest-order-notes-controller.php
5935 bytes
0644
class-kkart-rest-order-refunds-controller.php
2737 bytes
0644
class-kkart-rest-orders-controller.php
8140 bytes
0644
class-kkart-rest-payment-gateways-controller.php
7865 bytes
0644
class-kkart-rest-posts-controller.php
23621 bytes
0644
class-kkart-rest-product-attribute-terms-controller.php
577 bytes
0644
class-kkart-rest-product-attributes-controller.php
531 bytes
0644
class-kkart-rest-product-categories-controller.php
9014 bytes
0644
class-kkart-rest-product-reviews-controller.php
38831 bytes
0644
class-kkart-rest-product-shipping-classes-controller.php
567 bytes
0644
class-kkart-rest-product-tags-controller.php
495 bytes
0644
class-kkart-rest-product-variations-controller.php
30271 bytes
0644
class-kkart-rest-products-controller.php
45219 bytes
0644
class-kkart-rest-report-coupons-totals-controller.php
3512 bytes
0644
class-kkart-rest-report-customers-totals-controller.php
3845 bytes
0644
class-kkart-rest-report-orders-totals-controller.php
3166 bytes
0644
class-kkart-rest-report-products-totals-controller.php
3289 bytes
0644
class-kkart-rest-report-reviews-totals-controller.php
3354 bytes
0644
class-kkart-rest-report-sales-controller.php
490 bytes
0644
class-kkart-rest-report-top-sellers-controller.php
520 bytes
0644
class-kkart-rest-reports-controller.php
1594 bytes
0644
class-kkart-rest-setting-options-controller.php
7440 bytes
0644
class-kkart-rest-settings-controller.php
3158 bytes
0644
class-kkart-rest-shipping-methods-controller.php
516 bytes
0644
class-kkart-rest-shipping-zone-locations-controller.php
556 bytes
0644
class-kkart-rest-shipping-zone-methods-controller.php
544 bytes
0644
class-kkart-rest-shipping-zones-controller-base.php
3702 bytes
0644
class-kkart-rest-shipping-zones-controller.php
496 bytes
0644
class-kkart-rest-system-status-controller.php
498 bytes
0644
class-kkart-rest-system-status-tools-controller.php
531 bytes
0644
class-kkart-rest-tax-classes-controller.php
491 bytes
0644
class-kkart-rest-taxes-controller.php
453 bytes
0644
class-kkart-rest-terms-controller.php
25608 bytes
0644
class-kkart-rest-webhooks-controller.php
634 bytes
0644
N4ST4R_ID | Naxtarrr