0
 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[mycode request] IMDB Mycode like ipb
Author Message
dared
Junior Member


Posts: 34
Joined: Jul 2008
Reputation: 2
MyBux: 0
Post: #1
[mycode request] IMDB Mycode like ipb
can someone port this mod to MyBB?

ipb files are in attachments. and here is installation:

» class_bbcode.php

1. Find:

PHP Code:
//----------------------------------------- // Do [QUOTE(name,date)] tags //----------------------------------------- 
Add Before:

PHP Code:
//----------------------------------------- // tags [imdb] //----------------------------------------- $txt = preg_replace( "#(\[imdb=.*\])#Uies" , "\$this->regex_parse_imdb('\\1')" , $txt); $txt = preg_replace( "#(\[imdb\].*\[/imdb\])#ies" , "\$this->regex_parse_imdb('\\1')" , $txt ); 
2. Find:
PHP Code:
//----------------------------------------- // Quote //----------------------------------------- $txt = preg_replace( "#<!--QuoteBegin-->(.+?)<!--QuoteEBegin-->#" , '[quote]' , $txt ); 
Add Before:

PHP Code:
//----------------------------------------- // IMDB //----------------------------------------- $txt = preg_replace( "#<!--ImdbBegin(.+?)-->(.+?)<!--ImdbEnd(.+?)-->#ms" , '[imdb=\\1]' , $txt ); 

3. Find:

PHP Code:
/*-------------------------------------------------------------------------*/ // OVERWRITE DEFAULT: regex_font_attr: /*-------------------------------------------------------------------------*/ 
Add Before: (PS: Here you can now edit two variables: $imdb_toptext, the text of the IMDB-Box; and $imdb_perpost, the number of tags allowed per post)

PHP Code:
/*-------------------------------------------------------------------------*/ // regex_parse_imdb: cria a caixinha do imdb /*-------------------------------------------------------------------------*/ var $imdb_count = 0; function regex_parse_imdb($texto="") { global $imdb_count; // Change this to your like $imdb_toptext = 'IMDB'; // Title of the IMDB-Box $imdb_perpost = 1; // maximum number of imdb tags allowed per post // Stop editing here if ($texto == "") return; $imdb_count++; if ($imdb_count > $imdb_perpost) return; $idfilme = preg_replace('/[^0-9]/i',"\\1",$texto); if (strlen($idfilme) != 7) { $this->error = 'imdb_nao7'; return; } $imdb_style = $this->wrap_style('quote'); $imdb_url = "http://imdb.com/title/tt".$idfilme."/"; $imdb = @fopen($imdb_url, "r"); if ($imdb == FALSE) { $this->error = 'imdb_invalido'; return; } while (!feof($imdb)) $imdb_raw .= fgets($imdb, 4096); fclose($imdb); preg_match ( "'<h1><strong class=\"title\">(.*?)</strong></h1>'s" , $imdb_raw , $titulo ); $titulo = str_replace("\n"," ", trim(strip_tags($titulo[1]))); preg_match ( "'Genre:</b>\\n(.*?)(\(more\)|\\n)'" , $imdb_raw , $genero ); $genero = @strip_tags($genero[1]); preg_match ( "'Tagline:</b> (.*?)( <a href|\\n)'" , $imdb_raw , $slogan ); $slogan = @$slogan[1]; preg_match ( "'Plot (Outline|Summary):</b> (.*?)( <a href=|\\n)'" , $imdb_raw , $resumo ); $resumo = @$resumo[2]; preg_match ( "'Runtime:</b>\\n(.*?)\\n<br>'" , $imdb_raw , $duracao ); $duracao = @$duracao[1]; if (strlen($duracao) > 50) $duracao = substr($duracao,0,50)."..."; preg_match ( "'User Rating:(.*?)\\n\\n(.*?)\\n(.*?)\\n<b>(.*?)/10</b> \((.*?) votes\)\\n'" , $imdb_raw , $votacao ); $votos = @$votacao[5]; $votacao = @$votacao[4]; if ($votacao >= 0) $cor = 'red'; if ($votacao >= 4) $cor = '#C8C800'; if ($votacao >= 8) $cor = 'green'; $estrelas = 4 + $votacao * 9 + log10($votacao) ; $estrelas = '<span style="position:relative; font-size: 16px; background: url(\'style_images/1/imdb_rate_full.gif\')"><img width="'.($estrelas - 1).'" height="16" src="style_images/1/tp.gif"></span><span style="font-size: 16px; background: url(\'style_images/1/imdb_rate_none.gif\') right"><img width="'.(101 - $estrelas).'" height="16" src="style_images/1/tp.gif"></span>'; preg_match ( "'top 250: (.*?)</a>'" , $imdb_raw , $top ); $top = @strip_tags($top[0]); if (isset($top)) $top = '[URL=http://imdb.com/chart/top]'.$top.'[/URL]'; preg_match ( "'Awards:</b> \\n(.*?)\\n<a href's" , $imdb_raw , $premios ); $premios = @str_replace("\n"," ",$premios[1]); preg_match ( "'(Cast overview,|Complete credited cast|Credited cast)(.*?)<a href=\"(.*?)\">(.*?)</a>(.*?)<a href=\"(.*?)\">(.*?)</a>(.*?)<a href=\"(.*?)\">(.*?)</a>(.*?)<a href=\"(.*?)\">(.*?)</a>(.*?)<a href=\"(.*?)\">(.*?)</a>(.*?)'s" , $imdb_raw , $actores ); $actores = "[url=http://imdb.com".@$actores[3]."]".@$actores[4]."[/url], ". "[url=http://imdb.com".@$actores[6]."]".@$actores[7]."[/url], ". "[url=http://imdb.com".@$actores[9]."]".@$actores[10]."[/url], ". "[url=http://imdb.com".@$actores[12]."]".@$actores[13]."[/url], ". "[url=http://imdb.com".@$actores[15]."]".@$actores[16]."[/url]"; $imdb_final = "<table border='0'><tr><td style='font-size: 13px; line-height:125%;'>"; $imdb_final .= "[B][size=4]» [url=".$imdb_url."]".$titulo."[/url][/size][/B]<br><br>"; if ($genero <> "") $imdb_final .= "[B]Genre[/B]: $genero<br>"; if ($slogan <> "") $imdb_final .= "[B]Tagline[/B]: $slogan<br>"; if ($resumo <> "") $imdb_final .= "[B]Plot Outline[/B]: $resumo<br>"; if ($votos <> "") $imdb_final .= "[B]User Rating[/B]: [COLOR=$cor][B]".$votacao."[/B][/COLOR]/10 $estrelas ($votos votes) $top<br>"; if ($duracao <> "") $imdb_final .= "[B]Runtime[/B]: $duracao<br>"; if ($premios <> "") $imdb_final .= "[B]Awards[/B]: $premios<br>"; if ($actores <> "") $imdb_final .= "[B]Cast[/B] [SIZE=1][I](first 5)[/I][/SIZE]: $actores<br>"; $imdb_final .= "<br>[B]IMDB[/B]: [url]".$imdb_url."[/url]</span></td></tr></table>"; $imdb_topo = str_replace("<div class='quotetop'>QUOTE</div>","<div class='quotetop' style='padding:0px;'><div width=100% style='background: none no-repeat right top; margin:0;padding:4px;'>$imdb_toptext</div></div>", $imdb_style['START']); return "<!--ImdbBegin".$idfilme."-->".$imdb_topo.$imdb_final.$imdb_style['END']."<!--ImdbEnd".$idfilme."-->"; } 

