ads
3 months ago
groups
3 months ago
metaboxes
1 year ago
pages
3 months ago
placements
2 months ago
class-action-links.php
1 year ago
class-addon-box.php
1 year ago
class-addon-updater.php
3 months ago
class-admin-menu.php
3 months ago
class-admin-notices.php
1 year ago
class-ajax.php
3 months ago
class-assets.php
3 months ago
class-authors.php
1 year ago
class-compatibility.php
1 year ago
class-edd-updater.php
3 months ago
class-list-filters.php
2 months ago
class-marketing.php
1 year ago
class-metabox-ad-settings.php
1 year ago
class-metabox-ad.php
1 year ago
class-misc.php
1 year ago
class-page-quick-edit.php
1 year ago
class-plugin-installer.php
1 year ago
class-post-list.php
1 year ago
class-post-types.php
3 months ago
class-screen-options.php
3 months ago
class-settings.php
1 year ago
class-shortcode-creator.php
1 year ago
class-system-info.php
1 year ago
class-tinymce.php
2 years ago
class-translation-promo.php
1 year ago
class-upgrades.php
1 year ago
class-version-control.php
3 months ago
class-welcome.php
1 year ago
class-wordpress-dashboard.php
1 year ago
index.php
2 years ago
class-tinymce.php
51 lines
| 1 | <?php |
| 2 | /** |
| 3 | * The class is responsible for configuring the TinyMCE editor to allow unsafe link targets. |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.47.0 |
| 8 | */ |
| 9 | |
| 10 | namespace AdvancedAds\Admin; |
| 11 | |
| 12 | use AdvancedAds\Framework\Interfaces\Integration_Interface; |
| 13 | |
| 14 | defined( 'ABSPATH' ) || exit; |
| 15 | |
| 16 | /** |
| 17 | * TinyMCE. |
| 18 | */ |
| 19 | class TinyMCE implements Integration_Interface { |
| 20 | |
| 21 | /** |
| 22 | * Hook into WordPress. |
| 23 | * |
| 24 | * @return void |
| 25 | */ |
| 26 | public function hooks(): void { |
| 27 | add_filter( 'tiny_mce_before_init', [ $this, 'allow_unsafe_link_target' ] ); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Configure TinyMCE to allow unsafe link target. |
| 32 | * |
| 33 | * @param bool $mce_init the tinyMce initialization array. |
| 34 | * |
| 35 | * @return bool|[] |
| 36 | */ |
| 37 | public function allow_unsafe_link_target( $mce_init ) { |
| 38 | // Early bail!! |
| 39 | if ( ! function_exists( 'get_current_screen' ) ) { |
| 40 | return $mce_init; |
| 41 | } |
| 42 | |
| 43 | $screen = get_current_screen(); |
| 44 | if ( 'advanced_ads' === ( $screen->id ?? '' ) ) { |
| 45 | $mce_init['allow_unsafe_link_target'] = true; |
| 46 | } |
| 47 | |
| 48 | return $mce_init; |
| 49 | } |
| 50 | } |
| 51 |