@@ -9,8 +11,9 @@
* @revisionDate 2012/02/02
*/
-@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty');
-@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Zpracovává instrukce Å¡ablonového systému Smarty napsané v tÄ›le pÅ™ÃspÄ›vku');
+@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty');
+@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Zpracovává instrukce Å¡ablonového systému Smarty napsané v tÄ›le pÅ™ÃspÄ›vku. This is not usable in combination with syntax code-highlighters or multilingual tags in entry context fields!');
// Next lines were translated on 2012/02/02
-@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - VarovánÃ: komentáře jsou veÅ™ejnÄ› pÅ™Ãstupný prostor, zacházejte s nimi opatrnÄ›!');
\ No newline at end of file
+@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - VarovánÃ: komentáře jsou veÅ™ejnÄ› pÅ™Ãstupný prostor, zacházejte s nimi opatrnÄ›!');
+
diff --git a/serendipity_event_smartymarkup/UTF-8/lang_de.inc.php b/serendipity_event_smartymarkup/UTF-8/lang_de.inc.php
index 9f17b16d..6fb74322 100644
--- a/serendipity_event_smartymarkup/UTF-8/lang_de.inc.php
+++ b/serendipity_event_smartymarkup/UTF-8/lang_de.inc.php
@@ -1,5 +1,6 @@
-
-
-
- Dokumentace: Markup: Smarty
-
-
- Dokumentace k pluginu 'Markup: Smarty'
- (serendipity_event_smartymarkup)
- Dokumentaci k tomuto pluginu pøeložil do èeštiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) dne 2.2.2012. Od té doby mohl být plugin pozmìnìn nebo mohly být rozšíøené jeho funkce. Zkontrolujte pro jistotu i aktuální anglický ChangeLog.
-
-
- Popis pluginu
-
- Zpracovává instrukce šablonového systému Smarty napsané v tìle pøíspìvku.
-
-
- Historie verzí (ChangeLog)
-
- - verze 1.10
-
- - pøidáno: varování v nastavení komentáøù (jestli se mají parsovat na pøítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"
-
- - verze 1.9
-
- - dopøedná kompatibilita se Smarty3
-
-
-
+
+
+
+
+ Dokumentace: Markup: Smarty
+
+
+ Dokumentace k pluginu 'Markup: Smarty'
+ (serendipity_event_smartymarkup)
+ Dokumentaci k tomuto pluginu pøeložil do èeštiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) dne 2.2.2012. Od té doby mohl být plugin pozmìnìn nebo mohly být rozšíøené jeho funkce. Zkontrolujte pro jistotu i aktuální anglický ChangeLog.
+
+ Popis pluginu
+ Zpracovává instrukce šablonového systému Smarty napsané v tìle pøíspìvku.
+
+ Historie verzí (ChangeLog)
+
+ - verze 1.10
+
+ - pøidáno: varování v nastavení komentáøù (jestli se mají parsovat na pøítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"
+
+ - verze 1.9
+
+ - dopøedná kompatibilita se Smarty3
+
+
+
diff --git a/serendipity_event_smartymarkup/documentation_cz.html b/serendipity_event_smartymarkup/documentation_cz.html
index fbb8cfaa..20839b5b 100644
--- a/serendipity_event_smartymarkup/documentation_cz.html
+++ b/serendipity_event_smartymarkup/documentation_cz.html
@@ -1,29 +1,27 @@
-
-
-
- Dokumentace: Markup: Smarty
-
-
- Dokumentace k pluginu 'Markup: Smarty'
- (serendipity_event_smartymarkup)
- Dokumentaci k tomuto pluginu pøelo¾il do èe¹tiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) dne 2.2.2012. Od té doby mohl být plugin pozmìnìn nebo mohly být roz¹íøené jeho funkce. Zkontrolujte pro jistotu i aktuální anglický ChangeLog.
-
-
- Popis pluginu
-
- Zpracovává instrukce ¹ablonového systému Smarty napsané v tìle pøíspìvku.
-
-
- Historie verzí (ChangeLog)
-
- - verze 1.10
-
- - pøidáno: varování v nastavení komentáøù (jestli se mají parsovat na pøítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"
-
- - verze 1.9
-
- - dopøedná kompatibilita se Smarty3
-
-
-
+
+
+
+
+ Dokumentace: Markup: Smarty
+
+
+ Dokumentace k pluginu 'Markup: Smarty'
+ (serendipity_event_smartymarkup)
+ Dokumentaci k tomuto pluginu pøelo¾il do èe¹tiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) dne 2.2.2012. Od té doby mohl být plugin pozmìnìn nebo mohly být roz¹íøené jeho funkce. Zkontrolujte pro jistotu i aktuální anglický ChangeLog.
+
+ Popis pluginu
+ Zpracovává instrukce ¹ablonového systému Smarty napsané v tìle pøíspìvku.
+
+ Historie verzí (ChangeLog)
+
+ - verze 1.10
+
+ - pøidáno: varování v nastavení komentáøù (jestli se mají parsovat na pøítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"
+
+ - verze 1.9
+
+ - dopøedná kompatibilita se Smarty3
+
+
+
diff --git a/serendipity_event_smartymarkup/lang_cs.inc.php b/serendipity_event_smartymarkup/lang_cs.inc.php
index 3672a8df..ee3550ad 100644
--- a/serendipity_event_smartymarkup/lang_cs.inc.php
+++ b/serendipity_event_smartymarkup/lang_cs.inc.php
@@ -1,6 +1,8 @@
* @translated 2009/02/22
* @author Vladimír Ajgl
@@ -9,8 +11,9 @@
* @revisionDate 2012/02/02
*/
-@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty');
-@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Zpracovává instrukce šablonového systému Smarty napsané v tìle pøíspìvku');
+@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty');
+@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Zpracovává instrukce šablonového systému Smarty napsané v tìle pøíspìvku. This is not usable in combination with syntax code-highlighters or multilingual tags in entry context fields!');
// Next lines were translated on 2012/02/02
-@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáøe jsou veøejnì pøístupný prostor, zacházejte s nimi opatrnì!');
\ No newline at end of file
+@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáøe jsou veøejnì pøístupný prostor, zacházejte s nimi opatrnì!');
+
diff --git a/serendipity_event_smartymarkup/lang_cz.inc.php b/serendipity_event_smartymarkup/lang_cz.inc.php
index 4d8d7354..68be6afc 100644
--- a/serendipity_event_smartymarkup/lang_cz.inc.php
+++ b/serendipity_event_smartymarkup/lang_cz.inc.php
@@ -1,6 +1,8 @@
* @translated 2009/02/22
* @author Vladimír Ajgl
@@ -9,8 +11,9 @@
* @revisionDate 2012/02/02
*/
-@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty');
-@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Zpracovává instrukce ¹ablonového systému Smarty napsané v tìle pøíspìvku');
+@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty');
+@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Zpracovává instrukce ¹ablonového systému Smarty napsané v tìle pøíspìvku. This is not usable in combination with syntax code-highlighters or multilingual tags in entry context fields!');
// Next lines were translated on 2012/02/02
-@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáøe jsou veøejnì pøístupný prostor, zacházejte s nimi opatrnì!');
\ No newline at end of file
+@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáøe jsou veøejnì pøístupný prostor, zacházejte s nimi opatrnì!');
+
diff --git a/serendipity_event_smartymarkup/lang_de.inc.php b/serendipity_event_smartymarkup/lang_de.inc.php
index 252fe3d5..733ed986 100644
--- a/serendipity_event_smartymarkup/lang_de.inc.php
+++ b/serendipity_event_smartymarkup/lang_de.inc.php
@@ -1,5 +1,6 @@
-
* EN-Revision: Revision of lang_en.inc.php
*/
-@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty Parsing');
-@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Parses Smarty instructions inside the article text');
-@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Warning: comments are public user-space, handle with care!');
+@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Markup: Smarty Parsing');
+@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Parses Smarty instructions inside the article text. This is not usable in combination with syntax code-highlighters or multilingual tags in entry context fields!');
+@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Warning: comments are public user-space, handle with care!');
-?>
diff --git a/serendipity_event_smartymarkup/serendipity_event_smartymarkup.php b/serendipity_event_smartymarkup/serendipity_event_smartymarkup.php
index 6264430f..271f093c 100644
--- a/serendipity_event_smartymarkup/serendipity_event_smartymarkup.php
+++ b/serendipity_event_smartymarkup/serendipity_event_smartymarkup.php
@@ -1,37 +1,11 @@
-add('description', PLUGIN_EVENT_SMARTYMARKUP_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '1.11');
+ $propbag->add('version', '1.12');
$propbag->add('requirements', array(
- 'serendipity' => '0.8',
- 'smarty' => '2.6.7',
- 'php' => '4.1.0'
+ 'serendipity' => '1.7',
+ 'smarty' => '3.1.0',
+ 'php' => '5.2.0'
));
$propbag->add('groups', array('MARKUP'));
$propbag->add('cachable_events', array('frontend_display' => true));
- $propbag->add('event_hooks', array('frontend_display' => true));
+ $propbag->add('event_hooks', array('frontend_display' => true));
if (!defined('STATICPAGE')) {
@define('STATICPAGE', 'Staticpage');
@@ -107,15 +81,15 @@ class serendipity_event_smartymarkup extends serendipity_event
$propbag->add('type', 'boolean');
$propbag->add('name', constant($name));
$propbag->add('description', sprintf(APPLY_MARKUP_TO, constant($name)) . ($name == 'COMMENT' ? PLUGIN_EVENT_SMARTYMARKUP_WARN : ''));
- $propbag->add('default', ($name == 'COMMENT' ? 'false' : 'true'));
+ $propbag->add('default', ($name == 'COMMENT' ? 'false' : 'true'));
return true;
}
- function smarty_resource_smartymarkupplugin_template($tpl_name, &$tpl_source, $smarty) {
+ function smarty_resource_smartymarkupplugin_template($tpl_name, &$tpl_source) {
global $serendipity;
// return the template content via referenced argument
- $tpl_source = $serendipity['PLUGINDATA']['smartymarkupplugin'];
+ $tpl_source = $serendipity['plugindata']['smartymarkupplugin'];
// test
#$tpl_source = '{assign var="foo" value="bar"}{$foo|escape:"html"}';
@@ -124,18 +98,18 @@ class serendipity_event_smartymarkup extends serendipity_event
return true;
}
- function smarty_resource_smartymarkupplugin_timestamp($tpl_name, &$tpl_timestamp, $smarty) {
+ function smarty_resource_smartymarkupplugin_timestamp($tpl_name, &$tpl_timestamp) {
global $serendipity;
- $tpl_timestamp = crc32($serendipity['PLUGINDATA']['smartymarkupplugin']);
+ $tpl_timestamp = crc32($serendipity['plugindata']['smartymarkupplugin']);
return true;
}
- function smarty_resource_smartymarkupplugin_secure($tpl_name, $smarty) {
+ function smarty_resource_smartymarkupplugin_secure($tpl_name) {
return true;
}
- function smarty_resource_smartymarkupplugin_trusted($tpl_name, $smarty) {
+ function smarty_resource_smartymarkupplugin_trusted($tpl_name) {
}
function smartymarkup($input, &$eventData) {
@@ -145,29 +119,20 @@ class serendipity_event_smartymarkup extends serendipity_event
serendipity_smarty_init();
}
- if (!isset($serendipity['PLUGINDATA']['smartymarkupplugin'])) {
- if( !defined('Smarty::SMARTY_VERSION') ) {
- $serendipity['smarty']->register_resource("smartymarkupplugin", array(
- "smarty_resource_smartymarkupplugin_template",
- "smarty_resource_smartymarkupplugin_timestamp",
- "smarty_resource_smartymarkupplugin_secure",
- "smarty_resource_smartymarkupplugin_trusted"));
- } else {
- // Smarty 3.1 >=
- $serendipity['smarty']->registerResource("smartymarkupplugin", array(
+ if (!isset($serendipity['plugindata']['smartymarkupplugin'])) {
+ $serendipity['smarty']->registerResource("smartymarkupplugin", array(
array( $this, "smarty_resource_smartymarkupplugin_template" ),
array( $this, "smarty_resource_smartymarkupplugin_timestamp" ),
array( $this, "smarty_resource_smartymarkupplugin_secure" ),
array( $this, "smarty_resource_smartymarkupplugin_trusted" )));
- }
}
- $serendipity['PLUGINDATA']['smartymarkupplugin'] =& $input;
+ $serendipity['plugindata']['smartymarkupplugin'] =& $input;
$serendipity['smarty']->assign('smartymarkup_eventData', $eventData);
// avoid non existing or empty template fetch calls
- if(isset($serendipity['PLUGINDATA']['smartymarkupplugin']) && !empty($serendipity['PLUGINDATA']['smartymarkupplugin'])) {
- return $serendipity['smarty']->fetch('smartymarkupplugin:' . crc32($serendipity['PLUGINDATA']['smartymarkupplugin']));
+ if (isset($serendipity['plugindata']['smartymarkupplugin']) && !empty($serendipity['plugindata']['smartymarkupplugin'])) {
+ return $serendipity['smarty']->fetch('smartymarkupplugin:' . crc32($serendipity['plugindata']['smartymarkupplugin']));
}
}
@@ -180,6 +145,15 @@ class serendipity_event_smartymarkup extends serendipity_event
switch($event) {
case 'frontend_display':
+ if ($_GET['serendipity']['is_iframe'] == 'true' && $_GET['serendipity']['iframe_mode'] == 'save') {
+ // Due to strange errors passing by with an unregistered function at this point,
+ // eg. giving a 'Fatal error: Call to undefined function staticpage_display()',
+ // we disable this in Serendipity iframe preview saving mode.
+ // $serendipity['GET'] is not available too
+ // This also disables the preview on saving, which is not a need and might confuse here
+ return;
+ }
+
foreach ($this->markup_elements as $temp) {
if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
!$eventData['properties']['ep_disable_markup_' . $this->instance] &&
@@ -195,7 +169,30 @@ class serendipity_event_smartymarkup extends serendipity_event
if (isset($eventData['staticpage']) && $temp['element'] == 'body') {
// Skip applying markup to a staticpage content, because
// it's already done for the "staticpage" element instead
- // of "body"
+ // of "body".
+ continue;
+ }
+ // This matches CKEDITOR codesnippet and Googles prettyprint highlight markup
+ // ToDo: enhance to match only when it finds {$foo} and {word_boundary patterns ...} in it
+ $regex = '/(<(pre|code)\s+[^>]*?class\s*?=\s*?["|\'].*?(prettyprint|language-).*?["|\'].*?>)(.*?)(<\/(code|pre)>)/si';
+ if (isset($eventData['body']) && preg_match($regex, $eventData['body']) ||
+ isset($eventData['extended']) && preg_match($regex, $eventData['extended']) ||
+ isset($eventData['staticpage']) && preg_match($regex, $eventData['staticpage'])) {
+ // Skip parsing when entry has code highlighter blocks,
+ // which are show-code only, set by CKEDITOR codesnippet plugin.
+ // This should work for other highlighters too,
+ // since this pattern is a common usage for marking syntax code.
+ // Do not use both in entries: Smarty parsing and Coding Blocks with Smarty!
+ // Default to skip are code highlighter blocks.
+ continue;
+ }
+ if (isset($eventData['body']) && preg_match('@{{!@', $eventData['body']) ||
+ isset($eventData['extended']) && preg_match('@{{!@', $eventData['extended']) ||
+ isset($eventData['staticpage']) && preg_match('@{{!@', $eventData['staticpage'])) {
+ // Do not parse content with multilanguage tags
+ // set by the multilingual plugin.
+ // Do not use both in entries: Smarty parsing and multilingual tags!
+ // Default to skip is tag multilingual.
continue;
}