This repository was archived by the owner on Jan 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmt-wp-plugin.php
73 lines (63 loc) · 1.81 KB
/
mt-wp-plugin.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
<?php
// phpcs:disable PEAR.Commenting.FileComment.WrongStyle
/*
Plugin Name: MT Plugin
Plugin URI: https://github.com/MirosTruckstop/mt_wp_plugin
Description: Wordpress plugin for MiRo's Truckstop
Version: 1.0.0
Author: Xennis
Text Domain: mt-wp-plugin
*/
// phpcs:enable
/*
* Set locale for correct dates
*/
setlocale(LC_ALL, get_locale());
/*
* Set timezone
*/
date_default_timezone_set(get_option('timezone_string'));
/**
* Plugin name
*/
define('MT_NAME', dirname(plugin_basename(__FILE__)));
/**
* Plugin directory
*/
define('MT_DIR', WP_PLUGIN_DIR.'/'.MT_NAME);
/**
* PHP source directory
*/
define('MT_DIR_SRC_PHP', MT_DIR.'/src/main/php');
require_once plugin_dir_path(__FILE__).'/vendor/autoload.php';
/*
* Register activation hook
*/
register_activation_hook(__FILE__, function () {
include_once MT_DIR_SRC_PHP . '/config/Db.php';
MT_Config_Db::__setup_database_tables();
add_option('datum_letzte_suche', 0, null, false);
});
add_action('plugins_loaded', function () {
load_plugin_textdomain(MT_NAME, false, MT_NAME.'/languages/');
});
/*
* Admin scripts hook
*/
add_action('admin_enqueue_scripts', function () {
wp_enqueue_style('mt-style', plugins_url('/dist/back-end.css', __FILE__));
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui', 'https://code.jquery.com/ui/1.11.4/jquery-ui.min.js');
wp_enqueue_script('mt-script', plugins_url('src/js/back-end/back-end.js', __FILE__));
});
/**
* Include style sheet.
*/
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('mt-style', plugins_url('/dist/front-end.css', __FILE__));
});
require_once MT_DIR . '/mt-wp-plugin.routing.php';
require_once MT_DIR . '/mt-wp-plugin.widgets.php';
require_once MT_DIR . '/mt-wp-plugin.shortcodes.php';
require_once MT_DIR . '/mt-wp-plugin.pages.php';
require_once MT_DIR . '/mt-wp-plugin.template.php';