/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { $bits = new ocp_tempcode(); $map = array(); $url = get_base_url(); list($rank, $links, $speed) = getAlexaRank($url); $map['Google PageRank'] = getPageRank($url); $map['Alexa rank'] = $rank; $map['Back links'] = protect_from_escaping('<a title="Show back links" href="http://www.google.co.uk/search?as_lq=' . urlencode($url) . '">' . $links . '</a>'); $map['Speed'] = $speed; foreach ($map as $key => $val) { $bits->attach(do_template('BLOCK_SIDE_STATS_SUBLINE', array('KEY' => $key, 'VALUE' => is_null($val) ? '' : $val))); } $section = do_template('BLOCK_SIDE_STATS_SECTION', array('SECTION' => 'Meta stats', 'CONTENT' => $bits)); return $section; }
$str = 0; } } else { $str = 0; } } return trim($str); } function getBarCY($_url) { $_uri = "http://bar-navig.yandex.ru/u?ver=2&url=" . urlencode("http://" . $_url) . "&show=1"; $fd = @fopen($_uri, "r"); if ($fd) { while ($buffer = fgets($fd, 4096)) { $haystack .= $buffer; } fclose($fd); preg_match("/<tcy rang=\"(.*)\" value=\"(.*)\"\\/>/isU", $haystack, $cy); return (int) $cy[2]; } else { return 0; } } } // Пример использования: echo ">>>" . getBarCY("zhilinsky.ru"); // покажет значение Яндекс.тИЦ, полученное из Яндекс.Бара. echo ">>>" . yandex_tic("zhilinsky.ru"); // покажет значени Яндекс.тИЦ, полученное из Яндекс.Каталога. echo ">>>" . getPageRank("zhilinsky.ru"); // покажет значение Google PageRank.
<?php require_once 'pagerank.php'; $url = "http://www.google.de/"; echo "{$url} has Google PageRank: " . getPageRank($url);