Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

View File

@ -0,0 +1,121 @@
<?php
/**
* Class used for querying products.
*
* @package WP_Ultimo
* @subpackage Database\Sites
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Sites;
use WP_Ultimo\Database\Engine\Query;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Class used for querying products.
*
* @since 2.0.0
*/
class Site_Query extends Query {
/**
* Table prefix, including the site prefix.
*
* @since 1.0.0
* @var string
*/
protected $prefix = '';
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 2.0.0
* @access public
* @var string
*/
protected $table_name = 'blogs';
/**
* String used to alias the database table in MySQL statement.
*
* @since 2.0.0
* @access public
* @var string
*/
protected $table_alias = 's';
/**
* Name of class used to setup the database schema
*
* @since 2.0.0
* @access public
* @var string
*/
protected $table_schema = '\\WP_Ultimo\\Database\\Sites\\Sites_Schema';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 2.0.0
* @access public
* @var string
*/
protected $item_name = 'blog';
/**
* Plural version for a group of items.
*
* @since 2.0.0
* @access public
* @var string
*/
protected $item_name_plural = 'blogs';
/**
* Callback function for turning IDs into objects
*
* @since 2.0.0
* @access public
* @var mixed
*/
protected $item_shape = '\\WP_Ultimo\\Models\\Site';
/**
* Group to cache queries and queried items in.
*
* @since 2.0.0
* @access public
* @var string
*/
protected $cache_group = 'sites';
/**
* If we should use a global cache group.
*
* @since 2.1.2
* @var bool
*/
protected $global_cache = true;
/**
* Sets up the customer query, based on the query vars passed.
*
* @since 2.0.0
* @access public
*
* @param string|array $query Array of query arguments.
*/
public function __construct($query = array()) {
parent::__construct($query);
} // end __construct;
} // end class Site_Query;

View File

@ -0,0 +1,73 @@
<?php
/**
* Site Types enum.
*
* @package WP_Ultimo
* @subpackage WP_Ultimo\Database\Sites
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Sites;
// Exit if accessed directly
defined('ABSPATH') || exit;
use \WP_Ultimo\Database\Engine\Enum;
/**
* Site Types.
*
* @since 2.0.0
*/
class Site_Type extends Enum {
/**
* Default type.
*/
const __default = 'default'; // phpcs:ignore
const REGULAR = 'default';
const SITE_TEMPLATE = 'site_template';
const CUSTOMER_OWNED = 'customer_owned';
const PENDING = 'pending';
const EXTERNAL = 'external';
const MAIN = 'main';
/**
* Returns an array with values => CSS Classes.
*
* @since 2.0.0
* @return array
*/
protected function classes() {
return array(
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',
);
} // end classes;
/**
* Returns an array with values => labels.
*
* @since 2.0.0
* @return array
*/
protected function labels() {
return array(
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'),
);
} // end labels;
} // end class Site_Type;

View File

@ -0,0 +1,82 @@
<?php
/**
* Class used for querying products' meta data.
*
* @package WP_Ultimo
* @subpackage Database\Sites
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Sites;
use WP_Ultimo\Database\Engine\Table;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Setup the "wu_productmeta" database table
*
* @since 2.0.0
*/
final class Sites_Meta_Table extends Table {
/**
* Table prefix, including the site prefix.
*
* @since 1.0.0
* @var string
*/
protected $prefix = '';
/**
* Table name
*
* @since 2.0.0
* @var string
*/
protected $name = 'blogmeta';
/**
* Is this table global?
*
* @since 2.0.0
* @var boolean
*/
protected $global = true;
/**
* Table current version
*
* @since 2.0.0
* @var string
*/
protected $version = '2.0.0';
/**
* Sites constructor.
*
* @access public
* @since 2.0.0
* @return void
*/
public function __construct() {
parent::__construct();
} // end __construct;
/**
* Setup the database schema
*
* @access protected
* @since 2.0.0
* @return void
*/
protected function set_schema() {
$this->schema = false;
} // end set_schema;
} // end class Sites_Meta_Table;

View File

@ -0,0 +1,151 @@
<?php
/**
* Site schema class
*
* @package WP_Ultimo
* @subpackage Database\Sites
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Sites;
use WP_Ultimo\Database\Engine\Schema;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Sites Schema Class.
*
* @since 2.0.0
*/
class Sites_Schema extends Schema {
/**
* Table prefix, including the site prefix.
*
* @since 1.0.0
* @var string
*/
protected $prefix = '';
/**
* Array of database column objects
*
* @since 2.0.0
* @access public
* @var array
*/
public $columns = array(
array(
'name' => 'blog_id',
'type' => 'bigint',
'length' => '20',
'unsigned' => true,
'extra' => 'auto_increment',
'primary' => true,
'sortable' => true,
'aliases' => array('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',
'modified' => true,
'date_query' => true,
'sortable' => true,
'allow_null' => true,
),
array(
'name' => 'last_updated',
'type' => 'datetime',
'default' => '0000-00-00 00:00:00',
'modified' => true,
'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,
),
);
} // end class Sites_Schema;

View File

@ -0,0 +1,89 @@
<?php
/**
* Class used for querying blogs.
*
* @package WP_Ultimo
* @subpackage Database\Sites
* @since 2.0.0
*/
namespace WP_Ultimo\Database\Sites;
use WP_Ultimo\Database\Engine\Table;
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Setup the "wp_blog" database table
*
* @since 2.0.0
*/
final class Sites_Table extends Table {
/**
* Table prefix, including the site prefix.
*
* @since 1.0.0
* @var string
*/
protected $prefix = '';
/**
* Table name
*
* @since 2.0.0
* @var string
*/
protected $name = 'blogs';
/**
* Is this table global?
*
* @since 2.0.0
* @var boolean
*/
protected $global = true;
/**
* Table current version
*
* @since 2.0.0
* @var string
*/
protected $version = '2.0.0';
/**
* Sites constructor.
*
* @access public
* @since 2.0.0
* @return void
*/
public function __construct() {
parent::__construct();
} // end __construct;
/**
* Setup the database schema
*
* @access protected
* @since 2.0.0
* @return void
*/
protected function set_schema() {
$this->schema = false;
} // end set_schema;
/**
* Do nothing as this table already exists.
*
* @since 2.0.0
*/
public function install() {} // end install;
} // end class Sites_Table;