PluginProbe
BeyondWords – AI audio for publishers / 7.0.0
BeyondWords – AI audio for publishers v7.0.0
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 / player / renderer / class-base.php

class-base.php in BeyondWords – AI audio for publishers 7.0.0, at src/player/renderer/class-base.php

50 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 * Base class for player renderers.
4 *
5 * @package BeyondWords\Player\Renderer
6 * @since 6.0.0
7 * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods.
8 */
9
10 declare( strict_types = 1 );
11
12 namespace BeyondWords\Player\Renderer;
13
14 defined( 'ABSPATH' ) || exit;
15
16 /**
17 * Common eligibility checks for every renderer.
18 *
19 * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods.
20 */
21 class Base {
22
23 /**
24 * Whether a player should be rendered for this post in this request.
25 *
26 * @param \WP_Post $post WordPress post object.
27 */
28 public static function check( \WP_Post $post ): bool {
29 if ( function_exists( 'is_preview' ) && is_preview() ) {
30 return false;
31 }
32
33 if ( \BeyondWords\Core\Utils::is_gutenberg_page() || \BeyondWords\Core\Utils::is_edit_screen() ) {
34 return false;
35 }
36
37 $project_id = \BeyondWords\Post\Meta::get_project_id( $post->ID );
38
39 if ( ! $project_id ) {
40 return false;
41 }
42
43 $content_id = \BeyondWords\Post\Meta::get_content_id( $post->ID );
44 $method = \BeyondWords\Settings\Fields::get_integration_method( $post );
45
46 return \BeyondWords\Settings\Fields::INTEGRATION_CLIENT_SIDE === $method
47 || ( \BeyondWords\Settings\Fields::INTEGRATION_REST_API === $method && $content_id );
48 }
49 }
50