PluginProbe
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager / 0.0.3
Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager v0.0.3
0.0.11 0.0.10 0.0.9 0.0.8 0.0.7 0.0.6 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5
cookiez / modules / core / module.php

module.php in Cookie Consent – GDPR & CCPA Cookie Banner & Consent Manager 0.0.3, at modules/core/module.php

99 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Cookiez\Modules\Core;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit; // Exit if accessed directly.
7 }
8
9 use Cookiez\Classes\Module_Base;
10 use Cookiez\Modules\Connect\Module as Connect;
11 use Cookiez\Modules\Settings\Module as Settings;
12
13 /**
14 * Core module
15 */
16 class Module extends Module_Base {
17
18 /**
19 * @return string
20 */
21 public function get_name(): string {
22 return 'Core';
23 }
24
25 /**
26 * Declare components list
27 *
28 * @return array
29 */
30 public static function component_list(): array {
31 return [
32 'Notices',
33 'Pointers',
34 ];
35 }
36
37 /**
38 * Prepends Settings / Upgrade / Connect links for this plugin on the Plugins screen.
39 *
40 * @param array|string $links Existing action links.
41 * @param string $plugin_file_name Plugin basename relative to WP_PLUGIN_DIR.
42 * @return array
43 */
44 public function add_plugin_links( $links, $plugin_file_name ): array {
45 if ( ! str_ends_with( $plugin_file_name, '/cookiez.php' ) ) {
46 return (array) $links;
47 }
48
49 $custom_links = [
50 'settings' => sprintf(
51 '<a href="%s">%s</a>',
52 admin_url( 'admin.php?page=' . Settings::SETTING_BASE_SLUG ),
53 esc_html__( 'Settings', 'cookiez' )
54 ),
55 ];
56
57 if ( Connect::is_connected() && ! Settings::is_elementor_one() ) {
58 $custom_links['upgrade'] = sprintf(
59 '<a href="%s" style="color: #524CFF; font-weight: 700;" target="_blank" rel="noopener noreferrer">%s</a>',
60 'https://go.elementor.com/cookiez-add-quota-button',
61 esc_html__( 'Upgrade', 'cookiez' )
62 );
63 }
64 if ( ! Connect::is_connected() ) {
65 $custom_links['connect'] = sprintf(
66 '<a href="%s" style="color: #524CFF; font-weight: 700;">%s</a>',
67 admin_url( 'admin.php?page=' . Settings::SETTING_BASE_SLUG ),
68 esc_html__( 'Connect', 'cookiez' )
69 );
70 }
71
72 return array_merge( $custom_links, $links );
73 }
74
75 /**
76 * Enqueue global admin styles (e.g. quota notices).
77 *
78 * @return void
79 */
80 public function enqueue_scripts(): void {
81 wp_enqueue_style(
82 'cookiez-admin-global',
83 COOKIEZ_ASSETS_URL . 'css/admin.css',
84 [],
85 COOKIEZ_VERSION
86 );
87 }
88
89 /**
90 * Module constructor.
91 */
92 public function __construct() {
93 $this->register_components();
94
95 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
96 add_filter( 'plugin_action_links', [ $this, 'add_plugin_links' ], 10, 2 );
97 }
98 }
99