smartymarkup fixes and some exclude checks before action
This commit is contained in:
parent
e846a0f2c8
commit
779ee5b93c
7
serendipity_event_smartymarkup/.htaccess
Normal file
7
serendipity_event_smartymarkup/.htaccess
Normal file
|
@ -0,0 +1,7 @@
|
|||
<Files .htaccess>
|
||||
Allow from all
|
||||
</Files>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine Off
|
||||
</IfModule>
|
|
@ -1,5 +1,19 @@
|
|||
1.10
|
||||
added: configs comment warning and their default to not parse comments
|
||||
1.12:
|
||||
----
|
||||
* Exclude content having code highlighter or multilingual tags
|
||||
Do not use parsable Smarty Variables in combination with
|
||||
any other content having braces "{}"!
|
||||
* Extend Requirement to Smarty 3.1 and Serendipity 1.7+
|
||||
* Removed old code parts for backward compat (was erroneous)
|
||||
* Rename wrong $serendipity['PLUGINDATA'] to $serendipity['plugindata']
|
||||
|
||||
1.9
|
||||
latest: Smarty3 forward compatibility
|
||||
1.11:
|
||||
* More compatibility fixes fc19cfc
|
||||
|
||||
1.10:
|
||||
----
|
||||
* Added: configs comment warning and their default to not parse comments
|
||||
|
||||
1.9:
|
||||
---
|
||||
* Latest: Smarty3 forward compatibility
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
# lang_cs.inc.php 1.2 2012-02-02 20:46:40 VladaAjgl $
|
||||
|
||||
/**
|
||||
* @version 1.2
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
* @translated 2009/02/22
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
|
@ -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ě!');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáře jsou veřejně přístupný prostor, zacházejte s nimi opatrně!');
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
# lang_cz.inc.php 1.2 2012-02-02 20:46:38 VladaAjgl $
|
||||
|
||||
/**
|
||||
* @version 1.2
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
* @translated 2009/02/22
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
|
@ -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ě!');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáře jsou veřejně přístupný prostor, zacházejte s nimi opatrně!');
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Textformatierung: Smarty Parsing');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Parst Smarty-Anweisungen im Artikeltext. Dies ist nicht nutzbar in Kombination mit Syntax Code-Highlightern oder Multilingual tags in Textfeldern!');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Warnung: Kommentare sind öffentliche Eingaben. Benutze mit Vorsicht!');
|
||||
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Textformatierung: Smarty Parsing');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Parst Smarty-Anweisungen im Artikeltext');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Warnung: Kommentare sind öffentliche Eingaben. Benutzung nur mit Vorsicht!');
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
|
||||
<title>Dokumentace: Markup: Smarty</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dokumentace k pluginu 'Markup: Smarty'<br />
|
||||
<small>(serendipity_event_smartymarkup)</small></h1>
|
||||
<p>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 <a href="ChangeLog">aktuální anglický ChangeLog</a>.
|
||||
</p>
|
||||
|
||||
<h2>Popis pluginu</h2>
|
||||
<p>
|
||||
Zpracovává instrukce šablonového systému Smarty napsané v těle příspěvku.
|
||||
</p>
|
||||
|
||||
<h2>Historie verzí (ChangeLog)</h2>
|
||||
<ul>
|
||||
<li>verze 1.10</li>
|
||||
<ul>
|
||||
<li>přidáno: varování v nastavení komentářů (jestli se mají parsovat na přítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"</li>
|
||||
</ul>
|
||||
<li>verze 1.9</li>
|
||||
<ul>
|
||||
<li>dopředná kompatibilita se Smarty3</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</body>
|
||||
<!doctype html>
|
||||
<html dir="ltr" lang="cs">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
|
||||
<title>Dokumentace: Markup: Smarty</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dokumentace k pluginu 'Markup: Smarty'<br />
|
||||
<small>(serendipity_event_smartymarkup)</small></h1>
|
||||
<p>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 <a href="ChangeLog">aktuální anglický ChangeLog</a>.</p>
|
||||
|
||||
<h2>Popis pluginu</h2>
|
||||
<p>Zpracovává instrukce šablonového systému Smarty napsané v těle příspěvku.</p>
|
||||
|
||||
<h2>Historie verzí (ChangeLog)</h2>
|
||||
<ul>
|
||||
<li>verze 1.10</li>
|
||||
<ul>
|
||||
<li>přidáno: varování v nastavení komentářů (jestli se mají parsovat na přítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"</li>
|
||||
</ul>
|
||||
<li>verze 1.9</li>
|
||||
<ul>
|
||||
<li>dopředná kompatibilita se Smarty3</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
|
||||
<title>Dokumentace: Markup: Smarty</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dokumentace k pluginu 'Markup: Smarty'<br />
|
||||
<small>(serendipity_event_smartymarkup)</small></h1>
|
||||
<p>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 <a href="ChangeLog">aktuální anglický ChangeLog</a>.
|
||||
</p>
|
||||
|
||||
<h2>Popis pluginu</h2>
|
||||
<p>
|
||||
Zpracovává instrukce šablonového systému Smarty napsané v těle příspěvku.
|
||||
</p>
|
||||
|
||||
<h2>Historie verzí (ChangeLog)</h2>
|
||||
<ul>
|
||||
<li>verze 1.10</li>
|
||||
<ul>
|
||||
<li>přidáno: varování v nastavení komentářů (jestli se mají parsovat na přítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"</li>
|
||||
</ul>
|
||||
<li>verze 1.9</li>
|
||||
<ul>
|
||||
<li>dopředná kompatibilita se Smarty3</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</body>
|
||||
<!doctype html>
|
||||
<html dir="ltr" lang="cz">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
|
||||
<title>Dokumentace: Markup: Smarty</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dokumentace k pluginu 'Markup: Smarty'<br />
|
||||
<small>(serendipity_event_smartymarkup)</small></h1>
|
||||
<p>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 <a href="ChangeLog">aktuální anglický ChangeLog</a>.</p>
|
||||
|
||||
<h2>Popis pluginu</h2>
|
||||
<p>Zpracovává instrukce šablonového systému Smarty napsané v těle příspěvku.</p>
|
||||
|
||||
<h2>Historie verzí (ChangeLog)</h2>
|
||||
<ul>
|
||||
<li>verze 1.10</li>
|
||||
<ul>
|
||||
<li>přidáno: varování v nastavení komentářů (jestli se mají parsovat na přítomnost smarty-markupu) a jejich výchozí nastavení na "neparsovat"</li>
|
||||
</ul>
|
||||
<li>verze 1.9</li>
|
||||
<ul>
|
||||
<li>dopředná kompatibilita se Smarty3</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
# lang_cs.inc.php 1.2 2012-02-02 20:46:40 VladaAjgl $
|
||||
|
||||
/**
|
||||
* @version 1.2
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
* @translated 2009/02/22
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
|
@ -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ì!');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáøe jsou veøejnì pøístupný prostor, zacházejte s nimi opatrnì!');
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
# lang_cz.inc.php 1.2 2012-02-02 20:46:38 VladaAjgl $
|
||||
|
||||
/**
|
||||
* @version 1.2
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
* @translated 2009/02/22
|
||||
* @author Vladimír Ajgl <vlada@ajgl.cz>
|
||||
|
@ -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ì!');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Varování: komentáøe jsou veøejnì pøístupný prostor, zacházejte s nimi opatrnì!');
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Textformatierung: Smarty Parsing');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Parst Smarty-Anweisungen im Artikeltext. Dies ist nicht nutzbar in Kombination mit Syntax Code-Highlightern oder Multilingual tags in Textfeldern!');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Warnung: Kommentare sind öffentliche Eingaben. Benutze mit Vorsicht!');
|
||||
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_NAME', 'Textformatierung: Smarty Parsing');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_DESC', 'Parst Smarty-Anweisungen im Artikeltext');
|
||||
@define('PLUGIN_EVENT_SMARTYMARKUP_WARN', ' - Warnung: Kommentare sind öffentliche Eingaben. Benutzung nur mit Vorsicht!');
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @version
|
||||
* @version $Revision$
|
||||
* @author Translator Name <yourmail@example.com>
|
||||
* 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!');
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,37 +1,11 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
}
|
||||
|
||||
// Probe for a language include with constants. Still include defines later on, if some constants were missing
|
||||
$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
|
||||
if (file_exists($probelang)) {
|
||||
include $probelang;
|
||||
}
|
||||
|
||||
include_once dirname(__FILE__) . '/lang_en.inc.php';
|
||||
|
||||
function smarty_resource_smartymarkupplugin_template($tpl_name, &$tpl_source, &$smarty) {
|
||||
global $serendipity;
|
||||
|
||||
$tpl_source = $serendipity['PLUGINDATA']['smartymarkupplugin'];
|
||||
return true;
|
||||
}
|
||||
|
||||
function smarty_resource_smartymarkupplugin_timestamp($tpl_name, &$tpl_timestamp, &$smarty) {
|
||||
global $serendipity;
|
||||
|
||||
$tpl_timestamp = crc32($serendipity['PLUGINDATA']['smartymarkupplugin']);
|
||||
return true;
|
||||
}
|
||||
|
||||
function smarty_resource_smartymarkupplugin_secure($tpl_name, &$smarty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function smarty_resource_smartymarkupplugin_trusted($tpl_name, &$smarty) {
|
||||
}
|
||||
// Load possible language files.
|
||||
@serendipity_plugin_api::load_language(dirname(__FILE__));
|
||||
|
||||
class serendipity_event_smartymarkup extends serendipity_event
|
||||
{
|
||||
|
@ -45,15 +19,15 @@ class serendipity_event_smartymarkup extends serendipity_event
|
|||
$propbag->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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue