403Webshell
Server IP : 3.93.235.159  /  Your IP : 216.73.216.140
Web Server : Apache
System : Linux ip-172-26-0-169 5.10.0-46-cloud-amd64 #1 SMP Debian 5.10.262-1 (2026-07-31) x86_64
User : bitnami ( 1000)
PHP Version : 8.2.9
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /bitnami/wordpress/wp-content/plugins/yoast-test-helper/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bitnami/wordpress/wp-content/plugins/yoast-test-helper/src//admin-page.php
<?php

namespace Yoast\WP\Test_Helper;

/**
 * Class to manage registering and rendering the admin page in WordPress.
 */
class Admin_Page implements Integration {

	/**
	 * List of admin page blocks.
	 *
	 * @var callable[]
	 */
	protected $admin_page_blocks = [];

	/**
	 * Registers WordPress hooks and filters.
	 *
	 * @return void
	 */
	public function add_hooks() {
		\add_action( 'admin_menu', [ $this, 'register_admin_menu' ] );

		\add_filter( 'Yoast\WP\Test_Helper\admin_page', [ $this, 'get_admin_page' ] );
	}

	/**
	 * Retrieves the admin page identifier.
	 *
	 * @return string The admin page identifier.
	 */
	public function get_admin_page() {
		return 'yoast-test-helper';
	}

	/**
	 * Adding the assets to the page.
	 *
	 * @return void
	 */
	public function add_assets() {
		// CSS file.
		\wp_enqueue_style(
			'yoast-test-admin-style',
			\plugin_dir_url( \YOAST_TEST_HELPER_FILE ) . 'assets/css/admin.css',
			[],
			\YOAST_TEST_HELPER_VERSION,
		);
		\wp_enqueue_script( 'masonry' );
	}

	/**
	 * Registers the admin menu.
	 *
	 * @return void
	 */
	public function register_admin_menu() {
		$menu_item = \add_management_page(
			\esc_html__( 'Yoast Test', 'yoast-test-helper' ),
			\esc_html__( 'Yoast Test', 'yoast-test-helper' ),
			'manage_options',
			\sanitize_key( $this->get_admin_page() ),
			[ $this, 'show_admin_page' ],
		);
		\add_action( 'admin_print_styles-' . $menu_item, [ $this, 'add_assets' ] );
	}

	/**
	 * Adds an admin block.
	 *
	 * @param callable $block Block to add.
	 *
	 * @return void
	 */
	public function add_admin_page_block( $block ) {
		$this->admin_page_blocks[] = $block;
	}

	/**
	 * Shows the admin page.
	 *
	 * @return void
	 */
	public function show_admin_page() {
		echo '<h1>', \esc_html__( 'Yoast Test Helper', 'yoast-test-helper' ), '</h1>';

		\do_action( 'Yoast\WP\Test_Helper\notifications', $this );

		echo '<div id="yoast_masonry">';
		$this->masonry_script();

		\array_map( [ $this, 'display_block_output' ], $this->admin_page_blocks );
		echo '</div>';
	}

	/**
	 * Display an admin page block.
	 *
	 * @param callable $block Admin page block.
	 *
	 * @return void
	 */
	private function display_block_output( $block ) {
		$block_output = $block();
		if ( $block_output === '' ) {
			return;
		}
		echo '<div class="wpseo_test_block">';
		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
		echo $block_output;
		echo '</div>';
	}

	/**
	 * Prints our masonry script.
	 *
	 * @return void
	 */
	private function masonry_script() {
		?>
		<script type="text/javascript">
			jQuery( window ).on( "load", function() {
				var container = document.querySelector( "#yoast_masonry" );
				var masonry   = new Masonry( container, {
					itemSelector: ".wpseo_test_block",
					columnWidth: ".wpseo_test_block"
				} );

				// Re-flow the masonry layout whenever any tile's content size changes,
				// so integrations that show/hide rows don't need to know about masonry.
				if ( typeof ResizeObserver === "function" ) {
					var observer = new ResizeObserver( function() {
						masonry.layout();
					} );
					Array.prototype.forEach.call( container.children, function( tile ) {
						observer.observe( tile );
					} );
				}
			} );
		</script>
		<?php
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit