}
/**
* Retrieves an array containing the properties of a registered block pattern.
*
* @since 5.5.0
*
* @param string $pattern_name Block pattern name including namespace.
* @return array Registered pattern properties.
*/
public function get_registered( $pattern_name ) {
if ( ! $this->is_registered( $pattern_name ) ) {
return null;
}
$pattern = $this->registered_patterns[ $pattern_name ];
$pattern['content'] = $this->get_content( $pattern_name );
$pattern['content'] = $this->prepare_content( $pattern, get_hooked_blocks() );
return $pattern;
}
/**
* Retrieves all registered block patterns.
*
* @since 5.5.0
*
* @param bool $outside_init_only Return only patterns registered outside the `init` action.
* @return array[] Array of arrays containing the registered block patterns properties,
* and per style.
*/
public function get_all_registered( $outside_init_only = false ) {
$patterns = $outside_init_only
? $this->registered_patterns_outside_init
: $this->registered_patterns;
$hooked_blocks = get_hooked_blocks();
foreach ( $patterns as $index => $pattern ) {
$pattern['content'] = $this->get_content( $pattern['name'], $outside_init_only );
$patterns[ $index ]['content'] = $this->prepare_content( $pattern, $hooked_blocks );
}
return array_values( $patterns );
}
/**
* Checks if a block pattern is registered.
*
* @since 5.5.0
*
* @param string $pattern_name Block pattern name including namespace.
* @return bool True if the pattern is registered, false otherwise.
*/
public function is_registered( $pattern_name ) {
return isset( $this->registered_patterns[ $pattern_name ] );
}
public function __wakeup() {
if ( ! $this->registered_patterns ) {
return;
}
if ( ! is_array( $this->registered_patterns ) ) {
throw new UnexpectedValueException();
}
foreach ( $this->registered_patterns as $value ) {
if ( ! is_array( $value ) ) {
throw new UnexpectedValueException();
}
}
$this->registered_patterns_outside_init = array();
}
/**
* Utility method to retrieve the main instance of the class.
*
* The instance will be created if it does not exist yet.
*
* @since 5.5.0
*
* @return WP_Block_Patterns_Registry The main instance.
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
}
/**
* Registers a new block pattern.
*
* @since 5.5.0
*
* @param string $pattern_name Block pattern name including namespace.
* @param array $pattern_properties List of properties for the block pattern.
* See WP_Block_Patterns_Registry::register() for accepted arguments.
* @return bool True if the pattern was registered with success and false otherwise.
*/
function register_block_pattern( $pattern_name, $pattern_properties ) {
return WP_Block_Patterns_Registry::get_instance()->register( $pattern_name, $pattern_properties );
}
/**
* Unregisters a block pattern.
*
* @since 5.5.0
*
* @param string $pattern_name Block pattern name including namespace.
* @return bool True if the pattern was unregistered with success and false otherwise.
*/
function unregister_block_pattern( $pattern_name ) {
return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name );
}
is->is_preview();
$enabled = isset( $config['status'] ) && false === $preview ? $config['status'] : true;
if ( false === $enabled ) {
$element->parentNode->removeChild( $element ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName
continue;
}
$styles = isset( $config['styles'] ) ? $config['styles'] : array();
$existing = $element->getAttribute( 'style' );
$style = isset( $existing ) ? $existing : '';
if ( ! empty( $styles ) ) {
foreach ( $styles as $property => $value ) {
if ( '' !== $value ) {
$style .= $property . ':' . $value . ';';
}
}
}
if ( '' !== $style ) {
$element->setAttribute( 'style', esc_attr( $style ) );
}
}
$this->html = $dom->saveHTML( $dom->documentElement ); //phpcs:ignore WordPress.NamingConventions.ValidVariableName
} catch ( \Exception $e ) {
// Could not generate the template.
$this->html = $html;
}
return $this->html;
}
/**
* Check if banner is in preview mode.
*
* @return boolean
*/
public function is_preview() {
return defined( 'CKY_PREVIEW_REQUEST' ) && CKY_PREVIEW_REQUEST;
}
/**
* Retrieve stored template.
*
* @return string
*/
public function get_stored() {
$stored = get_option( 'cky_banner_template', array() );
return isset( $stored[ $this->language ] ) ? $stored[ $this->language ] : array();
}
/**
* Store templates to options table
*
* @return void
*/
public function update() {
$stored = get_option( 'cky_banner_template', array() );
$stored = is_array( $stored ) && ! empty( $stored ) ? $stored : array();
$stored[ $this->language ] = array(
'html' => wp_kses( $this->html, cky_allowed_html() ),
'styles' => wp_kses(
$this->styles,
cky_allowed_html()
),
);
update_option(
'cky_banner_template',
$stored
);
}
/**
* Set templates from the stored
*
* @return void
*/
public function set_template() {
$template = $this->get_stored();
$this->styles = isset( $template['styles'] ) ? $template['styles'] : '';
$this->html = isset( $template['html'] ) ? $template['html'] : '';
}
/**
* Reset banner template
*
* @return void
*/
public function clear_template() {
update_option( 'cky_banner_template', '' );
}
/**
* Return the asset path
*
* @param string $path Template path.
* @return string
*/
public function get_assets_path( $path ) {
$base_name = wp_basename( $path );
return CKY_APP_ASSETS_URL . $base_name;
}
/**
* Elements contain image tags
*
* @return array
*/
public function image_tags() {
return array(
'revisit-consent',
'close-button',
'detail-close',
'detail-powered-by',
'optout-close',
'optout-powered-by',
);
}
}
Fatal error: Uncaught Error: Class 'CookieYes\Lite\Admin\Modules\Banners\Includes\Template' not found in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/banners/class-banners.php:44
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-modules.php(54): CookieYes\Lite\Admin\Modules\Banners\Banners->init()
#1 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(179): CookieYes\Lite\Includes\Modules->__construct('banners')
#2 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/class-admin.php(81): CookieYes\Lite\Admin\Admin->load_modules()
#3 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(153): CookieYes\Lite\Admin\Admin->__construct('cookie-law-info', '3.2.4')
#4 /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/includes/class-cli.php(95): CookieYes\Lite\Includes\CLI->define_admin_hooks in /var/www/html/helitower.com.br/web/wp-content/plugins/cookie-law-info/lite/admin/modules/banners/class-banners.php on line 44