Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/blocksy-companion-pro/framework/premium/pro.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
namespace Blocksy;
4
+
5
+
class Premium {
6
+
public $content_blocks = null;
7
+
public $premium_header = null;
8
+
public $premium_footer = null;
9
+
public $code_editor = null;
10
+
public $recently_viewed_products = null;
11
+
12
+
public function __construct() {
13
+
add_action(
14
+
'init',
15
+
function () {
16
+
$this->load_premium_translations();
17
+
}
18
+
);
19
+
20
+
$this->code_editor = new CodeEditor();
21
+
22
+
require BLOCKSY_PATH . '/framework/premium/helpers/helpers.php';
23
+
require BLOCKSY_PATH . '/framework/premium/helpers/content-blocks.php';
24
+
25
+
$this->content_blocks = new ContentBlocks();
26
+
new ContentBlocksLayer();
27
+
new CopyOptions();
28
+
29
+
new MaintenanceMode();
30
+
31
+
$this->premium_header = new PremiumHeader();
32
+
$this->premium_footer = new PremiumFooter();
33
+
34
+
new Local_Gravatars_Init();
35
+
36
+
new CloneCPT();
37
+
new CaptchaToolsIntegration();
38
+
39
+
new MediaVideo();
40
+
// attachment metadata: now only works in pro version
41
+
new VideoImportExport();
42
+
43
+
new TaxonomySearch();
44
+
45
+
$this->recently_viewed_products = new RecentlyViewedProducts();
46
+
47
+
new SocialsExtra();
48
+
49
+
new ExtendCoreTypographyOptions();
50
+
new PerformanceTypography();
51
+
52
+
new ImportExport();
53
+
54
+
add_filter(
55
+
'plugin_row_meta',
56
+
function ($plugin_meta, $plugin_file, $plugin_data, $status) {
57
+
if (! isset($plugin_data['slug'])) {
58
+
return $plugin_meta;
59
+
}
60
+
61
+
if ($plugin_data['slug'] === 'blocksy-companion') {
62
+
unset($plugin_meta[2]);
63
+
}
64
+
65
+
return $plugin_meta;
66
+
},
67
+
10,4
68
+
);
69
+
70
+
add_filter('blocksy_extensions_paths', function ($p) {
71
+
$p[] = BLOCKSY_PATH . 'framework/premium/extensions';
72
+
return $p;
73
+
});
74
+
75
+
$this->mount_integrations();
76
+
77
+
add_action(
78
+
'customize_preview_init',
79
+
function () {
80
+
if (! function_exists('get_plugin_data')) {
81
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
82
+
}
83
+
84
+
$data = get_plugin_data(BLOCKSY__FILE__);
85
+
86
+
wp_enqueue_script(
87
+
'blocksy-pro-customizer',
88
+
BLOCKSY_URL . 'framework/premium/static/bundle/sync.js',
89
+
['ct-customizer'],
90
+
$data['Version'],
91
+
true
92
+
);
93
+
}
94
+
);
95
+
96
+
add_action(
97
+
'admin_enqueue_scripts',
98
+
function () {
99
+
if (! function_exists('get_plugin_data')) {
100
+
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
101
+
}
102
+
103
+
global $wp_customize;
104
+
105
+
$data = get_plugin_data(BLOCKSY__FILE__);
106
+
107
+
$deps = ['ct-options-scripts'];
108
+
109
+
$current_screen = get_current_screen();
110
+
111
+
if ($current_screen && $current_screen->id === 'customize') {
112
+
$deps = ['ct-customizer-controls'];
113
+
}
114
+
115
+
wp_enqueue_script(
116
+
'blocksy-premium-admin-scripts',
117
+
BLOCKSY_URL . 'framework/premium/static/bundle/options.js',
118
+
$deps,
119
+
$data['Version'],
120
+
true
121
+
);
122
+
123
+
$hooks_manager = new HooksManager();
124
+
125
+
$localize = array_merge(
126
+
[
127
+
'all_hooks' => $hooks_manager->get_all_hooks(),
128
+
'ajax_url' => admin_url('admin-ajax.php'),
129
+
'rest_url' => get_rest_url(),
130
+
'content_blocks' => blc_get_content_blocks(),
131
+
'admin_url' => get_dashboard_url()
132
+
],
133
+
$this->code_editor->get_admin_localizations(),
134
+
$this->premium_footer->get_admin_localizations(),
135
+
);
136
+
137
+
wp_localize_script(
138
+
'blocksy-premium-admin-scripts',
139
+
'blocksy_premium_admin',
140
+
$localize
141
+
);
142
+
143
+
wp_enqueue_style(
144
+
'blocksy-premium-styles',
145
+
BLOCKSY_URL . 'framework/premium/static/bundle/options.min.css',
146
+
[],
147
+
$data['Version']
148
+
);
149
+
},
150
+
50
151
+
);
152
+
153
+
add_filter('blocksy:general:ct-scripts-localizations', function ($data) {
154
+
$data['dynamic_styles_selectors'][] = [
155
+
'selector' => '.ct-media-container[data-media-id], .ct-dynamic-media[data-media-id]',
156
+
'url' => blocksy_cdn_url(
157
+
BLOCKSY_URL . 'framework/premium/static/bundle/video-lazy.min.css'
158
+
)
159
+
];
160
+
161
+
return $data;
162
+
});
163
+
}
164
+
165
+
public function load_premium_translations() {
166
+
/**
167
+
* Load Blocksy textdomain.
168
+
*
169
+
* Load gettext translate for blocksy-companion text domain.
170
+
* This needs to happen only for Pro version because version from
171
+
* wp.org will pick up its language automatically.
172
+
* Pro code is not hosted on wp.org so manual textdomain loading is required.
173
+
*/
174
+
// phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound
175
+
load_plugin_textdomain(
176
+
'blocksy-companion',
177
+
false,
178
+
dirname(BLOCKSY_PLUGIN_BASE) . '/languages'
179
+
);
180
+
181
+
if (! class_exists('WP_Translation_Controller')) {
182
+
return;
183
+
}
184
+
185
+
$locale = determine_locale();
186
+
187
+
$i18n_controller = \WP_Translation_Controller::get_instance();
188
+
189
+
$preferred_format = apply_filters(
190
+
'translation_file_format',
191
+
'php',
192
+
'blocksy-companion'
193
+
);
194
+
195
+
if (! in_array($preferred_format, array('php', 'mo'), true)) {
196
+
$preferred_format = 'php';
197
+
}
198
+
199
+
$mofile = 'blocksy-companion' . '-' . $locale;
200
+
201
+
$file_extension = 'mo';
202
+
203
+
if ($preferred_format === 'php') {
204
+
// $file_extension = 'l10n.php';
205
+
}
206
+
207
+
$mofile = $mofile . '.' . $file_extension;
208
+
209
+
$file_path = BLOCKSY_PATH . 'languages/' . $mofile;
210
+
211
+
if (! file_exists($file_path)) {
212
+
return;
213
+
}
214
+
215
+
$res = $i18n_controller->load_file(
216
+
$file_path,
217
+
'blocksy-companion',
218
+
$locale
219
+
);
220
+
}
221
+
222
+
private function mount_integrations() {
223
+
add_action('plugins_loaded', function () {
224
+
if (class_exists('Elementor\Plugin')) {
225
+
new PluginIntegrations\Elementor();
226
+
}
227
+
});
228
+
}
229
+
}
230
+