linktrimmer - frontpage option and nativ API use

This commit is contained in:
Ian 2013-06-14 10:54:04 +02:00
parent 402c682021
commit ce803ca0ae
3 changed files with 29 additions and 24 deletions

View file

@ -1,33 +1,37 @@
1.3:
----
* Added new option to hide lintrimmer on backend frontpage
* Use nativ API method here - extends S9y version >= 1.3
1.1, 1.2:
----
static php5 function fixes
* Static php5 function fixes
1.0:
----
do not show in Dashboard (POC)
* Do not show in Dashboard (POC)
0.9:
----
added CKEDITOR ready eventData image path
* Added CKEDITOR ready eventData image path
0.8:
----
latest: Smarty3 forward compatibility
* Latest: Smarty3 forward compatibility
0.7:
----
Use latin1_general_cs charset due to lower/uppercase lookups,
thanks to danst0
* Use latin1_general_cs charset due to lower/uppercase lookups,
thanks to danst0
0.6:
----
Allow to be used in other plugins (danst0)
* Allow to be used in other plugins (danst0)
0.5:
----
Remove unneeded die()
* Remove unneeded die()
0.1:
----
Initial Release. See Documentation.
* Initial Release. See Documentation.

View file

@ -9,3 +9,5 @@ define('PLUGIN_LINKTRIMMER_LINKPREFIX', 'Link prefix');
define('PLUGIN_LINKTRIMMER_LINKPREFIX_DESC', 'Enter a unique URL portion that will be used on your domain to identify the base of the linktrimmer. If you enter "l" for example, your URLs will look like http://yourblog/l/feda [with URL-Rewriting enabled] or http://yourblog/index.php?/l/feda [without URL-Rewriting]. Never leave empty, even if you have a separate domain for your short url.');
define('PLUGIN_LINKTRIMMER_DOMAIN', 'Domain');
define('PLUGIN_LINKTRIMMER_DOMAIN_DESC', 'The link that is used for the output. You could use .htaccess redirection of any other domain you own and enter that here. If you have Serendipity on http://mylongdomain.com/serendipity/ but also own http://short.com/ you could enter http://short.com/ here, and inside the .htaccess of short.com redirect everything to your longdomain: RewriteRule ^(.*)$ http://longdomain.com/serendipity/yourprefix/$1 (alternativly: redirectMatch 301 ^(.*)$ http://longdomain.com/serendipity/yourprefix/$1). URLs are then redirected twice: from your short.com to mylongdomain.com to the original URL.');
define('PLUGIN_LINKTRIMMER_FRONTPAGE_OPTION', 'Show linktrimmer on backend frontpage?');

View file

@ -21,15 +21,15 @@ class serendipity_event_linktrimmer extends serendipity_event {
$propbag->add('name', PLUGIN_LINKTRIMMER_NAME);
$propbag->add('description', PLUGIN_LINKTRIMMER_DESC);
$propbag->add('requirements', array(
'serendipity' => '0.9',
'serendipity' => '1.3',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '1.2');
$propbag->add('version', '1.3');
$propbag->add('author', 'Garvin Hicking');
$propbag->add('stackable', false);
$propbag->add('configuration', array('prefix', 'domain'));
$propbag->add('configuration', array('prefix', 'frontpage', 'domain'));
$propbag->add('event_hooks', array(
'backend_frontpage_display' => true,
'css_backend' => true,
@ -56,6 +56,13 @@ class serendipity_event_linktrimmer extends serendipity_event {
$propbag->add('default', 'l');
break;
case 'frontpage':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_LINKTRIMMER_FRONTPAGE_OPTION);
$propbag->add('description', '');
$propbag->add('default', 'true');
break;
case 'domain':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_LINKTRIMMER_DOMAIN);
@ -202,16 +209,8 @@ class serendipity_event_linktrimmer extends serendipity_event {
'linktrimmer_css' => file_get_contents(dirname(__FILE__) . '/linktrimmer.css')
));
$tfile = serendipity_getTemplateFile('plugin_linktrimmer.tpl', 'serendipityPath');
if (!$tfile || $tfile == 'plugin_linktrimmer.tpl') {
$tfile = dirname(__FILE__) . '/plugin_linktrimmer.tpl';
}
$inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
$serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
$content = $serendipity['smarty']->fetch('file:'. $tfile);
$serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
echo $content;
// use nativ API here - extends S9y version >= 1.3
echo $this->parseTemplate('plugin_linktrimmer.tpl');
}
function generate_button ($txtarea) {
@ -299,7 +298,7 @@ class serendipity_event_linktrimmer extends serendipity_event {
break;
case 'backend_frontpage_display':
if (!isset($serendipity['plugin_dashboard_version'])) $this->show();
if (!isset($serendipity['plugin_dashboard_version']) && serendipity_db_bool($this->get_config('frontpage', true)) ) $this->show();
break;
case 'external_plugin':