Main.php
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace AIOSEO\Plugin\Common\Main;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AIOSEO\Plugin\Common\Models;
/**
* Abstract class that Pro and Lite both extend.
*
* @since 4.0.0
*/
class Main {
/**
* Construct method.
*
* @since 4.0.0
*/
public function __construct() {
new Media();
new QueryArgs();
add_action( 'admin_enqueue_scripts', [ $this, 'enqueueTranslations' ] );
add_action( 'wp_enqueue_scripts', [ $this, 'enqueueFrontEndAssets' ] );
add_action( 'admin_footer', [ $this, 'adminFooter' ] );
}
/**
* Enqueues the translations seperately so it can be called from anywhere.
*
* @since 4.1.9
*
* @return void
*/
public function enqueueTranslations() {
aioseo()->core->assets->load( 'src/vue/standalone/app/main.js', [], [
'translations' => aioseo()->helpers->getJedLocaleData( 'all-in-one-seo-pack' )
], 'aioseoTranslations' );
}
/**
* Enqueue styles on the front-end.
*
* @since 4.0.0
*
* @return void
*/
public function enqueueFrontEndAssets() {
$canManageSeo = apply_filters( 'aioseo_manage_seo', 'aioseo_manage_seo' );
if (
! is_admin_bar_showing() ||
! ( current_user_can( $canManageSeo ) || aioseo()->access->canManage() )
) {
return;
}
aioseo()->core->assets->enqueueCss( 'src/vue/assets/scss/app/admin-bar.scss', [], 'src/vue/assets/scss/app/admin-bar.scss' );
}
/**
* Enqueue the footer file to let vue attach.
*
* @since 4.0.0
*
* @return void
*/
public function adminFooter() {
echo '<div id="aioseo-admin"></div>';
}
}