|
Server IP : 10.106.20.8 / Your IP : 216.73.216.148 Web Server : Apache System : Linux webm008.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : sixiemesrc ( 611999) PHP Version : 8.0.30 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/sixiemesrc/new/wp-content/languages/../plugins/complianz-terms-conditions/gutenberg/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Enqueue Gutenberg block assets for backend editor.
*
* @since 1.0.0
*/
function cmplz_tc_editor_assets() {
$asset_file = include( plugin_dir_path( __FILE__ ) . 'build/index.asset.php');
wp_enqueue_script(
'cmplz-tc-block',
plugins_url( 'gutenberg/build/index.js', __DIR__ ),
$asset_file['dependencies'],
$asset_file['version'],
true
);
wp_localize_script(
'cmplz-tc-block',
'complianz_tc',
array(
'site_url' => get_rest_url(),
'cmplz_tc_preview' => cmplz_tc_url . 'assets/images/gutenberg-preview.png',
)
);
wp_set_script_translations( 'cmplz-tc-block', 'complianz-terms-conditions', cmplz_tc_path . '/languages' );
}
add_action( 'enqueue_block_editor_assets', 'cmplz_tc_editor_assets' );
/**
* Handles the front end rendering of the complianz block
*
* @param $attributes
* @param $content
*
* @return string
*/
function cmplz_tc_render_document_block( $attributes, $content ) {
if ( isset( $attributes['documentSyncStatus'] ) && $attributes['documentSyncStatus'] === 'unlink' && isset( $attributes['customDocument'] ) ) {
$html = $attributes['customDocument'];
} else {
$type = 'terms-conditions';
$html = COMPLIANZ_TC::$document->get_document_html( $type );
}
return $html;
}
register_block_type( 'complianztc/terms-conditions', array(
'render_callback' => 'cmplz_tc_render_document_block',
) );