1
0

Also support "last X" REST interface

This commit is contained in:
Garvin Hicking
2006-08-02 10:07:34 +00:00
commit 80e14346a5
1775 changed files with 195589 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?php # $Id$
/**
* @version $Revision$
* @author Ivan Cenov jwalker@abv.bg
* EN-Revision: 690
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Живо (активно) търсене');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Подобрява вътрешната функция за търсене като добавя обновяване на резултатите след всяко въвеждане на символи в стринга за търсене (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Изчакайте, заявката се изпраща...');
?>

View File

@@ -0,0 +1,5 @@
<?php # $Id: serendipity_event_livesearch.php 235 2005-07-08 13:29:39Z garvinhicking $
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'LiveSearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Erweitert die Suchfunktion mit einer Live-aktualisierung (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Suche aktiviert, bitte warten...');

View File

@@ -0,0 +1,12 @@
<?php # $Id: lang_es.inc.php,v 1.0 2005/08/20 11:37:42 garvinhicking Exp $
/**
* @version $Revision: 690 $
* @author Rodrigo Lazo Paz <rlazo.paz@gmail.com>
* EN-Revision: 690
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Mejora el funcionamiento interno de la búsqueda al añadir actualizaciones en tiempo real al presionar las teclas (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Espere, enviando pedido...');
?>

View File

@@ -0,0 +1,21 @@
<?php # $Id: lang_ja.inc.php,v 1.4 2005/05/17 11:37:42 garvinhicking Exp $
##########################################################################
# serendipity - another blogger... #
##########################################################################
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
# Translated by #
# Sebastian Mordziol <argh@php-tools.net> #
# http://sebastian.mordziol.de #
# #
##########################################################################
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Recherche active');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Améliore la fonction de recherche par des mises à jour a chaque pression de touche du clavier (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Patientez, envoi de la requête...');
/* vim: set sts=4 ts=4 expandtab : */
?>

View File

@@ -0,0 +1,13 @@
<?php # $Id$
/**
* @version $Revision$
* @author Tadashi Jokagi <elf2000@users.sourceforge.net>
* EN-Revision: 690
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'ライブサーチ');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '(JavaScript 経由で)キー入力中のライブアップデートを追加することにより、内部検索機能を強化します。');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'リクエストを送信中です。お待ちください...');
?>

View File

@@ -0,0 +1,9 @@
<?php # $Id: lang_ko.inc.php,v 1.0 2005/06/29 13:41:13 garvinhicking Exp $
# Translated by: Wesley Hwang-Chung <wesley96@gmail.com>
# (c) 2005 http://www.tool-box.info/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '실시간 검색');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '기본 검색 기능을 향상시켜 글자를 입력할 때마다 실시간으로 검색결과를 갱신함 (자바스트립트 사용)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '요청을 보냈습니다. 기다려주십시오...');
?>

View File

@@ -0,0 +1,11 @@
<?php # $Id: lang_en.inc.php 690 2005-11-13 04:49:04Z elf2000 $
/**
* @version $Revision: 690 $
* @author Wilco Wietsma <demo@demo.webxtra.nl>
* NL-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livezoeken');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Veranderd de zoekfunctie door te zoeken zodra er getypt word (Javascript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Wacht AUB, bezig met verzenden....');

View File

@@ -0,0 +1,13 @@
<?php # $Id: lang_en.inc.php 690 2005-11-13 04:49:04Z elf2000 $
/**
* @version $Revision: 690 $
* @author Kostas CoSTa Brzezinski <costa@kofeina.net>
* EN-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Rozszerza wbudowaną funkcję wyszukiwania przez dodanie zmieniającego się w czasie rzeczywistym okna wyboru, którego treść jest dopasowywana po każdym naciśnięciu klawisza (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Poczekaj, wysyłam zapytanie...');
?>

View File

@@ -0,0 +1,11 @@
<?php # $Id:$
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
# Translation (c) by João P Matos <jmatos@math.ist.utl.pt>
/* vim: set sts=4 ts=4 expandtab : */
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Melhora o funcionamento interno da busca ao juntar actualizações em tempo real ao pressionar as teclas (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Espere, enviando pedido...');
?>

View File

@@ -0,0 +1,18 @@
<?php # $Id: $
##########################################################################
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity #
# Developer Team) All rights reserved. See LICENSE file for licensing #
# details #
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
# Translated by #
# (c) 2004-2005 CapriSkye <admin@capriskye.com> #
# http://open.38.com #
##########################################################################
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '即時搜尋');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '提高搜尋的功能,輸入的搜尋字可快速顯示。');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '稍待,傳送資料...');
?>

View File

