PluginProbe ʕ •ᴥ•ʔ
Catch Scroll Progress Bar / 1.5
Catch Scroll Progress Bar v1.5
trunk 1.0.0 1.1 1.2 1.3 1.4 1.5 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 2.0 2.1 2.2
catch-scroll-progress-bar / includes / class-catch-scroll-progress-bar.php
catch-scroll-progress-bar / includes Last commit date
CatchThemesThemePlugin.php 4 years ago class-catch-scroll-progress-bar-activator.php 4 years ago class-catch-scroll-progress-bar-deactivator.php 4 years ago class-catch-scroll-progress-bar-i18n.php 4 years ago class-catch-scroll-progress-bar-loader.php 4 years ago class-catch-scroll-progress-bar.php 4 years ago ctp-tabs-removal.php 4 years ago index.php 4 years ago
class-catch-scroll-progress-bar.php
209 lines
1 <?php
2
3 /**
4 * The core plugin class.
5 *
6 * This is used to define internationalization, admin-specific hooks, and
7 * public-facing site hooks.
8 *
9 * Also maintains the unique identifier of this plugin as well as the current
10 * version of the plugin.
11 *
12 * @since 1.0.0
13 * @package Catch_Scroll_Progress_Bar
14 * @subpackage Catch_Scroll_Progress_Bar/includes
15 * @author Catch Plugins <www.catchplugins.com>
16 */
17 class Catch_Scroll_Progress_Bar {
18
19 /**
20 * The loader that's responsible for maintaining and registering all hooks that power
21 * the plugin.
22 *
23 * @since 1.0.0
24 * @access protected
25 * @var Catch_Progress_Bar_Loader $loader Maintains and registers all hooks for the plugin.
26 */
27 protected $loader;
28
29 /**
30 * The unique identifier of this plugin.
31 *
32 * @since 1.0.0
33 * @access protected
34 * @var string $plugin_name The string used to uniquely identify this plugin.
35 */
36 protected $plugin_name;
37
38 /**
39 * The current version of the plugin.
40 *
41 * @since 1.0.0
42 * @access protected
43 * @var string $version The current version of the plugin.
44 */
45 protected $version;
46
47 /**
48 * Define the core functionality of the plugin.
49 *
50 * Set the plugin name and the plugin version that can be used throughout the plugin.
51 * Load the dependencies, define the locale, and set the hooks for the admin area and
52 * the public-facing side of the site.
53 *
54 * @since 1.0.0
55 */
56 public function __construct() {
57
58 $this->version = CATCH_SCROLL_PROGRESS_BAR_VERSION;
59
60 $this->plugin_name = 'catch-scroll-progress-bar';
61
62 $this->load_dependencies();
63 $this->set_locale();
64 $this->define_admin_hooks();
65 $this->define_public_hooks();
66
67 }
68
69 /**
70 * Load the required dependencies for this plugin.
71 *
72 * Include the following files that make up the plugin:
73 *
74 * - Catch_Scroll_Progress_Bar_Loader. Orchestrates the hooks of the plugin.
75 * - Catch_Scroll_Progress_Bar_i18n. Defines internationalization functionality.
76 * - Catch_Scroll_Progress_Bar_Admin. Defines all hooks for the admin area.
77 * - Catch_Scroll_Progress_Bar_Public. Defines all hooks for the public side of the site.
78 *
79 * Create an instance of the loader which will be used to register the hooks
80 * with WordPress.
81 *
82 * @since 1.0.0
83 * @access private
84 */
85 private function load_dependencies() {
86
87 /**
88 * The class responsible for orchestrating the actions and filters of the
89 * core plugin.
90 */
91 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-catch-scroll-progress-bar-loader.php';
92
93 /**
94 * The class responsible for defining internationalization functionality
95 * of the plugin.
96 */
97 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-catch-scroll-progress-bar-i18n.php';
98
99 /**
100 * The class responsible for defining all actions that occur in the admin area.
101 */
102 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-catch-scroll-progress-bar-admin.php';
103
104 /**
105 * The class responsible for defining all actions that occur in the public-facing
106 * side of the site.
107 */
108 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-catch-scroll-progress-bar-public.php';
109
110 $this->loader = new Catch_Scroll_Progress_Bar_Loader();
111
112 }
113
114 /**
115 * Define the locale for this plugin for internationalization.
116 *
117 * Uses the Catch_Scroll_Progress_Bar_i18n class in order to set the domain and to register the hook
118 * with WordPress.
119 *
120 * @since 1.0.0
121 * @access private
122 */
123 private function set_locale() {
124
125 $plugin_i18n = new Catch_Scroll_Progress_Bar_i18n();
126
127 $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
128
129 }
130
131 /**
132 * Register all of the hooks related to the admin area functionality
133 * of the plugin.
134 *
135 * @since 1.0.0
136 * @access private
137 */
138 private function define_admin_hooks() {
139
140 $plugin_admin = new Catch_Scroll_Progress_Bar_Admin( $this->get_plugin_name(), $this->get_version() );
141
142 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
143 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
144 $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_settings_menu' );
145 $this->loader->add_action( 'admin_init', $plugin_admin, 'register_settings' );
146 $this->loader->add_filter( 'plugin_action_links', $plugin_admin, 'action_links', 10, 2 );
147 $this->loader->add_filter( 'plugin_row_meta', $plugin_admin, 'add_plugin_meta_links', 10, 2 );
148
149 }
150
151 /**
152 * Register all of the hooks related to the public-facing functionality
153 * of the plugin.
154 *
155 * @since 1.0.0
156 * @access private
157 */
158 private function define_public_hooks() {
159
160 $plugin_public = new Catch_Scroll_Progress_Bar_Public( $this->get_plugin_name(), $this->get_version() );
161
162 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
163 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
164 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'show_it' );
165
166 }
167
168 /**
169 * Run the loader to execute all of the hooks with WordPress.
170 *
171 * @since 1.0.0
172 */
173 public function run() {
174 $this->loader->run();
175 }
176
177 /**
178 * The name of the plugin used to uniquely identify it within the context of
179 * WordPress and to define internationalization functionality.
180 *
181 * @since 1.0.0
182 * @return string The name of the plugin.
183 */
184 public function get_plugin_name() {
185 return $this->plugin_name;
186 }
187
188 /**
189 * The reference to the class that orchestrates the hooks with the plugin.
190 *
191 * @since 1.0.0
192 * @return Catch_Scroll_Progress_Bar_Loader Orchestrates the hooks of the plugin.
193 */
194 public function get_loader() {
195 return $this->loader;
196 }
197
198 /**
199 * Retrieve the version number of the plugin.
200 *
201 * @since 1.0.0
202 * @return string The version number of the plugin.
203 */
204 public function get_version() {
205 return $this->version;
206 }
207
208 }
209