-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmobile-bankid-integration.php
78 lines (68 loc) · 3.2 KB
/
mobile-bankid-integration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php // PHPCS:Ignore
/*
Plugin Name: Mobile BankID Integration
Description: A plugin that allows you to integrate Mobile BankID with your WordPress site.
Version: Indev
Author: Jamie Blomerus
Author URI: https://github.com/jamieblomerus
License: GPL v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: mobile-bankid-integration
*/
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
// Define constants.
define( 'MOBILE_BANKID_INTEGRATION_VERSION', 'Indev' );
define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_FILE', __FILE__ );
define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
if ( ! class_exists( 'mobile_bankid_integration' ) ) {
/**
* Main plugin class.
*/
class Mobile_Bankid_Integration {
/**
* Class constructor.
*/
public function __construct() {
// Check if composer autoload exists.
if ( ! file_exists( MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'vendor/autoload.php' ) ) {
wp_die( wp_kses_post( __( '<strong>Mobile BankID Integration</strong> requires its dependencies to be installed. These are included in all releases, but if you are using the development version, you need to run <code>composer install</code> in the plugin directory.', 'mobile-bankid-integration' ) ) );
}
// Composer autoload.
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'vendor/autoload.php';
// Load plugin files.
$this->load_plugin_files();
// Add link in plugin list.
add_filter( 'plugin_action_links_' . plugin_basename( MOBILE_BANKID_INTEGRATION_PLUGIN_FILE ), array( $this, 'plugin_list_link' ) );
}
/**
* Load plugin files.
*/
private function load_plugin_files() {
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/class-core.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/class-activation.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/class-session.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/settings/class-setup.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/settings/class-api.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/settings/class-usersettings.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/wp-login/class-api.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/wp-login/class-login.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/admin/class-admin.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/integrations/load.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/privacy/class-privacy-policy.php';
require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/privacy/class-data-export.php';
}
/**
* Add link to settings page in plugin list.
*
* @param array $links Array of links.
* @return array
*/
public function plugin_list_link( $links ) {
$setup_link = '<a href="admin.php?page=mobile-bankid-integration">' . esc_html__( 'Settings', 'mobile-bankid-integration' ) . '</a>';
array_unshift( $links, $setup_link );
return $links;
}
}
new Mobile_Bankid_Integration();
}