@@ -0,0 +1,18 @@
<?php # $Id: $
##########################################################################
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity #
# Developer Team) All rights reserved. See LICENSE file for licensing #
# details #
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
# Translated by #
# (c) 2006 Aphonex Li <aphonex.li@gmail.com> #
# http://www.exten.cn #
##########################################################################
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '即时搜索');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '提高搜索功能,输入的搜索字符可快速显示。');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '稍等,传送资料...');
?>

View File

@@ -0,0 +1,13 @@
<?php # $Id$
/**
* @version $Revision$
* @author Ivan Cenov jwalker@abv.bg
* EN-Revision: 690
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '<27><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...');
?>

View File

@@ -0,0 +1,5 @@
<?php # $Id: serendipity_event_livesearch.php 235 2005-07-08 13:29:39Z garvinhicking $
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'LiveSearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Erweitert die Suchfunktion mit einer Live-aktualisierung (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Suche aktiviert, bitte warten...');

View File

@@ -0,0 +1,13 @@
<?php # $Id$
/**
* @version $Revision$
* @author Translator Name <yourmail@example.com>
* EN-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Enhances the internal search function by adding live-updates on keypress (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Wait, sending request...');
?>

View File

@@ -0,0 +1,12 @@
<?php # $Id: lang_es.inc.php,v 1.0 2005/08/20 11:37:42 garvinhicking Exp $
/**
* @version $Revision: 690 $
* @author Rodrigo Lazo Paz <rlazo.paz@gmail.com>
* EN-Revision: 690
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Mejora el funcionamiento interno de la b<>squeda al a<>adir actualizaciones en tiempo real al presionar las teclas (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Espere, enviando pedido...');
?>

View File

@@ -0,0 +1,21 @@
<?php # $Id: lang_ja.inc.php,v 1.4 2005/05/17 11:37:42 garvinhicking Exp $
##########################################################################
# serendipity - another blogger... #
##########################################################################
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
# Translated by #
# Sebastian Mordziol <argh@php-tools.net> #
# http://sebastian.mordziol.de #
# #
##########################################################################
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Recherche active');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Am<41>liore la fonction de recherche par des mises <20> jour a chaque pression de touche du clavier (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Patientez, envoi de la requ<71>te...');
/* vim: set sts=4 ts=4 expandtab : */
?>

View File

@@ -0,0 +1,13 @@
<?php # $Id$
/**
* @version $Revision$
* @author Tadashi Jokagi <elf2000@users.sourceforge.net>
* EN-Revision: 690
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'ライブサーチ');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '(JavaScript 経由で)キー入力中のライブアップデートを追加することにより、内部検索機能を強化します。');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'リクエストを送信中です。お待ちください...');
?>

View File

@@ -0,0 +1,9 @@
<?php # $Id: lang_ko.inc.php,v 1.0 2005/06/29 13:41:13 garvinhicking Exp $
# Translated by: Wesley Hwang-Chung <wesley96@gmail.com>
# (c) 2005 http://www.tool-box.info/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '실시간 검색');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '기본 검색 기능을 향상시켜 글자를 입력할 때마다 실시간으로 검색결과를 갱신함 (자바스트립트 사용)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '요청을 보냈습니다. 기다려주십시오...');
?>

View File

@@ -0,0 +1,11 @@
<?php # $Id: lang_en.inc.php 690 2005-11-13 04:49:04Z elf2000 $
/**
* @version $Revision: 690 $
* @author Wilco Wietsma <demo@demo.webxtra.nl>
* NL-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livezoeken');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Veranderd de zoekfunctie door te zoeken zodra er getypt word (Javascript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Wacht AUB, bezig met verzenden....');

View File

@@ -0,0 +1,13 @@
<?php # $Id: lang_en.inc.php 690 2005-11-13 04:49:04Z elf2000 $
/**
* @version $Revision: 690 $
* @author Kostas CoSTa Brzezinski <costa@kofeina.net>
* EN-Revision: Revision of lang_en.inc.php
*/
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Rozszerza wbudowan<61> funkcj<63> wyszukiwania przez dodanie zmieniaj<61>cego si<73> w czasie rzeczywistym okna wyboru, kt<6B>rego tre<72><65> jest dopasowywana po ka<6B>dym naci<63>ni<6E>ciu klawisza (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Poczekaj, wysy<73>am zapytanie...');
?>

View File

@@ -0,0 +1,11 @@
<?php # $Id:$
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
# Translation (c) by Jo<4A>o P Matos <jmatos@math.ist.utl.pt>
/* vim: set sts=4 ts=4 expandtab : */
@define('PLUGIN_EVENT_LIVESEARCH_NAME', 'Livesearch');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', 'Melhora o funcionamento interno da busca ao juntar actualiza<7A><61>es em tempo real ao pressionar as teclas (JavaScript)');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', 'Espere, enviando pedido...');
?>

View File

@@ -0,0 +1,18 @@
<?php # $Id: $
##########################################################################
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity #
# Developer Team) All rights reserved. See LICENSE file for licensing #
# details #
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
# Translated by #
# (c) 2004-2005 CapriSkye <admin@capriskye.com> #
# http://open.38.com #
##########################################################################
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '即時搜尋');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '提高搜尋的功能,輸入的搜尋字可快速顯示。');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '稍待,傳送資料...');
?>

View File

@@ -0,0 +1,18 @@
<?php # $Id: $
##########################################################################
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity #
# Developer Team) All rights reserved. See LICENSE file for licensing #
# details #
# #
# (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html #
# #
# Translated by #
# (c) 2006 Aphonex Li <aphonex.li@gmail.com> #
# http://www.exten.cn #
##########################################################################
@define('PLUGIN_EVENT_LIVESEARCH_NAME', '<27><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>');
@define('PLUGIN_EVENT_LIVESEARCH_DESC', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>');
@define('PLUGIN_EVENT_LIVESEARCH_WAIT', '<27>Եȣ<D4B5><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...');
?>

View File

@@ -0,0 +1,157 @@
/*
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Bitflux GmbH |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the "License"); |
// | you may not use this file except in compliance with the License. |
// | You may obtain a copy of the License at |
// | http://www.apache.org/licenses/LICENSE-2.0 |
// | Unless required by applicable law or agreed to in writing, software |
// | distributed under the License is distributed on an "AS IS" BASIS, |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
// | implied. See the License for the specific language governing |
// | permissions and limitations under the License. |
// +----------------------------------------------------------------------+
// | Author: Bitflux GmbH <devel@bitflux.ch> |
// +----------------------------------------------------------------------+
*/
var liveSearchReq = false;
var t = null;
var liveSearchLast = "";
var isIE = false;
// on !IE we only have to initialize it once
if (window.XMLHttpRequest) {
liveSearchReq = new XMLHttpRequest();
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
function liveSearchInit() {
if (navigator.userAgent.indexOf("Safari") > 0) {
document.getElementById('serendipityQuickSearchTermField').addEventListener("keydown", liveSearchKeyPress,false);
document.getElementById('searchform').addEventListener("submit", liveSearchSubmit,false);
} else if (navigator.product == "Gecko") {
document.getElementById('serendipityQuickSearchTermField').addEventListener("keypress", liveSearchKeyPress,false);
document.getElementById('searchform').addEventListener("submit", liveSearchSubmit,false);
} else {
document.getElementById('serendipityQuickSearchTermField').attachEvent("onkeydown", liveSearchKeyPress);
document.getElementById('searchform').attachEvent("onsubmit", liveSearchSubmit);
isIE = true;
}
if (document.getElementById('searchform').setAttribute) {
document.getElementById('searchform').setAttribute('autocomplete','off');
document.getElementById('serendipityQuickSearchTermField').setAttribute('autocomplete','off');
}
document.getElementById('serendipityQuickSearchTermField').style.border = '1px solid green';
}
function liveSearchKeyPress(event) {
if (event.keyCode == 40 ) { //KEY DOWN
highlight = document.getElementById("LSHighlight");
if (!highlight) {
highlight = document.getElementById("LSResult").firstChild.firstChild.firstChild;
} else {
highlight.removeAttribute("id");
highlight = highlight.nextSibling;
}
if (highlight) {
highlight.setAttribute("id","LSHighlight");
}
if (!isIE) { event.preventDefault(); }
}
//KEY UP
else if (event.keyCode == 38 ) {
highlight = document.getElementById("LSHighlight");
if (!highlight) {
highlight = document.getElementById("LSResult").firstChild.firstChild.lastChild;
}
else {
highlight.removeAttribute("id");
highlight = highlight.previousSibling;
}
if (highlight) {
highlight.setAttribute("id","LSHighlight");
}
if (!isIE) { event.preventDefault(); }
}
//ESC
else if (event.keyCode == 27) {
highlight = document.getElementById("LSHighlight");
if (highlight) {
highlight.removeAttribute("id");
}
document.getElementById("LSResult").style.display = "none";
} else {
liveSearchStart();
}
}
function liveSearchStart() {
if (t) {
window.clearTimeout(t);
}
t = window.setTimeout("liveSearchDoSearch()",200);
}
function liveSearchDoSearch() {
v = document.getElementById('serendipityQuickSearchTermField').value;
if (liveSearchLast != v && v.length > 3) {
if (liveSearchReq && liveSearchReq.readyState < 4) {
liveSearchReq.abort();
}
if (v == "") {
document.getElementById("LSResult").style.display = "none";
highlight = document.getElementById("LSHighlight");
if (highlight) {
highlight.removeAttribute("id");
}
return false;
}
if (window.XMLHttpRequest) {
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
}
document.getElementById('LSResult').style.display = "block";
document.getElementById('LSResult').firstChild.innerHTML = '<div class="serendipity_livesearch_result">' + waittext + '</div>';
liveSearchReq.onreadystatechange= liveSearchProcessReqChange;
liveSearchReq.open("GET", lsbase + "s=" + v);
liveSearchLast = v;
liveSearchReq.send(null);
}
}
function liveSearchProcessReqChange() {
if (liveSearchReq.readyState == 4) {
var res = document.getElementById("LSResult");
res.style.display = "block";
res.firstChild.innerHTML = liveSearchReq.responseText;
}
}
function liveSearchSubmit() {
var highlight = document.getElementById("LSHighlight");
if (highlight && highlight.firstChild) {
document.getElementById('searchform').action = highlight.firstChild.getAttribute("href");
return false;
} else {
return true;
}
}

View File

@@ -0,0 +1,166 @@
<?php # $Id$
// 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';
class serendipity_event_livesearch extends serendipity_event
{
var $title = PLUGIN_EVENT_LIVESEARCH_NAME;
function introspect(&$propbag)
{
global $serendipity;
$propbag->add('name', PLUGIN_EVENT_LIVESEARCH_NAME);
$propbag->add('description', PLUGIN_EVENT_LIVESEARCH_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Christian Stocker, Garvin Hicking');
$propbag->add('version', '1.3');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('event_hooks', array(
'external_plugin' => true,
'frontend_header' => true,
'css' => true,
'quicksearch_plugin' => true
));
$propbag->add('groups', array('FRONTEND_ENTRY_RELATED'));
}
function generate_content(&$title) {
$title = $this->title;
}
function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
case 'css':
if (strpos($eventData, '.serendipity_livesearch_row')) {
// class exists in CSS, so a user has customized it and we don't need default
return true;
}
?>
#LSResult {
position: absolute;
margin-left: 4px;
margin-top: 4px;
}
#LSShadow {
position: relative;
bottom: 1px;
right: 1px;
color: inherit;
border-right: 2px solid #ccc;
border-bottom: 2px solid #ccc;
}
#LSHighlight {
background-color: #80FF80;
color: black;
}
.serendipity_livesearch_row {
margin: 0px;
line-height: 1.2em;
padding-top: 0.2em;
padding-bottom: 0.2em;
text-indent: -1em;
padding-left: 1em;
line-height: 1.2em;
padding-right: 1em;
}
.serendipity_livesearch_result {
position: relative;
bottom: 2px;
right: 2px;
border: 1px solid black;
padding: 2px;
}
<?php
break;
case 'frontend_header':
if (!$serendipity['embed'] || $serendipity['embed'] === 'false' || $serendipity['embed'] === false) {
echo '<script type="text/javascript" src="' . $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/ls-js"></script>';
}
break;
case 'quicksearch_plugin':
echo '<script type="text/javascript">
lsbase = "' . $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/ls' . ($serendipity['rewrite'] == 'none' ? '_&' : '?') . '";
waittext = "' . PLUGIN_EVENT_LIVESEARCH_WAIT . '";
addLoadEvent(liveSearchInit);
</script>';
break;
case 'external_plugin':
$uri_parts = explode('?', str_replace('&amp;', '&', $eventData));
// Try to get request parameters from eventData name
if (!empty($uri_parts[1])) {
$reqs = explode('&', $uri_parts[1]);
foreach($reqs AS $id => $req) {
$val = explode('=', $req);
if (empty($_REQUEST[$val[0]])) {
$_REQUEST[$val[0]] = $val[1];
}
}
}
$parts = explode('_', $uri_parts[0]);
switch($parts[0]) {
case 'ls-js':
header('Content-Type: text/javascript');
echo file_get_contents(S9Y_INCLUDE_PATH . 'plugins/serendipity_event_livesearch/serendipity_event_livesearch.js');
break;
case 'ls':
// header('X-Search: ' . htmlspecialchars($eventData) . ' leads to ' . preg_replace('@[^a-z0-9 \.\-_]@i', '', $_REQUEST['s']));
$res = serendipity_searchEntries($_REQUEST['s']);
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo '<div class="serendipity_livesearch_result">';
if (is_array($res) && count($res) > 0) {
foreach($res AS $id => $entry) {
echo '<div class="serendipity_livesearch_row"><a href="' . serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])) . '">' . htmlspecialchars($entry['title']) . '</a></div>';
}
} else {
echo '<div class="serendipity_livesearch_row">' . print_r($res, true) . '</div>';
}
echo '</div>';
break;
}
return true;
break;
default:
return false;
break;
}
} else {
return false;
}
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>