Skip to content
Extraits de code Groupes Projets
Valider 6f5eabe3 rédigé par pebosi's avatar pebosi Validation de Stefan Giehl
Parcourir les fichiers

Remove dmoz entries, as dmoz is offline (#11597)

* Delete Dmoz.php

* Remove dmoz entries, as dmoz is offline

* Remove dmoz entries, as dmoz is offline

* Remove dmoz entries, as dmoz is offline
parent 3f4d252e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -23,7 +23,7 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/Referrers/functions.php';
/**
* The SEO API lets you access a list of SEO metrics for the specified URL: Google PageRank, Google/Bing indexed pages
* Alexa Rank, age of the Domain name and count of DMOZ entries.
* Alexa Ranka and age of the Domain name.
*
* @method static API getInstance()
*/
......
......@@ -50,7 +50,6 @@ class Aggregator implements MetricsProvider
$container->get('Piwik\Plugins\SEO\Metric\Bing'),
$container->get('Piwik\Plugins\SEO\Metric\Alexa'),
$container->get('Piwik\Plugins\SEO\Metric\DomainAge'),
$container->get('Piwik\Plugins\SEO\Metric\Dmoz'),
);
/**
......
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\SEO\Metric;
use Piwik\Http;
use Piwik\NumberFormatter;
use Psr\Log\LoggerInterface;
/**
* Retrieves the number of Dmoz.org entries.
*/
class Dmoz implements MetricsProvider
{
const URL = 'http://www.dmoz.org/search?q=';
/**
* @var LoggerInterface
*/
private $logger;
/**
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public function getMetrics($domain)
{
try {
$response = Http::sendHttpRequest(self::URL . urlencode($domain), $timeout = 10, @$_SERVER['HTTP_USER_AGENT']);
preg_match('#[0-9] - [0-9]+ of ([0-9]+)#', $response, $p);
if (!empty($p[1])) {
$value = NumberFormatter::getInstance()->formatNumber((int)$p[1]);
} else {
$value = 0;
}
// Add DMOZ only if > 0 entries found
if ($value == 0) {
return array();
}
} catch (\Exception $e) {
$this->logger->warning('Error while getting Dmoz SEO stats: {message}', array('message' => $e->getMessage()));
$value = null;
}
$logo = "plugins/Morpheus/icons/dist/SEO/dmoz.org.png";
return array(
new Metric('dmoz', 'SEO_Dmoz', $value, $logo)
);
}
}
......@@ -3,11 +3,10 @@
"PluginDescription": "This Plugin extracts and displays SEO metrics: Alexa web ranking, Google Pagerank, number of Indexed pages and backlinks of the currently selected website.",
"AlexaRank": "Alexa Rank",
"Bing_IndexedPages": "Bing indexed pages",
"Dmoz": "DMOZ entries",
"DomainAge": "Domain Age",
"Google_IndexedPages": "Google indexed pages",
"Rank": "Rank",
"SeoRankings": "SEO Rankings",
"SEORankingsFor": "SEO Rankings for %s"
}
}
\ No newline at end of file
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter