PluginProbe ʕ •ᴥ•ʔ
Firebase Authentication / 1.6.1
Firebase Authentication v1.6.1
1.7.0 trunk 1.0.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 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.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9
firebase-authentication / includes / class-mo-firebase-authentication.php
firebase-authentication / includes Last commit date
images 3 years ago class-mo-firebase-authentication-deactivator.php 3 years ago class-mo-firebase-authentication-i18n.php 3 years ago class-mo-firebase-authentication-loader.php 3 years ago class-mo-firebase-authentication.php 3 years ago
class-mo-firebase-authentication.php
212 lines
1 <?php
2 /**
3 * The file that defines the core plugin class
4 *
5 * A class definition that includes attributes and functions used across both the
6 * public-facing side of the site and the admin area.
7 *
8 * @link https://miniorange.com
9 * @since 1.0.0
10 *
11 * @package Firebase_Authentication
12 * @subpackage Firebase_Authentication/includes
13 */
14
15 /**
16 * The core plugin class.
17 *
18 * This is used to define internationalization, admin-specific hooks, and
19 * public-facing site hooks.
20 *
21 * Also maintains the unique identifier of this plugin as well as the current
22 * version of the plugin.
23 *
24 * @since 1.0.0
25 * @package Firebase_Authentication
26 * @subpackage Firebase_Authentication/includes
27 * @author miniOrange <info@miniorange.com>
28 */
29 class MO_Firebase_Authentication {
30
31 /**
32 * The loader that's responsible for maintaining and registering all hooks that power
33 * the plugin.
34 *
35 * @since 1.0.0
36 * @access protected
37 * @var MO_Firebase_Authentication_Loader $loader Maintains and registers all hooks for the plugin.
38 */
39 protected $loader;
40
41 /**
42 * The unique identifier of this plugin.
43 *
44 * @since 1.0.0
45 * @access protected
46 * @var string $plugin_name The string used to uniquely identify this plugin.
47 */
48 protected $plugin_name;
49
50 /**
51 * The current version of the plugin.
52 *
53 * @since 1.0.0
54 * @access protected
55 * @var string $version The current version of the plugin.
56 */
57 protected $version;
58
59 /**
60 * Define the core functionality of the plugin.
61 *
62 * Set the plugin name and the plugin version that can be used throughout the plugin.
63 * Load the dependencies, define the locale, and set the hooks for the admin area and
64 * the public-facing side of the site.
65 *
66 * @since 1.0.0
67 */
68 public function __construct() {
69 if ( defined( 'MO_FIREBASE_AUTHENTICATION_VERSION' ) ) {
70 $this->version = MO_FIREBASE_AUTHENTICATION_VERSION;
71 } else {
72 $this->version = '1.0.0';
73 }
74 update_option( 'mo_firebase_authentication_current_plugin_version ', $this->version );
75 $this->plugin_name = 'firebase-authentication';
76
77 $this->load_dependencies();
78 $this->set_locale();
79 $this->define_admin_hooks();
80 }
81
82 /**
83 * Load the required dependencies for this plugin.
84 *
85 * Include the following files that make up the plugin:
86 *
87 * - MO_Firebase_Authentication_Loader. Orchestrates the hooks of the plugin.
88 * - MO_Firebase_Authentication_I18n. Defines internationalization functionality.
89 * - MO_Firebase_Authentication_Admin. Defines all hooks for the admin area.
90 *
91 * Create an instance of the loader which will be used to register the hooks
92 * with WordPress.
93 *
94 * @since 1.0.0
95 * @access private
96 */
97 private function load_dependencies() {
98
99 /**
100 * The class responsible for orchestrating the actions and filters of the
101 * core plugin.
102 */
103 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-mo-firebase-authentication-loader.php';
104
105 /**
106 * The class responsible for defining internationalization functionality
107 * of the plugin.
108 */
109 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-mo-firebase-authentication-i18n.php';
110
111 /**
112 * The class responsible for defining all actions that occur in the admin area.
113 */
114 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-mo-firebase-authentication-admin.php';
115
116 $this->loader = new MO_Firebase_Authentication_Loader();
117
118 }
119
120 /**
121 * Define the locale for this plugin for internationalization.
122 *
123 * Uses the MO_Firebase_Authentication_i18n class in order to set the domain and to register the hook
124 * with WordPress.
125 *
126 * @since 1.0.0
127 * @access private
128 */
129 private function set_locale() {
130
131 $plugin_i18n = new MO_Firebase_Authentication_I18n();
132
133 $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
134
135 }
136
137 /**
138 * Register all of the hooks related to the admin area functionality
139 * of the plugin.
140 *
141 * @since 1.0.0
142 * @access private
143 */
144 private function define_admin_hooks() {
145
146 $plugin_admin = new MO_Firebase_Authentication_Admin( $this->get_plugin_name(), $this->get_version() );
147 add_action( 'admin_menu', array( $this, 'miniorange_firebase_menu' ) );
148 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
149 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
150 }
151
152 /**
153 * Add miniOrange plugin to the menu
154 *
155 * @return void
156 */
157 public function miniorange_firebase_menu() {
158 $page = add_menu_page( 'Configuration', 'Firebase Authentication', 'manage_options', 'mo_firebase_authentication', array( $this, 'mo_firebase_auth_options' ), plugin_dir_url( __FILE__ ) . '../public/images/miniorange.png' );
159 }
160
161 /**
162 * Initialize plugin screen from admin menu
163 *
164 * @return void
165 */
166 public function mo_firebase_auth_options() {
167 $plugin_admin = new MO_Firebase_Authentication_Admin( $this->get_plugin_name(), $this->get_version() );
168 $plugin_admin->mo_firebase_auth_page();
169 }
170
171 /**
172 * Run the loader to execute all of the hooks with WordPress.
173 *
174 * @since 1.0.0
175 */
176 public function run() {
177 $this->loader->run();
178 }
179
180 /**
181 * The name of the plugin used to uniquely identify it within the context of
182 * WordPress and to define internationalization functionality.
183 *
184 * @since 1.0.0
185 * @return string The name of the plugin.
186 */
187 public function get_plugin_name() {
188 return $this->plugin_name;
189 }
190
191 /**
192 * The reference to the class that orchestrates the hooks with the plugin.
193 *
194 * @since 1.0.0
195 * @return MO_Firebase_Authentication_Loader Orchestrates the hooks of the plugin.
196 */
197 public function get_loader() {
198 return $this->loader;
199 }
200
201 /**
202 * Retrieve the version number of the plugin.
203 *
204 * @since 1.0.0
205 * @return string The version number of the plugin.
206 */
207 public function get_version() {
208 return $this->version;
209 }
210
211 }
212