Initial commit: Atomaste website

This commit is contained in:
2025-12-10 12:17:30 -05:00
commit 0b9e5d1605
19260 changed files with 5206382 additions and 0 deletions

View File

@@ -0,0 +1,315 @@
<?php
/**
* Astra Sites Compatibility for 'Astra Pro'
*
* @see https://wordpress.org/plugins/astra-pro/
*
* @package Astra Sites
* @since 1.0.0
*/
use STImporter\Importer\Helpers\ST_Image_Importer;
if ( ! class_exists( 'Astra_Sites_Compatibility_Astra_Pro' ) ) :
/**
* Astra_Sites_Compatibility_Astra_Pro
*
* @since 1.0.0
*/
class Astra_Sites_Compatibility_Astra_Pro {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.0.0
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.0
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'astra_pro' ), 10, 2 );
add_action( 'astra_sites_import_start', array( $this, 'import_enabled_extension' ), 10, 2 );
add_action( 'astra_sites_import_complete', array( $this, 'clear_cache' ) );
}
/**
* Import
*
* @since 1.1.6
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Processing "Astra Pro" Batch Import' );
}
Astra_Sites_Importer_Log::add( '---- Processing Mapping - for Astra Pro ----' );
self::start_post_mapping();
}
/**
* Update Site Origin Active Widgets
*
* @since 1.0.0
*
* @param string $plugin_init Plugin init file.
* @param array $data Data.
* @return void
*/
public function astra_pro( $plugin_init = '', $data = array() ) {
if ( 'astra-addon/astra-addon.php' === $plugin_init && ! empty( $data ) ) {
if ( is_array( $data ) ) {
$data = json_decode( wp_json_encode( $data ), true );
}
if ( isset( $data['enabled_extensions'] ) ) {
$extensions = $data['enabled_extensions'];
if ( ! empty( $extensions ) ) {
if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $extensions );
}
}
}
}
}
/**
* Import custom 404 section.
*
* @since 1.0.0
* @param array $demo_data Site all data render from API call.
* @param array $demo_api_uri Demo URL.
*/
public function import_custom_404( $demo_data = array(), $demo_api_uri = '' ) {
if ( isset( $demo_data['astra-custom-404'] ) ) {
if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
$options_404 = $demo_data['astra-custom-404'];
Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_custom_404', $options_404 );
}
}
}
/**
* Import settings enabled Astra extensions from the demo.
*
* @since 1.0.0
* @param array $demo_data Site all data render from API call.
* @param array $demo_api_uri Demo URL.
*/
public function import_enabled_extension( $demo_data = array(), $demo_api_uri = '' ) {
if ( isset( $demo_data['astra-enabled-extensions'] ) ) {
if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $demo_data['astra-enabled-extensions'] );
}
}
}
/**
* Start post meta mapping of Astra Addon
*
* @since 1.1.6
*
* @return null If there is no import option data found.
*/
public static function start_post_mapping() {
$demo_data = Astra_Sites_File_System::get_instance()->get_demo_content();
if ( ! isset( $demo_data['astra-post-data-mapping'] ) ) {
return;
}
$post_type = 'astra-advanced-hook';
$posts = ( isset( $demo_data['astra-post-data-mapping'][ $post_type ] ) ) ? $demo_data['astra-post-data-mapping'][ $post_type ] : array();
if ( ! empty( $posts ) ) {
foreach ( $posts as $key => $post ) {
$page = Astra_Site_Options_Import::instance()->get_page_by_title( $post['post_title'], $post_type );
if ( is_object( $page ) ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Setting Location Rules for ' . $post['post_title'] );
}
self::update_location_rules( $page->ID, 'ast-advanced-hook-location', $post['mapping']['ast-advanced-hook-location'] );
}
}
}
$post_type = 'astra_adv_header';
$posts = ( isset( $demo_data['astra-post-data-mapping'][ $post_type ] ) ) ? $demo_data['astra-post-data-mapping'][ $post_type ] : array();
if ( ! empty( $posts ) ) {
foreach ( $posts as $key => $post ) {
$page = Astra_Site_Options_Import::instance()->get_page_by_title( $post['post_title'], $post_type );
if ( is_object( $page ) ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Setting Location Rules for ' . $post['post_title'] );
}
self::update_location_rules( $page->ID, 'ast-advanced-headers-location', $post['mapping']['ast-advanced-headers-location'] );
self::update_location_rules( $page->ID, 'ast-advanced-headers-exclusion', $post['mapping']['ast-advanced-headers-exclusion'] );
self::update_header_mapping( $page->ID, 'ast-advanced-headers-design', $post['mapping']['ast-advanced-headers-design'] );
}
}
}
}
/**
* Update Header Mapping Data
*
* @since 1.1.6
*
* @param int $post_id Post ID.
* @param string $meta_key Post meta key.
* @param array $mapping Mapping array.
* @return void
*/
public static function update_header_mapping( $post_id = '', $meta_key = '', $mapping = array() ) {
Astra_Sites_Importer_Log::add( 'Mapping "' . $meta_key . '" for ' . $post_id );
$headers_old = get_post_meta( $post_id, $meta_key, true );
$headers_new = self::get_header_mapping( $headers_old, $mapping );
update_post_meta( $post_id, $meta_key, $headers_new );
}
/**
* Update Location Rules
*
* @since 1.1.6
*
* @param int $post_id Post ID.
* @param string $meta_key Post meta key.
* @param array $mapping Mapping array.
* @return void
*/
public static function update_location_rules( $post_id = '', $meta_key = '', $mapping = array() ) {
Astra_Sites_Importer_Log::add( 'Mapping "' . $meta_key . '" for ' . $post_id );
$location_new = self::get_location_mappings( $mapping );
update_post_meta( $post_id, $meta_key, $location_new );
}
/**
* Get mapping locations.
*
* @since 1.1.6
*
* @param array $location Location data.
* @return array Location mapping data.
*/
public static function get_location_mappings( $location = array() ) {
if ( empty( $location ) ) {
return $location;
}
if ( ! isset( $location['specific'] ) || empty( $location['specific'] ) ) {
return $location;
}
$mapping = array();
if ( isset( $location['specific']['post'] ) ) {
foreach ( $location['specific']['post'] as $post_type => $old_post_data ) {
if ( is_array( $old_post_data ) ) {
foreach ( $old_post_data as $post_key => $post ) {
$post_object = get_page_by_path( $post['slug'] );
if ( $post_object ) {
$mapping[] = 'post-' . absint( $post_object->ID );
}
}
}
}
}
if ( isset( $location['specific']['tax'] ) ) {
foreach ( $location['specific']['tax'] as $taxonomy_type => $old_term_data ) {
if ( is_array( $old_term_data ) ) {
foreach ( $old_term_data as $term_key => $term_data ) {
$term = get_term_by( 'slug', $term_data['slug'], $taxonomy_type );
if ( is_object( $term ) ) {
$mapping[] = 'tax-' . absint( $term->term_id );
}
}
}
}
}
$location['specific'] = $mapping;
return $location;
}
/**
* Get advanced header mapping data
*
* @since 1.1.6
*
* @param array $headers_old Header mapping stored data.
* @param array $headers_data Header mapping data.
* @return array Filtered header mapping data.
*/
public static function get_header_mapping( $headers_old = array(), $headers_data = array() ) {
// Set menu location by menu slug.
if ( isset( $headers_data['menus'] ) && ! empty( $headers_data['menus'] ) ) {
foreach ( $headers_data['menus'] as $header_option_name => $menu_data ) {
$term = get_term_by( 'slug', $menu_data['slug'], 'nav_menu' );
if ( is_object( $term ) ) {
$headers_old[ $header_option_name ] = $term->term_id;
}
}
}
// Set image ID & URL after importing these on website.
if ( isset( $headers_data['images'] ) && ! empty( $headers_data['images'] ) ) {
foreach ( $headers_data['images'] as $key => $image_data ) {
if ( isset( $image_data['image'] ) && ! empty( $image_data['image'] ) ) {
$downloaded_image = ST_Image_Importer::get_instance()->import( $image_data['image'] );
$headers_old[ $image_data['key_map']['url'] ] = $downloaded_image['url'];
$headers_old[ $image_data['key_map']['id'] ] = $downloaded_image['id'];
}
}
}
return $headers_old;
}
/**
* Clear Cache
*
* @since 1.2.3
* @return void
*/
public function clear_cache() {
if ( is_callable( 'Astra_Minify::refresh_assets' ) ) {
Astra_Minify::refresh_assets();
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_Astra_Pro::get_instance();
endif;

View File

@@ -0,0 +1,62 @@
<?php
/**
* Astra Sites Compatibility for 'Beaver Builder'
*
* @package Astra Sites
* @since 3.0.21
*/
defined( 'ABSPATH' ) || exit;
/**
* Beaver Builder Compatibility
*
* @since 3.0.21
*/
class Astra_Sites_Compatibility_BB {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 3.0.21
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.21
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 3.0.21
*/
public function __construct() {
add_action( 'fl_builder_activated', array( $this, 'bb_activated' ) );
}
/**
* Disable redirection for Beaver Builder plugin when activated via Starter templates import process.
*/
public function bb_activated() {
if ( astra_sites_has_import_started() ) {
delete_transient( '_fl_builder_activation_admin_notice' );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_BB::get_instance();

View File

@@ -0,0 +1,60 @@
<?php
/**
* Astra Sites Compatibility for 'Checkout Plugins Stripe for WooCommerce'
*
* @see https://wordpress.org/plugins/checkout-plugins-stripe-woo/
*
* @package Astra Sites
* @since 3.0.23
*/
/**
* Checkout Plugins - Stripe compatibility for Starter Templates.
*/
class Astra_Sites_Checkout_Plugins_Stripe_WOO {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 3.0.23
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.23
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'checkout_plugins' ), 10, 2 );
}
/**
* Disable redirec after installing and activating Checkout Plugins - Stripe.
*
* @param string $plugin_init Plugin init file used for activation.
* @return void
*/
public function checkout_plugins( $plugin_init ) {
if ( 'checkout-plugins-stripe-woo/checkout-plugins-stripe-woo.php' === $plugin_init ) {
delete_option( 'cpsw_start_onboarding' );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Checkout_Plugins_Stripe_WOO::get_instance();

View File

@@ -0,0 +1,78 @@
<?php
/**
* Astra Sites Compatibility for 3rd party plugins.
*
* @package Astra Sites
* @since 1.0.11
*/
if ( ! class_exists( 'Astra_Sites_Compatibility' ) ) :
/**
* Astra Sites Compatibility
*
* @since 1.0.11
*/
class Astra_Sites_Compatibility {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.0.11
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.11
* @return object initialized object of class.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.11
*/
public function __construct() {
// Plugin - Astra Pro.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php';
// Plugin - WooCommerce.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php';
// Plugin - LearnDash LMS.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php';
// Plugin - Elementor.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/elementor/class-astra-sites-compatibility-elementor.php';
// Plugin - Beaver Builder.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/beaver-builder/class-astra-sites-compatibility-bb.php';
// Plugin - LearnDash.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/learndash/class-astra-sites-compatibility-learndash.php';
// Plugin - UABB.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/uabb/class-astra-sites-compatibility-uabb.php';
}
}
/**
* Kicking this off by calling 'instance()' method
*/
Astra_Sites_Compatibility::instance();
endif;

View File

@@ -0,0 +1,187 @@
<?php
/**
* Astra Sites Compatibility for 'Elementor'
*
* @package Astra Sites
* @since 2.0.0
*/
namespace AstraSites\Elementor;
defined( 'ABSPATH' ) || exit;
if ( ! class_exists( '\Elementor\Plugin' ) ) {
return;
}
if ( ! class_exists( 'Astra_Sites_Compatibility_Elementor' ) ) :
/**
* Elementor Compatibility
*
* @since 2.0.0
*/
class Astra_Sites_Compatibility_Elementor {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 2.0.0
*/
private static $instance;
/**
* Initiator
*
* @since 2.0.0
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 2.0.0
*/
public function __construct() {
/**
* Add Slashes
*
* @todo Elementor already have below code which works on defining the constant `WP_LOAD_IMPORTERS`.
* After defining the constant `WP_LOAD_IMPORTERS` in WP CLI it was not works.
* Try to remove below duplicate code in future.
*/
if ( ! wp_doing_ajax() || ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.0.0', '>=' ) ) ) {
remove_filter( 'wp_import_post_meta', array( 'Elementor\Compatibility', 'on_wp_import_post_meta' ) );
remove_filter( 'wxr_importer.pre_process.post_meta', array( 'Elementor\Compatibility', 'on_wxr_importer_pre_process_post_meta' ) );
add_filter( 'wp_import_post_meta', array( $this, 'on_wp_import_post_meta' ) );
add_filter( 'wxr_importer.pre_process.post_meta', array( $this, 'on_wxr_importer_pre_process_post_meta' ) );
}
add_action( 'astra_sites_before_delete_imported_posts', array( $this, 'force_delete_kit' ), 10, 2 );
add_action( 'astra_sites_before_sse_import', array( $this, 'disable_attachment_metadata' ) );
add_action( 'init', array( $this, 'init' ) );
add_action( 'astra_sites_after_plugin_activation', array( $this, 'disable_elementor_redirect' ) );
}
/**
* Disable Elementor redirect.
*
* @return void.
*/
public function disable_elementor_redirect() {
$elementor_redirect = get_transient( 'elementor_activation_redirect' );
if ( ! empty( $elementor_redirect ) && '' !== $elementor_redirect ) {
delete_transient( 'elementor_activation_redirect' );
}
}
/**
* Remove the transient update check for plugins callback from Elementor.
* This reduces the extra code execution for Elementor.
*/
public function init() {
if ( astra_sites_has_import_started() && null !== \Elementor\Plugin::$instance->admin ) {
remove_filter( 'pre_set_site_transient_update_plugins', array( \Elementor\Plugin::$instance->admin->get_component( 'canary-deployment' ), 'check_version' ) );
}
}
/**
* Disable the attachment metadata
*/
public function disable_attachment_metadata() {
remove_filter(
'wp_update_attachment_metadata', array(
\Elementor\Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' ),
'set_svg_meta_data',
), 10, 2
);
}
/**
* Force Delete Elementor Kit
*
* Delete the previously imported Elementor kit.
*
* @param int $post_id Post name.
* @param string $post_type Post type.
*/
public function force_delete_kit( $post_id = 0, $post_type = '' ) {
if ( ! $post_id ) {
return;
}
if ( 'elementor_library' === $post_type ) {
$_GET['force_delete_kit'] = true;
}
}
/**
* Process post meta before WP importer.
*
* Normalize Elementor post meta on import, We need the `wp_slash` in order
* to avoid the unslashing during the `add_post_meta`.
*
* Fired by `wp_import_post_meta` filter.
*
* @since 1.4.3
* @access public
*
* @param array $post_meta Post meta.
*
* @return array Updated post meta.
*/
public function on_wp_import_post_meta( $post_meta ) {
foreach ( $post_meta as &$meta ) {
if ( '_elementor_data' === $meta['key'] ) {
$meta['value'] = wp_slash( $meta['value'] );
break;
}
}
return $post_meta;
}
/**
* Process post meta before WXR importer.
*
* Normalize Elementor post meta on import with the new WP_importer, We need
* the `wp_slash` in order to avoid the unslashing during the `add_post_meta`.
*
* Fired by `wxr_importer.pre_process.post_meta` filter.
*
* @since 1.4.3
* @access public
*
* @param array $post_meta Post meta.
*
* @return array Updated post meta.
*/
public function on_wxr_importer_pre_process_post_meta( $post_meta ) {
if ( '_elementor_data' === $post_meta['key'] ) {
$post_meta['value'] = wp_slash( $post_meta['value'] );
}
return $post_meta;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_Elementor::get_instance();
endif;

View File

@@ -0,0 +1,71 @@
<?php
/**
* Astra Sites Compatibility for 'LatePoint'
*
* @see https://wordpress.org/plugins/latepoint/
*
* @package Astra Sites
* @since 4.4.14
*/
if ( ! class_exists( 'Astra_Sites_Compatibility_LatePoint' ) ) :
/**
* LatePoint Compatibility
*
* @since 4.4.14
*/
class Astra_Sites_Compatibility_LatePoint {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 4.4.14
*/
private static $instance;
/**
* Initiator
*
* @since 4.4.14
* @return object initialized object of class.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 4.4.14
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'disable_latepoint_redirection' ) );
}
/**
* Disables LatePoint redirection during plugin activation.
*
* @param string $plugin_init The path to the plugin file that was just activated.
*
* @since 4.4.14
*/
public function disable_latepoint_redirection( $plugin_init ) {
if ( 'latepoint/latepoint.php' === $plugin_init ) {
update_option( 'latepoint_redirect_to_wizard', false );
update_option( 'latepoint_show_version_5_modal', false );
}
}
}
/**
* Kicking this off by calling 'instance()' method
*/
Astra_Sites_Compatibility_LatePoint::instance();
endif;

View File

@@ -0,0 +1,62 @@
<?php
/**
* Compatibility for 'LearnDash'
*
* @see https://wordpress.org/plugins/astra-pro/
*
* @package Astra Sites
* @since 2.3.8
*/
// If LearnDash is not defined then return false.
if ( ! defined( 'LEARNDASH_COURSE_GRID_VERSION' ) ) {
return;
}
if ( ! class_exists( 'Astra_Sites_Compatibility_LearnDash' ) ) :
/**
* Astra Sites Compatibility LearnDash
*
* @since 2.3.8
*/
class Astra_Sites_Compatibility_LearnDash {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 2.3.8
*/
private static $instance;
/**
* Initiator
*
* @since 2.3.8
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 2.3.8
*/
public function __construct() {
add_filter( 'astra_sites_pre_process_post_disable_content', '__return_false' );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_LearnDash::get_instance();
endif;

View File

@@ -0,0 +1,108 @@
<?php
/**
* Astra Sites Compatibility for 'LearnDash LMS'
*
* @see https://www.learndash.com/
*
* @package Astra Sites
* @since 1.3.13
*/
if ( ! class_exists( 'Astra_Sites_Compatibility_SFWD_LMS' ) ) :
/**
* Astra_Sites_Compatibility_SFWD_LMS
*
* @since 1.3.13
*/
class Astra_Sites_Compatibility_SFWD_LMS {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.3.13
*/
private static $instance;
/**
* Initiator
*
* @since 1.3.13
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.3.13
*/
public function __construct() {
add_filter( 'astra_sites_gutenberg_batch_process_post_types', array( $this, 'set_post_types' ) );
add_action( 'astra_sites_import_complete', array( $this, 'process_landing_pages_mapping' ) );
}
/**
* Set LearnDash Landing pages with respect to Cartflows.
*
* @since 2.3.2
*/
public function process_landing_pages_mapping() {
$demo_data = Astra_Sites_File_System::get_instance()->get_demo_content();
if ( ! isset( $demo_data['astra-post-data-mapping'] ) || ! isset( $demo_data['astra-post-data-mapping']['ld_landing_pages'] ) ) {
return;
}
$index = 'ld_landing_pages';
$posts = ( isset( $demo_data['astra-post-data-mapping'][ $index ] ) ) ? $demo_data['astra-post-data-mapping'][ $index ] : array();
if ( ! empty( $posts ) ) {
foreach ( $posts as $key => $post ) {
if ( '' !== $post['landing_page'] ) {
// Get course by Title.
$course = Astra_Site_Options_Import::instance()->get_page_by_title( $post['course'], 'sfwd-courses' );
// Get landing step by Title.
$landing_page = Astra_Site_Options_Import::instance()->get_page_by_title( $post['landing_page'], 'cartflows_step' );
if ( is_object( $course ) && is_object( $landing_page ) ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Setting LearnDash - CartFlows Landing page - ' . $course->post_title . ' - ( ' . $course->ID . ' )' );
}
$ld_meta = get_post_meta( $course->ID, '_sfwd-courses', true );
$ld_meta['sfwd-courses_wcf_course_template'] = $landing_page->ID;
// Update the imported landing step to the course.
update_post_meta( $course->ID, '_sfwd-courses', $ld_meta );
}
}
}
}
}
/**
* Set post types
*
* @since 1.3.13
*
* @param array $post_types Post types.
*/
public function set_post_types( $post_types = array() ) {
return array_merge( $post_types, array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates', 'sfwd-assignment' ) );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_SFWD_LMS::get_instance();
endif;

View File

@@ -0,0 +1,57 @@
<?php
/**
* Astra Sites Compatibility for 'UABB - Lite'
*
* @see https://wordpress.org/plugins/ultimate-addons-for-beaver-builder-lite/
*
* @package Astra Sites
* @since 3.0.23
*/
/**
* UABB compatibility for Starter Templates.
*/
class Astra_Sites_Compatibility_UABB {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 3.0.23
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.23
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'uabb_activation' ), 10, 2 );
}
/**
* Disable redirec after installing and activating UABB.
*
* @return void
*/
public function uabb_activation() {
update_option( 'uabb_lite_redirect', false );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_UABB::get_instance();

View File

@@ -0,0 +1,184 @@
<?php
/**
* Astra Sites Compatibility for 'WooCommerce'
*
* @see https://wordpress.org/plugins/woocommerce/
*
* @package Astra Sites
* @since 1.1.4
*/
if ( ! class_exists( 'Astra_Sites_Compatibility_WooCommerce' ) ) :
/**
* WooCommerce Compatibility
*
* @since 1.1.4
*/
class Astra_Sites_Compatibility_WooCommerce {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.1.4
*/
private static $instance;
/**
* Initiator
*
* @since 1.1.4
* @return object initialized object of class.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.1.4
*/
public function __construct() {
add_action( 'astra_sites_import_start', array( $this, 'add_attributes' ), 10, 2 );
add_action( 'astra_sites_after_plugin_activation', array( $this, 'install_wc' ), 10, 2 );
// WooCommerce product attributes registration.
if ( class_exists( 'WooCommerce' ) ) {
add_filter( 'wxr_importer.pre_process.term', array( $this, 'woocommerce_product_attributes_registration' ), 10, 1 );
add_action( 'astra_sites_import_complete', array( $this, 'update_wc_lookup_table' ) );
}
add_filter( 'astra_sites_pre_process_post_disable_content', '__return_false' );
add_filter( 'astra_sites_pre_process_post_empty_excerpt', '__return_false' );
}
/**
* Add product attributes.
*
* @since 1.1.4
*
* @param string $demo_data Import data.
* @param array $demo_api_uri Demo site URL.
* @return void
*/
public function add_attributes( $demo_data = array(), $demo_api_uri = '' ) {
$attributes = ( isset( $demo_data['astra-site-options-data']['woocommerce_product_attributes'] ) ) ? $demo_data['astra-site-options-data']['woocommerce_product_attributes'] : array();
if ( ! empty( $attributes ) && function_exists( 'wc_create_attribute' ) ) {
foreach ( $attributes as $key => $attribute ) {
$args = array(
'name' => $attribute['attribute_label'],
'slug' => $attribute['attribute_name'],
'type' => $attribute['attribute_type'],
'order_by' => $attribute['attribute_orderby'],
'has_archives' => $attribute['attribute_public'],
);
$id = wc_create_attribute( $args );
}
}
}
/**
* Create default WooCommerce tables
*
* @param string $plugin_init Plugin file which is activated.
* @return void
*/
public function install_wc( $plugin_init ) {
if ( 'woocommerce/woocommerce.php' !== $plugin_init ) {
return;
}
// Create WooCommerce database tables.
if ( is_callable( '\Automattic\WooCommerce\Admin\Install::create_tables' ) ) {
\Automattic\WooCommerce\Admin\Install::create_tables();
\Automattic\WooCommerce\Admin\Install::create_events();
}
if ( is_callable( 'WC_Install::install' ) ) {
WC_Install::install();
}
}
/**
* Hook into the pre-process term filter of the content import and register the
* custom WooCommerce product attributes, so that the terms can then be imported normally.
*
* This should probably be removed once the WP importer 2.0 support is added in WooCommerce.
*
* Fixes: [WARNING] Failed to import pa_size L warnings in content import.
* Code from: woocommerce/includes/admin/class-wc-admin-importers.php (ver 2.6.9).
*
* Github issue: https://github.com/proteusthemes/one-click-demo-import/issues/71
*
* @since 3.0.0
* @param array $data The term data to import.
* @return array The unchanged term data.
*/
public function woocommerce_product_attributes_registration( $data ) {
global $wpdb;
if ( strstr( $data['taxonomy'], 'pa_' ) ) {
if ( ! taxonomy_exists( $data['taxonomy'] ) ) {
$attribute_name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $data['taxonomy'] ) );
// Create the taxonomy.
if ( ! in_array( $attribute_name, wc_get_attribute_taxonomies(), true ) ) {
$attribute = array(
'attribute_label' => $attribute_name,
'attribute_name' => $attribute_name,
'attribute_type' => 'select',
'attribute_orderby' => 'menu_order',
'attribute_public' => 0,
);
$wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- WP Query would be expensive here, we are adding taxonomy attributes for WooCommerce.
delete_transient( 'wc_attribute_taxonomies' );
}
// Register the taxonomy now so that the import works!
register_taxonomy(
$data['taxonomy'],
apply_filters( 'woocommerce_taxonomy_objects_' . $data['taxonomy'], array( 'product' ) ),
apply_filters(
'woocommerce_taxonomy_args_' . $data['taxonomy'], array(
'hierarchical' => true,
'show_ui' => false,
'query_var' => true,
'rewrite' => false,
)
)
);
}
}
return $data;
}
/**
* Update WooCommerce Lookup Table.
*
* @since 3.0.0
*
* @return void
*/
public function update_wc_lookup_table() {
if ( function_exists( 'wc_update_product_lookup_tables' ) ) {
if ( ! wc_update_product_lookup_tables_is_running() ) {
wc_update_product_lookup_tables();
}
}
}
}
/**
* Kicking this off by calling 'instance()' method
*/
Astra_Sites_Compatibility_WooCommerce::instance();
endif;