2009-06-21, 02:44 AM
Hello guys..
I finally decided to make this as code edits and NOT a plugin.. keeping in mindeverything that conflicts the plugin...
See Below :
Edits :
Preview :
![[Image: or2z4x.jpg]](https://camo.mybb.com/cf708f33497512454d68964e78fec09d9b40286b/687474703a2f2f6932392e74696e797069632e636f6d2f6f72327a34782e6a7067)
This will replace any links inserted without a given title, that is like http://www.google.com/ to its title as text, that is, it will be shown as Google
I finally decided to make this as code edits and NOT a plugin.. keeping in mindeverything that conflicts the plugin...
See Below :
Edits :
- Find the lines below in inc/class_parser.php
/* options = array( allow_html allow_smilies allow_mycode nl2br filter_badwords me_username shorten_urls ) */
Now, Add the code below after the found lines
function urltitlefind($link, $text='') { // Ensure $link is a valid URL $url = $link; $fp = @fopen($url, 'r'); if (!$fp) { $title = (!$text ? $link : $text); return "(Broken Link)"; } // Grab <title>*</title> from the first "chunk" of data $title = url_grab_title($fp); // No <title> tag in first chunk... if (!$title) { $title = (!$text ? $link : $text); return "<a href='$url'>::Link (no title found)::</a>"; } // User gave me some text to append to the link title if ($text) { $title .= ': '. $text; } return $title; } function url_grab_title($fp) { // How many bytes to grab in one chunk. // Most sites seem to have <title> within 512 $chunk_size = 512; $chunk = fread($fp, $chunk_size); $chunk = preg_replace("/(\n|\r)/", '', $chunk); // Look for <title>(.*?)</title> in the text if (preg_match('/<title>(.*?)<\/title>/i', $chunk, $matches)) { return $matches[1]; } return null; }
- Now, Find the code below in the same file
$name = $url;
Replace this with the code below :
$name = urltitlefind($url);
- For Link Checking
Files on the following websites will be checked :
Quote:rapidshare.com
megaupload.com
megashares.com
sendspace.com
rapidshare.de
mediafire.com- Find the code below in the Same file
$fullurl = strtr($fullurl, array('$' => '%24', '^' => '%5E', '`' => '%60', '[' => '%5B', ']' => '%5D', '{' => '%7B', '}' => '%7D', '"' => '%22', '<' => '%3C', '>' => '%3E', ' ' => '%20'));
Add the code below after the found code
if(strstr($fullurl,"rapidshare.com")){ $var = file_get_contents($fullurl); $checked = $checked + 1; if(strpos($var,"FILE DOWNLOAD")){ $status = " <font color=\"green\">(file found!)<br></font>"; $working = $working + 1; } if(strpos($var,"The file could not be found")){ $status = " <font color=\"red\">(file not found!)<br></font>"; } if(strpos($var," deleted.")){ $status = " <font color=\"red\">(file deleted!)<br></font>"; } } elseif (strstr($fullurl,"megaupload.com")){ $var1 = file_get_contents($fullurl); $checked = $checked +1; if(strpos($var1,"Please enter")){ $status = " <font color =\"green\">(file found!)<br></font>"; $working = $working + 1; } if(strpos($var1,"Unfortunately, the link you have clicked is not available.")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } } elseif (strstr($fullurl,"megashares.com")){ $var2 = file_get_contents($fullurl); $checked = $checked +1; if(strpos($var2,"Filename:")){ $status = " <font color =\"green\">(file found!)<br></font>"; $working = $working + 1; } if(strpos($var2,"Welcome to Megashares")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } if(strpos($var2,"have the correct URL")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } } elseif (strstr($fullurl,"sendspace.com")){ $var3 = file_get_contents($fullurl); $checked = $checked +1; if(strpos($var3,"404 Page Not Found")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } elseif(strpos($var3,"Sorry, the file you requested is not available.")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } else { $status = " <font color =\"green\">(file found!)<br></font>"; $working = $working + 1; } } elseif(strstr($fullurl,"rapidshare.de")){ $var5 = file_get_contents($fullurl); $checked = $checked + 1; if(strpos($var,"You want to download the file ")){ $status = " <font color=\"green\">(file found!)<br></font>"; $working = $working + 1; } if(strpos($var,"File not found.")){ $status = " <font color=\"red\">(file not found!)<br></font>"; } if(strpos($var," deleted.")){ $status = " <font color=\"red\">(file deleted!)<br></font>"; } } elseif (strstr($fullurl,"mediafire.com")){ $var4 = file_get_contents($fullurl); $checked = $checked +1; if(strpos($var4,"Sharing")){ $status = " <font color =\"green\">(file found!)<br></font>"; $working = $working + 1; } if(strpos($var4,"Invalid Quickkey.")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } if(strpos($var4,"I want to upload")){ $status = " <font color =\"red\">(file not found!)<br></font>"; } } else { $status = ""; }
- Find this code in the Same File :
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
Replace this with :
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a> -".$status;
- Find the code below in the Same file
Preview :
This will replace any links inserted without a given title, that is like http://www.google.com/ to its title as text, that is, it will be shown as Google