PluginProbe ʕ •ᴥ•ʔ
Firebase Authentication / 1.1.2
Firebase Authentication v1.1.2
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 / admin / class-firebase-authentication-admin.php
firebase-authentication / admin Last commit date
css 6 years ago images 6 years ago js 6 years ago partials 6 years ago class-firebase-authentication-admin.php 6 years ago index.php 6 years ago
class-firebase-authentication-admin.php
100 lines
1 <?php
2
3 require_once 'partials/firebase-authentication-admin-display.php';
4 class MO_Firebase_Authentication_Admin {
5
6 /**
7 * The ID of this plugin.
8 *
9 * @since 1.0.0
10 * @access private
11 * @var string $plugin_name The ID of this plugin.
12 */
13 private $plugin_name;
14
15 /**
16 * The version of this plugin.
17 *
18 * @since 1.0.0
19 * @access private
20 * @var string $version The current version of this plugin.
21 */
22 private $version;
23
24 /**
25 * Initialize the class and set its properties.
26 *
27 * @since 1.0.0
28 * @param string $plugin_name The name of this plugin.
29 * @param string $version The version of this plugin.
30 */
31 public function __construct( $plugin_name, $version ) {
32 $this->plugin_name = $plugin_name;
33 $this->version = $version;
34 }
35
36 /**
37 * Register the stylesheets for the admin area.
38 *
39 * @since 1.0.0
40 */
41 public function enqueue_styles( $hook ) {
42 if( $hook != 'toplevel_page_mo_firebase_configuration' ) {
43 return;
44 }
45 wp_enqueue_style( 'mo_firebase_auth_admin_bootstrap_style', plugins_url( 'css/bootstrap.min.css', __FILE__ ) );
46 wp_enqueue_style( 'mo_firebase_auth_firebase_phone_style', plugins_url( 'css/phone.css', __FILE__ ) );
47 wp_enqueue_style( 'mo_firebase_auth_settings_style', plugins_url( 'css/style.css', __FILE__ ) );
48 }
49
50 /**
51 * Register the JavaScript for the admin area.
52 *
53 * @since 1.0.0
54 */
55 public function enqueue_scripts( $hook ) {
56 if( $hook != 'toplevel_page_mo_firebase_configuration' ) {
57 return;
58 }
59 wp_enqueue_script( 'mo_firebase_auth_bootstrap_script', plugins_url( 'js/bootstrap.min.js', __FILE__) );
60 wp_enqueue_script( 'mo_firebase_auth_custom_settings_script', plugins_url( 'js/custom.js', __FILE__) );
61 wp_enqueue_script( 'mo_firebase_auth_firebase_phone_script', plugins_url( 'js/phone.js', __FILE__ ), array(), $this->version , false );
62 }
63
64 public function enqueue_firebase_scripts() {
65 if( isset( $_GET['mo_action'] ) && 'firebaselogin' === sanitize_text_field( wp_unslash($_GET['mo_action'] ) ) ) {
66 wp_enqueue_script( 'mo_firebase_app_script', plugins_url( 'js/firebase-app.js', __FILE__) );
67 wp_enqueue_script( 'mo_firebase_auth_script', plugins_url( 'js/firebase-auth.js', __FILE__) );
68 wp_enqueue_script( 'mo_firebase_firestore_script', plugins_url( 'js/firebase-firestore.js', __FILE__), ['jquery'] );
69 }
70 }
71
72 public function enqueue_firebase_wp_login_scripts() {
73 wp_enqueue_script( 'mo_firebase_app_script', plugins_url( 'js/firebase-app.js', __FILE__) );
74 wp_enqueue_script( 'mo_firebase_auth_script', plugins_url( 'js/firebase-auth.js', __FILE__) );
75 wp_enqueue_script( 'mo_firebase_firestore_script', plugins_url( 'js/firebase-firestore.js', __FILE__), ['jquery'] );
76 wp_register_script( 'mo_firebase_app_main_script', plugins_url( 'js/firebase-auth-main-script.js', __FILE__), [ 'jquery' ] );
77 wp_enqueue_script( 'mo_firebase_app_main_script' );
78 wp_register_script( 'mo_firebase_app_login_script', plugins_url( 'js/firebase-wp-login.js', __FILE__), [ 'jquery' ] );
79 $data = [];
80 $data['api_key'] = get_option( 'mo_firebase_auth_api_key' );
81 $data['project_id'] = get_option( 'mo_firebase_auth_project_id' );
82 $data['enable_firebase_login'] = get_option( 'mo_enable_firebase_auth' );
83 $data["disable_wp_login"] = get_option( "mo_firebase_auth_disable_wordpress_login" );
84 $data["enable_admin_wp_login"] = get_option( "mo_firebase_auth_enable_admin_wp_login" );
85 if( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) === 'POST' ) {
86 $data['log'] = isset( $_POST['log'] ) ? sanitize_text_field( $_POST['log'] ) : '';
87 $data['pwd'] = isset( $_POST['pwd'] ) ? sanitize_text_field( $_POST['pwd'] ) : '';
88 }
89 wp_localize_script( 'mo_firebase_app_login_script', 'firebase_data', $data );
90 wp_enqueue_script( 'mo_firebase_app_login_script' );
91 }
92
93
94 public function mo_firebase_auth_page() {
95 update_option( 'host_name', 'https://login.xecurify.com' );
96 mo_firebase_auth_page_ui();
97 }
98
99 }
100