PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / app / Http / Requests / Page / PageRequest.php
kirki / app / Http / Requests / Page Last commit date
PageDataRequest.php 3 weeks ago PageRequest.php 3 weeks ago PageSettingsRequest.php 3 weeks ago PageUpdateRequest.php 3 weeks ago PopupRequest.php 3 weeks ago TogglePageSymbolRequest.php 3 weeks ago
PageRequest.php
62 lines
1 <?php
2
3 namespace Kirki\App\Http\Requests\Page;
4
5 defined('ABSPATH') || exit;
6
7 use Kirki\App\Constants\PostTypes;
8 use Kirki\App\Constants\UtilityPageType;
9 use Kirki\App\Services\UtilityPageService;
10 use Kirki\Framework\Http\Request;
11 use Kirki\Framework\Sanitizer;
12
13 class PageRequest extends Request
14 {
15 public function rules()
16 {
17 return [
18 'post_title' => 'required|string',
19 'post_type' => 'required|string',
20 'blocks' => 'nullable|array',
21 'conditions' => 'nullable|array',
22 'collection_type' => 'nullable|string',
23 'utility_page_type' => [
24 'nullable',
25 'string',
26 'in:' . UtilityPageType::join(),
27 function ($value) {
28 if ($this->post_type === PostTypes::UTILITY) {
29 if (empty($value)) {
30 return __("Utility page type is required.", 'kirki');
31 }
32
33 $exists = UtilityPageService::create()->exists($value);
34
35 if ($exists) {
36 /** translators: %s: Utility page type */
37 return sprintf(__("Utility page of type %s already exists."), $value);
38 }
39 }
40
41 return true;
42 }
43 ],
44 'custom_template' => 'nullable|array',
45 'custom_template.url' => 'nullable|url',
46 ];
47 }
48
49 public function filters()
50 {
51 return [
52 'post_title' => Sanitizer::TEXT,
53 'post_type' => Sanitizer::TEXT,
54 'blocks' => Sanitizer::ARRAY,
55 'conditions' => Sanitizer::ARRAY,
56 'collection_type' => Sanitizer::TEXT,
57 'utility_page_type' => Sanitizer::TEXT,
58 'custom_template' => Sanitizer::ARRAY,
59 'custom_template.url' => Sanitizer::URL,
60 ];
61 }
62 }