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 Anthon Pang Matthieu Aubry
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

Anthon Pang
Collaborator

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

Matthieu Aubry
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.