| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Extension Factory |
| 5 |
* |
| 6 |
* @package NotificationX\Extensions |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace NotificationX\Admin; |
| 10 |
|
| 11 |
use NotificationX\GetInstance; |
| 12 |
|
| 13 |
/** |
| 14 |
* @method static XSS get_instance($args = null) |
| 15 |
*/ |
| 16 |
class XSS { |
| 17 |
use GetInstance; |
| 18 |
|
| 19 |
public function __construct() { |
| 20 |
add_filter( 'nx_settings', [ $this, 'save_settings' ] ); |
| 21 |
add_filter( 'nx_settings_tab_miscellaneous', [ $this, 'settings_tab_help' ] ); |
| 22 |
} |
| 23 |
|
| 24 |
public function save_settings( $settings ) { |
| 25 |
if ( isset( $settings['xss_code'] ) ) { |
| 26 |
unset( $settings['xss_code'] ); |
| 27 |
} |
| 28 |
return $settings; |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
public function settings_tab_help( $tabs ) { |
| 33 |
|
| 34 |
$tabs['fields']['xss_settings'] = array( |
| 35 |
'name' => 'xss_settings', |
| 36 |
'type' => 'section', |
| 37 |
'label' => __( 'Cross Domain Notice', 'notificationx' ), |
| 38 |
'priority' => 30, |
| 39 |
'fields' => array( |
| 40 |
'xss_code' => array( |
| 41 |
'name' => 'xss_code', |
| 42 |
'type' => 'codeviewer', |
| 43 |
'label' => __( 'Cross Domain Notice', 'notificationx' ), |
| 44 |
'button_text' => __( 'Click to Copy', 'notificationx' ), |
| 45 |
'success_text' => __( 'Copied to clipboard.', 'notificationx' ), |
| 46 |
'is_pro' => true, |
| 47 |
'copyOnClick' => true, |
| 48 |
'readOnly' => true, |
| 49 |
'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/' ), |
| 50 |
'default' => apply_filters( 'nx_settings_xss_code_default', "<div id='notificationx-frontend'></div>\n<script>....</script>\n<script src='....../crossSite.js'></script>" ), |
| 51 |
'priority' => 1, |
| 52 |
), |
| 53 |
), |
| 54 |
); |
| 55 |
|
| 56 |
return $tabs; |
| 57 |
} |
| 58 |
} |
| 59 |
|