mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
Closes #4978 - {NEWS_MODIFIED} shortcode added.
This commit is contained in:
@@ -593,36 +593,54 @@ class news_shortcodes extends e_shortcode
|
|||||||
return "<a ".$style." href='".e107::getUrl()->create('news/list/category', $category)."'>".$category_name."</a>";
|
return "<a ".$style." href='".e107::getUrl()->create('news/list/category', $category)."'>".$category_name."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_news_date($parm=null)
|
private function formatDate($date, $parm)
|
||||||
{
|
{
|
||||||
$date = ($this->news_item['news_start'] > 0) ? $this->news_item['news_start'] : $this->news_item['news_datestamp'];
|
|
||||||
$con = e107::getDate();
|
$con = e107::getDate();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if(empty($parm))
|
if(empty($parm))
|
||||||
{
|
{
|
||||||
return $tp->toDate($date, 'long');
|
$ret = $tp->toDate($date, 'long');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret = '';
|
||||||
|
|
||||||
switch($parm)
|
switch($parm)
|
||||||
{
|
{
|
||||||
case 'long':
|
case 'long':
|
||||||
return $tp->toDate($date, 'long');
|
$ret = $tp->toDate($date, 'long');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'short':
|
case 'short':
|
||||||
return $tp->toDate($date, 'short');
|
$ret = $tp->toDate($date, 'short');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'forum':
|
case 'forum':
|
||||||
return $con->convert_date($date, 'forum');
|
$ret = $con->convert_date($date, 'forum');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return $tp->toDate($date,$parm);
|
$ret = $tp->toDate($date, $parm);
|
||||||
// return date($parm, $date);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_news_date($parm=null)
|
||||||
|
{
|
||||||
|
$date = ($this->news_item['news_start'] > 0) ? $this->news_item['news_start'] : $this->news_item['news_datestamp'];
|
||||||
|
return $this->formatDate($date, $parm);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_news_modified($parm=null)
|
||||||
|
{
|
||||||
|
return $this->formatDate($this->news_item['news_modified'], $parm);
|
||||||
|
}
|
||||||
|
|
||||||
function sc_news_author_avatar($parm=null)
|
function sc_news_author_avatar($parm=null)
|
||||||
{
|
{
|
||||||
|
@@ -549,6 +549,7 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
'news_meta_description' => 'Description for Facebook and search engines.',
|
'news_meta_description' => 'Description for Facebook and search engines.',
|
||||||
'news_meta_robots' => '',
|
'news_meta_robots' => '',
|
||||||
'news_datestamp' => '1454367600',
|
'news_datestamp' => '1454367600',
|
||||||
|
'news_modified' => '1654101979',
|
||||||
'news_author' => '1',
|
'news_author' => '1',
|
||||||
'news_category' => '1',
|
'news_category' => '1',
|
||||||
'news_allow_comments' => '0',
|
'news_allow_comments' => '0',
|
||||||
|
Reference in New Issue
Block a user