/
home
/
rekodeb
/
webmars
/
wp-content
/
plugins
/
calmor-core
/
Upload File
HOME
<?php /** * Plugin Name: Calmer Core * Plugin URI: https://themeforest.net/user/picmaticweb/portfolio * Description: This plugin adds the core features to the calmer WordPress theme. You must have to install this plugin to get all the features included with the theme. * Version: 1.0.4 * Author: Calmer * Author URI: https://themeforest.net/user/picmaticweb/portfolio * Text domain: calmor-core */ if ( !defined('ABSPATH') ) die('-1'); // Make sure the same class is not loaded twice in free/premium versions. if ( !class_exists( 'calmor_core' ) ) { /** * Main calmor Core Class * * The main class that initiates and runs the calmor Core plugin. * * @since 1.7.0 */ class calmor_core { /** * calmor Core Version * * Holds the version of the plugin. * * @since 1.7.0 * @since 1.7.1 Moved from property with that name to a constant. * * @var string The plugin version. */ const VERSION = '1.0' ; /** * Minimum Elementor Version * * Holds the minimum Elementor version required to run the plugin. * * @since 1.7.0 * @since 1.7.1 Moved from property with that name to a constant. * * @var string Minimum Elementor version required to run the plugin. */ const MINIMUM_ELEMENTOR_VERSION = '1.7.0'; /** * Minimum PHP Version * * Holds the minimum PHP version required to run the plugin. * * @since 1.7.0 * @since 1.7.1 Moved from property with that name to a constant. * * @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 `calmor_Core` class. * * @since 1.7.0 * * @access private * @static * * @var calmor_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. * * @since 1.7.0 * * @access public * @static * * @return calmor_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. * * @since 1.7.0 * * @access protected * * @return void */ public function __clone() { // Cloning instances of the class is forbidden _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'calmor-core' ), '1.7.0' ); } /** * Wakeup * * Disable unserializing the class. * * @since 1.7.0 * * @access protected * * @return void */ public function __wakeup() { // Unserializing instances of the class is forbidden. _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'calmor-core' ), '1.7.0' ); } /** * Constructor * * Initialize the calmor Core plugins. * * @since 1.7.0 * * @access public */ public function __construct() { $this->init_hooks(); $this->core_includes(); do_action( 'calmor_core_loaded' ); } /** * Include Files * * Load core files required to run the plugin. * * @since 1.7.0 * * @access public */ public function core_includes() { // Extra functions $opt = get_option('calmor_opt'); $is_team_cpt = isset($opt['is_team_cpt']) ? $opt['is_team_cpt'] : '1'; $is_project_cpt = isset($opt['is_project_cpt']) ? $opt['is_project_cpt'] : '1'; $is_service_cpt = isset($opt['is_service_cpt']) ? $opt['is_service_cpt'] : '1'; require_once __DIR__ . '/inc/extra.php'; if($is_team_cpt == '1'){ require_once __DIR__ . '/post-type/teachers.php'; } if($is_project_cpt == '1'){ require_once __DIR__ . '/post-type/program.php'; } if($is_service_cpt == '1'){ require_once __DIR__ . '/post-type/services.php'; } require_once __DIR__ . '/post-type/footer.php'; require_once __DIR__ . '/post-type/header.php'; /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ require_once __DIR__ . '/wp-widgets/widgets.php'; // Elementor custom field icons require_once __DIR__ . '/fields/icons.php'; // RGBA color picker require plugin_dir_path(__FILE__) . '/acf-rgba-color-picker/acf-rgba-color-picker.php'; // ACF Metaboxes //require plugin_dir_path(__FILE__) . '/inc/metaboxes.php'; // Parallax if ( is_readable( __DIR__ . '/inc/parallax/class-parallax.php') ) { if ( !class_exists('\DROIT_ELEMENTOR_PRO\Parallax') ) { require_once __DIR__ . '/inc/parallax/class-parallax.php'; \DROIT_ELEMENTOR_PRO\Parallax::instance()->init(); } } } /** * Init Hooks * * Hook into actions and filters. * * @since 1.7.0 * * @access private */ private function init_hooks() { add_action( 'init', [ $this, 'i18n' ] ); add_action( 'plugins_loaded', [ $this, 'init' ] ); } /** * Load Textdomain * * Load plugin localization files. * * @since 1.7.0 * * @access public */ public function i18n() { load_plugin_textdomain( 'calmor-core', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); } /** * Init calmor Core * * Load the plugin after Elementor (and other plugins) are loaded. * * @since 1.0.0 * @since 1.7.0 The logic moved from a standalone function to this class method. * * @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/frontend/after_enqueue_styles', [ $this, 'enqueue_widget_styles' ] ); add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_widget_styles' ] ); // Register New Widgets add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] ); } /** * Admin notice * * Warning when the site doesn't have Elementor installed or activated. * * @since 1.1.0 * @since 1.7.0 Moved from a standalone function to a class method. * * @access public */ public function admin_notice_missing_main_plugin() { $message = sprintf( /* translators: 1: calmor Core 2: Elementor */ esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'calmor-core' ), '<strong>' . esc_html__( 'calmor core', 'calmor-core' ) . '</strong>', '<strong>' . esc_html__( 'Elementor', 'calmor-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. * * @since 1.1.0 * @since 1.7.0 Moved from a standalone function to a class method. * * @access public */ public function admin_notice_minimum_elementor_version() { $message = sprintf( /* translators: 1: calmor Core 2: Elementor 3: Required Elementor version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'calmor-core' ), '<strong>' . esc_html__( 'calmor Core', 'calmor-core' ) . '</strong>', '<strong>' . esc_html__( 'Elementor', 'calmor-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. * * @since 1.7.0 * * @access public */ public function admin_notice_minimum_php_version() { $message = sprintf( /* translators: 1: calmor Core 2: PHP 3: Required PHP version */ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'calmor-core' ), '<strong>' . esc_html__( 'calmor Core', 'calmor-core' ) . '</strong>', '<strong>' . esc_html__( 'PHP', 'calmor-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 calmor 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( 'calmor-elements', [ 'title' => __( 'calmor Elements', 'calmor-core' ), ], 1 ); } /** * Register Widget Scripts * * Register custom scripts required to run calmor Core. * * @since 1.6.0 * @since 1.7.1 The method moved to this class. * * @access public */ public function register_widget_scripts() { wp_register_script( 'ajax-chimp', plugins_url( 'assets/js/ajax-chimp.js', __FILE__ ), 'jquery', '1.0', true ); // Theme Style wp_enqueue_style('style', plugins_url( 'assets_theme/css/style.css', __FILE__ ) ); wp_enqueue_style('progress', plugins_url( 'assets_theme/css/plugins/progress.css', __FILE__ ) ); wp_enqueue_style('nice-select', plugins_url( 'assets_theme/css/plugins/nice-select.min.css', __FILE__ ) ); wp_enqueue_style('magnific-popup', plugins_url( 'assets_theme/css/plugins/magnific-popup.css', __FILE__ ) ); wp_enqueue_style('animate', plugins_url( 'assets_theme/css/plugins/animate.css', __FILE__ ) ); wp_enqueue_style('slick', plugins_url( 'assets_theme/css/plugins/slick-slider/slick.css', __FILE__ ) ); //wp_enqueue_style('responsive', plugins_url( 'assets_theme/css/responsive.css', __FILE__ ) ); wp_register_script( 'jquery-counterup', plugins_url( 'assets_theme/js/jquery.counterup.js', __FILE__ ), false, '1.0.0' ); wp_register_script( 'magnet-mousemin', plugins_url( 'assets_theme/js/magnet-mouse.min.js', __FILE__ ), false, '1.0.0' ); wp_register_script( 'magnific-popup', plugins_url( 'assets_theme/js/magnific-popup.min.js', __FILE__ ), false, '1.1.0' ); wp_register_script( 'parallax-min', plugins_url( 'assets_theme/js/parallax.min.js', __FILE__ ), false, '1.0.0' ); wp_register_script( 'wow-min', plugins_url( 'assets_theme/js/wow.min.js', __FILE__ ), false, '1.1.3' ); } /** * Register Widget Styles * * Register custom styles required to run calmor Core. * * @since 1.7.0 * @since 1.7.1 The method moved to this class. * * @access public */ public function enqueue_widget_styles() { } public function enqueue_scripts() { wp_enqueue_script( 'jquery-counterup', plugins_url( 'assets_theme/js/jquery.counterup.js', __FILE__ ), false, '1.0.0' ); wp_enqueue_script( 'magnet-mousemin', plugins_url( 'assets_theme/js/magnet-mouse.min.js', __FILE__ ), false, '1.0.0' ); wp_enqueue_script( 'magnific-popup', plugins_url( 'assets_theme/js/magnific-popup.min.js', __FILE__ ), false, '1.1.0' ); wp_enqueue_script( 'parallax-min', plugins_url( 'assets_theme/js/parallax.min.js', __FILE__ ), false, '1.0.0' ); wp_enqueue_script( 'wow-min', plugins_url( 'assets_theme/js/wow.min.js', __FILE__ ), false, '1.1.3' ); } /*public function register_admin_styles() { wp_enqueue_style( 'calmor_core_admin', plugins_url( 'assets/css/calmor-core-admin.css', __FILE__ ) ); }*/ /** * Register New Widgets * * Include calmor Core widgets files and register them in Elementor. * * @since 1.0.0 * @since 1.7.1 The method moved to this class. * * @access public */ public function on_widgets_registered() { $this->include_widgets(); $this->register_widgets(); } /** * Include Widgets Files * * Load calmor Core widgets files. * * @since 1.0.0 * @since 1.7.1 The method moved to this class. * * @access private */ private function include_widgets() { require_once __DIR__ . '/widgets/calmor_hero.php'; require_once __DIR__ . '/widgets/calmor_blog.php'; require_once __DIR__ . '/widgets/calmor_services.php'; require_once __DIR__ . '/widgets/calmor_awards.php'; require_once __DIR__ . '/widgets/calmor_project.php'; require_once __DIR__ . '/widgets/calmor_team.php'; require_once __DIR__ . '/widgets/calmor_testimonials.php'; require_once __DIR__ . '/widgets/calmor_video.php'; require_once __DIR__ . '/widgets/calmor_marque.php'; require_once __DIR__ . '/widgets/calmor_client.php'; require_once __DIR__ . '/widgets/calmor_pricing.php'; require_once __DIR__ . '/widgets/calmor_progress.php'; require_once __DIR__ . '/widgets/calmor_address.php'; require_once __DIR__ . '/widgets/calmor_button.php'; require_once __DIR__ . '/widgets/calmor_counter.php'; require_once __DIR__ . '/widgets/calmor_service_cate.php'; require_once __DIR__ . '/widgets/calmer_product.php'; require_once __DIR__ . '/widgets/calmer_accrodion.php'; require_once __DIR__ . '/widgets/calmer_breadcrumbs.php'; require_once __DIR__ . '/widgets/calmer_nav_menu.php'; //require_once __DIR__ . '/widgets/calmer_contactform.php'; } /** * Register Widgets * * Register calmor Core widgets. * * @since 1.0.0 * @since 1.7.1 The method moved to this class. * * @access private */ private function register_widgets() { // Site Elements \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_hero() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_blog() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_services() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_awards() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_project() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_team() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_testimonials() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_video() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_marque() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_client() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_pricing() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_progress() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_address() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_button() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_counter() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmor_service_cate() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmer_product() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmer_accrodion() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmer_breadcrumbs() ); \Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmer_navmenu() ); //\Elementor\Plugin::instance()->widgets_manager->register( new \calmorCore\Widgets\calmer_contactform() ); } } } // Make sure the same function is not loaded twice in free/premium versions. if ( !function_exists( 'calmor_core_load' ) ) { /** * Load calmor Core * * Main instance of calmor_Core. * * @since 1.0.0 * @since 1.7.0 The logic moved from this function to a class method. */ function calmor_core_load() { return calmor_core::instance(); } // Run calmor Core calmor_core_load(); } function calmor_admin_cpt_script( $hook ) { global $post; if ( $hook == 'post-new.php' || $hook == 'post.php' ) { if ( 'service' === $post->post_type ) { wp_enqueue_style('themify-icons', plugins_url( 'assets/vendors/themify-icon/themify-icons.css', __FILE__ )); } } } add_action( 'admin_enqueue_scripts', 'calmor_admin_cpt_script', 10, 1 ); // Parallax if ( is_readable( __DIR__ . '/inc/parallax/class-parallax.php') ) { if ( !class_exists('\DROIT_ELEMENTOR_PRO\Parallax') ) { require_once __DIR__ . '/inc/parallax/class-parallax.php'; \DROIT_ELEMENTOR_PRO\Parallax::instance()->init(); } } /// nav menu