| Server IP : 172.67.75.225 / Your IP : 216.73.216.185 Web Server : nginx/1.27.1 System : Linux us-1 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64 User : vinodai ( 3134) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v1396/chatgptkafila/public_html/wp-content/plugins/presto-player/inc/Blocks/ |
Upload File : |
<?php
/**
* Popup block.
*
* @package PrestoPlayer\Blocks
*/
namespace PrestoPlayer\Blocks;
/**
* Popup block.
*/
class PopupBlock {
/**
* Register the block type.
*/
public function register() {
if ( ! file_exists( PRESTO_PLAYER_PLUGIN_DIR . 'src/admin/blocks/blocks/popup' ) ) {
return;
}
add_action( 'init', array( $this, 'register_block' ) );
}
/**
* Registers the popup block with WordPress.
*/
public function register_block() {
register_block_type(
PRESTO_PLAYER_PLUGIN_DIR . 'src/admin/blocks/blocks/popup',
array(
'render_callback' => array( $this, 'render_block' ),
)
);
}
/**
* Renders the block content for the popup block.
*
* @param array $attributes The block attributes.
* @param string $content The block content.
*
* @return string The rendered HTML for the block.
*/
public function render_block( $attributes, $content ) {
ob_start(); ?>
<div
<?php
echo wp_kses_data(
get_block_wrapper_attributes(
array(
'class' => 'presto-popup',
'data-wp-interactive' => 'presto-player/popup',
)
)
);
?>
<?php
echo wp_kses_data(
wp_interactivity_data_wp_context(
array(
'id' => $attributes['popupId'] ?? null,
)
)
);
?>
>
<?php echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php
return ob_get_clean();
}
}