Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../EmbedPre.../Provider...
File: Boomplay.php
<?php
[0] Fix | Delete
namespace EmbedPress\Providers;
[1] Fix | Delete
[2] Fix | Delete
use Embera\Provider\ProviderAdapter;
[3] Fix | Delete
use Embera\Provider\ProviderInterface;
[4] Fix | Delete
use Embera\Url;
[5] Fix | Delete
[6] Fix | Delete
(defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed. or EmbedPress is not loaded yet.");
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Entity responsible to support Boomplay embeds.
[10] Fix | Delete
*
[11] Fix | Delete
* @package EmbedPress
[12] Fix | Delete
* @subpackage EmbedPress/Providers
[13] Fix | Delete
* @author EmbedPress <help@embedpress.com>
[14] Fix | Delete
* @copyright Copyright (C) 2021 WPDeveloper. All rights reserved.
[15] Fix | Delete
* @license GPLv3 or later
[16] Fix | Delete
* @since 1.5.0
[17] Fix | Delete
*/
[18] Fix | Delete
class Boomplay extends ProviderAdapter implements ProviderInterface
[19] Fix | Delete
{
[20] Fix | Delete
/**
[21] Fix | Delete
* The regex which identifies Boomplay URLs.
[22] Fix | Delete
*
[23] Fix | Delete
* @since 1.5.0
[24] Fix | Delete
* @access private
[25] Fix | Delete
*
[26] Fix | Delete
* @var string
[27] Fix | Delete
*/
[28] Fix | Delete
private $urlRegexPattern = '/boomplay\.com\/(songs|playlists|albums)\/(\d+)/';
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Method that verifies if the embed URL belongs to Boomplay.
[32] Fix | Delete
*
[33] Fix | Delete
* @param Url $url
[34] Fix | Delete
* @return boolean
[35] Fix | Delete
*
[36] Fix | Delete
*/
[37] Fix | Delete
public function validateUrl(Url $url)
[38] Fix | Delete
{
[39] Fix | Delete
return (bool) preg_match($this->urlRegexPattern, $this->url);
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* This method fakes an Oembed response.
[44] Fix | Delete
*
[45] Fix | Delete
* @since 1.5.0
[46] Fix | Delete
*
[47] Fix | Delete
* @return array
[48] Fix | Delete
*/
[49] Fix | Delete
public function fakeResponse()
[50] Fix | Delete
{
[51] Fix | Delete
$url = $this->getUrl();
[52] Fix | Delete
$providerUrl = 'https://www.boomplay.com';
[53] Fix | Delete
[54] Fix | Delete
if (preg_match("{$this->urlRegexPattern}i", $url, $matches)) {
[55] Fix | Delete
$type = $matches[1]; // songs | playlists | album
[56] Fix | Delete
$content_id = $matches[2];
[57] Fix | Delete
$endpoint_type = apply_filters( 'embedpress_boomplay_content_type', 'MUSIC', $type);
[58] Fix | Delete
[59] Fix | Delete
$width = isset( $this->config['maxwidth']) ? $this->config['maxwidth']: '100%';
[60] Fix | Delete
$height = isset( $this->config['maxheight']) ? $this->config['maxheight']: 450;
[61] Fix | Delete
[62] Fix | Delete
$html = "<iframe src='" . esc_url("https://www.boomplay.com/embed/$content_id/$endpoint_type") . "' frameborder='0' height='" . esc_attr($height) . "' width='" . esc_attr($width) . "'></iframe>";
[63] Fix | Delete
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
[67] Fix | Delete
$response = [
[68] Fix | Delete
'type' => $type,
[69] Fix | Delete
'content_id' => $content_id,
[70] Fix | Delete
'provider_name' => 'Boomplay',
[71] Fix | Delete
'provider_url' => $providerUrl,
[72] Fix | Delete
'url' => $url,
[73] Fix | Delete
'html' => $html,
[74] Fix | Delete
];
[75] Fix | Delete
[76] Fix | Delete
if ( in_array( $type, ['albums', 'playlists'])) {
[77] Fix | Delete
$alert_message = sprintf( '<p><strong>%s</strong>. <span style="font-size: 13px;">%s</span></p>', __( 'Embedding Boomplay playlists and albums are supported in EmbedPress Pro', 'embedpress'), __( 'This message is only visible to you.', 'embedpress'));
[78] Fix | Delete
// for gutenberg
[79] Fix | Delete
[80] Fix | Delete
if ( !is_embedpress_pro_active() ) {
[81] Fix | Delete
$response['alert'] = $alert_message;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
if ( is_admin() && !is_embedpress_pro_active() ) {
[85] Fix | Delete
$response['html'] = $alert_message;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
if ( !is_admin() && !is_embedpress_pro_active() ) {
[89] Fix | Delete
$response['html'] = $url;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
}
[93] Fix | Delete
} else {
[94] Fix | Delete
$response = [];
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
return $response;
[98] Fix | Delete
}
[99] Fix | Delete
/** inline @inheritDoc */
[100] Fix | Delete
public function modifyResponse( array $response = [])
[101] Fix | Delete
{
[102] Fix | Delete
return $this->fakeResponse();
[103] Fix | Delete
}
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function