-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscroll-progress-bar.php
More file actions
70 lines (60 loc) · 2.01 KB
/
Copy pathscroll-progress-bar.php
File metadata and controls
70 lines (60 loc) · 2.01 KB
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
<?php
/**
* Plugin Name: Scroll Progress Bar
* Plugin URI: https://bychko.ru
* Description: Минималистичная полоска прогресса чтения вверху страницы. Улучшает UX длинных статей.
* Version: 1.0.0
* Author: Владимир Бычко
* Author URI: https://bychko.ru
* Text Domain: scroll-progress-bar
* Domain Path: /languages
* License: GPL v2 or later
*/
// Защита от прямого доступа
if (!defined('ABSPATH')) {
exit;
}
// Константы плагина
define('SCROLL_PROGRESS_BAR_VERSION', '1.0.0');
define('SCROLL_PROGRESS_BAR_PLUGIN_URL', plugin_dir_url(__FILE__));
define('SCROLL_PROGRESS_BAR_PLUGIN_PATH', plugin_dir_path(__FILE__));
/**
* Основной класс плагина
*/
class Scroll_Progress_Bar_Plugin {
private static $instance = null;
public static function get_instance() {
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
private function __construct() {
add_action('plugins_loaded', array($this, 'load_textdomain'));
add_action('init', array($this, 'init_plugin'));
}
/**
* Загрузка переводов
*/
public function load_textdomain() {
load_plugin_textdomain(
'scroll-progress-bar',
false,
dirname(plugin_basename(__FILE__)) . '/languages'
);
}
/**
* Инициализация плагина
*/
public function init_plugin() {
// Подключаем классы
require_once SCROLL_PROGRESS_BAR_PLUGIN_PATH . 'includes/class-settings.php';
require_once SCROLL_PROGRESS_BAR_PLUGIN_PATH . 'includes/class-scroll-progress.php';
// Инициализируем классы
Scroll_Progress_Bar_Settings::get_instance();
Scroll_Progress_Bar::get_instance();
}
}
// Запуск плагина
Scroll_Progress_Bar_Plugin::get_instance();
?>