PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.0
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / vendor / hostinger / hostinger-wp-surveys / src / Assets.php
hostinger-reach / vendor / hostinger / hostinger-wp-surveys / src Last commit date
Ajax.php 3 months ago Assets.php 1 month ago Loader.php 1 year ago Rest.php 1 year ago SurveyLoader.php 1 year ago SurveyManager.php 1 month ago
Assets.php
50 lines
1 <?php
2
3 namespace Hostinger\Surveys;
4
5 class Assets
6 {
7 public Loader $surveys;
8 private string $assetsPath;
9 public function init(): void
10 {
11 add_action('admin_enqueue_scripts', [ $this, 'enqueueAdminAssets' ]);
12 $this->assetsPath = '/vendor/hostinger/hostinger-wp-surveys/assets';
13 }
14
15 /**
16 * @return void
17 */
18 public function enqueueAdminAssets(): void
19 {
20 $pluginInfo = $this->surveys->getPluginInfo();
21 $defaultVersion = '1.0.0';
22 $jsScriptPath = __DIR__ . '/../assets/js/hostinger-surveys.min.js';
23 $cssStylePath = __DIR__ . '/../assets/css/style.min.css';
24 $jsVersion = $defaultVersion;
25
26 if (file_exists($jsScriptPath)) {
27 $jsVersion = filemtime($jsScriptPath) ?: $defaultVersion;
28 }
29
30 if (empty($pluginInfo)) {
31 $pluginInfo = get_stylesheet_directory_uri();
32 }
33
34 wp_enqueue_script('hostinger_surveys_scripts', $pluginInfo . $this->assetsPath . '/js/hostinger-surveys.min.js', [ 'jquery' ], $jsVersion, [ 'strategy' => 'defer' ]);
35
36 wp_localize_script('hostinger_surveys_scripts', 'hostingerContainer', [
37 'url' => admin_url('admin-ajax.php'),
38 'nonce' => wp_create_nonce('hts-ajax-nonce'),
39 ]);
40
41 $cssVersion = $defaultVersion;
42
43 if (file_exists($cssStylePath)) {
44 $cssVersion = filemtime($cssStylePath) ?: $defaultVersion;
45 }
46
47 wp_enqueue_style('hostinger_surveys_styles', $pluginInfo . $this->assetsPath . '/css/style.min.css', [], $cssVersion);
48 }
49 }
50