'.
-__('Use date format of Dotclear or leave empty to use default date format of blog.').
+ array(
+ 'fac_formats[' . $uid . '][dateformat]',
+ 'fac_formats_' . $uid . '_dateformat'
+ ),
+ 20,
+ 255,
+ '',
+ 'maximal'
+) . '
+
' .
+__('Use date format of Dotclear or leave empty to use default date format of blog.') .
'
@@ -538,30 +531,30 @@ __('Leave lengh empty for no limit.').
-
'.__('Informations').'
+
' . __('Informations') . '
-
'.__('Theme').'
-
'.
-__('Theme must have behavoir publicEntryAfterContent.').' '.
-__('To add feed to an entry edit this entry and put in sidebar the url of the feed and select a format.').
+
' . __('Theme') . '
+
' .
+__('Theme must have behavoir publicEntryAfterContent.') . ' ' .
+__('To add feed to an entry edit this entry and put in sidebar the url of the feed and select a format.') .
'
-
'.__('Structure').'
-
'.html::escapeHTML('
+
' . __('Structure') . '
+
' . html::escapeHTML('
-
'.__('Title of feed').'
-
'.__('Description of feed').'
+
' . __('Title of feed') . '
+
' . __('Description of feed') . '
-
'.__('Title of entry').'
-
'.__('Description of entry').'
+
' . __('Title of entry') . '
+
' . __('Description of entry') . '
-').'
+') . '
-
';
+
';
\ No newline at end of file
diff --git a/_define.php b/_define.php
index b3e2c95..bc9ca90 100644
--- a/_define.php
+++ b/_define.php
@@ -3,8 +3,7 @@
#
# This file is part of fac, a plugin for Dotclear 2.
#
-# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
-# contact@jcdenis.fr http://jcd.lv
+# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
@@ -13,25 +12,19 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
-
- return null;
+ return null;
}
$this->registerModule(
- /* Name */
- "fac",
- /* Description*/
- "Add RSS/Atom feeds after entries content",
- /* Author */
- "Jean-Christian Denis",
- /* Version */
- '0.7',
- /* Properies */
- array(
- 'permissions' => 'usage,contentadmin',
- 'type' => 'plugin',
- 'dc_min' => '2.6',
- 'support' => 'http://jcd.lv/q=fac',
- 'details' => 'http://plugins.dotaddict.org/dc2/details/fac'
- )
-);
+ 'fac',
+ 'Add RSS/Atom feeds after entries content',
+ 'Jean-Christian Denis and Contributors',
+ '0.8',
+ [
+ 'permissions' => 'usage,contentadmin',
+ 'type' => 'plugin',
+ 'dc_min' => '2.18',
+ 'support' => 'https://github.com/JcDenis/fac',
+ 'details' => 'https://plugins.dotaddict.org/dc2/details/fac'
+ ]
+);
\ No newline at end of file
diff --git a/_install.php b/_install.php
index 19ffd8a..dcccebb 100644
--- a/_install.php
+++ b/_install.php
@@ -3,8 +3,7 @@
#
# This file is part of fac, a plugin for Dotclear 2.
#
-# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
-# contact@jcdenis.fr http://jcd.lv
+# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
@@ -13,8 +12,7 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
-
- return null;
+ return null;
}
# -- Module specs --
@@ -22,107 +20,107 @@ if (!defined('DC_CONTEXT_ADMIN')) {
$dc_min = '2.6';
$mod_id = 'fac';
$mod_conf = array(
- array(
- 'fac_active',
- 'Enabled fac plugin',
- false,
- 'boolean'
- ),
- array(
- 'fac_public_tpltypes',
- 'List of templates types which used fac',
- serialize(array('post', 'tag', 'archive')),
- 'string'
- ),
- array(
- 'fac_formats',
- 'Formats of feeds contents',
- serialize(array(
- uniqid() => array(
- 'name' => 'default',
- 'dateformat' => '',
- 'lineslimit' => '5',
- 'linestitletext' => '%T',
- 'linestitleover' => '%D',
- 'linestitlelength' => '150',
- 'showlinesdescription' => '0',
- 'linesdescriptionlength' => '350',
- 'linesdescriptionnohtml' => '1',
- 'showlinescontent' => '0',
- 'linescontentlength' => '350',
- 'linescontentnohtml' => '1'
- ),
- uniqid() => array(
- 'name' => 'full',
- 'dateformat' => '',
- 'lineslimit' => '20',
- 'linestitletext' => '%T',
- 'linestitleover' => '%D - %E',
- 'linestitlelength' => '',
- 'showlinesdescription' => '1',
- 'linesdescriptionlength' => '',
- 'linesdescriptionnohtml' => '1',
- 'showlinescontent' => '1',
- 'linescontentlength' => '',
- 'linescontentnohtml' => '1'
- )
- )),
- 'string'
- ),
- array(
- 'fac_defaultfeedtitle',
- 'Default title of feed',
- '%T',
- 'string'
- ),
- array(
- 'fac_showfeeddesc',
- 'Show description of feed',
- 1,
- 'boolean'
- )
+ array(
+ 'fac_active',
+ 'Enabled fac plugin',
+ false,
+ 'boolean'
+ ),
+ array(
+ 'fac_public_tpltypes',
+ 'List of templates types which used fac',
+ serialize(array('post', 'tag', 'archive')),
+ 'string'
+ ),
+ array(
+ 'fac_formats',
+ 'Formats of feeds contents',
+ serialize(array(
+ uniqid() => array(
+ 'name' => 'default',
+ 'dateformat' => '',
+ 'lineslimit' => '5',
+ 'linestitletext' => '%T',
+ 'linestitleover' => '%D',
+ 'linestitlelength' => '150',
+ 'showlinesdescription' => '0',
+ 'linesdescriptionlength' => '350',
+ 'linesdescriptionnohtml' => '1',
+ 'showlinescontent' => '0',
+ 'linescontentlength' => '350',
+ 'linescontentnohtml' => '1'
+ ),
+ uniqid() => array(
+ 'name' => 'full',
+ 'dateformat' => '',
+ 'lineslimit' => '20',
+ 'linestitletext' => '%T',
+ 'linestitleover' => '%D - %E',
+ 'linestitlelength' => '',
+ 'showlinesdescription' => '1',
+ 'linesdescriptionlength' => '',
+ 'linesdescriptionnohtml' => '1',
+ 'showlinescontent' => '1',
+ 'linescontentlength' => '',
+ 'linescontentnohtml' => '1'
+ )
+ )),
+ 'string'
+ ),
+ array(
+ 'fac_defaultfeedtitle',
+ 'Default title of feed',
+ '%T',
+ 'string'
+ ),
+ array(
+ 'fac_showfeeddesc',
+ 'Show description of feed',
+ 1,
+ 'boolean'
+ )
);
# -- Nothing to change below --
try {
- # Check module version
- if (version_compare(
- $core->getVersion($mod_id),
- $core->plugins->moduleInfo($mod_id, 'version'),
- '>='
- )) {
+ # Check module version
+ if (version_compare(
+ $core->getVersion($mod_id),
+ $core->plugins->moduleInfo($mod_id, 'version'),
+ '>='
+ )) {
- return null;
- }
+ return null;
+ }
- # Check Dotclear version
- if (!method_exists('dcUtils', 'versionsCompare')
- || dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
- throw new Exception(sprintf(
- '%s requires Dotclear %s', $mod_id, $dc_min
- ));
- }
+ # Check Dotclear version
+ if (!method_exists('dcUtils', 'versionsCompare')
+ || dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
+ throw new Exception(sprintf(
+ '%s requires Dotclear %s', $mod_id, $dc_min
+ ));
+ }
- # Set module settings
- $core->blog->settings->addNamespace($mod_id);
- foreach($mod_conf as $v) {
- $core->blog->settings->{$mod_id}->put(
- $v[0], $v[2], $v[3], $v[1], false, true
- );
- }
+ # Set module settings
+ $core->blog->settings->addNamespace($mod_id);
+ foreach($mod_conf as $v) {
+ $core->blog->settings->{$mod_id}->put(
+ $v[0], $v[2], $v[3], $v[1], false, true
+ );
+ }
- # Set module version
- $core->setVersion(
- $mod_id,
- $core->plugins->moduleInfo($mod_id, 'version')
- );
+ # Set module version
+ $core->setVersion(
+ $mod_id,
+ $core->plugins->moduleInfo($mod_id, 'version')
+ );
- return true;
+ return true;
}
catch (Exception $e) {
- $core->error->add($e->getMessage());
+ $core->error->add($e->getMessage());
- return false;
-}
+ return false;
+}
\ No newline at end of file
diff --git a/_public.php b/_public.php
index 80f10db..2b535f4 100644
--- a/_public.php
+++ b/_public.php
@@ -3,8 +3,7 @@
#
# This file is part of fac, a plugin for Dotclear 2.
#
-# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
-# contact@jcdenis.fr http://jcd.lv
+# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
@@ -13,13 +12,12 @@
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_RC_PATH')) {
-
- return null;
+ return null;
}
$core->addBehavior(
- 'publicEntryAfterContent',
- array('facPublic', 'publicEntryAfterContent')
+ 'publicEntryAfterContent',
+ array('facPublic', 'publicEntryAfterContent')
);
/**
@@ -29,237 +27,226 @@ $core->addBehavior(
*/
class facPublic
{
- /**
- * Add feed after entry
- *
- * @param dcCore $core dcCore instance
- * @param context $_ctx context instance
- */
- public static function publicEntryAfterContent(dcCore $core, context $_ctx)
- {
- $core->blog->settings->addNamespace('fac');
+ /**
+ * Add feed after entry
+ *
+ * @param dcCore $core dcCore instance
+ * @param context $_ctx context instance
+ */
+ public static function publicEntryAfterContent(dcCore $core, context $_ctx)
+ {
+ $core->blog->settings->addNamespace('fac');
- # Not active or not a post
- if (!$core->blog->settings->fac->fac_active
- || !$_ctx->exists('posts')
- ) {
- return null;
- }
+ # Not active or not a post
+ if (!$core->blog->settings->fac->fac_active
+ || !$_ctx->exists('posts')) {
+ return null;
+ }
- # Not in page to show
- $types = @unserialize($core->blog->settings->fac->fac_public_tpltypes);
- if (!is_array($types)
- || !in_array($core->url->type,$types)
- ) {
- return null;
- }
+ # Not in page to show
+ $types = @unserialize($core->blog->settings->fac->fac_public_tpltypes);
+ if (!is_array($types)
+ || !in_array($core->url->type,$types)) {
+ return null;
+ }
- # Get related feed
- $fac_url = $core->meta->getMetadata(array(
- 'meta_type' => 'fac',
- 'post_id' => $_ctx->posts->post_id,
- 'limit' => 1
- ));
- if ($fac_url->isEmpty()) {
+ # Get related feed
+ $fac_url = $core->meta->getMetadata([
+ 'meta_type' => 'fac',
+ 'post_id' => $_ctx->posts->post_id,
+ 'limit' => 1
+ ]);
+ if ($fac_url->isEmpty()) {
+ return null;
+ }
- return null;
- }
+ # Get related format
+ $fac_format = $core->meta->getMetadata([
+ 'meta_type' => 'facformat',
+ 'post_id' => $_ctx->posts->post_id,
+ 'limit' => 1
+ ]);
+ if ($fac_format->isEmpty()) {
+ return null;
+ }
- # Get related format
- $fac_format = $core->meta->getMetadata(array(
- 'meta_type' => 'facformat',
- 'post_id' => $_ctx->posts->post_id,
- 'limit' => 1
- ));
- if ($fac_format->isEmpty()) {
+ # Get format info
+ $default_format = array(
+ 'name' => 'default',
+ 'dateformat' => '',
+ 'lineslimit' => '5',
+ 'linestitletext' => '%T',
+ 'linestitleover' => '%D',
+ 'linestitlelength' => '150',
+ 'showlinesdescription' => '0',
+ 'linesdescriptionlength' => '350',
+ 'linesdescriptionnohtml' => '1',
+ 'showlinescontent' => '0',
+ 'linescontentlength' => '350',
+ 'linescontentnohtml' => '1'
+ );
- return null;
- }
+ $formats = @unserialize($core->blog->settings->fac->fac_formats);
+ if (empty($formats)
+ || !is_array($formats)
+ || !isset($formats[$fac_format->meta_id])) {
+ $format = $default_format;
+ } else {
+ $format = array_merge(
+ $default_format,
+ $formats[$fac_format->meta_id]
+ );
+ }
- # Get format info
- $default_format = array(
- 'name' => 'default',
- 'dateformat' => '',
- 'lineslimit' => '5',
- 'linestitletext' => '%T',
- 'linestitleover' => '%D',
- 'linestitlelength' => '150',
- 'showlinesdescription' => '0',
- 'linesdescriptionlength' => '350',
- 'linesdescriptionnohtml' => '1',
- 'showlinescontent' => '0',
- 'linescontentlength' => '350',
- 'linescontentnohtml' => '1'
- );
+ # Read feed url
+ $cache = is_dir(DC_TPL_CACHE . '/fac') ? DC_TPL_CACHE . '/fac' : null;
+ try {
+ $feed = feedReader::quickParse($fac_url->meta_id, $cache);
+ } catch (Exception $e) {
+ $feed = null;
+ }
- $formats = @unserialize($core->blog->settings->fac->fac_formats);
- if (empty($formats)
- || !is_array($formats)
- || !isset($formats[$fac_format->meta_id])
- ) {
- $format = $default_format;
- }
- else {
- $format = array_merge(
- $default_format,
- $formats[$fac_format->meta_id]
- );
- }
+ # No entries
+ if (!$feed) {
+ return null;
+ }
- # Read feed url
- $cache = is_dir(DC_TPL_CACHE.'/fac') ? DC_TPL_CACHE.'/fac' : null;
- try {
- $feed = feedReader::quickParse($fac_url->meta_id,$cache);
- }
- catch (Exception $e) {
- $feed = null;
- }
+ # Feed title
+ $feedtitle = '';
+ if ('' != $core->blog->settings->fac->fac_defaultfeedtitle) {
+ $feedtitle = '
';
+ }
+}
\ No newline at end of file
diff --git a/locales/en/help/help.html b/locales/en/help/fac.html
similarity index 100%
rename from locales/en/help/help.html
rename to locales/en/help/fac.html
diff --git a/locales/en/resources.php b/locales/en/resources.php
index 93f65d7..549b317 100644
--- a/locales/en/resources.php
+++ b/locales/en/resources.php
@@ -3,8 +3,7 @@
#
# This file is part of fac, a plugin for Dotclear 2.
#
-# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
-# contact@jcdenis.fr http://jcd.lv
+# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
@@ -12,7 +11,8 @@
#
# -- END LICENSE BLOCK ------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
+if (!defined('DC_RC_PATH')) {
+ return;
+}
-$__resources['help']['fac'] = dirname(__FILE__).'/help/help.html';
-?>
\ No newline at end of file
+$__resources['help']['fac'] = dirname(__FILE__) . '/help/fac.html';
\ No newline at end of file
diff --git a/locales/fr/help/help.html b/locales/fr/help/fac.html
similarity index 100%
rename from locales/fr/help/help.html
rename to locales/fr/help/fac.html
diff --git a/locales/fr/resources.php b/locales/fr/resources.php
index 93f65d7..549b317 100644
--- a/locales/fr/resources.php
+++ b/locales/fr/resources.php
@@ -3,8 +3,7 @@
#
# This file is part of fac, a plugin for Dotclear 2.
#
-# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
-# contact@jcdenis.fr http://jcd.lv
+# Copyright (c) 2009-2021 Jean-Christian Denis and contributors
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
@@ -12,7 +11,8 @@
#
# -- END LICENSE BLOCK ------------------------------------
-if (!defined('DC_RC_PATH')) { return; }
+if (!defined('DC_RC_PATH')) {
+ return;
+}
-$__resources['help']['fac'] = dirname(__FILE__).'/help/help.html';
-?>
\ No newline at end of file
+$__resources['help']['fac'] = dirname(__FILE__) . '/help/fac.html';
\ No newline at end of file