| Server IP : 104.26.5.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/Services/ |
Upload File : |
<?php
namespace Kirki\App\Services;
use Kirki\App\Constants\PageMetaKeys;
use Kirki\App\DTO\Page\PageSettingsDTO;
use Kirki\App\Models\Page as PageModel;
use Kirki\App\Models\PostMeta;
use Kirki\App\Utils\PostUtil;
defined('ABSPATH') || exit;
class PageSettingsService
{
public static function create()
{
return new static();
}
public function update_page_settings(PageModel $page, PageSettingsDTO $payload)
{
$data = [
'post_title' => $payload->page_title,
'post_name' => $payload->slug,
'post_excerpt' => $payload->page_description,
];
if (!empty($payload->post_status)) {
$data['post_status'] = $payload->post_status;
}
$page = PageModel::update_post($page->ID, $data);
PostMeta::update_meta_value($page->ID, PageMetaKeys::SEO_SETTINGS, $payload->seo_settings);
PostMeta::update_meta_value($page->ID, PageMetaKeys::CUSTOM_CODE, $payload->custom_code);
$image_id = attachment_url_to_postid($payload->featured_image);
if ($image_id > 0) {
set_post_thumbnail($page->ID, $image_id);
} else {
delete_post_thumbnail($page->ID);
}
return $page;
}
public function update_page_custom_code(?array $custom_code = null)
{
return PostMeta::update_meta_value(PostUtil::get_post_id_from_url(), PageMetaKeys::CUSTOM_CODE, $custom_code);
}
}