PluginProbe
AccessiYes Accessibility Widget for ADA, EAA & WCAG Readiness / trunk
AccessiYes Accessibility Widget for ADA, EAA & WCAG Readiness vtrunk
3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 trunk 1.0 1.1 1.1.1 1.2 1.2.1 2 2.0.1 2.1 2.2 2.2.1 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 All 33 releases
accessibility-widget / lite / includes / class-modules.php

class-modules.php in AccessiYes Accessibility Widget for ADA, EAA & WCAG Readiness trunk, at lite/includes/class-modules.php

83 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Abstract class to handle all the modules on the plugin.
4 *
5 * @package CookieYes\Lite\Includes
6 */
7
8 namespace CookieYes\AccessibilityWidget\Lite\Includes;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Class Module
16 */
17 abstract class Modules {
18
19 /**
20 * Module slug name
21 *
22 * @var string
23 */
24 protected $module_id = '';
25
26 /**
27 * Slug of the main menu
28 *
29 * @var string
30 */
31 protected static $menu_slug = 'accessibility-widget';
32
33 /**
34 * Default capability of menus
35 *
36 * @var string
37 */
38 protected static $capability = 'manage_options';
39 /**
40 * All the module translation strings.
41 *
42 * @var [type]
43 */
44 public $translations = array();
45
46 /**
47 * Module constructor.
48 *
49 * @param string $module_id Module identifier.
50 */
51 public function __construct( $module_id ) {
52 $this->module_id = $module_id;
53 if ( true === $this->is_active() ) {
54 $this->init();
55 }
56 }
57
58 /**
59 * Return true if the module is activated
60 *
61 * @return Boolean
62 */
63 public function is_active() {
64 $module_id = $this->get_module_id();
65 return apply_filters( "cya11y_is_module_active_$module_id", true );
66 }
67 /**
68 * Return the module slug name
69 *
70 * @return string
71 */
72 public function get_module_id() {
73 return $this->module_id;
74 }
75
76 /**
77 * Initializes the module. Always executed even if the module is deactivated.
78 *
79 * Do not use __construct in subclasses, use init() instead
80 */
81 abstract public function init();
82 }
83