release 2022.11.20

This commit is contained in:
Jean-Christian Paul Denis 2022-11-20 21:23:22 +01:00
parent 32672d605f
commit 11b700544a
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
8 changed files with 98 additions and 155 deletions

View File

@ -1,3 +1,6 @@
2022.11.20
- fix compatibility with Dotclear 2.24 (required)
2021.09.17 2021.09.17
- clean up and cosmetics - clean up and cosmetics

View File

@ -3,7 +3,7 @@
[![Release](https://img.shields.io/github/v/release/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/releases) [![Release](https://img.shields.io/github/v/release/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/releases) [![Date](https://img.shields.io/github/release-date/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/issues) [![Issues](https://img.shields.io/github/issues/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/lastpostsExtend) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/lastpostsExtend)
[![License](https://img.shields.io/github/license/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/blob/master/LICENSE) [![License](https://img.shields.io/github/license/JcDenis/lastpostsExtend)](https://github.com/JcDenis/lastpostsExtend/blob/master/LICENSE)
@ -19,7 +19,7 @@ Like widget lastposts but with more options.
lastpostsExtend requires: lastpostsExtend requires:
* permissions to manage widgets * permissions to manage widgets
* Dotclear 2.19 * Dotclear 2.24
## USAGE ## USAGE

View File

@ -10,7 +10,6 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }

View File

@ -10,7 +10,6 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }
@ -19,13 +18,13 @@ $this->registerModule(
'Last entries (Extended)', 'Last entries (Extended)',
'Extended list of entries', 'Extended list of entries',
'Jean-Christian Denis and contributors', 'Jean-Christian Denis and contributors',
'2022.11.12', '2022.11.20',
[ [
'requires' => [['core', '2.24']], 'requires' => [['core', '2.24']],
'permissions' => dcAuth::PERMISSION_ADMIN, 'permissions' => dcAuth::PERMISSION_ADMIN,
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://github.com/JcDenis/lastpostsExtend', 'support' => 'https://github.com/JcDenis/lastpostsExtend',
'details' => 'http://plugins.dotaddict.org/dc2/details/lastpostsExtend', 'details' => 'http://plugins.dotaddict.org/dc2/details/lastpostsExtend',
'repository' => 'https://raw.githubusercontent.com/JcDenis/lastpostsExtend/master/repository.xml' 'repository' => 'https://raw.githubusercontent.com/JcDenis/lastpostsExtend/master/repository.xml',
] ]
); );

View File

@ -10,7 +10,6 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }

View File

