Файловый менеджер - Редактировать - /home/digitalm/invisalign/wp-content/themes/healthy-smiles/admin/installer/importer/cptui.php
Назад
<?php namespace HealthySmilesSpace\Admin\Installer\Importer; use HealthySmilesSpace\Admin\Installer\Importer\Importer_Base; use HealthySmilesSpace\Core\Utils\API_Requests; use HealthySmilesSpace\Core\Utils\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * CPTUI handler class is responsible for different methods on importing "Custom Post Type UI" plugin options. * * @since 1.0.0 */ class CPTUI extends Importer_Base { /** * Post types options. * * @since 1.0.0 */ protected $post_types_options = array(); /** * Taxonomies options. * * @since 1.0.0 */ protected $tax_options = array(); /** * Activation status. * * @since 1.0.0 * * @return bool Activation status. */ public static function activation_status() { return function_exists( 'cptui_import_types_taxes_settings' ); } /** * Get import status. * * @since 1.0.0 * * @param string $default Import status by default, may be pending or done. * * @return string Import status. */ public static function get_import_status( $default = 'done' ) { return get_option( 'cmsmasters_healthy-smiles_cptui_import', $default ); } /** * Set import status. * * @since 1.0.0 * * @param string $status Import status, may be pending or done. */ public static function set_import_status( $status = 'pending' ) { update_option( 'cmsmasters_healthy-smiles_cptui_import', $status ); } /** * Set exists options. * * @since 1.0.0 */ protected function set_exists_options() { $demo = Utils::get_demo(); $this->post_types_options = get_option( "cmsmasters_healthy-smiles_{$demo}_cptui_post_types", array() ); $this->tax_options = get_option( "cmsmasters_healthy-smiles_{$demo}_cptui_taxonomies", array() ); } /** * Set options from API. * * @since 1.0.0 */ protected function set_api_options() { if ( ! empty( $this->post_types_options ) || ! empty( $this->tax_options ) ) { return; } $response = API_Requests::post_request( 'get-cptui-settings', array( 'demo' => Utils::get_demo() ) ); $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $response_code ) { return; } $response_body = json_decode( wp_remote_retrieve_body( $response ), true ); $data = $response_body['data']; if ( isset( $data['post_import'] ) && '' !== $data['post_import'] ) { $post_types_data = stripslashes_deep( trim( $data['post_import'] ) ); $post_types_data = json_decode( $post_types_data, true ); if ( is_array( $post_types_data ) ) { $this->post_types_options = $post_types_data; } } if ( isset( $data['tax_import'] ) && '' !== $data['tax_import'] ) { $tax_data = stripslashes_deep( trim( $data['tax_import'] ) ); $tax_data = json_decode( $tax_data, true ); if ( is_array( $tax_data ) ) { $this->tax_options = $tax_data; } } } /** * Import options. * * @since 1.0.0 */ protected function import_options() { if ( empty( $this->post_types_options ) && empty( $this->tax_options ) ) { return; } update_option( 'cptui_post_types', $this->post_types_options ); update_option( 'cptui_taxonomies', $this->tax_options ); set_transient( 'cptui_flush_rewrite_rules', 'true', 5 * 60 ); } /** * Backup current options. * * @since 1.0.0 * * @param bool $first_install First install trigger, if need to backup customer option from previous theme. */ public static function set_backup_options( $first_install = false ) { if ( ! self::activation_status() ) { return; } $post_types_options = get_option( 'cptui_post_types', array() ); $tax_options = get_option( 'cptui_taxonomies', array() ); $demo = Utils::get_demo(); $post_types_option_name = "cmsmasters_healthy-smiles_{$demo}_cptui_post_types"; $tax_option_name = "cmsmasters_healthy-smiles_{$demo}_cptui_taxonomies"; if ( $first_install ) { $post_types_option_name = 'cmsmasters_healthy-smiles_cptui_post_types_backup'; $tax_option_name = 'cmsmasters_healthy-smiles_cptui_taxonomies_backup'; } update_option( $post_types_option_name, $post_types_options ); update_option( $tax_option_name, $tax_options ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Генерация страницы: 0.03 |
proxy
|
phpinfo
|
Настройка