*/ /* Content filter callback function to replace the page comment with the hResume */ function lnhr_callback($content) { if(!preg_match('//', $content)) { return $content; } $hresume = lnhr_get_linkedin_page(); $hresume = lnhr_stripout_hresume($hresume); return str_replace('', $hresume, $content); } function lnhr_get_linkedin_page() { global $linkedin_url; global $linkedin_server; // If Wordpress caching is enabled, get content from the cache $data = wp_cache_get('lnhr_data'); if ($data !== false) { return $data; } // Split up the URL $matches = array(); preg_match('/^http:\/\/([^\/]+)(\/.*)$/', $linkedin_url, $matches); $linkedin_server = $matches[1]; $page = $matches[2]; // Request the LinkedIn page $errno = 0; $errstr = ''; $fp = @fsockopen($linkedin_server, 80, $errno, $errstr, 30); if (!$fp) { return "
Details: $errstr ($errno)
"; } else { $out = "GET $page HTTP/1.1\r\n"; $out .= "Host: $linkedin_server\r\n"; $out .= "Connection: Close\r\n\r\n"; $response = ''; fwrite($fp, $out); while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); $response = split("\r\n\r\n", $response); $headers = $response[0]; $data = $response[1]; } // If Wordpress caching is enabled, cache the content wp_cache_set('lnhr_data', $data, '', 3600); return $data; } function lnhr_stripout_hresume($content) { global $lnhr_your_name; global $linkedin_server; // Just grab the hResume part minus some extra LinkedIn junk // Kind of lazy, but maybe do some parsing in another version $hresume = strstr($content, '