ID)) { $enabled = false; } /** * Filters the enabled/disabled (shown/hidden) status of the player for each post. * * @since 3.3.3 * * @param boolean $enabled Is the player enabled (shown) for this post? * @param int $post_id WordPress post ID. */ $enabled = apply_filters('beyondwords_post_player_enabled', $enabled, $post->ID); return $enabled; } /** * Register the JavaScript for the public-facing side of the site. * * @since 3.0.0 * * @return void */ public function enqueueScripts() { if (! is_singular() && ! is_admin()) { return; } // JS SDK Player script, filtered by $this->scriptLoaderTag() add_filter('script_loader_tag', array($this, 'scriptLoaderTag'), 10, 3); wp_enqueue_script( 'beyondwords-sdk', Environment::getJsSdkUrlLegacy(), array(), null, true ); } /** * Filters the HTML script tag of an enqueued script. * * @param string $tag The ID); $podcastId = PostMetaUtils::getContentId($post->ID); $skBackend = Environment::getBackendUrl(); $skBackendApi = Environment::getApiUrl(); $params = [ 'projectId' => (int)$projectId, 'podcastId' => $podcastId, ]; if (get_option('beyondwords_player_size') === 'medium') { $params['playerType'] = 'manual'; } if (strlen($skBackend)) { $params['skBackend'] = esc_url($skBackend); } if (is_admin()) { $params['processingStatus'] = true; $params['apiWriteKey'] = get_option('beyondwords_api_key', ''); if (strlen($skBackendApi)) { $params['skBackendApi'] = esc_url($skBackendApi); } } if (defined('BEYONDWORDS_DEBUG') && BEYONDWORDS_DEBUG) { $params['debug'] = true; } /** * Filters the BeyondWords JavaScript SDK parameters. * * @since 3.3.3 * * @param array The default JS SDK params. */ $params = apply_filters('beyondwords_js_player_params', $params); return $params; } }