#3516 closed Bug (fixed)

SEO widget: domain name creation working for more date formats

Reported by: tonibilly Owned by:
Priority: major Milestone: 1.9.2 - Piwik 1.9.2
Component: Core Keywords: date creation
Cc: Sensitive: no

Description

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;

}

Change History (4)

comment:1 Changed 18 months ago by tonibilly

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

comment:2 Changed 18 months ago by vipsoft (robocoder)

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

comment:3 Changed 17 months ago by matt (mattab)

  • Milestone set to 1.9.2 - Piwik 1.9.2
  • Summary changed from Domain Date Creation to SEO widget: domain name creation working for more date formats

comment:4 Changed 17 months ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.