Edit File by line
/home/zeestwma/richards.../wp-inclu.../SimplePi.../src
File: SimplePie.php
* @since 1.0
[3000] Fix | Delete
* @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
[3001] Fix | Delete
* @link http://www.georss.org/ GeoRSS
[3002] Fix | Delete
* @return float|null
[3003] Fix | Delete
*/
[3004] Fix | Delete
public function get_longitude()
[3005] Fix | Delete
{
[3006] Fix | Delete
if ($return = $this->get_channel_tags(self::NAMESPACE_W3C_BASIC_GEO, 'long')) {
[3007] Fix | Delete
return (float) $return[0]['data'];
[3008] Fix | Delete
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_W3C_BASIC_GEO, 'lon')) {
[3009] Fix | Delete
return (float) $return[0]['data'];
[3010] Fix | Delete
} elseif (($return = $this->get_channel_tags(self::NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) {
[3011] Fix | Delete
return (float) $match[2];
[3012] Fix | Delete
}
[3013] Fix | Delete
[3014] Fix | Delete
return null;
[3015] Fix | Delete
}
[3016] Fix | Delete
[3017] Fix | Delete
/**
[3018] Fix | Delete
* Get the feed logo's title
[3019] Fix | Delete
*
[3020] Fix | Delete
* RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" title.
[3021] Fix | Delete
*
[3022] Fix | Delete
* Uses `<image><title>` or `<image><dc:title>`
[3023] Fix | Delete
*
[3024] Fix | Delete
* @return string|null
[3025] Fix | Delete
*/
[3026] Fix | Delete
public function get_image_title()
[3027] Fix | Delete
{
[3028] Fix | Delete
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_10, 'title')) {
[3029] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
[3030] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_090, 'title')) {
[3031] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
[3032] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'title')) {
[3033] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
[3034] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_DC_11, 'title')) {
[3035] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
[3036] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_DC_10, 'title')) {
[3037] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
[3038] Fix | Delete
}
[3039] Fix | Delete
[3040] Fix | Delete
return null;
[3041] Fix | Delete
}
[3042] Fix | Delete
[3043] Fix | Delete
/**
[3044] Fix | Delete
* Get the feed logo's URL
[3045] Fix | Delete
*
[3046] Fix | Delete
* RSS 0.9.0, 2.0, Atom 1.0, and feeds with iTunes RSS tags are allowed to
[3047] Fix | Delete
* have a "feed logo" URL. This points directly to the image itself.
[3048] Fix | Delete
*
[3049] Fix | Delete
* Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`,
[3050] Fix | Delete
* `<image><title>` or `<image><dc:title>`
[3051] Fix | Delete
*
[3052] Fix | Delete
* @return string|null
[3053] Fix | Delete
*/
[3054] Fix | Delete
public function get_image_url()
[3055] Fix | Delete
{
[3056] Fix | Delete
if ($return = $this->get_channel_tags(self::NAMESPACE_ITUNES, 'image')) {
[3057] Fix | Delete
return $this->sanitize($return[0]['attribs']['']['href'], self::CONSTRUCT_IRI);
[3058] Fix | Delete
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'logo')) {
[3059] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3060] Fix | Delete
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'icon')) {
[3061] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3062] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_10, 'url')) {
[3063] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3064] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_090, 'url')) {
[3065] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3066] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) {
[3067] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3068] Fix | Delete
}
[3069] Fix | Delete
[3070] Fix | Delete
return null;
[3071] Fix | Delete
}
[3072] Fix | Delete
[3073] Fix | Delete
[3074] Fix | Delete
/**
[3075] Fix | Delete
* Get the feed logo's link
[3076] Fix | Delete
*
[3077] Fix | Delete
* RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" link. This
[3078] Fix | Delete
* points to a human-readable page that the image should link to.
[3079] Fix | Delete
*
[3080] Fix | Delete
* Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`,
[3081] Fix | Delete
* `<image><title>` or `<image><dc:title>`
[3082] Fix | Delete
*
[3083] Fix | Delete
* @return string|null
[3084] Fix | Delete
*/
[3085] Fix | Delete
public function get_image_link()
[3086] Fix | Delete
{
[3087] Fix | Delete
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_10, 'link')) {
[3088] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3089] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_090, 'link')) {
[3090] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3091] Fix | Delete
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'link')) {
[3092] Fix | Delete
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
[3093] Fix | Delete
}
[3094] Fix | Delete
[3095] Fix | Delete
return null;
[3096] Fix | Delete
}
[3097] Fix | Delete
[3098] Fix | Delete
/**
[3099] Fix | Delete
* Get the feed logo's link
[3100] Fix | Delete
*
[3101] Fix | Delete
* RSS 2.0 feeds are allowed to have a "feed logo" width.
[3102] Fix | Delete
*
[3103] Fix | Delete
* Uses `<image><width>` or defaults to 88 if no width is specified and
[3104] Fix | Delete
* the feed is an RSS 2.0 feed.
[3105] Fix | Delete
*
[3106] Fix | Delete
* @return int|null
[3107] Fix | Delete
*/
[3108] Fix | Delete
public function get_image_width()
[3109] Fix | Delete
{
[3110] Fix | Delete
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'width')) {
[3111] Fix | Delete
return intval($return[0]['data']);
[3112] Fix | Delete
} elseif ($this->get_type() & self::TYPE_RSS_SYNDICATION && $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) {
[3113] Fix | Delete
return 88;
[3114] Fix | Delete
}
[3115] Fix | Delete
[3116] Fix | Delete
return null;
[3117] Fix | Delete
}
[3118] Fix | Delete
[3119] Fix | Delete
/**
[3120] Fix | Delete
* Get the feed logo's height
[3121] Fix | Delete
*
[3122] Fix | Delete
* RSS 2.0 feeds are allowed to have a "feed logo" height.
[3123] Fix | Delete
*
[3124] Fix | Delete
* Uses `<image><height>` or defaults to 31 if no height is specified and
[3125] Fix | Delete
* the feed is an RSS 2.0 feed.
[3126] Fix | Delete
*
[3127] Fix | Delete
* @return int|null
[3128] Fix | Delete
*/
[3129] Fix | Delete
public function get_image_height()
[3130] Fix | Delete
{
[3131] Fix | Delete
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'height')) {
[3132] Fix | Delete
return intval($return[0]['data']);
[3133] Fix | Delete
} elseif ($this->get_type() & self::TYPE_RSS_SYNDICATION && $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) {
[3134] Fix | Delete
return 31;
[3135] Fix | Delete
}
[3136] Fix | Delete
[3137] Fix | Delete
return null;
[3138] Fix | Delete
}
[3139] Fix | Delete
[3140] Fix | Delete
/**
[3141] Fix | Delete
* Get the number of items in the feed
[3142] Fix | Delete
*
[3143] Fix | Delete
* This is well-suited for {@link http://php.net/for for()} loops with
[3144] Fix | Delete
* {@see get_item()}
[3145] Fix | Delete
*
[3146] Fix | Delete
* @param int $max Maximum value to return. 0 for no limit
[3147] Fix | Delete
* @return int Number of items in the feed
[3148] Fix | Delete
*/
[3149] Fix | Delete
public function get_item_quantity(int $max = 0)
[3150] Fix | Delete
{
[3151] Fix | Delete
$qty = count($this->get_items());
[3152] Fix | Delete
if ($max === 0) {
[3153] Fix | Delete
return $qty;
[3154] Fix | Delete
}
[3155] Fix | Delete
[3156] Fix | Delete
return min($qty, $max);
[3157] Fix | Delete
}
[3158] Fix | Delete
[3159] Fix | Delete
/**
[3160] Fix | Delete
* Get a single item from the feed
[3161] Fix | Delete
*
[3162] Fix | Delete
* This is better suited for {@link http://php.net/for for()} loops, whereas
[3163] Fix | Delete
* {@see get_items()} is better suited for
[3164] Fix | Delete
* {@link http://php.net/foreach foreach()} loops.
[3165] Fix | Delete
*
[3166] Fix | Delete
* @see get_item_quantity()
[3167] Fix | Delete
* @since Beta 2
[3168] Fix | Delete
* @param int $key The item that you want to return. Remember that arrays begin with 0, not 1
[3169] Fix | Delete
* @return Item|null
[3170] Fix | Delete
*/
[3171] Fix | Delete
public function get_item(int $key = 0)
[3172] Fix | Delete
{
[3173] Fix | Delete
$items = $this->get_items();
[3174] Fix | Delete
if (isset($items[$key])) {
[3175] Fix | Delete
return $items[$key];
[3176] Fix | Delete
}
[3177] Fix | Delete
[3178] Fix | Delete
return null;
[3179] Fix | Delete
}
[3180] Fix | Delete
[3181] Fix | Delete
/**
[3182] Fix | Delete
* Get all items from the feed
[3183] Fix | Delete
*
[3184] Fix | Delete
* This is better suited for {@link http://php.net/for for()} loops, whereas
[3185] Fix | Delete
* {@see get_items()} is better suited for
[3186] Fix | Delete
* {@link http://php.net/foreach foreach()} loops.
[3187] Fix | Delete
*
[3188] Fix | Delete
* @see get_item_quantity
[3189] Fix | Delete
* @since Beta 2
[3190] Fix | Delete
* @param int $start Index to start at
[3191] Fix | Delete
* @param int $end Number of items to return. 0 for all items after `$start`
[3192] Fix | Delete
* @return Item[] List of {@see Item} objects
[3193] Fix | Delete
*/
[3194] Fix | Delete
public function get_items(int $start = 0, int $end = 0)
[3195] Fix | Delete
{
[3196] Fix | Delete
if (!isset($this->data['items'])) {
[3197] Fix | Delete
if (!empty($this->multifeed_objects)) {
[3198] Fix | Delete
$this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
[3199] Fix | Delete
if (empty($this->data['items'])) {
[3200] Fix | Delete
return [];
[3201] Fix | Delete
}
[3202] Fix | Delete
return $this->data['items'];
[3203] Fix | Delete
}
[3204] Fix | Delete
$this->data['items'] = [];
[3205] Fix | Delete
if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_10, 'entry')) {
[3206] Fix | Delete
$keys = array_keys($items);
[3207] Fix | Delete
foreach ($keys as $key) {
[3208] Fix | Delete
$this->data['items'][] = $this->make_item($items[$key]);
[3209] Fix | Delete
}
[3210] Fix | Delete
}
[3211] Fix | Delete
if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_03, 'entry')) {
[3212] Fix | Delete
$keys = array_keys($items);
[3213] Fix | Delete
foreach ($keys as $key) {
[3214] Fix | Delete
$this->data['items'][] = $this->make_item($items[$key]);
[3215] Fix | Delete
}
[3216] Fix | Delete
}
[3217] Fix | Delete
if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_10, 'item')) {
[3218] Fix | Delete
$keys = array_keys($items);
[3219] Fix | Delete
foreach ($keys as $key) {
[3220] Fix | Delete
$this->data['items'][] = $this->make_item($items[$key]);
[3221] Fix | Delete
}
[3222] Fix | Delete
}
[3223] Fix | Delete
if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_090, 'item')) {
[3224] Fix | Delete
$keys = array_keys($items);
[3225] Fix | Delete
foreach ($keys as $key) {
[3226] Fix | Delete
$this->data['items'][] = $this->make_item($items[$key]);
[3227] Fix | Delete
}
[3228] Fix | Delete
}
[3229] Fix | Delete
if ($items = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'item')) {
[3230] Fix | Delete
$keys = array_keys($items);
[3231] Fix | Delete
foreach ($keys as $key) {
[3232] Fix | Delete
$this->data['items'][] = $this->make_item($items[$key]);
[3233] Fix | Delete
}
[3234] Fix | Delete
}
[3235] Fix | Delete
}
[3236] Fix | Delete
[3237] Fix | Delete
if (empty($this->data['items'])) {
[3238] Fix | Delete
return [];
[3239] Fix | Delete
}
[3240] Fix | Delete
[3241] Fix | Delete
if ($this->order_by_date) {
[3242] Fix | Delete
if (!isset($this->data['ordered_items'])) {
[3243] Fix | Delete
$this->data['ordered_items'] = $this->data['items'];
[3244] Fix | Delete
usort($this->data['ordered_items'], [get_class($this), 'sort_items']);
[3245] Fix | Delete
}
[3246] Fix | Delete
$items = $this->data['ordered_items'];
[3247] Fix | Delete
} else {
[3248] Fix | Delete
$items = $this->data['items'];
[3249] Fix | Delete
}
[3250] Fix | Delete
// Slice the data as desired
[3251] Fix | Delete
if ($end === 0) {
[3252] Fix | Delete
return array_slice($items, $start);
[3253] Fix | Delete
}
[3254] Fix | Delete
[3255] Fix | Delete
return array_slice($items, $start, $end);
[3256] Fix | Delete
}
[3257] Fix | Delete
[3258] Fix | Delete
/**
[3259] Fix | Delete
* Set the favicon handler
[3260] Fix | Delete
*
[3261] Fix | Delete
* @deprecated Use your own favicon handling instead
[3262] Fix | Delete
* @param string|false $page
[3263] Fix | Delete
* @return bool
[3264] Fix | Delete
*/
[3265] Fix | Delete
public function set_favicon_handler($page = false, string $qs = 'i')
[3266] Fix | Delete
{
[3267] Fix | Delete
trigger_error('Favicon handling has been removed since SimplePie 1.3, please use your own handling', \E_USER_DEPRECATED);
[3268] Fix | Delete
return false;
[3269] Fix | Delete
}
[3270] Fix | Delete
[3271] Fix | Delete
/**
[3272] Fix | Delete
* Get the favicon for the current feed
[3273] Fix | Delete
*
[3274] Fix | Delete
* @deprecated Use your own favicon handling instead
[3275] Fix | Delete
* @return string|bool
[3276] Fix | Delete
*/
[3277] Fix | Delete
public function get_favicon()
[3278] Fix | Delete
{
[3279] Fix | Delete
trigger_error('Favicon handling has been removed since SimplePie 1.3, please use your own handling', \E_USER_DEPRECATED);
[3280] Fix | Delete
[3281] Fix | Delete
if (($url = $this->get_link()) !== null) {
[3282] Fix | Delete
return 'https://www.google.com/s2/favicons?domain=' . urlencode($url);
[3283] Fix | Delete
}
[3284] Fix | Delete
[3285] Fix | Delete
return false;
[3286] Fix | Delete
}
[3287] Fix | Delete
[3288] Fix | Delete
/**
[3289] Fix | Delete
* Magic method handler
[3290] Fix | Delete
*
[3291] Fix | Delete
* @param string $method Method name
[3292] Fix | Delete
* @param array<mixed> $args Arguments to the method
[3293] Fix | Delete
* @return mixed
[3294] Fix | Delete
*/
[3295] Fix | Delete
public function __call(string $method, array $args)
[3296] Fix | Delete
{
[3297] Fix | Delete
if (strpos($method, 'subscribe_') === 0) {
[3298] Fix | Delete
trigger_error('subscribe_*() has been deprecated since SimplePie 1.3, implement the callback yourself', \E_USER_DEPRECATED);
[3299] Fix | Delete
return '';
[3300] Fix | Delete
}
[3301] Fix | Delete
if ($method === 'enable_xml_dump') {
[3302] Fix | Delete
trigger_error('enable_xml_dump() has been deprecated since SimplePie 1.3, use get_raw_data() instead', \E_USER_DEPRECATED);
[3303] Fix | Delete
return false;
[3304] Fix | Delete
}
[3305] Fix | Delete
[3306] Fix | Delete
$class = get_class($this);
[3307] Fix | Delete
$trace = debug_backtrace(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
[3308] Fix | Delete
$file = $trace[0]['file'] ?? '';
[3309] Fix | Delete
$line = $trace[0]['line'] ?? '';
[3310] Fix | Delete
throw new SimplePieException("Call to undefined method $class::$method() in $file on line $line");
[3311] Fix | Delete
}
[3312] Fix | Delete
[3313] Fix | Delete
/**
[3314] Fix | Delete
* Item factory
[3315] Fix | Delete
*
[3316] Fix | Delete
* @param array<string, mixed> $data
[3317] Fix | Delete
*/
[3318] Fix | Delete
private function make_item(array $data): Item
[3319] Fix | Delete
{
[3320] Fix | Delete
$item = $this->registry->create(Item::class, [$this, $data]);
[3321] Fix | Delete
$item->set_sanitize($this->sanitize);
[3322] Fix | Delete
[3323] Fix | Delete
return $item;
[3324] Fix | Delete
}
[3325] Fix | Delete
[3326] Fix | Delete
/**
[3327] Fix | Delete
* Sorting callback for items
[3328] Fix | Delete
*
[3329] Fix | Delete
* @access private
[3330] Fix | Delete
* @param Item $a
[3331] Fix | Delete
* @param Item $b
[3332] Fix | Delete
* @return -1|0|1
[3333] Fix | Delete
*/
[3334] Fix | Delete
public static function sort_items(Item $a, Item $b)
[3335] Fix | Delete
{
[3336] Fix | Delete
$a_date = $a->get_date('U');
[3337] Fix | Delete
$b_date = $b->get_date('U');
[3338] Fix | Delete
if ($a_date && $b_date) {
[3339] Fix | Delete
return $a_date > $b_date ? -1 : 1;
[3340] Fix | Delete
}
[3341] Fix | Delete
// Sort items without dates to the top.
[3342] Fix | Delete
if ($a_date) {
[3343] Fix | Delete
return 1;
[3344] Fix | Delete
}
[3345] Fix | Delete
if ($b_date) {
[3346] Fix | Delete
return -1;
[3347] Fix | Delete
}
[3348] Fix | Delete
return 0;
[3349] Fix | Delete
}
[3350] Fix | Delete
[3351] Fix | Delete
/**
[3352] Fix | Delete
* Merge items from several feeds into one
[3353] Fix | Delete
*
[3354] Fix | Delete
* If you're merging multiple feeds together, they need to all have dates
[3355] Fix | Delete
* for the items or else SimplePie will refuse to sort them.
[3356] Fix | Delete
*
[3357] Fix | Delete
* @link http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date#if_feeds_require_separate_per-feed_settings
[3358] Fix | Delete
* @param array<SimplePie> $urls List of SimplePie feed objects to merge
[3359] Fix | Delete
* @param int $start Starting item
[3360] Fix | Delete
* @param int $end Number of items to return
[3361] Fix | Delete
* @param int $limit Maximum number of items per feed
[3362] Fix | Delete
* @return array<Item>
[3363] Fix | Delete
*/
[3364] Fix | Delete
public static function merge_items(array $urls, int $start = 0, int $end = 0, int $limit = 0)
[3365] Fix | Delete
{
[3366] Fix | Delete
if (count($urls) > 0) {
[3367] Fix | Delete
$items = [];
[3368] Fix | Delete
foreach ($urls as $arg) {
[3369] Fix | Delete
if ($arg instanceof SimplePie) {
[3370] Fix | Delete
$items = array_merge($items, $arg->get_items(0, $limit));
[3371] Fix | Delete
[3372] Fix | Delete
// @phpstan-ignore-next-line Enforce PHPDoc type.
[3373] Fix | Delete
} else {
[3374] Fix | Delete
trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
[3375] Fix | Delete
}
[3376] Fix | Delete
}
[3377] Fix | Delete
[3378] Fix | Delete
usort($items, [get_class($urls[0]), 'sort_items']);
[3379] Fix | Delete
[3380] Fix | Delete
if ($end === 0) {
[3381] Fix | Delete
return array_slice($items, $start);
[3382] Fix | Delete
}
[3383] Fix | Delete
[3384] Fix | Delete
return array_slice($items, $start, $end);
[3385] Fix | Delete
}
[3386] Fix | Delete
[3387] Fix | Delete
trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
[3388] Fix | Delete
return [];
[3389] Fix | Delete
}
[3390] Fix | Delete
[3391] Fix | Delete
/**
[3392] Fix | Delete
* Store PubSubHubbub links as headers
[3393] Fix | Delete
*
[3394] Fix | Delete
* There is no way to find PuSH links in the body of a microformats feed,
[3395] Fix | Delete
* so they are added to the headers when found, to be used later by get_links.
[3396] Fix | Delete
*/
[3397] Fix | Delete
private function store_links(Response $file, ?string $hub, ?string $self): Response
[3398] Fix | Delete
{
[3399] Fix | Delete
$linkHeaderLine = $file->get_header_line('link');
[3400] Fix | Delete
$linkHeader = $file->get_header('link');
[3401] Fix | Delete
[3402] Fix | Delete
if ($hub && !preg_match('/rel=hub/', $linkHeaderLine)) {
[3403] Fix | Delete
$linkHeader[] = '<'.$hub.'>; rel=hub';
[3404] Fix | Delete
}
[3405] Fix | Delete
[3406] Fix | Delete
if ($self && !preg_match('/rel=self/', $linkHeaderLine)) {
[3407] Fix | Delete
$linkHeader[] = '<'.$self.'>; rel=self';
[3408] Fix | Delete
}
[3409] Fix | Delete
[3410] Fix | Delete
if (count($linkHeader) > 0) {
[3411] Fix | Delete
$file = $file->with_header('link', $linkHeader);
[3412] Fix | Delete
}
[3413] Fix | Delete
[3414] Fix | Delete
return $file;
[3415] Fix | Delete
}
[3416] Fix | Delete
[3417] Fix | Delete
/**
[3418] Fix | Delete
* Get a DataCache
[3419] Fix | Delete
*
[3420] Fix | Delete
* @param string $feed_url Only needed for BC, can be removed in SimplePie 2.0.0
[3421] Fix | Delete
*
[3422] Fix | Delete
* @return DataCache
[3423] Fix | Delete
*/
[3424] Fix | Delete
private function get_cache(string $feed_url = ''): DataCache
[3425] Fix | Delete
{
[3426] Fix | Delete
if ($this->cache === null) {
[3427] Fix | Delete
// @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED);
[3428] Fix | Delete
$cache = $this->registry->call(Cache::class, 'get_handler', [
[3429] Fix | Delete
$this->cache_location,
[3430] Fix | Delete
$this->get_cache_filename($feed_url),
[3431] Fix | Delete
Base::TYPE_FEED
[3432] Fix | Delete
]);
[3433] Fix | Delete
[3434] Fix | Delete
return new BaseDataCache($cache);
[3435] Fix | Delete
}
[3436] Fix | Delete
[3437] Fix | Delete
return $this->cache;
[3438] Fix | Delete
}
[3439] Fix | Delete
[3440] Fix | Delete
/**
[3441] Fix | Delete
* Get a HTTP client
[3442] Fix | Delete
*/
[3443] Fix | Delete
private function get_http_client(): Client
[3444] Fix | Delete
{
[3445] Fix | Delete
if ($this->http_client === null) {
[3446] Fix | Delete
$this->http_client = new FileClient(
[3447] Fix | Delete
$this->get_registry(),
[3448] Fix | Delete
[
[3449] Fix | Delete
'timeout' => $this->timeout,
[3450] Fix | Delete
'redirects' => 5,
[3451] Fix | Delete
'useragent' => $this->useragent,
[3452] Fix | Delete
'force_fsockopen' => $this->force_fsockopen,
[3453] Fix | Delete
'curl_options' => $this->curl_options,
[3454] Fix | Delete
]
[3455] Fix | Delete
);
[3456] Fix | Delete
$this->http_client_injected = true;
[3457] Fix | Delete
}
[3458] Fix | Delete
[3459] Fix | Delete
return $this->http_client;
[3460] Fix | Delete
}
[3461] Fix | Delete
}
[3462] Fix | Delete
[3463] Fix | Delete
class_alias('SimplePie\SimplePie', 'SimplePie');
[3464] Fix | Delete
[3465] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function