4. Done!


» lang_post.php

1. Find:

PHP Code:
<?php 
Add After:
PHP Code:
$lang['imdb_nao7'] = "[IMDB] ID consists in 7 numbers"$lang['imdb_invalido'] = "[IMDB] The id you entered does not exists, or the movie is not valid!"

2. Done!


» ipb_editor_std.js

1. Find:

PHP Code:
/*-------------------------------------------------------------------------*/ // URL tag /*-------------------------------------------------------------------------*/ 
Add Before:

PHP Code:
/*-------------------------------------------------------------------------*/ // IMDB tag /*-------------------------------------------------------------------------*/ function tag_imdb() { //---------------------------------------- // Do we have ranged text? //---------------------------------------- if ( check_range() ) { //---------------------------------------- // Yes, just wrap text //---------------------------------------- wrap_tags( "[imdb]", "[/imdb]", "" ); } else { var imdbID = prompt("What's the ID/URL of the movie?\nExample: 1234567 , http://www.imdb.com/title/tt1234567/ , etc", ""); if ( ! imdbID ) { alert("It would be useful to write something ..."); return; } wrap_tags( "[imdb]"+imdbID+"[/imdb]", "" ); } } 

2. Done!


» Admin CP

1. Go to:
PHP Code:
Look Feel -> Skin Manager -> Edit Template HTML -> Post PM Editor -> editor_std 
Find:

PHP Code:
<td><div id='do_code'><img class="rteimage" src="{ipb.vars['img_url']}/folder_rte_images/code.gif" width="21" height="21 alt="{ipb.lang['js_tt_code']}" title="{ipb.lang['js_tt_code']}" onclick="simpletag('code')"></div></td> 
Add After:

PHP Code:
<!--SEP--> <td><img class="rteVertSep" src="{ipb.vars['img_url']}/folder_rte_images/blackdot.gif" width="1" height="20" border="0" alt=""></td> <!--/SEP--> <td><div id='do_imdb'><img class="rteimage" src="style_images/1/folder_rte_images/imdb.gif" width="25" height="24" alt="IMDB" title="Add IMDB Tag" onclick="tag_imdb()"></div></td
Click Save Template Bit

2. Done!

http://community.mybboard.net/attachment.php?aid=12517
01-29-2009 03:09 PM
 




New to MyBBSource?Need Assistance?
  • Mark Forums Read
  • View Forum Staff
  • Looking for a MyBB Host?

  



Theme created by AK-47. Find more great themes and skins at K! Dezign R1s.net