11<?php
22namespace InfiniteScrollElementorNameSpace ;
33
4- class Plugin {
4+ class Plugin
5+ {
6+ private static $ _instance = null ;
57
6- private static $ _instance = null ;
8+ public static function instance ()
9+ {
10+ if (is_null (self ::$ _instance )) {
11+ self ::$ _instance = new self ();
12+ }
13+ return self ::$ _instance ;
14+ }
715
8- public static function instance () {
9- if ( is_null ( self ::$ _instance ) ) {
10- self ::$ _instance = new self ();
11- }
12- return self ::$ _instance ;
13- }
16+ public function widget_scripts ()
17+ {
18+ wp_enqueue_script ('infinite-scroll-js ' , plugin_dir_url (__FILE__ ) . '../assets/js/infinite-scroll.pkgd.min.js ' , '' , '' , true );
19+ }
1420
15- public function widget_scripts () {
16- wp_enqueue_script ( 'infinite-scroll-js ' , plugin_dir_url ( __FILE__ ) . '../assets/js/infinite-scroll.pkgd.min.js ' , '' ,'' , true );
17- }
21+ public function widget_styles ()
22+ {
23+ wp_register_style ('infinite-scroll-elementor-css ' , plugins_url ('../assets/css/infinite-scroll-elementor.css ' , __FILE__ ));
24+ }
1825
19- public function widget_styles () {
20- wp_register_style ( 'infinite-scroll-elementor-css ' , plugins_url ( '../assets/css/infinite-scroll-elementor.css ' , __FILE__ ) );
21- }
26+ private function include_widgets_files ()
27+ {
28+ require_once (__DIR__ . '/widgets/infinite-scroll-elementor-ise.php ' );
29+ require_once (__DIR__ . '/widgets/button-load-elementor-ise.php ' );
30+ }
2231
23- private function include_widgets_files () {
24- require_once ( __DIR__ . '/widgets/infinite-scroll-elementor-ise.php ' );
25- }
32+ /**
33+ * Register Widgets
34+ *
35+ * Register new Elementor widgets.
36+ *
37+ * @since 1.0.0
38+ * @access public
39+ */
40+ public function register_widgets ()
41+ {
42+ // Its is now safe to include Widgets files
43+ $ this ->include_widgets_files ();
2644
27- /**
28- * Register Widgets
29- *
30- * Register new Elementor widgets.
31- *
32- * @since 1.0.0
33- * @access public
34- */
35- public function register_widgets () {
36- // Its is now safe to include Widgets files
37- $ this ->include_widgets_files ();
45+ // Register Widgets
46+ \Elementor \Plugin::instance ()->widgets_manager ->register_widget_type (new Widgets \ISE_InfiniteScroll ());
47+ \Elementor \Plugin::instance ()->widgets_manager ->register_widget_type (new Widgets \ISE_ButtonLoad ());
48+ }
49+
50+ /**
51+ * Plugin class constructor
52+ *
53+ * Register plugin action hooks and filters
54+ *
55+ * @since 1.0.0
56+ * @access public
57+ */
58+ public function __construct ()
59+ {
3860
39- // Register Widgets
40- \Elementor \Plugin::instance ()->widgets_manager ->register_widget_type ( new Widgets \ISE_InfiniteScroll () );
41- }
42-
43- /**
44- * Plugin class constructor
45- *
46- * Register plugin action hooks and filters
47- *
48- * @since 1.0.0
49- * @access public
50- */
51- public function __construct () {
61+ // Register widgets scripts
62+ add_action ('elementor/frontend/after_register_scripts ' , [ $ this , 'widget_scripts ' ]);
63+
64+ // Register widgets styles
65+ add_action ('elementor/frontend/after_enqueue_styles ' , [ $ this , 'widget_styles ' ]);
5266
53- // Register widgets scripts
54- add_action ( 'elementor/frontend/after_register_scripts ' , [ $ this , 'widget_scripts ' ] );
55-
56- // Register widgets styles
57- add_action ( 'elementor/frontend/after_enqueue_styles ' , [ $ this , 'widget_styles ' ] );
58-
59- // Register widgets
60- add_action ( 'elementor/widgets/widgets_registered ' , [ $ this , 'register_widgets ' ] );
61-
67+ // Register widgets
68+ add_action ('elementor/widgets/widgets_registered ' , [ $ this , 'register_widgets ' ]);
69+
6270 // Register widgets category
63- add_action ( 'elementor/init ' , function () {
64- \Elementor \Plugin::$ instance ->elements_manager ->add_category (
65- 'infinite-scroll-elementor-category ' ,
66- [
67- 'title ' => __ ( 'Infinite Scroll Elementor ' , 'infinite-scroll-elementor-td ' ),
68- ],
69- 1 // Position
70- );
71+ add_action ('elementor/init ' , function () {
72+ \Elementor \Plugin::$ instance ->elements_manager ->add_category (
73+ 'infinite-scroll-elementor-category ' ,
74+ [
75+ 'title ' => __ ('Infinite Scroll Elementor ' , 'infinite-scroll-elementor-td ' ),
76+ ],
77+ 1 // Position
78+ );
7179 });
72-
73- }
74-
80+ }
7581}
7682
7783// Instantiate Plugin Class
78- Plugin::instance ();
84+ Plugin::instance ();
0 commit comments