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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: class-simplepie.php
else
[2000] Fix | Delete
{
[2001] Fix | Delete
$this->data['type'] = SIMPLEPIE_TYPE_NONE;
[2002] Fix | Delete
}
[2003] Fix | Delete
}
[2004] Fix | Delete
return $this->data['type'];
[2005] Fix | Delete
}
[2006] Fix | Delete
[2007] Fix | Delete
/**
[2008] Fix | Delete
* Get the URL for the feed
[2009] Fix | Delete
*
[2010] Fix | Delete
* When the 'permanent' mode is enabled, returns the original feed URL,
[2011] Fix | Delete
* except in the case of an `HTTP 301 Moved Permanently` status response,
[2012] Fix | Delete
* in which case the location of the first redirection is returned.
[2013] Fix | Delete
*
[2014] Fix | Delete
* When the 'permanent' mode is disabled (default),
[2015] Fix | Delete
* may or may not be different from the URL passed to {@see set_feed_url()},
[2016] Fix | Delete
* depending on whether auto-discovery was used, and whether there were
[2017] Fix | Delete
* any redirects along the way.
[2018] Fix | Delete
*
[2019] Fix | Delete
* @since Preview Release (previously called `get_feed_url()` since SimplePie 0.8.)
[2020] Fix | Delete
* @todo Support <itunes:new-feed-url>
[2021] Fix | Delete
* @todo Also, |atom:link|@rel=self
[2022] Fix | Delete
* @param bool $permanent Permanent mode to return only the original URL or the first redirection
[2023] Fix | Delete
* iff it is a 301 redirection
[2024] Fix | Delete
* @return string|null
[2025] Fix | Delete
*/
[2026] Fix | Delete
public function subscribe_url($permanent = false)
[2027] Fix | Delete
{
[2028] Fix | Delete
if ($permanent)
[2029] Fix | Delete
{
[2030] Fix | Delete
if ($this->permanent_url !== null)
[2031] Fix | Delete
{
[2032] Fix | Delete
// sanitize encodes ampersands which are required when used in a url.
[2033] Fix | Delete
return str_replace('&amp;', '&',
[2034] Fix | Delete
$this->sanitize($this->permanent_url,
[2035] Fix | Delete
SIMPLEPIE_CONSTRUCT_IRI));
[2036] Fix | Delete
}
[2037] Fix | Delete
}
[2038] Fix | Delete
else
[2039] Fix | Delete
{
[2040] Fix | Delete
if ($this->feed_url !== null)
[2041] Fix | Delete
{
[2042] Fix | Delete
return str_replace('&amp;', '&',
[2043] Fix | Delete
$this->sanitize($this->feed_url,
[2044] Fix | Delete
SIMPLEPIE_CONSTRUCT_IRI));
[2045] Fix | Delete
}
[2046] Fix | Delete
}
[2047] Fix | Delete
return null;
[2048] Fix | Delete
}
[2049] Fix | Delete
[2050] Fix | Delete
/**
[2051] Fix | Delete
* Get data for an feed-level element
[2052] Fix | Delete
*
[2053] Fix | Delete
* This method allows you to get access to ANY element/attribute that is a
[2054] Fix | Delete
* sub-element of the opening feed tag.
[2055] Fix | Delete
*
[2056] Fix | Delete
* The return value is an indexed array of elements matching the given
[2057] Fix | Delete
* namespace and tag name. Each element has `attribs`, `data` and `child`
[2058] Fix | Delete
* subkeys. For `attribs` and `child`, these contain namespace subkeys.
[2059] Fix | Delete
* `attribs` then has one level of associative name => value data (where
[2060] Fix | Delete
* `value` is a string) after the namespace. `child` has tag-indexed keys
[2061] Fix | Delete
* after the namespace, each member of which is an indexed array matching
[2062] Fix | Delete
* this same format.
[2063] Fix | Delete
*
[2064] Fix | Delete
* For example:
[2065] Fix | Delete
* <pre>
[2066] Fix | Delete
* // This is probably a bad example because we already support
[2067] Fix | Delete
* // <media:content> natively, but it shows you how to parse through
[2068] Fix | Delete
* // the nodes.
[2069] Fix | Delete
* $group = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group');
[2070] Fix | Delete
* $content = $group[0]['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'];
[2071] Fix | Delete
* $file = $content[0]['attribs']['']['url'];
[2072] Fix | Delete
* echo $file;
[2073] Fix | Delete
* </pre>
[2074] Fix | Delete
*
[2075] Fix | Delete
* @since 1.0
[2076] Fix | Delete
* @see http://simplepie.org/wiki/faq/supported_xml_namespaces
[2077] Fix | Delete
* @param string $namespace The URL of the XML namespace of the elements you're trying to access
[2078] Fix | Delete
* @param string $tag Tag name
[2079] Fix | Delete
* @return array
[2080] Fix | Delete
*/
[2081] Fix | Delete
public function get_feed_tags($namespace, $tag)
[2082] Fix | Delete
{
[2083] Fix | Delete
$type = $this->get_type();
[2084] Fix | Delete
if ($type & SIMPLEPIE_TYPE_ATOM_10)
[2085] Fix | Delete
{
[2086] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag]))
[2087] Fix | Delete
{
[2088] Fix | Delete
return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag];
[2089] Fix | Delete
}
[2090] Fix | Delete
}
[2091] Fix | Delete
if ($type & SIMPLEPIE_TYPE_ATOM_03)
[2092] Fix | Delete
{
[2093] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag]))
[2094] Fix | Delete
{
[2095] Fix | Delete
return $this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag];
[2096] Fix | Delete
}
[2097] Fix | Delete
}
[2098] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_RDF)
[2099] Fix | Delete
{
[2100] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag]))
[2101] Fix | Delete
{
[2102] Fix | Delete
return $this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag];
[2103] Fix | Delete
}
[2104] Fix | Delete
}
[2105] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
[2106] Fix | Delete
{
[2107] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag]))
[2108] Fix | Delete
{
[2109] Fix | Delete
return $this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag];
[2110] Fix | Delete
}
[2111] Fix | Delete
}
[2112] Fix | Delete
return null;
[2113] Fix | Delete
}
[2114] Fix | Delete
[2115] Fix | Delete
/**
[2116] Fix | Delete
* Get data for an channel-level element
[2117] Fix | Delete
*
[2118] Fix | Delete
* This method allows you to get access to ANY element/attribute in the
[2119] Fix | Delete
* channel/header section of the feed.
[2120] Fix | Delete
*
[2121] Fix | Delete
* See {@see SimplePie::get_feed_tags()} for a description of the return value
[2122] Fix | Delete
*
[2123] Fix | Delete
* @since 1.0
[2124] Fix | Delete
* @see http://simplepie.org/wiki/faq/supported_xml_namespaces
[2125] Fix | Delete
* @param string $namespace The URL of the XML namespace of the elements you're trying to access
[2126] Fix | Delete
* @param string $tag Tag name
[2127] Fix | Delete
* @return array
[2128] Fix | Delete
*/
[2129] Fix | Delete
public function get_channel_tags($namespace, $tag)
[2130] Fix | Delete
{
[2131] Fix | Delete
$type = $this->get_type();
[2132] Fix | Delete
if ($type & SIMPLEPIE_TYPE_ATOM_ALL)
[2133] Fix | Delete
{
[2134] Fix | Delete
if ($return = $this->get_feed_tags($namespace, $tag))
[2135] Fix | Delete
{
[2136] Fix | Delete
return $return;
[2137] Fix | Delete
}
[2138] Fix | Delete
}
[2139] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_10)
[2140] Fix | Delete
{
[2141] Fix | Delete
if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'channel'))
[2142] Fix | Delete
{
[2143] Fix | Delete
if (isset($channel[0]['child'][$namespace][$tag]))
[2144] Fix | Delete
{
[2145] Fix | Delete
return $channel[0]['child'][$namespace][$tag];
[2146] Fix | Delete
}
[2147] Fix | Delete
}
[2148] Fix | Delete
}
[2149] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_090)
[2150] Fix | Delete
{
[2151] Fix | Delete
if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'channel'))
[2152] Fix | Delete
{
[2153] Fix | Delete
if (isset($channel[0]['child'][$namespace][$tag]))
[2154] Fix | Delete
{
[2155] Fix | Delete
return $channel[0]['child'][$namespace][$tag];
[2156] Fix | Delete
}
[2157] Fix | Delete
}
[2158] Fix | Delete
}
[2159] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
[2160] Fix | Delete
{
[2161] Fix | Delete
if ($channel = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'channel'))
[2162] Fix | Delete
{
[2163] Fix | Delete
if (isset($channel[0]['child'][$namespace][$tag]))
[2164] Fix | Delete
{
[2165] Fix | Delete
return $channel[0]['child'][$namespace][$tag];
[2166] Fix | Delete
}
[2167] Fix | Delete
}
[2168] Fix | Delete
}
[2169] Fix | Delete
return null;
[2170] Fix | Delete
}
[2171] Fix | Delete
[2172] Fix | Delete
/**
[2173] Fix | Delete
* Get data for an channel-level element
[2174] Fix | Delete
*
[2175] Fix | Delete
* This method allows you to get access to ANY element/attribute in the
[2176] Fix | Delete
* image/logo section of the feed.
[2177] Fix | Delete
*
[2178] Fix | Delete
* See {@see SimplePie::get_feed_tags()} for a description of the return value
[2179] Fix | Delete
*
[2180] Fix | Delete
* @since 1.0
[2181] Fix | Delete
* @see http://simplepie.org/wiki/faq/supported_xml_namespaces
[2182] Fix | Delete
* @param string $namespace The URL of the XML namespace of the elements you're trying to access
[2183] Fix | Delete
* @param string $tag Tag name
[2184] Fix | Delete
* @return array
[2185] Fix | Delete
*/
[2186] Fix | Delete
public function get_image_tags($namespace, $tag)
[2187] Fix | Delete
{
[2188] Fix | Delete
$type = $this->get_type();
[2189] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_10)
[2190] Fix | Delete
{
[2191] Fix | Delete
if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'image'))
[2192] Fix | Delete
{
[2193] Fix | Delete
if (isset($image[0]['child'][$namespace][$tag]))
[2194] Fix | Delete
{
[2195] Fix | Delete
return $image[0]['child'][$namespace][$tag];
[2196] Fix | Delete
}
[2197] Fix | Delete
}
[2198] Fix | Delete
}
[2199] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_090)
[2200] Fix | Delete
{
[2201] Fix | Delete
if ($image = $this->get_feed_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'image'))
[2202] Fix | Delete
{
[2203] Fix | Delete
if (isset($image[0]['child'][$namespace][$tag]))
[2204] Fix | Delete
{
[2205] Fix | Delete
return $image[0]['child'][$namespace][$tag];
[2206] Fix | Delete
}
[2207] Fix | Delete
}
[2208] Fix | Delete
}
[2209] Fix | Delete
if ($type & SIMPLEPIE_TYPE_RSS_SYNDICATION)
[2210] Fix | Delete
{
[2211] Fix | Delete
if ($image = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'image'))
[2212] Fix | Delete
{
[2213] Fix | Delete
if (isset($image[0]['child'][$namespace][$tag]))
[2214] Fix | Delete
{
[2215] Fix | Delete
return $image[0]['child'][$namespace][$tag];
[2216] Fix | Delete
}
[2217] Fix | Delete
}
[2218] Fix | Delete
}
[2219] Fix | Delete
return null;
[2220] Fix | Delete
}
[2221] Fix | Delete
[2222] Fix | Delete
/**
[2223] Fix | Delete
* Get the base URL value from the feed
[2224] Fix | Delete
*
[2225] Fix | Delete
* Uses `<xml:base>` if available, otherwise uses the first link in the
[2226] Fix | Delete
* feed, or failing that, the URL of the feed itself.
[2227] Fix | Delete
*
[2228] Fix | Delete
* @see get_link
[2229] Fix | Delete
* @see subscribe_url
[2230] Fix | Delete
*
[2231] Fix | Delete
* @param array $element
[2232] Fix | Delete
* @return string
[2233] Fix | Delete
*/
[2234] Fix | Delete
public function get_base($element = array())
[2235] Fix | Delete
{
[2236] Fix | Delete
if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base']))
[2237] Fix | Delete
{
[2238] Fix | Delete
return $element['xml_base'];
[2239] Fix | Delete
}
[2240] Fix | Delete
elseif ($this->get_link() !== null)
[2241] Fix | Delete
{
[2242] Fix | Delete
return $this->get_link();
[2243] Fix | Delete
}
[2244] Fix | Delete
[2245] Fix | Delete
return $this->subscribe_url();
[2246] Fix | Delete
}
[2247] Fix | Delete
[2248] Fix | Delete
/**
[2249] Fix | Delete
* Sanitize feed data
[2250] Fix | Delete
*
[2251] Fix | Delete
* @access private
[2252] Fix | Delete
* @see SimplePie_Sanitize::sanitize()
[2253] Fix | Delete
* @param string $data Data to sanitize
[2254] Fix | Delete
* @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants
[2255] Fix | Delete
* @param string $base Base URL to resolve URLs against
[2256] Fix | Delete
* @return string Sanitized data
[2257] Fix | Delete
*/
[2258] Fix | Delete
public function sanitize($data, $type, $base = '')
[2259] Fix | Delete
{
[2260] Fix | Delete
try
[2261] Fix | Delete
{
[2262] Fix | Delete
return $this->sanitize->sanitize($data, $type, $base);
[2263] Fix | Delete
}
[2264] Fix | Delete
catch (SimplePie_Exception $e)
[2265] Fix | Delete
{
[2266] Fix | Delete
if (!$this->enable_exceptions)
[2267] Fix | Delete
{
[2268] Fix | Delete
$this->error = $e->getMessage();
[2269] Fix | Delete
$this->registry->call('Misc', 'error', array($this->error, E_USER_WARNING, $e->getFile(), $e->getLine()));
[2270] Fix | Delete
return '';
[2271] Fix | Delete
}
[2272] Fix | Delete
[2273] Fix | Delete
throw $e;
[2274] Fix | Delete
}
[2275] Fix | Delete
}
[2276] Fix | Delete
[2277] Fix | Delete
/**
[2278] Fix | Delete
* Get the title of the feed
[2279] Fix | Delete
*
[2280] Fix | Delete
* Uses `<atom:title>`, `<title>` or `<dc:title>`
[2281] Fix | Delete
*
[2282] Fix | Delete
* @since 1.0 (previously called `get_feed_title` since 0.8)
[2283] Fix | Delete
* @return string|null
[2284] Fix | Delete
*/
[2285] Fix | Delete
public function get_title()
[2286] Fix | Delete
{
[2287] Fix | Delete
if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
[2288] Fix | Delete
{
[2289] Fix | Delete
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
[2290] Fix | Delete
}
[2291] Fix | Delete
elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
[2292] Fix | Delete
{
[2293] Fix | Delete
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
[2294] Fix | Delete
}
[2295] Fix | Delete
elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
[2296] Fix | Delete
{
[2297] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[2298] Fix | Delete
}
[2299] Fix | Delete
elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
[2300] Fix | Delete
{
[2301] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[2302] Fix | Delete
}
[2303] Fix | Delete
elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
[2304] Fix | Delete
{
[2305] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[2306] Fix | Delete
}
[2307] Fix | Delete
elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
[2308] Fix | Delete
{
[2309] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2310] Fix | Delete
}
[2311] Fix | Delete
elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
[2312] Fix | Delete
{
[2313] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2314] Fix | Delete
}
[2315] Fix | Delete
[2316] Fix | Delete
return null;
[2317] Fix | Delete
}
[2318] Fix | Delete
[2319] Fix | Delete
/**
[2320] Fix | Delete
* Get a category for the feed
[2321] Fix | Delete
*
[2322] Fix | Delete
* @since Unknown
[2323] Fix | Delete
* @param int $key The category that you want to return. Remember that arrays begin with 0, not 1
[2324] Fix | Delete
* @return SimplePie_Category|null
[2325] Fix | Delete
*/
[2326] Fix | Delete
public function get_category($key = 0)
[2327] Fix | Delete
{
[2328] Fix | Delete
$categories = $this->get_categories();
[2329] Fix | Delete
if (isset($categories[$key]))
[2330] Fix | Delete
{
[2331] Fix | Delete
return $categories[$key];
[2332] Fix | Delete
}
[2333] Fix | Delete
[2334] Fix | Delete
return null;
[2335] Fix | Delete
}
[2336] Fix | Delete
[2337] Fix | Delete
/**
[2338] Fix | Delete
* Get all categories for the feed
[2339] Fix | Delete
*
[2340] Fix | Delete
* Uses `<atom:category>`, `<category>` or `<dc:subject>`
[2341] Fix | Delete
*
[2342] Fix | Delete
* @since Unknown
[2343] Fix | Delete
* @return array|null List of {@see SimplePie_Category} objects
[2344] Fix | Delete
*/
[2345] Fix | Delete
public function get_categories()
[2346] Fix | Delete
{
[2347] Fix | Delete
$categories = array();
[2348] Fix | Delete
[2349] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
[2350] Fix | Delete
{
[2351] Fix | Delete
$term = null;
[2352] Fix | Delete
$scheme = null;
[2353] Fix | Delete
$label = null;
[2354] Fix | Delete
if (isset($category['attribs']['']['term']))
[2355] Fix | Delete
{
[2356] Fix | Delete
$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
[2357] Fix | Delete
}
[2358] Fix | Delete
if (isset($category['attribs']['']['scheme']))
[2359] Fix | Delete
{
[2360] Fix | Delete
$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
[2361] Fix | Delete
}
[2362] Fix | Delete
if (isset($category['attribs']['']['label']))
[2363] Fix | Delete
{
[2364] Fix | Delete
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
[2365] Fix | Delete
}
[2366] Fix | Delete
$categories[] = $this->registry->create('Category', array($term, $scheme, $label));
[2367] Fix | Delete
}
[2368] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
[2369] Fix | Delete
{
[2370] Fix | Delete
// This is really the label, but keep this as the term also for BC.
[2371] Fix | Delete
// Label will also work on retrieving because that falls back to term.
[2372] Fix | Delete
$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2373] Fix | Delete
if (isset($category['attribs']['']['domain']))
[2374] Fix | Delete
{
[2375] Fix | Delete
$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
[2376] Fix | Delete
}
[2377] Fix | Delete
else
[2378] Fix | Delete
{
[2379] Fix | Delete
$scheme = null;
[2380] Fix | Delete
}
[2381] Fix | Delete
$categories[] = $this->registry->create('Category', array($term, $scheme, null));
[2382] Fix | Delete
}
[2383] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
[2384] Fix | Delete
{
[2385] Fix | Delete
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[2386] Fix | Delete
}
[2387] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
[2388] Fix | Delete
{
[2389] Fix | Delete
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[2390] Fix | Delete
}
[2391] Fix | Delete
[2392] Fix | Delete
if (!empty($categories))
[2393] Fix | Delete
{
[2394] Fix | Delete
return array_unique($categories);
[2395] Fix | Delete
}
[2396] Fix | Delete
[2397] Fix | Delete
return null;
[2398] Fix | Delete
}
[2399] Fix | Delete
[2400] Fix | Delete
/**
[2401] Fix | Delete
* Get an author for the feed
[2402] Fix | Delete
*
[2403] Fix | Delete
* @since 1.1
[2404] Fix | Delete
* @param int $key The author that you want to return. Remember that arrays begin with 0, not 1
[2405] Fix | Delete
* @return SimplePie_Author|null
[2406] Fix | Delete
*/
[2407] Fix | Delete
public function get_author($key = 0)
[2408] Fix | Delete
{
[2409] Fix | Delete
$authors = $this->get_authors();
[2410] Fix | Delete
if (isset($authors[$key]))
[2411] Fix | Delete
{
[2412] Fix | Delete
return $authors[$key];
[2413] Fix | Delete
}
[2414] Fix | Delete
[2415] Fix | Delete
return null;
[2416] Fix | Delete
}
[2417] Fix | Delete
[2418] Fix | Delete
/**
[2419] Fix | Delete
* Get all authors for the feed
[2420] Fix | Delete
*
[2421] Fix | Delete
* Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
[2422] Fix | Delete
*
[2423] Fix | Delete
* @since 1.1
[2424] Fix | Delete
* @return array|null List of {@see SimplePie_Author} objects
[2425] Fix | Delete
*/
[2426] Fix | Delete
public function get_authors()
[2427] Fix | Delete
{
[2428] Fix | Delete
$authors = array();
[2429] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
[2430] Fix | Delete
{
[2431] Fix | Delete
$name = null;
[2432] Fix | Delete
$uri = null;
[2433] Fix | Delete
$email = null;
[2434] Fix | Delete
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
[2435] Fix | Delete
{
[2436] Fix | Delete
$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2437] Fix | Delete
}
[2438] Fix | Delete
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
[2439] Fix | Delete
{
[2440] Fix | Delete
$uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
[2441] Fix | Delete
}
[2442] Fix | Delete
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
[2443] Fix | Delete
{
[2444] Fix | Delete
$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2445] Fix | Delete
}
[2446] Fix | Delete
if ($name !== null || $email !== null || $uri !== null)
[2447] Fix | Delete
{
[2448] Fix | Delete
$authors[] = $this->registry->create('Author', array($name, $uri, $email));
[2449] Fix | Delete
}
[2450] Fix | Delete
}
[2451] Fix | Delete
if ($author = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
[2452] Fix | Delete
{
[2453] Fix | Delete
$name = null;
[2454] Fix | Delete
$url = null;
[2455] Fix | Delete
$email = null;
[2456] Fix | Delete
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
[2457] Fix | Delete
{
[2458] Fix | Delete
$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2459] Fix | Delete
}
[2460] Fix | Delete
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
[2461] Fix | Delete
{
[2462] Fix | Delete
$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
[2463] Fix | Delete
}
[2464] Fix | Delete
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
[2465] Fix | Delete
{
[2466] Fix | Delete
$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[2467] Fix | Delete
}
[2468] Fix | Delete
if ($name !== null || $email !== null || $url !== null)
[2469] Fix | Delete
{
[2470] Fix | Delete
$authors[] = $this->registry->create('Author', array($name, $url, $email));
[2471] Fix | Delete
}
[2472] Fix | Delete
}
[2473] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
[2474] Fix | Delete
{
[2475] Fix | Delete
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[2476] Fix | Delete
}
[2477] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
[2478] Fix | Delete
{
[2479] Fix | Delete
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[2480] Fix | Delete
}
[2481] Fix | Delete
foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
[2482] Fix | Delete
{
[2483] Fix | Delete
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[2484] Fix | Delete
}
[2485] Fix | Delete
[2486] Fix | Delete
if (!empty($authors))
[2487] Fix | Delete
{
[2488] Fix | Delete
return array_unique($authors);
[2489] Fix | Delete
}
[2490] Fix | Delete
[2491] Fix | Delete
return null;
[2492] Fix | Delete
}
[2493] Fix | Delete
[2494] Fix | Delete
/**
[2495] Fix | Delete
* Get a contributor for the feed
[2496] Fix | Delete
*
[2497] Fix | Delete
* @since 1.1
[2498] Fix | Delete
* @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function