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: Gumroad.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace EmbedPress\Providers;
[2] Fix | Delete
[3] Fix | Delete
use Embera\Provider\ProviderAdapter;
[4] Fix | Delete
use Embera\Provider\ProviderInterface;
[5] Fix | Delete
use Embera\Url;
[6] Fix | Delete
[7] Fix | Delete
(defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed.");
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Entity responsible to support Gumroad embeds.
[11] Fix | Delete
*
[12] Fix | Delete
* @package EmbedPress
[13] Fix | Delete
* @subpackage EmbedPress/Providers
[14] Fix | Delete
* @author EmbedPress <help@embedpress.com>
[15] Fix | Delete
* @copyright Copyright (C) 2023 WPDeveloper. All rights reserved.
[16] Fix | Delete
* @license GPLv3 or later
[17] Fix | Delete
* @since 1.0.0
[18] Fix | Delete
*/
[19] Fix | Delete
class Gumroad extends ProviderAdapter implements ProviderInterface
[20] Fix | Delete
{
[21] Fix | Delete
/** inline {@inheritdoc} */
[22] Fix | Delete
protected static $hosts = ["gumroad.com"];
[23] Fix | Delete
/**
[24] Fix | Delete
* Method that verifies if the embed URL belongs to Gumroad.
[25] Fix | Delete
*
[26] Fix | Delete
* @param Url $url
[27] Fix | Delete
* @return boolean
[28] Fix | Delete
* @since 1.0.0
[29] Fix | Delete
*
[30] Fix | Delete
*/
[31] Fix | Delete
public function validateUrl(Url $url)
[32] Fix | Delete
{
[33] Fix | Delete
return (bool) preg_match(
[34] Fix | Delete
"/^https:\/\/[\w.-]+\.gumroad\.com\/l\/[\w.-]+$/i",
[35] Fix | Delete
(string) $url
[36] Fix | Delete
);
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
public function validateGumroad($url)
[40] Fix | Delete
{
[41] Fix | Delete
return (bool) preg_match(
[42] Fix | Delete
"/^https:\/\/[\w.-]+\.gumroad\.com\/l\/[\w.-]+$/i",
[43] Fix | Delete
(string) $url
[44] Fix | Delete
);
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* This method fakes an Oembed response.
[49] Fix | Delete
*
[50] Fix | Delete
* @since 1.0.0
[51] Fix | Delete
*
[52] Fix | Delete
* @return array
[53] Fix | Delete
*/
[54] Fix | Delete
public function fakeResponse()
[55] Fix | Delete
{
[56] Fix | Delete
$src_url = urldecode($this->url);
[57] Fix | Delete
[58] Fix | Delete
[59] Fix | Delete
// Check if the url is already converted to the embed format
[60] Fix | Delete
if ($this->validateGumroad($src_url)) {
[61] Fix | Delete
$iframeSrc = $this->url;
[62] Fix | Delete
} else {
[63] Fix | Delete
return [];
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
$width = isset($this->config['maxwidth']) ? $this->config['maxwidth'] : 600;
[67] Fix | Delete
$height = isset($this->config['maxheight']) ? $this->config['maxheight'] : 350;
[68] Fix | Delete
[69] Fix | Delete
return [
[70] Fix | Delete
'type' => 'rich',
[71] Fix | Delete
'provider_name' => 'Gumroad',
[72] Fix | Delete
'provider_url' => 'https://gumroad.com',
[73] Fix | Delete
'title' => 'Unknown title',
[74] Fix | Delete
'html' => '<iframe title="" width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" src="' . esc_url($iframeSrc) . '" ></iframe>',
[75] Fix | Delete
];
[76] Fix | Delete
}
[77] Fix | Delete
/** inline @inheritDoc */
[78] Fix | Delete
public function modifyResponse(array $response = [])
[79] Fix | Delete
{
[80] Fix | Delete
return $this->fakeResponse();
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function