| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.5/wp-content/plugins/woocommerce-payments/src/Internal/Proxy/ |
Upload File : |
<?php
/**
* Class LegacyProxy
*
* @package WooCommerce\Payments
*/
namespace WCPay\Internal\Proxy;
/**
* Legacy Proxy
*
* Used for accessing legacy code (everything outside `src`), incl. functions, static methods, and globals.
* Classes are handled through WCPay\Internal\DependencyManagement\DelegateContainer\LegacyContainer.
*/
class LegacyProxy {
/**
* Calls a function outside of `src`.
*
* Use this for WP, WC, and other generic non-native PHP functions.
*
* @param string $name Name of the function.
* @param mixed ...$parameters Parameters to pass to the function.
*
* @return mixed The response from the function.
*/
public function call_function( string $name, ...$parameters ) {
return call_user_func_array( $name, $parameters );
}
/**
* Calls the static method of a class outside of `src`.
*
* Use this for non-`src` classes.
* Static methods on `src` classes should be pure (without side effects).
*
* @param string $class_name Name of the class.
* @param string $method_name Name of the method.
* @param mixed ...$parameters Parameters to pass to the method.
*
* @return mixed The response from the method.
*/
public function call_static( string $class_name, string $method_name, ...$parameters ) {
return call_user_func_array( [ $class_name, $method_name ], $parameters );
}
/**
* Checks whether a global variable is defined.
*
* @param string $name Name of the variable.
* @return bool
*/
public function has_global( string $name ) {
return isset( $GLOBALS[ $name ] );
}
/**
* Returns a global variable.
*
* @param string $name Name of the variable.
* @throws ProxyException In case the variable is not set.
* @return mixed
*/
public function get_global( string $name ) {
if ( ! $this->has_global( $name ) ) {
throw new ProxyException( esc_html( sprintf( 'The global "%s" is not set.', $name ) ) );
}
return $GLOBALS[ $name ];
}
}