本文整理汇总了PHP中Piwik_Common::extractSearchEngineInformationFromUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Common::extractSearchEngineInformationFromUrl方法的具体用法?PHP Piwik_Common::extractSearchEngineInformationFromUrl怎么用?PHP Piwik_Common::extractSearchEngineInformationFromUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Common
的用法示例。
在下文中一共展示了Piwik_Common::extractSearchEngineInformationFromUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_extractSearchEngineInformationFromUrl
public function test_extractSearchEngineInformationFromUrl()
{
$urls = array('http://uk.search.yahoo.com/search?p=piwik&ei=UTF-8&fr=moz2' => array('name' => 'Yahoo!', 'keywords' => 'piwik'), 'http://www.google.com/search?hl=en&q=+piWIk+&btnG=Google+Search&aq=f&oq=' => array('name' => 'Google', 'keywords' => 'piwik'), 'http://images.google.com/imgres?imgurl=http://www.linux-corner.info/snapshot1.png&imgrefurl=http://www.oxxus.net/blog/archives/date/2007/10/page/41/&usg=__-xYvnp1IKpRZKjRDQVhpfExMkuM=&h=781&w=937&sz=203&hl=en&start=1&tbnid=P9LqKMIbdhlg-M:&tbnh=123&tbnw=148&prev=/images%3Fq%3Dthis%2Bmy%2Bquery%2Bwith%2Bhttp://domain%2Bname%2Band%2Bstrange%2Bcharacters%2B%2526%2B%255E%2B%257C%2B%253C%253E%2B%2525%2B%2522%2B%2527%2527%2BEOL%26gbv%3D2%26hl%3Den%26sa%3DG' => array('name' => 'Google Images', 'keywords' => 'this my query with http://domain name and strange characters & ^ | <> % " \'\' eol'), 'http://www.google.fr/search?hl=en&q=%3C%3E+%26test%3B+piwik+%26quot%3B&ei=GcXJSb-VKoKEsAPmnIjzBw&sa=X&oi=revisions_inline&ct=unquoted-query-link' => array('name' => 'Google', 'keywords' => '<> &test; piwik "'), 'http://www.baidu.com/s?ie=gb2312&bs=%BF%D5%BC%E4+hao123+%7C+%B8%FC%B6%E0%3E%3E&sr=&z=&cl=3&f=8&tn=baidu&wd=%BF%D5%BC%E4+%BA%C3123+%7C+%B8%FC%B6%E0%3E%3E&ct=0' => array('name' => 'Baidu', 'keywords' => '空间 好123 | 更多>>'), 'http://www.baidu.com/s?kw=&sc=web&cl=3&tn=sitehao123&ct=0&rn=&lm=&ie=gb2312&rs2=&myselectvalue=&f=&pv=&z=&from=&word=%B7%E8%BF%F1%CB%B5%D3%A2%D3%EF+%D4%DA%CF%DF%B9%DB%BF%B4' => array('name' => 'Baidu', 'keywords' => '疯狂说英语 在线观看'), 'http://www.baidu.com/s?wd=%C1%F7%D0%D0%C3%C0%D3%EF%CF%C2%D4%D8' => array('name' => 'Baidu', 'keywords' => '流行美语下载'), 'http://web.gougou.com/search?search=%E5%85%A8%E9%83%A8&id=1' => array('name' => 'Baidu', 'keywords' => '全部'), 'http://www.google.cn/search?hl=zh-CN&q=%E6%B5%8F%E8%A7%88%E5%85%AC%E4%BA%A4%E5%9C%B0%E9%93%81%E7%AB%99%E7%82%B9%E4%BF%A1%E6%81%AF&btnG=Google+%E6%90%9C%E7%B4%A2&meta=cr%3DcountryCN&aq=f&oq=' => array('name' => 'Google', 'keywords' => '浏览公交地铁站点信息'), 'http://hledani.tiscali.cz/web/search.php?lang=cs&query=v+%E8esk%E9m+internetu&kde=cz_internet' => array('name' => 'Tiscali', 'keywords' => 'v českém internetu'), 'http://yandex.ru/yandsearch?text=%D1%87%D0%B0%D1%81%D1%82%D0%BE%D1%82%D0%B0+%D1%80%D0%B0%D1%81%D0%BF%D0%B0%D0%B4%D0%B0+%D1%81%D1%82%D0%B5%D0%BA%D0%BB%D0%B0&stpar2=%2Fh1%2Ftm11%2Fs1&stpar4=%2Fs1&stpar1=%2Fu0%27,%20%27%D1%87%D0%B0%D1%81%D1%82%D0%BE%D1%82%D0%B0+%D1%80%D0%B0%D1%81%D0%BF%D0%B0%D0%B4%D0%B0+%D1%81%D1%82%D0%B5%D0%BA%D0%BB%D0%B0' => array('name' => 'Yandex', 'keywords' => 'частота распада стекла'), 'http://yandex.ru/yandsearch?text=%D1%81%D0%BF%D0%BE%D1%80%D1%82%D0%B7%D0%B4%D1%80%D0%B0%D0%B2' => array('name' => 'Yandex', 'keywords' => 'спортздрав'), 'http://www.google.ge/search?hl=en&q=%E1%83%A1%E1%83%90%E1%83%A5%E1%83%90%E1%83%A0%E1%83%97%E1%83%95%E1%83%94%E1%83%9A%E1%83%9D&btnG=Google+Search' => array('name' => 'Google', 'keywords' => 'საქართველო'), 'http://www.google.com/url?sa=t&source=web&ct=res&cd=7&url=http%3A%2F%2Fwww.example.com%2Fmypage.htm&ei=0SjdSa-1N5O8M_qW8dQN&rct=j&q=flowers&usg=AFQjCNHJXSUh7Vw7oubPaO3tZOzz-F-u_w&sig2=X8uCFh6IoPtnwmvGMULQfw' => array('name' => 'Google', 'keywords' => 'flowers'));
foreach ($urls as $refererUrl => $expectedReturnedValue) {
$returnedValue = Piwik_Common::extractSearchEngineInformationFromUrl($refererUrl);
$exported = var_export($returnedValue, true);
$result = $expectedReturnedValue === $returnedValue;
$this->assertTrue($result);
if (!$result) {
echo "error in extracting from {$refererUrl} got " . $exported . "<br>";
}
}
}
示例2: detectRefererSearchEngine
protected function detectRefererSearchEngine()
{
$searchEngineInformation = Piwik_Common::extractSearchEngineInformationFromUrl(html_entity_decode($this->refererUrl));
if ($searchEngineInformation === false) {
return false;
}
$this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_SEARCH_ENGINE;
$this->nameRefererAnalyzed = $searchEngineInformation['name'];
$this->keywordRefererAnalyzed = $searchEngineInformation['keywords'];
return true;
}
示例3: testExtractSearchEngineInformationFromUrl
/**
* @dataProvider getSearchEngineUrls
* @group Core
* @group Common
* @group extractSearchEngineInformationFromUrl
*/
public function testExtractSearchEngineInformationFromUrl($referrerUrl, $expectedReturnedValue)
{
include "DataFiles/SearchEngines.php";
include "DataFiles/Countries.php";
$returnedValue = Piwik_Common::extractSearchEngineInformationFromUrl($referrerUrl);
$this->assertEquals($expectedReturnedValue, $returnedValue);
}