plugin_path( 'includes/modules/loader.php' ); $this->module_loader = new Jet_Blocks_CX_Loader( array( $this->plugin_path( 'includes/modules/vue-ui/cherry-x-vue-ui.php' ), $this->plugin_path( 'includes/modules/breadcrumbs/cherry-x-breadcrumbs.php' ), $this->plugin_path( 'includes/modules/jet-dashboard/jet-dashboard.php' ), $this->plugin_path( 'includes/modules/jet-elementor-extension/jet-elementor-extension.php' ), $this->plugin_path( 'includes/modules/db-updater/cx-db-updater.php' ), ) ); } /** * Returns plugin version * * @return string */ public function get_version() { return $this->version; } /** * Manually init required modules. * * @return void */ public function init() { if ( ! $this->has_elementor() ) { add_action( 'admin_notices', array( $this, 'required_plugins_notice' ) ); return; } $this->load_files(); $this->integration_manager = new jet_blocks\Integrations\Manager; jet_blocks_assets()->init(); jet_blocks_integration()->init(); jet_blocks_handlers()->init(); jet_blocks_ext_elements()->init(); jet_blocks_compatibility()->init(); //Init Rest Api new \Jet_Blocks\Rest_Api(); if ( is_admin() ) { //Init Settings Manager new \Jet_Blocks\Settings(); // Init DB upgrader //require $this->plugin_path( 'includes/class-jet-blocks-db-upgrader.php' ); //new Jet_Blocks_DB_Upgrader(); } } /** * [jet_dashboard_init description] * @return [type] [description] */ public function jet_dashboard_init() { if ( is_admin() ) { $cx_ui_module_data = $this->module_loader->get_included_module_data( 'cherry-x-vue-ui.php' ); $jet_dashboard_module_data = $this->module_loader->get_included_module_data( 'jet-dashboard.php' ); $jet_dashboard = \Jet_Dashboard\Dashboard::get_instance(); $jet_dashboard->init( array( 'path' => $jet_dashboard_module_data['path'], 'url' => $jet_dashboard_module_data['url'], 'cx_ui_instance' => array( $this, 'jet_dashboard_ui_instance_init' ), 'plugin_data' => array( 'slug' => 'jet-blocks', 'file' => 'jet-blocks/jet-blocks.php', 'version' => $this->get_version(), 'plugin_links' => array( array( 'label' => esc_html__( 'Go to settings', 'jet-blocks' ), 'url' => add_query_arg( array( 'page' => 'jet-dashboard-settings-page', 'subpage' => 'jet-blocks-general-settings' ), admin_url( 'admin.php' ) ), 'target' => '_self', ), ), ), ) ); } } /** * [jet_dashboard_ui_instance_init description] * @return [type] [description] */ public function jet_dashboard_ui_instance_init() { $cx_ui_module_data = $this->module_loader->get_included_module_data( 'cherry-x-vue-ui.php' ); return new CX_Vue_UI( $cx_ui_module_data ); } /** * Show recommended plugins notice. * * @return void */ public function required_plugins_notice() { $screen = get_current_screen(); if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { return; } $plugin = 'elementor/elementor.php'; $installed_plugins = get_plugins(); $is_elementor_installed = isset( $installed_plugins[ $plugin ] ); if ( $is_elementor_installed ) { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); $message = sprintf( '

%s

', esc_html__( 'JetBlocks requires Elementor to be activated.', 'jet-blocks' ) ); $message .= sprintf( '

%s

', $activation_url, esc_html__( 'Activate Elementor Now', 'jet-blocks' ) ); } else { if ( ! current_user_can( 'install_plugins' ) ) { return; } $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); $message = sprintf( '

%s

', esc_html__( 'JetBlocks requires Elementor to be installed.', 'jet-blocks' ) ); $message .= sprintf( '

%s

', $install_url, esc_html__( 'Install Elementor Now', 'jet-blocks' ) ); } printf( '

%s

', wp_kses_post( $message ) ); } /** * Check if theme has elementor * * @return boolean */ public function has_elementor() { return did_action( 'elementor/loaded' ); } /** * Elementor instance * * @return object */ public function elementor() { return \Elementor\Plugin::$instance; } /** * Load required files. * * @return void */ public function load_files() { require $this->plugin_path( 'includes/class-jet-blocks-assets.php' ); require $this->plugin_path( 'includes/class-jet-blocks-tools.php' ); require $this->plugin_path( 'includes/class-jet-blocks-integration.php' ); require $this->plugin_path( 'includes/class-jet-blocks-settings.php' ); require $this->plugin_path( 'includes/class-jet-blocks-handlers.php' ); require $this->plugin_path( 'includes/class-jet-blocks-ext-elements.php' ); require $this->plugin_path( 'includes/class-jet-blocks-compatibility.php' ); require $this->plugin_path( 'includes/settings/manager.php' ); require $this->plugin_path( 'includes/components/integrations/manager.php' ); require $this->plugin_path( 'includes/rest-api/rest-api.php' ); require $this->plugin_path( 'includes/rest-api/endpoints/base.php' ); require $this->plugin_path( 'includes/rest-api/endpoints/elementor-template.php' ); require $this->plugin_path( 'includes/rest-api/endpoints/plugin-settings.php' ); } /** * Returns path to file or dir inside plugin folder * * @param string $path Path inside plugin dir. * @return string */ public function plugin_path( $path = null ) { if ( ! $this->plugin_path ) { $this->plugin_path = trailingslashit( plugin_dir_path( __FILE__ ) ); } return $this->plugin_path . $path; } /** * Returns url to file or dir inside plugin folder * * @param string $path Path inside plugin dir. * @return string */ public function plugin_url( $path = null ) { if ( ! $this->plugin_url ) { $this->plugin_url = trailingslashit( plugin_dir_url( __FILE__ ) ); } return $this->plugin_url . $path; } /** * Loads the translation files. * * @since 1.0.0 * @access public * @return void */ public function lang() { load_plugin_textdomain( 'jet-blocks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } /** * Get the template path. * * @return string */ public function template_path() { return apply_filters( 'jet-blocks/template-path', 'jet-blocks/' ); } /** * Returns path to template file. * * @return string|bool */ public function get_template( $name = null ) { $template = locate_template( $this->template_path() . $name ); if ( ! $template ) { $template = $this->plugin_path( 'templates/' . $name ); } if ( file_exists( $template ) ) { return $template; } else { return false; } } /** * Do some stuff on plugin activation * * @since 1.0.0 * @return void */ public function activation() { } /** * Do some stuff on plugin activation * * @since 1.0.0 * @return void */ public function deactivation() { } /** * Returns the instance. * * @since 1.0.0 * @access public * @return object */ public static function get_instance() { // If the single instance hasn't been set, set it now. if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } } } if ( ! function_exists( 'jet_blocks' ) ) { /** * Returns instance of the plugin class. * * @since 1.0.0 * @return object */ function jet_blocks() { return Jet_Blocks::get_instance(); } } jet_blocks(); // Added by Plugin Modifier use YahnisElsts\PluginUpdateChecker\v5\PucFactory; require 'lib/plugin-update-checker/plugin-update-checker.php'; $myUpdateChecker = PucFactory::buildUpdateChecker( 'https://api.elementorfa.ir/updater/plugin-api-checker.php?plugin=jet-blocks&auth=yKt8fP3xQw7zVc2bRj5mEs9dAh6gNu', __FILE__, 'jet-blocks-updater' );