D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
www
/
secureplusconsultancy.online
/
wp-content
/
plugins
/
sefu-core
/
Filename :
sefu-core.php
back
Copy
<?php /** * Plugin Name: Sefu Core * Plugin URI: https://themeforest.net/user/creativegigs/portfolio * Description: This plugin adds the core features to the Sefu WordPress theme. You must have to install this plugin to get all the features included with the Sefu theme. * Version: 1.2.8 * Author: Spider Themes * Author URI: https://themeforest.net/user/creativegigs/portfolio * Text domain: sefu-core */ if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } // Sefu Core Directories define( 'SC_IMAGES', plugins_url( 'widgets/images/', __FILE__ ) ); define( 'SEFU_PATH', plugin_dir_path( __FILE__ ) ); define( 'SEFU_URL', plugin_dir_url( __FILE__ ) ); // Make sure the same class is not loaded twice in free/premium versions. if ( ! class_exists( 'Sefu_core' ) ) { /** * Main Sefu Core Class * * The main class that initiates and runs the Sefu Core plugin. */ class Sefu_core { /** * Sefu Core Version * * Holds the version of the plugin. * * @var string The plugin version. */ const VERSION = '1.0'; /** * Minimum Elementor Version * * Holds the minimum Elementor version required to run the plugin. * * @var string Minimum Elementor version required to run the plugin. */ const MINIMUM_ELEMENTOR_VERSION = '2.6.0'; /** * Minimum PHP Version * * Holds the minimum PHP version required to run the plugin. * * @var string Minimum PHP version required to run the plugin. */ const MINIMUM_PHP_VERSION = '5.4'; /** * Plugin's directory paths * @since 1.0 */ const CSS = null; const JS = null; const IMG = null; const VEND = null; /** * Instance * * Holds a single instance of the `Sefu_Core` class. * * @access private * @static * * @var Sefu_Core A single instance of the class. */ private static $_instance = null; /** * Instance * * Ensures only one instance of the class is loaded or can be loaded. * * @access public * @static * * @return Sefu_Core An instance of the class. */ public static function instance() { if ( is_null( self::$_instance ) ) { self::$_instance = new self(); } return self::$_instance; } /** * Clone * * Disable class cloning. * * @access protected * * @return void */ public function __clone() { // Cloning instances of the class is forbidden _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'sefu-core' ), '1.7.0' ); } /** * Wakeup * * Disable unserializing the class. * * @access protected * * @return void */ public function __wakeup() { // Unserializing instances of the class is forbidden. _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'sefu-core' ), '1.7.0' ); } /** * Constructor * * Initialize the Sefu Core plugins. * * @access public */ public function __construct() { //add_action( 'init', [$this, 'mega_menu_include']); $this->init_hooks(); $this->core_includes(); do_action( 'sefu_core_loaded' ); } /** * Include Files * * Load core files required to run the plugin. * * @access public */ public function core_includes() { // Metaboxes require_once __DIR__ . '/inc/metaboxes.php'; // Extra functions require_once __DIR__ . '/inc/extra.php'; // Custom post types require_once __DIR__ . '/post-type/faq.pt.php'; require_once __DIR__ . '/post-type/case-study.pt.php'; require_once __DIR__ . '/post-type/team-member.php'; require_once __DIR__ . '/post-type/none.pt.php'; /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ require_once __DIR__ . '/wp-widgets/widgets.php'; // RGBA color picker require plugin_dir_path( __FILE__ ) . '/inc/acf-rgba/acf-rgba-color-picker.php'; } /** * Init Hooks * * Hook into actions and filters. * * @access private */ private function init_hooks() { add_action( 'init', [ $this, 'i18n' ] ); add_action( 'plugins_loaded', [ $this, 'init' ] ); } /** * Load Textdomain * * Load plugin localization files. * * @access public */ public function i18n() { load_plugin_textdomain( 'sefu-core', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); } /** * Init Sefu Core * * Load the plugin after Elementor (and other plugins) are loaded. * * @access public */ public function init() { if ( ! did_action( 'elementor/loaded' ) ) { add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] ); return; } // Check for required Elementor version if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) { add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] ); return; } // Check for required PHP version if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] ); return; } // Add new Elementor Categories add_action( 'elementor/init', [ $this, 'add_elementor_category' ] ); // Register Widget Scripts add_action( 'elementor/frontend/after_register_scripts', [ $this, 'register_widget_scripts' ] ); add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'register_widget_scripts' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); // Register Widget Scripts add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_elementor_editor_styles' ] ); add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'enqueue_widget_styles' ] ); // Register New Widgets add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] ); // Register Custom Fonts add_filter( 'elementor/fonts/groups', function ( $font_groups ) { $font_groups['sefu_fonts'] = __( 'Sefu Fonts' ); return $font_groups; } ); add_filter( 'elementor/fonts/additional_fonts', function ( $additional_fonts ) { $additional_fonts['Circular Std'] = 'sefu_fonts'; $additional_fonts['Circular Std Book'] = 'sefu_fonts'; $additional_fonts['thinkregular'] = 'sefu_fonts'; $additional_fonts['Beginning of Summer'] = 'sefu_fonts'; return $additional_fonts; } ); } /** * Admin notice * * Warning when the site doesn't have Elementor installed or activated. * * @access public */ public function admin_notice_missing_main_plugin() { $message = sprintf( /* translators: 1: Sefu Core 2: Elementor */ esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'sefu-core' ), '<strong>' . esc_html__( 'Sefu core', 'sefu-core' ) . '</strong>', '<strong>' . esc_html__( 'Elementor', 'sefu-core' ) . '</strong>' ); printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); } /** * Admin notice * * Warning when the site doesn't have a minimum required Elementor version. * * @access public */ public function admin_notice_minimum_elementor_version() { $message = sprintf( /* translators: 1: Sefu Core 2: Elementor 3: Required Elementor version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'sefu-core' ), '<strong>' . esc_html__( 'Sefu Core', 'sefu-core' ) . '</strong>', '<strong>' . esc_html__( 'Elementor', 'sefu-core' ) . '</strong>', self::MINIMUM_ELEMENTOR_VERSION ); printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); } /** * Admin notice * * Warning when the site doesn't have a minimum required PHP version. * * @access public */ public function admin_notice_minimum_php_version() { $message = sprintf( /* translators: 1: Sefu Core 2: PHP 3: Required PHP version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'sefu-core' ), '<strong>' . esc_html__( 'Sefu Core', 'sefu-core' ) . '</strong>', '<strong>' . esc_html__( 'PHP', 'sefu-core' ) . '</strong>', self::MINIMUM_PHP_VERSION ); printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); } /** * Add new Elementor Categories * * Register new widget categories for Sefu Core widgets. * * @since 1.0.0 * @since 1.7.1 The method moved to this class. * * @access public */ public function add_elementor_category() { \Elementor\Plugin::instance()->elements_manager->add_category( 'sefu-elements', [ 'title' => __( 'Sefu Elements', 'sefu-core' ) ], 1 ); } /** * Register Widget Styles * * Register custom styles required to run Sefu Core. * * @access public */ public function enqueue_widget_styles() { wp_register_style( 'nice-select', plugins_url( 'assets/css/nice-select.css', __FILE__ ) ); wp_register_style( 'animate-headline', plugins_url( 'assets/css/animate-headline.css', __FILE__ ) ); wp_register_style( 'animate', plugins_url( 'assets/css/animate.css', __FILE__ ) ); wp_register_style( 'owl-carousel', plugins_url( 'assets/css/owl.carousel.min.css', __FILE__ ) ); wp_register_style( 'slick', plugins_url( 'assets/css/slick.css', __FILE__ ) ); wp_register_style( 'magnific-popup', plugins_url( 'assets/css/magnific-popup.css', __FILE__ ) ); wp_enqueue_style('nice-select'); } /** * Register Widget Scripts * * Register custom scripts required to run Sefu Core. * * @access public */ public function register_widget_scripts() { wp_register_script( 'nice-select', plugins_url( 'assets/js/jquery.nice-select.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'animate-headline', plugins_url( 'assets/js/animate-headline.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'owl-carousel', plugins_url( 'assets/js/owl.carousel.min.js', __FILE__ ), 'jquery', '2.3.4', true ); //wp_register_script( 'sefu-counterup', plugins_url( 'assets/js/jquery.counterup.min.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'sefu-imagesloaded', plugins_url( 'assets/js/imagesloaded.pkgd.min.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'sefu-easypiechart', plugins_url( 'assets/js/jquery.easypiechart.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'sefu-waypoints', plugins_url( 'assets/js/waypoints.min.js', __FILE__ ), 'jquery', '1.0', true ); wp_enqueue_script( 'sefu-wow', plugins_url( 'assets/js/wow.min.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'magnific-popup', plugins_url( 'assets/js/jquery.magnific-popup.min.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'slick', plugins_url( 'assets/js/slick.min.js', __FILE__ ), 'jquery', '1.0', true ); wp_enqueue_script( 'ajax-chimp', plugins_url( 'assets/js/ajax-chimp.js', __FILE__ ), 'jquery', '1.0', true ); wp_register_script( 'sefu-scripts', plugins_url( 'assets/js/scripts.js', __FILE__ ), 'jquery', '1.0', true ); wp_enqueue_script('nice-select'); } public function enqueue_elementor_editor_styles() { wp_enqueue_style( 'sefu-elementor-editor', plugins_url( 'assets/css/elementor-editor.css', __FILE__ ) ); } public function enqueue_scripts() { wp_deregister_style( 'elementor-animations' ); } /** * Register New Widgets * * Include Sefu Core widgets files and register them in Elementor. * * @access public */ public function on_widgets_registered() { $this->include_widgets(); $this->register_widgets(); } /** * Include Widgets Files * * Load Sefu Core widgets files. * * @access private */ private function include_widgets() { require_once __DIR__ . '/widgets/Sefu_Hero.php'; require_once __DIR__ . '/widgets/Feature_Box.php'; require_once __DIR__ . '/widgets/Sefu_Title.php'; require_once __DIR__ . '/widgets/Author_Box.php'; require_once __DIR__ . '/widgets/Sefu_Form.php'; require_once __DIR__ . '/widgets/Sefu_Blog.php'; require_once __DIR__ . '/widgets/Testimonial.php'; require_once __DIR__ . '/widgets/States_Counter.php'; require_once __DIR__ . '/widgets/Sefu_Accordion.php'; require_once __DIR__ . '/widgets/Sefu_Video.php'; require_once __DIR__ . '/widgets/Team_Member.php'; require_once __DIR__ . '/widgets/Sefu_Search.php'; require_once __DIR__ . '/widgets/Pricing_Table.php'; require_once __DIR__ . '/widgets/Case_Study.php'; } /** * Register Widgets * * Register Sefu Core widgets. * * @access private */ private function register_widgets() { // Site Elements $widgets = [ 'Sefu_Hero', 'Feature_box', 'Sefu_Title', 'Sefu_Author_Box', 'Sefu_Form', 'Sefu_Blog', 'Sefu_Testimonial', 'Sefu_Sates_Counter', 'Sefu_Video', 'Sefu_Accordion', 'Sefu_Team_Member', 'Sefu_Search', 'Sefu_Pricing_Table', 'Sefu_Case_Study' ]; $widgets = array_merge( $widgets ); foreach ( $widgets as $widget ) { $classname = "\\SefuCore\\Widgets\\$widget"; \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new $classname() ); } } } } // Make sure the same function is not loaded twice in free/premium versions. if ( ! function_exists( 'sefu_core_load' ) ) { /** * Load Sefu Core * * Main instance of Sefu_Core. * */ function sefu_core_load() { return Sefu_core::instance(); } // Run Sefu Core sefu_core_load(); }