[pLog-svn] r7277 - in plog/branches/lifetype-1.2/class: dao view
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Feb 19 15:37:54 EST 2024
Author: jondaley
Date: 2024-02-19 15:37:54 -0500 (Mon, 19 Feb 2024)
New Revision: 7277
Modified:
plog/branches/lifetype-1.2/class/dao/article.class.php
plog/branches/lifetype-1.2/class/view/defaultview.class.php
Log:
moved show_more link code into the article class (other people might want to call it (like the sticky posts plugin)
Modified: plog/branches/lifetype-1.2/class/dao/article.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/article.class.php 2024-02-19 19:18:39 UTC (rev 7276)
+++ plog/branches/lifetype-1.2/class/dao/article.class.php 2024-02-19 20:37:54 UTC (rev 7277)
@@ -1134,5 +1134,23 @@
{
$this->_inSummary = $inSummary;
}
+
+ /**
+ * Determines if we have to add the "show more"
+ * link based on whether there is "extended" text or not.
+ *
+ * @return nothing.
+ */
+ function setupShowMoreLink(){
+ if( $this->hasExtendedText()) {
+ $rg = $this->getBlogInfo()->getBlogRequestGenerator();
+
+ $intro = $this->getIntroText();
+ $showMoreText = $this->_blogInfo->getLocale()->tr( 'read_more' );
+ $showMoreLink = " <a class=\"showMoreLink\" href=\"".$rg->postPermalink($this)."\">".$showMoreText."</a>";
+ $this->setText( $intro . $showMoreLink );
+ }
+ }
+
}
-?>
\ No newline at end of file
+?>
Modified: plog/branches/lifetype-1.2/class/view/defaultview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/defaultview.class.php 2024-02-19 19:18:39 UTC (rev 7276)
+++ plog/branches/lifetype-1.2/class/view/defaultview.class.php 2024-02-19 20:37:54 UTC (rev 7277)
@@ -23,30 +23,18 @@
}
/**
- * Takes all the posts and determines if we have to add the "show more" after
- * show_more_threshold words have been counted. If so, clicking on the link
- * will show the whole post using the ViewArticle action.
+ * Takes all the posts and determines if we have to add the "show more"
+ * link based on whether there is "extended" text or not.
*
- * @param maxWords The amount of words we tollerate before showing the link.
* @return nothing.
*/
function _addShowMoreLink()
{
$posts = $this->_params->getValue( 'posts' );
-
- //lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
- //$textFilter = new TextFilter();
$modifPosts = Array();
- $rg = $this->_blogInfo->getBlogRequestGenerator();
foreach( $posts as $post ) {
- if( $post->hasExtendedText()) {
- $result = $post->getIntroText();
- $showMoreText = $this->_locale->tr( 'read_more' );
- $showMoreLink = " <a class=\"showMoreLink\" href=\"".$rg->postPermalink($post)."\">".$showMoreText."</a>";
- $post->setText( $result. $showMoreLink );
- }
-
- array_push( $modifPosts, $post );
+ $post->setupShowMoreLink();
+ array_push( $modifPosts, $post );
}
$this->_params->setValue( 'posts', $modifPosts );
More information about the pLog-svn
mailing list