本文整理汇总了PHP中HTML::tbody方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::tbody方法的具体用法?PHP HTML::tbody怎么用?PHP HTML::tbody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::tbody方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _arrayToTable
function _arrayToTable($array, &$request)
{
$thead = HTML::thead();
$label[0] = _("Wiki Name");
$label[1] = _("Search");
$thead->pushContent(HTML::tr(HTML::th($label[0]), HTML::th($label[1])));
$tbody = HTML::tbody();
$dbi = $request->getDbh();
if ($array) {
foreach ($array as $moniker => $interurl) {
$monikertd = HTML::td(array('class' => 'interwiki-moniker'), $dbi->isWikiPage($moniker) ? WikiLink($moniker) : $moniker);
$w = new WikiPluginLoader();
$p = $w->getPlugin('ExternalSearch');
$argstr = sprintf('url="%s"', addslashes($interurl));
$searchtd = HTML::td($p->run($dbi, $argstr, $request, $basepage));
$tbody->pushContent(HTML::tr($monikertd, $searchtd));
}
}
$table = HTML::table();
$table->setAttr('class', 'interwiki-map');
$table->pushContent($thead);
$table->pushContent($tbody);
return $table;
}
示例2: run
function run($dbi, $argstr, &$request, $basepage)
{
include_once "lib/BlockParser.php";
// MediawikiTablePlugin markup is new.
$markup = 2.0;
// We allow the compact Mediawiki syntax with:
// - multiple cells on the same line (separated by "||"),
// - multiple header cells on the same line (separated by "!!").
$argstr = str_replace("||", "\n| ", $argstr);
$argstr = str_replace("!!", "\n! ", $argstr);
$lines = preg_split('/\\n/', $argstr);
$table = HTML::table();
// We always generate an Id for the table.
// This is convenient for tables of class "sortable".
// If user provides an Id, the generated Id will be overwritten below.
$table->setAttr("id", GenerateId("MediawikiTable"));
if (substr($lines[0], 0, 2) == "{|") {
// Start of table
$lines[0] = substr($lines[0], 2);
}
if ($lines[0][0] != '|' and $lines[0][0] != '!') {
$line = array_shift($lines);
$attrs = parse_attributes($line);
foreach ($attrs as $key => $value) {
if (in_array($key, array("id", "class", "title", "style", "bgcolor", "frame", "rules", "border", "cellspacing", "cellpadding", "summary", "align", "width"))) {
$table->setAttr($key, $value);
}
}
}
if (count($lines) == 1) {
// empty table, we only have closing "|}" line
return HTML::raw('');
}
foreach ($lines as $line) {
if (substr($line, 0, 2) == "|}") {
// End of table
continue;
}
if (substr($line, 0, 2) == "|-") {
if (isset($row)) {
if (isset($cell)) {
if (isset($content)) {
if (is_numeric(trim($content))) {
$cell->pushContent(HTML::p(array('style' => "text-align:right"), trim($content)));
} else {
$cell->pushContent(TransformText(trim($content), $markup, $basepage));
}
unset($content);
}
$row->pushContent($cell);
unset($cell);
}
if (isset($thead)) {
$thead->pushContent($row);
$table->pushContent($thead);
unset($thead);
$tbody = HTML::tbody();
} else {
$tbody->pushContent($row);
}
}
$row = HTML::tr();
$attrs = parse_attributes(substr($line, 2));
foreach ($attrs as $key => $value) {
if (in_array($key, array("id", "class", "title", "style", "bgcolor", "align", "valign"))) {
$row->setAttr($key, $value);
}
}
continue;
}
// Table summary
if (substr($line, 0, 2) == "|=") {
$line = substr($line, 2);
$table->setAttr("summary", trim($line));
}
// Table caption
if (substr($line, 0, 2) == "|+") {
$caption = HTML::caption();
$line = substr($line, 2);
$pospipe = strpos($line, "|");
$posbracket = strpos($line, "[");
if ($pospipe !== false && ($posbracket === false || $posbracket > $pospipe)) {
$attrs = parse_attributes(substr($line, 0, $pospipe));
foreach ($attrs as $key => $value) {
if (in_array($key, array("id", "class", "title", "style", "align", "lang"))) {
$caption->setAttr($key, $value);
}
}
$line = substr($line, $pospipe + 1);
}
$caption->pushContent(trim($line));
$table->pushContent($caption);
}
if ((substr($line, 0, 1) == "|" or substr($line, 0, 1) == "!") and isset($row)) {
if (isset($cell)) {
if (isset($content)) {
if (is_numeric(trim($content))) {
$cell->pushContent(HTML::p(array('style' => "text-align:right"), trim($content)));
} else {
$cell->pushContent(TransformText(trim($content), $markup, $basepage));
//.........这里部分代码省略.........
示例3: _formatMap
function _formatMap($pagetext)
{
$map = $this->_getMap($pagetext);
if (!$map) {
return HTML::p("<No interwiki map found>");
}
// Shouldn't happen.
$mon_attr = array('class' => 'interwiki-moniker');
$url_attr = array('class' => 'interwiki-url');
$thead = HTML::thead(HTML::tr(HTML::th($mon_attr, _("Moniker")), HTML::th($url_attr, _("InterWiki Address"))));
foreach ($map as $moniker => $interurl) {
$rows[] = HTML::tr(HTML::td($mon_attr, new Cached_WikiLinkIfKnown($moniker)), HTML::td($url_attr, HTML::tt($interurl)));
}
return HTML::table(array('class' => 'interwiki-map'), $thead, HTML::tbody(false, $rows));
}
示例4: _generateTable
function _generateTable($caption)
{
if (count($this->pagelist) > 0) {
$table = HTML::table(array('cellpadding' => 0, 'cellspacing' => 1, 'border' => 0, 'class' => 'pagelist'));
if ($caption) {
$table->pushContent(HTML::caption(array('align' => 'top'), $caption));
}
$row = HTML::tr();
$spacer = new RawXml(" ");
foreach ($this->_columns as $col_heading) {
$row->pushContent(HTML::td(HTML($spacer, HTML::u($col_heading))));
$table_summary[] = $col_heading;
}
// Table summary for non-visual browsers.
$table->setAttr('summary', sprintf(_("Columns: %s."), implode(", ", $table_summary)));
$table->pushContent(HTML::thead($row), HTML::tbody(false, $this->_rows));
} else {
$table = HTML();
if ($caption) {
$table->pushContent(HTML::p($caption));
}
$table->pushContent(HTML::p($this->_messageIfEmpty));
}
return $table;
}
示例5: run
function run($dbi, $argstr, &$request, $basepage)
{
$this->_args = $this->getArgs($argstr, $request);
extract($this->_args);
//trigger_error("1 p= $page a= $author");
if ($page && $page == 'username') {
//FIXME: use [username]!!!!!
$page = $author;
}
//trigger_error("2 p= $page a= $author");
if (!$page || !$author) {
//user not signed in or no author specified
return '';
}
//$pagelist = new PageList($info, $exclude);
///////////////////////////
$nbsp = HTML::raw(' ');
global $WikiTheme;
// date & time formatting
if (!($page == 'all')) {
$p = $dbi->getPage($page);
$t = HTML::table(array('class' => 'pagelist', 'style' => 'font-size:smaller'));
$th = HTML::thead();
$tb = HTML::tbody();
$th->pushContent(HTML::tr(HTML::td(array('align' => 'right'), _("Version")), $includeminor ? HTML::td(_("Minor")) : "", HTML::td(_("Author")), HTML::td(_("Summary")), HTML::td(_("Modified"))));
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
$isminor = $rev->get('is_minor_edit');
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || $includeminor && $isminor)) {
$difflink = Button(array('action' => 'diff', 'previous' => 'minor'), $rev->getversion(), $rev);
$tr = HTML::tr(HTML::td(array('align' => 'right'), $difflink, $nbsp), $includeminor ? HTML::td($nbsp, $isminor ? "minor" : "major", $nbsp) : "", HTML::td($nbsp, WikiLink($rev->get('author'), 'if_known'), $nbsp), HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align' => 'right'), $WikiTheme->formatdatetime($rev->get('mtime'))));
$class = $isminor ? 'evenrow' : 'oddrow';
$tr->setAttr('class', $class);
$tb->pushContent($tr);
//$pagelist->addPage($rev->getPage());
}
}
$captext = fmt($includeminor ? "History of all major and minor edits by %s to page %s." : "History of all major edits by %s to page %s.", WikiLink($author, 'auto'), WikiLink($page, 'auto'));
$t->pushContent(HTML::caption($captext));
$t->pushContent($th, $tb);
} else {
//search all pages for all edits by this author
/////////////////////////////////////////////////////////////
$t = HTML::table(array('class' => 'pagelist', 'style' => 'font-size:smaller'));
$th = HTML::thead();
$tb = HTML::tbody();
$th->pushContent(HTML::tr(HTML::td(_("Page Name")), HTML::td(array('align' => 'right'), _("Version")), $includeminor ? HTML::td(_("Minor")) : "", HTML::td(_("Summary")), HTML::td(_("Modified"))));
/////////////////////////////////////////////////////////////
$allpages_iter = $dbi->getAllPages($includedeleted);
while ($p = $allpages_iter->next()) {
/////////////////////////////////////////////////////////////
$allrevisions_iter = $p->getAllRevisions();
while ($rev = $allrevisions_iter->next()) {
$isminor = $rev->get('is_minor_edit');
$authordoesmatch = $author == $rev->get('author');
if ($authordoesmatch && (!$isminor || $includeminor && $isminor)) {
$difflink = Button(array('action' => 'diff', 'previous' => 'minor'), $rev->getversion(), $rev);
$tr = HTML::tr(HTML::td($nbsp, $isminor ? $rev->_pagename : WikiLink($rev->_pagename, 'auto')), HTML::td(array('align' => 'right'), $difflink, $nbsp), $includeminor ? HTML::td($nbsp, $isminor ? "minor" : "major", $nbsp) : "", HTML::td($nbsp, $rev->get('summary')), HTML::td(array('align' => 'right'), $WikiTheme->formatdatetime($rev->get('mtime')), $nbsp));
$class = $isminor ? 'evenrow' : 'oddrow';
$tr->setAttr('class', $class);
$tb->pushContent($tr);
//$pagelist->addPage($rev->getPage());
}
}
/////////////////////////////////////////////////////////////
}
$captext = fmt($includeminor ? "History of all major and minor modifications for any page edited by %s." : "History of major modifications for any page edited by %s.", WikiLink($author, 'auto'));
$t->pushContent(HTML::caption($captext));
$t->pushContent($th, $tb);
}
// if (!$noheader) {
// total minor, major edits. if include minoredits was specified
// }
return $t;
// if (!$noheader) {
// $pagelink = WikiLink($page, 'auto');
//
// if ($pagelist->isEmpty())
// return HTML::p(fmt("No pages link to %s.", $pagelink));
//
// if ($pagelist->getTotal() == 1)
// $pagelist->setCaption(fmt("One page links to %s:",
// $pagelink));
// else
// $pagelist->setCaption(fmt("%s pages link to %s:",
// $pagelist->getTotal(), $pagelink));
// }
//
// return $pagelist;
}
示例6: run
//.........这里部分代码省略.........
$sql = preg_replace("/LIMIT\\s+[\\d,]+\\s+/m", "LIMIT " . $limit . " ", $sql);
}
}
}
if (strstr($sql, "%%sortby%%")) {
if (!$sortby) {
$sql = preg_replace("/ORDER BY .*%%sortby%%\\s/m", "", $sql);
} else {
$sql = str_replace("%%sortby%%", $sortby, $sql);
}
} elseif (PageList::sortby($sortby, 'db')) {
// add sorting: support paging sortby links
if (preg_match("/\\sORDER\\s/", $sql)) {
$sql = preg_replace("/ORDER BY\\s\\S+\\s/m", "ORDER BY " . PageList::sortby($sortby, 'db'), $sql);
} else {
$sql .= " ORDER BY " . PageList::sortby($sortby, 'db');
}
}
$inidsn = $this->getDsn($alias);
if (!$inidsn) {
return $this->error(sprintf(_("No DSN for alias %s in SqlResult.ini found"), $alias));
}
// adodb or pear? adodb as default, since we distribute per default it.
// for pear there may be overrides.
// TODO: native PDO support (for now we use ADODB)
if ($DBParams['dbtype'] == 'SQL') {
$dbh = DB::connect($inidsn);
$all = $dbh->getAll($sql);
if (DB::isError($all)) {
return $this->error($all->getMessage() . ' ' . $all->userinfo);
}
} else {
// unless PearDB use the included ADODB, regardless if dba, file or PDO, ...
if ($DBParams['dbtype'] != 'ADODB') {
// require_once('lib/WikiDB/adodb/adodb-errorhandler.inc.php');
require_once 'lib/WikiDB/adodb/adodb.inc.php';
}
$parsed = parseDSN($inidsn);
$dbh =& ADONewConnection($parsed['phptype']);
$conn = $dbh->Connect($parsed['hostspec'], $parsed['username'], $parsed['password'], $parsed['database']);
if (!$conn) {
return $this->error($dbh->errorMsg());
}
$GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_ASSOC;
$dbh->SetFetchMode(ADODB_FETCH_ASSOC);
$all = $dbh->getAll($sql);
$GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_NUM;
$dbh->SetFetchMode(ADODB_FETCH_NUM);
if (!$all) {
return $this->error($dbh->errorMsg());
}
}
$args = array();
if ($limit) {
// fill paging vars (see PageList)
$args = $pagelist->pagingTokens(count($all), count($all[0]), $limit);
if (!$args) {
$args = array();
}
}
if ($template) {
$args = array_merge(array('SqlResult' => $all, 'ordered' => $ordered, 'where' => $where, 'sortby' => $sortby, 'limit' => $limit), $args);
// paging params override given params
return Template($template, $args);
} else {
if ($ordered) {
$html = HTML::ol(array('class' => 'sqlresult'));
if ($all) {
foreach ($all as $row) {
$html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0]));
}
}
} else {
$html = HTML::table(array('class' => 'sqlresult'));
$i = 0;
if ($all) {
foreach ($all as $row) {
$tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'));
if ($row) {
foreach ($row as $col) {
$tr->pushContent(HTML::td($col));
}
}
$html->pushContent($tr);
}
}
}
}
// do paging via pagelink template
if (!empty($args['NUMPAGES'])) {
$paging = Template("pagelink", $args);
$html = $table->pushContent(HTML::thead($paging), HTML::tbody($html), HTML::tfoot($paging));
}
if (0 and DEBUG) {
// test deferred error/warning/notice collapsing
trigger_error("test notice", E_USER_NOTICE);
trigger_error("test warning", E_USER_WARNING);
}
return $html;
}
示例7: showForm
function showForm(&$dbi, &$request, $args)
{
global $WikiTheme;
$action = $request->getPostURL();
$hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's', 'semsearch', 'relation', 'attribute'));
$pagefilter = HTML::input(array('name' => 'page', 'value' => $args['page'], 'title' => _("Search only in these pages. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$allrelations = $dbi->listRelations(false, false, true);
$svalues = empty($allrelations) ? "" : join("','", $allrelations);
$reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')");
$relation = HTML::input(array('name' => 'relation', 'value' => $args['relation'], 'title' => _("Filter by this relation. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:10em', 'acdropdown' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), '');
$queryrel = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this link. These are pagenames. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'xmlrpc:wiki.titleSearch ^[S] 4'), '');
$relsubmit = Button('submit:semsearch[relations]', _("Relations"), false);
// just testing some dhtml... not yet done
$enhancements = HTML();
$nbsp = HTML::raw(' ');
$this_uri = $_SERVER['REQUEST_URI'] . '#';
$andbutton = new Button(_("AND"), $this_uri, 'wikiaction', array('onclick' => "addquery('rel', 'and')", 'title' => _("Add an AND query")));
$orbutton = new Button(_("OR"), $this_uri, 'wikiaction', array('onclick' => "addquery('rel', 'or')", 'title' => _("Add an OR query")));
if (DEBUG) {
$enhancements = HTML::span($andbutton, $nbsp, $orbutton);
}
$instructions = _("Search in pages for a relation with that value (a pagename).");
$form1 = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => 0, 'cellspacing' => 2), HTML::colgroup(array('span' => 6)), HTML::thead(HTML::tr(HTML::th('Pagefilter'), HTML::th('Relation'), HTML::th(), HTML::th('Links'), HTML::th())), HTML::tbody(HTML::tr(HTML::td($pagefilter, ": "), HTML::td($relation), HTML::td(HTML::strong(HTML::tt(' :: '))), HTML::td($queryrel), HTML::td($nbsp, $relsubmit, $nbsp, $enhancements)))));
$allattrs = $dbi->listRelations(false, true, true);
if (empty($allrelations) and empty($allattrs)) {
// be nice to the dummy.
$this->_norelations_warning = 1;
}
$svalues = empty($allattrs) ? "" : join("','", $allattrs);
$attdef = JavaScript("var semsearch_attributes = new Array('" . $svalues . "')\n" . "var semsearch_op = new Array('" . join("','", $this->_supported_operators) . "')");
// TODO: We want some more tricks: Autofill the base unit of the selected
// attribute into the s area.
$attribute = HTML::input(array('name' => 'attribute', 'value' => $args['attribute'], 'title' => _("Filter by this attribute name. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:10em', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'array:semsearch_attributes'), '');
$attr_op = HTML::input(array('name' => 'attr_op', 'value' => $args['attr_op'], 'title' => _("Comparison operator. With autocompletion."), 'class' => 'dropdown', 'style' => 'width:2em', 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'array:semsearch_op'), '');
$queryatt = HTML::input(array('name' => 's', 'value' => $args['s'], 'title' => _("Filter by this numeric attribute value. With autocompletion."), 'class' => 'dropdown', 'acdropdown' => 'false', 'autocomplete_complete' => 'true', 'autocomplete_matchsubstring' => 'false', 'autocomplete_assoc' => 'false', 'autocomplete_list' => 'plugin:SemanticSearch page=' . $args['page'] . ' attribute=^[S] attr_op==~'), '');
$andbutton = new Button(_("AND"), $this_uri, 'wikiaction', array('onclick' => "addquery('attr', 'and')", 'title' => _("Add an AND query")));
$orbutton = new Button(_("OR"), $this_uri, 'wikiaction', array('onclick' => "addquery('attr', 'or')", 'title' => _("Add an OR query")));
if (DEBUG) {
$enhancements = HTML::span($andbutton, $nbsp, $orbutton);
}
$attsubmit = Button('submit:semsearch[attributes]', _("Attributes"), false);
$instructions = HTML::span(_("Search in pages for an attribute with that numeric value."), "\n");
if (DEBUG) {
$instructions->pushContent(HTML(" ", new Button(_("Advanced..."), _("SemanticSearchAdvanced"))));
}
$form2 = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $attdef, $hiddenfield, HiddenInputs(array('relation' => '')), $instructions, HTML::br(), HTML::table(array('border' => 0, 'cellspacing' => 2), HTML::colgroup(array('span' => 6)), HTML::thead(HTML::tr(HTML::th('Pagefilter'), HTML::th('Attribute'), HTML::th('Op'), HTML::th('Value'), HTML::th())), HTML::tbody(HTML::tr(HTML::td($pagefilter, ": "), HTML::td($attribute), HTML::td($attr_op), HTML::td($queryatt), HTML::td($nbsp, $attsubmit, $nbsp, $enhancements)))));
return HTML($form1, $form2);
}
示例8: run
function run($dbi, $argstr, &$request, $basepage)
{
$this->args = $this->getArgs($argstr, $request);
$args =& $this->args;
$this->_links = array();
$now = localtime(time() + 3600 * $request->getPref('timeOffset'), 1);
foreach (array('month' => $now['tm_mon'] + 1, 'year' => $now['tm_year'] + 1900) as $param => $dflt) {
if (!($args[$param] = intval($args[$param]))) {
$args[$param] = $dflt;
}
}
$time = mktime(12, 0, 0, $args['month'] + $args['month_offset'], 1, $args['year']);
$colnum = $args['display_weeknum'] ? 8 : 7;
$cal = HTML::table(array('cellspacing' => 0, 'cellpadding' => 2, 'class' => 'cal'), HTML::thead($this->__header($request->getArg('pagename'), $time), $this->__daynames($args['start_wday'])));
$t = localtime($time, 1);
if ($now['tm_year'] == $t['tm_year'] && $now['tm_mon'] == $t['tm_mon']) {
$this->_today = $now['tm_mday'];
} else {
$this->_today = false;
}
$tbody = HTML::tbody();
$row = HTML::tr();
if ($args['display_weeknum']) {
$row->pushContent(HTML::td(array('class' => 'cal-weeknum'), (int) strftime("%U", $time) + 1));
}
// %U problem. starts with 0
$col = (7 + $t['tm_wday'] - $args['start_wday']) % 7;
if ($col > 0) {
$row->pushContent(HTML::td(array('colspan' => $col)));
}
$done = false;
while (!$done) {
$row->pushContent($this->__date($dbi, $time));
if (++$col % 7 == 0) {
$tbody->pushContent($row);
$col = 0;
$row = HTML::tr();
}
$time += SECONDS_PER_DAY;
$t = localtime($time, 1);
$done = $t['tm_mday'] == 1;
if (!$col and !$done and $args['display_weeknum']) {
$row->pushContent(HTML::td(array('class' => 'cal-weeknum'), (int) strftime("%U", $time) + 1));
}
// starts with 0
}
if ($row->getContent()) {
$row->pushContent(HTML::td(array('colspan' => (42 - $col) % 7)));
$tbody->pushContent($row);
}
$cal->pushContent($tbody);
return $cal;
}
示例9: _generateTableBody
function _generateTableBody(&$info, &$dbi, &$request, &$table)
{
$plugin_dir = 'lib/plugin';
if (defined('PHPWIKI_DIR')) {
$plugin_dir = PHPWIKI_DIR . "/{$plugin_dir}";
}
$pd = new fileSet($plugin_dir, '*.php');
$plugins = $pd->getFiles();
unset($pd);
sort($plugins);
// table body
$tbody = HTML::tbody();
$row_no = 0;
$w = new WikiPluginLoader();
foreach ($plugins as $pluginName) {
// instantiate a plugin
$pluginName = str_replace(".php", "", $pluginName);
$temppluginclass = "<? plugin {$pluginName} ?>";
// hackish
$p = $w->getPlugin($pluginName, false);
// second arg?
// trap php files which aren't WikiPlugin~s
if (!strtolower(substr(get_parent_class($p), 0, 10)) == 'wikiplugin') {
// Security: Hide names of extraneous files within
// plugin dir from non-admins.
if ($request->_user->isAdmin()) {
trigger_error(sprintf(_("%s does not appear to be a WikiPlugin."), $pluginName . ".php"));
}
continue;
// skip this non WikiPlugin file
}
$desc = $p->getDescription();
$ver = $p->getVersion();
$arguments = $p->getArgumentsDescription();
unset($p);
//done querying plugin object, release from memory
// This section was largely improved by Pierrick Meignen:
// make a link if an actionpage exists
$pluginNamelink = $pluginName;
$pluginDocPageName = $pluginName . "Plugin";
$pluginDocPageNamelink = false;
$localizedPluginName = '';
$localizedPluginDocPageName = '';
if ($GLOBALS['LANG'] != "en") {
if (_($pluginName) != $pluginName) {
$localizedPluginName = _($pluginName);
}
if ($localizedPluginName && $dbi->isWikiPage($localizedPluginName)) {
$pluginDocPageNamelink = WikiLink($localizedPluginName, 'if_known');
}
if (_($pluginDocPageName) != $pluginDocPageName) {
$localizedPluginDocPageName = _($pluginDocPageName);
}
if ($localizedPluginDocPageName && $dbi->isWikiPage($localizedPluginDocPageName)) {
$pluginDocPageNamelink = WikiLink($localizedPluginDocPageName, 'if_known');
}
} else {
$pluginNamelink = WikiLink($pluginName, 'if_known');
if ($dbi->isWikiPage($pluginDocPageName)) {
$pluginDocPageNamelink = WikiLink($pluginDocPageName, 'if_known');
}
}
// highlight alternate rows
$row_no++;
$group = (int) ($row_no / 1);
//_group_rows
$class = $group % 2 ? 'evenrow' : 'oddrow';
// generate table row
$tr = HTML::tr(array('class' => $class));
if ($pluginDocPageNamelink) {
// plugin has a description page 'PluginName' . 'Plugin'
$tr->pushContent(HTML::td($pluginNamelink, HTML::br(), $pluginDocPageNamelink));
$pluginDocPageNamelink = false;
} else {
// plugin just has an actionpage
$tr->pushContent(HTML::td($pluginNamelink));
}
$tr->pushContent(HTML::td($ver), HTML::td($desc));
if ($info == 'args') {
// add Arguments column
$style = array('style' => 'font-family:monospace;font-size:smaller');
$tr->pushContent(HTML::td($style, $arguments));
}
$tbody->pushContent($tr);
}
$table->pushContent($tbody);
}
示例10: run
function run($dbi, $argstr, &$request, $basepage)
{
/* ignore fatal on loading */
/*
global $ErrorManager;
$ErrorManager->pushErrorHandler(new WikiMethodCb($this,'_error_handler'));
*/
// Require the XML_FOAF_Parser class. This is a pear library not included with phpwiki.
// see doc/README.foaf
if (findFile('XML/FOAF/Parser.php', 'missing_ok')) {
require_once 'XML/FOAF/Parser.php';
}
//$ErrorManager->popErrorHandler();
if (!class_exists('XML_FOAF_Parser')) {
return $this->error(_("required pear library XML/FOAF/Parser.php not found in include_path"));
}
extract($this->getArgs($argstr, $request));
// Get our FOAF File from the foaf plugin argument or $_GET['foaf']
if (empty($foaf)) {
$foaf = $request->getArg('foaf');
}
$chooser = HTML::form(array('method' => 'get', 'action' => $request->getURLtoSelf()), HTML::h4(_("FOAF File URI")), HTML::input(array('id' => 'foaf', 'name' => 'foaf', 'type' => 'text', 'size' => '80', 'value' => $foaf)), HTML::br(), HTML::input(array('id' => 'pretty', 'name' => 'pretty', 'type' => 'radio', 'checked' => 'checked'), _("Pretty HTML")), HTML::input(array('id' => 'original', 'name' => 'original', 'type' => 'radio'), _("Original URL (Redirect)")), HTML::br(), HTML::input(array('type' => 'submit', 'value' => _("Parse FOAF"))));
if (empty($foaf)) {
return $chooser;
} else {
//Error Checking
if (substr($foaf, 0, 7) != "http://") {
return $this->error(_("foaf must be a URI starting with http://"));
}
// Start of output
if (!empty($original)) {
$request->redirect($foaf);
} else {
$foaffile = url_get_contents($foaf);
if (!$foaffile) {
//TODO: get errormsg
return HTML(HTML::p("Resource isn't available: Something went wrong, probably a 404!"));
}
// Create new Parser object
$parser = new XML_FOAF_Parser();
// Parser FOAF into $foaffile
$parser->parseFromMem($foaffile);
$a = $parser->toArray();
$html = HTML(HTML::h1(@$a[0]["name"]), HTML::table(HTML::thead(), HTML::tbody(@$a[0]["title"] ? HTML::tr(HTML::td(_("Title")), HTML::td($a[0]["title"])) : null, @$a[0]["homepage"][0] ? $this->iterateHTML($a[0], "homepage", $a["dc"]) : null, @$a[0]["weblog"][0] ? $this->iterateHTML($a[0], "weblog", $a["dc"]) : null, HTML::tr(HTML::td("Full Name"), @$a[0]["name"][0] ? HTML::td(@$a[0]["name"]) : null), @$a[0]["nick"][0] ? $this->iterateHTML($a[0], "nick", $a["dc"]) : null, @$a[0]["mboxsha1sum"][0] ? $this->iterateHTML($a[0], "mboxsha1sum", $a["dc"]) : null, @$a[0]["depiction"][0] ? $this->iterateHTML($a[0], "depiction", $a["dc"]) : null, @$a[0]["seealso"][0] ? $this->iterateHTML($a[0], "seealso", $a["dc"]) : null, HTML::tr(HTML::td("Source"), HTML::td(HTML::a(array('href' => @$foaf), "RDF"))))));
if (DEBUG) {
$html->pushContent(HTML::hr(), $chooser);
}
return $html;
}
}
}
示例11: _generateTable
function _generateTable($caption)
{
if (count($this->_sortby) > 0) {
$this->_sortPages();
}
$rows = array();
$i = 0;
foreach ($this->_pages as $pagenum => $page) {
$rows[] = $this->_renderPageRow($page, $i++);
}
$table = HTML::table(array('cellpadding' => 0, 'cellspacing' => 1, 'border' => 0, 'class' => 'pagelist'));
if ($caption) {
$table->pushContent(HTML::caption(array('align' => 'top'), $caption));
}
//Warning: This is quite fragile. It depends solely on a private variable
// in ->_addColumn()
if (!empty($this->_columns_seen['checkbox'])) {
$table->pushContent($this->_jsFlipAll());
}
$do_paging = (isset($this->_options['paging']) and !empty($this->_options['limit']) and $this->getTotal() and $this->_options['paging'] != 'none');
$row = HTML::tr();
$table_summary = array();
$i = 1;
// start with 1!
foreach ($this->_columns as $col) {
$heading = $col->button_heading($this, $i);
if ($do_paging and isset($col->_field) and $col->_field == 'pagename' and $maxlen = $this->maxLen()) {
$heading->setAttr('width', $maxlen * 7);
}
$row->pushContent($heading);
if (is_string($col->getHeading())) {
$table_summary[] = $col->getHeading();
}
$i++;
}
// Table summary for non-visual browsers.
$table->setAttr('summary', sprintf(_("Columns: %s."), join(", ", $table_summary)));
$table->pushContent(HTML::colgroup(array('span' => count($this->_columns))));
if ($do_paging) {
$tokens = $this->pagingTokens($this->getTotal(), count($this->_columns), $this->_options['limit']);
if ($tokens === false) {
$table->pushContent(HTML::thead($row), HTML::tbody(false, $rows));
return $table;
}
$paging = Template("pagelink", $tokens);
if ($this->_options['paging'] != 'bottom') {
$table->pushContent(HTML::thead($paging));
}
$table->pushContent(HTML::tbody(false, HTML($row, $rows)));
if ($this->_options['paging'] != 'top') {
$table->pushContent(HTML::tfoot($paging));
}
return $table;
} else {
$table->pushContent(HTML::thead($row), HTML::tbody(false, $rows));
return $table;
}
}
示例12: _getQueryResults
function _getQueryResults($query, &$dbi)
{
$queryResult = $dbi->genericSqlIter($query);
if (!$queryResult) {
$tbody = HTML::tbody(HTML::tr(HTML::td(_("<empty>"))));
} else {
$tbody = HTML::tbody();
while ($row = $queryResult->next()) {
$this->_setHeaders($row);
$tr = HTML::tr();
foreach ($row as $value) {
// output a '-' for empty values, otherwise the table looks strange
$tr->pushContent(HTML::td(empty($value) ? '-' : $value));
}
$tbody->pushContent($tr);
}
}
$queryResult->free();
return $tbody;
}
示例13: addTableBody
function addTableBody(&$list, &$table)
{
if (!defined('HIGHLIGHT_ROWS_CUTOFF_SCORE')) {
define('HIGHLIGHT_ROWS_CUTOFF_SCORE', 60);
}
$tbody = HTML::tbody();
foreach ($list as $found_pagename => $score) {
$row = HTML::tr(array('class' => $score > HIGHLIGHT_ROWS_CUTOFF_SCORE ? 'evenrow' : 'oddrow'), HTML::td(WikiLink($found_pagename)), HTML::td(array('align' => 'right'), round($score)));
if ($this->debug) {
$this->_pushDebugTDinto($row, $found_pagename);
}
$tbody->pushContent($row);
}
$table->pushContent($tbody);
}
示例14: _generateTable
function _generateTable($caption)
{
if (count($this->_sortby) > 0) {
$this->_sortPages();
}
// wikiadminutils hack. that's a way to pagelist non-pages
$rows = isset($this->_rows) ? $this->_rows : array();
$i = 0;
$count = $this->getTotal();
$do_paging = (isset($this->_options['paging']) and !empty($this->_options['limit']) and $count and $this->_options['paging'] != 'none');
if ($do_paging) {
$tokens = $this->pagingTokens($count, count($this->_columns), $this->_options['limit']);
if ($tokens and !empty($this->_options['slice'])) {
$this->_pages = array_slice($this->_pages, $tokens['OFFSET'], $tokens['SIZE']);
}
}
foreach ($this->_pages as $pagenum => $page) {
$one_row = $this->_renderPageRow($page, $i++);
$rows[] = $one_row;
}
$table = HTML::table(array('cellpadding' => 0, 'cellspacing' => 1, 'border' => 0, 'width' => '100%', 'class' => 'pagelist'));
if ($caption) {
$table->pushContent(HTML::caption(array('align' => 'top'), $caption));
}
$row = HTML::tr();
$table_summary = array();
$i = 1;
// start with 1!
foreach ($this->_columns as $col) {
$heading = $col->button_heading($this, $i);
if ($do_paging and isset($col->_field) and $col->_field == 'pagename' and $maxlen = $this->maxLen()) {
}
$row->pushContent($heading);
if (is_string($col->getHeading())) {
$table_summary[] = $col->getHeading();
}
$i++;
}
// Table summary for non-visual browsers.
$table->setAttr('summary', sprintf(_("Columns: %s."), join(", ", $table_summary)));
$table->pushContent(HTML::colgroup(array('span' => count($this->_columns))));
if ($do_paging) {
if ($tokens === false) {
$table->pushContent(HTML::thead($row), HTML::tbody(false, $rows));
return $table;
}
$paging = Template("pagelink", $tokens);
if ($this->_options['paging'] != 'bottom') {
$table->pushContent(HTML::thead($paging));
}
if ($this->_options['paging'] != 'top') {
$table->pushContent(HTML::tfoot($paging));
}
$table->pushContent(HTML::tbody(false, HTML($row, $rows)));
return $table;
} else {
$table->pushContent(HTML::thead($row), HTML::tbody(false, $rows));
return $table;
}
}