Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2015-10-07 05:40:45 +0300
committermattab <matthieu.aubry@gmail.com>2015-10-07 05:40:45 +0300
commit2bb4e75e3315196ff584cb8a329c1df65c3ab947 (patch)
tree2f010db691b30107cbae632b73c58204fff650f4 /plugins/SEO
parent48115990a5128a612236d7290f183108622b8d43 (diff)
Remove Majestic SEO feature
Diffstat (limited to 'plugins/SEO')
-rw-r--r--plugins/SEO/Metric/Aggregator.php1
-rw-r--r--plugins/SEO/Metric/Majestic.php129
-rw-r--r--plugins/SEO/lang/en.json5
-rw-r--r--plugins/SEO/templates/getRank.twig4
4 files changed, 2 insertions, 137 deletions
diff --git a/plugins/SEO/Metric/Aggregator.php b/plugins/SEO/Metric/Aggregator.php
index bdaf430000..ef3c93e606 100644
--- a/plugins/SEO/Metric/Aggregator.php
+++ b/plugins/SEO/Metric/Aggregator.php
@@ -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\Majestic'),
$container->get('Piwik\Plugins\SEO\Metric\Dmoz'),
);
diff --git a/plugins/SEO/Metric/Majestic.php b/plugins/SEO/Metric/Majestic.php
deleted file mode 100644
index f276232945..0000000000
--- a/plugins/SEO/Metric/Majestic.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?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 Psr\Log\LoggerInterface;
-
-/**
- * Client for Majestic SEO's HTTP API.
- */
-class Majestic implements MetricsProvider
-{
- const API_BASE = 'http://simpleapi.majesticseo.com/sapi/';
- const API_KEY = 'ETHPYY'; // please only use this key within Piwik
- const LOGO = 'plugins/SEO/images/majesticseo.png';
-
- /**
- * @var LoggerInterface
- */
- private $logger;
-
- /**
- * @param LoggerInterface $logger
- */
- public function __construct(LoggerInterface $logger)
- {
- $this->logger = $logger;
- }
-
- public function getMetrics($domain)
- {
- try {
- $stats = $this->getBacklinkStats($domain);
- $backlinks = $stats['backlink_count'];
- $referrers = $stats['referrer_domains_count'];
- } catch (\Exception $e) {
- $this->logger->warning('Error while getting Majestic SEO stats: {message}', array('message' => $e->getMessage()));
- $backlinks = null;
- $referrers = null;
- }
-
- $link = $this->getLinkForUrl($domain);
-
- return array(
- new Metric('external-backlinks', 'SEO_ExternalBacklinks', $backlinks, self::LOGO, $link, 'SEO_ViewBacklinksOnMajesticSEO'),
- new Metric('referrer-domains', 'SEO_ReferrerDomains', $referrers, self::LOGO, $link, 'SEO_ViewBacklinksOnMajesticSEO'),
- );
- }
-
- /**
- * Returns a URL that can be used to view all SEO data for a particular website.
- *
- * @param string $targetSiteUrl The URL of the website for whom SEO stats should be
- * accessible for.
- * @return string
- */
- private function getLinkForUrl($targetSiteUrl)
- {
- $domain = @parse_url($targetSiteUrl, PHP_URL_HOST);
- return "http://www.majesticseo.com/reports/site-explorer/summary/$domain?IndexDataSource=F";
- }
-
- /**
- * Returns backlink statistics including the count of backlinks and count of
- * referrer domains (domains with backlinks).
- *
- * This method issues an HTTP request and waits for it to return.
- *
- * @param string $siteDomain The domain of the website to get stats for.
- * @param int $timeout The number of seconds to wait before aborting
- * the HTTP request.
- * @return array An array containing the backlink count and referrer
- * domain count:
- * array(
- * 'backlink_count' => X,
- * 'referrer_domains_count' => Y
- * )
- * If either stat is false, either the API returned an
- * error, or the IP was blocked for this request.
- */
- private function getBacklinkStats($siteDomain, $timeout = 300)
- {
- $apiUrl = $this->getApiUrl($method = 'GetBacklinkStats', $args = array(
- 'items' => '1',
- 'item0' => $siteDomain
- ));
- $apiResponse = Http::sendHttpRequest($apiUrl, $timeout);
-
- $result = array(
- 'backlink_count' => false,
- 'referrer_domains_count' => false
- );
-
- $apiResponse = json_decode($apiResponse, $assoc = true);
- if (!empty($apiResponse)
- && !empty($apiResponse['Data'])
- ) {
- $siteSeoStats = reset($apiResponse['Data']);
-
- if (isset($siteSeoStats['ExtBackLinks'])
- && $siteSeoStats['ExtBackLinks'] !== -1
- ) {
- $result['backlink_count'] = $siteSeoStats['ExtBackLinks'];
- }
-
- if (isset($siteSeoStats['RefDomains'])
- && $siteSeoStats['RefDomains'] !== -1
- ) {
- $result['referrer_domains_count'] = $siteSeoStats['RefDomains'];
- }
- }
-
- return $result;
- }
-
- private function getApiUrl($method, $args = array())
- {
- $args['sak'] = self::API_KEY;
-
- $queryString = http_build_query($args);
- return self::API_BASE . $method . '?' . $queryString;
- }
-}
diff --git a/plugins/SEO/lang/en.json b/plugins/SEO/lang/en.json
index 5052c37441..7007ad48f2 100644
--- a/plugins/SEO/lang/en.json
+++ b/plugins/SEO/lang/en.json
@@ -5,12 +5,9 @@
"Bing_IndexedPages": "Bing indexed pages",
"Dmoz": "DMOZ entries",
"DomainAge": "Domain Age",
- "ExternalBacklinks": "External Backlinks (Majestic)",
"Google_IndexedPages": "Google indexed pages",
"Rank": "Rank",
- "ReferrerDomains": "Referrer Domains (Majestic)",
"SeoRankings": "SEO Rankings",
- "SEORankingsFor": "SEO Rankings for %s",
- "ViewBacklinksOnMajesticSEO": "View External Backlinks report on MajesticSEO.com"
+ "SEORankingsFor": "SEO Rankings for %s"
}
} \ No newline at end of file
diff --git a/plugins/SEO/templates/getRank.twig b/plugins/SEO/templates/getRank.twig
index 80bf40ef7b..6eb025d7e4 100644
--- a/plugins/SEO/templates/getRank.twig
+++ b/plugins/SEO/templates/getRank.twig
@@ -28,11 +28,9 @@
{% set seoLink %}{% if rank.logo_link is not empty %}<a class="linkContent" href="?module=Proxy&action=redirect&url={{ rank.logo_link|url_encode }}"
target="_blank"
{% if rank.logo_tooltip is not empty %}title="{{ rank.logo_tooltip }}"{% endif %}>{% endif %}{% endset %}
- {% set majesticLink %}{{ seoLink }}Majestic</a>{% endset %}
<td>{% if rank.logo_link is not empty %}{{ seoLink|raw }}{% endif %}<img
style='vertical-align:middle;margin-right:6px;' src='{{ rank.logo }}' border='0'
- alt="{{ rank.label }}">{% if rank.logo_link is not empty %}</a>{% endif %} {{ rank.label|replace({"Majestic":
- majesticLink})|raw }}
+ alt="{{ rank.label }}">{% if rank.logo_link is not empty %}</a>{% endif %} {{ rank.label|raw }}
</td>
<td>
<div style="margin-left:15px;">