PluginProbe
BeyondWords – AI audio for publishers / 6.0.3
BeyondWords – AI audio for publishers v6.0.3
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 / Player / Renderer / Base.php

Base.php in BeyondWords – AI audio for publishers 6.0.3, at src/Core/Player/Renderer/Base.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Beyondwords\Wordpress\Core\Player\Renderer;
4
5 use Beyondwords\Wordpress\Component\Post\PostMetaUtils;
6 use Beyondwords\Wordpress\Component\Settings\Fields\IntegrationMethod\IntegrationMethod;
7 use Beyondwords\Wordpress\Core\CoreUtils;
8
9 /**
10 * Class Base.
11 *
12 * Base class for player renderers.
13 */
14 class Base
15 {
16 /**
17 * Check whether a player should be rendered.
18 *
19 * @param \WP_Post $post WordPress post object.
20 *
21 * @return bool True if a player should be rendered.
22 */
23 public static function check(\WP_Post $post): bool
24 {
25 if (function_exists('is_preview') && is_preview()) {
26 return false;
27 }
28
29 if (CoreUtils::isGutenbergPage() || CoreUtils::isEditScreen()) {
30 return false;
31 }
32
33 $projectId = PostMetaUtils::getProjectId($post->ID);
34
35 if (! $projectId) {
36 return false;
37 }
38
39 $contentId = PostMetaUtils::getContentId($post->ID);
40 $method = IntegrationMethod::getIntegrationMethod($post);
41
42 return $method === IntegrationMethod::CLIENT_SIDE ||
43 ($method === IntegrationMethod::REST_API && $contentId);
44 }
45 }
46