# speechkit/4.0.6/src/Core/CoreUtils.php

BeyondWords – AI audio for publishers, version 4.0.6. 81 lines.

- Page: https://pluginprobe.com/plugins/speechkit/4.0.6/code/src/Core/CoreUtils.php
- Raw: https://pluginprobe.com/plugins/speechkit/4.0.6/raw/src/Core/CoreUtils.php
- Modified: 2023-09-07T17:37:44+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/speechkit/4.0.6/code/src/Core/CoreUtils.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Beyondwords\Wordpress\Core;

/**
 * BeyondWords Core Utilities.
 *
 * @package    Beyondwords
 * @subpackage Beyondwords/includes
 * @author     Stuart McAlpine <stu@beyondwords.io>
 * @since      3.5.0
 */
class CoreUtils
{
    /**
     * Check to see if the Gutenberg Editor is being used.
     *
     * @link https://wordpress.stackexchange.com/a/324866
     *
     * @since 3.0.0
     * @since 3.5.0 Moved from Core\Utils to Core\CoreUtils
     */
    public static function isGutenbergPage()
    {
        if (function_exists('is_gutenberg_page') && is_gutenberg_page()) {
            // The Gutenberg plugin is on.
            return true;
        }

        $currentScreen = null;

        if (function_exists('get_current_screen')) {
            $currentScreen = get_current_screen();
        }

        if ($currentScreen === null) {
            return false;
        }

        if (method_exists($currentScreen, 'is_block_editor') && $currentScreen->is_block_editor()) {
            // Gutenberg page on 5+.
            return true;
        }

        return false;
    }

    /**
     * Check to see if current screen is an edit screen
     * (this includes the screen that lists the posts).
     *
     * @since 4.0.0
     * @since 4.0.5 Ensure is_admin() and $screen
     */
    public static function isEditScreen()
    {
        if (! is_admin()) {
            return false;
        }

        if (! function_exists('get_current_screen')) {
            return false;
        }

        $screen = get_current_screen();

        if (! $screen || ! ($screen instanceof \WP_Screen)) {
            return false;
        }

        // TODO improve this check?
        if ($screen->parent_base === 'edit' || $screen->base === 'post') {
            return true;
        }

        return false;
    }
}

```
