HEX
Server: Apache/2.4.57 (Unix) OpenSSL/1.1.1k
System: Linux tam.zee-supreme-vps.net 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Sat Dec 2 05:23:44 EST 2023 x86_64
User: adltc (1070)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/adltc/public_html/wp-content/plugins/feeds-for-youtube/inc/Builder/Tooltip_Wizard.php
<?php
/**
 * SBY Tooltip Wizard
 *
 *
 * @since 2.0
 */
namespace SmashBalloon\YouTubeFeed\Builder;

class Tooltip_Wizard {

	/**
	 * Register component
	 *
	 * @since 2.0
	 */
	public function register() {
		$this->hooks();
	}

	/**
	 * Register hooks.
	 *
	 * @since 2.0
	 */
	public function hooks() {
		add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] );
		add_action( 'admin_footer', [ $this, 'output' ] );
	}


	/**
	 * Enqueue assets.
	 *
	 * @since 2.0
	 */
	public function enqueues() {

		wp_enqueue_style(
			'sby_tooltipster',
			SBY_PLUGIN_URL . 'css/tooltipster.css',
			null,
			SBYVER
		);

		wp_enqueue_script(
			'tooltipster',
			SBY_PLUGIN_URL . 'js/jquery.tooltipster.min.js',
			[ 'jquery' ],
			SBYVER,
			true
		);

		wp_enqueue_script(
			'sby-admin-tooltip-wizard',
			SBY_PLUGIN_URL . 'js/tooltip-wizard.js',
			[ 'jquery' ],
			SBYVER
		);

		$wp_localize_data = [];
		if( $this->check_gutenberg_wizard() ){
			$wp_localize_data['sby_wizard_gutenberg'] = true;
		}

		wp_localize_script(
			'sby-admin-tooltip-wizard',
			'sby_admin_tooltip_wizard',
			$wp_localize_data
		);
	}

	/**
	 * Output HTML.
	 *
	 * @since 2.0
	 */
	public function output() {
		if( $this->check_gutenberg_wizard() ){
			$this->gutenberg_tooltip_output();
		}

	}

	/**
	 * Gutenberg Tooltip Output HTML.
	 *
	 * @since 2.0
	 */
	public function check_gutenberg_wizard() {
		global $pagenow;
		return  (	( $pagenow == 'post.php' ) || (get_post_type() == 'page') )
				&& ! empty( $_GET['sby_wizard'] );
	}


	/**
	 * Gutenberg Tooltip Output HTML.
	 *
	 * @since 2.0
	 */
	public function gutenberg_tooltip_output() {
		?>
		<div id="sby-gutenberg-tooltip-content">
			<div class="sby-tlp-wizard-cls sby-tlp-wizard-close"></div>
			<div class="sby-tlp-wizard-content">
				<strong class="sby-tooltip-wizard-head"><?php echo __('Add a Block','feeds-for-youtube') ?></strong>
				<p class="sby-tooltip-wizard-txt"><?php echo __('Click the plus button, search for Feeds for YouTube','feeds-for-youtube'); ?>
                    <br/><?php echo __('Feed, and click the block to embed it.','feeds-for-youtube') ?> <a href="https://smashballoon.com/doc/wordpress-5-block-page-editor-gutenberg/?youtube" rel="noopener" target="_blank" rel="nofollow noopener"><?php echo __('Learn More','feeds-for-youtube') ?></a></p>
				<div class="sby-tooltip-wizard-actions">
					<button class="sby-tlp-wizard-close"><?php echo __('Done','feeds-for-youtube') ?></button>
				</div>
			</div>
		</div>
		<?php
	}
}