2021-01-08 14:08:40 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2021-01-16 15:21:46 +01:00
|
|
|
* Plugin Name: <wordpress-nice-name>
|
|
|
|
* Author: <wordpress-author-name>
|
|
|
|
* Author URI: <wordpress-author-url>
|
|
|
|
* Description: <wordpress-description>
|
|
|
|
* Version: <wordpress-version>
|
2021-01-08 14:08:40 +01:00
|
|
|
* Requires at least: <wordpress-minimum-version>
|
|
|
|
* Requires PHP: <wordpress-php-minimum-version>
|
|
|
|
* License: <wordpress-license>
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once __DIR__ . '/includes/constants.php';
|
|
|
|
require_once __DIR__ . '/includes/settings.php';
|
|
|
|
require_once __DIR__ . '/includes/events-list-shortcut.php';
|
|
|
|
require_once __DIR__ . '/includes/events-list-widget.php';
|
|
|
|
|
|
|
|
// Exit if this file is called directly.
|
|
|
|
if (!defined('ABSPATH')) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2021-11-01 21:17:10 +01:00
|
|
|
final class Mobilizon_Connector {
|
2021-01-08 14:08:40 +01:00
|
|
|
|
2021-11-01 21:17:10 +01:00
|
|
|
private function __construct() {
|
|
|
|
add_action('init', [$this, 'register_settings']);
|
|
|
|
add_action('init', [$this, 'register_shortcut']);
|
|
|
|
add_action('widgets_init', [$this, 'register_widget']);
|
|
|
|
add_action('wp_enqueue_scripts', [$this, 'register_scripts']);
|
|
|
|
register_activation_hook(__FILE__, [$this, 'enable_activation']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function init() {
|
|
|
|
// Create singleton instance.
|
|
|
|
static $instance = false;
|
|
|
|
if(!$instance) {
|
|
|
|
$instance = new self();
|
|
|
|
}
|
|
|
|
return $instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function enable_activation() {
|
|
|
|
MobilizonConnector\Settings::setDefaultOptions();
|
|
|
|
}
|
2021-01-08 14:08:40 +01:00
|
|
|
|
2021-11-01 21:17:10 +01:00
|
|
|
public function register_settings() {
|
|
|
|
MobilizonConnector\Settings::init();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function register_scripts() {
|
|
|
|
wp_enqueue_script(MobilizonConnector\NAME . '-js', plugins_url('front/events-loader.js', __FILE__ ));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function register_shortcut() {
|
|
|
|
MobilizonConnector\EventsListShortcut::init();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function register_widget() {
|
|
|
|
register_widget('MobilizonConnector\EventsListWidget');
|
|
|
|
}
|
2021-01-08 14:08:40 +01:00
|
|
|
}
|
|
|
|
|
2021-11-01 21:17:10 +01:00
|
|
|
function mobilizon_connector_run_plugin() {
|
|
|
|
return Mobilizon_Connector::init();
|
2021-01-08 14:08:40 +01:00
|
|
|
}
|
2021-11-01 21:17:10 +01:00
|
|
|
|
|
|
|
mobilizon_connector_run_plugin();
|