|
@@ 37-49 (lines=13) @@
|
| 34 |
|
* Get yesterday's rank |
| 35 |
|
* @return int |
| 36 |
|
*/ |
| 37 |
|
public static function getDailyRank($url = false) |
| 38 |
|
{ |
| 39 |
|
self::setRankingKeys($url); |
| 40 |
|
if (0 == self::$_rankKeys['1d']) { |
| 41 |
|
return parent::noDataDefaultValue(); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
$xpath = self::_getXPath($url); |
| 45 |
|
$nodes = @$xpath->query("//*[@id='rank']/table/tr[" . self::$_rankKeys['1d'] . "]/td[1]"); |
| 46 |
|
|
| 47 |
|
return !$nodes->item(0) ? parent::noDataDefaultValue() : |
| 48 |
|
self::retInt( strip_tags($nodes->item(0)->nodeValue) ); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
/** |
| 52 |
|
* For backward compatibility |
|
@@ 62-74 (lines=13) @@
|
| 59 |
|
* Get the average rank over the last 7 days |
| 60 |
|
* @return int |
| 61 |
|
*/ |
| 62 |
|
public static function getWeeklyRank($url = false) |
| 63 |
|
{ |
| 64 |
|
self::setRankingKeys($url); |
| 65 |
|
if (0 == self::$_rankKeys['7d']) { |
| 66 |
|
return parent::noDataDefaultValue(); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
$xpath = self::_getXPath($url); |
| 70 |
|
$nodes = @$xpath->query("//*[@id='rank']/table/tr[" . self::$_rankKeys['7d'] . "]/td[1]"); |
| 71 |
|
|
| 72 |
|
return !$nodes->item(0) ? parent::noDataDefaultValue() : |
| 73 |
|
self::retInt( strip_tags($nodes->item(0)->nodeValue) ); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** |
| 77 |
|
* For backward compatibility |
|
@@ 87-99 (lines=13) @@
|
| 84 |
|
* Get the average rank over the last month |
| 85 |
|
* @return int |
| 86 |
|
*/ |
| 87 |
|
public static function getMonthlyRank($url = false) |
| 88 |
|
{ |
| 89 |
|
self::setRankingKeys($url); |
| 90 |
|
if (0 == self::$_rankKeys['1m']) { |
| 91 |
|
return parent::noDataDefaultValue(); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
$xpath = self::_getXPath($url); |
| 95 |
|
$nodes = @$xpath->query("//*[@id='rank']/table/tr[" . self::$_rankKeys['1m'] . "]/td[1]"); |
| 96 |
|
|
| 97 |
|
return !$nodes->item(0) ? parent::noDataDefaultValue() : |
| 98 |
|
self::retInt( strip_tags($nodes->item(0)->nodeValue) ); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
/** |
| 102 |
|
* For backward compatibility |