PluginProbe
BeyondWords – AI audio for publishers / 4.0.4
BeyondWords – AI audio for publishers v4.0.4
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / Core / CoreUtils.php

CoreUtils.php in BeyondWords – AI audio for publishers 4.0.4, at src/Core/CoreUtils.php

72 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Beyondwords\Wordpress\Core;
6
7 /**
8 * BeyondWords Core Utilities.
9 *
10 * @package Beyondwords
11 * @subpackage Beyondwords/includes
12 * @author Stuart McAlpine <stu@beyondwords.io>
13 * @since 3.5.0
14 */
15 class CoreUtils
16 {
17 /**
18 * Check to see if the Gutenberg Editor is being used.
19 *
20 * @link https://wordpress.stackexchange.com/a/324866
21 *
22 * @since 3.0.0
23 * @since 3.5.0 Moved from Core\Utils to Core\CoreUtils
24 */
25 public static function isGutenbergPage()
26 {
27 if (function_exists('is_gutenberg_page') && is_gutenberg_page()) {
28 // The Gutenberg plugin is on.
29 return true;
30 }
31
32 $currentScreen = null;
33
34 if (function_exists('get_current_screen')) {
35 $currentScreen = get_current_screen();
36 }
37
38 if ($currentScreen === null) {
39 return false;
40 }
41
42 if (method_exists($currentScreen, 'is_block_editor') && $currentScreen->is_block_editor()) {
43 // Gutenberg page on 5+.
44 return true;
45 }
46
47 return false;
48 }
49
50 /**
51 * Check to see if current screen is an edit screen (this includes the screen
52 * that lists the posts).
53 *
54 * @since 4.0.0
55 */
56 public static function isEditScreen()
57 {
58 if (! function_exists('get_current_screen')) {
59 return false;
60 }
61
62 $screen = get_current_screen();
63
64 // TODO improve this check?
65 if ($screen->parent_base === 'edit' || $screen->base === 'post') {
66 return true;
67 }
68
69 return false;
70 }
71 }
72