Added option "stripBrs" ("Ignore <br> tags")

This commit is contained in:
Chri-s 2014-04-25 00:30:39 +02:00
parent 299fd50a5f
commit 5aba03c0a8
2 changed files with 15 additions and 1 deletions

View file

@ -28,4 +28,6 @@
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_SMARTTABS', 'Smart tabs');
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_SMARTTABS_DESC', 'Allows you to turn smart tabs feature on and off.');
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_TABSIZE', 'Tab size for smart tabs');
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_TABSIZE_DESC', 'Allows you to adjust tab size.');
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_TABSIZE_DESC', 'Allows you to adjust tab size.');
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_STRIPBRS', 'Ignore <br> tags');
@define('PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_STRIPBRS_DESC', 'If your software adds <br /> tags at the end of each line, this option allows you to ignore those..');

View file

@ -66,6 +66,7 @@ class serendipity_event_dpsyntaxhighlighter extends serendipity_event {
$conf_array[] = 'gutter';
$conf_array[] = 'smart-tabs';
$conf_array[] = 'tab-size';
$conf_array[] = 'stripBrs';
$propbag->add('configuration', $conf_array);
}
@ -137,6 +138,12 @@ class serendipity_event_dpsyntaxhighlighter extends serendipity_event {
$propbag->add('default', '4');
$propbag->add('validate', 'number');
break;
case 'stripBrs':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_STRIPBRS);
$propbag->add('description', PLUGIN_EVENT_DPSYNTAXHIGHLIGHTER_STRIPBRS_DESC);
$propbag->add('default', 'false');
break;
}
return true;
}
@ -173,6 +180,11 @@ class serendipity_event_dpsyntaxhighlighter extends serendipity_event {
$footer_add .= '<script type="text/javascript">
SyntaxHighlighter.config.clipboardSwf = \''.$pluginDir.'/sh/'.$this->version.'/scripts/clipboard.swf\';';
$stripBrs = $this->get_config('stripBrs');
if ($stripBrs) {
$footer_add .= 'SyntaxHighlighter.config.stripBrs = true;';
}
$toolbar = $this->get_config('toolbar');
if (!$toolbar) {
$footer_add .= 'SyntaxHighlighter.defaults[\'toolbar\'] = false;';