Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

SEO widget: domain name creation working for more date formats #3516

Closed
anonymous-piwik-user opened this Issue · 3 comments

3 participants

@anonymous-piwik-user

One error in RegExp on 'public function getAge()' return incorrect date creation:

Original function:
public function getAge()
{
$url = preg_replace('/^www./', '', $this->url);
$url = 'http://www.who.is/whois/'.urlencode($url);
$data = $this->getPage($url);
preg_match('#(?:Creation Date|Created On):\s*([ \ta-z0-9/-]+)#si', $data, $p);
if(!isset($p[1]))
{
return null;
}
$value = strtotime($p[1]);
if ($value === false) {
return null;
}
$value = Piwik::getPrettyTimeFromSeconds(time() - $value);
return $value;
}

Modified function:
public function getAge()
{
$url = preg_replace('/^www./', '', $this->url);
$url = 'http://www.who.is/whois/'.urlencode($url);
$data = $this->getPage($url);
---> preg_match('#(?:Creation Date|Created On):\s*([ \ta-z0-9/-:]+)#si', $data, $p);
if(!isset($p[1]))
{
return null;
}
$value = strtotime($p[1]);
if ($value === false) {
return null;
}
$value = Piwik::getPrettyTimeFromSeconds(time() - $value);
return $value;
}
Keywords: date creation

@anonymous-piwik-user

On file: ./plugins/SEO/RankChecker.php

@robocoder
Collaborator

Yeah, adding . and : will handle some more esoteric formats.

@mattab
Owner

(In [7410]) Fixes #3516 Thanks for the patch

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.