本文整理汇总了PHP中NNText::dateToDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP NNText::dateToDateFormat方法的具体用法?PHP NNText::dateToDateFormat怎么用?PHP NNText::dateToDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NNText
的用法示例。
在下文中一共展示了NNText::dateToDateFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
$label = $this->get('label');
$format = $this->get('format');
$date = JFactory::getDate();
$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
$date->setTimeZone($tz);
if ($format)
{
if (strpos($format, '%') !== false)
{
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
$format = NNText::dateToDateFormat($format);
}
$html = $date->format($format, 1);
}
else
{
$html = $date->format('', 1);
}
if ($label)
{
$html = JText::sprintf($label, $html);
}
return '<div class="nn_block nn_title">' . $html . '</div>';
}
示例2: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
$label = $this->get('label');
$format = $this->get('format');
$date = JFactory::getDate();
$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
$date->setTimeZone($tz);
if ($format) {
if (strpos($format, '%') !== false) {
require_once dirname(__DIR__) . '/helpers/text.php';
$format = NNText::dateToDateFormat($format);
}
$html = $date->format($format, true);
} else {
$html = $date->format('', true);
}
if ($label) {
$html = JText::sprintf($label, $html);
}
return '</div><div>' . $html;
}
示例3: convertDateToString
public function convertDateToString($string, $extra)
{
// Check if string could be a date
if (strpos($string, '-') == false || preg_match('#[a-z]#i', $string) || !strtotime($string)) {
return $string;
}
if (!$extra) {
$extra = JText::_('DATE_FORMAT_LC2');
}
if (strpos($extra, '%') !== false) {
$extra = NNText::dateToDateFormat($extra);
}
return JHtml::_('date', $string, $extra);
}
示例4: processArticle
//.........这里部分代码省略.........
}
$str[] = $str_part;
} else {
// character limit
if ($max < $count + strlen($str_part)) {
// strpart has to be cut off
$maxlen = $max - $count;
if ($maxlen < 3) {
$string = '';
if (preg_match('#[^a-z0-9]$#si', $str_part)) {
$string .= ' ';
}
if ($this->params->use_ellipsis) {
$string .= '...';
}
$str[] = $string;
} else {
$string = rtrim(substr($str_part, 0, $maxlen - 3));
if (preg_match('#[^a-z0-9]$#si', $string)) {
$string .= ' ';
}
if ($this->params->use_ellipsis) {
$string .= '...';
}
$str[] = $string;
}
break;
}
$count += strlen($str_part);
$str[] = $str_part;
}
}
}
}
// revers sort open tags
krsort($tags);
$tags = array_values($tags);
$count = count($tags);
for ($i = 0; $i < 3; $i++) {
foreach ($tags as $ti => $tag) {
if ($tag['0'] == '/') {
for ($oi = $ti + 1; $oi < $count; $oi++) {
$opentag = $tags[$oi];
if ($opentag == $tag) {
break;
}
if ('/' . $opentag == $tag) {
unset($tags[$ti]);
unset($tags[$oi]);
break;
}
}
}
}
}
foreach ($tags as $tag) {
// add closing tag to end of string
if ($tag['0'] != '/') {
$str[] = '</' . $tag . '>';
}
}
$str = implode('', $str);
$str = str_replace(array('<!-- ARTA_PAGENAVCOUNTER -->', '<!-- ARTA_PAGENAV -->'), array($pagenavcounter, $pagenav), $str);
}
}
// Fix links in pagination to point to the included article instead of the main article
// This doesn't seem to work correctly and causes issues with other links in the article
// So commented out untill I find a better solution
/*if ($art && isset($art->id) && $art->id) {
$str = str_replace('view=article&id=' . $art->id, 'view=article&id=' . $article->id, $str);
}*/
} else {
if (ctype_alnum(str_replace(array('-', '_'), '', $tag))) {
// Get data from db columns
if (isset($article->{$tag})) {
$str = $article->{$tag};
$ok = 1;
}
if ($ok && !(strpos($str, '-') == false) && !preg_match('#[a-z]#i', $str) && strtotime($str)) {
if (!$extra) {
$extra = JText::_('DATE_FORMAT_LC2');
}
if (!(strpos($extra, '%') === false)) {
$extra = NNText::dateToDateFormat($extra);
}
$str = JHtml::_('date', $str, $extra);
}
}
}
}
}
}
}
}
if ($ok) {
$text = str_replace($match['0'], $str, $text);
}
}
return $text;
}
示例5: dateToDateFormat
static function dateToDateFormat($dateFormat)
{
require_once __DIR__ . '/text.php';
return NNText::dateToDateFormat($dateFormat);
}