Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anonymous-matomo-user opened this issue Nov 5, 2012 · 3 comments
Closed
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@anonymous-matomo-user
Copy link

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-matomo-user
Copy link
Author

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

@robocoder
Copy link
Contributor

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

@mattab
Copy link
Member

mattab commented Nov 9, 2012

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

@anonymous-matomo-user anonymous-matomo-user added this to the 1.9.2 - Piwik 1.9.2 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

3 participants