PluginProbe
Scrollsequence – Cinematic Scroll Image Animation Plugin / 1.6.2
Scrollsequence – Cinematic Scroll Image Animation Plugin v1.6.2
1.4.3 1.4.4 1.4.5 1.4.6 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 trunk 0.9.92 0.9.93 0.9.94 0.9.96 1.0.072 1.0.073 All 61 releases
scrollsequence / includes / class-scrollsequence.php

class-scrollsequence.php in Scrollsequence – Cinematic Scroll Image Animation Plugin 1.6.2, at includes/class-scrollsequence.php

270 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The file that defines the core plugin class
5 *
6 * A class definition that includes attributes and functions used across both the
7 * public-facing side of the site and the admin area.
8 *
9 * @link www.scrollsequence.com
10 * @since 0.7.0
11 *
12 * @package Scrollsequence
13 * @subpackage Scrollsequence/includes
14 */
15
16 /**
17 * The core plugin class.
18 *
19 * This is used to define internationalization, admin-specific hooks, and
20 * public-facing site hooks.
21 *
22 * Also maintains the unique identifier of this plugin as well as the current
23 * version of the plugin.
24 *
25 * @since 0.7.0
26 * @package Scrollsequence
27 * @subpackage Scrollsequence/includes
28 * @author Scrollsequence <info@scrollsequence.com>
29 */
30 class Scrollsequence {
31
32 /**
33 * The loader that's responsible for maintaining and registering all hooks that power
34 * the plugin.
35 *
36 * @since 0.7.0
37 * @access protected
38 * @var Scrollsequence_Loader $loader Maintains and registers all hooks for the plugin.
39 */
40 protected $loader;
41
42 /**
43 * The unique identifier of this plugin.
44 *
45 * @since 0.7.0
46 * @access protected
47 * @var string $plugin_name The string used to uniquely identify this plugin.
48 */
49 protected $plugin_name;
50
51 /**
52 * The current version of the plugin.
53 *
54 * @since 0.7.0
55 * @access protected
56 * @var string $version The current version of the plugin.
57 */
58 protected $version;
59
60 /**
61 * Define the core functionality of the plugin.
62 *
63 * Set the plugin name and the plugin version that can be used throughout the plugin.
64 * Load the dependencies, define the locale, and set the hooks for the admin area and
65 * the public-facing side of the site.
66 *
67 * @since 0.7.0
68 */
69 public function __construct() {
70 if ( defined( 'SCROLLSEQUENCE_VERSION' ) ) {
71 $this->version = SCROLLSEQUENCE_VERSION;
72 } else {
73 $this->version = '1.0.0';
74 }
75 $this->plugin_name = 'scrollsequence';
76
77 $this->load_dependencies();
78 $this->set_locale();
79 $this->define_admin_hooks();
80 $this->define_public_hooks();
81
82 }
83
84 /**
85 * Load the required dependencies for this plugin.
86 *
87 * Include the following files that make up the plugin:
88 *
89 * - Scrollsequence_Loader. Orchestrates the hooks of the plugin.
90 * - Scrollsequence_i18n. Defines internationalization functionality.
91 * - Scrollsequence_Admin. Defines all hooks for the admin area.
92 * - Scrollsequence_Public. Defines all hooks for the public side of the site.
93 *
94 * Create an instance of the loader which will be used to register the hooks
95 * with WordPress.
96 *
97 * @since 0.7.0
98 * @access private
99 */
100 private function load_dependencies() {
101
102 /**
103 * The class responsible for orchestrating the actions and filters of the
104 * core plugin.
105 */
106 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-scrollsequence-loader.php';
107
108 /**
109 * The class responsible for defining internationalization functionality
110 * of the plugin.
111 */
112 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-scrollsequence-i18n.php';
113
114 /**
115 * The class responsible for defining all actions that occur in the admin area.
116 */
117 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-scrollsequence-admin.php';
118
119 /**
120 * The class responsible for defining all actions that occur in the public-facing
121 * side of the site.
122 */
123 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-scrollsequence-public.php';
124
125 $this->loader = new Scrollsequence_Loader();
126
127 }
128
129 /**
130 * Define the locale for this plugin for internationalization.
131 *
132 * Uses the Scrollsequence_i18n class in order to set the domain and to register the hook
133 * with WordPress.
134 *
135 * @since 0.7.0
136 * @access private
137 */
138 private function set_locale() {
139
140 $plugin_i18n = new Scrollsequence_i18n();
141
142 $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
143
144 }
145
146 /**
147 * Register all of the hooks related to the admin area functionality
148 * of the plugin.
149 *
150 * @since 0.7.0
151 * @access private
152 */
153 private function define_admin_hooks() {
154
155 $plugin_admin = new Scrollsequence_Admin( $this->get_plugin_name(), $this->get_version() );
156
157 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
158 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
159 // register scrollsequence CPT
160 $this->loader->add_action( 'init', $plugin_admin, 'scrollsequence_cpt' );
161 // register CPT submenu
162 $this->loader->add_action( 'init', $plugin_admin, 'scrollsequence_cpt_submenu' );
163 // register scrollsequence_preview_media
164 $this->loader->add_action( 'init', $plugin_admin, 'scrollsequence_preview_media' );
165 $this->loader->add_action( 'admin_head', $plugin_admin, 'scrollsequence_preview_media_hide_submenu_page' );
166
167
168 // tutplus.com Step 1
169 $this->loader->add_action( 'template_include', $plugin_admin, 'scrollsequence_template' );
170 //Carbon Fields boot
171 $this->loader->add_action( 'after_setup_theme', $plugin_admin, 'scrollsequence_carbon_fields_load' );
172 //Carbon Fields main fields
173 $this->loader->add_action( 'carbon_fields_register_fields', $plugin_admin, 'scrollsequence_carbon_fields_cpt' );
174
175 //admin notice (too many img)
176 $this->loader->add_action( 'admin_notices', $plugin_admin, 'scrollsequence_admin_notice', 10, 2);
177
178 //Classic Content Editor Heading
179 $this->loader->add_action( 'edit_form_after_title', $plugin_admin, 'scrollsequence_classic_content_html', 9999, 2);
180
181 // Admin Columns
182 $this->loader->add_action( 'manage_scrollsequence_posts_columns', $plugin_admin, 'scrollsequence_admin_columns',5 );
183 $this->loader->add_action( 'manage_scrollsequence_posts_custom_column', $plugin_admin, 'scrollsequence_admin_column_content',5,2 );
184
185 // Admin Columns (thumb)
186 $this->loader->add_action( 'manage_scrollsequence_posts_columns', $plugin_admin, 'ssq_add_thumbnail_column',5 );
187 $this->loader->add_action( 'manage_scrollsequence_posts_custom_column', $plugin_admin, 'ssq_display_thumbnail_column',5,2 );
188
189 // Options page settings
190 $this->loader->add_action( 'admin_init', $plugin_admin, 'scrollsequence_register_options_settings' );
191
192 // Duplicate button
193 $this->loader->add_action( 'post_row_actions', $plugin_admin, 'ssq_duplicate_post_link', 10, 2);
194 $this->loader->add_action( 'admin_action_duplicate_scrollsequence_as_draft', $plugin_admin, 'duplicate_scrollsequence_as_draft' );
195 $this->loader->add_action( 'admin_notices', $plugin_admin, 'ssq_duplication_admin_notice' );
196
197 // HelpScout Beacon Definition
198 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'ssq_add_helpscout_beacon' );
199
200 // Ajax for creating a Scrollsequence CPT programatically
201 $this->loader->add_action( 'wp_ajax_add_scrollsequence_post', $plugin_admin, 'wp_ajax_add_scrollsequence_post_callback_function' );
202
203
204 //BLOCKSTUFF
205 //Carbon Fields block fields
206 //$this->loader->add_action( 'carbon_fields_register_fields', $plugin_admin, 'scrollsequence_carbon_fields_block' );
207
208
209 }
210
211 /**
212 * Register all of the hooks related to the public-facing functionality
213 * of the plugin.
214 *
215 * @since 0.7.0
216 * @access private
217 */
218 private function define_public_hooks() {
219
220 $plugin_public = new Scrollsequence_Public( $this->get_plugin_name(), $this->get_version() );
221
222 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
223 $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts',1 ); // added priority 1.1.6 to make sure GSAP loads nicely (smgic)
224
225
226
227 }
228
229 /**
230 * Run the loader to execute all of the hooks with WordPress.
231 *
232 * @since 0.7.0
233 */
234 public function run() {
235 $this->loader->run();
236 }
237
238 /**
239 * The name of the plugin used to uniquely identify it within the context of
240 * WordPress and to define internationalization functionality.
241 *
242 * @since 0.7.0
243 * @return string The name of the plugin.
244 */
245 public function get_plugin_name() {
246 return $this->plugin_name;
247 }
248
249 /**
250 * The reference to the class that orchestrates the hooks with the plugin.
251 *
252 * @since 0.7.0
253 * @return Scrollsequence_Loader Orchestrates the hooks of the plugin.
254 */
255 public function get_loader() {
256 return $this->loader;
257 }
258
259 /**
260 * Retrieve the version number of the plugin.
261 *
262 * @since 0.7.0
263 * @return string The version number of the plugin.
264 */
265 public function get_version() {
266 return $this->version;
267 }
268
269 }
270