diff --git a/admin/views/item/view.html.php b/admin/views/item/view.html.php index cda2d3c26b5..6bf8d0da27a 100644 --- a/admin/views/item/view.html.php +++ b/admin/views/item/view.html.php @@ -182,6 +182,7 @@ function display( $tpl = null ) } // Add a preview button for LATEST version of the item + $_sh404sef = JPluginHelper::isEnabled('system', 'sh404sef'); if ( $cid ) { // Domain URL and autologin vars @@ -194,7 +195,8 @@ function display( $tpl = null ) if ( $isAdmin ) JFactory::$application = JApplication::getInstance('site'); // Create the URL - $item_url = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->id.':'.$item->alias, $categories[$item->catid]->slug) . $autologin ); + $item_url = FlexicontentHelperRoute::getItemRoute($item->id.':'.$item->alias, $categories[$item->catid]->slug) . $autologin; + $item_url = $_sh404sef ? $item_url : JRoute::_($item_url); // Non SEF url if SH404SEF is installed // Check if we are in the backend again // In backend we need to remove administrator from URL as it is added even though we've set the application to the site app diff --git a/site/classes/flexicontent.helper.php b/site/classes/flexicontent.helper.php index 3af25d9968d..2263085c935 100644 --- a/site/classes/flexicontent.helper.php +++ b/site/classes/flexicontent.helper.php @@ -1165,7 +1165,7 @@ static function dataFilter( $v, $maxlength=0, $validation='string', $check_calla * @return string * @since 1.5 */ - static function striptagsandcut( $text, $chars=null ) + static function striptagsandcut( $text, $chars=null, &$uncut_length=0 ) { // Convert html entities to characters so that they will not be removed ... by strip_tags $text = html_entity_decode ($text, ENT_NOQUOTES, 'UTF-8'); @@ -1194,11 +1194,11 @@ static function striptagsandcut( $text, $chars=null ) $cleantext = preg_replace('/[\p{Z}\s]{2,}/u', ' ', $cleantext); // Unicode safe whitespace replacing // Calculate length according to UTF-8 encoding - $length = JString::strlen($cleantext); + $uncut_length = JString::strlen($cleantext); // Cut off the text if required but reencode html entities before doing so if ($chars) { - if ($length > $chars) { + if ($uncut_length > $chars) { $cleantext = JString::substr( $cleantext, 0, $chars ).'...'; } } diff --git a/site/templates/blog/category.xml b/site/templates/blog/category.xml index 2c486646b7b..1a933f366e9 100644 --- a/site/templates/blog/category.xml +++ b/site/templates/blog/category.xml @@ -43,7 +43,7 @@ - + @@ -115,7 +115,7 @@ - + diff --git a/site/templates/blog/category_items.php b/site/templates/blog/category_items.php index 64d0a6be95f..95918b3f136 100644 --- a/site/templates/blog/category_items.php +++ b/site/templates/blog/category_items.php @@ -120,6 +120,11 @@ // ONLY FIRST PAGE has leading content items if ($this->limitstart != 0) $leadnum = 0; +$lead_cut_text = $this->params->get('lead_cut_text', 400); +$intro_cut_text = $this->params->get('intro_cut_text', 200); +$uncut_length = 0; +FlexicontentFields::getFieldDisplay($items, 'text', $values=null, $method='display'); // Render 'text' (description) field for all items + if ($leadnum) : //added to intercept more columns (see also css changes) $lead_cols = $this->params->get('lead_cols', 2); @@ -331,9 +336,9 @@

params->get('lead_strip_html', 1)) : - echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $this->params->get('lead_cut_text', 400) ); + echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $lead_cut_text, $uncut_length ); else : echo $item->fields['text']->display; endif; @@ -397,7 +402,7 @@ params->get('show_readmore', 1) == -1 || $this->params->get('lead_strip_html', 1) == 1 ; - $readmore_shown = $this->params->get('show_readmore', 1) && strlen(trim($item->fulltext)) >= 1; + $readmore_shown = $this->params->get('show_readmore', 1) && ($uncut_length > $lead_cut_text || strlen(trim($item->fulltext)) >= 1); $readmore_shown = $readmore_shown || $readmore_forced; $footer_shown = $readmore_shown || $item->event->afterDisplayContent; ?> @@ -646,9 +651,9 @@

