golden hour
/home/godaofbq/hardchambers.com/wp-content/plugins/notificationx-pro/includes/Admin
⬆️ Go Up
Upload
File/Folder
Size
Actions
Admin.php
793 B
Del
OK
Cron.php
4.46 KB
Del
OK
Entries.php
432 B
Del
OK
Reports
-
Del
OK
Settings.php
5.43 KB
Del
OK
XSS.php
3.39 KB
Del
OK
query-content
-
Del
OK
Edit: XSS.php
<?php /** * Extension Factory * * @package NotificationX\Extensions */ namespace NotificationXPro\Admin; use NotificationX\Core\Helper as HelperFree; use NotificationX\GetInstance; use NotificationX\ThirdParty\WPML; use NotificationXPro\Core\Helper; /** * @method static XSS get_instance($args = null) */ class XSS { use GetInstance; public function __construct() { add_filter('nx_builder_configs', [$this, 'builder_configs']); add_filter('nx_settings_xss_code_default', [$this, 'settings_field_xss_code']); // add_filter( 'nx_settings_tab_miscellaneous', [ $this, 'settings_tab_help' ], 11 ); // add_action( 'init', [ $this, 'add_cors_http_header'] ); } public function get_localize_data($data = []){ $data = apply_filters('nx_frontend_localize_data', $data); if(isset($data['rest']['nonce'])){ unset($data['rest']['nonce']); } return $data; } public function builder_configs($tabs){ $tabs['xss_data'] = $this->get_localize_data(); $tabs['xss_scripts'] = $this->get_scripts(); return $tabs; } public function settings_field_xss_code($xss_code){ $xss_code = "<script>\nwindow.notificationXArr = window.notificationXArr || []; \nwindow.notificationXArr.push(" . json_encode($this->get_localize_data(['all_active' => true, 'cross' => true ])) . ");\n</script>"; $xss_code .= $this->get_scripts(); return $xss_code; } public function get_scripts(){ $scripts = [ 'notificationx-public' => HelperFree::file('public/js/frontend.js', true), ]; $styles = [ 'notificationx-public' => HelperFree::file('public/css/frontend.css', true), 'notificationx-pro-public' => Helper::pro_file('public/css/frontend.css', true), ]; $xss_scripts = " <script> (function(){ var scripts = " . json_encode($scripts) . ", styles = " . json_encode($styles) . "; for(var i in scripts){ if(document.getElementById(i + '-js')){ continue; } var script = document.createElement('script'); script.src = scripts[i]; document.head.appendChild(script); } for(var i in styles){ if(document.getElementById(i + '-css')){ continue; } var link = document.createElement('link'); link.rel = 'stylesheet'; link.href = styles[i]; document.head.appendChild(link); } })(); </script>"; return $xss_scripts; } public function settings_tab_help( $tabs ) { $tabs['fields']['xss_settings']['fields']['acao'] = array( 'name' => 'acao', 'type' => 'text', 'label' => __( 'Access-Control-Allow-Origin', 'notificationx' ), 'placeholder' => __('*', 'notificationx'), 'is_pro' => true, 'help' => sprintf( __( 'Show your Notification Alerts in another website using <a target="_blank" href="%s">Cross Domain Notice</a>.', 'notificationx' ), 'https://notificationx.com/docs/notificationx-cross-domain-notice/' ), 'default' => '', 'priority' => 5, ); return $tabs; } public function add_cors_http_header(){ $acao = \NotificationX\Admin\Settings::get_instance()->get('settings.acao'); if ( ! empty( $acao ) ) { header("Access-Control-Allow-Origin: $acao"); } } }
Save