version = ADV_VIS_ELE_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'wp-ave'; $this->load_dependencies(); $this->set_locale(); $this->library = new Adv_Vis_Ele_Library(); $this->define_admin_hooks(); $this->define_public_hooks(); $this->load_elements_editor(); } private function load_dependencies() { require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-adv-vis-ele-helpers.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-adv-vis-ele-loader.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-adv-vis-ele-i18n.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-adv-vis-ele-admin.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-adv-vis-ele-elementor.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-adv-vis-ele-gutenberg.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'public/class-adv-vis-ele-public.php'; require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-adv-vis-ele-library.php'; $this->loader = new Adv_Vis_Ele_Loader(); } private function set_locale() { $plugin_i18n = new Adv_Vis_Ele_i18n(); $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); } private function define_admin_hooks() { $plugin_admin = new Adv_Vis_Ele_Admin($this->get_plugin_name(), $this->get_version()); $gutenberg_shortcode = new Adv_Vis_Ele_Gutenberg_Shortcode(); if (get_option('adv_vis_ele_enable_default_meta_viewport') == 'on') { $this->loader->add_action('wp_head', $plugin_admin, 'add_viewport_meta_tag'); } $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); $this->loader->add_action('admin_menu', $plugin_admin, 'create_plugin_admin_page'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_install_element', $this->library, 'install_element'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_uninstall_element', $this->library, 'uninstall_element'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_load_more_elements', $this->library, 'ajax_load_more_elements'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_import_settings', $this, 'ajax_import_settings'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_save_ordering', $this->library, 'ajax_save_ordering'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_full_import', $this->library, 'ajax_full_import'); $this->loader->add_action('wp_ajax_adv_vis_ele_ajax_quick_save', $this->library, 'ajax_quick_save'); $this->loader->add_action('edit_form_after_editor', $this, 'element_settings_editor'); $this->loader->add_action('publish_adv-vis-element', $plugin_admin, 'on_publish_element'); $this->loader->add_action('draft_adv-vis-element', $plugin_admin, 'on_publish_element'); $this->loader->add_action('manage_adv-vis-element_posts_custom_column', $plugin_admin, 'populate_shortcodes_in_element_list', 10, 2); $this->loader->add_filter('manage_adv-vis-element_posts_columns', $plugin_admin, 'add_shortcodes_to_element_list'); $this->loader->add_filter('post_row_actions', $plugin_admin, 'add_preview_link', 10, 2); $this->loader->add_filter('post_row_actions', $plugin_admin, 'add_duplicate_button', 10, 2); $this->loader->add_action('admin_init', $plugin_admin, 'duplicate_element'); $this->loader->add_action('admin_init', $plugin_admin, 'register_plugin_settings'); $this->loader->add_action('admin_init', $this, 'update_library', 1); $this->loader->add_filter('plugin_action_links_wp-ave/wp-ave.php', $plugin_admin, 'add_plugin_page_links'); $this->loader->add_filter('admin_body_class', $plugin_admin, 'add_editor_body_classes'); $this->loader->add_filter('parent_file', $plugin_admin, 'keep_admin_menu_parent_item_open'); $this->loader->add_action('post_submitbox_misc_actions', $plugin_admin, 'add_preview_link_to_publish_box'); $this->loader->add_filter('wp_loaded', $plugin_admin, 'quick_preview'); $this->loader->add_action('current_screen', $plugin_admin, 'check_site_url', PHP_INT_MAX); $this->loader->add_action('init', $gutenberg_shortcode, 'gutenberg_shortcode_block'); if (Adv_Vis_Ele_Admin::is_dev()) { $this->loader->add_action('admin_footer', $plugin_admin, 'dev_control_dashboard', PHP_INT_MAX); } } private function define_public_hooks() { $plugin_public = new Adv_Vis_Ele_Public($this->get_plugin_name(), $this->get_version()); $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); } public function run() { $this->loader->run(); } public function get_plugin_name() { return $this->plugin_name; } public function get_loader() { return $this->loader; } public function get_version() { return $this->version; } public function load_elements_editor() { $this->loader->add_action('init', $this, 'register_cpt_adv_vis_element'); } public function register_cpt_adv_vis_element() { $labels = [ "name" => __("Elements", 'wp-ave'), "singular_name" => __("Element", 'wp-ave'), "menu_name" => __("My Elements", 'wp-ave'), "all_items" => __("All Elements", 'wp-ave'), "add_new" => __("Add new", 'wp-ave'), "add_new_item" => __("Add new Element", 'wp-ave'), "edit_item" => __("Edit Element", 'wp-ave'), "new_item" => __("New Element", 'wp-ave'), "view_item" => __("View Element", 'wp-ave'), "view_items" => __("View Elements", 'wp-ave'), "search_items" => __("Search Elements", 'wp-ave'), "not_found" => __("No Elements found", 'wp-ave'), "not_found_in_trash" => __("No Elements found in trash", 'wp-ave'), "parent" => __("Parent Element:", 'wp-ave'), "featured_image" => __("Featured image for this Element", 'wp-ave'), "set_featured_image" => __("Set featured image for this Element", 'wp-ave'), "remove_featured_image" => __("Remove featured image for this Element", 'wp-ave'), "use_featured_image" => __("Use as featured image for this Element", 'wp-ave'), "archives" => __("Element archives", 'wp-ave'), "insert_into_item" => __("Insert into Element", 'wp-ave'), "uploaded_to_this_item" => __("Upload to this Element", 'wp-ave'), "filter_items_list" => __("Filter Elements list", 'wp-ave'), "items_list_navigation" => __("Elements list navigation", 'wp-ave'), "items_list" => __("Elements list", 'wp-ave'), "attributes" => __("Elements attributes", 'wp-ave'), "name_admin_bar" => __("Element", 'wp-ave'), "item_published" => __("Element published", 'wp-ave'), "item_published_privately" => __("Element published privately.", 'wp-ave'), "item_reverted_to_draft" => __("Element reverted to draft.", 'wp-ave'), "item_scheduled" => __("Element scheduled", 'wp-ave'), "item_updated" => __("Element updated.", 'wp-ave'), "parent_item_colon" => __("Parent Element:", 'wp-ave') ]; $args = [ "label" => __("Elements", 'wp-ave'), "labels" => $labels, "description" => "", "public" => false, "publicly_queryable" => false, "show_ui" => true, "show_in_rest" => false, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "has_archive" => false, "show_in_menu" => false, "show_in_nav_menus" => false, "delete_with_user" => false, "exclude_from_search" => true, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "rewrite" => false, "query_var" => true, "supports" => ["title"] ]; register_post_type("adv-vis-element", $args); remove_post_type_support('adv-vis-element', 'revisions'); } /** * Options editing, after the post editor */ public function element_settings_editor() { global $post; $post_id = $post->ID; if ($post->post_type != 'adv-vis-element') { return; } if (isset($_GET['element-id'])) { // first time editing, redirected from the library $element_id = sanitize_text_field($_GET['element-id']); } else { $element_id = get_post_meta($post_id, 'adv-vis-ele-element_id', true); } ?>
[ave-element id=""]
<?php echo do_shortcode('[ave-element id=""]'); ?>
#adv-vis-ele-shortcode--