Use PHP 7.4 featers and PHP 8 polyfills
This commit is contained in:
@ -46,7 +46,7 @@ class Broadcast_Query extends Post_Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Broadcast';
|
||||
protected $item_shape = \WP_Ultimo\Models\Broadcast::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -73,9 +73,9 @@ class Broadcast_Query extends Post_Query {
|
||||
* @param array $query Query parameters being passed.
|
||||
* @return array
|
||||
*/
|
||||
public function query($query = array()) {
|
||||
public function query($query = []) {
|
||||
|
||||
$query['type__in'] = array('broadcast_email', 'broadcast_notice');
|
||||
$query['type__in'] = ['broadcast_email', 'broadcast_notice'];
|
||||
|
||||
return parent::query($query);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Checkout_Form_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Checkout_Forms\\Checkout_Forms_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Checkout_Forms\Checkout_Forms_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Checkout_Form_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Checkout_Form';
|
||||
protected $item_shape = \WP_Ultimo\Models\Checkout_Form::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Checkout_Form_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class Checkout_Forms_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,9 +28,9 @@ class Checkout_Forms_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,26 +38,26 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'slug',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -65,31 +65,31 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'settings',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'transition' => true,
|
||||
'allow_null' => false,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'custom_css',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'allowed_countries',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -97,9 +97,9 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -107,7 +107,7 @@ class Checkout_Forms_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Checkout_Forms_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Event constructor.
|
||||
@ -73,7 +73,7 @@ final class Checkout_Forms_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL auto_increment,
|
||||
name tinytext NOT NULL DEFAULT '',
|
||||
@ -93,10 +93,10 @@ final class Checkout_Forms_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Customer_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Customers\\Customers_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Customers\Customers_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Customer_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Customer';
|
||||
protected $item_shape = \WP_Ultimo\Models\Customer::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Customer_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
// $query['type'] = 'customer';
|
||||
|
||||
|
@ -64,7 +64,7 @@ final class Customers_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class Customers_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
// id
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -40,27 +40,27 @@ class Customers_Schema extends Schema {
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// user_id
|
||||
array(
|
||||
[
|
||||
'name' => 'user_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'type',
|
||||
'type' => 'varchar',
|
||||
'default' => 'customer',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_registered
|
||||
array(
|
||||
[
|
||||
'name' => 'date_registered',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -68,28 +68,28 @@ class Customers_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// email_verification
|
||||
array(
|
||||
[
|
||||
'name' => 'email_verification',
|
||||
'type' => 'enum(\'verified\', \'pending\', \'none\')',
|
||||
'default' => 'none',
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// last_login
|
||||
array(
|
||||
[
|
||||
'name' => 'last_login',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// has_trialed
|
||||
array(
|
||||
[
|
||||
'name' => 'has_trialed',
|
||||
'type' => 'smallint',
|
||||
'length' => '',
|
||||
@ -97,10 +97,10 @@ class Customers_Schema extends Schema {
|
||||
'default' => null,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// vip
|
||||
array(
|
||||
[
|
||||
'name' => 'vip',
|
||||
'type' => 'smallint',
|
||||
'length' => '',
|
||||
@ -108,25 +108,25 @@ class Customers_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// ips
|
||||
array(
|
||||
[
|
||||
'name' => 'ips',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// Added on 2.0 beta 7
|
||||
array(
|
||||
[
|
||||
'name' => 'signup_form',
|
||||
'type' => 'varchar',
|
||||
'default' => 'by-admin',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ final class Customers_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20210508' => 20_210_508,
|
||||
'2.0.1-revision.20210607' => 20_210_607,
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Customer constructor.
|
||||
@ -75,7 +75,7 @@ final class Customers_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
user_id bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
@ -152,11 +152,11 @@ final class Customers_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_modified',
|
||||
'date_registered',
|
||||
'last_login',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Discount_Code_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Discount_Codes\\Discount_Codes_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Discount_Codes\Discount_Codes_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Discount_Code_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Discount_Code';
|
||||
protected $item_shape = \WP_Ultimo\Models\Discount_Code::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Discount_Code_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class Discount_Codes_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,9 +28,9 @@ class Discount_Codes_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,40 +38,40 @@ class Discount_Codes_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'code',
|
||||
'type' => 'varchar',
|
||||
'length' => '20',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'description',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'uses',
|
||||
'type' => 'int',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'max_uses',
|
||||
'type' => 'int',
|
||||
'unsigned' => true,
|
||||
@ -79,9 +79,9 @@ class Discount_Codes_Schema extends Schema {
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
'default' => 0,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'apply_to_renewals',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -89,39 +89,39 @@ class Discount_Codes_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'type',
|
||||
'type' => 'enum(\'percentage\', \'absolute\')',
|
||||
'default' => 'percentage',
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'value',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'setup_fee_type',
|
||||
'type' => 'enum(\'percentage\', \'absolute\')',
|
||||
'default' => 'percentage',
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'setup_fee_value',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -129,9 +129,9 @@ class Discount_Codes_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_start',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -139,9 +139,9 @@ class Discount_Codes_Schema extends Schema {
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_expiration',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -149,9 +149,9 @@ class Discount_Codes_Schema extends Schema {
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -159,9 +159,9 @@ class Discount_Codes_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -169,7 +169,7 @@ class Discount_Codes_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Discount_Codes_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Discount_Code constructor.
|
||||
@ -73,7 +73,7 @@ final class Discount_Codes_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL auto_increment,
|
||||
name tinytext NOT NULL DEFAULT '',
|
||||
@ -100,10 +100,10 @@ final class Discount_Codes_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Domain_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Domains\\Domains_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Domains\Domains_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Domain_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Domain';
|
||||
protected $item_shape = \WP_Ultimo\Models\Domain::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Domain_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ class Domain_Stage extends Enum {
|
||||
*/
|
||||
protected function classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::FAILED => 'wu-bg-red-200 wu-text-red-700',
|
||||
static::CHECKING_DNS => 'wu-bg-blue-200 wu-text-blue-700',
|
||||
static::CHECKING_SSL => 'wu-bg-yellow-200 wu-text-yellow-700',
|
||||
static::DONE => 'wu-bg-green-200 wu-text-green-700',
|
||||
static::DONE_WITHOUT_SSL => 'wu-bg-gray-800 wu-text-white',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,12 +57,12 @@ class Domain_Stage extends Enum {
|
||||
*/
|
||||
protected function labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::FAILED => __('DNS Failed', 'wp-ultimo'),
|
||||
static::CHECKING_DNS => __('Checking DNS', 'wp-ultimo'),
|
||||
static::CHECKING_SSL => __('Checking SSL', 'wp-ultimo'),
|
||||
static::DONE => __('Ready', 'wp-ultimo'),
|
||||
static::DONE_WITHOUT_SSL => __('Ready (without SSL)', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ class Domains_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,27 +38,27 @@ class Domains_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'blog_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'aliases' => array('site_id', 'site'),
|
||||
'aliases' => ['site_id', 'site'],
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'domain',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -66,9 +66,9 @@ class Domains_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'primary_domain',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -76,9 +76,9 @@ class Domains_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'secure',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -86,17 +86,17 @@ class Domains_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'stage',
|
||||
'type' => 'enum(\'checking-dns\', \'checking-ssl-cert\', \'done-without-ssl\', \'done\', \'failed\')',
|
||||
'default' => 'checking-dns',
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -104,9 +104,9 @@ class Domains_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -114,7 +114,7 @@ class Domains_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Domains_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Domains constructor.
|
||||
@ -73,7 +73,7 @@ final class Domains_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL auto_increment,
|
||||
blog_id bigint(20) NOT NULL,
|
||||
@ -95,10 +95,10 @@ final class Domains_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -46,7 +46,7 @@ class Email_Query extends Post_Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Email';
|
||||
protected $item_shape = \WP_Ultimo\Models\Email::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -73,9 +73,9 @@ class Email_Query extends Post_Query {
|
||||
* @param array $query Query parameters being passed.
|
||||
* @return array
|
||||
*/
|
||||
public function query($query = array()) {
|
||||
public function query($query = []) {
|
||||
|
||||
$query['type__in'] = array('system_email');
|
||||
$query['type__in'] = ['system_email'];
|
||||
|
||||
return parent::query($query);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ abstract class Enum {
|
||||
* @since 2.0.0
|
||||
* @var array
|
||||
*/
|
||||
static $options = array();
|
||||
static $options = [];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -69,7 +69,7 @@ abstract class Enum {
|
||||
*/
|
||||
protected function icon_classes() {
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,10 +223,10 @@ abstract class Enum {
|
||||
public function exists_or_default($array, $key, $default = '') {
|
||||
|
||||
if (empty($default)) {
|
||||
$default = isset($array[ static::__default ]) ? $array[ static::__default ] : '';
|
||||
$default = $array[ static::__default ] ?? '';
|
||||
}
|
||||
|
||||
return isset($array[ $key ]) ? $array[ $key ] : $default;
|
||||
return $array[ $key ] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class Query extends \BerlinDB\Database\Query {
|
||||
* @since 2.1.2
|
||||
* @var array
|
||||
*/
|
||||
protected static $added_globals = array();
|
||||
protected static $added_globals = [];
|
||||
|
||||
/**
|
||||
* Plural version for a group of items.
|
||||
@ -69,12 +69,12 @@ class Query extends \BerlinDB\Database\Query {
|
||||
* @param string|array $query Optional. An array or string of Query parameters.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
$cache_group = $this->apply_prefix($this->cache_group, '-');
|
||||
|
||||
if ($this->global_cache && ! in_array($cache_group, self::$added_globals, true)) {
|
||||
wp_cache_add_global_groups(array($cache_group));
|
||||
wp_cache_add_global_groups([$cache_group]);
|
||||
|
||||
self::$added_globals[] = $cache_group;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Event_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Events\\Events_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Events\Events_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Event_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Event';
|
||||
protected $item_shape = \WP_Ultimo\Models\Event::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Event_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ class Events_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,62 +38,62 @@ class Events_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'severity',
|
||||
'type' => 'tinyint',
|
||||
'length' => '1',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'initiator',
|
||||
'type' => 'enum(\'system\', \'manual\')',
|
||||
'default' => 'none',
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'author_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'object_type',
|
||||
'type' => 'varchar',
|
||||
'length' => 20,
|
||||
'default' => 'network',
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'object_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'slug',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'payload',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -101,7 +101,7 @@ class Events_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Events_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Event constructor.
|
||||
@ -73,7 +73,7 @@ final class Events_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL auto_increment,
|
||||
severity tinyint(4),
|
||||
@ -96,9 +96,9 @@ final class Events_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Membership_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Memberships\\Memberships_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Memberships\Memberships_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Membership_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Membership';
|
||||
protected $item_shape = \WP_Ultimo\Models\Membership::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Membership_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ class Membership_Status extends Enum {
|
||||
*/
|
||||
protected function classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PENDING => 'wu-bg-gray-200 wu-text-gray-700',
|
||||
static::ACTIVE => 'wu-bg-green-200 wu-text-green-700',
|
||||
static::TRIALING => 'wu-bg-orange-200 wu-text-orange-700',
|
||||
static::ON_HOLD => 'wu-bg-blue-200 wu-text-blue-700',
|
||||
static::EXPIRED => 'wu-bg-yellow-200 wu-text-yellow-700',
|
||||
static::CANCELLED => 'wu-bg-red-200 wu-text-red-700',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,13 +59,13 @@ class Membership_Status extends Enum {
|
||||
*/
|
||||
protected function labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PENDING => __('Pending', 'wp-ultimo'),
|
||||
static::ACTIVE => __('Active', 'wp-ultimo'),
|
||||
static::TRIALING => __('Trialing', 'wp-ultimo'),
|
||||
static::ON_HOLD => __('On Hold', 'wp-ultimo'),
|
||||
static::EXPIRED => __('Expired', 'wp-ultimo'),
|
||||
static::CANCELLED => __('Cancelled', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class Memberships_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class Memberships_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
// id
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -40,69 +40,69 @@ class Memberships_Schema extends Schema {
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// customer_id
|
||||
array(
|
||||
[
|
||||
'name' => 'customer_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// user_id
|
||||
array(
|
||||
[
|
||||
'name' => 'user_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'default' => null,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'migrated_from_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// object_id
|
||||
array(
|
||||
[
|
||||
'name' => 'plan_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// addons
|
||||
array(
|
||||
[
|
||||
'name' => 'addon_products',
|
||||
'type' => 'longtext',
|
||||
),
|
||||
],
|
||||
|
||||
// currency
|
||||
array(
|
||||
[
|
||||
'name' => 'currency',
|
||||
'type' => 'varchar',
|
||||
'length' => '20',
|
||||
'default' => 'USD',
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'initial_amount',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'recurring',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -110,9 +110,9 @@ class Memberships_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'auto_renew',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -120,33 +120,33 @@ class Memberships_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'duration',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'duration_unit',
|
||||
'type' => 'enum(\'day\', \'month\', \'week\', \'year\')',
|
||||
'default' => 'none',
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'amount',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_created
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -154,50 +154,50 @@ class Memberships_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_activated
|
||||
array(
|
||||
[
|
||||
'name' => 'date_activated',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_trial_end
|
||||
array(
|
||||
[
|
||||
'name' => 'date_trial_end',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_renewed
|
||||
array(
|
||||
[
|
||||
'name' => 'date_renewed',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_cancellation
|
||||
array(
|
||||
[
|
||||
'name' => 'date_cancellation',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_expiration
|
||||
array(
|
||||
[
|
||||
'name' => 'date_expiration',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -205,10 +205,10 @@ class Memberships_Schema extends Schema {
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_payment_plan_completed
|
||||
array(
|
||||
[
|
||||
'name' => 'date_payment_plan_completed',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -216,118 +216,118 @@ class Memberships_Schema extends Schema {
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// auto_renew
|
||||
array(
|
||||
[
|
||||
'name' => 'auto_renew',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// times_billed
|
||||
array(
|
||||
[
|
||||
'name' => 'times_billed',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// billing_cycles
|
||||
array(
|
||||
[
|
||||
'name' => 'billing_cycles',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// status
|
||||
array(
|
||||
[
|
||||
'name' => 'status',
|
||||
'type' => 'varchar',
|
||||
'length' => '12',
|
||||
'default' => 'pending',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// gateway_customer_id
|
||||
array(
|
||||
[
|
||||
'name' => 'gateway_customer_id',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// gateway_subscription_id
|
||||
array(
|
||||
[
|
||||
'name' => 'gateway_subscription_id',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// gateway
|
||||
array(
|
||||
[
|
||||
'name' => 'gateway',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// signup_method
|
||||
array(
|
||||
[
|
||||
'name' => 'signup_method',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
),
|
||||
],
|
||||
|
||||
// subscription_key
|
||||
array(
|
||||
[
|
||||
'name' => 'subscription_key',
|
||||
'type' => 'varchar',
|
||||
'length' => '32',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// upgraded_from
|
||||
array(
|
||||
[
|
||||
'name' => 'upgraded_from',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'default' => '',
|
||||
),
|
||||
],
|
||||
|
||||
// date_modified
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
'modified' => true,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// disabled
|
||||
array(
|
||||
[
|
||||
'name' => 'disabled',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '',
|
||||
'pattern' => '%d',
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Memberships_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Memberships constructor.
|
||||
@ -73,7 +73,7 @@ final class Memberships_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
customer_id bigint(20) unsigned NOT NULL default '0',
|
||||
@ -119,7 +119,7 @@ final class Memberships_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_activated',
|
||||
'date_trial_end',
|
||||
@ -128,7 +128,7 @@ final class Memberships_Table extends Table {
|
||||
'date_expiration',
|
||||
'date_payment_plan_completed',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Payment_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Payments\\Payments_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Payments\Payments_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Payment_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Payment';
|
||||
protected $item_shape = \WP_Ultimo\Models\Payment::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Payment_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class Payment_Status extends Enum {
|
||||
*/
|
||||
protected function classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PENDING => 'wu-bg-gray-200 wu-text-gray-700',
|
||||
static::COMPLETED => 'wu-bg-green-200 wu-text-green-700',
|
||||
static::REFUND => 'wu-bg-blue-200 wu-text-gray-700',
|
||||
@ -50,7 +50,7 @@ class Payment_Status extends Enum {
|
||||
static::PARTIAL => 'wu-bg-yellow-200 wu-text-yellow-700',
|
||||
static::FAILED => 'wu-bg-red-200 wu-text-red-700',
|
||||
static::CANCELLED => 'wu-bg-orange-200 wu-text-orange-700',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +61,7 @@ class Payment_Status extends Enum {
|
||||
*/
|
||||
protected function icon_classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PENDING => 'wu-align-middle dashicons-wu-clock wu-text-gray-700',
|
||||
static::COMPLETED => 'wu-align-middle dashicons-wu-check wu-text-green-700',
|
||||
static::REFUND => 'wu-align-middle dashicons-wu-cw wu-text-gray-700',
|
||||
@ -69,7 +69,7 @@ class Payment_Status extends Enum {
|
||||
static::PARTIAL => 'wu-align-middle dashicons-wu-cw wu-text-yellow-700',
|
||||
static::FAILED => 'wu-align-middle dashicons-wu-circle-with-cross wu-text-red-700',
|
||||
static::CANCELLED => 'wu-align-middle dashicons-wu-circle-with-cross wu-text-orange-700',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ class Payment_Status extends Enum {
|
||||
*/
|
||||
protected function labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PENDING => __('Pending', 'wp-ultimo'),
|
||||
static::COMPLETED => __('Completed', 'wp-ultimo'),
|
||||
static::REFUND => __('Refunded', 'wp-ultimo'),
|
||||
@ -88,6 +88,6 @@ class Payment_Status extends Enum {
|
||||
static::PARTIAL => __('Partially Paid', 'wp-ultimo'),
|
||||
static::FAILED => __('Failed', 'wp-ultimo'),
|
||||
static::CANCELLED => __('Cancelled', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class Payments_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,10 +28,10 @@ class Payments_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
// id
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -40,152 +40,152 @@ class Payments_Schema extends Schema {
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'status',
|
||||
'type' => 'varchar',
|
||||
'length' => '12',
|
||||
'default' => 'pending',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// customer_id
|
||||
array(
|
||||
[
|
||||
'name' => 'customer_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'membership_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'parent_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'product_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'migrated_from_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// currency
|
||||
array(
|
||||
[
|
||||
'name' => 'currency',
|
||||
'type' => 'varchar',
|
||||
'length' => '20',
|
||||
'default' => 'USD',
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'discount_code',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'discount_total',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'subtotal',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'refund_total',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'tax_total',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'total',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// gateway
|
||||
array(
|
||||
[
|
||||
'name' => 'gateway',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// gateway
|
||||
array(
|
||||
[
|
||||
'name' => 'gateway_payment_id',
|
||||
'type' => 'tinytext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_created
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'created' => true,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
// date_modified
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'modified' => true,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ final class Payments_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20210417' => 20_210_417,
|
||||
'2.0.1-revision.20210607' => 20_210_607,
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Payments constructor.
|
||||
@ -75,7 +75,7 @@ final class Payments_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
status varchar(20) NOT NULL DEFAULT 'pending',
|
||||
@ -162,10 +162,10 @@ final class Payments_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Post_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Posts\\Posts_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Posts\Posts_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Post_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Post_Base_Model';
|
||||
protected $item_shape = \WP_Ultimo\Models\Post_Base_Model::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -96,7 +96,7 @@ class Post_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function query($query = array()) {
|
||||
public function query($query = []) {
|
||||
|
||||
if ( ! isset($query['type__in'])) {
|
||||
$query['type'] = $this->item_name;
|
||||
|
@ -64,7 +64,7 @@ final class Posts_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,9 +28,9 @@ class Posts_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,51 +38,51 @@ class Posts_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'author_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'type',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'slug',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'title',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'content',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'excerpt',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'list_order',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -90,17 +90,17 @@ class Posts_Schema extends Schema {
|
||||
'default' => 10,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'status',
|
||||
'type' => 'varchar', // An "enum" here would possibly limit custom post status.
|
||||
'default' => 'draft',
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -108,9 +108,9 @@ class Posts_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -118,7 +118,7 @@ class Posts_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Posts_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Posts constructor.
|
||||
@ -73,7 +73,7 @@ final class Posts_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
author_id bigint(20) NOT NULL,
|
||||
@ -95,10 +95,10 @@ final class Posts_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -48,7 +48,7 @@ class Product_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Products\\Products_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Products\Products_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Product_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Product';
|
||||
protected $item_shape = \WP_Ultimo\Models\Product::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Product_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ class Product_Type extends Enum {
|
||||
*/
|
||||
protected function classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PLAN => 'wu-bg-green-200 wu-text-green-700',
|
||||
static::PACKAGE => 'wu-bg-gray-200 wu-text-blue-700',
|
||||
static::SERVICE => 'wu-bg-yellow-200 wu-text-yellow-700',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,10 +53,10 @@ class Product_Type extends Enum {
|
||||
*/
|
||||
protected function labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::PLAN => __('Plan', 'wp-ultimo'),
|
||||
static::PACKAGE => __('Package', 'wp-ultimo'),
|
||||
static::SERVICE => __('Service', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ final class Products_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$max_index_length = 191;
|
||||
|
||||
|
@ -28,9 +28,9 @@ class Products_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,16 +38,16 @@ class Products_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'slug',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'parent_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -55,72 +55,72 @@ class Products_Schema extends Schema {
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'migrated_from_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'description',
|
||||
'type' => 'longtext',
|
||||
'default' => '',
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'product_group',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'currency',
|
||||
'type' => 'varchar',
|
||||
'length' => '10',
|
||||
'default' => 'USD',
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'pricing_type',
|
||||
'type' => 'varchar',
|
||||
'length' => '10',
|
||||
'default' => 'paid',
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'amount',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'setup_fee',
|
||||
'type' => 'decimal(13,4)',
|
||||
'default' => '',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'recurring',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -128,48 +128,48 @@ class Products_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'trial_duration',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'trial_duration_unit',
|
||||
'type' => 'enum(\'day\', \'month\', \'week\', \'year\')',
|
||||
'default' => 'none',
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'duration',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'duration_unit',
|
||||
'type' => 'enum(\'day\', \'month\', \'week\', \'year\')',
|
||||
'default' => 'none',
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'billing_cycles',
|
||||
'type' => 'smallint',
|
||||
'unsigned' => true,
|
||||
'default' => '0',
|
||||
'sortable' => true,
|
||||
'transition' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'list_order',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -177,9 +177,9 @@ class Products_Schema extends Schema {
|
||||
'default' => 10,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -187,9 +187,9 @@ class Products_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -197,9 +197,9 @@ class Products_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -207,14 +207,14 @@ class Products_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'type',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,11 +50,11 @@ final class Products_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20210419' => 20_210_419,
|
||||
'2.0.1-revision.20210607' => 20_210_607,
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Products constructor.
|
||||
@ -75,7 +75,7 @@ final class Products_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = "id bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
name tinytext NOT NULL DEFAULT '',
|
||||
@ -161,10 +161,10 @@ final class Products_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
@ -56,7 +56,7 @@ class Site_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Sites\\Sites_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Sites\Sites_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -85,7 +85,7 @@ class Site_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Site';
|
||||
protected $item_shape = \WP_Ultimo\Models\Site::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -112,7 +112,7 @@ class Site_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ class Site_Type extends Enum {
|
||||
*/
|
||||
protected function classes() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::REGULAR => 'wu-bg-gray-700 wu-text-gray-200',
|
||||
static::SITE_TEMPLATE => 'wu-bg-yellow-200 wu-text-yellow-700',
|
||||
static::CUSTOMER_OWNED => 'wu-bg-green-200 wu-text-green-700',
|
||||
static::PENDING => 'wu-bg-purple-200 wu-text-purple-700',
|
||||
static::EXTERNAL => 'wu-bg-blue-200 wu-text-blue-700',
|
||||
static::MAIN => 'wu-bg-pink-200 wu-text-pink-700',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,12 +59,12 @@ class Site_Type extends Enum {
|
||||
*/
|
||||
protected function labels() {
|
||||
|
||||
return array(
|
||||
return [
|
||||
static::REGULAR => __('Regular Site', 'wp-ultimo'),
|
||||
static::SITE_TEMPLATE => __('Site Template', 'wp-ultimo'),
|
||||
static::CUSTOMER_OWNED => __('Customer-Owned', 'wp-ultimo'),
|
||||
static::PENDING => __('Pending', 'wp-ultimo'),
|
||||
static::MAIN => __('Main Site', 'wp-ultimo'),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ final class Sites_Meta_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = false;
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ class Sites_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'blog_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -46,33 +46,33 @@ class Sites_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
'aliases' => array('id', 'ID'),
|
||||
'aliases' => ['id', 'ID'],
|
||||
'searchable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'site_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'domain',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'path',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'registered',
|
||||
'type' => 'datetime',
|
||||
'default' => '0000-00-00 00:00:00',
|
||||
@ -80,9 +80,9 @@ class Sites_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'last_updated',
|
||||
'type' => 'datetime',
|
||||
'default' => '0000-00-00 00:00:00',
|
||||
@ -90,61 +90,61 @@ class Sites_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'public',
|
||||
'type' => 'tinyint',
|
||||
'length' => '2',
|
||||
'unsigned' => true,
|
||||
'default' => 1,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'archived',
|
||||
'type' => 'tinyint',
|
||||
'length' => '2',
|
||||
'unsigned' => true,
|
||||
'default' => 0,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'mature',
|
||||
'type' => 'tinyint',
|
||||
'length' => '2',
|
||||
'unsigned' => true,
|
||||
'default' => 0,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'spam',
|
||||
'type' => 'tinyint',
|
||||
'length' => '2',
|
||||
'unsigned' => true,
|
||||
'default' => 0,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'deleted',
|
||||
'type' => 'tinyint',
|
||||
'length' => '2',
|
||||
'unsigned' => true,
|
||||
'default' => 0,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'lang_id',
|
||||
'type' => 'int',
|
||||
'length' => '11',
|
||||
'unsigned' => true,
|
||||
'default' => 0,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ final class Sites_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
$this->schema = false;
|
||||
}
|
||||
@ -82,5 +82,5 @@ final class Sites_Table extends Table {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function install() {}
|
||||
public function install(): void {}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Webhook_Query extends Query {
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
protected $table_schema = '\\WP_Ultimo\\Database\\Webhooks\\Webhooks_Schema';
|
||||
protected $table_schema = \WP_Ultimo\Database\Webhooks\Webhooks_Schema::class;
|
||||
|
||||
/** Item ******************************************************************/
|
||||
|
||||
@ -77,7 +77,7 @@ class Webhook_Query extends Query {
|
||||
* @access public
|
||||
* @var mixed
|
||||
*/
|
||||
protected $item_shape = '\\WP_Ultimo\\Models\\Webhook';
|
||||
protected $item_shape = \WP_Ultimo\Models\Webhook::class;
|
||||
|
||||
/**
|
||||
* Group to cache queries and queried items in.
|
||||
@ -104,7 +104,7 @@ class Webhook_Query extends Query {
|
||||
*
|
||||
* @param string|array $query Array of query arguments.
|
||||
*/
|
||||
public function __construct($query = array()) {
|
||||
public function __construct($query = []) {
|
||||
|
||||
parent::__construct($query);
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ class Webhooks_Schema extends Schema {
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
public $columns = [
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
@ -38,48 +38,48 @@ class Webhooks_Schema extends Schema {
|
||||
'extra' => 'auto_increment',
|
||||
'primary' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'migrated_from_id',
|
||||
'type' => 'bigint',
|
||||
'length' => '20',
|
||||
'unsigned' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'webhook_url',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'event',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'event_count',
|
||||
'type' => 'int',
|
||||
'length' => '10',
|
||||
'default' => 0,
|
||||
'sortable' => true,
|
||||
'aliases' => array('sent_events_count'),
|
||||
),
|
||||
'aliases' => ['sent_events_count'],
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'active',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -87,9 +87,9 @@ class Webhooks_Schema extends Schema {
|
||||
'default' => 1,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'hidden',
|
||||
'type' => 'tinyint',
|
||||
'length' => '4',
|
||||
@ -97,31 +97,31 @@ class Webhooks_Schema extends Schema {
|
||||
'default' => 0,
|
||||
'transition' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'integration',
|
||||
'type' => 'varchar',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_last_failed',
|
||||
'type' => 'datetime',
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_created',
|
||||
'type' => 'datetime',
|
||||
'created' => true,
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
),
|
||||
],
|
||||
|
||||
array(
|
||||
[
|
||||
'name' => 'date_modified',
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
@ -129,7 +129,7 @@ class Webhooks_Schema extends Schema {
|
||||
'date_query' => true,
|
||||
'sortable' => true,
|
||||
'allow_null' => true,
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ final class Webhooks_Table extends Table {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $upgrades = array(
|
||||
protected $upgrades = [
|
||||
'2.0.1-revision.20230601' => 20_230_601,
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Webhook constructor.
|
||||
@ -73,7 +73,7 @@ final class Webhooks_Table extends Table {
|
||||
* @since 2.0.0
|
||||
* @return void
|
||||
*/
|
||||
protected function set_schema() {
|
||||
protected function set_schema(): void {
|
||||
|
||||
// phpcs:disable
|
||||
|
||||
@ -101,10 +101,10 @@ final class Webhooks_Table extends Table {
|
||||
*/
|
||||
protected function __20230601(): bool {
|
||||
|
||||
$null_columns = array(
|
||||
$null_columns = [
|
||||
'date_created',
|
||||
'date_modified',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($null_columns as $column) {
|
||||
$query = "ALTER TABLE {$this->table_name} MODIFY COLUMN `{$column}` datetime DEFAULT NULL;";
|
||||
|
Reference in New Issue
Block a user