# wp-to-buffer/6.2.5/lib/social/includes/class-screen.php

Social Media Auto Poster – Schedule &amp; Publish to Buffer, version 6.2.5. 163 lines.

- Page: https://pluginprobe.com/plugins/wp-to-buffer/6.2.5/code/lib/social/includes/class-screen.php
- Raw: https://pluginprobe.com/plugins/wp-to-buffer/6.2.5/raw/lib/social/includes/class-screen.php
- Modified: 2026-08-19T11:19:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-to-buffer/6.2.5/code/lib/social/includes/class-screen.php#L10-L20`.

```php
<?php
/**
 * Screen class
 *
 * @package WPZinc\Social
 * @author WP Zinc
 */

namespace WPZinc\Social;

/**
 * Determines which Plugin Screen the User is on
 *
 * @package WPZinc\Social
 * @author  WP Zinc
 * @version 3.9.6
 */
class Screen {

	/**
	 * Holds the base object.
	 *
	 * @since   3.9.6
	 *
	 * @var     object
	 */
	public $base;

	/**
	 * Constructor
	 *
	 * @since   3.9.6
	 *
	 * @param   object $base    Base Plugin Class.
	 */
	public function __construct( $base ) {

		// Store base class.
		$this->base = $base;

	}

	/**
	 * Returns an array comprising of the Plugin Top Level Screen and Section
	 *
	 * For example:
	 * [
	 *  'screen' => 'settings',
	 *  'section' => 'page',
	 * ]
	 *
	 * Returns false if we're not on a Plugin screen
	 *
	 * @since   3.9.6
	 *
	 * @return  array   Screen and Section (if false, we're not on this Plugin's screens)
	 */
	public function get_current_screen() {

		// Assume we're not on a plugin screen.
		$result = array(
			'screen'  => false,
			'section' => false,
		);

		// Early detection of settings page so that early hooks e.g. init can detect if we're on the settings screen.
		$page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
		$tab  = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
		if ( $page === $this->base->plugin->name . '-settings' ) {
			return array(
				'screen'  => 'settings',
				'section' => ( $tab ? $tab : 'auth' ),
			);
		}

		// Bail if we can't determine this.
		if ( ! function_exists( 'get_current_screen' ) ) {
			return $result;
		}

		// Get screen.
		$screen = get_current_screen();

		// Bail if screen is null.
		if ( is_null( $screen ) ) {
			return $result;
		}

		// Get screen ID without Plugin Display Name, which can be edited by whitelabelling.
		$screen_id = str_replace(
			array(
				'toplevel_page_', // licensing = wp-to-xxx-pro.
				sanitize_title( $this->base->plugin->displayName ) . '_page_',
			),
			'',
			$screen->base
		);

		switch ( $screen_id ) {

			/**
			 * Post/Page/CPT WP_List_Table
			 */
			case 'edit':
				return array(
					'screen'  => 'post',
					'section' => 'wp_list_table',
				);

			/**
			 * Post/Page/CPT Add/Edit
			 */
			case 'post':
				return array(
					'screen'  => 'post',
					'section' => 'edit',
				);

			/**
			 * Settings
			 */
			case $this->base->plugin->name . '-settings':
				return array(
					'screen'  => 'settings',
					'section' => filter_has_var( INPUT_GET, 'tab' ) ? filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) : 'auth',
				);

			/**
			 * Bulk Publish
			 */
			case $this->base->plugin->name . '-bulk-publish':
				return array(
					'screen'  => 'bulk_publish',
					'section' => 'bulk_publish',
				);

			/**
			 * Log
			 */
			case $this->base->plugin->name . '-log':
				return array(
					'screen'  => 'log',
					'section' => 'log',
				);

			/**
			 * WordPress Screens
			 */
			case 'customize':
				return array(
					'screen'  => 'customize',
					'section' => 'customize',
				);

		}

		// If here, we couldn't determine the screen.
		return $result;

	}

}

```
