summaryrefslogtreecommitdiff
path: root/plugins/data.titlesearch.php
blob: 133d7a4b1db6c459d73ffbfdcc01e630604e6c36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
 * @version  $Revision: 1.7 $
 * @package  liberty
 * @subpackage plugins_data
 */
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
// |
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Claudio Bustos <cdx@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// | Reworked from: wikiplugin_titlesearch.php - see deprecated code below
// +----------------------------------------------------------------------+
// $Id: data.titlesearch.php,v 1.7 2006/08/07 22:14:58 squareing Exp $

/**
 * definitions
 */
define( 'PLUGIN_GUID_DATATITLESEARCH', 'datatitlesearch' );
global $gLibertySystem;
$pluginParams = array (
	'tag' => 'TITLESEARCH',
	'auto_activate' => FALSE,
	'requires_pair' => FALSE,
	'load_function' => 'data_titlesearch',
	'title' => 'TitleSearch - This plugin is not yet functional.', // Remove this line when the plugin becomes operational
//	'title' => 'TitleSearch',                                                                                         // and Remove the comment from the start of this line
	'help_page' => 'DataPluginTitleSearch',
	'description' => tra("This plugin search the titles of all pages in this wiki."),
	'help_function' => 'data_titlesearch_help',
	'syntax' => "{TITLESEARCH search= info= exclude= noheader= }",
	'path' => LIBERTY_PKG_PATH.'plugins/data.titlesearch.php',
	'security' => 'registered',
	'plugin_type' => DATA_PLUGIN
);
$gLibertySystem->registerPlugin( PLUGIN_GUID_DATATITLESEARCH, $pluginParams );
$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATATITLESEARCH );

// Help Function
function data_titlesearch_help() {
	$back = tra("^__Parameter Syntax:__ ") . "~np~{TITLESEARCH" . tra("(key=>value)}~/np~\n");
	$back.= tra("||__::key::__ | __::value::__ | __::Comments::__\n");
	$back.= "::search::" . tra(" | ::string:: | __Required__ - So what do you want to search for?\n");
	$back.= "::info::" . tra(" | ::value:: | defines which fields are to be displayed. Possible values are: ") . "__hits / lastModif / user / ip / len / comment / creator / version /  flag / versions / links / backlinks__" . tra(" Multiple values can be given using the character ~124~. Example: ") . "__user~124~len~124~comment__" . tra(". The default shows __None__ of this information.\n");
	$back.= "::exclude::" . tra(" | ::page names:: | pages to be excluded from the listing. Multiple names can be exclude using the character ~124~. Example: ") . "__HomePage~124~SandBox~124~~np~RecentChanges~/np~__." . tra(" By default - __Every__ page is displayed.\n");
	$back.= "::noheader::" . tra(" | ::boolean:: |  if True (any value = False) a header will be displayed. The default is __False__.||^");
	$back.= tra("^__Example:__ ") . "~np~{TITLESEARCH(search=>Admin,info=>user,exclude=>HomePage|SandBox,noheader=>1)}{TITLESEARCH}~/np~^";
	return $back;
}

// Load Function
function data_titlesearch($data, $params) {
	$ret = "This plugin has not been completed as yet. ";
	return $ret;
}
/******************************************************************************
The code below is from the deprecated TITLESEARCH plugin. All comments and the help routines have been removed. - StarRider
    require_once( WIKI_PKG_PATH.'plugins_lib.php' );
	include_once( WIKI_PKG_PATH.'BitPage.php');
        function run ($data, $params) {
            global $WikiLib;
            $aInfoPreset = array_keys($this->aInfoPresetNames);
            $params = $this->getParams($params, true);
            extract ($params, EXTR_SKIP);
            if (!$search) {
                return $this->error("You have to define a search");
            }
            //
            /////////////////////////////////
            // Create a valid list for $info
            /////////////////////////////////
            //
            if ($info) {
                $info_temp = array();
                foreach($info as $sInfo) {
                    if (in_array(trim($sInfo), $aInfoPreset)) {
                        $info_temp[] = trim($sInfo);
                    }
                    $info = $info_temp?$info_temp:
                    false;
                }
            } else {
                $info = false;
            }
            //
            /////////////////////////////////
            // Process pages
            /////////////////////////////////
            //
            $sOutput = "";
            $aPages = $wikilib->getList(0, -1, 'title_desc', $search);
            foreach($aPages["data"] as $idPage => $aPage) {
                if (in_array($aPage["title"], $exclude)) {
                    unset($aPages["data"][$idPage]);
                    $aPages["cant"]--;
                }
            }
            //
            /////////////////////////////////
            // Start of Output
            /////////////////////////////////
            //
            if (!$noheader) {
                // Create header
                $count = $aPages["cant"];
                if (!$count) {
                    $sOutput  .= tra("No pages found for title search")." '__".$search."__'";
                } elseif ($count == 1) {
                    $sOutput  .= tra("One page found for title search")." '__".$search."__'";
                } else {
                    $sOutput = "$count".tra(" pages found for title search")." '__".$search."__'";
                }
                $sOutput  .= "\n";
            }
            $sOutput.=PluginsLibUtil::createTable($aPages["data"],$info);
            return $sOutput;
        }
    }
*/
?>