Edit File by line
/home/barbar84/www/wp-inclu.../SimplePi...
File: Source.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* SimplePie
[2] Fix | Delete
*
[3] Fix | Delete
* A PHP-Based RSS and Atom Feed Framework.
[4] Fix | Delete
* Takes the hard work out of managing a complete RSS/Atom solution.
[5] Fix | Delete
*
[6] Fix | Delete
* Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
[7] Fix | Delete
* All rights reserved.
[8] Fix | Delete
*
[9] Fix | Delete
* Redistribution and use in source and binary forms, with or without modification, are
[10] Fix | Delete
* permitted provided that the following conditions are met:
[11] Fix | Delete
*
[12] Fix | Delete
* * Redistributions of source code must retain the above copyright notice, this list of
[13] Fix | Delete
* conditions and the following disclaimer.
[14] Fix | Delete
*
[15] Fix | Delete
* * Redistributions in binary form must reproduce the above copyright notice, this list
[16] Fix | Delete
* of conditions and the following disclaimer in the documentation and/or other materials
[17] Fix | Delete
* provided with the distribution.
[18] Fix | Delete
*
[19] Fix | Delete
* * Neither the name of the SimplePie Team nor the names of its contributors may be used
[20] Fix | Delete
* to endorse or promote products derived from this software without specific prior
[21] Fix | Delete
* written permission.
[22] Fix | Delete
*
[23] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
[24] Fix | Delete
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
[25] Fix | Delete
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
[26] Fix | Delete
* AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
[27] Fix | Delete
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
[28] Fix | Delete
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
[29] Fix | Delete
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
[30] Fix | Delete
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
[31] Fix | Delete
* POSSIBILITY OF SUCH DAMAGE.
[32] Fix | Delete
*
[33] Fix | Delete
* @package SimplePie
[34] Fix | Delete
* @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
[35] Fix | Delete
* @author Ryan Parman
[36] Fix | Delete
* @author Sam Sneddon
[37] Fix | Delete
* @author Ryan McCue
[38] Fix | Delete
* @link http://simplepie.org/ SimplePie
[39] Fix | Delete
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
[40] Fix | Delete
*/
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Handles `<atom:source>`
[44] Fix | Delete
*
[45] Fix | Delete
* Used by {@see SimplePie_Item::get_source()}
[46] Fix | Delete
*
[47] Fix | Delete
* This class can be overloaded with {@see SimplePie::set_source_class()}
[48] Fix | Delete
*
[49] Fix | Delete
* @package SimplePie
[50] Fix | Delete
* @subpackage API
[51] Fix | Delete
*/
[52] Fix | Delete
class SimplePie_Source
[53] Fix | Delete
{
[54] Fix | Delete
var $item;
[55] Fix | Delete
var $data = array();
[56] Fix | Delete
protected $registry;
[57] Fix | Delete
[58] Fix | Delete
public function __construct($item, $data)
[59] Fix | Delete
{
[60] Fix | Delete
$this->item = $item;
[61] Fix | Delete
$this->data = $data;
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
public function set_registry(SimplePie_Registry $registry)
[65] Fix | Delete
{
[66] Fix | Delete
$this->registry = $registry;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
public function __toString()
[70] Fix | Delete
{
[71] Fix | Delete
return md5(serialize($this->data));
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
public function get_source_tags($namespace, $tag)
[75] Fix | Delete
{
[76] Fix | Delete
if (isset($this->data['child'][$namespace][$tag]))
[77] Fix | Delete
{
[78] Fix | Delete
return $this->data['child'][$namespace][$tag];
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
return null;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
public function get_base($element = array())
[85] Fix | Delete
{
[86] Fix | Delete
return $this->item->get_base($element);
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
public function sanitize($data, $type, $base = '')
[90] Fix | Delete
{
[91] Fix | Delete
return $this->item->sanitize($data, $type, $base);
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
public function get_item()
[95] Fix | Delete
{
[96] Fix | Delete
return $this->item;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
public function get_title()
[100] Fix | Delete
{
[101] Fix | Delete
if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
[102] Fix | Delete
{
[103] 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]));
[104] Fix | Delete
}
[105] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
[106] Fix | Delete
{
[107] 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]));
[108] Fix | Delete
}
[109] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
[110] Fix | Delete
{
[111] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[112] Fix | Delete
}
[113] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
[114] Fix | Delete
{
[115] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[116] Fix | Delete
}
[117] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
[118] Fix | Delete
{
[119] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[120] Fix | Delete
}
[121] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
[122] Fix | Delete
{
[123] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[124] Fix | Delete
}
[125] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
[126] Fix | Delete
{
[127] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
return null;
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
public function get_category($key = 0)
[134] Fix | Delete
{
[135] Fix | Delete
$categories = $this->get_categories();
[136] Fix | Delete
if (isset($categories[$key]))
[137] Fix | Delete
{
[138] Fix | Delete
return $categories[$key];
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
return null;
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
public function get_categories()
[145] Fix | Delete
{
[146] Fix | Delete
$categories = array();
[147] Fix | Delete
[148] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
[149] Fix | Delete
{
[150] Fix | Delete
$term = null;
[151] Fix | Delete
$scheme = null;
[152] Fix | Delete
$label = null;
[153] Fix | Delete
if (isset($category['attribs']['']['term']))
[154] Fix | Delete
{
[155] Fix | Delete
$term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
[156] Fix | Delete
}
[157] Fix | Delete
if (isset($category['attribs']['']['scheme']))
[158] Fix | Delete
{
[159] Fix | Delete
$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
[160] Fix | Delete
}
[161] Fix | Delete
if (isset($category['attribs']['']['label']))
[162] Fix | Delete
{
[163] Fix | Delete
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
[164] Fix | Delete
}
[165] Fix | Delete
$categories[] = $this->registry->create('Category', array($term, $scheme, $label));
[166] Fix | Delete
}
[167] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
[168] Fix | Delete
{
[169] Fix | Delete
// This is really the label, but keep this as the term also for BC.
[170] Fix | Delete
// Label will also work on retrieving because that falls back to term.
[171] Fix | Delete
$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[172] Fix | Delete
if (isset($category['attribs']['']['domain']))
[173] Fix | Delete
{
[174] Fix | Delete
$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
[175] Fix | Delete
}
[176] Fix | Delete
else
[177] Fix | Delete
{
[178] Fix | Delete
$scheme = null;
[179] Fix | Delete
}
[180] Fix | Delete
$categories[] = $this->registry->create('Category', array($term, $scheme, null));
[181] Fix | Delete
}
[182] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
[183] Fix | Delete
{
[184] Fix | Delete
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[185] Fix | Delete
}
[186] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
[187] Fix | Delete
{
[188] Fix | Delete
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[189] Fix | Delete
}
[190] Fix | Delete
[191] Fix | Delete
if (!empty($categories))
[192] Fix | Delete
{
[193] Fix | Delete
return array_unique($categories);
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
return null;
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
public function get_author($key = 0)
[200] Fix | Delete
{
[201] Fix | Delete
$authors = $this->get_authors();
[202] Fix | Delete
if (isset($authors[$key]))
[203] Fix | Delete
{
[204] Fix | Delete
return $authors[$key];
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
return null;
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
public function get_authors()
[211] Fix | Delete
{
[212] Fix | Delete
$authors = array();
[213] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
[214] Fix | Delete
{
[215] Fix | Delete
$name = null;
[216] Fix | Delete
$uri = null;
[217] Fix | Delete
$email = null;
[218] Fix | Delete
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
[219] Fix | Delete
{
[220] Fix | Delete
$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[221] Fix | Delete
}
[222] Fix | Delete
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
[223] Fix | Delete
{
[224] 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]));
[225] Fix | Delete
}
[226] Fix | Delete
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
[227] Fix | Delete
{
[228] Fix | Delete
$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[229] Fix | Delete
}
[230] Fix | Delete
if ($name !== null || $email !== null || $uri !== null)
[231] Fix | Delete
{
[232] Fix | Delete
$authors[] = $this->registry->create('Author', array($name, $uri, $email));
[233] Fix | Delete
}
[234] Fix | Delete
}
[235] Fix | Delete
if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
[236] Fix | Delete
{
[237] Fix | Delete
$name = null;
[238] Fix | Delete
$url = null;
[239] Fix | Delete
$email = null;
[240] Fix | Delete
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
[241] Fix | Delete
{
[242] Fix | Delete
$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[243] Fix | Delete
}
[244] Fix | Delete
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
[245] Fix | Delete
{
[246] 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]));
[247] Fix | Delete
}
[248] Fix | Delete
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
[249] Fix | Delete
{
[250] Fix | Delete
$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[251] Fix | Delete
}
[252] Fix | Delete
if ($name !== null || $email !== null || $url !== null)
[253] Fix | Delete
{
[254] Fix | Delete
$authors[] = $this->registry->create('Author', array($name, $url, $email));
[255] Fix | Delete
}
[256] Fix | Delete
}
[257] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
[258] Fix | Delete
{
[259] Fix | Delete
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[260] Fix | Delete
}
[261] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
[262] Fix | Delete
{
[263] Fix | Delete
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[264] Fix | Delete
}
[265] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
[266] Fix | Delete
{
[267] Fix | Delete
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
if (!empty($authors))
[271] Fix | Delete
{
[272] Fix | Delete
return array_unique($authors);
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
return null;
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
public function get_contributor($key = 0)
[279] Fix | Delete
{
[280] Fix | Delete
$contributors = $this->get_contributors();
[281] Fix | Delete
if (isset($contributors[$key]))
[282] Fix | Delete
{
[283] Fix | Delete
return $contributors[$key];
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
return null;
[287] Fix | Delete
}
[288] Fix | Delete
[289] Fix | Delete
public function get_contributors()
[290] Fix | Delete
{
[291] Fix | Delete
$contributors = array();
[292] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
[293] Fix | Delete
{
[294] Fix | Delete
$name = null;
[295] Fix | Delete
$uri = null;
[296] Fix | Delete
$email = null;
[297] Fix | Delete
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
[298] Fix | Delete
{
[299] Fix | Delete
$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[300] Fix | Delete
}
[301] Fix | Delete
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
[302] Fix | Delete
{
[303] Fix | Delete
$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
[304] Fix | Delete
}
[305] Fix | Delete
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
[306] Fix | Delete
{
[307] Fix | Delete
$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[308] Fix | Delete
}
[309] Fix | Delete
if ($name !== null || $email !== null || $uri !== null)
[310] Fix | Delete
{
[311] Fix | Delete
$contributors[] = $this->registry->create('Author', array($name, $uri, $email));
[312] Fix | Delete
}
[313] Fix | Delete
}
[314] Fix | Delete
foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
[315] Fix | Delete
{
[316] Fix | Delete
$name = null;
[317] Fix | Delete
$url = null;
[318] Fix | Delete
$email = null;
[319] Fix | Delete
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
[320] Fix | Delete
{
[321] Fix | Delete
$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[322] Fix | Delete
}
[323] Fix | Delete
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
[324] Fix | Delete
{
[325] Fix | Delete
$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
[326] Fix | Delete
}
[327] Fix | Delete
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
[328] Fix | Delete
{
[329] Fix | Delete
$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[330] Fix | Delete
}
[331] Fix | Delete
if ($name !== null || $email !== null || $url !== null)
[332] Fix | Delete
{
[333] Fix | Delete
$contributors[] = $this->registry->create('Author', array($name, $url, $email));
[334] Fix | Delete
}
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
if (!empty($contributors))
[338] Fix | Delete
{
[339] Fix | Delete
return array_unique($contributors);
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
return null;
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
public function get_link($key = 0, $rel = 'alternate')
[346] Fix | Delete
{
[347] Fix | Delete
$links = $this->get_links($rel);
[348] Fix | Delete
if (isset($links[$key]))
[349] Fix | Delete
{
[350] Fix | Delete
return $links[$key];
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
return null;
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
/**
[357] Fix | Delete
* Added for parity between the parent-level and the item/entry-level.
[358] Fix | Delete
*/
[359] Fix | Delete
public function get_permalink()
[360] Fix | Delete
{
[361] Fix | Delete
return $this->get_link(0);
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
public function get_links($rel = 'alternate')
[365] Fix | Delete
{
[366] Fix | Delete
if (!isset($this->data['links']))
[367] Fix | Delete
{
[368] Fix | Delete
$this->data['links'] = array();
[369] Fix | Delete
if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
[370] Fix | Delete
{
[371] Fix | Delete
foreach ($links as $link)
[372] Fix | Delete
{
[373] Fix | Delete
if (isset($link['attribs']['']['href']))
[374] Fix | Delete
{
[375] Fix | Delete
$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
[376] Fix | Delete
$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
[377] Fix | Delete
}
[378] Fix | Delete
}
[379] Fix | Delete
}
[380] Fix | Delete
if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
[381] Fix | Delete
{
[382] Fix | Delete
foreach ($links as $link)
[383] Fix | Delete
{
[384] Fix | Delete
if (isset($link['attribs']['']['href']))
[385] Fix | Delete
{
[386] Fix | Delete
$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
[387] Fix | Delete
$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
[388] Fix | Delete
[389] Fix | Delete
}
[390] Fix | Delete
}
[391] Fix | Delete
}
[392] Fix | Delete
if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
[393] Fix | Delete
{
[394] Fix | Delete
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
[395] Fix | Delete
}
[396] Fix | Delete
if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
[397] Fix | Delete
{
[398] Fix | Delete
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
[399] Fix | Delete
}
[400] Fix | Delete
if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
[401] Fix | Delete
{
[402] Fix | Delete
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
$keys = array_keys($this->data['links']);
[406] Fix | Delete
foreach ($keys as $key)
[407] Fix | Delete
{
[408] Fix | Delete
if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
[409] Fix | Delete
{
[410] Fix | Delete
if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
[411] Fix | Delete
{
[412] Fix | Delete
$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
[413] Fix | Delete
$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
[414] Fix | Delete
}
[415] Fix | Delete
else
[416] Fix | Delete
{
[417] Fix | Delete
$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
[418] Fix | Delete
}
[419] Fix | Delete
}
[420] Fix | Delete
elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
[421] Fix | Delete
{
[422] Fix | Delete
$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
[423] Fix | Delete
}
[424] Fix | Delete
$this->data['links'][$key] = array_unique($this->data['links'][$key]);
[425] Fix | Delete
}
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
if (isset($this->data['links'][$rel]))
[429] Fix | Delete
{
[430] Fix | Delete
return $this->data['links'][$rel];
[431] Fix | Delete
}
[432] Fix | Delete
[433] Fix | Delete
return null;
[434] Fix | Delete
}
[435] Fix | Delete
[436] Fix | Delete
public function get_description()
[437] Fix | Delete
{
[438] Fix | Delete
if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
[439] Fix | Delete
{
[440] 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]));
[441] Fix | Delete
}
[442] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
[443] Fix | Delete
{
[444] 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]));
[445] Fix | Delete
}
[446] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
[447] Fix | Delete
{
[448] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[449] Fix | Delete
}
[450] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
[451] Fix | Delete
{
[452] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[453] Fix | Delete
}
[454] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
[455] Fix | Delete
{
[456] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
[457] Fix | Delete
}
[458] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
[459] Fix | Delete
{
[460] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[461] Fix | Delete
}
[462] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
[463] Fix | Delete
{
[464] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[465] Fix | Delete
}
[466] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
[467] Fix | Delete
{
[468] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
[469] Fix | Delete
}
[470] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
[471] Fix | Delete
{
[472] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
[473] Fix | Delete
}
[474] Fix | Delete
[475] Fix | Delete
return null;
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
public function get_copyright()
[479] Fix | Delete
{
[480] Fix | Delete
if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
[481] Fix | Delete
{
[482] 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]));
[483] Fix | Delete
}
[484] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
[485] Fix | Delete
{
[486] 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]));
[487] Fix | Delete
}
[488] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
[489] Fix | Delete
{
[490] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[491] Fix | Delete
}
[492] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
[493] Fix | Delete
{
[494] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[495] Fix | Delete
}
[496] Fix | Delete
elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
[497] Fix | Delete
{
[498] Fix | Delete
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function