| Server IP : 172.67.71.254 / Your IP : 216.73.217.51 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-191-generic #201-Ubuntu SMP Fri Aug 7 18:39:04 UTC 2026 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;
defined('ABSPATH') || exit;
use Exception;
use Kirki\Ajax\Collection;
use Kirki\App\Constants\PageMetaKeys;
use Kirki\App\Constants\PostTypes;
use Kirki\App\Constants\UtilityPageType;
use Kirki\App\Models\Page as PageModel;
use Kirki\Framework\Database\Query\QueryBuilder;
use Kirki\Framework\Http\Response;
class UtilityPageService
{
/**
* Create a new instance of the service
* @return UtilityPageService
*/
public static function create()
{
return new static();
}
/**
* Check if a utility page exists
*
* @param string $utility_type
*
* @return bool
*/
public function exists(string $utility_type)
{
if (!in_array($utility_type, UtilityPageType::get_constant_values(), true)) {
throw new Exception(
/* translators: %s: Utility page type */
sprintf(esc_html__('Invalid utility page type: %s', 'kirki'), esc_html($utility_type)),
Response::UNPROCESSABLE_ENTITY
);
}
return PageModel::query()
->exclude_trash()
->where('post_type', '=', PostTypes::UTILITY)
->where_has('meta', function (QueryBuilder $query) use ($utility_type) {
$query->where('meta_key', '=', PageMetaKeys::UTILITY_PAGE_TYPE)
->where('meta_value', '=', $utility_type);
})
->exists();
}
/**
* Get all utility pages
*
* @return Collection
*/
public function get_utility_pages()
{
return PageModel::query()
->with([
'meta' => function (QueryBuilder $query) {
$query->where('meta_key', '=', PageMetaKeys::UTILITY_PAGE_TYPE)
->where_in('meta_value', UtilityPageType::get_constant_values());
}
])
->exclude_trash()
->where('post_type', '=', PostTypes::UTILITY)
->get();
}
}