1 | <?php |
||
19 | class Mozscape extends SEOstats |
||
20 | { |
||
21 | // A normalized 100-point score representing the likelihood |
||
22 | // of the URL to rank well in search engine results. |
||
23 | 2 | public static function getPageAuthority($url = false) |
|
29 | |||
30 | // A normalized 100-point score representing the likelihood |
||
31 | // of the domain of the URL to rank well in search engine results. |
||
32 | 2 | public static function getDomainAuthority($url = false) |
|
38 | |||
39 | // The number of external equity links to the URL. |
||
40 | // http://apiwiki.moz.com/glossary#equity |
||
41 | 2 | public static function getEquityLinkCount($url = false) |
|
47 | |||
48 | // The number of links (equity or nonequity or not, internal or external) to the URL. |
||
49 | 2 | public static function getLinkCount($url = false) |
|
55 | |||
56 | // The normalized 10-point MozRank score of the URL. |
||
57 | 2 | public static function getMozRank($url = false) |
|
63 | |||
64 | // The raw MozRank score of the URL. |
||
65 | 2 | public static function getMozRankRaw($url = false) |
|
71 | |||
72 | /** |
||
73 | * Return Link metrics from the (free) Mozscape (f.k.a. Seomoz) API. |
||
74 | * |
||
75 | * @access public |
||
76 | * @param cols string The bit flags you want returned. |
||
77 | * @param url string The URL to get metrics for. |
||
78 | */ |
||
79 | 5 | public static function getCols($cols, $url = false) |
|
80 | { |
||
81 | 5 | if ('' == Config\ApiKeys::getMozscapeAccessId() || |
|
82 | 5 | '' == Config\ApiKeys::getMozscapeSecretKey()) { |
|
83 | throw new E('In order to use the Mozscape API, you must obtain |
||
84 | and set an API key first (see SEOstats\Config\ApiKeys.php).'); |
||
85 | exit(0); |
||
86 | } |
||
87 | |||
88 | 5 | $expires = time() + 300; |
|
89 | |||
90 | 5 | $apiEndpoint = sprintf(Config\Services::MOZSCAPE_API_URL, |
|
91 | 5 | urlencode(Helper\Url::parseHost(parent::getUrl($url))), |
|
92 | 5 | $cols, |
|
93 | 5 | Config\ApiKeys::getMozscapeAccessId(), |
|
94 | 5 | $expires, |
|
95 | 5 | urlencode(self::_getUrlSafeSignature($expires)) |
|
96 | 5 | ); |
|
97 | |||
98 | 5 | $ret = static::_getPage($apiEndpoint); |
|
99 | |||
100 | 5 | return (!$ret || empty($ret) || '{}' == (string)$ret) |
|
101 | 5 | ? parent::noDataDefaultValue() |
|
102 | 5 | : Helper\Json::decode($ret, true); |
|
103 | } |
||
104 | |||
105 | 6 | private static function _getUrlSafeSignature($expires) |
|
106 | { |
||
107 | 6 | $data = Config\ApiKeys::getMozscapeAccessId() . "\n{$expires}"; |
|
108 | 6 | $sig = self::_hmacsha1($data, Config\ApiKeys::getMozscapeSecretKey()); |
|
109 | |||
110 | 6 | return base64_encode($sig); |
|
111 | } |
||
112 | |||
113 | 7 | private static function _hmacsha1($data, $key) |
|
123 | |||
124 | 1 | private static function _hmacsha1Rebuild($data, $key) |
|
140 | } |
||
141 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: