PluginProbe
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.4
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.4
4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 All 183 releases
elementskit-lite / modules / onepage-scroll / init.php
init.php
72 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ElementsKit_Lite\Modules\Onepage_Scroll;
3
4 defined( 'ABSPATH' ) || exit;
5
6 class Init {
7 private $dir;
8 private $url;
9
10 public function __construct() {
11
12 // get current directory path
13 $this->dir = dirname( __FILE__ ) . '/';
14
15 // get current module's url
16 $this->url = \ElementsKit_Lite::plugin_url() . 'modules/onepage-scroll/';
17
18 // enqueue styles and scripts
19 add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'load_styles' ) );
20 add_action( 'elementor/frontend/before_enqueue_scripts', array( $this, 'load_scripts' ) );
21 add_action( 'elementor/frontend/before_enqueue_scripts', array( $this, 'editor_scripts' ) );
22
23 // include all necessary files
24 $this->include_files();
25
26 // calling the sticky controls
27 new \Elementor\ElementsKit_Extend_Onepage_Scroll();
28
29 if ( \ElementsKit_Lite::package_type() === 'pro' ) :
30 new \Elementor\ElementsKit_Pro_Extend_Onepage_Scroll();
31 endif;
32 }
33
34 public function include_files() {
35 include $this->dir . 'extend-controls.php';
36 include $this->dir . 'extend-controls-pro.php';
37 }
38
39 public function load_styles() {
40 if ( self::get_page_data_setting( 'ekit_onepagescroll' ) ) :
41 wp_enqueue_style( 'one-page-scroll', $this->url . 'assets/css/one-page-scroll.min.css', array(), \ElementsKit_Lite::version() );
42 endif;
43 }
44
45 public function load_scripts() {
46 if ( self::get_page_data_setting( 'ekit_onepagescroll' ) ) :
47 wp_enqueue_script( 'one-page-scroll', $this->url . 'assets/js/one-page-scroll.js', array( 'jquery', 'elementor-frontend' ), \ElementsKit_Lite::version(), true );
48 endif;
49 }
50
51 public function editor_scripts() {
52 // todo: has some conflicts with dependency.
53 // wp_enqueue_script( 'ekit-onepage-scroll-editor', $this->url . 'assets/js/editor.js', ['jquery', 'elementor-editor', 'elementor-frontend'], \ElementsKit_Lite::version(), true );
54 }
55
56 public static function get_settings_model() {
57 $post_id = get_the_ID();
58 $page_settings_manager = \Elementor\Core\Settings\Manager::get_settings_managers( 'page' );
59 return $page_settings_manager->get_model( $post_id );
60 }
61
62 public static function get_page_data_setting( $id ) {
63 $page_settings = self::get_settings_model()->get_data('settings');
64 return isset($page_settings[$id]) ? $page_settings[$id] : false;
65 }
66
67 public static function get_page_setting( $id ) {
68 $settings_model = self::get_settings_model();
69 return $settings_model->get_settings( $id );
70 }
71 }
72