true, 'single' => true, 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', ] ); } function bBlocksTheContent( $content ){ $id = get_the_ID(); $postMeta = get_post_meta( $id, 'bBlocksCursorData', true ); if( !$postMeta ){ return $content; } return $content . '
'; } public function bBlocks_cursor_data_settings(){ if (!wp_verify_nonce(sanitize_text_field(isset($_POST['nonce']) ? stripcslashes($_POST['nonce']) : null), 'wp_ajax')) { wp_send_json_error('invalid request'); } $data = json_decode(sanitize_text_field( stripcslashes($_POST['bBlocksCustomCursor'])), true); if(!$data){ $data = get_option('bBlocks_custom_cursor_settings', []); wp_send_json_success($data); } update_option('bBlocks_custom_cursor_settings', $data); wp_send_json_success($data); } public function bBlocks_get_cursor_data_settings(){ if (!wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'wp_ajax')) { wp_send_json_error('invalid request'); } $data = get_option('bBlocks_custom_cursor_settings', []); wp_send_json_success($data); } public function bBlocksEnqueueBlockAssets() { wp_enqueue_script( 'bBlocks-cursor', B_BLOCKS_DIR_URL . 'build/cursor/cursor.js', array('react', 'react-dom', 'wp-util'), B_BLOCKS_VERSION, true); wp_enqueue_style( 'bBlocks-cursor', B_BLOCKS_DIR_URL . 'build/cursor/cursor.css', array(), B_BLOCKS_VERSION); wp_localize_script( 'bBlocks-cursor', 'bBlocksCursorDataConfig', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('wp_ajax'), 'dirUrl' => B_BLOCKS_DIR_URL )); } function bBlocksEnqueueBlockEditorAssets(){ wp_enqueue_script('bBlocks-cursor-settings', B_BLOCKS_DIR_URL . 'build/cursor/settings.js', array('wp-compose','wp-data','wp-editor','wp-plugins','wp-components','wp-i18n','react','react-dom'), B_BLOCKS_VERSION, true); wp_enqueue_style("bBlocks-cursor-settings", B_BLOCKS_DIR_URL . 'build/cursor/settings.css', array(), B_BLOCKS_VERSION); } } new BBlocksCustomCursor(); }