Файловый менеджер - Редактировать - /home/avadvi5/public_html/wp-content/plugins/code4rest-pro/class-code4rest-theme-pro.php
Ðазад
<?php /** * Main plugin class */ final class Code4rest_Theme_Pro { /** * Instance Control * * @var null */ private static $instance = null; /** * Main Code4rest_Theme_Pro Instance. * * Insures that only one instance of Code4rest_Theme_Pro exists in memory at any one * time. Also prevents needing to define globals all over the place. * * @static * @staticvar array $instance * * @param string $file Main plugin file path. * * @return Code4rest_Theme_Pro The one true Code4rest_Theme_Pro */ public static function instance( $file = '' ) { // Return if already instantiated. if ( self::is_instantiated() ) { return self::$instance; } // Setup the singleton. self::setup_instance( $file ); // Bootstrap. self::$instance->setup_constants(); self::$instance->setup_files(); // Return the instance. return self::$instance; } /** * Throw error on object clone. * * The whole idea of the singleton design pattern is that there is a single * object therefore, we don't want the object to be cloned. * * @return void */ public function __clone() { // Cloning instances of the class is forbidden. _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'code4rest-pro' ), '1.0' ); } /** * Disable un-serializing of the class. * * @return void */ public function __wakeup() { // Unserializing instances of the class is forbidden. _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'code4rest-pro' ), '1.0' ); } /** * Return whether the main loading class has been instantiated or not. * * @access private * @since 3.0 * @return boolean True if instantiated. False if not. */ private static function is_instantiated() { // Return true if instance is correct class. if ( ! empty( self::$instance ) && ( self::$instance instanceof Code4rest_Theme_Pro ) ) { return true; } // Return false if not instantiated correctly. return false; } /** * Setup the singleton instance * * @param string $file Path to main plugin file. * * @access private */ private static function setup_instance( $file = '' ) { self::$instance = new Code4rest_Theme_Pro(); self::$instance->file = $file; } /** * Setup plugin constants. * * @access private * @since 3.0 * @return void */ private function setup_constants() { if ( ! defined( 'KTP_VERSION' ) ) { define( 'KTP_VERSION', '1.0.9' ); } if ( ! defined( 'KTP_PLUGIN_FILE' ) ) { define( 'KTP_PLUGIN_FILE', $this->file ); } if ( ! defined( 'KTP_PATH' ) ) { define( 'KTP_PATH', realpath( plugin_dir_path( KTP_PLUGIN_FILE ) ) . DIRECTORY_SEPARATOR ); } if ( ! defined( 'KTP_URL' ) ) { define( 'KTP_URL', plugin_dir_url( KTP_PLUGIN_FILE ) ); } } /** * Include required files. * * @access private * @return void */ private function setup_files() { $this->include_files(); // Admin. if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { $this->include_admin(); } else { $this->include_frontend(); } } /** * On Load */ public function include_files() { require_once KTP_PATH . 'dist/elements/post-select-rest-controller.php'; add_action( 'rest_api_init', array( $this, 'register_api_endpoints' ) ); $enabled = json_decode( get_option( 'code4rest_pro_theme_config' ), true ); if ( isset( $enabled ) && isset( $enabled['conditional_headers'] ) && true === $enabled['conditional_headers'] ) { require_once KTP_PATH . 'dist/conditional-headers.php'; } if ( isset( $enabled ) && isset( $enabled['elements'] ) && true === $enabled['elements'] ) { require_once KTP_PATH . 'dist/elements/duplicate-elements.php'; require_once KTP_PATH . 'dist/elements/elements-init.php'; } if ( isset( $enabled ) && isset( $enabled['header_addons'] ) && true === $enabled['header_addons'] ) { require_once KTP_PATH . 'dist/header-addons.php'; } if ( isset( $enabled ) && isset( $enabled['mega_menu'] ) && true === $enabled['mega_menu'] ) { require_once KTP_PATH . 'dist/mega-menu/mega-menu.php'; } if ( class_exists( 'woocommerce' ) && isset( $enabled ) && isset( $enabled['woocommerce_addons'] ) && true === $enabled['woocommerce_addons'] ) { require_once KTP_PATH . 'dist/woocommerce-addons.php'; } if ( isset( $enabled ) && isset( $enabled['scripts'] ) && true === $enabled['scripts'] ) { require_once KTP_PATH . 'dist/scripts-addon.php'; } if ( isset( $enabled ) && isset( $enabled['infinite'] ) && true === $enabled['infinite'] ) { require_once KTP_PATH . 'dist/infinite-scroll.php'; } if ( isset( $enabled ) && isset( $enabled['localgravatars'] ) && true === $enabled['localgravatars'] ) { require_once KTP_PATH . 'dist/local-gravatars.php'; } if ( isset( $enabled ) && isset( $enabled['archive_meta'] ) && true === $enabled['archive_meta'] ) { require_once KTP_PATH . 'dist/archive-meta.php'; } if ( isset( $enabled ) && isset( $enabled['dark_mode'] ) && true === $enabled['dark_mode'] ) { require_once KTP_PATH . 'dist/dark-mode.php'; } } /** * On Load */ public function include_admin() { // if ( ! class_exists( 'Code4rest/Theme' ) ) { // add_action( 'admin_notices', array( $this, 'admin_notice_need_code4rest_theme' ) ); // } add_action( 'admin_enqueue_scripts', array( $this, 'basic_css_menu_support' ) ); } /** * Add a little css for submenu items. */ public function basic_css_menu_support() { wp_register_style( 'code4rest-pro-admin', false ); wp_enqueue_style( 'code4rest-pro-admin' ); $css = '#menu-appearance .wp-submenu a[href^="themes.php?page=code4rest-"]:before, #menu-appearance .wp-submenu a[href^="edit.php?post_type=code4rest_element"]:before, #menu-appearance .wp-submenu a[href^="edit.php?post_type=kt_font"]:before {content: "\21B3";margin-right: 0.5em;opacity: 0.5;}'; wp_add_inline_style( 'code4rest-pro-admin', $css ); } /** * On Load */ public function include_frontend() { add_shortcode( 'code4rest_breadcrumbs', array( $this, 'output_code4rest_breadcrumbs' ) ); } /** * On Load */ public function output_code4rest_breadcrumbs( $atts ) { $args = shortcode_atts( array( 'show_title' => true, ), $atts ); $output = ''; if ( function_exists( 'Code4rest\code4rest' ) ) { ob_start(); Code4rest\code4rest()->print_breadcrumb( $args ); $output = ob_get_clean(); } return $output; } /** * Admin Notice */ public function admin_notice_need_code4rest_theme() { if ( get_transient( 'code4rest_theme_pro_free_theme_notice' ) || ! current_user_can( 'manage_options' ) ) { return; } echo '<div class="notice notice-error is-dismissible kt-blocks-pro-notice-wrapper">'; // translators: %s is a link to code4rest theme. echo '<p>' . sprintf( esc_html__( 'Code4rest Theme Pro requires the %s to be active for it to work.', 'code4rest-pro' ) . '</p>', '<a target="_blank" href="https://code4restwp.com/code4rest-theme/">Code4rest Theme</a>' ); echo '</div>'; } /** * Setup the post select API endpoint. * * @return void */ public function register_api_endpoints() { $controller = new Code4rest_Pro\Post_Select_Controller(); $controller->register_routes(); } } /** * Function to get main class instance. */ function code4rest_theme_pro() { return Code4rest_Theme_Pro::instance(); }
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка