apache
wp-content
mu-plugins
plugins
activitypub
audioigniter
authldap
companion-auto-update
easy-digital-downloads
assets
includes
adjustments
admin
api
blocks
cart
checkout
compat
currency
customers
database
downloads
emails
extensions
gateways
libraries
logs
models
notes
orders
payments
reports
traits
users
utils
EDD_SL_Plugin_Updater.php
actions.php
ajax-functions.php
class-base-object.php
class-component.php
class-easy-digital-downloads.php
class-edd-cache-helper.php
class-edd-cli.php
class-edd-cron.php
class-edd-customer-query.php
class-edd-customer.php
class-edd-db-customer-meta.php
class-edd-db-customers.php
class-edd-db.php
class-edd-discount.php
class-edd-download.php
class-edd-fees.php
class-edd-html-elements.php
class-edd-license-handler.php
class-edd-logging.php
class-edd-register-meta.php
class-edd-requirements-check.php
class-edd-roles.php
class-edd-session.php
class-edd-stats.php
class-stats.php
class-structured-data.php
class-utilities.php
compat-functions.php
component-functions.php
country-functions.php
customer-functions.php
date-functions.php
deprecated-functions.php
deprecated-hooks.php
discount-functions.php
download-functions.php
error-tracking.php
formatting.php
install.php
interface-edd-exception.php
mime-types.php
misc-functions.php
plugin-compatibility.php
post-types.php
privacy-functions.php
process-download.php
process-purchase.php
query-filters.php
refund-functions.php
scripts.php
shortcodes.php
tax-functions.php
template-actions.php
template-functions.php
theme-compatibility.php
user-functions.php
widgets.php
languages
src
templates
vendor
easy-digital-downloads.php
license.txt
readme.txt
uninstall.php
gitium
gp-premium
jetpack-protect
menu-icons
simple-local-avatars
smtp-mailer
two-factor
wp-piwik
wp-webauthn
index.php
themes
index.php
.dbsetup
.gitignore
htaccess
php.ini
149 lines
2.3 KiB
PHP
149 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* Component Class.
|
|
*
|
|
* @package EDD
|
|
* @subpackage Core
|
|
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
|
* @since 3.0
|
|
*/
|
|
namespace EDD;
|
|
|
|
use EDD\Database;
|
|
|
|
/**
|
|
* Component Class.
|
|
*
|
|
* @since 3.0
|
|
*/
|
|
class Component extends Base_Object {
|
|
|
|
/**
|
|
* Name of this component
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var string
|
|
*/
|
|
public $name = '';
|
|
|
|
/**
|
|
* Database schema definition
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var Database\Schema
|
|
*/
|
|
public $schema = false;
|
|
|
|
/**
|
|
* Database table interface
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var Database\Table
|
|
*/
|
|
public $table = false;
|
|
|
|
/**
|
|
* Database single object interface
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var Database\Table
|
|
*/
|
|
public $meta = false;
|
|
|
|
/**
|
|
* Database query interface
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var Database\Query
|
|
*/
|
|
public $query = false;
|
|
|
|
/**
|
|
* Database single object interface
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var Database\Row|object
|
|
*/
|
|
public $object = false;
|
|
|
|
/**
|
|
* Array of interface objects instantiated during init
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var array
|
|
*/
|
|
private $interfaces = array();
|
|
|
|
/**
|
|
* Array of interface keys
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @var array
|
|
*/
|
|
private $interface_keys = array(
|
|
'schema' => false,
|
|
'table' => false,
|
|
'query' => false,
|
|
'object' => false,
|
|
'meta' => false
|
|
);
|
|
|
|
/**
|
|
* Construct an EDD component
|
|
*
|
|
* @since 3.0
|
|
* @param array $args
|
|
*/
|
|
public function __construct( $args = array() ) {
|
|
parent::__construct( $args );
|
|
}
|
|
|
|
/**
|
|
* Return an interface object
|
|
*
|
|
* @since 3.0
|
|
*
|
|
* @param string $name
|
|
* @return object
|
|
*/
|
|
public function get_interface( $name = '' ) {
|
|
return isset( $this->interfaces[ $name ] )
|
|
? $this->interfaces[ $name ]
|
|
: false;
|
|
}
|
|
|
|
/**
|
|
* Setup an EDD component based on parsing in constructor
|
|
*
|
|
* @since 3.0
|
|
* @param array $args
|
|
*/
|
|
protected function set_vars( $args = array() ) {
|
|
|
|
// Get the interface keys
|
|
$keys = array_keys( $this->interface_keys );
|
|
|
|
// Loop through args...
|
|
foreach ( $args as $key => $value ) {
|
|
|
|
// Set arg as a Component Interface
|
|
if ( in_array( $key, $keys, true ) && class_exists( $value ) ) {
|
|
$this->interfaces[ $key ] = new $value;
|
|
|
|
// Set arg as a Component property
|
|
} else {
|
|
$this->{$key} = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|