HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: /var/www/html/maisonimmobiliare/wp-content/plugins/3d-viewer-block/inc/block.php
<?php

if(!class_exists('TDViewerBlock')){
	class TDViewerBlock{
		public function __construct(){
			add_action( 'enqueue_block_assets', [$this, 'enqueueBlockAssets'] );
			add_action( 'init', [$this, 'onInit'] );
		}
	
		function enqueueBlockAssets(){
			wp_register_style( 'tdvb-td-viewer-style', plugins_url( 'dist/style.css', __DIR__ ), [], BP3D_VERSION ); // Style
		}
	
		function onInit(){
			wp_register_style( 'tdvb-td-viewer-editor-style', plugins_url( 'dist/editor.css', __DIR__ ), [ 'tdvb-td-viewer-style' ], BP3D_VERSION ); // Backend Style
	
			register_block_type( __DIR__, [
				'editor_style'		=> 'tdvb-td-viewer-editor-style',
				'render_callback'	=> [$this, 'render']
			] ); // Register Block
	
			wp_set_script_translations( 'tdvb-td-viewer-editor-script', 'model-viewer', plugin_dir_path( __FILE__ ) . 'languages' ); // Translate
	
			wp_localize_script( 'tdvb-td-viewer-editor-script', 'bp3dBlock', [
				'nonce' => wp_create_nonce( 'wp_ajax' ),
				'ajaxURL' => admin_url( 'admin-ajax.php' )
			] );
		}
	
		function render( $attributes ){
			extract( $attributes );
	
			wp_enqueue_style( 'tdvb-td-viewer-style' );
			wp_enqueue_script( 'tdvb-td-viewer-script', plugins_url( 'dist/script.js', __DIR__ ), [ 'react', 'react-dom', 'bp3d-model-viewer' ], BP3D_VERSION, true );
	
			$className = $className ?? '';
			$blockClassName = "wp-block-tdvb-td-viewer $className align$align";
	
			ob_start(); ?>
			<div class='<?php echo esc_attr( $blockClassName ); ?>' id='tdvb3DViewerBlock-<?php echo esc_attr( $cId ) ?>' data-attributes='<?php echo esc_attr( wp_json_encode( $attributes ) ); ?>'></div>
	
			<?php return ob_get_clean();
		}
	}
	new TDViewerBlock();
}