@ -10,7 +10,6 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { if (!defined('DC_RC_PATH')) {
return null; return null;
} }
@ -43,14 +42,13 @@ class lastpostsextendWidget
$posttypes = [ $posttypes = [
__('Post') => 'post', __('Post') => 'post',
__('Page') => 'page', __('Page') => 'page',
__('Gallery') => 'galitem' __('Gallery') => 'galitem',
]; ];
# plugin muppet types # plugin muppet types
if (dcCore::app()->plugins->moduleExists('muppet')) { if (dcCore::app()->plugins->moduleExists('muppet')) {
$muppet_types = muppet::getPostTypes(); $muppet_types = muppet::getPostTypes();
if(is_array($muppet_types) && !empty($muppet_types)) { if (is_array($muppet_types) && !empty($muppet_types)) {
foreach ($muppet_types as $k => $v) {
foreach($muppet_types as $k => $v) {
$posttypes[$v['name']] = $k; $posttypes[$v['name']] = $k;
} }
} }
@ -64,18 +62,17 @@ class lastpostsextendWidget
); );
# Category (post and page have same category) # Category (post and page have same category)
$rs = dcCore::app()->blog->getCategories([ $rs = dcCore::app()->blog->getCategories([
'post_type' => 'post' 'post_type' => 'post',
]); ]);
$categories = [ $categories = [
'' => '', '' => '',
__('Uncategorized') => 'null' __('Uncategorized') => 'null',
]; ];
while ($rs->fetch()) { while ($rs->fetch()) {
$categories[str_repeat( $categories[str_repeat(
'  ', '  ',
$rs->level-1 $rs->level - 1
) . '• ' . html::escapeHTML($rs->cat_title)] = ) . '• ' . html::escapeHTML($rs->cat_title)] = $rs->cat_id;
$rs->cat_id;
} }
$w->lastpostsextend->setting( $w->lastpostsextend->setting(
'category', 'category',
@ -94,7 +91,7 @@ class lastpostsextendWidget
[ [
__('all') => 'all', __('all') => 'all',
__('only without password') => 'no', __('only without password') => 'no',
__('only with password') => 'yes' __('only with password') => 'yes',
] ]
); );
# Status # Status
@ -108,7 +105,7 @@ class lastpostsextendWidget
__('pending') => '-2', __('pending') => '-2',
__('scheduled') => '-1', __('scheduled') => '-1',
__('unpublished') => '0', __('unpublished') => '0',
__('published') => '1' __('published') => '1',
] ]
); );
# Selected entries only # Selected entries only
@ -157,7 +154,7 @@ class lastpostsextendWidget
[ [
__('Date') => 'date', __('Date') => 'date',
__('Title') => 'post_title', __('Title') => 'post_title',
__('Comments') => 'nb_comment' __('Comments') => 'nb_comment',
] ]
); );
# Sort order # Sort order
@ -168,7 +165,7 @@ class lastpostsextendWidget
'combo', 'combo',
[ [
__('Ascending') => 'asc', __('Ascending') => 'asc',
__('Descending') => 'desc' __('Descending') => 'desc',
] ]
); );
# First image # First image
@ -183,7 +180,7 @@ class lastpostsextendWidget
__('thumbnail') => 't', __('thumbnail') => 't',
__('small') => 's', __('small') => 's',
__('medium') => 'm', __('medium') => 'm',
__('original') => 'o' __('original') => 'o',
] ]
); );
# With excerpt # With excerpt
@ -216,7 +213,7 @@ class lastpostsextendWidget
[ [
__('All pages') => 0, __('All pages') => 0,
__('Home page only') => 1, __('Home page only') => 1,
__('Except on home page') => 2 __('Except on home page') => 2,
] ]
); );
# widget option - content only # widget option - content only
@ -246,7 +243,7 @@ class lastpostsextendWidget
$params = [ $params = [
'sql' => '', 'sql' => '',
'columns' => [], 'columns' => [],
'from' => '' 'from' => '',
]; ];
# Widget is offline # Widget is offline
@ -268,8 +265,7 @@ class lastpostsextendWidget
# Passworded # Passworded
if ($w->passworded == 'yes') { if ($w->passworded == 'yes') {
$params['sql'] .= 'AND post_password IS NOT NULL '; $params['sql'] .= 'AND post_password IS NOT NULL ';
} } elseif ($w->passworded == 'no') {
elseif ($w->passworded == 'no') {
$params['sql'] .= 'AND post_password IS NULL '; $params['sql'] .= 'AND post_password IS NULL ';
} }
@ -285,23 +281,21 @@ class lastpostsextendWidget
# Updated posts only # Updated posts only
if ($w->updatedonly) { if ($w->updatedonly) {
$params['sql'] .= $params['sql'] .= 'AND post_creadt < post_upddt ' .
"AND post_creadt < post_upddt " . 'AND post_dt < post_upddt ';
"AND post_dt < post_upddt "; /*
/*
$params['sql'] .= $params['sql'] .=
"AND TIMESTAMP(post_creadt ,'DD-MM-YYYY HH24:MI:SS') < TIMESTAMP(post_upddt ,'DD-MM-YYYY HH24:MI:SS') ". "AND TIMESTAMP(post_creadt ,'DD-MM-YYYY HH24:MI:SS') < TIMESTAMP(post_upddt ,'DD-MM-YYYY HH24:MI:SS') ".
"AND TIMESTAMP(post_dt ,'DD-MM-YYYY HH24:MI:SS') < TIMESTAMP(post_upddt ,'DD-MM-YYYY HH24:MI:SS') "; "AND TIMESTAMP(post_dt ,'DD-MM-YYYY HH24:MI:SS') < TIMESTAMP(post_upddt ,'DD-MM-YYYY HH24:MI:SS') ";
//*/ //*/
$params['order'] = $w->sortby == 'date' ? $params['order'] = $w->sortby == 'date' ?
'post_upddt ' : $w->sortby . ' '; 'post_upddt ' : $w->sortby . ' ';
} } else {
else {
$params['order'] = $w->sortby == 'date' ? $params['order'] = $w->sortby == 'date' ?
'post_dt ' : $w->sortby . ' '; 'post_dt ' : $w->sortby . ' ';
} }
$params['order'] .= $w->sort == 'asc' ? 'asc' : 'desc'; $params['order'] .= $w->sort == 'asc' ? 'asc' : 'desc';
$params['limit'] = abs((integer) $w->limit); $params['limit'] = abs((int) $w->limit);
$params['no_content'] = true; $params['no_content'] = true;
# Selected posts only # Selected posts only
@ -317,7 +311,7 @@ class lastpostsextendWidget
if ($w->category == 'null') { if ($w->category == 'null') {
$params['sql'] .= ' AND P.cat_id IS NULL '; $params['sql'] .= ' AND P.cat_id IS NULL ';
} elseif (is_numeric($w->category)) { } elseif (is_numeric($w->category)) {
$params['cat_id'] = (integer) $w->category; $params['cat_id'] = (int) $w->category;
} else { } else {
$params['cat_url'] = $w->category; $params['cat_url'] = $w->category;
} }
@ -326,12 +320,12 @@ class lastpostsextendWidget
# Tags # Tags
if (dcCore::app()->plugins->moduleExists('tags') && $w->tag) { if (dcCore::app()->plugins->moduleExists('tags') && $w->tag) {
$tags = explode(',', $w->tag); $tags = explode(',', $w->tag);
foreach($tags as $i => $tag) { foreach ($tags as $i => $tag) {
$tags[$i] = trim($tag); $tags[$i] = trim($tag);
} }
$params['from'] .= ', ' . dcCore::app()->prefix . 'meta META '; $params['from'] .= ', ' . dcCore::app()->prefix . 'meta META ';
$params['sql'] .= 'AND META.post_id = P.post_id '; $params['sql'] .= 'AND META.post_id = P.post_id ';
$params['sql'] .= "AND META.meta_id " . dcCore::app()->con->in($tags) . " "; $params['sql'] .= 'AND META.meta_id ' . dcCore::app()->con->in($tags) . ' ';
$params['sql'] .= "AND META.meta_type = 'tag' "; $params['sql'] .= "AND META.meta_type = 'tag' ";
} }
@ -389,7 +383,7 @@ class lastpostsextendWidget
if (strlen($excerpt) > 0) { if (strlen($excerpt) > 0) {
$cut = text::cutString( $cut = text::cutString(
$excerpt, $excerpt,
abs((integer) $w->excerptlen) abs((int) $w->excerptlen)
); );
$res .= ' : ' . $cut . (strlen($cut) < strlen($excerpt) ? '...' : ''); $res .= ' : ' . $cut . (strlen($cut) < strlen($excerpt) ? '...' : '');
@ -410,7 +404,6 @@ class lastpostsextendWidget
private static function entryFirstImage($type, $id, $size = 's') private static function entryFirstImage($type, $id, $size = 's')
{ {
if (!in_array($type, ['post', 'page', 'galitem'])) { if (!in_array($type, ['post', 'page', 'galitem'])) {
return ''; return '';
} }
@ -444,14 +437,13 @@ class lastpostsextendWidget
$subject = $rs->post_excerpt_xhtml . $rs->post_content_xhtml . $rs->cat_desc; $subject = $rs->post_excerpt_xhtml . $rs->post_content_xhtml . $rs->cat_desc;
if (preg_match_all($pattern, $subject, $m) > 0) { if (preg_match_all($pattern, $subject, $m) > 0) {
foreach ($m[1] as $i => $img) { foreach ($m[1] as $i => $img) {
if (($src = self::ContentFirstImageLookup($p_root, $img, $size)) !== false) { if (($src = self::ContentFirstImageLookup($p_root, $img, $size)) !== false) {
$src = $p_url . (dirname($img) != '/' ? dirname($img) : '') . '/' . $src; $src = $p_url . (dirname($img) != '/' ? dirname($img) : '') . '/' . $src;
if (preg_match('/alt="([^"]+)"/', $m[0][$i], $malt)) { if (preg_match('/alt="([^"]+)"/', $m[0][$i], $malt)) {
$alt = $malt[1]; $alt = $malt[1];
} }
break; break;
} }
} }

View File

@ -1,12 +1,13 @@
<?xml version="1.0"?>
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="lastpostsExtend"> <module id="lastpostsExtend">
<name>Last entries (Extended)</name> <name>Last entries (Extended)</name>
<version>2021.09.17</version> <version>2022.11.20</version>
<author>Jean-Christian Denis and contributors</author> <author>Jean-Christian Denis and contributors</author>
<desc>Extended list of entries</desc> <desc>Extended list of entries</desc>
<file>https://github.com/JcDenis/lastpostsExtend/releases/download/v2021.09.17/plugin-lastpostsExtend.zip</file> <file>https://github.com/JcDenis/lastpostsExtend/releases/download/v2022.11.20/plugin-lastpostsExtend.zip</file>
<da:dcmin>2.19</da:dcmin> <da:dcmin>2.24</da:dcmin>
<da:details>http://plugins.dotaddict.org/dc2/details/lastpostsExtend</da:details> <da:details>http://plugins.dotaddict.org/dc2/details/lastpostsExtend</da:details>
<da:support>https://github.com/JcDenis/lastpostsExtend</da:support> <da:support>https://github.com/JcDenis/lastpostsExtend</da:support>
</module> </module>
</modules> </modules>

View File

@ -1,50 +0,0 @@
<?php
// Language: Français
// Module: lastpostsExtend - 2021.08.25
// Date: 2021-08-25 22:43:47
// Translated with dcTranslater - 2021.08.18
#_widgets.php:33
$GLOBALS['__l10n']['Last entries (Extended)'] = 'Derniers billets (étendu)';
#_widgets.php:36
$GLOBALS['__l10n']['Extended list of entries'] = 'Liste étendue de billets';
#_widgets.php:47
$GLOBALS['__l10n']['Post'] = 'Billet';
#_widgets.php:49
$GLOBALS['__l10n']['Gallery'] = 'Galerie';
#_widgets.php:94
$GLOBALS['__l10n']['Protection:'] = 'Protection :';
#_widgets.php:99
$GLOBALS['__l10n']['only without password'] = 'seulement sans mot de passe';
#_widgets.php:100
$GLOBALS['__l10n']['only with password'] = 'seulement avec mot de passe';
#_widgets.php:120
$GLOBALS['__l10n']['Selected entries only'] = 'Billets sélectionnés seulement';
#_widgets.php:127
$GLOBALS['__l10n']['Updated entries only'] = 'Billets mis à jour seulement';
#_widgets.php:135
$GLOBALS['__l10n']['Limit to tags:'] = 'Limiter aux mots-clés :';
#_widgets.php:143
$GLOBALS['__l10n']['Limit to words:'] = 'Limiter aux mots :';
#_widgets.php:180
$GLOBALS['__l10n']['Show entries first image:'] = 'Afficher la première image du billet :';
#_widgets.php:195
$GLOBALS['__l10n']['Show entries excerpt'] = 'Afficher l\'extrait';
#_widgets.php:202
$GLOBALS['__l10n']['Excerpt length:'] = 'Taille de l\'extrait :';
#_widgets.php:209
$GLOBALS['__l10n']['Show comments count'] = 'Afficher le nombre de commentaires';