| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/mahyarcake/public_html/wp-content/plugins/woocommerce/src/StoreApi/ |
Upload File : |
<?php
namespace Automattic\WooCommerce\StoreApi;
use Automattic\WooCommerce\Blocks\Registry\Container;
use Automattic\WooCommerce\StoreApi\Formatters;
use Automattic\WooCommerce\StoreApi\Authentication;
use Automattic\WooCommerce\StoreApi\Legacy;
use Automattic\WooCommerce\StoreApi\Formatters\CurrencyFormatter;
use Automattic\WooCommerce\StoreApi\Formatters\HtmlFormatter;
use Automattic\WooCommerce\StoreApi\Formatters\MoneyFormatter;
use Automattic\WooCommerce\StoreApi\RoutesController;
use Automattic\WooCommerce\StoreApi\SchemaController;
use Automattic\WooCommerce\StoreApi\Schemas\ExtendSchema;
/**
* StoreApi Main Class.
*/
final class StoreApi {
/**
* Init and hook in Store API functionality.
*/
public function init() {
add_action(
'rest_api_init',
function() {
self::container()->get( Legacy::class )->init();
self::container()->get( RoutesController::class )->register_all_routes();
}
);
// Runs on priority 11 after rest_api_default_filters() which is hooked at 10.
add_action(
'rest_api_init',
function() {
self::container()->get( Authentication::class )->init();
},
11
);
}
/**
* Loads the DI container for Store API.
*
* @internal This uses the Blocks DI container. If Store API were to move to core, this container could be replaced
* with a different compatible container.
*
* @param boolean $reset Used to reset the container to a fresh instance. Note: this means all dependencies will be reconstructed.
* @return mixed
*/
public static function container( $reset = false ) {
static $container;
if ( $reset ) {
$container = null;
}
if ( $container ) {
return $container;
}
$container = new Container();
$container->register(
Authentication::class,
function () {
return new Authentication();
}
);
$container->register(
Legacy::class,
function () {
return new Legacy();
}
);
$container->register(
RoutesController::class,
function ( $container ) {
return new RoutesController(
$container->get( SchemaController::class )
);
}
);
$container->register(
SchemaController::class,
function ( $container ) {
return new SchemaController(
$container->get( ExtendSchema::class )
);
}
);
$container->register(
ExtendSchema::class,
function ( $container ) {
return new ExtendSchema(
$container->get( Formatters::class )
);
}
);
$container->register(
Formatters::class,
function () {
$formatters = new Formatters();
$formatters->register( 'money', MoneyFormatter::class );
$formatters->register( 'html', HtmlFormatter::class );
$formatters->register( 'currency', CurrencyFormatter::class );
return $formatters;
}
);
return $container;
}
}