Autor Tópico: YouTube Playlist BBCode  (Lida 6411 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5073
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
YouTube Playlist BBCode
« em: 03 de Janeiro de 2009, 06:07 »
Subs.php

Pesquisar
Código: [Seleccione]
array(
'tag' => 'white',
'before' => '<span style="color: white;">',
'after' => '</span>',
),


Adicionar
Código: [Seleccione]
array(
'tag' => 'ytplaylist',
'type' => 'unparsed_content',
'content' => '<object width="530px" height="370px">'
.'<param name="movie" value="http://www.youtube.com/p/$1" />'
.'<param name="wmode" value="transparent" />'
.'<param name="allowScriptAccess" value="never" />'
.'<embed src="http://www.youtube.com/p/$1" type="application/x-shockwave-flash" allowScriptAccess="never" wmode="transparent" width="530px" height="370px"></embed>'
.'</object>',
'validate' => create_function('&$tag, &$data, $disabled', '
// WE MAY NEED ACCESS TO THE YTPLAYLIST TXT STRING
global $txt;
// REMOVE EXTRA LINES
$data = strtr($data, array(\'<br />\' => \'\'));
// SET DEFAULT SITE (TO TRY TO RETURN, IF DISABLED)
$site = \'www.\';
// JUST A PLAYLIST ID?
if (preg_match(\'#^([0-9a-f]{16})#i\', trim($data), $matches)) {
$data = $matches[1];
} else {
// MATCH THREE FORMS, THE PAGE URL, THE EMBED LINK, THE PLAYER EMBED LINK
if (preg_match(\'#^http://(www\.|uk\.|fr\.|ie\.|it\.|jp\.|pl\.|es\.|nl\.|br\.|)youtube\.com/(ep\.swf\?id=|view_play_list\?p=|p/)([0-9a-f]{16})(.*?)#i\', trim($data), $matches)) {
$data = $matches[3];
$site = !empty($matches[1]) ? strtolower($matches[1]) : $site;
} else {
// INVALID YT PLAYLIST LINK, SO RETURN ERROR MESSAGE
$tag[\'content\'] = $txt[\'ytplaylist_invalid\'];
return;
}
}
// YTPLAYLIST & URL DISABLED? (INCLUDES THE PRINT VERSION) USE PRINTER FRIENDLY TEXT (WITH PARSED SITE)
if (isset($disabled[\'url\']) && isset($disabled[\'ytplaylist\'])) {
$tag[\'content\'] = $txt[\'ytplaylist\'].\': http://\'.$site.\'youtube.com/view_play_list?p=\'.$data;
return;
// ONLY YT PLAYLIST DISABLED? USE LINK INSTEAD (WITH PARSED SITE)
} elseif(isset($disabled[\'ytplaylist\'])) {
$tag[\'content\'] = \'<a href="http://\'.$site.\'youtube.com/view_play_list?p=\'.$data.\'" target="_blank">\'.$txt[\'ytplaylist\'].\': http://\'.$site.\'youtube.com/view_play_list?p=\'.$data.\'</a>\';
return;
}
'),
'disabled_content' => '$1',
            ),
array(
'tag' => 'ytplaylist',
'type' => 'unparsed_commas_content',
'test' => '\d+,\d+\]',
'content' => '<object width="$2px" height="$3px">'
.'<param name="movie" value="http://www.youtube.com/p/$1" />'
.'<param name="wmode" value="transparent" />'
.'<param name="allowScriptAccess" value="never" />'
.'<embed src="http://www.youtube.com/p/$1" type="application/x-shockwave-flash" allowScriptAccess="never" wmode="transparent" width="$2px" height="$3px"></embed>'
.'</object>',
'validate' => create_function('&$tag, &$data, $disabled', '
// WE MAY NEED ACCESS TO THE YTPLAYLIST TXT STRING
global $txt;
// REMOVE EXTRA LINES
$data[0] = strtr($data[0], array(\'<br />\' => \'\'));
// SET DEFAULT SITE (TO TRY TO RETURN, IF DISABLED)
$site = \'www.\';
// JUST A PLAYLIST ID?
if (preg_match(\'#^([0-9a-f]{16})#i\', trim($data[0]), $matches)) {
$data[0] = $matches[1];
} else {
// MATCH THREE FORMS, THE PAGE URL, THE EMBED LINK, THE PLAYER EMBED LINK
if (preg_match(\'#^http://(www\.|uk\.|fr\.|ie\.|it\.|jp\.|pl\.|es\.|nl\.|br\.|)youtube\.com/(ep\.swf\?id=|view_play_list\?p=|p/)([0-9a-f]{16})(.*?)#i\', trim($data[0]), $matches)) {
$data[0] = $matches[3];
$site = !empty($matches[1]) ? strtolower($matches[1]) : $site;
} else {
// INVALID YT PLAYLIST LINK, SO RETURN ERROR MESSAGE
$tag[\'content\'] = $txt[\'ytplaylist_invalid\'];
return;
}
}
// YTPLAYLIST & URL DISABLED? (INCLUDES THE PRINT VERSION) USE PRINTER FRIENDLY TEXT (WITH PARSED SITE)
if (isset($disabled[\'url\']) && isset($disabled[\'ytplaylist\'])) {
$tag[\'content\'] = $txt[\'ytplaylist\'].\': http://\'.$site.\'youtube.com/view_play_list?p=\'.$data[0];
return;
// ONLY YT PLAYLIST DISABLED? USE LINK INSTEAD (WITH PARSED SITE)
} elseif(isset($disabled[\'ytplaylist\'])) {
$tag[\'content\'] = \'<a href="http://\'.$site.\'youtube.com/view_play_list?p=\'.$data[0].\'" target="_blank">\'.$txt[\'ytplaylist\'].\': http://\'.$site.\'youtube.com/view_play_list?p=\'.$data[0].\'</a>\';
return;
}
// SANITIZE/VALIDATE THE SIZES
// IF EITHER THE WIDTH AND/OR THE HEIGHT IS LESS THAN 100 OR GREATER THAN 800, USE THE DEFAULT YOUTUBE PLAYLIST SIZES
if($data[1] > 800 || $data[1] < 100 || $data[2] > 800 || $data[2] < 100) {
$data[1] = 530;
$data[2] = 370;
} else {
$data[1] = (int) $data[1];
$data[2] = (int) $data[2];
}

'),
'disabled_content' => '$1',
            ),
 

Pesquisar
Código: [Seleccione]
$disabled['email'] = true;
$disabled['flash'] = true;

Adicionar
Código: [Seleccione]
// DISABLE YT PLAYLIST IF ON 'PRINTER FRIENDLY PAGE'
$disabled['ytplaylist'] = true;


Post.template.php

Pesquisar
Código: [Seleccione]
'flash' => array('code' => 'flash',
Adicionar
Código: [Seleccione]
'ytplaylist' => array('code' => 'ytplaylist', 'before' => '[ytplaylist]', 'after' => '[/ytplaylist]', 'description' => $txt['ytplaylist']),
Modifications.portuguese_pt.php

Pesquisar
Código: [Seleccione]
?>

Adicionar antes
Código: [Seleccione]
$txt['ytplaylist'] = 'YouTube Playlista';
$txt['ytplaylist_invalid'] = '#Invalido YouTube Playliste Link#';

Tem que colocar a imagem que esta no anexo...na pasta /images/bbc