HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: //home/madepabj/public_html/wp-content/plugins/rehub-framework/gutenberg/blocks/class-titlebox.php
<?php

namespace Rehub\Gutenberg\Blocks;

defined('ABSPATH') OR exit;

use WP_REST_Request;
use WP_REST_Server;

class TitleBox extends Basic {
	protected $name = 'titlebox';

	protected $attributes = array(
		'style' => array(
			'type'    => 'string',
			'default' => '1',
		),
		'title' => array(
			'type'    => 'string',
			'default' => '',
		),
		'text'  => array(
			'type'    => 'string',
			'default' => '',
		),
	);

	protected function render($settings = array(), $inner_content = ''){
		// Remove all instances of "<p>&nbsp;</p><br>" to avoid extra lines.
		$content = do_shortcode($settings['text']);
		$content = preg_replace( '%<p>&nbsp;\s*</p>%', '', $content ); 
		$content = preg_replace('/^(?:<br\s*\/?>\s*)+/', '', $content);
		if($settings['style'] == 'main') {
			$themeclass = ' rehub-main-color-border';
			$colorclass = 'rehub-main-color';
		} else if($settings['style'] == 'secondary') {
			$themeclass = ' rehub-sec-color-border';
			$colorclass = 'rehub-sec-color';
		} else {
			$themeclass = $colorclass = '';
		}
		if(empty($settings['align'])){
			$settings['align'] = '';
		}

		// return the url
		return wpsm_titlebox_shortcode(array('style'=>$settings['style'], 'title'=>$settings['title'], 'align' => $settings['align']), $content);
	}
}