Commit c3ac94c1 by Hikonobu Kurihara

Added modifier plugins

parent 4cc60391
<?php
function Dwoo_Plugin_clean_datetime(Dwoo $dwoo, $datetime) {
return date('Y-m-d H:i:s', strtotime($datetime));
}
<?php
function Dwoo_Plugin_jp_date(Dwoo $dwoo, $date) {
if (preg_match('/(\d{4})[\/\-]?(\d{2})[\/\-]?(\d{2})/', $date, $matched)) {
return $matched[1] . '年' . (int)$matched[2] . '月' . (int)$matched[3] . '日';
}
else {
return $date;
}
}
<?php
function Dwoo_Plugin_jp_datetime(Dwoo $dwoo, $datetime) {
if (preg_match('/(\d{4})[\/\-]?(\d{2})[\/\-]?(\d{2}) (\d{2}):(\d{2}):(\d{2})/', $datetime, $matched)) {
return $matched[1] . '年' . (int)$matched[2] . '月' . (int)$matched[3] . '日' . (int)$matched[4] . '時' . (int)$matched[5] . '分';
}
else {
return $datetime;
}
}
<?php
function Dwoo_Plugin_remain_jp(Dwoo $dwoo, $input) {
if ($input === null) {
return '';
}
$min = intval($input / 60);
$sec = $input - $min * 60;
if ($min > 0) {
return $min . '分' . $sec . '秒';
}
else {
return $sec . '秒';
}
}
<?php
function Dwoo_Plugin_tinytime(Dwoo $dwoo, $input) {
if (!$input) {
return '';
}
$time = strtotime($input);
if ($time > time() - 3600) {
return intval((time() - $time) / 60) . '分前';
}
else if ($time > time() - 3600 * 24) {
return intval((time() - $time) / 3600) . '時間前';
}
else if ($time > time() - 3600 * 24 * 90) {
return intval((time() - $time) / (3600 * 24)) . '日前';
}
else {
return date('n月j日', $time);
}
}
<?php
function Dwoo_Plugin_z2h_compile(Dwoo_Compiler $compiler, $value)
{
return 'mb_convert_kana((string) '.$value.', "ak", "utf-8")';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment