smarty syntax change
This commit is contained in:
parent
3f60fa9b21
commit
5ab53029ea
|
@ -1,5 +1,23 @@
|
|||
Version 1.4:
|
||||
* Not stripping comment html tags in code, so the template can decide, how to display comments
|
||||
* Stripping tags before truncating comment in template, else tags will be truncated.
|
||||
1.6:
|
||||
----
|
||||
|
||||
* Set plugin consistencies
|
||||
* Use load language API - extends required Serendipity version to v.1.6
|
||||
* Removed old Smarty2 security settings - extends required Serendipity version to v.1.7
|
||||
* Use native API method parseTemplate()
|
||||
* Convert plugin template for Smarty3 usage
|
||||
|
||||
|
||||
1.5:
|
||||
----
|
||||
|
||||
* Fixed a remaining old htmlspecialchars usage
|
||||
|
||||
|
||||
1.4:
|
||||
----
|
||||
|
||||
* Not stripping comment html tags in code, so the template can decide, how to display comments
|
||||
* Stripping tags before truncating comment in template, else tags will be truncated.
|
||||
|
||||
latest: Smarty3 forward compatibility
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @version
|
||||
* @version
|
||||
* @author Ivan Cenov <jwalker@hotmail.bg>
|
||||
* EN-Revision: 1.2
|
||||
*/
|
||||
|
@ -9,3 +9,4 @@
|
|||
@define('COMMENTSEARCH_TITLE', 'Търси в коментарите при бързо търсене');
|
||||
@define('COMMENTSEARCH_DESC', 'Ако тази приставка е инсталирана, бързото търсене ще се изпълнява и в коментарите');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Резултати от търсенето в коментарите');
|
||||
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
@define('COMMENTSEARCH_TITLE', 'Hledání v komentářích');
|
||||
@define('COMMENTSEARCH_DESC', 'Pokud je tento plugin nainstalovaný, rychlé vyhledávání bude prohledávat také komentáře');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentářích');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentářích');
|
||||
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
@define('COMMENTSEARCH_TITLE', 'Hledání v komentářích');
|
||||
@define('COMMENTSEARCH_DESC', 'Pokud je tento plugin nainstalovaný, rychlé vyhledávání bude prohledávat také komentáře');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentářích');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentářích');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php # lang_de.inc.php 1.0 2009-08-20 10:08:48 VladaAjgl $
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
|
@ -8,4 +8,5 @@
|
|||
|
||||
@define('COMMENTSEARCH_TITLE', 'Durchsuche Kommentare mit der Schnellsuche');
|
||||
@define('COMMENTSEARCH_DESC', 'Wenn dieses Plugin installiert ist, durchsucht die Schnellsuche Ihres Blogs auch die Kommentare.');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Such-Ergebnisse in Kommentaren');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Such-Ergebnisse in Kommentaren');
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
|
||||
<title>Dokumentace: Hledání v komentářích</title>
|
||||
<title>Dokumentace: Hledání v komentářích</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dokumentace k pluginu 'Hledání v komentáøích'<br />
|
||||
<small>(serendipity_event_commentsearch)</small></h1>
|
||||
<p>Dokumentaci k tomuto pluginu přeložil do češtiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) a naposledy zkontroloval dne 5.5.2013. 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>Dokumentaci k tomuto pluginu přeložil do češtiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) a naposledy zkontroloval dne 5.5.2013. 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>
|
||||
|
@ -24,6 +24,6 @@
|
|||
<ul>
|
||||
<li>dopøedná kompatibilita se smarty 3</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-2">
|
||||
<title>Dokumentace: Hledání v komentářích</title>
|
||||
<title>Dokumentace: Hledání v komentářích</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Dokumentace k pluginu 'Hledání v komentáøích'<br />
|
||||
<small>(serendipity_event_commentsearch)</small></h1>
|
||||
<p>Dokumentaci k tomuto pluginu přeložil do češtiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) a naposledy zkontroloval dne 5.5.2013. 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>Dokumentaci k tomuto pluginu přeložil do češtiny Vladimír Ajgl (vlada [zavinac] ajgl [tecka] cz) a naposledy zkontroloval dne 5.5.2013. 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>
|
||||
|
@ -24,6 +24,6 @@
|
|||
<ul>
|
||||
<li>dopøedná kompatibilita se smarty 3</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @version
|
||||
* @version
|
||||
* @author Ivan Cenov <jwalker@hotmail.bg>
|
||||
* EN-Revision: 1.2
|
||||
*/
|
||||
|
@ -9,3 +9,4 @@
|
|||
@define('COMMENTSEARCH_TITLE', 'Òúðñè â êîìåíòàðèòå ïðè áúðçî òúðñåíå');
|
||||
@define('COMMENTSEARCH_DESC', 'Àêî òàçè ïðèñòàâêà å èíñòàëèðàíà, áúðçîòî òúðñåíå ùå ñå èçïúëíÿâà è â êîìåíòàðèòå');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Ðåçóëòàòè îò òúðñåíåòî â êîìåíòàðèòå');
|
||||
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
@define('COMMENTSEARCH_TITLE', 'Hledání v komentáøích');
|
||||
@define('COMMENTSEARCH_DESC', 'Pokud je tento plugin nainstalovaný, rychlé vyhledávání bude prohledávat také komentáøe');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentáøích');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentáøích');
|
||||
|
||||
|
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
@define('COMMENTSEARCH_TITLE', 'Hledání v komentáøích');
|
||||
@define('COMMENTSEARCH_DESC', 'Pokud je tento plugin nainstalovaný, rychlé vyhledávání bude prohledávat také komentáøe');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentáøích');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Výsledky hledání v komentáøích');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php # lang_de.inc.php 1.0 2009-08-20 10:08:48 VladaAjgl $
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
|
@ -8,4 +8,5 @@
|
|||
|
||||
@define('COMMENTSEARCH_TITLE', 'Durchsuche Kommentare mit der Schnellsuche');
|
||||
@define('COMMENTSEARCH_DESC', 'Wenn dieses Plugin installiert ist, durchsucht die Schnellsuche Ihres Blogs auch die Kommentare.');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Such-Ergebnisse in Kommentaren');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Such-Ergebnisse in Kommentaren');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php #
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @version
|
||||
* @version
|
||||
* @author Translator Name <yourmail@example.com>
|
||||
* EN-Revision: Revision of lang_en.inc.php
|
||||
*/
|
||||
|
@ -9,3 +9,4 @@
|
|||
@define('COMMENTSEARCH_TITLE', 'Searches comments on quicksearch');
|
||||
@define('COMMENTSEARCH_DESC', 'If this plugin is installed, the quicksearch on your blog will also search through comments on your blog');
|
||||
@define('COMMENT_SEARCHRESULTS', 'Search results for comments');
|
||||
|
||||
|
|
|
@ -2,15 +2,16 @@
|
|||
<p class="comment_result_header">{$CONST.COMMENT_SEARCHRESULTS|sprintf:$comment_searchresults}</p>
|
||||
|
||||
<ul class="comment_result plainList">
|
||||
{foreach from=$comment_results item="result"}
|
||||
<li>{$result.ctimestamp|@formatTime:DATE_FORMAT_ENTRY}:
|
||||
{foreach $comment_results AS $result}
|
||||
<li>{$result.ctimestamp|formatTime:DATE_FORMAT_ENTRY}:
|
||||
{if $result.type == 'TRACKBACK'}
|
||||
<a href="{$result.url|@escape}">{$result.author|@escape}</a> - <a href="{$result.permalink|@escape}">{$result.title|@escape}</a>
|
||||
<a href="{$result.url|escape}">{$result.author|escape}</a> - <a href="{$result.permalink|escape}">{$result.title|escape}</a>
|
||||
{else}
|
||||
{$result.author|@escape} - <a href="{$result.permalink|@escape}">{$result.title|@escape}</a>
|
||||
{$result.author|escape} - <a href="{$result.permalink|escape}">{$result.title|escape}</a>
|
||||
{/if}
|
||||
<br />
|
||||
{$result.comment|@truncate:200:" ..."}</li>
|
||||
{$result.comment|truncate:200:" ..."}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
<!-- commentsearch searchresults origin template file -->
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
<?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 dirname(__FILE__) . '/lang_en.inc.php';
|
||||
@serendipity_plugin_api::load_language(dirname(__FILE__));
|
||||
|
||||
class serendipity_event_commentsearch extends serendipity_event
|
||||
{
|
||||
var $title = COMMENTSEARCH_TITLE;
|
||||
|
||||
function introspect(&$propbag)
|
||||
{
|
||||
global $serendipity;
|
||||
|
@ -23,22 +17,23 @@ class serendipity_event_commentsearch extends serendipity_event
|
|||
$propbag->add('name', COMMENTSEARCH_TITLE);
|
||||
$propbag->add('description', COMMENTSEARCH_DESC);
|
||||
$propbag->add('event_hooks', array(
|
||||
'entries_footer' => true,
|
||||
'frontend_fetchentries' => true
|
||||
'entries_footer' => true,
|
||||
'frontend_fetchentries' => true
|
||||
));
|
||||
|
||||
$propbag->add('author', 'Garvin Hicking');
|
||||
$propbag->add('version', '1.5');
|
||||
$propbag->add('version', '1.6');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '0.8',
|
||||
'smarty' => '2.6.7',
|
||||
'php' => '4.1.0'
|
||||
'serendipity' => '1.7',
|
||||
'smarty' => '3.1.0',
|
||||
'php' => '5.1.0'
|
||||
));
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('groups', array('FRONTEND_FEATURES'));
|
||||
$propbag->add('groups', array('FRONTEND_FEATURES'));
|
||||
}
|
||||
|
||||
function setupDB() {
|
||||
function setupDB()
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
$built = $this->get_config('db_built', null);
|
||||
|
@ -49,7 +44,8 @@ class serendipity_event_commentsearch extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
function showSearch() {
|
||||
function showSearch()
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
$this->setupDB();
|
||||
|
@ -59,12 +55,12 @@ class serendipity_event_commentsearch extends serendipity_event
|
|||
$group = '';
|
||||
$distinct = 'DISTINCT';
|
||||
$find_part = "(c.title ILIKE '%$term%' OR c.body ILIKE '%$term%')";
|
||||
} elseif ($serendipity['dbType'] == 'sqlite') {
|
||||
} elseif (stristr($serendipity['dbType'], 'sqlite') !== FALSE) {
|
||||
$group = 'GROUP BY id';
|
||||
$distinct = '';
|
||||
$term = serendipity_mb('strtolower', $term);
|
||||
$find_part = "(lower(c.title) LIKE '%$term%' OR lower(c.body) LIKE '%$term%')";
|
||||
} else {
|
||||
} else { // MYSQL
|
||||
$group = 'GROUP BY id';
|
||||
$distinct = '';
|
||||
$term = str_replace('"', '"', $term);
|
||||
|
@ -95,11 +91,11 @@ class serendipity_event_commentsearch extends serendipity_event
|
|||
$myAddData = array("from" => "serendipity_plugin_commentsearch:generate_content");
|
||||
foreach($results AS $idx => $result) {
|
||||
$results[$idx]['permalink'] = serendipity_archiveURL($result['id'], $result['title'], 'baseURL', true, $result);
|
||||
$results[$idx]['comment'] = $result['body'];//(function_exists('serendipity_specialchars') ? serendipity_specialchars(strip_tags($result['body'])) : htmlspecialchars(strip_tags($result['body']), ENT_COMPAT, LANG_CHARSET));
|
||||
$results[$idx]['comment'] = $result['body']; // escape it in the template (function_exists('serendipity_specialchars') ? serendipity_specialchars(strip_tags($result['body'])) : htmlspecialchars(strip_tags($result['body']), ENT_COMPAT, LANG_CHARSET));
|
||||
serendipity_plugin_api::hook_event('frontend_display', $results[$idx], $myAddData);
|
||||
// let the template decide, if we want to have tags or not
|
||||
$results[$idx]['commenthtml'] = $results[$idx]['comment'];
|
||||
$results[$idx]['comment'] = strip_tags($results[$idx]['comment']);
|
||||
$results[$idx]['comment'] = strip_tags($results[$idx]['comment']);
|
||||
}
|
||||
|
||||
$serendipity['smarty']->assign(
|
||||
|
@ -110,18 +106,12 @@ class serendipity_event_commentsearch extends serendipity_event
|
|||
);
|
||||
|
||||
$filename = 'plugin_commentsearch_searchresults.tpl';
|
||||
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
|
||||
if (!$tfile) {
|
||||
$tfile = dirname(__FILE__) . '/' . $filename;
|
||||
}
|
||||
$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;
|
||||
$content = $this->parseTemplate($filename);
|
||||
echo $content;
|
||||
}
|
||||
|
||||
function event_hook($event, &$bag, &$eventData, $addData = null) {
|
||||
function event_hook($event, &$bag, &$eventData, $addData = null)
|
||||
{
|
||||
global $serendipity;
|
||||
|
||||
$hooks = &$bag->get('event_hooks');
|
||||
|
@ -147,5 +137,8 @@ class serendipity_event_commentsearch extends serendipity_event
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
?>
|
Loading…
Reference in a new issue