
<?php
// phx:newly
$ymdSeparater = '.';
$newDays = 7;
$outhtml = "<font color=#FF0000>New!</font>";
$newSec = $newDays * 86400; //24H x 60min x 60sec = 86400
$curDate = explode(' ', $output);
$half = is_array($curDate)?$curDate[0]:$curDate;
$ymd = explode($ymdSeparater , $half);
$curTime = mktime (23,59,59, $ymd[1], $ymd[2], $ymd[0]);
if($curTime > (time()- $newSec)) {
return $outhtml;
}
return '';
?>
<?php
$placeholders['newicon'] = array("createdon","whatsNew");
if (!function_exists("whatsNew")) {
function whatsNew($resource) {
global $modx;
$newmark = "";
$now = time();
$time = intval($resource['createdon']) + $modx->config["server_offset_time"];
$erapse = $now - $time;
if ($erapse <= 7*60*60*24) {
$newmark = "NEW!!";
}
return $newmark;
}
}
?>
&extenders=`newicon`
[+newicon+]
<?php
$placeholders['newicon'] = array("editedon,createdon,pub_date","whatsNew");
$newDays = isset($newDays) ? $newDays : 7;
$newMark = isset($newMark) ? $newMark : "NEW!!";
$GLOBALS['ditto_newicon'] = compact("dateSource","newDays","newMark");
if (!function_exists("whatsNew")) {
function whatsNew($resource) {
global $modx, $ditto_newicon;
$now = time();
$timestamp = ($resource[$ditto_newicon["dateSource"]] != "0") ? $resource[$ditto_newicon["dateSource"]] : $resource['createdon'];
$erapse = $now - (intval($timestamp) + $modx->config["server_offset_time"]);
if ($erapse <= $ditto_newicon["newDays"]*60*60*24) {
return $ditto_newicon["newMark"];
}
return "";
}
}
?>
&newDays=`3`
&newMark=`キタ━━━━(゚∀゚)━━━━!!`
[+newicon+]