WC_Regenerate_Images::init()public staticWC 1.0

Init function

Метод класса: WC_Regenerate_Images{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$result = WC_Regenerate_Images::init();

Код WC_Regenerate_Images::init() WC 9.3.3

public static function init() {
	add_action( 'image_get_intermediate_size', array( __CLASS__, 'filter_image_get_intermediate_size' ), 10, 3 );
	add_filter( 'wp_generate_attachment_metadata', array( __CLASS__, 'add_uncropped_metadata' ) );
	add_filter( 'wp_get_attachment_image_src', array( __CLASS__, 'maybe_resize_image' ), 10, 4 );

	// Not required when Jetpack Photon is in use.
	if ( method_exists( 'Jetpack', 'is_module_active' ) && Jetpack::is_module_active( 'photon' ) ) {
		return;
	}

	if ( apply_filters( 'woocommerce_background_image_regeneration', true ) ) {
		include_once WC_ABSPATH . 'includes/class-wc-regenerate-images-request.php';

		self::$background_process = new WC_Regenerate_Images_Request();

		add_action( 'admin_init', array( __CLASS__, 'regenerating_notice' ) );
		add_action( 'woocommerce_hide_regenerating_thumbnails_notice', array( __CLASS__, 'dismiss_regenerating_notice' ) );

		// Regenerate thumbnails in the background after settings changes. Not ran on multisite to avoid multiple simultaneous jobs.
		if ( ! is_multisite() ) {
			add_action( 'customize_save_after', array( __CLASS__, 'maybe_regenerate_images' ) );
			add_action( 'after_switch_theme', array( __CLASS__, 'maybe_regenerate_images' ) );
		}
	}
}