cleanup (license, help, dc2.19, PSR2, short array, php7.3+, php8.0.x)
This commit is contained in:
parent
140706e705
commit
50f881d512
@ -1,71 +1,59 @@
|
|||||||
|
lastpostsExtend 2021.08.25
|
||||||
|
* cleanup (license, help, dc2.19, PSR2, short array, php7.3+, php8.0.x)
|
||||||
|
|
||||||
lastpostsExtend 2016.10.24
|
lastpostsExtend 2016.10.24
|
||||||
===========================================================
|
|
||||||
* oops missed 2015 update
|
* oops missed 2015 update
|
||||||
|
|
||||||
lastpostsExtend 2016.10.23
|
lastpostsExtend 2016.10.23
|
||||||
===========================================================
|
|
||||||
* Used new widget rendering method
|
* Used new widget rendering method
|
||||||
* Updated year
|
* Updated year
|
||||||
|
|
||||||
lastpostsExtend 2015.01.13 Pierre Van Glabeke
|
lastpostsExtend 2015.01.13 Pierre Van Glabeke
|
||||||
===========================================================
|
|
||||||
* Compatibilité dotclear 2.7
|
* Compatibilité dotclear 2.7
|
||||||
* Ajout options widget et compatibilité currywurst
|
* Ajout options widget et compatibilité currywurst
|
||||||
* Modifications locales
|
* Modifications locales
|
||||||
|
|
||||||
lastpostsExtend 2013.12.01
|
lastpostsExtend 2013.12.01
|
||||||
===========================================================
|
|
||||||
* Fix XHTML validation on widget
|
* Fix XHTML validation on widget
|
||||||
* Fix category id from wrong table. thx BG
|
* Fix category id from wrong table. thx BG
|
||||||
|
|
||||||
lastpostsExtend 2013.11.12
|
lastpostsExtend 2013.11.12
|
||||||
===========================================================
|
|
||||||
* Switch to Dotclear 2.6
|
* Switch to Dotclear 2.6
|
||||||
* Add widget options
|
* Add widget options
|
||||||
|
|
||||||
lastpostsExtend 2013.06.30
|
lastpostsExtend 2013.06.30
|
||||||
===========================================================
|
|
||||||
* Used new 'homeonly' style for widgets
|
* Used new 'homeonly' style for widgets
|
||||||
|
|
||||||
lastpostsExtend 2011.08.01
|
lastpostsExtend 2011.08.01
|
||||||
===========================================================
|
|
||||||
* Added support of plugin muppet (post types)
|
* Added support of plugin muppet (post types)
|
||||||
* Try to fix date compare on sql request
|
* Try to fix date compare on sql request
|
||||||
|
|
||||||
lastpostsExtend 0.10 - 2010-08-19
|
lastpostsExtend 0.10 - 2010-08-19
|
||||||
===========================================================
|
|
||||||
* Sort by comments (annso)
|
* Sort by comments (annso)
|
||||||
|
|
||||||
lastpostsExtend 0.9 - 2010-06-09
|
lastpostsExtend 0.9 - 2010-06-09
|
||||||
===========================================================
|
|
||||||
* Writed now for DC 2.2 or higher
|
* Writed now for DC 2.2 or higher
|
||||||
|
|
||||||
lastpostsExtend 0.8.2 - 2010-03-29
|
lastpostsExtend 0.8.2 - 2010-03-29
|
||||||
===========================================================
|
|
||||||
* Fixed getPosts by using sudo
|
* Fixed getPosts by using sudo
|
||||||
* Fixed entryFirstImage on non-pushided post
|
* Fixed entryFirstImage on non-pushided post
|
||||||
|
|
||||||
lastpostsExtend 0.8.1 - 2009-12-31
|
lastpostsExtend 0.8.1 - 2009-12-31
|
||||||
===========================================================
|
|
||||||
* Happy new year!
|
* Happy new year!
|
||||||
* Fixed multiple bugs and crashes
|
* Fixed multiple bugs and crashes
|
||||||
|
|
||||||
lastpostsExtend 0.8 - 2009-12-30
|
lastpostsExtend 0.8 - 2009-12-30
|
||||||
===========================================================
|
|
||||||
* Added post words limit
|
* Added post words limit
|
||||||
* Added post status limit
|
* Added post status limit
|
||||||
* Added post password limit (closes #385)
|
* Added post password limit (closes #385)
|
||||||
* Changed blog->getPosts to internal getPosts
|
* Changed blog->getPosts to internal getPosts
|
||||||
|
|
||||||
lastpostsExtend 0.7 2009-12-10
|
lastpostsExtend 0.7 2009-12-10
|
||||||
===========================================================
|
|
||||||
* Added entryFirstimage
|
* Added entryFirstimage
|
||||||
* Fixed typo
|
* Fixed typo
|
||||||
|
|
||||||
lastpostsExtend 0.6 - 2009-08-23
|
lastpostsExtend 0.6 - 2009-08-23
|
||||||
===========================================================
|
|
||||||
* Added ''pluginsPage'' support
|
* Added ''pluginsPage'' support
|
||||||
|
|
||||||
lastpostsExtend 0.5 - 2009-08-16
|
lastpostsExtend 0.5 - 2009-08-16
|
||||||
===========================================================
|
|
||||||
* Fixed php 5.3 compatibility
|
* Fixed php 5.3 compatibility
|
@ -20,3 +20,9 @@ First install lastpostsExtend, manualy from a zip package or from
|
|||||||
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
||||||
|
|
||||||
Add and configure "Last entries (Extended)" from widgets manager.
|
Add and configure "Last entries (Extended)" from widgets manager.
|
||||||
|
|
||||||
|
## MORE
|
||||||
|
|
||||||
|
* License : GNU GPL v2
|
||||||
|
* Source & contribution : [GitHub Page](https://github.com/JcDenis/lastpostsExtend)
|
||||||
|
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/lastpostsExtend)
|
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2016 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcdenis.net
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,8 +12,7 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require dirname(__FILE__).'/_widgets.php';
|
require dirname(__FILE__) . '/_widgets.php';
|
27
_define.php
27
_define.php
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2016 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcdenis.net
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,24 +12,20 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
/* Name */
|
'Last entries (Extended)',
|
||||||
"Last entries (Extended)",
|
'Extended list of entries',
|
||||||
/* Description*/
|
'Jean-Christian Denis and contributors',
|
||||||
"Extended list of entries",
|
'2021.08.25',
|
||||||
/* Author */
|
[
|
||||||
"Jean-Christian Denis",
|
|
||||||
/* Version */
|
|
||||||
'2016.10.24',
|
|
||||||
array(
|
|
||||||
'permissions' => 'admin',
|
'permissions' => 'admin',
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'dc_min' => '2.10',
|
'dc_min' => '2.19',
|
||||||
'support' => 'http://lab.dotclear.org/wiki/plugin/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'
|
||||||
|
]
|
||||||
);
|
);
|
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2016 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcdenis.net
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,8 +12,7 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
require dirname(__FILE__).'/_widgets.php';
|
require dirname(__FILE__) . '/_widgets.php';
|
165
_widgets.php
165
_widgets.php
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
# This file is part of lastpostsExtend, a plugin for Dotclear 2.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009-2016 Jean-Christian Denis and contributors
|
# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
|
||||||
# contact@jcdenis.fr http://jcdenis.net
|
|
||||||
#
|
#
|
||||||
# Licensed under the GPL version 2.0 license.
|
# Licensed under the GPL version 2.0 license.
|
||||||
# A copy of this license is available in LICENSE file or at
|
# A copy of this license is available in LICENSE file or at
|
||||||
@ -13,13 +12,12 @@
|
|||||||
# -- END LICENSE BLOCK ------------------------------------
|
# -- END LICENSE BLOCK ------------------------------------
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$core->addBehavior(
|
$core->addBehavior(
|
||||||
'initWidgets',
|
'initWidgets',
|
||||||
array('lastpostsextendWidget', 'initWidget')
|
['lastpostsextendWidget', 'initWidget']
|
||||||
);
|
);
|
||||||
|
|
||||||
class lastpostsextendWidget
|
class lastpostsextendWidget
|
||||||
@ -32,7 +30,7 @@ class lastpostsextendWidget
|
|||||||
$w->create(
|
$w->create(
|
||||||
'lastpostsextend',
|
'lastpostsextend',
|
||||||
__('Last entries (Extended)'),
|
__('Last entries (Extended)'),
|
||||||
array('lastpostsextendWidget', 'parseWidget'),
|
['lastpostsextendWidget', 'parseWidget'],
|
||||||
null,
|
null,
|
||||||
__('Extended list of entries')
|
__('Extended list of entries')
|
||||||
);
|
);
|
||||||
@ -44,11 +42,11 @@ class lastpostsextendWidget
|
|||||||
'text'
|
'text'
|
||||||
);
|
);
|
||||||
# type
|
# type
|
||||||
$posttypes = array(
|
$posttypes = [
|
||||||
__('Post') => 'post',
|
__('Post') => 'post',
|
||||||
__('Page') => 'page',
|
__('Page') => 'page',
|
||||||
__('Gallery') => 'galitem'
|
__('Gallery') => 'galitem'
|
||||||
);
|
];
|
||||||
# plugin muppet types
|
# plugin muppet types
|
||||||
if ($core->plugins->moduleExists('muppet')) {
|
if ($core->plugins->moduleExists('muppet')) {
|
||||||
$muppet_types = muppet::getPostTypes();
|
$muppet_types = muppet::getPostTypes();
|
||||||
@ -67,18 +65,18 @@ class lastpostsextendWidget
|
|||||||
$posttypes
|
$posttypes
|
||||||
);
|
);
|
||||||
# Category (post and page have same category)
|
# Category (post and page have same category)
|
||||||
$rs = $core->blog->getCategories(array(
|
$rs = $core->blog->getCategories([
|
||||||
'post_type' => 'post'
|
'post_type' => 'post'
|
||||||
));
|
]);
|
||||||
$categories = array(
|
$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(
|
||||||
@ -88,18 +86,18 @@ class lastpostsextendWidget
|
|||||||
'combo',
|
'combo',
|
||||||
$categories
|
$categories
|
||||||
);
|
);
|
||||||
unset($rs,$categories);
|
unset($rs, $categories);
|
||||||
# Pasworded
|
# Pasworded
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
'passworded',
|
'passworded',
|
||||||
__('Protection:'),
|
__('Protection:'),
|
||||||
'no',
|
'no',
|
||||||
'combo',
|
'combo',
|
||||||
array(
|
[
|
||||||
__('all') => 'all',
|
__('all') => 'all',
|
||||||
__('only without password') => 'no',
|
__('only without password') => 'no',
|
||||||
__('only with password') => 'yes'
|
__('only with password') => 'yes'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
# Status
|
# Status
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
@ -107,13 +105,13 @@ class lastpostsextendWidget
|
|||||||
__('Status:'),
|
__('Status:'),
|
||||||
'1',
|
'1',
|
||||||
'combo',
|
'combo',
|
||||||
array(
|
[
|
||||||
__('all') => 'all',
|
__('all') => 'all',
|
||||||
__('pending') => '-2',
|
__('pending') => '-2',
|
||||||
__('scheduled') => '-1',
|
__('scheduled') => '-1',
|
||||||
__('unpublished') => '0',
|
__('unpublished') => '0',
|
||||||
__('published') => '1'
|
__('published') => '1'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
# Selected entries only
|
# Selected entries only
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
@ -130,8 +128,7 @@ class lastpostsextendWidget
|
|||||||
'check'
|
'check'
|
||||||
);
|
);
|
||||||
# Tag
|
# Tag
|
||||||
if ($core->plugins->moduleExists('tags'))
|
if ($core->plugins->moduleExists('tags')) {
|
||||||
{
|
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
'tag',
|
'tag',
|
||||||
__('Limit to tags:'),
|
__('Limit to tags:'),
|
||||||
@ -159,11 +156,11 @@ class lastpostsextendWidget
|
|||||||
__('Order by:'),
|
__('Order by:'),
|
||||||
'date',
|
'date',
|
||||||
'combo',
|
'combo',
|
||||||
array(
|
[
|
||||||
__('Date') => 'date',
|
__('Date') => 'date',
|
||||||
__('Title') => 'post_title',
|
__('Title') => 'post_title',
|
||||||
__('Comments') => 'nb_comment'
|
__('Comments') => 'nb_comment'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
# Sort order
|
# Sort order
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
@ -171,10 +168,10 @@ class lastpostsextendWidget
|
|||||||
__('Sort:'),
|
__('Sort:'),
|
||||||
'desc',
|
'desc',
|
||||||
'combo',
|
'combo',
|
||||||
array(
|
[
|
||||||
__('Ascending') => 'asc',
|
__('Ascending') => 'asc',
|
||||||
__('Descending') => 'desc'
|
__('Descending') => 'desc'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
# First image
|
# First image
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
@ -182,14 +179,14 @@ class lastpostsextendWidget
|
|||||||
__('Show entries first image:'),
|
__('Show entries first image:'),
|
||||||
'',
|
'',
|
||||||
'combo',
|
'combo',
|
||||||
array(
|
[
|
||||||
__('no') => '',
|
__('no') => '',
|
||||||
__('square') => 'sq',
|
__('square') => 'sq',
|
||||||
__('thumbnail') => 't',
|
__('thumbnail') => 't',
|
||||||
__('small') => 's',
|
__('small') => 's',
|
||||||
__('medium') => 'm',
|
__('medium') => 'm',
|
||||||
__('original') => 'o'
|
__('original') => 'o'
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
# With excerpt
|
# With excerpt
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
@ -218,11 +215,11 @@ class lastpostsextendWidget
|
|||||||
__('Display on:'),
|
__('Display on:'),
|
||||||
0,
|
0,
|
||||||
'combo',
|
'combo',
|
||||||
array(
|
[
|
||||||
__('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
|
||||||
$w->lastpostsextend->setting(
|
$w->lastpostsextend->setting(
|
||||||
@ -250,20 +247,20 @@ class lastpostsextendWidget
|
|||||||
{
|
{
|
||||||
global $core;
|
global $core;
|
||||||
|
|
||||||
$params = array(
|
$params = [
|
||||||
'sql' => '',
|
'sql' => '',
|
||||||
'columns' => array(),
|
'columns' => [],
|
||||||
'from' => ''
|
'from' => ''
|
||||||
);
|
];
|
||||||
|
|
||||||
# Widget is offline
|
# Widget is offline
|
||||||
if ($w->offline)
|
if ($w->offline) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# Home page only
|
# Home page only
|
||||||
if ($w->homeonly == 1 && $core->url->type != 'default'
|
if ($w->homeonly == 1 && $core->url->type != 'default'
|
||||||
|| $w->homeonly == 2 && $core->url->type == 'default'
|
|| $w->homeonly == 2 && $core->url->type == 'default') {
|
||||||
) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +290,7 @@ 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'] .=
|
||||||
@ -301,11 +298,11 @@ class lastpostsextendWidget
|
|||||||
"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((integer) $w->limit);
|
||||||
@ -323,11 +320,9 @@ class lastpostsextendWidget
|
|||||||
if ($w->category) {
|
if ($w->category) {
|
||||||
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'] = (integer) $w->category;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$params['cat_url'] = $w->category;
|
$params['cat_url'] = $w->category;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,21 +333,20 @@ class lastpostsextendWidget
|
|||||||
foreach($tags as $i => $tag) {
|
foreach($tags as $i => $tag) {
|
||||||
$tags[$i] = trim($tag);
|
$tags[$i] = trim($tag);
|
||||||
}
|
}
|
||||||
$params['from'] .= ', '.$core->prefix.'meta META ';
|
$params['from'] .= ', ' . $core->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 ".$core->con->in($tags)." ";
|
$params['sql'] .= "AND META.meta_id " . $core->con->in($tags) . " ";
|
||||||
$params['sql'] .= "AND META.meta_type = 'tag' ";
|
$params['sql'] .= "AND META.meta_type = 'tag' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = $core->auth->sudo(
|
$rs = $core->auth->sudo(
|
||||||
array($core->blog, 'getPosts'),
|
[$core->blog, 'getPosts'],
|
||||||
$params,
|
$params,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
# No result
|
# No result
|
||||||
if ($rs->isEmpty()) {
|
if ($rs->isEmpty()) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,23 +354,23 @@ class lastpostsextendWidget
|
|||||||
$res = $w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '';
|
$res = $w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '';
|
||||||
|
|
||||||
while ($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
$res .= '<li>'.
|
$res .= '<li>' .
|
||||||
'<'.($rs->post_status == 1 ? 'a href="'.$rs->getURL().'"' : 'span').
|
'<' . ($rs->post_status == 1 ? 'a href="' . $rs->getURL() . '"' : 'span') .
|
||||||
' title="'.
|
' title="' .
|
||||||
dt::dt2str(
|
dt::dt2str(
|
||||||
$core->blog->settings->system->date_format,
|
$core->blog->settings->system->date_format,
|
||||||
$rs->post_upddt
|
$rs->post_upddt
|
||||||
).', '.
|
) . ', ' .
|
||||||
dt::dt2str(
|
dt::dt2str(
|
||||||
$core->blog->settings->system->time_format,
|
$core->blog->settings->system->time_format,
|
||||||
$rs->post_upddt
|
$rs->post_upddt
|
||||||
).'">'.
|
) . '">' .
|
||||||
html::escapeHTML($rs->post_title).
|
html::escapeHTML($rs->post_title) .
|
||||||
'</'.($rs->post_status == 1 ? 'a' : 'span').'>';
|
'</' . ($rs->post_status == 1 ? 'a' : 'span') . '>';
|
||||||
|
|
||||||
# Nb comments
|
# Nb comments
|
||||||
if ($w->commentscount && $rs->post_status == 1) {
|
if ($w->commentscount && $rs->post_status == 1) {
|
||||||
$res .= ' ('.$rs->nb_comment.')';
|
$res .= ' (' . $rs->nb_comment . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
# First image
|
# First image
|
||||||
@ -402,8 +396,7 @@ class lastpostsextendWidget
|
|||||||
$excerpt,
|
$excerpt,
|
||||||
abs((integer) $w->excerptlen)
|
abs((integer) $w->excerptlen)
|
||||||
);
|
);
|
||||||
$res .= ' : '.$cut.(strlen($cut) < strlen($excerpt) ?
|
$res .= ' : ' . $cut . (strlen($cut) < strlen($excerpt) ? '...' : '');
|
||||||
'...' : '');
|
|
||||||
|
|
||||||
unset($cut);
|
unset($cut);
|
||||||
}
|
}
|
||||||
@ -413,31 +406,30 @@ class lastpostsextendWidget
|
|||||||
|
|
||||||
return $w->renderDiv(
|
return $w->renderDiv(
|
||||||
$w->content_only,
|
$w->content_only,
|
||||||
'lastpostsextend '.$w->class,
|
'lastpostsextend ' . $w->class,
|
||||||
'',
|
'',
|
||||||
'<ul>'.$res.'</ul>'
|
'<ul>' . $res . '</ul>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function entryFirstImage($core, $type, $id, $size='s')
|
private static function entryFirstImage($core, $type, $id, $size = 's')
|
||||||
{
|
{
|
||||||
if (!in_array($type, array('post', 'page', 'galitem'))) {
|
if (!in_array($type, ['post', 'page', 'galitem'])) {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = $core->auth->sudo(
|
$rs = $core->auth->sudo(
|
||||||
array($core->blog, 'getPosts'),
|
[$core->blog, 'getPosts'],
|
||||||
array('post_id' => $id, 'post_type' => $type),
|
['post_id' => $id, 'post_type' => $type],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($rs->isEmpty()) {
|
if ($rs->isEmpty()) {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^sq|t|s|m|o$/',$size)) {
|
if (!preg_match('/^sq|t|s|m|o$/', $size)) {
|
||||||
$size = 's';
|
$size = 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,19 +441,19 @@ class lastpostsextendWidget
|
|||||||
);
|
);
|
||||||
$p_root = $core->blog->public_path;
|
$p_root = $core->blog->public_path;
|
||||||
|
|
||||||
$pattern = '(?:'.preg_quote($p_site, '/').')?'.preg_quote($p_url, '/');
|
$pattern = '(?:' . preg_quote($p_site, '/') . ')?' . preg_quote($p_url, '/');
|
||||||
$pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu', $pattern);
|
$pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu', $pattern);
|
||||||
|
|
||||||
$src = '';
|
$src = '';
|
||||||
$alt = '';
|
$alt = '';
|
||||||
|
|
||||||
$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];
|
||||||
}
|
}
|
||||||
@ -471,46 +463,41 @@ class lastpostsextendWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$src) {
|
if (!$src) {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
'<div class="img-box">'.
|
'<div class="img-box">' .
|
||||||
'<div class="img-thumbnail">'.
|
'<div class="img-thumbnail">' .
|
||||||
'<a title="'.html::escapeHTML($rs->post_title).'" href="'.$rs->getURL().'">'.
|
'<a title="' . html::escapeHTML($rs->post_title) . '" href="' . $rs->getURL() . '">' .
|
||||||
'<img alt="'.$alt.'" src="'.stripslashes($src).'" />'.
|
'<img alt="' . $alt . '" src="' . stripslashes($src) . '" />' .
|
||||||
'</a></div>'.
|
'</a></div>' .
|
||||||
"</div>\n";
|
"</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function ContentFirstImageLookup($root,$img,$size)
|
private static function ContentFirstImageLookup($root, $img, $size)
|
||||||
{
|
{
|
||||||
# Get base name and extension
|
# Get base name and extension
|
||||||
$info = path::info($img);
|
$info = path::info($img);
|
||||||
$base = $info['base'];
|
$base = $info['base'];
|
||||||
|
|
||||||
if (preg_match('/^\.(.+)_(sq|t|s|m)$/',$base,$m)) {
|
if (preg_match('/^\.(.+)_(sq|t|s|m)$/', $base, $m)) {
|
||||||
$base = $m[1];
|
$base = $m[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = false;
|
$res = false;
|
||||||
if ($size != 'o' && file_exists($root.'/'.$info['dirname'].'/.'.$base.'_'.$size.'.jpg')) {
|
if ($size != 'o' && file_exists($root . '/' . $info['dirname'] . '/.' . $base . '_' . $size . '.jpg')) {
|
||||||
$res = '.'.$base.'_'.$size.'.jpg';
|
$res = '.' . $base . '_' . $size . '.jpg';
|
||||||
}
|
} else {
|
||||||
else {
|
$f = $root . '/' . $info['dirname'] . '/' . $base;
|
||||||
$f = $root.'/'.$info['dirname'].'/'.$base;
|
if (file_exists($f . '.' . $info['extension'])) {
|
||||||
if (file_exists($f.'.'.$info['extension'])) {
|
$res = $base . '.' . $info['extension'];
|
||||||
$res = $base.'.'.$info['extension'];
|
} elseif (file_exists($f . '.jpg')) {
|
||||||
}
|
$res = $base . '.jpg';
|
||||||
elseif (file_exists($f.'.jpg')) {
|
} elseif (file_exists($f . '.png')) {
|
||||||
$res = $base.'.jpg';
|
$res = $base . '.png';
|
||||||
}
|
} elseif (file_exists($f . '.gif')) {
|
||||||
elseif (file_exists($f.'.png')) {
|
$res = $base . '.gif';
|
||||||
$res = $base.'.png';
|
|
||||||
}
|
|
||||||
elseif (file_exists($f.'.gif')) {
|
|
||||||
$res = $base.'.gif';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,52 +1,51 @@
|
|||||||
<?php
|
<?php
|
||||||
// Language: Français
|
// Language: Français
|
||||||
// Module: lastpostsExtend - 2013.11.12
|
// Module: lastpostsExtend - 2021.08.25
|
||||||
// Date: 2013-11-13 07:22:55
|
// Date: 2021-08-25 22:43:47
|
||||||
// Translated with dcTranslater - 2013.05.11
|
// Translated with dcTranslater - 2021.08.18
|
||||||
|
|
||||||
#_widgets.php:34
|
#_widgets.php:33
|
||||||
$GLOBALS['__l10n']['Last entries (Extended)'] = 'Derniers billets (étendu)';
|
$GLOBALS['__l10n']['Last entries (Extended)'] = 'Derniers billets (étendu)';
|
||||||
|
|
||||||
#_widgets.php:37
|
#_widgets.php:36
|
||||||
$GLOBALS['__l10n']['Extended list of entries'] = 'Liste étendue de billets';
|
$GLOBALS['__l10n']['Extended list of entries'] = 'Liste étendue de billets';
|
||||||
|
|
||||||
#_widgets.php:48
|
#_widgets.php:47
|
||||||
$GLOBALS['__l10n']['Post'] = 'Billet';
|
$GLOBALS['__l10n']['Post'] = 'Billet';
|
||||||
|
|
||||||
#_widgets.php:50
|
#_widgets.php:49
|
||||||
$GLOBALS['__l10n']['Gallery'] = 'Galerie';
|
$GLOBALS['__l10n']['Gallery'] = 'Galerie';
|
||||||
|
|
||||||
#_widgets.php:95
|
#_widgets.php:94
|
||||||
$GLOBALS['__l10n']['Protection:'] = 'Protection :';
|
$GLOBALS['__l10n']['Protection:'] = 'Protection :';
|
||||||
|
|
||||||
#_widgets.php:100
|
#_widgets.php:99
|
||||||
$GLOBALS['__l10n']['only without password'] = 'seulement sans mot de passe';
|
$GLOBALS['__l10n']['only without password'] = 'seulement sans mot de passe';
|
||||||
|
|
||||||
#_widgets.php:101
|
#_widgets.php:100
|
||||||
$GLOBALS['__l10n']['only with password'] = 'seulement avec mot de passe';
|
$GLOBALS['__l10n']['only with password'] = 'seulement avec mot de passe';
|
||||||
|
|
||||||
#_widgets.php:121
|
#_widgets.php:120
|
||||||
$GLOBALS['__l10n']['Selected entries only'] = 'Billets sélectionnés seulement';
|
$GLOBALS['__l10n']['Selected entries only'] = 'Billets sélectionnés seulement';
|
||||||
|
|
||||||
#_widgets.php:128
|
#_widgets.php:127
|
||||||
$GLOBALS['__l10n']['Updated entries only'] = 'Billets mis à jour seulement';
|
$GLOBALS['__l10n']['Updated entries only'] = 'Billets mis à jour seulement';
|
||||||
|
|
||||||
#_widgets.php:137
|
#_widgets.php:135
|
||||||
$GLOBALS['__l10n']['Limit to tags:'] = 'Limiter aux mots-clés :';
|
$GLOBALS['__l10n']['Limit to tags:'] = 'Limiter aux mots-clés :';
|
||||||
|
|
||||||
#_widgets.php:145
|
#_widgets.php:143
|
||||||
$GLOBALS['__l10n']['Limit to words:'] = 'Limiter aux mots :';
|
$GLOBALS['__l10n']['Limit to words:'] = 'Limiter aux mots :';
|
||||||
|
|
||||||
#_widgets.php:182
|
#_widgets.php:180
|
||||||
$GLOBALS['__l10n']['Show entries first image:'] = 'Afficher la première image du billet :';
|
$GLOBALS['__l10n']['Show entries first image:'] = 'Afficher la première image du billet :';
|
||||||
|
|
||||||
#_widgets.php:197
|
#_widgets.php:195
|
||||||
$GLOBALS['__l10n']['Show entries excerpt'] = "Afficher l'extrait";
|
$GLOBALS['__l10n']['Show entries excerpt'] = 'Afficher l\'extrait';
|
||||||
|
|
||||||
#_widgets.php:204
|
#_widgets.php:202
|
||||||
$GLOBALS['__l10n']['Excerpt length:'] = "Taille de l'extrait :";
|
$GLOBALS['__l10n']['Excerpt length:'] = 'Taille de l\'extrait :';
|
||||||
|
|
||||||
#_widgets.php:211
|
#_widgets.php:209
|
||||||
$GLOBALS['__l10n']['Show comments count'] = 'Afficher le nombre de commentaires';
|
$GLOBALS['__l10n']['Show comments count'] = 'Afficher le nombre de commentaires';
|
||||||
|
|
||||||
?>
|
|
@ -1,76 +1,77 @@
|
|||||||
# Language: Français
|
# Language: Français
|
||||||
# Module: lastpostsExtend - 2013.11.12
|
# Module: lastpostsExtend - 2021.08.25
|
||||||
# Date: 2013-11-13 07:22:55
|
# Date: 2021-08-25 22:43:47
|
||||||
# Translated with translater 2013.05.11
|
# Translated with translater 2021.08.18
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Project-Id-Version: lastpostsExtend 2013.11.12\n"
|
"Project-Id-Version: lastpostsExtend 2021.08.25\n"
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: 2013-11-13T07:22:55+00:00\n"
|
"PO-Revision-Date: 2021-08-25T22:43:47+00:00\n"
|
||||||
"Last-Translator: Jean-Christian Denis\n"
|
"Last-Translator: Jean-Christian Denis\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
|
||||||
#: _widgets.php:34
|
#: _widgets.php:33
|
||||||
msgid "Last entries (Extended)"
|
msgid "Last entries (Extended)"
|
||||||
msgstr "Derniers billets (étendu)"
|
msgstr "Derniers billets (étendu)"
|
||||||
|
|
||||||
#: _widgets.php:37
|
#: _widgets.php:36
|
||||||
msgid "Extended list of entries"
|
msgid "Extended list of entries"
|
||||||
msgstr "Liste étendue de billets"
|
msgstr "Liste étendue de billets"
|
||||||
|
|
||||||
#: _widgets.php:48
|
#: _widgets.php:47
|
||||||
msgid "Post"
|
msgid "Post"
|
||||||
msgstr "Billet"
|
msgstr "Billet"
|
||||||
|
|
||||||
#: _widgets.php:50
|
#: _widgets.php:49
|
||||||
msgid "Gallery"
|
msgid "Gallery"
|
||||||
msgstr "Galerie"
|
msgstr "Galerie"
|
||||||
|
|
||||||
#: _widgets.php:95
|
#: _widgets.php:94
|
||||||
msgid "Protection:"
|
msgid "Protection:"
|
||||||
msgstr "Protection :"
|
msgstr "Protection :"
|
||||||
|
|
||||||
#: _widgets.php:100
|
#: _widgets.php:99
|
||||||
msgid "only without password"
|
msgid "only without password"
|
||||||
msgstr "seulement sans mot de passe"
|
msgstr "seulement sans mot de passe"
|
||||||
|
|
||||||
#: _widgets.php:101
|
#: _widgets.php:100
|
||||||
msgid "only with password"
|
msgid "only with password"
|
||||||
msgstr "seulement avec mot de passe"
|
msgstr "seulement avec mot de passe"
|
||||||
|
|
||||||
#: _widgets.php:121
|
#: _widgets.php:120
|
||||||
msgid "Selected entries only"
|
msgid "Selected entries only"
|
||||||
msgstr "Billets sélectionnés seulement"
|
msgstr "Billets sélectionnés seulement"
|
||||||
|
|
||||||
#: _widgets.php:128
|
#: _widgets.php:127
|
||||||
msgid "Updated entries only"
|
msgid "Updated entries only"
|
||||||
msgstr "Billets mis à jour seulement"
|
msgstr "Billets mis à jour seulement"
|
||||||
|
|
||||||
#: _widgets.php:137
|
#: _widgets.php:135
|
||||||
msgid "Limit to tags:"
|
msgid "Limit to tags:"
|
||||||
msgstr "Limiter aux mots-clés :"
|
msgstr "Limiter aux mots-clés :"
|
||||||
|
|
||||||
#: _widgets.php:145
|
#: _widgets.php:143
|
||||||
msgid "Limit to words:"
|
msgid "Limit to words:"
|
||||||
msgstr "Limiter aux mots :"
|
msgstr "Limiter aux mots :"
|
||||||
|
|
||||||
#: _widgets.php:182
|
#: _widgets.php:180
|
||||||
msgid "Show entries first image:"
|
msgid "Show entries first image:"
|
||||||
msgstr "Afficher la première image du billet :"
|
msgstr "Afficher la première image du billet :"
|
||||||
|
|
||||||
#: _widgets.php:197
|
#: _widgets.php:195
|
||||||
msgid "Show entries excerpt"
|
msgid "Show entries excerpt"
|
||||||
msgstr "Afficher l'extrait"
|
msgstr "Afficher l'extrait"
|
||||||
|
|
||||||
#: _widgets.php:204
|
#: _widgets.php:202
|
||||||
msgid "Excerpt length:"
|
msgid "Excerpt length:"
|
||||||
msgstr "Taille de l'extrait :"
|
msgstr "Taille de l'extrait :"
|
||||||
|
|
||||||
#: _widgets.php:211
|
#: _widgets.php:209
|
||||||
msgid "Show comments count"
|
msgid "Show comments count"
|
||||||
msgstr "Afficher le nombre de commentaires"
|
msgstr "Afficher le nombre de commentaires"
|
||||||
|
|
||||||
|
13
repository.xml
Normal file
13
repository.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
|
<module id="lastpostsExtend">
|
||||||
|
<name>Last entries (Extended)</name>
|
||||||
|
<version>2021.08.25</version>
|
||||||
|
<author>Jean-Christian Denis and contributors</author>
|
||||||
|
<desc>Extended list of entries</desc>
|
||||||
|
<file>https://github.com/JcDenis/lastpostsExtend/releases/download/v2021.08.25/plugin-lastpostsExtend.zip</file>
|
||||||
|
<da:dcmin>2.19</da:dcmin>
|
||||||
|
<da:details>https://plugins.dotaddict.org/dc2/details/lastpostsExtend</da:details>
|
||||||
|
<da:section></da:section>
|
||||||
|
<da:support>https://github.com/JcDenis/lastpostsExtend</da:support>
|
||||||
|
</module>
|
||||||
|
</modules>
|
Loading…
Reference in New Issue
Block a user