X7ROOT File Manager
Current Path:
/home/katmhsmi/public_html/wp-content/plugins/oxy-ninja/admin
home
/
katmhsmi
/
public_html
/
wp-content
/
plugins
/
oxy-ninja
/
admin
/
📁
..
📄
.htaccess
(420 B)
📄
class-conditions.php
(2.86 KB)
📄
class-helper-integration.php
(1.77 KB)
📄
class-oxy-ninja-admin.php
(15.87 KB)
📁
css
📁
icons
📄
index.php
(26 B)
📁
js
📁
svg
📁
view
Editing: class-oxy-ninja-admin.php
<?php /** * The admin-specific functionality of the plugin. * * @link https://oxyninja.com * @since 3.1.0 * * @package Oxy_Ninja * @subpackage Oxy_Ninja/admin */ /** * The admin-specific functionality of the plugin. * * Defines the plugin name, version, and hooks for enqueue * in the admin-specific stylesheet and JavaScript. * * @package Oxy_Ninja * @subpackage Oxy_Ninja/admin * @author OxyNinja <rados@oxyninja.com> */ class Oxy_Ninja_Admin { /** * The ID of this plugin. * * @since 3.1.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 3.1.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Initialize the class and set its properties. * * @since 3.1.0 * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; require_once OXYNINJA_MAIN . 'includes/class-oxy-ninja-activator.php'; } /** * Register the stylesheets for the admin area. * * @since 3.1.0 */ public function enqueue_styles() { wp_enqueue_style( $this->plugin_name, OXYNINJA_URI . '/css/oxy-ninja-admin.css', array(), $this->version, 'all' ); } /** * Register the JavaScript for the admin area. * * @since 3.1.0 */ public function enqueue_scripts() { $bkais = trim( get_option( base64_decode('b3h5bmluamFfbGljZW5zZV9zdGF0dXM='), false ) ); $core = get_option('oxygen_vsb_source_sites')['core']['accesskey'] ?? 0; $woocore = get_option('oxygen_vsb_source_sites')['woocore']['accesskey'] ?? 0; $otb = class_exists( 'OXY_Toolbox_Plugin_Updater' ) ? 'active' : FALSE; if (defined('SHOW_CT_BUILDER') && $bkais) { wp_enqueue_script( 'oxyNinjaKlazzy', OXYNINJA_URI . '/js/oxy-ninja-klazzy.js', [], $this->version, true ); wp_enqueue_script( 'axios', OXYNINJA_URI . '/js/axios/axios.min.js', [], "0.21.1", false ); wp_enqueue_script( 'sweetAlert2', OXYNINJA_URI . '/js/sweetalert2.all.min.js', [], "11.0.8", false ); wp_enqueue_script( 'oxyNinjaConnection', OXYNINJA_URI . '/js/oxy-ninja-connection.js', [], $this->version, true ); wp_enqueue_script( 'oxyNinjaAdmin', OXYNINJA_URI . '/js/oxy-ninja-admin.js', [], $this->version, true ); $oxyninja_storage = get_option( 'oxyninja_storage' ); wp_localize_script("oxyNinjaConnection", 'konnektor', [ 'core' => !empty($core) ? TRUE : FALSE, 'woocore' => !empty($woocore) ? TRUE : FALSE, 'lon' => get_option( base64_decode('b3h5bmluamFfbGljZW5zZV9zdGF0dXM=') ) === base64_decode('dmFsaWQ=') ? TRUE : FALSE, 'third' => get_option('oxygen_vsb_enable_3rdp_designsets') ? TRUE : FALSE, 'ajax_url' => admin_url('admin-ajax.php'), 'oxyNinjaFirstRun' => FALSE, 'oxyNinjaOnlyStyleSheets' => FALSE, 'otb' => $otb, 'stCL' => $oxyninja_storage['classlock'] ?: FALSE, 'stPaste' => $oxyninja_storage['pastebutton'] ?: FALSE, ]); } } /** * Register the JavaScript for the Oxygen Iframe area. * * @since 3.1.0 */ public function core_oxy_ninja_iframe() { $nasif = trim( get_option( base64_decode('b3h5bmluamFfbGljZW5zZV9zdGF0dXM='), false ) ); if (defined('SHOW_CT_BUILDER') && $nasif === base64_decode('dmFsaWQ=')) { wp_enqueue_script( 'oxyNinjaIframe', OXYNINJA_URI . '/js/oxy-ninja-iframe.js', [], $this->version, true ); $oxyninja_storage = get_option( 'oxyninja_storage', false ); if ($oxyninja_storage && $oxyninja_storage['slider']) { wp_enqueue_script('splide'); wp_enqueue_style('splide'); } } } /** * Add license isset and only when path is helpers ! * * Parts taken from Oxygen Builer * * @since 3.1.0 */ public static function ct_new_api_remote_get_on($source, $path, $licenses) { $args = [ 'headers' => [ 'oxygenclientversion' => '2.1+', 'eddlicense' => $licenses, ], 'timeout' => 15, ]; // figure out the access key $accessKey = ''; $site = ct_find_source_site_from_url($source); if (is_array($site)) { if (!isset($site['system']) || $site['system'] !== true) { $accessKey = md5($site['accesskey']); } else { $accessKey = false; } } if ($accessKey !== false) { $args['headers']['auth'] = $accessKey; } $result = wp_remote_request( $source . '/wp-json/oxygen-vsb-connection/v1/' . $path, $args ); $status = wp_remote_retrieve_response_code($result); if (is_wp_error($result)) { return json_encode([ 'error' => $result->get_error_message(), ]); die(); } elseif ($status !== 200) { return json_encode([ 'error' => wp_remote_retrieve_response_message($result), ]); die(); } if (is_array($result)) { return $result['body']; } return false; } /** * API Security Check * * Parts taken from Oxygen Builer * * @since 3.3.0 */ private function ct_ns_api_call_security_check($call_type) { $failure = false; $nonce = isset($_REQUEST['nonce']) ? $_REQUEST['nonce'] : false; $post_id = isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : false; if ($_REQUEST['nonce']) return false; if ($_REQUEST['post_id']) return false; // check nonce if ($call_type === 'oxyninja') { if ( ! wp_verify_nonce( $nonce, 'oxygen-nonce-' . $post_id ) ) { $failure = true; } } if ($call_type === 'lizzy' || $call_type === 'lizzy_remove') { if ( ! wp_verify_nonce( $nonce, 'oxyninja_lizzer_lizon' ) ) { $failure = true; } } if (!oxygen_vsb_current_user_can_access()) { $failure = true; } if($failure) { wp_send_json_error(); } } /** * Verify/Create different CTs * * Parts taken from Oxygen Builer * * @since 3.1.0 */ public function oxy_ninja_api_call() { $call_type = isset($_REQUEST['call_type']) ? sanitize_text_field($_REQUEST['call_type']) : false; $this->ct_ns_api_call_security_check($call_type); if ($call_type === 'oxyninja') { $this->ct_get_oxyninja_json(); } if ($call_type === 'lizzy') { $this->oxyninja_react_activate(); } if ($call_type === 'lizzy_remove') { $this->oxyninja_react_deactivate(); } if ($call_type === 'iconz_true') { $this->oxyninja_iconz_activate(); } if ($call_type === 'iconz_false') { $this->oxyninja_iconz_remove(); } die(); } /** * Get helpers from remote API * * @since 3.1.0 */ protected function ct_get_oxyninja_json() { global $ct_source_sites; $name = isset($_REQUEST['name']) ? sanitize_text_field($_REQUEST['name']) : false; $type = isset($_REQUEST['type']) ? sanitize_text_field($_REQUEST['type']) : false; $skvarkos = trim( get_option( base64_decode('b3h5bmluamFfbGljZW5zZV9rZXk=') ) ); if (isset($ct_source_sites[$name]) && !empty($type)) { $result = $this->ct_new_api_remote_get_on( $ct_source_sites[$name]['url'], $type . '/', $skvarkos ); echo $result; } die(); } /** * License Activation API * * @since 3.3.0 */ protected function oxyninja_react_activate() { $license = isset($_REQUEST['license']) ? sanitize_text_field($_REQUEST['license']) : false; $user = wp_get_current_user(); delete_transient('oxygen-token-check-user-' . $user->ID); update_option( 'oxyninja_license_key', trim( $license ), false ); // retrieve the license from the database $license = trim( get_option( 'oxyninja_license_key' ) ); // data to send in our API request $api_params = array( 'edd_action'=> 'activate_license', 'license' => $license, 'item_id' => OXYNINJA_ITEM_ID, 'url' => home_url() ); // Call the custom API. $response = wp_remote_get( add_query_arg( $api_params, 'https://oxyninja.com' ), array( 'timeout' => 30, 'sslverify' => true ) ); // make sure the response came back okay if ( is_wp_error( $response ) ) return false; // decode the license data $license_data = json_decode( wp_remote_retrieve_body( $response ) ); // if valid license update the hash if ( isset( $license_data->site_hash ) && $license_data->license == "valid" ) { update_option( 'oxyninja_license_site_hash', $license_data->site_hash, false ); } update_option( 'oxyninja_license_status', $license_data->license, false ); $ovss = get_option('oxygen_vsb_source_sites', false); $ds_c_ac = isset($ovss['core']) ? $ovss['core']['accesskey'] : '0'; $ds_wc_ac = isset($ovss['woocore']) ? $ovss['woocore']['accesskey'] : '0'; if(strlen($ds_c_ac) > 4){ Oxy_Ninja_Activator::oxyninja_icons_activate('OxyNinja Core', 'core'); } if(strlen($ds_wc_ac) > 4){ Oxy_Ninja_Activator::oxyninja_icons_activate('OxyNinja WooCore', 'woocore'); } die(); } /** * License Deactivation API * * @since 3.3.0 */ protected function oxyninja_react_deactivate() { // retrieve the license from the database $license = isset($_REQUEST['license']) ? sanitize_text_field($_REQUEST['license']) : trim( get_option( 'oxyninja_license_key' ) ); // data to send in our API request $api_params = array( 'edd_action'=> 'deactivate_license', 'license' => $license, 'item_id' => OXYNINJA_ITEM_ID, 'url' => home_url() ); // Call the custom API. $response = wp_remote_get( add_query_arg( $api_params, 'https://oxyninja.com' ), array( 'timeout' => 30, 'sslverify' => true ) ); // make sure the response came back okay if ( is_wp_error( $response ) ) return false; // decode the license data $license_data = json_decode( wp_remote_retrieve_body( $response ) ); delete_option('oxyninja_license_status'); delete_option('oxyninja_license_key'); Oxy_Ninja_Activator::oxyninja_icons_remove('OxyNinja Core'); Oxy_Ninja_Activator::oxyninja_icons_remove('OxyNinja WooCore'); wp_die(); } /** * Register the JavaScript for the settings area. * * @since 3.3.0 */ public function oxyninja_settings_assets() { if (!defined('CT_VERSION')) { return false; } wp_register_script( 'oxyninja-settings', OXYNINJA_URI . '/js/settings.js', array( 'wp-api', 'wp-i18n', 'wp-components', 'wp-element' ), $this->version, true ); wp_register_style( 'oxyninja-settings', OXYNINJA_URI . '/css/settings.css', array( 'wp-components' ), $this->version); $ovss = get_option('oxygen_vsb_source_sites', false); if (!$ovss) { wp_localize_script('oxyninja-settings', 'lizzo', array( 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce( 'oxyninja_lizzer_lizon' ), 'error' => 'Please Activate 3rd party design sets in Oxygen → Settings → Library', )); return false; } $ds_c_ac = isset($ovss['core']) ? $ovss['core']['accesskey'] : '0'; $ds_wc_ac = isset($ovss['woocore']) ? $ovss['woocore']['accesskey'] : '0'; $svg_sets = get_option('ct_svg_sets', []); $ics_c = '0'; $ics_wc = '0'; if (version_compare(CT_VERSION, '3.7.9', '<')) { if (isset($svg_sets['OxyNinja Core']) && strlen($ds_c_ac) > 4) $ics_c = '1'; if (isset($svg_sets['OxyNinja WooCore']) && strlen($ds_wc_ac) > 4) $ics_wc = '1'; } else { $svg_c = get_option('ct_svg_sets_OxyNinja Core 0', false); $svg_wc = get_option('ct_svg_sets_OxyNinja WooCore 0', false); if($svg_c && strlen($ds_c_ac) > 4) $ics_c = '1'; if($svg_wc && strlen($ds_wc_ac) > 4) $ics_wc = '1'; } $ds_c = '0'; $ds_wc = '0'; if(isset($ds_c_ac) && strlen($ds_c_ac) > 4) $ds_c = '1'; if(isset($ds_wc_ac) && strlen($ds_wc_ac) > 4) $ds_wc = '1'; wp_localize_script('oxyninja-settings', 'lizzo', array( 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce( 'oxyninja_lizzer_lizon' ), 'ds_c' => $ds_c, 'ds_wc' => $ds_wc, 'ics_c' => $ics_c, 'ics_wc' => $ics_wc, )); } /** * Notices * * @since 3.4.0 */ public function oxyninja_setup() { if (!is_admin()) return false; Oxy_Ninja_Activator::woocore_notices(); $oxyninja_storage = get_option( 'oxyninja_storage', false ); if (!$oxyninja_storage ) { $ds_c_ac = isset(get_option('oxygen_vsb_source_sites')['core']['accesskey']) ? get_option('oxygen_vsb_source_sites')['core']['accesskey'] : false; $ds_wc_ac = isset(get_option('oxygen_vsb_source_sites')['woocore']['accesskey']) ? get_option('oxygen_vsb_source_sites')['woocore']['accesskey'] : false; $opce = array( 'slider' => 1, 'id' => 0, 'badge' => 1, 'sizing_stylesheet' => 1, 'spacing_stylesheet' => 1, 'classlock' => 1, 'pastebutton' => 1, 'icons_core' => $ds_c_ac && strlen($ds_c_ac) > 4 ? 1 : 0, 'icons_woocore' => $ds_wc_ac && strlen($ds_wc_ac) > 4 ? 1 : 0, 'deleteOnDeactivate' => 0, ); update_option('oxyninja_storage', $opce, false ); } } /** * Iconz Activate from Settings * * @since 3.4.0 */ protected function oxyninja_iconz_activate() { $iconz_set = isset($_REQUEST['iconz_set']) ? sanitize_text_field($_REQUEST['iconz_set']) : false; $user = wp_get_current_user(); delete_transient('oxygen-token-check-user-' . $user->ID); // $oxyninja_storage = get_option( 'oxyninja_storage' ); if ($iconz_set == 'icons_core') { Oxy_Ninja_Activator::oxyninja_icons_activate('OxyNinja Core', 'core'); } elseif ($iconz_set == 'icons_woocore'){ Oxy_Ninja_Activator::oxyninja_icons_activate('OxyNinja WooCore', 'woocore'); } die(); } /** * Iconz Remove from Settings * * @since 3.4.0 */ protected function oxyninja_iconz_remove() { $iconz_set = isset($_REQUEST['iconz_set']) ? sanitize_text_field($_REQUEST['iconz_set']) : false; $user = wp_get_current_user(); delete_transient('oxygen-token-check-user-' . $user->ID); $oxyninja_storage = get_option( 'oxyninja_storage', false ); if ($oxyninja_storage && $iconz_set == 'icons_core') { Oxy_Ninja_Activator::oxyninja_icons_remove('OxyNinja Core'); $cstg = $oxyninja_storage; $cstg['icons_core'] = 0; update_option( 'oxyninja_storage', $cstg, false ); } elseif ($oxyninja_storage && $iconz_set == 'icons_woocore'){ Oxy_Ninja_Activator::oxyninja_icons_remove('OxyNinja WooCore'); $wcstg = $oxyninja_storage; $wcstg['icons_core'] = 0; update_option( 'oxyninja_storage', $wcstg, false ); } die(); } /** * Register the Options * * @since 3.3.0 */ public function oxyninja_register_options() { register_setting( 'oxyninja_settings', 'oxyninja_license_key', array( 'type' => 'string', 'show_in_rest' => true, ) ); register_setting( 'oxyninja_settings', 'oxyninja_license_status', array( 'type' => 'string', 'show_in_rest' => true, ) ); register_setting( 'oxyninja_settings', 'oxyninja_storage', array( 'show_in_rest' => array( 'schema' => array( 'type' => 'object', 'properties' => array( 'slider' => ['type' => 'boolean'], 'id' => ['type' => 'boolean'], 'badge' => ['type' => 'boolean'], 'classlock' => ['type' => 'boolean'], 'sizing_stylesheet' => ['type' => 'boolean'], 'spacing_stylesheet' => ['type' => 'boolean'], 'pastebutton' => ['type' => 'boolean'], 'icons_core' => ['type' => 'boolean'], 'icons_woocore' => ['type' => 'boolean'], 'deleteOnDeactivate' => ['type' => 'boolean'], ) ), ), ) ); } /** * OxyNinja Settings Panel * * @since 3.3.0 */ public function oxyninja_settings() { wp_enqueue_style( 'oxyninja-settings' ); wp_enqueue_script( 'oxyninja-settings' ); echo '<div id="oxyninja"></div>'; } /** * SubPage WP MENU * * @since 3.3.0 */ public function oxyninja_settings_menu() { $oxyninja_hook_suffix = add_submenu_page( 'ct_dashboard_page', 'OxyNinja', 'OxyNinja', 'manage_options', 'oxyninja', array( $this, 'oxyninja_settings')); add_action( "load-{$oxyninja_hook_suffix}", array($this, 'oxyninja_settings_assets')); } }
Upload File
Create Folder