PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / trunk
Wp Social Login and Register Social Counter vtrunk
trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / lib / template-library / init.php
wp-social / lib / template-library Last commit date
assets 9 months ago init.php 1 year ago
init.php
86 lines
1 <?php
2 namespace WP_Social\Lib\Template_Library;
3
4 use WP_Social\Plugin;
5
6 defined( 'ABSPATH' ) || exit;
7
8 /**
9 * Class Init
10 *
11 * Initializes the Template Library of the WP Social plugin.
12 */
13 class Init {
14 /**
15 * Initializes the Init class.
16 *
17 * Includes necessary files.
18 */
19 public function __construct() {
20 add_action('activate_gutenkit-blocks-addon/gutenkit-blocks-addon.php', array( $this, 'load_gutenkit_plugin' ), 9999);
21 add_action( 'admin_enqueue_scripts', array( $this, 'library_admin_enqueue_scripts' ) );
22 }
23
24 /**
25 * Retrieves the URL of the Template Library.
26 *
27 * @return string The URL of the Template Library.
28 * @since 3.0.3
29 */
30 public static function get_url() {
31 return Plugin::instance()->lib_url() . 'template-library/';
32 }
33
34 /**
35 * Retrieves the directory of the Template Library.
36 *
37 * @return string The directory of the Template Library.
38 * @since 3.0.3
39 */
40 public static function get_dir() {
41 return Plugin::instance()->lib_dir() . 'template-library/';
42 }
43
44 /**
45 * Loads the GutenKit plugin.
46 * @since 3.0.3
47 * Deletes the 'gutenkit_do_activation_redirect' option.
48 */
49 public function load_gutenkit_plugin() {
50 delete_option( 'gutenkit_do_activation_redirect' );
51 }
52
53 /**
54 * Enqueue scripts and styles for the template library in the admin area.
55 *
56 * @param string $screen The current admin screen.
57 * @since 3.0.3
58 */
59 public function library_admin_enqueue_scripts($screen) {
60 // Enqueue block editor only JavaScript and CSS.
61 $editor_template_library = include self::get_dir() . 'assets/library/editor-template-library.asset.php';
62 if ( $screen === 'post.php' || $screen === 'post-new.php' || $screen === 'site-editor.php' ) {
63 wp_enqueue_script(
64 'gutenkit-editor-template-library',
65 self::get_url() . 'assets/library/editor-template-library.js',
66 $editor_template_library['dependencies'],
67 $editor_template_library['version'],
68 true
69 );
70
71 wp_enqueue_style(
72 'gutenkit-editor-template-library',
73 self::get_url() . 'assets/library/editor-template-library.css',
74 array(),
75 $editor_template_library['version']
76 );
77
78 // Google Roboto Font
79 wp_enqueue_style(
80 'gutenkit-google-fonts',
81 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap'
82 );
83 }
84 }
85 }
86