Edit File by line
/home/barbar84/www/wp-inclu.../SimplePi...
File: Enclosure.php
* Get the preferred handler
[500] Fix | Delete
*
[501] Fix | Delete
* @return string|null One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'
[502] Fix | Delete
*/
[503] Fix | Delete
public function get_handler()
[504] Fix | Delete
{
[505] Fix | Delete
return $this->get_real_type(true);
[506] Fix | Delete
}
[507] Fix | Delete
[508] Fix | Delete
/**
[509] Fix | Delete
* Get a single hash
[510] Fix | Delete
*
[511] Fix | Delete
* @link http://www.rssboard.org/media-rss#media-hash
[512] Fix | Delete
* @param int $key
[513] Fix | Delete
* @return string|null Hash as per `media:hash`, prefixed with "$algo:"
[514] Fix | Delete
*/
[515] Fix | Delete
public function get_hash($key = 0)
[516] Fix | Delete
{
[517] Fix | Delete
$hashes = $this->get_hashes();
[518] Fix | Delete
if (isset($hashes[$key]))
[519] Fix | Delete
{
[520] Fix | Delete
return $hashes[$key];
[521] Fix | Delete
}
[522] Fix | Delete
[523] Fix | Delete
return null;
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
/**
[527] Fix | Delete
* Get all credits
[528] Fix | Delete
*
[529] Fix | Delete
* @return array|null Array of strings, see {@see get_hash()}
[530] Fix | Delete
*/
[531] Fix | Delete
public function get_hashes()
[532] Fix | Delete
{
[533] Fix | Delete
if ($this->hashes !== null)
[534] Fix | Delete
{
[535] Fix | Delete
return $this->hashes;
[536] Fix | Delete
}
[537] Fix | Delete
[538] Fix | Delete
return null;
[539] Fix | Delete
}
[540] Fix | Delete
[541] Fix | Delete
/**
[542] Fix | Delete
* Get the height
[543] Fix | Delete
*
[544] Fix | Delete
* @return string|null
[545] Fix | Delete
*/
[546] Fix | Delete
public function get_height()
[547] Fix | Delete
{
[548] Fix | Delete
if ($this->height !== null)
[549] Fix | Delete
{
[550] Fix | Delete
return $this->height;
[551] Fix | Delete
}
[552] Fix | Delete
[553] Fix | Delete
return null;
[554] Fix | Delete
}
[555] Fix | Delete
[556] Fix | Delete
/**
[557] Fix | Delete
* Get the language
[558] Fix | Delete
*
[559] Fix | Delete
* @link http://tools.ietf.org/html/rfc3066
[560] Fix | Delete
* @return string|null Language code as per RFC 3066
[561] Fix | Delete
*/
[562] Fix | Delete
public function get_language()
[563] Fix | Delete
{
[564] Fix | Delete
if ($this->lang !== null)
[565] Fix | Delete
{
[566] Fix | Delete
return $this->lang;
[567] Fix | Delete
}
[568] Fix | Delete
[569] Fix | Delete
return null;
[570] Fix | Delete
}
[571] Fix | Delete
[572] Fix | Delete
/**
[573] Fix | Delete
* Get a single keyword
[574] Fix | Delete
*
[575] Fix | Delete
* @param int $key
[576] Fix | Delete
* @return string|null
[577] Fix | Delete
*/
[578] Fix | Delete
public function get_keyword($key = 0)
[579] Fix | Delete
{
[580] Fix | Delete
$keywords = $this->get_keywords();
[581] Fix | Delete
if (isset($keywords[$key]))
[582] Fix | Delete
{
[583] Fix | Delete
return $keywords[$key];
[584] Fix | Delete
}
[585] Fix | Delete
[586] Fix | Delete
return null;
[587] Fix | Delete
}
[588] Fix | Delete
[589] Fix | Delete
/**
[590] Fix | Delete
* Get all keywords
[591] Fix | Delete
*
[592] Fix | Delete
* @return array|null Array of strings
[593] Fix | Delete
*/
[594] Fix | Delete
public function get_keywords()
[595] Fix | Delete
{
[596] Fix | Delete
if ($this->keywords !== null)
[597] Fix | Delete
{
[598] Fix | Delete
return $this->keywords;
[599] Fix | Delete
}
[600] Fix | Delete
[601] Fix | Delete
return null;
[602] Fix | Delete
}
[603] Fix | Delete
[604] Fix | Delete
/**
[605] Fix | Delete
* Get length
[606] Fix | Delete
*
[607] Fix | Delete
* @return float Length in bytes
[608] Fix | Delete
*/
[609] Fix | Delete
public function get_length()
[610] Fix | Delete
{
[611] Fix | Delete
if ($this->length !== null)
[612] Fix | Delete
{
[613] Fix | Delete
return $this->length;
[614] Fix | Delete
}
[615] Fix | Delete
[616] Fix | Delete
return null;
[617] Fix | Delete
}
[618] Fix | Delete
[619] Fix | Delete
/**
[620] Fix | Delete
* Get the URL
[621] Fix | Delete
*
[622] Fix | Delete
* @return string|null
[623] Fix | Delete
*/
[624] Fix | Delete
public function get_link()
[625] Fix | Delete
{
[626] Fix | Delete
if ($this->link !== null)
[627] Fix | Delete
{
[628] Fix | Delete
return urldecode($this->link);
[629] Fix | Delete
}
[630] Fix | Delete
[631] Fix | Delete
return null;
[632] Fix | Delete
}
[633] Fix | Delete
[634] Fix | Delete
/**
[635] Fix | Delete
* Get the medium
[636] Fix | Delete
*
[637] Fix | Delete
* @link http://www.rssboard.org/media-rss#media-content
[638] Fix | Delete
* @return string|null Should be one of 'image', 'audio', 'video', 'document', 'executable'
[639] Fix | Delete
*/
[640] Fix | Delete
public function get_medium()
[641] Fix | Delete
{
[642] Fix | Delete
if ($this->medium !== null)
[643] Fix | Delete
{
[644] Fix | Delete
return $this->medium;
[645] Fix | Delete
}
[646] Fix | Delete
[647] Fix | Delete
return null;
[648] Fix | Delete
}
[649] Fix | Delete
[650] Fix | Delete
/**
[651] Fix | Delete
* Get the player URL
[652] Fix | Delete
*
[653] Fix | Delete
* Typically the same as {@see get_permalink()}
[654] Fix | Delete
* @return string|null Player URL
[655] Fix | Delete
*/
[656] Fix | Delete
public function get_player()
[657] Fix | Delete
{
[658] Fix | Delete
if ($this->player !== null)
[659] Fix | Delete
{
[660] Fix | Delete
return $this->player;
[661] Fix | Delete
}
[662] Fix | Delete
[663] Fix | Delete
return null;
[664] Fix | Delete
}
[665] Fix | Delete
[666] Fix | Delete
/**
[667] Fix | Delete
* Get a single rating
[668] Fix | Delete
*
[669] Fix | Delete
* @param int $key
[670] Fix | Delete
* @return SimplePie_Rating|null
[671] Fix | Delete
*/
[672] Fix | Delete
public function get_rating($key = 0)
[673] Fix | Delete
{
[674] Fix | Delete
$ratings = $this->get_ratings();
[675] Fix | Delete
if (isset($ratings[$key]))
[676] Fix | Delete
{
[677] Fix | Delete
return $ratings[$key];
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
return null;
[681] Fix | Delete
}
[682] Fix | Delete
[683] Fix | Delete
/**
[684] Fix | Delete
* Get all ratings
[685] Fix | Delete
*
[686] Fix | Delete
* @return array|null Array of {@see SimplePie_Rating} objects
[687] Fix | Delete
*/
[688] Fix | Delete
public function get_ratings()
[689] Fix | Delete
{
[690] Fix | Delete
if ($this->ratings !== null)
[691] Fix | Delete
{
[692] Fix | Delete
return $this->ratings;
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
return null;
[696] Fix | Delete
}
[697] Fix | Delete
[698] Fix | Delete
/**
[699] Fix | Delete
* Get a single restriction
[700] Fix | Delete
*
[701] Fix | Delete
* @param int $key
[702] Fix | Delete
* @return SimplePie_Restriction|null
[703] Fix | Delete
*/
[704] Fix | Delete
public function get_restriction($key = 0)
[705] Fix | Delete
{
[706] Fix | Delete
$restrictions = $this->get_restrictions();
[707] Fix | Delete
if (isset($restrictions[$key]))
[708] Fix | Delete
{
[709] Fix | Delete
return $restrictions[$key];
[710] Fix | Delete
}
[711] Fix | Delete
[712] Fix | Delete
return null;
[713] Fix | Delete
}
[714] Fix | Delete
[715] Fix | Delete
/**
[716] Fix | Delete
* Get all restrictions
[717] Fix | Delete
*
[718] Fix | Delete
* @return array|null Array of {@see SimplePie_Restriction} objects
[719] Fix | Delete
*/
[720] Fix | Delete
public function get_restrictions()
[721] Fix | Delete
{
[722] Fix | Delete
if ($this->restrictions !== null)
[723] Fix | Delete
{
[724] Fix | Delete
return $this->restrictions;
[725] Fix | Delete
}
[726] Fix | Delete
[727] Fix | Delete
return null;
[728] Fix | Delete
}
[729] Fix | Delete
[730] Fix | Delete
/**
[731] Fix | Delete
* Get the sampling rate (in kHz)
[732] Fix | Delete
*
[733] Fix | Delete
* @return string|null
[734] Fix | Delete
*/
[735] Fix | Delete
public function get_sampling_rate()
[736] Fix | Delete
{
[737] Fix | Delete
if ($this->samplingrate !== null)
[738] Fix | Delete
{
[739] Fix | Delete
return $this->samplingrate;
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
return null;
[743] Fix | Delete
}
[744] Fix | Delete
[745] Fix | Delete
/**
[746] Fix | Delete
* Get the file size (in MiB)
[747] Fix | Delete
*
[748] Fix | Delete
* @return float|null File size in mebibytes (1048 bytes)
[749] Fix | Delete
*/
[750] Fix | Delete
public function get_size()
[751] Fix | Delete
{
[752] Fix | Delete
$length = $this->get_length();
[753] Fix | Delete
if ($length !== null)
[754] Fix | Delete
{
[755] Fix | Delete
return round($length/1048576, 2);
[756] Fix | Delete
}
[757] Fix | Delete
[758] Fix | Delete
return null;
[759] Fix | Delete
}
[760] Fix | Delete
[761] Fix | Delete
/**
[762] Fix | Delete
* Get a single thumbnail
[763] Fix | Delete
*
[764] Fix | Delete
* @param int $key
[765] Fix | Delete
* @return string|null Thumbnail URL
[766] Fix | Delete
*/
[767] Fix | Delete
public function get_thumbnail($key = 0)
[768] Fix | Delete
{
[769] Fix | Delete
$thumbnails = $this->get_thumbnails();
[770] Fix | Delete
if (isset($thumbnails[$key]))
[771] Fix | Delete
{
[772] Fix | Delete
return $thumbnails[$key];
[773] Fix | Delete
}
[774] Fix | Delete
[775] Fix | Delete
return null;
[776] Fix | Delete
}
[777] Fix | Delete
[778] Fix | Delete
/**
[779] Fix | Delete
* Get all thumbnails
[780] Fix | Delete
*
[781] Fix | Delete
* @return array|null Array of thumbnail URLs
[782] Fix | Delete
*/
[783] Fix | Delete
public function get_thumbnails()
[784] Fix | Delete
{
[785] Fix | Delete
if ($this->thumbnails !== null)
[786] Fix | Delete
{
[787] Fix | Delete
return $this->thumbnails;
[788] Fix | Delete
}
[789] Fix | Delete
[790] Fix | Delete
return null;
[791] Fix | Delete
}
[792] Fix | Delete
[793] Fix | Delete
/**
[794] Fix | Delete
* Get the title
[795] Fix | Delete
*
[796] Fix | Delete
* @return string|null
[797] Fix | Delete
*/
[798] Fix | Delete
public function get_title()
[799] Fix | Delete
{
[800] Fix | Delete
if ($this->title !== null)
[801] Fix | Delete
{
[802] Fix | Delete
return $this->title;
[803] Fix | Delete
}
[804] Fix | Delete
[805] Fix | Delete
return null;
[806] Fix | Delete
}
[807] Fix | Delete
[808] Fix | Delete
/**
[809] Fix | Delete
* Get mimetype of the enclosure
[810] Fix | Delete
*
[811] Fix | Delete
* @see get_real_type()
[812] Fix | Delete
* @return string|null MIME type
[813] Fix | Delete
*/
[814] Fix | Delete
public function get_type()
[815] Fix | Delete
{
[816] Fix | Delete
if ($this->type !== null)
[817] Fix | Delete
{
[818] Fix | Delete
return $this->type;
[819] Fix | Delete
}
[820] Fix | Delete
[821] Fix | Delete
return null;
[822] Fix | Delete
}
[823] Fix | Delete
[824] Fix | Delete
/**
[825] Fix | Delete
* Get the width
[826] Fix | Delete
*
[827] Fix | Delete
* @return string|null
[828] Fix | Delete
*/
[829] Fix | Delete
public function get_width()
[830] Fix | Delete
{
[831] Fix | Delete
if ($this->width !== null)
[832] Fix | Delete
{
[833] Fix | Delete
return $this->width;
[834] Fix | Delete
}
[835] Fix | Delete
[836] Fix | Delete
return null;
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
/**
[840] Fix | Delete
* Embed the enclosure using `<embed>`
[841] Fix | Delete
*
[842] Fix | Delete
* @deprecated Use the second parameter to {@see embed} instead
[843] Fix | Delete
*
[844] Fix | Delete
* @param array|string $options See first paramter to {@see embed}
[845] Fix | Delete
* @return string HTML string to output
[846] Fix | Delete
*/
[847] Fix | Delete
public function native_embed($options='')
[848] Fix | Delete
{
[849] Fix | Delete
return $this->embed($options, true);
[850] Fix | Delete
}
[851] Fix | Delete
[852] Fix | Delete
/**
[853] Fix | Delete
* Embed the enclosure using Javascript
[854] Fix | Delete
*
[855] Fix | Delete
* `$options` is an array or comma-separated key:value string, with the
[856] Fix | Delete
* following properties:
[857] Fix | Delete
*
[858] Fix | Delete
* - `alt` (string): Alternate content for when an end-user does not have
[859] Fix | Delete
* the appropriate handler installed or when a file type is
[860] Fix | Delete
* unsupported. Can be any text or HTML. Defaults to blank.
[861] Fix | Delete
* - `altclass` (string): If a file type is unsupported, the end-user will
[862] Fix | Delete
* see the alt text (above) linked directly to the content. That link
[863] Fix | Delete
* will have this value as its class name. Defaults to blank.
[864] Fix | Delete
* - `audio` (string): This is an image that should be used as a
[865] Fix | Delete
* placeholder for audio files before they're loaded (QuickTime-only).
[866] Fix | Delete
* Can be any relative or absolute URL. Defaults to blank.
[867] Fix | Delete
* - `bgcolor` (string): The background color for the media, if not
[868] Fix | Delete
* already transparent. Defaults to `#ffffff`.
[869] Fix | Delete
* - `height` (integer): The height of the embedded media. Accepts any
[870] Fix | Delete
* numeric pixel value (such as `360`) or `auto`. Defaults to `auto`,
[871] Fix | Delete
* and it is recommended that you use this default.
[872] Fix | Delete
* - `loop` (boolean): Do you want the media to loop when it's done?
[873] Fix | Delete
* Defaults to `false`.
[874] Fix | Delete
* - `mediaplayer` (string): The location of the included
[875] Fix | Delete
* `mediaplayer.swf` file. This allows for the playback of Flash Video
[876] Fix | Delete
* (`.flv`) files, and is the default handler for non-Odeo MP3's.
[877] Fix | Delete
* Defaults to blank.
[878] Fix | Delete
* - `video` (string): This is an image that should be used as a
[879] Fix | Delete
* placeholder for video files before they're loaded (QuickTime-only).
[880] Fix | Delete
* Can be any relative or absolute URL. Defaults to blank.
[881] Fix | Delete
* - `width` (integer): The width of the embedded media. Accepts any
[882] Fix | Delete
* numeric pixel value (such as `480`) or `auto`. Defaults to `auto`,
[883] Fix | Delete
* and it is recommended that you use this default.
[884] Fix | Delete
* - `widescreen` (boolean): Is the enclosure widescreen or standard?
[885] Fix | Delete
* This applies only to video enclosures, and will automatically resize
[886] Fix | Delete
* the content appropriately. Defaults to `false`, implying 4:3 mode.
[887] Fix | Delete
*
[888] Fix | Delete
* Note: Non-widescreen (4:3) mode with `width` and `height` set to `auto`
[889] Fix | Delete
* will default to 480x360 video resolution. Widescreen (16:9) mode with
[890] Fix | Delete
* `width` and `height` set to `auto` will default to 480x270 video resolution.
[891] Fix | Delete
*
[892] Fix | Delete
* @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
[893] Fix | Delete
* @param array|string $options Comma-separated key:value list, or array
[894] Fix | Delete
* @param bool $native Use `<embed>`
[895] Fix | Delete
* @return string HTML string to output
[896] Fix | Delete
*/
[897] Fix | Delete
public function embed($options = '', $native = false)
[898] Fix | Delete
{
[899] Fix | Delete
// Set up defaults
[900] Fix | Delete
$audio = '';
[901] Fix | Delete
$video = '';
[902] Fix | Delete
$alt = '';
[903] Fix | Delete
$altclass = '';
[904] Fix | Delete
$loop = 'false';
[905] Fix | Delete
$width = 'auto';
[906] Fix | Delete
$height = 'auto';
[907] Fix | Delete
$bgcolor = '#ffffff';
[908] Fix | Delete
$mediaplayer = '';
[909] Fix | Delete
$widescreen = false;
[910] Fix | Delete
$handler = $this->get_handler();
[911] Fix | Delete
$type = $this->get_real_type();
[912] Fix | Delete
[913] Fix | Delete
// Process options and reassign values as necessary
[914] Fix | Delete
if (is_array($options))
[915] Fix | Delete
{
[916] Fix | Delete
extract($options);
[917] Fix | Delete
}
[918] Fix | Delete
else
[919] Fix | Delete
{
[920] Fix | Delete
$options = explode(',', $options);
[921] Fix | Delete
foreach($options as $option)
[922] Fix | Delete
{
[923] Fix | Delete
$opt = explode(':', $option, 2);
[924] Fix | Delete
if (isset($opt[0], $opt[1]))
[925] Fix | Delete
{
[926] Fix | Delete
$opt[0] = trim($opt[0]);
[927] Fix | Delete
$opt[1] = trim($opt[1]);
[928] Fix | Delete
switch ($opt[0])
[929] Fix | Delete
{
[930] Fix | Delete
case 'audio':
[931] Fix | Delete
$audio = $opt[1];
[932] Fix | Delete
break;
[933] Fix | Delete
[934] Fix | Delete
case 'video':
[935] Fix | Delete
$video = $opt[1];
[936] Fix | Delete
break;
[937] Fix | Delete
[938] Fix | Delete
case 'alt':
[939] Fix | Delete
$alt = $opt[1];
[940] Fix | Delete
break;
[941] Fix | Delete
[942] Fix | Delete
case 'altclass':
[943] Fix | Delete
$altclass = $opt[1];
[944] Fix | Delete
break;
[945] Fix | Delete
[946] Fix | Delete
case 'loop':
[947] Fix | Delete
$loop = $opt[1];
[948] Fix | Delete
break;
[949] Fix | Delete
[950] Fix | Delete
case 'width':
[951] Fix | Delete
$width = $opt[1];
[952] Fix | Delete
break;
[953] Fix | Delete
[954] Fix | Delete
case 'height':
[955] Fix | Delete
$height = $opt[1];
[956] Fix | Delete
break;
[957] Fix | Delete
[958] Fix | Delete
case 'bgcolor':
[959] Fix | Delete
$bgcolor = $opt[1];
[960] Fix | Delete
break;
[961] Fix | Delete
[962] Fix | Delete
case 'mediaplayer':
[963] Fix | Delete
$mediaplayer = $opt[1];
[964] Fix | Delete
break;
[965] Fix | Delete
[966] Fix | Delete
case 'widescreen':
[967] Fix | Delete
$widescreen = $opt[1];
[968] Fix | Delete
break;
[969] Fix | Delete
}
[970] Fix | Delete
}
[971] Fix | Delete
}
[972] Fix | Delete
}
[973] Fix | Delete
[974] Fix | Delete
$mime = explode('/', $type, 2);
[975] Fix | Delete
$mime = $mime[0];
[976] Fix | Delete
[977] Fix | Delete
// Process values for 'auto'
[978] Fix | Delete
if ($width === 'auto')
[979] Fix | Delete
{
[980] Fix | Delete
if ($mime === 'video')
[981] Fix | Delete
{
[982] Fix | Delete
if ($height === 'auto')
[983] Fix | Delete
{
[984] Fix | Delete
$width = 480;
[985] Fix | Delete
}
[986] Fix | Delete
elseif ($widescreen)
[987] Fix | Delete
{
[988] Fix | Delete
$width = round((intval($height)/9)*16);
[989] Fix | Delete
}
[990] Fix | Delete
else
[991] Fix | Delete
{
[992] Fix | Delete
$width = round((intval($height)/3)*4);
[993] Fix | Delete
}
[994] Fix | Delete
}
[995] Fix | Delete
else
[996] Fix | Delete
{
[997] Fix | Delete
$width = '100%';
[998] Fix | Delete
}
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function