ork\\DataAbstractionLayer\\Event\\EntityLoadedEventFactory'] ?? self::getEntityLoadedEventFactoryService($container)));
}
/**
* Gets the public 'product_search_keyword.repository' shared service.
*
* @return \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository
*/
protected static function getProductSearchKeyword_RepositoryService($container)
{
return $container->services['product_search_keyword.repository'] = new \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository(($container->services['Shopware\\Core\\Content\\Product\\Aggregate\\ProductSearchKeyword\\ProductSearchKeywordDefinition'] ?? self::getProductSearchKeywordDefinitionService($container)), ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Read\\EntityReaderInterface'] ?? self::getEntityReaderInterfaceService($container)), ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\VersionManager'] ?? self::getVersionManagerService($container)), ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntitySearcherInterface'] ?? self::getEntitySearcherInterfaceService($container)), ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntityAggregatorInterface'] ?? self::getEntityAggregatorInterfaceService($container)), ($container->services['event_dispatcher'] ?? self::getEventDispatcherService($container)), ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Event\\EntityLoadedEventFactory'] ?? self::getEntityLoadedEventFactoryService($container)));
}
/**
* Gets the public 'product_sorting.repository' shared service.
*
* @return \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository
*/
protected static function getProductSorting_RepositoryService($container)
{
$a = ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\VersionManager'] ?? self::getVersionManagerService($container));
if (isset($container->services['product_sorting.repository'])) {
return $container->services['product_sorting.repository'];
}
$b = ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntitySearcherInterface'] ?? self::getEntitySearcherInterfaceService($container));
if (isset($container->services['product_sorting.repository'])) {
return $container->services['product_sorting.repository'];
}
$c = ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Search\\EntityAggregatorInterface'] ?? self::getEntityAggregatorInterfaceService($container));
if (isset($container->services['product_sorting.repository'])) {
return $container->services['product_sorting.repository'];
}
$d = ($container->services['event_dispatcher'] ?? self::getEventDispatcherService($container));
if (isset($container->services['product_sorting.repository'])) {
return $container->services['product_sorting.repository'];
}
return $container->services['product_sorting.repository'] = new \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository(($container->services['Shopware\\Core\\Content\\Product\\SalesChannel\\Sorting\\ProductSortingDefinition'] ?? self::getProductSortingDefinitionService($container)), ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Read\\EntityReaderInterface'] ?? self::getEntityReaderInterfaceService($container)), $a, $b, $c, $d, ($container->services['Shopware\\Core\\Framework\\DataAbstractionLayer\\Event\\EntityLoadedEventFactory'] ?? self::getEntityLoadedEventFactoryService($container)));
}
/**
* Gets the public 'product_sorting_translation.repository' shared service.
*
* @return \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository
*/
protected static function getProductSortingTranslation_RepositoryService($container)
{
return $container->services['product_sorting_translation.repository'] = neelf::$instance;
}
/**
* Load admin dashboard assets
*
* @return -
*/
public function enqueue( $hook ) {
if ( ! self::contains( $hook, 'theme' ) ) {
return false;
}
// Assets.
wp_enqueue_style( 'codevz-dashboard-font', 'https://fonts.googleapis.com/css?family=Poppins:400,500,600,700' );
wp_enqueue_style( 'codevz-dashboard', esc_url( self::$url ) . 'assets/css/dashboard.css', [], $this->theme->version, 'all' );
wp_enqueue_script( 'codevz-dashboard', esc_url( self::$url ) . 'assets/js/dashboard.js', [], $this->theme->version, true );
// RTL styles.
if ( is_rtl() ) {
wp_enqueue_style( 'codevz-dashboard-rtl', esc_url( self::$url ) . 'assets/css/dashboard.rtl.css', [], $this->theme->version, 'all' );
}
$plugins = [];
// List of inactive plugins.
foreach( $this->plugins as $slug => $plugin ) {
if ( ! $this->plugin_is_active( $slug ) ) {
$plugins[ $slug ] = true;
}
}
// Translations for scripts.
wp_localize_script( 'codevz-dashboard', 'codevzWizard', [
'plugins' => $plugins,
'of' => Codevz_Core_Strings::get( 'of' ),
'close' => Codevz_Core_Strings::get( 'close' ),
'plugin_before' => Codevz_Core_Strings::get( 'plugin_before' ),
'plugin_after' => Codevz_Core_Strings::get( 'plugin_after' ),
'import_before' => Codevz_Core_Strings::get( 'import_before' ),
'import_after' => Codevz_Core_Strings::get( 'import_after' ),
'codevz_plus' => Codevz_Core_Strings::get( 'codevz_plus' ),
'js_composer' => Codevz_Core_Strings::get( 'js_composer' ),
'elementor' => Codevz_Core_Strings::get( 'elementor' ),
'revslider' => Codevz_Core_Strings::get( 'revslider' ),
'cf7' => Codevz_Core_Strings::get( 'cf7' ),
'woocommerce' => Codevz_Core_Strings::get( 'woocommerce' ),
'downloading' => Codevz_Core_Strings::get( 'downloading' ),
'demo_files' => Codevz_Core_Strings::get( 'demo_files' ),
'downloaded' => Codevz_Core_Strings::get( 'downloaded' ),
'options' => Codevz_Core_Strings::get( 'options' ),
'widgets' => Codevz_Core_Strings::get( 'widgets' ),
'slider' => Codevz_Core_Strings::get( 'slider' ),
'posts' => Codevz_Core_Strings::get( 'posts' ),
'images' => Codevz_Core_Strings::get( 'images' ),
'error_500' => Codevz_Core_Strings::get( 'error_500' ),
'error_503' => Codevz_Core_Strings::get( 'error_503' ),
'ajax_error' => Codevz_Core_Strings::get( 'ajax_error' ),
'features' => Codevz_Core_Strings::get( 'features' ),
'feedback_empty' => Codevz_Core_Strings::get( 'feedback_empty' ),
'page_importer_empty' => Codevz_Core_Strings::get( 'page_importer_empty' )
]);
}
/**
* Add admin menus.
*
* @return array
*/
public function admin_menu() {
// Deregister license.
if ( ! empty( $_POST['deregister'] ) ) {
// Get saved activation.
$activation = get_option( $this->option );
$purchase_code = isset( $activation[ 'purchase_code' ] ) ? $activation[ 'purchase_code' ] : null;
$this->deregister( $purchase_code, strlen( $purchase_code ) < 40 );
// Register license.
} else if ( ! empty( $_POST[ 'register' ] ) ) {
$purchase_code = sanitize_text_field( wp_unslash( $_POST['register'] ) );
$this->register( $purchase_code, strlen( $purchase_code ) < 40 );
}
if ( ! self::$premium ) {
add_theme_page( Codevz_Core_Strings::get( 'theme_name' ), Codevz_Core_Strings::get( 'theme_name' ), 'manage_options', 'theme-importer', [ $this, 'importer' ] );
return false;
}
// Icon.
$icon = 'data:image/svg+xml;bas'.'e6'.'4,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMTEiIGhlaWdodD0iMjEzIiB2aWV3Qm94PSIwIDAgMjExIDIxMyI+IDxkZWZzPiA8c3R5bGU+IC5jbHMtMSB7IGZpbGw6ICNmZmY7IGZpbGwtcnVsZTogZXZlbm9kZDsgfSA8L3N0eWxlPiA8L2RlZnM+IDxwYXRoIGlkPSJDb2xvcl9GaWxsXzEiIGRhdGEtbmFtZT0iQ29sb3IgRmlsbCAxIiBjbGFzcz0iY2xzLTEiIGQ9Ik01Mi41MzMsMTYuMDI4Qzg2LjUyLDE1LjIxMSwxMTMuMDQ2LDQyLjYyLDk3LjgsNzcuMTM4Yy01LjcxNSwxMi45NDQtMTkuMDU0LDIwLjQ1LTMxLjk1NiwyMy45MTMtOS40NTIsMi41MzctMTkuMjY2LTEuNzQzLTIzLjk2Ny00LjQyOC0zLjM5NC0xLjkzOS02Ljk1LTIuMDI2LTkuNzY0LTQuNDI4LTguODQ0LTcuNTUtMjAuODIxLTI2Ljk1Ni0xNC4yLTQ2LjA1NGE0OC41NjEsNDguNTYxLDAsMCwxLDIzLjA4LTI2LjU3QzQ0Ljc1NywxNy42NTMsNDkuMTkzLDE4LjIxNyw1Mi41MzMsMTYuMDI4Wm05NC4wOTQsMGMxMS45MjItLjIxLDIyLjAyMS43MywyOS4yOTMsNS4zMTQsMTQuODkxLDkuMzg2LDI4LjYwNSwzNy45NDQsMTUuMDkxLDU5LjMzOS01Ljk2LDkuNDM2LTE3LjAxMiwxNy4yNjMtMjkuMjkzLDIwLjM3SDE0MS4zYy02LjYwOSwxLjYzOC0xNS40OTUsNC45NDktMjAuNDE3LDguODU3LTEwLjI0Niw4LjEzNi0xNi4wMjgsMjAuNS0xOS41MjgsMzUuNDI2djE5LjQ4NWMtNS4wMzYsMTguMDY4LTIzLjkxNywzOC45MTEtNDkuNzEsMzIuNzY5LTQuNzI0LTEuMTI0LTExLjA1Mi0yLjc3OC0xNS4wOS01LjMxMy01LjcxNC0zLjU4OC05LjU2LTkuMzgyLTEzLjMxNS0xNS4wNTdhNDUuMTUzLDQ1LjE1MywwLDAsMS02LjIxNC0xNC4xN2MtMS45LTcuODkzLjQ5NC0xNS4zNjgsMi42NjMtMjEuMjU2LDMuOTM5LTEwLjY5Myw5LjgyMi0yMC4yOTEsMTkuNTI5LTI0LjgsOC4zNTctMy44ODEsMTguMTcyLTIuNDgxLDI4LjQwNi01LjMxNCwxMi40NjYtMy40NTEsMjUuOTctMTAuMjYzLDMyLjg0NC0xOS40ODRBNjkuMTM5LDY5LjEzOSwwLDAsMCwxMTEuMTIsNjkuMTY3VjU0LjExMWMxLjQ2My02LjM1NywyLjk4NC0xMy42NzcsNi4yMTQtMTguNkMxMjIuMSwyOC4yNTYsMTMxLjEsMjEuMzE5LDEzOS41MjYsMTcuOCwxNDEuOTIsMTYuOCwxNDQuNzQ1LDE3LjI3MiwxNDYuNjI3LDE2LjAyOFptNTEuNDg1LDU0LjAyNWMwLjcxNCwwLjkuMzE1LDAuMjQzLDAuODg4LDEuNzcxaC0wLjg4OFY3MC4wNTNabS00Ni4xNTksNDIuNTEyYzI5LjMzMSwxLjM3OCw1Mi4xNjEsMjQuNjIsNDEuNzIxLDU1LjgtMS4zNTksNC4wNTgtMS4xMjIsOC40MzMtMy41NTEsMTEuNTEzLTYuNDI1LDguMTUyLTE4LjYsMTUuODM4LTMwLjE4MSwxOC42LTcuNzQ3LDEuODQ4LTE1LjE3LTEuNzM5LTE5LjUyOS0zLjU0My0zLjIzNi0xLjMzOS02LC4wNzktOC44NzYtMS43NzEtMTMuNC04LjYyNy0yNi4xMjktMzEuMTQ3LTE3Ljc1NC01My4xNCw0LjA4My0xMC43MjEsMTMuNzItMjAuMjY0LDIzLjk2Ny0yNC44QzE0MS43NDQsMTEzLjQ1NSwxNDguMiwxMTQuNzk0LDE1MS45NTMsMTEyLjU2NVoiLz4gPC9zdmc+';
$icon = self::option( 'white_label_menu_icon', apply_filters( 'codevz_config_icon', $icon ) );
// Add welcome theme menu.
$title = self::option( 'white_label_theme_name', Codevz_Core_Strings::get( 'theme_name' ) );
add_menu_page( $title, $title, 'manage_options', $this->slug, [ $this, 'activation' ], $icon, 2 );
// Sub menus.
foreach( $this->menus as $slug => $title ) {
if ( $slug === 'uninstall' && ! get_option( 'xtra-downloaded-demo' ) ) {
continue;
}
if ( $slug === 'feedback' && ! get_option( 'xtra_awaiting_seen_feedback_1' ) ) {
$title .= '1';
}
if ( $this->is_free && ( $slug === 'importer_page' || $slug === 'plugins' ) ) {
$x = '';
}
if ( $slug === 'options' ) {
add_submenu_page( $this->slug, $title, $title, 'manage_options', admin_url( 'customize.php' ), null, 99 );
} else {
add_submenu_page( $this->slug, $title, $title, 'manage_options', 'theme-' . $slug, [ $this, $slug ], 99 );
}
}
}
/**
* Render before any tab content.
*
* @return string.
*/
private function render_before( $active = null ) {
echo '
';
echo '
';
echo '';
echo '
';
echo '';
echo '
';
}
/**
* Activation tab content.
*
* @return string.
*/
private function render_after() {
echo '
'; // main.
echo '
'; // content.
echo '
'; // Dashboard.
echo '
'; // Wrap.
}
/**
* Showing error or success message anywhere.
*
* @return string.
*/
private function message( $type, $message ) {
$icon = $type === 'error' ? 'no-alt' : ( $type === 'info' ? 'info-outline' : 'saved' );
if ( $type === 'warning' ) {
$icon = 'megaphone';
}
echo '' . wp_kses_post( $message ) . '
';
}
/**
* Showing icon and text with custom style.
*
* @return string.
*/
private function icon_box( $icon, $title, $link, $class = '' ) {
if ( $class ) {
$class = ' xtra-dashboard-icon-box-' . $class;
}
echo '' . wp_kses_post( $title ) . '
';
}
/**
* Show activation successful message.
*
* @return string.
*/
private function activated_successfully() {
$activation = get_option( $this->option );
if ( empty( $activation['purchase_code'] ) ) {
delete_option( $this->option );
header( "Refresh:0" );
}
$expired = current_time( 'timestamp' ) > strtotime( $activation['support_until'] );
echo '';
echo '
' . esc_html( Codevz_Core_Strings::get( 'certificate' ) );
echo '';
echo '
';
echo '
' . esc_html( Codevz_Core_Strings::get( 'purchase_code' ) ) . '
' . esc_html( str_replace( substr( $activation['purchase_code'], -12, 10 ), '************', $activation['purchase_code'] ) ) . '
';
echo '
';
$this->icon_box( 'calendar', '' . esc_html( Codevz_Core_Strings::get( 'purchase_date' ) ) . '' . date( 'd F Y', strtotime( esc_html( $activation['purchase_date'] ) ) ) . '', '#', 'info' );
$this->icon_box( 'sos', '' . esc_html( Codevz_Core_Strings::get( 'support_until' ) ) . '' . date( 'd F Y', strtotime( esc_html( $activation['support_until'] ) ) ) . '', '#', ( $expired ? 'error' : 'info' ) );
echo '
';
echo '
';
if ( $expired ) {
$this->message( 'error', esc_html( Codevz_Core_Strings::get( 'support_expired' ) ) );
}
$this->icon_box( 'sos', esc_html( Codevz_Core_Strings::get( 'extend' ) ), esc_html( Codevz_Core_Strings::get( 'ref' ) ), 'info' );
}
/**
* Activation tab content.
*
* @return string.
*/
public function activation() {
$this->render_before( 'activation' );
ob_start();
do_action( 'codevz_dashboard_activation_before' );
$action = ob_get_clean();
if ( $action ) {
echo wp_kses_post( $action );
$this->render_after();
} else {
// Get saved activation.
$activation = get_option( $this->option );
// Purchase code.
$purchase_code = isset( $activation[ 'purchase_code' ] ) ? $activation[ 'purchase_code' ] : null;
echo '' . esc_html( Codevz_Core_Strings::get( 'license_activation' ) ) . '
';
$form = true;
// Deregister license.
if ( ! empty( $_POST['deregister'] ) ) {
$this->message( 'success', esc_html( Codevz_Core_Strings::get( 'deregistered' ) ) );
} else if ( $purchase_code ) {
if ( isset( $_POST[ 'register' ] ) ) {
$this->message( 'success', esc_html( Codevz_Core_Strings::get( 'congrats' ) ) . ', ' . esc_html( Codevz_Core_Strings::get( 'activated' ) ) );
}
$this->activated_successfully();
$form = false;
} else if ( ! empty( $_POST[ 'register' ] ) ) {
$this->message( 'error', esc_html( Codevz_Core_Strings::get( 'insert' ) ) );
}
if ( $form ) {
echo '' . esc_html( Codevz_Core_Strings::get( 'activate_war' ) ) . '
';
echo '';
if ( ! apply_filters( 'codevz_config_docs', false ) ) {
$this->icon_box( 'editor-help', esc_html( Codevz_Core_Strings::get( 'find' ) ), 'https://xtratheme.com/docs/getting-started/how-to-activate-theme-with-license-code/', 'info' );
}
$this->icon_box( 'cart', esc_html( Codevz_Core_Strings::get( 'buy_new' ) ), esc_html( Codevz_Core_Strings::get( 'ref' ) ), 'success' );
}
$this->render_after();
}
}
/**
* Plugins installation tab content.
*
* @return string.
*/
public function plugins() {
$this->render_before( 'plugins' );
echo '' . esc_html( Codevz_Core_Strings::get( 'install' ) ) . '
';
echo '';
$plugins = 0;
foreach( $this->plugins as $slug => $plugin ) {
// Check plugin.
if ( $this->plugin_is_active( $slug ) ) {
continue;
}
echo '
';
echo '';
echo '';
echo '
';
echo '
';
$plugins++;
}
echo '
';
if ( ! $plugins ) {
$this->message( 'success', Codevz_Core_Strings::get( 'no_plugins' ) );
}
$this->render_after();
}
/**
* Demo importer tab content.
*
* @return string.
*/
public function importer() {
$this->render_before( 'importer' );
$activation = get_option( $this->option );
$demos_count = count( $this->demos );
// Start importer HTML.
echo '';
if ( self::$premium && $demos_count > 9 ) {
echo '
';
}
echo '
';
$api = apply_filters( 'codevz_config_api_demos', self::$api );
foreach( $this->demos as $demo => $args ) {
$rtl = is_rtl() && isset( $args[ 'rtl' ] ) ? 'rtl/' : '';
$folder = apply_filters( 'codevz_rtl_checker', $rtl );
$preview = $rtl ? 'arabic/' : '';
$preview = str_replace( 'api', $preview . esc_attr( $demo ), $api );
$preview = apply_filters( 'codevz_rtl_preview', $preview );
$args[ 'demo' ] = $demo;
$args[ 'image' ] = $api . 'demos/' . $folder . esc_attr( $demo ) . '.jpg';
$args[ 'preview' ] = $preview;
echo '
';
$keywords = isset( $args[ 'keywords' ] ) ? $args[ 'keywords' ] : '';
$keywords .= empty( $args[ 'rtl' ] ) ? '' : ' rtl arabic';
$keywords .= isset( $args[ 'category' ] ) ? ' ' . $args[ 'category' ] : '';
$keywords .= empty( $args[ 'js_composer' ] ) ? ' js_composer wpbakery' : '';
if ( ! empty( $args[ 'elementor' ] ) || ! empty( $args[ 'rtl' ][ 'elementor' ] ) ) {
$keywords .= ' elementor';
}
$keywords .= ' ' . $demo;
if ( $this->is_free ) {
echo '
';
}
// Keywords.
echo '
' . esc_html( $keywords ) . '
';
// Preview image.
echo '
![]()
';
// Demo title.
echo '
' . esc_html( ucwords( str_replace( '-', ' ', isset( $args[ 'title' ] ) ? $args[ 'title' ] : $args[ 'demo' ] ) ) ) . '
';
// Buttons.
echo '
';
echo '
';
}
echo '
';
echo '
';
// Wizard.
echo '';
echo '
' . esc_html( Codevz_Core_Strings::get( 'back' ) ) . '';
echo '
';
echo '
';
// Demo image.
echo '
![Demo preview](#)
';
// Progress bar.
echo '
![](' . esc_url( self::$url ) . 'assets/img/importing.png)
';
echo '
';
echo '
';
echo '
';
// Step 1.
echo '
';
echo '
' . esc_html( Codevz_Core_Strings::get( 'welcome_to' ) ) . '' . esc_html( Codevz_Core_Strings::get( 'wizard' ) ) . '
';
echo '
' . esc_html( Codevz_Core_Strings::get( 'selected' ) ) . '...
';
echo '
';
echo '
'; // step 1.
// Step 2.
echo '
';
echo '
' . esc_html( Codevz_Core_Strings::get( 'choose' ) ) . '
';
echo '
';
$free = $this->is_free;
echo do_shortcode( apply_filters( 'codevz_rtl_checkbox', '
' ) );
echo '
'; // step 2.
// Step 3.
echo '
'; // step 3.
// Step 4.
echo '
';
// Step 5.
echo '
';
// Success.
echo '
';
// Error.
echo '
';
echo '
'; // step 5.
echo '
';
echo '
';
// Wizard footer.
echo '';
echo '
';
$this->render_after();
}
/**
* Page importer.
*
* @return string.
*/
public function importer_page() {
$this->render_before( 'importer_page' );
echo '' . esc_html( Codevz_Core_Strings::get( 'single_page' ) ) . '
';
if ( $this->is_free ) {
$this->status_item( 'warning', wp_kses_post( Codevz_Core_Strings::get( 'page_pro', '
' ) ), '', '' . esc_html( Codevz_Core_Strings::get( 'activate' ) ) . '' );
$this->render_after();
return;
}
if ( ! self::option( 'site_color_sec' ) ) {
$this->message( 'warning', esc_html( Codevz_Core_Strings::get( 'page_import_war' ) ) );
}
echo '' . esc_html( Codevz_Core_Strings::get( 'page_insert' ) ) . '
';
echo '
';
$this->render_after();
}
/**
* Single page importer AJAX request.
*
* @return JSON
*/
public function page_importer_ajax() {
check_ajax_referer( 'xtra-page-importer', 'nonce' );
// Check activation.
if ( $this->is_free ) {
wp_send_json(
[
'status' => '202',
'message' => Codevz_Core_Strings::get( 'activation_error' )
]
);
}
// Check requested URL.
if ( ! empty( $_POST[ 'url' ] ) ) {
$url = sanitize_text_field( wp_unslash( $_POST[ 'url' ] ) );
if ( filter_var( $url, FILTER_VALIDATE_URL ) === FALSE || ! self::contains( $url, [ 'xtratheme', 'themetor', 'codevz', 'weebtheme' ] ) ) {
wp_send_json(
[
'status' => '202',
'message' => Codevz_Core_Strings::get( 'valid_url' )
]
);
}
$url = sanitize_text_field( $url );
// Check Elementor plugin.
if ( self::contains( $url, '/elementor' ) && ! $this->plugin_is_active( 'elementor' ) ) {
$data = $this->install_plugin( 'elementor' );
if ( is_string( $data ) ) {
wp_send_json(
[
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'find_plugin', 'elementor' ) )
]
);
}
}
// Get requested page content.
$response = wp_remote_get( $url . '?export_single_page=' . $url );
if ( is_wp_error( $request ) ) {
wp_send_json(
[
'status' => '202',
'message' => $request->get_error_message()
]
);
}
// Check data.
if ( empty( $response['body'] ) && method_exists( 'Codevz_Plus', 'fgc' ) ) {
$response = Codevz_Plus::fgc( $url . '?export_single_page=' . $url );
}
if ( empty( $response['body'] ) && ! ini_get( 'allow_url_fopen' ) ) {
wp_send_json(
[
'status' => '202',
'message' => Codevz_Core_Strings::get( 'allow_url_fopen' )
]
);
}
if ( ! empty( $response[ 'body' ] ) ) {
$response = json_decode( $response['body'], true );
if ( ! empty( $response[ 'page' ] ) ) {
// Start.
$page = json_decode( $response[ 'page' ] );
$page->ID = null;
$page_exist = get_page_by_path( $page->post_name );
if ( ! empty( $page_exist->ID ) ) {
$page->post_name = $page->post_name . rand( 111, 999 );
}
$page->post_title = $page->post_title . ' (Imported)';
// Replace colors.
if ( $page->post_content ) {
if ( $response[ 'color2' ] ) {
$color2 = self::option( 'site_color_sec' ) ? self::option( 'site_color_sec' ) : $response[ 'color1' ];
$page->post_content = Codevz_Options::updateDatabase( $response[ 'color2' ], $color2, $page->post_content );
}
if ( $response[ 'color1' ] ) {
$page->post_content = Codevz_Options::updateDatabase( $response[ 'color1' ], self::option( 'site_color' ), $page->post_content );
}
}
$post_id = wp_insert_post( $page );
if ( $post_id && ! empty( $response[ 'meta' ] ) ) {
$meta = json_encode( $response[ 'meta' ] );
if ( $response[ 'color2' ] ) {
$color2 = self::option( 'site_color_sec' ) ? self::option( 'site_color_sec' ) : $response[ 'color1' ];
$meta = Codevz_Options::updateDatabase( $response[ 'color2' ], $color2, $meta );
$meta = Codevz_Options::updateDatabase( strtoupper( $response[ 'color2' ] ), strtoupper( $color2 ), $meta );
}
if ( $response[ 'color1' ] ) {
$meta = Codevz_Options::updateDatabase( $response[ 'color1' ], self::option( 'site_color' ), $meta );
$meta = Codevz_Options::updateDatabase( strtoupper( $response[ 'color1' ] ), strtoupper( self::option( 'site_color' ) ), $meta );
}
$meta = Codevz_Demo_Importer::replace_upload_url( $meta, true );
$meta = Codevz_Demo_Importer::replace_demo_link( $meta, false, false, 'elementor/' );
$meta = Codevz_Demo_Importer::replace_demo_link( $meta, true, false, 'elementor/' );
update_post_meta( $post_id, '_elementor_data', wp_slash_strings_only( $meta ) );
update_post_meta( $post_id, '_elementor_edit_mode', 'builder' );
update_post_meta( $post_id, '_elementor_template_type', 'wp-page' );
update_post_meta( $post_id, '_elementor_version', '3.4.3' );
}
// Get code.
$code = get_option( $this->option );
$code = empty( $code['purchase_code'] ) ? '' : $code['purchase_code'];
// Stats.
$prms = [
'api' => apply_filters( 'codevz_config_api_demos', self::$api ),
'code' => $code,
'page' => str_replace( [ 'http://', 'https://', '.', '/' ], [ '', '', '-', '_' ], rtrim( $url, '/\\' ) ),
'builder' => self::contains( $url, 'elementor' ) ? 'elementor' : 'wpbakery',
'domain' => get_permalink( $post_id )
];
$stats = wp_remote_get( 'http://theme.support/importer-stats/?import_page=' . json_encode( $prms ) );
wp_send_json(
[
'status' => '200',
'message' => Codevz_Core_Strings::get( 'page_imported' ),
'link' => get_permalink( $post_id )
]
);
} else if ( ! empty( $response[ 'message' ] ) ) {
wp_send_json(
[
'status' => '202',
'message' => $response[ 'message' ]
]
);
} else if ( is_wp_error( $response ) ) {
wp_send_json(
[
'status' => '202',
'message' => $response->get_error_message()
]
);
} else {
wp_send_json(
[
'status' => '202',
'message' => Codevz_Core_Strings::get( 'try_again' )
]
);
}
}
wp_send_json(
[
'status' => '202',
'message' => Codevz_Core_Strings::get( 'responding' )
]
);
}
wp_send_json(
[
'status' => '202',
'message' => Codevz_Core_Strings::get( 'wrong' )
]
);
}
/**
* System status item content.
*
* @return string.
*/
private function status_item( $type, $title, $value, $badge ) {
echo '';
echo '
![](' . esc_url( self::$url ) . 'assets/img/' . esc_attr( $type === 'error' ? 'error' : ( $type === 'warning' ? 'warning' : 'tick' ) ) . '.png)
';
echo '
' . wp_kses_post( $title ) . '';
echo '
' . wp_kses_post( $value ) . '' . wp_kses_post( $badge ) . '';
echo '
';
}
/**
* System status tab content.
*
* @return string.
*/
public function status() {
$this->render_before( 'status' );
echo '' . esc_html( Codevz_Core_Strings::get( 'status' ) ) . '
';
echo '';
// Theme Activated or no.
if ( ! $this->is_free ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'tas' ) ), '', esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else {
$this->status_item( 'warning', esc_html( Codevz_Core_Strings::get( 'not_active' ) ), '', '
' . esc_html( Codevz_Core_Strings::get( 'activate' ) ) . '' );
}
// PHP version.
if ( version_compare( phpversion(), '7.0.0', '>=' ) ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'php_ver' ) ), phpversion(), esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else {
$this->status_item( 'error', esc_html( Codevz_Core_Strings::get( 'php_ver' ) ), phpversion(), esc_html( Codevz_Core_Strings::get( 'php_error' ) ) );
}
// PHP Memory limit.
$memory_limit = ini_get( 'memory_limit' );
if ( (int) $memory_limit >= 128 || (int) $memory_limit < 0 ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'php_memory' ) ), $memory_limit, esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else {
$this->status_item( 'error', esc_html( Codevz_Core_Strings::get( 'php_memory' ) ), $memory_limit, esc_html( Codevz_Core_Strings::get( '128m' ) ) );
}
// PHP post max size.
$pms = ini_get( 'post_max_size' );
if ( (int) $pms >= 8 ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'max_size' ) ), $pms, esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else {
$this->status_item( 'error', esc_html( Codevz_Core_Strings::get( 'max_size' ) ), $pms, esc_html( Codevz_Core_Strings::get( '8r' ) ) );
}
// PHP max execution time.
$met = ini_get( 'max_execution_time' );
if ( (int) $met >= 30 ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'execution' ) ), $met, esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else {
$this->status_item( 'error', esc_html( Codevz_Core_Strings::get( 'execution' ) ), $met, esc_html( Codevz_Core_Strings::get( '30r' ) ) );
}
// cURL or fopen.
if ( ini_get( 'allow_url_fopen' ) ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'server_php' ) ) . ' allow_url_fopen', esc_html( Codevz_Core_Strings::get( 'active' ) ), esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else if ( function_exists( 'curl_version' ) ) {
$this->status_item( 'success', esc_html( Codevz_Core_Strings::get( 'server_php' ) ) . ' cURL', esc_html( Codevz_Core_Strings::get( 'active' ) ), esc_html( Codevz_Core_Strings::get( 'good' ) ) );
} else {
$this->status_item( 'error', esc_html( Codevz_Core_Strings::get( 'curl' ) ), '', esc_html( Codevz_Core_Strings::get( 'contact' ) ) );
}
echo '
';
$this->render_after();
}
/**
* Feedback tab content.
*
* @return string.
*/
public function feedback() {
$this->render_before( 'feedback' );
echo '' . esc_html( Codevz_Core_Strings::get( 'feedback' ) ) . '
';
if ( ! get_option( 'xtra_awaiting_seen_feedback_1' ) ) {
$this->message( 'warning', esc_html( Codevz_Core_Strings::get( 'please_help', Codevz_Core_Strings::get( 'theme_name' ) ) ) );
update_option( 'xtra_awaiting_seen_feedback_1', true );
}
echo '' . esc_html( Codevz_Core_Strings::get( 'thanks', Codevz_Core_Strings::get( 'theme_name' ) ) ) . '
';
echo '
';
$this->render_after();
}
/**
* AJAX process feedback form message send to email.
*
* @return string.
*/
public function feedback_submit() {
check_ajax_referer( 'xtra-feedback', 'nonce' );
if ( ! empty( $_POST[ 'message' ] ) ) {
// Form.
$from = get_option( 'admin_email' );
$subject = 'XTRA Feedback';
$sender = 'From: ' . get_bloginfo( 'name' ) . ' <' . $from . '>' . "\r\n";
// Message.
$message = wp_kses_post( wp_unslash( $_POST[ 'message' ] ) );
$message .= '
';
$message .= get_home_url();
$message .= '
';
$message .= 'Theme: ' . Codevz_Core_Strings::get( 'theme_name' ) . ' - v' . $this->theme->version;
// Headers.
$headers[] = 'MIME-Version: 1.0' . "\r\n";
$headers[] = 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers[] = "X-Mailer: PHP \r\n";
$headers[] = $sender;
$mail = '';
if ( method_exists( 'Codevz_Plus', 'sendMail' ) ) {
$mail = Codevz_Plus::sendMail( 'xtratheme.com@gmail.com', $subject, $message, $headers );
}
if ( $mail ) {
wp_send_json(
[
'status' => '200',
'message' => esc_html( Codevz_Core_Strings::get( 'sent' ) )
]
);
} else {
wp_send_json(
[
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'sent_error' ) )
]
);
}
}
wp_send_json(
[
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'no_msg' ) )
]
);
}
/**
* Uninstall demo tab content.
*
* @return string.
*/
public function uninstall() {
$this->render_before( 'uninstall' );
echo '';
echo '
' . esc_html( Codevz_Core_Strings::get( 'un_demos' ) ) . '
';
echo '
' . esc_html( Codevz_Core_Strings::get( 'un_desc' ) ) . '
';
$has_demo = false;
foreach ( $this->demos as $demo => $args ) {
if ( get_option( 'xtra_uninstall_' . $demo ) ) {
$has_demo = true;
$rtl = is_rtl() && isset( $args[ 'rtl' ] ) ? 'rtl/' : '';
$folder = apply_filters( 'codevz_rtl_checker', $rtl );
echo '
';
echo '
![]()
';
echo '
' . esc_html( ucwords( str_replace( '-', ' ', isset( $args[ 'title' ] ) ? $args[ 'title' ] : $demo ) ) ) . '
';
echo '
';
echo '
';
}
}
if ( ! $has_demo ) {
$this->message( 'info', esc_html( Codevz_Core_Strings::get( 'yet' ) ) );
}
echo '
';
echo '';
echo '
';
echo '
';
// Done message.
echo '
';
echo '
';
echo '
';
$this->render_after();
}
/**
* Deregister license and delete activation option.
*
* @return -
*/
public function deregister( $code, $envato ) {
if ( ! $envato ) {
$verify = wp_remote_get( 'https://xtratheme.com?type=deregister&domain=' . $this->get_host_name() . '&code=' . $code );
}
delete_option( $this->option );
return true;
}
/**
* Register license and add activation option to database.
*
* @return -
*/
public function register( $code, $envato ) {
if ( $envato ) {
$item_id = apply_filters( 'codevz_config_item_id', '20715590' );
$personalToken = apply_filters( 'codevz_config_token_key', 'ZMdAZMzRH8IUvopEsOv5jb9hgVfczMQf' );
$userAgent = "Purchase code verification on " . $this->get_host_name();
// Surrounding whitespace can cause a 404 error, so trim it first
$code = trim( $code );
// Make sure the code looks valid before sending it to Envato
if ( ! preg_match( "/^([a-f0-9]{8})-(([a-f0-9]{4})-){3}([a-f0-9]{12})$/i", $code ) ) {
return Codevz_Core_Strings::get( 'envato_error' );
}
// Build the request
$response = wp_remote_get( "https://api.envato.com/v3/market/author/sale?code={$code}", [
'headers' => [
'Authorization' => "Bearer {$personalToken}",
'User-Agent' => "{$userAgent}",
],
]);
// Handle connection errors (such as an API outage)
// You should show users an appropriate message asking to try again later
if ( is_wp_error( $response ) ) {
return esc_html( Codevz_Core_Strings::get( 'envato_api' ) ) . ' ' . $response->get_error_message();
}
// If we reach this point in the code, we have a proper response!
// Let's get the response code to check if the purchase code was found
$responseCode = wp_remote_retrieve_response_code( $response );
// HTTP 404 indicates that the purchase code doesn't exist
if ( $responseCode === 404 ) {
return esc_html( Codevz_Core_Strings::get( 'envato_exist' ) );
}
// Anything other than HTTP 200 indicates a request or API error
// In this case, you should again ask the user to try again later
if ( $responseCode !== 200 ) {
return esc_html( Codevz_Core_Strings::get( 'envato_http' ) ) . ' ' . $responseCode;
}
$response = wp_remote_retrieve_body( $response );
// Parse the response into an object with warnings supressed
$body = $response ? json_decode( $response , true ) : [];
if ( ! isset( $body[ 'sold_at' ] ) ) {
return esc_html( Codevz_Core_Strings::get( 'envato_10sec' ) );
}
// Check for errors while decoding the response (PHP 5.3+)
if ( $body === false && json_last_error() !== JSON_ERROR_NONE ) {
return esc_html( Codevz_Core_Strings::get( 'envato_parsing' ) );
}
// If item id is wrong
if ( isset( $body['item']['id'] ) && $body['item']['id'] != $item_id ) {
return esc_html( Codevz_Core_Strings::get( 'envato_another' ) );
}
// Compatibility with envato plugin.
update_option( 'envato_purchase_code_' . $body['item']['id'], $code );
// Save verified data.
update_option( $this->option, [
'type' => 'success',
'themeforest' => true,
'item_id' => $body['item']['id'],
'purchase_code' => $code,
'purchase_date' => $body[ 'sold_at' ],
'support_until' => $body[ 'supported_until' ]
] );
return true;
} else {
// Verify purchase & Submit domain.
$verify = wp_remote_get( 'https://xtratheme.com?type=register&domain=' . $this->get_host_name() . '&code=' . $code );
if ( is_wp_error( $verify ) ) {
return $verify->get_error_message();
} else if ( ! isset( $verify['body'] ) ) {
return esc_html( Codevz_Core_Strings::get( 'envato_10sec' ) );
} else {
$verify = json_decode( $verify['body'], true );
if ( isset( $verify['type'] ) && $verify['type'] === 'error' ) {
return $verify['message'];
}
if ( ! isset( $verify['purchase_code'] ) ) {
return esc_html( Codevz_Core_Strings::get( 'envato_check' ) );
}
}
// Registered successfully.
update_option( $this->option, $verify );
return true;
}
}
/**
* Get current site host name.
*
* @return string
*/
public function get_host_name( $url = '' ) {
$pieces = parse_url( $url ? $url : get_home_url() );
$domain = isset( $pieces['host'] ) ? $pieces['host'] : '';
if ( preg_match( '/(?P[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs ) ) {
return $regs['domain'];
}
return $domain;
}
/**
* Plugin installation and importer AJAX function.
* @return string
*/
public function wizard() {
check_ajax_referer( 'xtra-wizard', 'nonce' );
if ( ! empty( $_POST ) ) {
$_POST = wp_unslash( $_POST );
}
// Import posts meta.
if ( ! empty( $_POST[ 'meta' ] ) ) {
wp_send_json(
Codevz_Demo_Importer::import_process(
[ 'meta' => 1 ]
)
);
}
// Check name.
if ( empty( $_POST[ 'name' ] ) ) {
wp_send_json(
[
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'ajax_error' ) )
]
);
}
// Fix redirects after plugin installation.
if ( $_POST[ 'name' ] === 'redirect' ) {
wp_send_json(
[
'status' => '200',
'message' => esc_html( Codevz_Core_Strings::get( 'redirected' ) )
]
);
}
// Vars.
$data = [];
$name = isset( $_POST[ 'name' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'name' ] ) ) : '';
$type = isset( $_POST[ 'type' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'type' ] ) ) : '';
$demo = isset( $_POST[ 'demo' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'demo' ] ) ) : '';
// Deactivate some plugins.
if ( function_exists( 'elementor_pro_load_plugin' ) ) {
deactivate_plugins( 'elementor-pro/elementor-pro.php' );
}
// Install & activate plugin.
if ( $type === 'plugin' ) {
$data = $this->install_plugin( $name );
if ( is_string( $data ) ) {
$data = [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'find_plugin', $name ) )
];
}
// Download demo files.
} else if ( $type === 'download' ) {
// Check codevz plus.
if ( ! class_exists( 'Codevz_Demo_Importer' ) ) {
wp_send_json(
[
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'cp_error' ) )
]
);
}
$folder = isset( $_POST[ 'folder' ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'folder' ] ) ) : '';
$data = Codevz_Demo_Importer::download( $demo, $folder );
// Import demo data.
} else if ( $type === 'import' ) {
$data = Codevz_Demo_Importer::import_process(
[
'demo' => $demo,
'features' => [ $name ],
'posts' => empty( $_POST[ 'posts' ] ) ? 1 : sanitize_text_field( wp_unslash( $_POST[ 'posts' ] ) )
]
);
// Uninstall demo data.
} else if ( $type === 'uninstall' ) {
$data = $this->uninstall_demo( $demo );
} else {
$data = [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'occured' ) )
];
}
wp_send_json( $data );
}
/**
* Plugin installation and activation process.
*
* @return array
*/
protected function install_plugin( $plugin = '' ) {
// Plugin slug.
$slug = esc_html( urldecode( $plugin ) );
// Check plugin inside plugins.
if ( ! isset( $this->plugins[ $slug ] ) ) {
return [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'listed', $slug ) )
];
}
// Pass necessary information via URL if WP_Filesystem is needed.
$url = wp_nonce_url(
add_query_arg(
array(
'plugin' => urlencode( $slug )
),
admin_url( 'admin-ajax.php' )
),
'xtra-wizard',
'nonce'
);
if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), '', false, false, [] ) ) ) {
return [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'ftp' ) )
];
}
// Prep variables for Plugin_Installer_Skin class.
if ( isset( $this->plugins[ $slug ][ 'source' ] ) ) {
$api = null;
$source = $this->plugins[ $slug ][ 'source' ];
} else {
$api = $this->plugins_api( $slug );
if ( is_string( $api ) ) {
return [
'status' => '202',
'message' => wp_kses_post( Codevz_Core_Strings::get( 'wp_api' ) . ' ' . $api )
];
}
$source = isset( $api->download_link ) ? $api->download_link : '';
}
// Check ZIP file.
if ( ! $source ) {
return [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'manually', $slug ) )
];
}
$url = add_query_arg(
array(
'plugin' => urlencode( $slug )
),
'update.php'
);
if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
}
$skin_args = array(
'type' => 'web',
'title' => $this->plugins[ $slug ]['name'],
'url' => esc_url_raw( $url ),
'nonce' => 'xtra-wizard',
'plugin' => '',
'api' => $source ? null : $api,
'extra' => [ 'slug' => $slug ]
);
$skin = new Plugin_Installer_Skin( $skin_args );
// Create a new instance of Plugin_Upgrader.
$upgrader = new Plugin_Upgrader( $skin );
// File path.
$file = $this->plugin_file( $slug, true );
// FIX: Check if file is not exist but folder exist.
$folder = dirname( $file );
if ( ! file_exists( $file ) && is_dir( $folder ) ) {
rename( $folder, $folder . '_backup_' . rand( 111, 999 ) );
}
// Install plugin.
if ( ! file_exists( $file ) ) {
$upgrader->install( $source );
}
// Install plugin manually.
if ( ! file_exists( $file ) ) {
$plugin_dir = dirname( $file );
// Final check if plugin installed?
if ( ! file_exists( $file ) || is_dir( $plugin_dir ) ) {
return [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( '300s', $slug ) )
];
}
}
if ( ! $this->plugin_is_active( $slug ) ) {
// Activate plugin.
$activate = activate_plugin( $this->plugin_file( $slug ) );
// Check activation error.
if ( is_wp_error( $activate ) ) {
return [
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'plugin_error' ) ) . $activate->get_error_message()
];
}
}
return [
'status' => '200',
'message' => esc_html( Codevz_Core_Strings::get( 'plugin_installed', $slug ) )
];
}
/**
* Try to grab information from WordPress API.
*
* @param string $slug Plugin slug.
* @return object Plugins_api response object on success, WP_Error on failure.
*/
protected function plugins_api( $slug ) {
static $api = [];
if ( ! isset( $api[ $slug ] ) ) {
if ( ! function_exists( 'plugins_api' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
}
$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
$api[ $slug ] = false;
if ( is_wp_error( $response ) ) {
return esc_html( Codevz_Core_Strings::get( 'plugin_api' ) ) . ' ' . $response->get_error_message();
} else {
$api[ $slug ] = $response;
}
}
return $api[ $slug ];
}
/**
* Check if plugin is active with file_exists function.
*
* @param string $slug Plugin slug.
* @return bool
*/
private function plugin_file( $slug, $full_path = false ) {
if ( $slug === 'contact-form-7' ) {
$file = 'wp-contact-form-7';
} else {
$file = $slug;
}
return $full_path ? WP_PLUGIN_DIR . '/' . $slug . '/' . $file . '.php' : $slug . '/' . $file . '.php';
}
/**
* Check if plugin is active with file_exists function.
*
* @param string $slug Plugin slug.
* @return bool
*/
private function plugin_is_active( $slug ) {
if ( isset( $this->plugins[ $slug ][ 'class_exists' ] ) && class_exists( $this->plugins[ $slug ][ 'class_exists' ] ) ) {
return true;
} else if ( isset( $this->plugins[ $slug ][ 'function_exists' ] ) && function_exists( $this->plugins[ $slug ][ 'function_exists' ] ) ) {
return true;
}
return false;
}
/**
* Retrieves the attachment ID from the file URL
*
* @return array
*/
private function get_attachment_id_by_url( $url ) {
global $wpdb;
$attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid = %s;", esc_url( $url ) ) );
return isset( $attachment[ 0 ] ) ? $attachment[ 0 ] : false;
}
/**
* Uninstall imported demo data.
*
* @return array
*/
private function uninstall_demo( $demo ) {
$data = get_option( 'xtra_uninstall_' . $demo );
if ( is_array( $data ) ) {
foreach( $data as $type => $items ) {
switch( $type ) {
case 'options':
delete_option( 'codevz_theme_options' );
break;
case 'posts':
// Delete posts.
foreach( $items as $item ) {
if ( ! empty( $item[ 'id' ] ) && sanitize_title_with_dashes( get_the_title( $item[ 'id' ] ) ) === sanitize_title_with_dashes( $item[ 'title' ] ) ) {
wp_delete_post( $item[ 'id' ], true );
}
}
break;
case 'attachments':
foreach( $items as $item ) {
if ( ! empty( $item[ 'id' ] ) && sanitize_title_with_dashes( get_the_title( $item[ 'id' ] ) ) === sanitize_title_with_dashes( $item[ 'title' ] ) ) {
wp_delete_attachment( $item[ 'id' ], true );
}
}
break;
case 'terms':
foreach( $items as $item ) {
if ( ! empty( $item[ 'id' ] ) ) {
wp_delete_term( $item[ 'id' ], $item[ 'taxonomy' ] );
}
}
break;
case 'sliders':
if ( class_exists( 'RevSliderSlider' ) ) {
foreach( $items as $item ) {
$slider = new RevSliderSlider();
$slider->init_by_id( $item[ 0 ] );
$slider->delete_slider();
}
}
break;
}
}
delete_option( 'xtra_uninstall_' . $demo );
// Reset colors.
delete_option( 'codevz_primary_color' );
delete_option( 'codevz_secondary_color' );
// Reset widgets.
update_option( 'sidebars_widgets', [] );
// Success.
wp_send_json(
[
'status' => '200',
'message' => esc_html( Codevz_Core_Strings::get( 'demo_uninstalled', $demo ) )
]
);
} else {
wp_send_json(
[
'status' => '202',
'message' => esc_html( Codevz_Core_Strings::get( 'uninstall_error', $demo ) )
]
);
}
}
}
// Run dashboard.
Codevz_Core_Dashboard::instance();
}
Gmedia Albums - Seite 2 von 5 - Lotus-Fassaden GmbH #branda-cookie-notice .cookie-notice-container {padding:5px !important;} #ub-cn-notice-text * {font-style: normal !important;} #ub-cn-notice-text {display: inline-block !important;}#branda-cookie-notice .button {background-color: #fff !important;color: #343434;border-radius: 3px; display:initial !important;}#branda-cookie-notice .button:hover {color: #343434;}Diese Website verwendet Cookies. Mit einem Klick auf OK stimmen Sie der Benutzung von Cookies zu. Mehr erfahren
OK