]*?href=(\".+?\"|'.+?')[^>]*>/"); } class title_grabber { function title_grabber() { $this->path = str_replace(str_replace("\\", "/", ABSPATH), '', str_replace("\\", "/", dirname(__FILE__))); add_filter('publish_post', array(&$this, 'change_links')); } function change_links($id) { global $wpdb; $text = $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id"); $newText = addslashes(preg_replace_callback(pattern_anchor, array(&$this, 'change_link'), stripslashes($text))); $wpdb->query("UPDATE $wpdb->posts SET post_content = '$newText' WHERE ID = $id"); return $id; } function grab_title($url) { $filetypes = array(".zip", ".png", ".gif", ".jpg", ".rar", ".exe", ".txt", ".pdf", ".psd"); if(strpos($url, $filetypes)) { return $url; } $pURL = parse_url($url); if (empty($pURL['host'])) { return $url; } if (empty($pURL['path'])) { $pURL['path'] = '/'; } if (empty($pURL['query'])) { $document = $pURL['path']; } else { $document = $pURL['path'] . '?' . $pURL['query']; } $fp = fsockopen($pURL['host'], 80, $errno, $errstr, 30); if (!$fp) { return $url; } else { $out = "GET $document HTTP/1.1\r\n"; $out .= "Host: {$pURL['host']}\r\n"; $out .= "Connection: Close\r\n\r\n"; $received = ''; fwrite($fp, $out); while (!feof($fp)) { $received .= fgets($fp, 128); } fclose($fp); } if (!preg_match('~