upstream patch by ian

This commit is contained in:
Garvin Hicking 2016-09-23 11:28:47 +02:00
parent 97cb741907
commit 679e261fdc
2 changed files with 103 additions and 100 deletions

View file

@ -1,13 +1,17 @@
1.14:
-----
* Fix "Illegal string offset 'from'" error
* Use lang API - extends required Serendipity version to 1.6
1.13: 1.13:
----- -----
Add lang <de> * Add lang <de>
Add new option for case bottom, closing a div class with certain templates * Add new option for case bottom, closing a div class with certain templates
1.12: 1.12:
----- -----
Add ability for "plaintext" markup * Add ability for "plaintext" markup
1.11: 1.11:
----- -----
* Add support for putting nuggets in RSS feeds
Add support for putting nuggets in RSS feeds

View file

@ -4,14 +4,8 @@ if (IN_serendipity !== true) {
die ("Don't hack!"); die ("Don't hack!");
} }
// Load possible language files.
// Probe for a language include with constants. Still include defines later on, if some constants were missing @serendipity_plugin_api::load_language(dirname(__FILE__));
$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
include $probelang;
}
include dirname(__FILE__) . '/lang_en.inc.php';
class serendipity_event_page_nugget extends serendipity_event class serendipity_event_page_nugget extends serendipity_event
{ {
@ -23,19 +17,21 @@ class serendipity_event_page_nugget extends serendipity_event
$propbag->add('description', PLUGIN_PAGE_NUGGET_DESC); $propbag->add('description', PLUGIN_PAGE_NUGGET_DESC);
$propbag->add('stackable', true); $propbag->add('stackable', true);
$propbag->add('author', 'Wesley Hwang-Chung'); $propbag->add('author', 'Wesley Hwang-Chung');
$propbag->add('version', '1.13'); $propbag->add('version', '1.14');
$propbag->add('requirements', array( $propbag->add('requirements', array(
'serendipity' => '0.8', 'serendipity' => '1.6',
'smarty' => '2.6.7', 'smarty' => '2.6.7',
'php' => '4.1.0' 'php' => '4.1.0'
)); ));
$propbag->add('groups', array('FRONTEND_ENTRY_RELATED')); $propbag->add('groups', array('FRONTEND_ENTRY_RELATED'));
$propbag->add('event_hooks', array('frontend_header' => true, $propbag->add('event_hooks', array(
'frontend_header' => true,
'entries_header' => true, 'entries_header' => true,
'entry_display' => true, 'entry_display' => true,
'entries_footer' => true, 'entries_footer' => true,
'frontend_footer' => true, 'frontend_footer' => true,
'frontend_display' => true)); 'frontend_display' => true)
);
$propbag->add('configuration', array('title', 'placement', 'language', 'content', 'content_plain', 'footer_close', 'markup', 'show_where')); $propbag->add('configuration', array('title', 'placement', 'language', 'content', 'content_plain', 'footer_close', 'markup', 'show_where'));
} }
@ -144,7 +140,8 @@ class serendipity_event_page_nugget extends serendipity_event
$title = $this->get_config('title'); $title = $this->get_config('title');
} }
function event_hook($event, &$bag, &$eventData, $addData = null) { function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity; global $serendipity;
$hooks = &$bag->get('event_hooks'); $hooks = &$bag->get('event_hooks');
@ -153,10 +150,12 @@ class serendipity_event_page_nugget extends serendipity_event
$show_where = $this->get_config('show_where', 'both'); $show_where = $this->get_config('show_where', 'both');
// if the language doesn't match, do not display // if the language doesn't match, do not display
if ($language != 'all' && $serendipity['lang'] != $language) return false; if ($language != 'all' && $serendipity['lang'] != $language) {
return false;
}
// RSS-Feed special case // RSS-Feed special case
if ($event == 'frontend_display' && $addData['from'] == 'functions_entries:printEntries_rss') { if ($event == 'frontend_display' && (isset($addData['from']) && $addData['from'] == 'functions_entries:printEntries_rss')) {
if ($placement == 'rss') { if ($placement == 'rss') {
if (serendipity_db_bool($this->get_config('markup', 'true')) && $event != 'frontend_header') { if (serendipity_db_bool($this->get_config('markup', 'true')) && $event != 'frontend_header') {
$entry = array('html_nugget' => $this->get_config('content')); $entry = array('html_nugget' => $this->get_config('content'));
@ -166,7 +165,6 @@ class serendipity_event_page_nugget extends serendipity_event
$eventData['body'] .= $this->get_config('content') . $this->get_config('content_plain'); $eventData['body'] .= $this->get_config('content') . $this->get_config('content_plain');
} }
} }
return true; return true;
} }
@ -210,6 +208,7 @@ class serendipity_event_page_nugget extends serendipity_event
return false; return false;
} }
} }
} }
?> ?>