Most recent edit on 2008-06-27 16:05:26 by DomBonj [v0.93: optimization; 1.1.6.5 compatibility]
Additions:
# @version 0.93
$display_title = isset($vars['opts']) && preg_match('/t/i', $vars['opts']);
$display_owner = isset($vars['opts']) && preg_match('/o/i', $vars['opts']);
if ($display_title)
$title = ;
$pagecontent = $page['body'];
$formatting_tags = array('
', '', '', '', '""', '', '', '
', '\'\);
$title = str_replace($formatting_tags, , $title[2]);
if ($display_owner)
Deletions:
- Wikka 1.1.6.2 & 1.1.6.3 & 1.1.6.4
# @version 0.92
if (isset($vars['opts']) && (preg_match('/t/i', $vars['opts'])))
$title = ;
$pagecontent = $page["body"];
$formatting_tags = array("**", "//", "__", "##", "''", "++", "#%", "@@", "\"\);
$title = str_replace($formatting_tags, "", $title[2]);
if (isset($vars['opts']) && (preg_match('/o/i', $vars['opts'])))
Edited on 2008-03-28 18:24:43 by DomBonj [v0.92: bugfix; 1.1.6.4 compatibility]
No differences.
Edited on 2008-03-28 18:22:31 by DomBonj [v0.92: bugfix]
Additions:
- Wikka 1.1.6.2 & 1.1.6.3 & 1.1.6.4
# @version 0.92
if (!defined('RI_PAGE_OWNER')) define('RI_PAGE_OWNER', ' . . . . Owner: %s');
if (!defined('RI_ERROR_NO_PAGES_FOUND')) define('RI_ERROR_NO_PAGES_FOUND', 'No pages found.');
$query = 'SELECT body, tag, owner FROM '. $this->config['table_prefix'] .'pages WHERE ((latest = \'Y\') AND (CAST(tag AS BINARY) REGEXP \
. mysql_real_escape_string($vars['re']) .'\')'. $wherecat .') ORDER BY '. $orderby;
if (ereg( "(=){3,5}([^=\n]+)(=){3,5}", $pagecontent, $title))
Deletions:
# @version 0.91
if (!defined('RI_PAGE_OWNER')) define('RI_PAGE_OWNER', " . . . . Owner: %s");
if (!defined('RI_ERROR_NO_PAGES_FOUND')) define('RI_ERROR_NO_PAGES_FOUND', "No pages found.");
$query = 'SELECT body, tag, owner FROM '. $this->config['table_prefix'] .'pages WHERE ((latest = \'Y\') AND (tag REGEXP \
. mysql_real_escape_string($vars['re']) .'\')'. $wherecat .') ORDER BY '. $orderby;
if (ereg( "(=){3,5}([^=\n]+)(=){3,5}", $pagecontent, $title)) {
Edited on 2008-01-28 00:15:25 by DomBonj [Modified links pointing to docs server]
No differences.
Edited on 2007-09-29 16:20:17 by DomBonj [v0.91: bugfix; slight layout change]
Additions:
# Displays a list of pages whose tag matches a regular expression
# @version 0.91
if (!defined('RI_PAGE_OWNER')) define('RI_PAGE_OWNER', " . . . . Owner: %s");
if (!defined('RI_NO_TITLE')) define('RI_NO_TITLE', );
|| ( isset($vars['re']) && (preg_match("/^\s*$/i", $vars['re'])) )
|| ( isset($vars['cat']) && (preg_match("/^\s*$/i", $vars['cat'])) )
$output .= ($title ? ': '. strip_tags($this->Format($title)) : '<i>'.RI_NO_TITLE.'</i>');
Deletions:
# Displays a list of pages whose tag matches a regular epxression
# @version 0.9
if (!defined('RI_PAGE_OWNER')) define('RI_PAGE_OWNER'," . . . . Owner: %s");
|| ( isset($vars['cat']) && (preg_match("/^\s+$/i", $vars['cat'])) )
$output .= ' - '. ($title ? strip_tags($this->Format($title)) : $page['tag']);
Oldest known version of this page was edited on 2007-09-26 16:38:29 by DomBonj [v0.90: first upload]
Page view:
Regexpindex Action
NOT included in any Wikka version
This is the development page for the Regexpindex action.
Installation
- Save the first code block below as actions/regexpindex.php
- Give it the same file permissions as the other php files in that directory
Code
actions/regexpindex.php
<?php
#
# Displays a list of pages whose tag matches a regular epxression
#
# @package Actions
# @name regexpindex
#
# @author DomBonj
#
# @version 0.9
#
# @input Parameters = re='myregexp' [cat='mycategory'] [sort=('tag'|'rtime'|'time')] [opts='[o][t]']
# default values: sort='tag'
# options: o=display page owner ; t=display page title
#
# @uses Wakka::Format()
# @uses Wakka::GetUserName()
# @uses Wakka::HasAccess()
# @uses Wakka::Link()
# @uses Wakka::LoadAll()
#
// i18n strings
if (!
defined('RI_PAGE_OWNER')) define('RI_PAGE_OWNER',
" . . . . Owner: %s");
if (!
defined('RI_ERROR_NO_PAGES_FOUND')) define('RI_ERROR_NO_PAGES_FOUND',
"No pages found.");
if (!
defined('RI_ERROR_REQUEST_FORMAT')) define ('RI_ERROR_REQUEST_FORMAT',
'Incorrect parameter; usage: %s');
if (!
defined('RI_ERROR_USAGE')) define ('RI_ERROR_USAGE',
"regexpindex re='myregexp' [cat='mycategory'] [sort='tag|time|rtime'] [opts='[o][t]']");
if (!
function_exists('RIerror'))
{
function RIerror
($msg)
{
return ('<em class="error">'.
$msg .
'</em><br />');
}
}
$output =
'';
if ( (isset($vars['opts']) &&
(!
preg_match("/^[ot]{1,2}$/i",
$vars['opts'])) )
||
( !
isset($vars['re']) )
||
( isset($vars['cat']) &&
(preg_match("/^\s+$/i",
$vars['cat'])) )
||
( isset($vars['sort']) &&
(!
preg_match("/^(time|tag|rtime)$/i",
$vars['sort'])) ) )
{
$output .= RIerror
(sprintf(RI_ERROR_REQUEST_FORMAT, RI_ERROR_USAGE
));
}
else
{
$cached_username =
$this->
GetUserName();
$orderby =
isset($vars['sort']) ?
(strtolower($vars['sort'])==
'rtime' ?
'time DESC' :
strtolower($vars['sort'])) :
'tag';
$wherecat =
isset($vars['cat']) ?
' AND (body REGEXP \''.
mysql_real_escape_string($vars['cat']) .
'\')' :
'';
$query =
'SELECT body, tag, owner FROM '.
$this->
config['table_prefix'] .
'pages WHERE ((latest = \'Y\') AND (tag REGEXP \''.
mysql_real_escape_string($vars['re']) .
'\')'.
$wherecat .
') ORDER BY '.
$orderby;
$pages =
$this->
LoadAll($query);
foreach ($pages as $page)
{
if ($this->
HasAccess('read',
$page['tag']))
{
$output .=
$this->
Link($page['tag']);
if (isset($vars['opts']) &&
(preg_match('/t/i',
$vars['opts'])))
{ // display page title; this code is taken from PageTitle() function in Wakka.class.php
$title =
"";
$pagecontent =
$page["body"];
if (ereg( "(=){3,5}([^=\n]+)(=){3,5}",
$pagecontent,
$title)) {
$formatting_tags =
array("**",
"//",
"__",
"##",
"''",
"++",
"#%",
"@@",
"\"\"");
$title =
str_replace($formatting_tags,
"",
$title[2]);
}
$output .=
' - '.
($title ?
strip_tags($this->
Format($title)) :
$page['tag']);
}
if (isset($vars['opts']) &&
(preg_match('/o/i',
$vars['opts'])))
{ // display page owner, or '*' if current user is the page owner
$page_owner =
$page['owner'];
if ($cached_username ==
$page_owner)
{
$output .=
'*';
}
elseif ($page_owner !=
'(Public)' &&
$page_owner !=
'')
{
$output .=
sprintf(RI_PAGE_OWNER,
$page_owner);
}
}
$output .=
"<br />\n";
}
}
}
echo ($output ?
$output : RI_ERROR_NO_PAGES_FOUND
);
?>
CategoryUserContributions