'.__( 'A video list cannot be viewed within this feed - please view the original content', 'youtube-embed' ).".
\n";
} else {
$youtube_url = 'http' . $https . '://www.youtube.com/watch?' . $embed_type . '=' . $id;
if ( ( $embed_type == 'v' ) && ( $general[ 'feed' ] != 't' ) ) { $result .= '\n";
if ( $fixed == 1) { $result = '
' . "\n" . $result; }
}
// Add EmbedPlus code
if ( $embedplus ) {
$result .= "
\n";
}
// Add IFRAME embed code
if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
$result .= $tab . '
\n";
if ( $fixed == 1 ) { $end_tag .= "
\n"; }
}
$result = str_replace( '%video%', $result . $end_tag, $template );
// Now add a commented header and trailer
$result = "\n\n" . $result;
$result .= "\n";
// Cache the output
if ( $general[ 'embed_cache' ] != 0 ) { set_transient( $cache_key, $result, 3600 * $general[ 'embed_cache' ] ); }
return $result;
}
/**
* Validate a supplied profile name
*
* Returns a profile number for a supplied name
*
* @since 2.0
*
* @param string $name The name of the profile to find
* @param string $number The number of profiles available
* @return string The profile number (defaults to 0)
*/
function aye_validate_profile( $name, $number ) {
$profile = 0;
$name = strtolower( $name );
if ( ( $name != '' ) && ( $name != 'default' ) ) {
// Loop around, fetching in profile names
$loop = 1;
while ( ( $loop <= $number ) && ( $profile == 0 ) ) {
if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
$profile = $loop;
} else {
$profiles = get_option( 'youtube_embed_profile' . $loop );
$profname = strtolower( $profiles[ 'name' ] );
if ( $profname == $name ) { $profile = $loop; }
}
$loop ++;
}
}
return $profile;
}
/**
* Validate a supplied list name
*
* Returns a list for a supplied list number or name name - blank if not a valid list
*
* @since 2.0
*
* @param string $name The name of the list to find
* @param string $number The number of lists available
* @return string The list (defaults to blank)
*/
function aye_validate_list( $name, $number ) {
$list = '';
// If the parameter contains commas, assume to be a comma seperated list and move into an array
if ( strpos( $name, ',' ) !== false ) {
$list = explode( ',', $name );
} else {
// No comma, so check if this is a named list
$name = strtolower( $name );
if ( $name != '' ) {
// Loop around, fetching in profile names
$loop = 1;
while ( ( $loop <= $number ) && ( $list == '' ) ) {
$listfiles = get_option( 'youtube_embed_list' . $loop );
if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
$list = $listfiles[ 'list' ];
} else {
$listname = strtolower( $listfiles[ 'name' ] );
if ( $listname == $name ) { $list = $listfiles[ 'list' ]; }
}
$loop ++;
}
}
if ( $list != '' ) { $list = explode( "\n", $list ); }
}
return $list;
}
/**
* Get URL parameters
*
* Extract a requested parameter from a URL
*
* @since 2.0
*
* @param string $id The ID of the video
* @param string $para The parameter to extract
* @param string $current The current parameter value
* @return string The parameter value
*/
function aye_get_url_para( $id, $para, $current ) {
// Look for an ampersand
$start_pos = false;
if ( strpos( $id, '&' . $para . '=' ) !== false ) { $start_pos = strpos( $id, '&' . $para . '=' ) + 6 + strlen( $para ); }
// If a parameter was found, look for the end of it
if ( $start_pos !== false ) {
$end_pos = strpos( $id, '&', $start_pos + 1 );
if ( !$end_pos ) { $end_pos = strlen( $id ); }
// Extract the parameter and return it
$current = substr( $id, $start_pos, $end_pos - $start_pos );
}
return $current;
}
/**
* Decode a string
*
* Decode an HTML encoded string. I'm not using htmlspecialchars_decode to maintain
* PHP 4 compatibility.
*
* @since 2.0.3
*
* @param string $encoded The encoded string
* @return string The decoded string
*/
function aye_decode( $encoded ) {
$find = array( '&', '"', ''', '<', '>' );
$replace = array( '&', '"', "'", '<', '>' );
$decoded = str_replace( $find, $replace, $encoded );
return $decoded;
}
?>