PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/live2news.com/wp-content/plugins/zeus-gpt/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/live2news.com/wp-content/plugins/zeus-gpt/class-zeusgpt.php |
<?php /** * Plugin main file * * @package zeus-gpt */ /** * ZeusGPT */ class ZeusGPT { /** * Constructor * * @return void */ public function __construct() { $this->register_front_end(); $this->register_services(); $this->register_db_option(); // kses allowed html. add_filter( 'wp_kses_allowed_html', array( $this, 'kses_allowed_html' ), 10, 2 ); } /** * Register front end hooks * * @return void */ public function register_front_end() { add_action( 'admin_menu', array( $this, 'register_admin_pages' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_static' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_public_static' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_public_static' ) ); } /** * Register the admin pages * * @return void */ public function register_admin_pages() { add_menu_page( esc_html__( 'ZeusGPT', 'zeus-gpt' ), esc_html__( 'ZeusGPT', 'zeus-gpt' ), 'manage_options', 'gfx-zeus-gpt', array( $this, 'render_admin_page' ), 'data:image/svg+xml;base64,PHN2ZyB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMjQ4IDExMiAyMDQgNDc2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9InJnYmEoMjQwLDI0NiwyNTIsLjYpIj4NCjxwYXRoIGQ9Ik00NDcuMDU3LDExMy42ODVjLTMuOTYxLTIuMjM0LTguOTctMS4yNjYtMTEuODM3LDIuMjc3TDI4Ny4yNCwyOTkuNTEyYy0yLjI1OCwyLjc5Ny0yLjcwNyw2LjY0MS0xLjE1Niw5Ljg4Mw0KCWMxLjU1MSwzLjI0Niw0LjgyNCw1LjMwOSw4LjQxOCw1LjMwOWgzNC43ODVsLTc0LjA3NCwxMTcuNzI5Yy0xLjgxMywyLjg3OS0xLjkxNCw2LjUwOC0wLjI3LDkuNDhzNC43NzMsNC44Miw4LjE2OCw0LjgyaDQwLjc2Mg0KCWwtNTQuOTQxLDEyNy43NmMtMS44NCw0LjI3My0wLjI1LDkuMjQ2LDMuNzIzLDExLjY2YzEuNTA4LDAuOTE4LDMuMTg0LDEuMzU5LDQuODQ4LDEuMzU5YzIuNzE1LDAsNS4zOTUtMS4xODQsNy4yMjMtMy40MQ0KCWwxNTkuMi0xOTQuMDFjMi4yODktMi43OTMsMi43NjYtNi42NTIsMS4yMjctOS45MTRjLTEuNTQzLTMuMjYyLTQuODMyLTUuMzQtOC40NDEtNS4zNGgtMzEuNDc4bDYwLjcyNC05OC4zNjMNCgljMS43ODEtMi44NzksMS44NTktNi40OTYsMC4yMDctOS40NTNjLTEuNjQ4LTIuOTUzLTQuNzY2LTQuNzg1LTguMTQ4LTQuNzg1aC0zNi4wNmw0OS4zMi0xMzcuMjUNCgljMS41NDMtNC4yODktMC4yMzQtOS4wNjMtNC4yMTEtMTEuMjkzTDQ0Ny4wNTcsMTEzLjY4NXoiLz4NCjwvc3ZnPg0K', 99 ); } /** * Render the admin page. * * @return void */ public function render_admin_page() { require_once ZEUS_GPT_PLUGIN_DIR . '/inc/templates/main.php'; } /** * Enqueue admin static files * * @return void */ public function enqueue_admin_static() { wp_register_style( 'outfit', $this->fonts_url( 'Outfit:wght@400;500;600' ), null, '1.0.0' ); wp_enqueue_style( 'colorjoe', ZEUS_GPT_PLUGIN_URL . 'static/css/lib/colorjoe.css', null, '4.2.0' ); wp_enqueue_style( 'toastify', ZEUS_GPT_PLUGIN_URL . 'static/css/lib/toastify.min.css', null, '1.12.0' ); wp_enqueue_style( 'gfx-zeus-main', ZEUS_GPT_PLUGIN_URL . 'static/css/style.css', null, '1.0.0' ); wp_enqueue_script( 'colorjoe', ZEUS_GPT_PLUGIN_URL . 'static/js/lib/colorjoe.min.js', null, '4.2.0', true ); wp_enqueue_script( 'toastify', ZEUS_GPT_PLUGIN_URL . 'static/js/lib/toastify.min.js', null, '1.12.0', true ); wp_enqueue_script( 'gfx-zeus-main', ZEUS_GPT_PLUGIN_URL . 'static/js/main.min.js', array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-hooks', 'wp-compose' ), '1.0.0', true ); wp_localize_script( 'gfx-zeus-main', 'GFXZEUSOBJ', array( 'ajax-url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'api-input' ), ) ); } /** * Enqueue public static files * * @return void */ public function enqueue_public_static() { wp_register_style( 'space-grotesk', $this->fonts_url( 'Space+Grotesk:400,500,600' ), null, '1.0.0' ); wp_register_style( 'gfx-zeus-main-public', ZEUS_GPT_PLUGIN_URL . 'static/css/public.css', null, '1.0.0' ); wp_register_script( 'gfx-zeus-main-public', ZEUS_GPT_PLUGIN_URL . 'static/js/public.min.js', null, '1.0.0', true ); wp_localize_script( 'gfx-zeus-main-public', 'GFXZEUSOBJPUBLIC', array( 'ajax-url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'api-input' ), ) ); if ( ! is_admin() ) { global $post; if ( ! has_block( 'zeusgpt/chat-block', $post ) && ! has_shortcode( $post->post_content, 'zeusgpt' ) ) { return; } } wp_enqueue_style( 'space-grotesk' ); wp_enqueue_style( 'gfx-zeus-main-public' ); wp_enqueue_script( 'gfx-zeus-main-public' ); } /** * Registers the services * * @return void */ public function register_services() { require_once ZEUS_GPT_PLUGIN_DIR . '/inc/services/class-zeusgptajax.php'; require_once ZEUS_GPT_PLUGIN_DIR . '/inc/services/class-zeusgptcustomizer.php'; require_once ZEUS_GPT_PLUGIN_DIR . '/inc/services/class-zeusgptratelimiter.php'; require_once ZEUS_GPT_PLUGIN_DIR . '/inc/services/class-zeusgptchatlog.php'; require_once ZEUS_GPT_PLUGIN_DIR . '/inc/services/class-zeusgptchatlogdb.php'; require_once ZEUS_GPT_PLUGIN_DIR . '/inc/interface/class-zeusgptinterface.php'; new ZeusGPTAJAX(); new ZeusGPTCustomizer(); new ZeusGPTRateLimiter(); new ZeusGPTInterface(); new ZeusGPTChatLogDB(); new ZeusGPTChatLog(); } /** * Generates URL for the google fonts * * @param string $family - font family. * @return string */ private function fonts_url( $family ) { $fonts_url = ''; $font = ''; $subsets = 'latin,latin-ext'; /* translators: If there are characters in your language that are not supported by Spartan, translate this to 'off'. Do not translate into your own language. */ $font = $family . '&display=swap'; if ( $font ) { $fonts_url = add_query_arg( array( 'family' => $font, 'subset' => $subsets, ), '//fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } /** * Kses_allowed_html * * @param mixed $tags - array of HTML tags. * @param mixed $context - context in which wp_kses is used. * @return array */ public function kses_allowed_html( $tags, $context ) { switch ( $context ) { case 'general': $tags = wp_kses_allowed_html( 'post' ); return $tags; case 'zeusgpt-icon': $tags = wp_kses_allowed_html( 'post' ); $tags = array_merge( $tags, array( 'style' => array(), 'script' => array( 'src' => true, ), 'svg' => array( 'fill' => true, 'height' => true, 'width' => true, 'xmlns' => true, 'viewbox' => true, 'class' => true, 'transform' => true, ), 'g' => array( 'fill' => true, 'transform-origin' => true, 'class' => true, ), 'title' => array( 'title' => true ), 'path' => array( 'class' => true, 'd' => true, 'id' => true, 'fill' => true, 'opacity' => true, 'fill-opacity' => true, 'style' => true, 'stroke' => true, 'stroke-width' => true, 'transform' => true, ), 'lineargradient' => array( 'id' => true, 'gradientUnits' => true, 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, ), 'stop' => array( 'class' => true, 'offset' => true, 'style' => true, 'stop-color' => true, 'stop-opacity' => true, ), 'image' => array( 'href' => true, 'x' => true, 'y' => true, 'width' => true, 'height' => true, ), 'defs' => array(), 'mask' => array( 'id' => true, 'x' => true, 'y' => true, 'width' => true, 'height' => true, ), 'rect' => array( 'x' => true, 'y' => true, 'width' => true, 'height' => true, ), 'text' => array( 'class' => true, 'dominant-baseline' => true, 'text-anchor' => true, 'x' => true, 'y' => true, ), 'tspan' => array( 'class' => true, ), ) ); return $tags; default: return $tags; } } /** * Adds the DB version to the options table. * * @return void */ private function register_db_option() { add_option( 'zeusgpt_db_version', '1.0.0' ); } }