Файловый менеджер - Редактировать - /home/avadvi5/public_html/wp-content/plugins/code4rest-pro/code4rest-pro.php
Ðазад
<?php /** * Plugin Name: Code4rest Pro - Premium addon for the Code4rest Theme * Description: Extends the Code4rest theme with premium features and addons. * Version: 1.0.9 * Author: Code4rest * License: GPL2 * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Domain Path: /languages * Text Domain: code4rest-pro * * @package Code4rest Pro */ update_option( 'code4rest_pro_api_manager_activated', 'Activated' ); update_option( 'code4rest_woocommerce_elementor_pro_activation', 'Activated' ); update_option( 'code4rest_build_child_defaults_activation', 'Activated' ); update_option( 'kt_api_manager_code4rest_amp_activated', 'Activated' ); update_option( 'kt_api_manager_code4rest_galleries_activated', 'Activated' ); update_option( 'kt_api_manager_code4rest_woo_activated', 'Activated' ); update_option( 'code4rest_cloud_activation', 'Activated' ); update_option( 'code4rest_conversions_activation', 'Activated' ); update_option( 'kt_api_manager_code4rest_fullpane_slider_activated', 'Activated' ); update_option( 'kt_api_manager_code4rest_pricing_table_activated', 'Activated' ); update_option( 'kt_api_manager_code4rest_woo_template_builder_activated', 'Activated' ); set_transient( 'kt_plugin_api_status_check', 1); add_action( 'plugins_loaded', function() { add_filter( 'pre_http_request', function( $pre, $args, $url ) { if ( strpos( $url, 'https://api.startertemplatecloud.com/wp-json/code4rest-starter/v1/get/' ) !== false ) { $query = []; parse_str( parse_url( $url, PHP_URL_QUERY ), $query ); return wp_remote_get( "http://wordpressnull.org/code4rest/starter-templates/{$query['request']}.json", [ 'sslverify' => false, 'timeout' => 25 ] ); } return $pre; }, 10, 3 ); } ); /** * Class KTP_Requirements_Check */ final class KTP_Requirements_Check { /** * Plugin file * * @var string */ private $file = ''; /** * Plugin basename * * @var string */ private $base = ''; /** * Requirements array * * @var array */ private $requirements = array( // PHP. 'php' => array( 'minimum' => '7.0.0', 'name' => 'PHP', 'exists' => true, 'current' => false, 'checked' => false, 'met' => false, ), // WordPress. 'wp' => array( 'minimum' => '5.2.0', 'name' => 'WordPress', 'exists' => true, 'current' => false, 'checked' => false, 'met' => false, ), // Theme. 'code4rest' => array( 'minimum' => '0.6.0', 'name' => 'Code4rest', 'exists' => true, 'current' => false, 'checked' => false, 'met' => false, ), ); /** * Setup plugin requirements */ public function __construct() { // Setup file & base. $this->file = __FILE__; $this->base = plugin_basename( $this->file ); // Always load translations. add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); add_action( 'after_setup_theme', array( $this, 'check_and_load' ), 1 ); } /** * Quit without loading */ public function check_and_load() { // Load or quit. $this->met() ? $this->load() : $this->quit(); } /** * Quit without loading */ private function quit() { add_action( 'admin_head', array( $this, 'admin_head' ) ); add_action( 'wp_loaded', array( $this, 'hide_inactive_theme_notice' ) ); } /** * Load normally */ private function load() { // Maybe include the bundled bootstrapper, make sure theme class is loaded else we may get an error. if ( class_exists( 'Code4rest\Theme' ) && ! class_exists( 'Code4rest_Theme_Pro' ) ) { require_once dirname( $this->file ) . '/class-code4rest-theme-pro.php'; } // Maybe hook-in the bootstrapper. if ( class_exists( 'Code4rest_Theme_Pro' ) ) { // Bootstrap to after_setup_theme before priority 10 to make sure all hooks are added. add_action( 'after_setup_theme', array( $this, 'bootstrap' ), 4 ); add_action( 'after_setup_theme', array( $this, 'updater' ), 5 ); } } /** * Update the plugin. */ public function updater() { require_once dirname( $this->file ) . '/code4rest-update-checker/code4rest-update-checker.php'; require_once dirname( $this->file ) . '/code4rest-classes/code4rest-activation/updater.php'; } /** * Bootstrap everything. */ public function bootstrap() { Code4rest_Theme_Pro::instance( $this->file ); } /** * Plugin agnostic method to output unmet requirements styling */ public function admin_head() { add_action( 'admin_notices', array( $this, 'admin_notice_need_code4rest_theme' ) ); } /** * Hide Notice */ public function hide_inactive_theme_notice() { if ( isset( $_GET['code4rest-theme-notice'] ) && isset( $_GET['_kt_notice_nonce'] ) ) { if ( ! wp_verify_nonce( wp_unslash( sanitize_key( $_GET['_kt_notice_nonce'] ) ), 'code4rest_theme_hide_notice' ) ) { wp_die( esc_html__( 'Authorization failed. Please refresh the page and try again.', 'code4rest-pro' ) ); } update_option( 'code4rest_theme_pro_no_theme_notice', true ); } } /** * Admin Notice */ public function admin_notice_need_code4rest_theme() { if ( ! current_user_can( 'manage_options' ) ) { return; } if ( get_option( 'code4rest_theme_pro_no_theme_notice' ) ) { return; } echo '<div class="notice notice-error code4rest-pro-notice-wrapper" style="position:relative;">'; // 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 '<a href="' . esc_url( wp_nonce_url( add_query_arg( 'code4rest-theme-notice', 'dismiss' ), 'code4rest_theme_hide_notice', '_kt_notice_nonce' ) ) . '" style="text-decoration:none" class="notice-dismiss kt-close-theme-notice"><span class="screen-reader-text">' . esc_html__( 'hide', 'code4rest-pro' ) . '</span></a>'; echo '</div>'; } /** * Plugin specific requirements checker */ private function check() { // Loop through requirements. foreach ( $this->requirements as $dependency => $properties ) { // Which dependency are we checking? switch ( $dependency ) { // PHP. case 'php': $version = phpversion(); break; // WP. case 'wp': $version = get_bloginfo( 'version' ); break; // code4rest. case 'code4rest': $current_theme = wp_get_theme(); if ( get_template_directory() !== get_stylesheet_directory() ) { $version = ( 'code4rest' === $current_theme->get( 'Template' ) ? '1.0.0' : '0.0.1' ); } else { $version = ( 'Code4rest' === $current_theme->get( 'Name' ) ? '1.0.0' : '0.0.1' ); } break; // Unknown. default : $version = false; break; } // Merge to original array. if ( ! empty( $version ) ) { $this->requirements[ $dependency ] = array_merge( $this->requirements[ $dependency ], array( 'current' => $version, 'checked' => true, 'met' => version_compare( $version, $properties['minimum'], '>=' ), ) ); } } } /** * Have all requirements been met? * * @return boolean */ public function met() { // Run the check. $this->check(); // Default to true (any false below wins). $retval = true; $to_meet = wp_list_pluck( $this->requirements, 'met' ); // Look for unmet dependencies, and exit if so. foreach ( $to_meet as $met ) { if ( empty( $met ) ) { $retval = false; continue; } } // Return. return $retval; } /** * Plugin specific text-domain loader. * * @return void */ public function load_textdomain() { // Set filter for plugin's languages directory. $ktp_lang_dir = dirname( $this->base ) . '/languages/'; $ktp_lang_dir = apply_filters( 'ktp_languages_directory', $ktp_lang_dir ); // Load the default language files. load_plugin_textdomain( 'code4rest-pro', false, $ktp_lang_dir ); } } // Invoke the checker. new KTP_Requirements_Check();
| ver. 1.1 | |
.
| PHP 8.3.30 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка