diff --git a/components/com_content/views/article/tmpl/default.php b/components/com_content/views/article/tmpl/default.php index a549b8c8957ac..77c1b2268add1 100644 --- a/components/com_content/views/article/tmpl/default.php +++ b/components/com_content/views/article/tmpl/default.php @@ -22,6 +22,10 @@ $assocParam = (JLanguageAssociations::isEnabled() && $params->get('show_associations')); JHtml::_('behavior.caption'); +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); +$isNotPublishedYet = $this->item->publish_up > $currentDate; +$isExpired = $this->item->publish_down < $currentDate && $this->item->publish_down !== JFactory::getDbo()->getNullDate(); + ?>
@@ -54,10 +58,10 @@ item->state == 0) : ?> - item->publish_up) > strtotime(JFactory::getDate())) : ?> + - item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate()) : ?> +
diff --git a/components/com_content/views/category/tmpl/blog_item.php b/components/com_content/views/category/tmpl/blog_item.php index aaf3432a708c5..1da735983a592 100644 --- a/components/com_content/views/category/tmpl/blog_item.php +++ b/components/com_content/views/category/tmpl/blog_item.php @@ -18,9 +18,12 @@ // Check if associations are implemented. If they are, define the parameter. $assocParam = (JLanguageAssociations::isEnabled() && $params->get('show_associations')); +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); +$isUnpublished = ($this->item->state == 0 || $this->item->publish_up > $currentDate) + || ($this->item->publish_down < $currentDate && $this->item->publish_down !== JFactory::getDbo()->getNullDate()); + ?> -item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate())) : ?> +
@@ -79,9 +82,8 @@ -item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate())) : ?> -
+ + diff --git a/components/com_content/views/category/tmpl/default_articles.php b/components/com_content/views/category/tmpl/default_articles.php index 678c570147a20..751d8a520d0eb 100644 --- a/components/com_content/views/category/tmpl/default_articles.php +++ b/components/com_content/views/category/tmpl/default_articles.php @@ -20,9 +20,9 @@ $listDirn = $this->escape($this->state->get('list.direction')); $langFilter = false; -// Tags filtering based on language filter +// Tags filtering based on language filter if (($this->params->get('filter_field') === 'tag') && (Multilanguage::isEnabled())) -{ +{ $tagfilter = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter'); switch ($tagfilter) @@ -63,6 +63,10 @@ '); $tableClass = $this->params->get('show_headings') != 1 ? ' table-noheader' : ''; + +$nullDate = JFactory::getDbo()->getNullDate(); +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); + ?>
params->get('filter_field') !== 'hide' || $this->params->get('show_pagination_limit')) : ?> @@ -213,12 +217,12 @@ - publish_up) > strtotime(JFactory::getDate())) : ?> + publish_up > $currentDate) : ?> - publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != JFactory::getDbo()->getNullDate()) : ?> + publish_down < $currentDate && $article->publish_down !== $nullDate) : ?> diff --git a/components/com_content/views/featured/tmpl/default_item.php b/components/com_content/views/featured/tmpl/default_item.php index 696a47ff1154e..c021f9b81d12a 100644 --- a/components/com_content/views/featured/tmpl/default_item.php +++ b/components/com_content/views/featured/tmpl/default_item.php @@ -16,10 +16,14 @@ // Check if associations are implemented. If they are, define the parameter. $assocParam = (JLanguageAssociations::isEnabled() && $params->get('show_associations')); -?> -item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate())) : ?> +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); +$isExpired = $this->item->publish_down < $currentDate && $this->item->publish_down !== JFactory::getDbo()->getNullDate(); +$isNotPublishedYet = $this->item->publish_up > $currentDate; +$isUnpublished = $this->item->state == 0 || $isNotPublishedYet || $isExpired; + +?> +
@@ -38,10 +42,10 @@ item->state == 0) : ?> -item->publish_up) > strtotime(JFactory::getDate())) : ?> + -item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate()) : ?> + @@ -96,8 +100,7 @@ -item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != $this->db->getNullDate() )) : ?> +
diff --git a/layouts/joomla/content/blog_style_default_item_title.php b/layouts/joomla/content/blog_style_default_item_title.php index d7eeac9ccf612..1b3f6c4521101 100644 --- a/layouts/joomla/content/blog_style_default_item_title.php +++ b/layouts/joomla/content/blog_style_default_item_title.php @@ -12,9 +12,11 @@ // Create a shortcut for params. $params = $displayData->params; $canEdit = $displayData->params->get('access-edit'); + +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); ?> - state == 0 || $params->get('show_title') || ($params->get('show_author') && !empty($displayData->author ))) : ?> diff --git a/layouts/joomla/content/icons/edit.php b/layouts/joomla/content/icons/edit.php index 47e1d1444e80a..6079b500bec84 100644 --- a/layouts/joomla/content/icons/edit.php +++ b/layouts/joomla/content/icons/edit.php @@ -17,12 +17,15 @@ // @deprecated 4.0 The legacy icon flag will be removed from this layout in 4.0 $legacy = $displayData['legacy']; +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); +$isUnpublished = ($article->publish_up > $currentDate) + || ($article->publish_down < $currentDate && $article->publish_down !== JFactory::getDbo()->getNullDate()); + if ($legacy) { $icon = $article->state ? 'edit.png' : 'edit_unpublished.png'; - if (strtotime($article->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != JFactory::getDbo()->getNullDate())) + if ($isUnpublished) { $icon = 'edit_unpublished.png'; } @@ -31,8 +34,7 @@ { $icon = $article->state ? 'edit' : 'eye-close'; - if (strtotime($article->publish_up) > strtotime(JFactory::getDate()) - || ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != JFactory::getDbo()->getNullDate())) + if ($isUnpublished) { $icon = 'eye-close'; } diff --git a/templates/beez3/html/com_content/category/blog_item.php b/templates/beez3/html/com_content/category/blog_item.php index 8fe4867732891..7336adce5e9df 100644 --- a/templates/beez3/html/com_content/category/blog_item.php +++ b/templates/beez3/html/com_content/category/blog_item.php @@ -14,12 +14,14 @@ $canEdit = $this->item->params->get('access-edit'); JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); -?> +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); +$isUnpublished = ($this->item->state == 0 || $this->item->publish_up > $currentDate) + || ($this->item->publish_down < $currentDate && $this->item->publish_down !== JFactory::getDbo()->getNullDate()); -item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || (strtotime($this->item->publish_down) < strtotime(JFactory::getDate()) && $this->item->publish_down !== JFactory::getDbo()->getNullDate())) : ?> -
+?> + +
get('show_title')) : ?>

@@ -159,9 +161,8 @@

-item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || (strtotime($this->item->publish_down) < strtotime(JFactory::getDate()) && $this->item->publish_down !== JFactory::getDbo()->getNullDate())) : ?> -

+ +
diff --git a/templates/beez3/html/com_content/featured/default_item.php b/templates/beez3/html/com_content/featured/default_item.php index 90beb1210d5a7..52a419f9d5c7a 100644 --- a/templates/beez3/html/com_content/featured/default_item.php +++ b/templates/beez3/html/com_content/featured/default_item.php @@ -20,11 +20,13 @@ $app = JFactory::getApplication(); $templateparams = $app->getTemplate(true)->params; -?> +$currentDate = JFactory::getDate()->format('Y-m-d H:i:s'); +$isUnpublished = ($this->item->state == 0 || $this->item->publish_up > $currentDate) + || ($this->item->publish_down < $currentDate && $this->item->publish_down !== JFactory::getDbo()->getNullDate()); -item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || (strtotime($this->item->publish_down) < strtotime(JFactory::getDate()) && $this->item->publish_down !== JFactory::getDbo()->getNullDate())) : ?> -
+?> + +
get('show_title')) : ?>

@@ -169,9 +171,8 @@

-item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate()) - || (strtotime($this->item->publish_down) < strtotime(JFactory::getDate()) && $this->item->publish_down !== JFactory::getDbo()->getNullDate())) : ?> -

+ +