Skip to content

Commit

Permalink
5.2.7
Browse files Browse the repository at this point in the history
Add merge paragraph option if existing readmore are to be ignored
  • Loading branch information
conseilgouz committed May 22, 2024
1 parent 16f1070 commit a7c4a76
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions autoreadmore.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.10" type="plugin" group="content" method="upgrade">
<name>PLG_CONTENT_AUTOREADMORE_TITLE</name>
<creationDate>2024-05-19</creationDate>
<creationDate>2024-05-22</creationDate>
<copyright>Copyright (C) 2024 Conseilgouz All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
<author>ConseilGouz</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://www.conseilgouz.com</authorUrl>
<version>5.2.6</version>
<version>5.2.7</version>
<description>PLG_CONTENT_AUTOREADMORE_THANK_YOU_FOR_USING_AUTO_READ_MORE</description>
<namespace path="src">ConseilGouz\Plugin\Content\Autoreadmore</namespace>
<files>
Expand Down
2 changes: 2 additions & 0 deletions language/en-GB/plg_content_autoreadmore.ini
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ PLG_CONTENT_AUTOREADMORE_USERTYPE_ALL="All"
PLG_CONTENT_AUTOREADMORE_USERTYPE_LOGGED="Logged only"
PLG_CONTENT_AUTOREADMORE_READMORE_GUEST="Button text for guests"
PLG_CONTENT_AUTOREADMORE_READMORE_GUEST_DESC="Enter the text to display in read more button for guests (not yet logged visitors)"
PLG_CONTENT_AUTOREADMORE_MERGE_AFTER_IGNORE_LABEL="Merge paragraph ?"
PLG_CONTENT_AUTOREADMORE_MERGE_AFTER_IGNORE_DESC="When inserting readmore tag, editors create a new paragraph after it. Yes will remove this paragraph, so continuing text will remain in the same paragraph.(default = no : keep new paragraph)"
2 changes: 2 additions & 0 deletions language/fr-FR/plg_content_autoreadmore.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ PLG_CONTENT_AUTOREADMORE_USERTYPE_LOGGED="Connectés"
PLG_CONTENT_AUTOREADMORE_READMORE_GUEST="Texte Bouton pour les visiteurs"
PLG_CONTENT_AUTOREADMORE_READMORE_GUEST_DESC="Entrez le texte à afficher dans le bouton 'lire la suite' pour les visiteurs (utilisateur non connectés)"

PLG_CONTENT_AUTOREADMORE_MERGE_AFTER_IGNORE_LABEL="Fusion paragraphe ?"
PLG_CONTENT_AUTOREADMORE_MERGE_AFTER_IGNORE_DESC="Quand on insère Lire la suite, les éditeurs créent un nouveau paragraphe. L'option <b>Oui</b>supprime ce nouveau paragraphe, ainsi la suite de l'article continue dans le même paragraphe.(défaut = Non = pas de suppression du nouveau paragraphe)"
11 changes: 11 additions & 0 deletions plg_autoreadmore_changelog.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<changelogs>
<changelog>
<element>autoreadmore</element>
<type>plugin</type>
<version>5.2.7</version>
<note>
<item>22/05/2024</item>
</note>
<addition>
<item>Add merge paragraph option if existing readmore are to be ignored</item>
</addition>
</changelog>
<changelog>
<element>autoreadmore</element>
<type>plugin</type>
Expand Down
6 changes: 5 additions & 1 deletion src/Extension/Autoreadmore.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ public function contentPrepare($event)
$this->fulltext_loaded = false;

if ($this->params->get('Ignore_Existing_Read_More') && isset($article->introtext) && isset($article->fulltext)) {
$text = $article->introtext . PHP_EOL . $article->fulltext;
if ($this->params->get('Merge_After_Ignore', 0)) {// merge intro + fulltext => ignore last </p> intro, first <p> fulltext
$text = preg_replace('/<\/.*$/', '', $article->introtext).preg_replace('/<p[^>]*>/', '', $article->fulltext, 1);
} else {
$text = $article->introtext . PHP_EOL . $article->fulltext;
}
if (file_exists(JPATH_PLUGINS ."/content/cck")) { //check if Seblod is installed
$text = preg_replace('/::cck::(\d+)::\/cck::/', '', $text) ; //remove the ::cck:: tags
$text = preg_replace('/::introtext::/', '', $text) ; //remove the ::introtext:: tags, keep content
Expand Down

0 comments on commit a7c4a76

Please sign in to comment.