| Server IP : 104.26.4.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 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/v9321/leapdubai/public_html/wp-content/plugins/kirki/app/Managers/ |
Upload File : |
<?php
namespace Kirki\App\Managers;
defined('ABSPATH') || exit;
use Kirki\App\Constants\PostTypes;
use Kirki\App\DTO\Symbol\SymbolDTO;
use Kirki\App\Models\Post as PostModel;
use Kirki\App\Supports\Facades\Page;
use Kirki\HelperFunctions;
use function Kirki\App\is_truthy;
use function Kirki\App\to_boolean;
class SymbolManager
{
/**
* Save symbol to database
*
* @param SymbolDTO $symbol
*
* @return SymbolDTO|null
*/
public function save(SymbolDTO $symbol)
{
if (!is_truthy($symbol->symbolData)) {
return null;
}
if (is_truthy($symbol->id)) {
$symbol->id = null;
}
$post = PostModel::create_post([
'post_type' => PostTypes::SYMBOL,
]);
$symbol->symbolData['data'][$symbol->symbolData['root']]['properties']['symbolId'] = $post->ID;
Page::save_blocks($post->ID, $symbol->symbolData);
Page::save_editor_mode($post->ID);
$symbol->id = $post->ID;
$symbol->type = isset($symbol->symbolData['category']) ? $symbol->symbolData['category'] : 'other';
return $symbol;
}
public function get_preview_html(SymbolDTO $symbol, $options = [], $variable_css = true) {
if (!is_truthy($symbol->symbolData)) {
return '';
}
$params = [
'blocks' => $symbol->symbolData['data'],
'style_blocks' => $symbol->symbolData['styleBlocks'],
'root' => $symbol->symbolData['root'],
'post_id' => $symbol->id,
'options' => $options,
'get_style' => true,
'get_variable' => to_boolean($variable_css),
'should_take_app_script' => false,
'prefix' => 'kirki-s' . $symbol->id,
];
// @todo: Need to refactor HelperFunctions::get_html_using_preview_script($params) first
$html = HelperFunctions::get_html_using_preview_script($params);
return $html;
}
}