Automattic\WooCommerce\Blocks\Assets
Api::__construct
Constructor for class
Метод класса: Api{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Api = new Api(); $Api->__construct( $package );
- $package(Package) (обязательный)
- An instance of Package.
Код Api::__construct() Api:: construct WC 10.5.1
public function __construct( Package $package ) {
// Use wc- prefix here to prevent collisions when WC Core version catches up to a version previously used by the WC Blocks feature plugin.
$this->wc_version = 'wc-' . Constants::get_constant( 'WC_VERSION' );
$this->package = $package;
$this->disable_cache = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) || wp_get_environment_type() !== 'production';
// If the site is accessed via HTTPS, change the transient key. This is to prevent the script URLs being cached
// with the first scheme they are accessed on after cache expiry.
if ( is_ssl() ) {
$this->script_data_transient_key .= '_ssl';
}
if ( ! $this->disable_cache ) {
$this->script_data_hash = $this->get_script_data_hash();
}
add_action( 'shutdown', array( $this, 'update_script_data_cache' ), 20 );
}