params->get('intro_strip_html', 1)) : - echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $this->params->get('intro_cut_text', 200) ); + echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $intro_cut_text, $uncut_length ); else : echo $item->fields['text']->display; endif; @@ -713,7 +718,7 @@ params->get('show_readmore', 1) == -1 || $this->params->get('intro_strip_html', 1) == 1 ; - $readmore_shown = $this->params->get('show_readmore', 1) && strlen(trim($item->fulltext)) >= 1; + $readmore_shown = $this->params->get('show_readmore', 1) && ($uncut_length > $intro_cut_text || strlen(trim($item->fulltext)) >= 1); $readmore_shown = $readmore_shown || $readmore_forced; $footer_shown = $readmore_shown || $item->event->afterDisplayContent; ?> diff --git a/site/templates/blog/category_items_html5.php b/site/templates/blog/category_items_html5.php index 32c3ad042f6..b9192ead8ab 100644 --- a/site/templates/blog/category_items_html5.php +++ b/site/templates/blog/category_items_html5.php @@ -121,6 +121,11 @@ // ONLY FIRST PAGE has leading content items if ($this->limitstart != 0) $leadnum = 0; +$lead_cut_text = $this->params->get('lead_cut_text', 400); +$intro_cut_text = $this->params->get('intro_cut_text', 200); +$uncut_length = 0; +FlexicontentFields::getFieldDisplay($items, 'text', $values=null, $method='display'); // Render 'text' (description) field for all items + if ($leadnum) : //added to intercept more columns (see also css changes) $lead_cols = $this->params->get('lead_cols', 2); @@ -344,9 +349,9 @@

params->get('lead_strip_html', 1)) : - echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $this->params->get('lead_cut_text', 400) ); + echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $lead_cut_text, $uncut_length ); else : echo $item->fields['text']->display; endif; @@ -410,7 +415,7 @@ params->get('show_readmore', 1) == -1 || $this->params->get('lead_strip_html', 1) == 1 ; - $readmore_shown = $this->params->get('show_readmore', 1) && strlen(trim($item->fulltext)) >= 1; + $readmore_shown = $this->params->get('show_readmore', 1) && ($uncut_length > $lead_cut_text || strlen(trim($item->fulltext)) >= 1); $readmore_shown = $readmore_shown || $readmore_forced; $footer_shown = $readmore_shown || $item->event->afterDisplayContent; ?> @@ -687,9 +692,9 @@

params->get('intro_strip_html', 1)) : - echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $this->params->get('intro_cut_text', 200) ); + echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $intro_cut_text, $uncut_length ); else : echo $item->fields['text']->display; endif; @@ -754,7 +759,7 @@ params->get('show_readmore', 1) == -1 || $this->params->get('intro_strip_html', 1) == 1 ; - $readmore_shown = $this->params->get('show_readmore', 1) && strlen(trim($item->fulltext)) >= 1; + $readmore_shown = $this->params->get('show_readmore', 1) && ($uncut_length > $intro_cut_text || strlen(trim($item->fulltext)) >= 1); $readmore_shown = $readmore_shown || $readmore_forced; $footer_shown = $readmore_shown || $item->event->afterDisplayContent; ?> diff --git a/site/templates/blog/language/en-GB/en-GB.ini b/site/templates/blog/language/en-GB/en-GB.ini index f7d2d51771c..a1b8124542a 100644 --- a/site/templates/blog/language/en-GB/en-GB.ini +++ b/site/templates/blog/language/en-GB/en-GB.ini @@ -5,4 +5,5 @@ FLEXI_TEMPLATE_HTML_MODE="HTML Version" FLEXI_HTML_MODE="Choose HTML version" FLEXI_HTML_MODE_DESC="Choose between xhtml or html5." FLEXI_XHTML="xhtml" -FLEXI_HTML5="html5" \ No newline at end of file +FLEXI_HTML5="html5" +FLEXI_YES_IF_NEEDED="Yes, if needed" \ No newline at end of file