Server : Apache System : Linux ls31.server.ly 3.10.0-962.3.2.lve1.5.68.el7.x86_64 #1 SMP Wed Apr 6 11:12:23 UTC 2022 x86_64 User : medchoco ( 2906) PHP Version : 8.3.16 Disable Function : mail Directory : /home/medchoco/www/wp-content/plugins/jetpack-boost-git/app/lib/ |
Upload File : |
<?php namespace Automattic\Jetpack_Boost\Lib; use Automattic\Jetpack_Boost\Contracts\Has_Setup; class Setup { protected static $instances = array(); /** * This method takes a `Has_Setup` instance and registers the setup action. * In addition, it will keep track of all the instances passed to it, * * This is useful if a plugin needs the instance * to modify the behavior at a certain hook that * Jetpack Boost is using. * * The use case would be something like this: * ``` * $instance = my_get_instance_method( Setup::get_instances() ); * remove_action( 'wp_footer', array( $instance, 'foobar' ) ); * ``` * * @param Has_Setup $instance * * @return void */ public static function add( Has_Setup $instance ) { $instance->setup(); self::$instances[] = $instance; } public static function get_instances() { return self::$instances; } public static function get_instance_of( $class_name ) { foreach ( self::get_instances() as $instance ) { if ( $instance instanceof $class_name ) { return $instance; } } return null; } }