Skip to content
Extraits de code Groupes Projets
Valider ce3b6eb6 rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

refs #5114 added detection for yahoo! japan; improved handling for search enginge detection

parent a8780b81
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -943,6 +943,12 @@ if (!isset($GLOBALS['Piwik_SearchEngines'])) { ...@@ -943,6 +943,12 @@ if (!isset($GLOBALS['Piwik_SearchEngines'])) {
// X-recherche // X-recherche
'www.x-recherche.com' => array('X-Recherche', 'MOTS', 'cgi-bin/websearch?MOTS={k}'), 'www.x-recherche.com' => array('X-Recherche', 'MOTS', 'cgi-bin/websearch?MOTS={k}'),
// Yahoo! Japan
'search.yahoo.co.jp' => array('Yahoo! Japan', 'p', 'search?p={k}'),
'video.search.yahoo.co.jp' => array('Yahoo! Japan Videos', 'p', 'search?p={k}'),
'image.search.yahoo.co.jp' => array('Yahoo! Japan Images', 'p', 'search?p={k}'),
// Yahoo // Yahoo
'search.yahoo.com' => array('Yahoo!', array('p', 'q'), 'search?p={k}'), 'search.yahoo.com' => array('Yahoo!', array('p', 'q'), 'search?p={k}'),
// '*.search.yahoo.com' => array('Yahoo!'), // see built-in helper in Common.php // '*.search.yahoo.com' => array('Yahoo!'), // see built-in helper in Common.php
...@@ -953,8 +959,6 @@ if (!isset($GLOBALS['Piwik_SearchEngines'])) { ...@@ -953,8 +959,6 @@ if (!isset($GLOBALS['Piwik_SearchEngines'])) {
'espanol.yahoo.com' => array('Yahoo!'), 'espanol.yahoo.com' => array('Yahoo!'),
'qc.yahoo.com' => array('Yahoo!'), 'qc.yahoo.com' => array('Yahoo!'),
'one.cn.yahoo.com' => array('Yahoo!'), 'one.cn.yahoo.com' => array('Yahoo!'),
'video.search.yahoo.co.jp' => array('Yahoo!'),
'image.search.yahoo.co.jp' => array('Yahoo!'),
// Powered by Yahoo APIs // Powered by Yahoo APIs
'www.cercato.it' => array('Yahoo!', 'q'), 'www.cercato.it' => array('Yahoo!', 'q'),
......
...@@ -286,8 +286,18 @@ class UrlHelper ...@@ -286,8 +286,18 @@ class UrlHelper
$searchEngines = Common::getSearchEngineUrls(); $searchEngines = Common::getSearchEngineUrls();
$hostPattern = self::getLossyUrl($referrerHost); $hostPattern = self::getLossyUrl($referrerHost);
/*
* Try to get the best matching 'host' in definitions
* 1. check if host + path matches an definition
* 2. check if host only matches
* 3. check if host pattern + path matches
* 4. check if host pattern matches
* 5. special handling
*/
if (array_key_exists($referrerHost . $referrerPath, $searchEngines)) { if (array_key_exists($referrerHost . $referrerPath, $searchEngines)) {
$referrerHost = $referrerHost . $referrerPath; $referrerHost = $referrerHost . $referrerPath;
} elseif (array_key_exists($referrerHost, $searchEngines)) {
// no need to change host
} elseif (array_key_exists($hostPattern . $referrerPath, $searchEngines)) { } elseif (array_key_exists($hostPattern . $referrerPath, $searchEngines)) {
$referrerHost = $hostPattern . $referrerPath; $referrerHost = $hostPattern . $referrerPath;
} elseif (array_key_exists($hostPattern, $searchEngines)) { } elseif (array_key_exists($hostPattern, $searchEngines)) {
......
...@@ -379,9 +379,17 @@ ...@@ -379,9 +379,17 @@
keywords: 'searchterm' keywords: 'searchterm'
- url: 'http://image.search.yahoo.co.jp/search?ei=UTF-8&fr=top_ga1_sa&p=%EF%BD%94%EF%BD%8F+%EF%BD%88%EF%BD%85%EF%BD%81%EF%BD%92%EF%BD%94+%EF%BD%8C%EF%BD%8F%EF%BD%87%EF%BD%8F' - url: 'http://image.search.yahoo.co.jp/search?ei=UTF-8&fr=top_ga1_sa&p=%EF%BD%94%EF%BD%8F+%EF%BD%88%EF%BD%85%EF%BD%81%EF%BD%92%EF%BD%94+%EF%BD%8C%EF%BD%8F%EF%BD%87%EF%BD%8F'
engine: 'Yahoo!' engine: 'Yahoo! Japan Images'
keywords: 'to heart logo' keywords: 'to heart logo'
- url: 'http://video.search.yahoo.co.jp/search?tt=c&ei=UTF-8&fr=sfp_as&aq=-1&oq=&p=piwik&meta=vc%3D'
engine: 'Yahoo! Japan Videos'
keywords: 'piwik'
- url: 'http://search.yahoo.co.jp/search?ei=UTF-8&p=piwik'
engine: 'Yahoo! Japan'
keywords: 'piwik'
- url: 'http://www.claro-search.com/?q=logiciels+pour+%C3%A9crire+en+japonais+avec+windows+xp&s=web&as=0&rlz=0&babsrc=SP_clro' - url: 'http://www.claro-search.com/?q=logiciels+pour+%C3%A9crire+en+japonais+avec+windows+xp&s=web&as=0&rlz=0&babsrc=SP_clro'
engine: 'Claro Search' engine: 'Claro Search'
keywords: 'logiciels pour écrire en japonais avec windows xp' keywords: 'logiciels pour écrire en japonais avec windows xp'
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter