PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.1.1
Kirki – Freeform Page Builder, Website Builder & Customizer v6.1.1
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 / Services / GlobalDataService.php
kirki / app / Services Last commit date
AppsService.php 3 days ago CollaborationCommentService.php 3 weeks ago CollaborationService.php 3 weeks ago CollectionItemService.php 3 weeks ago CollectionService.php 3 weeks ago EditorService.php 3 weeks ago FontService.php 3 days ago GlobalDataService.php 3 days ago MediaService.php 3 weeks ago PageService.php 3 days ago PageSettingsService.php 3 weeks ago UtilityPageService.php 3 days ago
GlobalDataService.php
45 lines
1 <?php
2
3 namespace Kirki\App\Services;
4
5 defined('ABSPATH') || exit;
6
7 use Kirki\App\Constants\CollaborationConnectionType;
8 use Kirki\App\Constants\CollaborationParent;
9 use Kirki\App\DTO\Collaboration\CreateCollaborationDTO;
10 use Kirki\App\Supports\Facades\GlobalData;
11
12 class GlobalDataService
13 {
14 /**
15 * Save global styles
16 *
17 * @return array
18 */
19 public function save_styles(array $global_styles, ?string $session_id = null)
20 {
21 foreach ($global_styles as $key => $style_block) {
22 if (empty($style_block['isGlobalStyle'])) {
23 $global_styles[$key] = array_merge($style_block, ['isGlobalStyle' => true]);
24 }
25 }
26
27 if ($session_id) {
28 $create_collaboration_dto = CreateCollaborationDTO::from_array([
29 'session_id' => $session_id,
30 'parent' => CollaborationParent::GLOBAL,
31 'parent_id' => 0,
32 'data' => [
33 'type' => CollaborationConnectionType::UPDATE_GLOBAL_STYLE,
34 'payload' => ['styleBlock' => $global_styles],
35 ],
36 ]);
37
38 (new CollaborationService())->save_action($create_collaboration_dto);
39 }
40
41 GlobalData::update_style_blocks($global_styles);
42
43 return $global_styles;
44 }
45 }