本文整理汇总了PHP中HTML::tr方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::tr方法的具体用法?PHP HTML::tr怎么用?PHP HTML::tr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::tr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
extract($args);
include_once "lib/imdb.php";
$imdb = new imdb();
if (method_exists($imdb, $query)) {
$SqlResult = $imdb->{$query}($title ? $title : $name);
} else {
$SqlResult = array();
}
// if ($limit) ; // TODO: fill paging vars (see PageList)
if ($ordered) {
$html = HTML::ol(array('class' => 'sqlresult'));
foreach ($SqlResult as $row) {
$html->pushContent(HTML::li(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'), $row[0]));
}
} else {
$html = HTML::table(array('class' => 'sqlresult'));
$i = 0;
foreach ($SqlResult as $row) {
$tr = HTML::tr(array('class' => $i++ % 2 ? 'evenrow' : 'oddrow'));
foreach ($row as $col) {
$tr->pushContent(HTML::td($col));
}
$html->pushContent($tr);
}
}
// if ($limit) ; // do paging via pagelink template
return $html;
}
示例2: showForm
function showForm(&$dbi, &$request, $args, $allrelations)
{
global $WikiTheme;
$action = $request->getPostURL();
$hiddenfield = HiddenInputs($request->getArgs(), '', array('action', 'page', 's'));
$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'), '');
$help = Button('submit:semsearch[help]', "?", false);
$svalues = empty($allrelations) ? "" : join("','", $allrelations);
$reldef = JavaScript("var semsearch_relations = new Array('" . $svalues . "')");
$querybox = HTML::textarea(array('name' => 's', 'title' => _("Enter a valid query expression"), 'rows' => 4, 'acdropdown' => 'true', 'autocomplete_complete' => 'true', 'autocomplete_assoc' => 'false', 'autocomplete_matchsubstring' => 'true', 'autocomplete_list' => 'array:semsearch_relations'), $args['s']);
$submit = Button('submit:semsearch[relations]', _("Search"), false, array('title' => 'Move to help page. No seperate window'));
$instructions = _("Search in all specified pages for the expression.");
$form = HTML::form(array('action' => $action, 'method' => 'post', 'accept-charset' => $GLOBALS['charset']), $reldef, $hiddenfield, HiddenInputs(array('attribute' => '')), $instructions, HTML::br(), HTML::table(array('border' => '0', 'width' => '100%'), HTML::tr(HTML::td(_("Pagename(s): "), $pagefilter), HTML::td(array('align' => 'right'), $help)), HTML::tr(HTML::td(array('colspan' => 2), $querybox))), HTML::br(), HTML::div(array('align' => 'center'), $submit));
return $form;
}
示例3: PageInfoRow
function PageInfoRow($label, $rev, &$request)
{
global $WikiTheme, $WikiNameRegexp;
$row = HTML::tr(HTML::td(array('align' => 'right'), $label));
if ($rev) {
$author = $rev->get('author');
$dbi = $request->getDbh();
$iswikipage = isWikiWord($author) && $dbi->isWikiPage($author);
$authorlink = $iswikipage ? WikiLink($author) : $author;
$linked_version = WikiLink($rev, 'existing', $rev->getVersion());
$row->pushContent(HTML::td(fmt("version %s", $linked_version)), HTML::td($WikiTheme->getLastModifiedMessage($rev, false)), HTML::td(fmt("by %s", $authorlink)));
} else {
$row->pushContent(HTML::td(array('colspan' => '3'), _("None")));
}
return $row;
}
示例4: run
function run($dbi, $argstr, &$request, $basepage)
{
if (!ACCESS_LOG) {
return;
}
$args = $this->getArgs($argstr, $request);
$table = HTML::table(array('cellpadding' => 1, 'cellspacing' => 2, 'border' => 0, 'class' => 'pagelist'));
if (!$args['noheader'] and !empty($args['caption'])) {
$table->pushContent(HTML::caption(array('align' => 'top'), $args['caption']));
}
$logs = array();
$limit = $args['limit'];
$accesslog =& $request->_accesslog;
if ($logiter = $accesslog->get_referer($limit, "external_only") and $logiter->count()) {
$table->pushContent(HTML::tr(HTML::th("Target"), HTML::th("Referrer"), HTML::th("Host"), HTML::th("Date")));
while ($logentry = $logiter->next()) {
$table->pushContent(HTML::tr(HTML::td($logentry['request']), HTML::td($logentry['referer']), HTML::td($logentry['host']), HTML::td($logentry['time'])));
}
return $table;
}
}
示例5: asEditableTable
function asEditableTable($type)
{
global $WikiTheme;
if (!isset($this->_group)) {
$this->_group =& $GLOBALS['request']->getGroup();
}
$table = HTML::table();
$table->pushContent(HTML::tr(HTML::th(array('align' => 'left'), _("Access")), HTML::th(array('align' => 'right'), _("Group/User")), HTML::th(_("Grant")), HTML::th(_("Del/+")), HTML::th(_("Description"))));
$allGroups = $this->_group->_specialGroups();
foreach ($this->_group->getAllGroupsIn() as $group) {
if (!in_array($group, $this->_group->specialGroups())) {
$allGroups[] = $group;
}
}
//array_unique(array_merge($this->_group->getAllGroupsIn(),
$deletesrc = $WikiTheme->_findData('images/delete.png');
$addsrc = $WikiTheme->_findData('images/add.png');
$nbsp = HTML::raw(' ');
foreach ($this->perm as $access => $groups) {
//$permlist = HTML::table(array('class' => 'cal','valign' => 'top'));
$first_only = true;
$newperm = HTML::input(array('type' => 'checkbox', 'name' => "acl[_new_perm][{$access}]", 'value' => 1));
$addbutton = HTML::input(array('type' => 'checkbox', 'name' => "acl[_add_group][{$access}]", 'title' => _("Add this ACL"), 'value' => 1));
$newgroup = HTML::select(array('name' => "acl[_new_group][{$access}]", 'style' => 'text-align: right;', 'size' => 1));
foreach ($allGroups as $groupname) {
if (!isset($groups[$groupname])) {
$newgroup->pushContent(HTML::option(array('value' => $groupname), $this->groupName($groupname)));
}
}
if (empty($groups)) {
$addbutton->setAttr('checked', 'checked');
$newperm->setAttr('checked', 'checked');
$table->pushContent(HTML::tr(array('valign' => 'top'), HTML::td(HTML::strong($access . ":")), HTML::td($newgroup), HTML::td($nbsp, $newperm), HTML::td($nbsp, $addbutton), HTML::td(HTML::em(getAccessDescription($access)))));
}
foreach ($groups as $group => $bool) {
$checkbox = HTML::input(array('type' => 'checkbox', 'name' => "acl[{$access}][{$group}]", 'title' => _("Allow / Deny"), 'value' => 1));
if ($bool) {
$checkbox->setAttr('checked', 'checked');
}
$checkbox = HTML(HTML::input(array('type' => 'hidden', 'name' => "acl[{$access}][{$group}]", 'value' => 0)), $checkbox);
$deletebutton = HTML::input(array('type' => 'checkbox', 'name' => "acl[_del_group][{$access}][{$group}]", 'style' => 'background: #aaa url(' . $deletesrc . ')', 'title' => _("Delete this ACL"), 'value' => 1));
if ($first_only) {
$table->pushContent(HTML::tr(HTML::td(HTML::strong($access . ":")), HTML::td(array('class' => 'cal-today', 'align' => 'right'), HTML::strong($this->groupName($group))), HTML::td(array('align' => 'center'), $nbsp, $checkbox), HTML::td(array('align' => 'right', 'style' => 'background: #aaa url(' . $deletesrc . ') no-repeat'), $deletebutton), HTML::td(HTML::em(getAccessDescription($access)))));
$first_only = false;
} else {
$table->pushContent(HTML::tr(HTML::td(), HTML::td(array('class' => 'cal-today', 'align' => 'right'), HTML::strong($this->groupName($group))), HTML::td(array('align' => 'center'), $nbsp, $checkbox), HTML::td(array('align' => 'right', 'style' => 'background: #aaa url(' . $deletesrc . ') no-repeat'), $deletebutton), HTML::td()));
}
}
if (!empty($groups)) {
$table->pushContent(HTML::tr(array('valign' => 'top'), HTML::td(array('align' => 'right'), _("add ")), HTML::td($newgroup), HTML::td(array('align' => 'center'), $nbsp, $newperm), HTML::td(array('align' => 'right', 'style' => 'background: #ccc url(' . $addsrc . ') no-repeat'), $addbutton), HTML::td(HTML::small(_("Check to add this ACL")))));
}
}
if ($type == 'default') {
$table->setAttr('style', 'border: dotted thin black; background-color:#eee;');
} elseif ($type == 'inherited') {
$table->setAttr('style', 'border: dotted thin black; background-color:#ddd;');
} elseif ($type == 'page') {
$table->setAttr('style', 'border: solid thin black; font-weight: bold;');
}
return $table;
}
示例6: 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));
//.........这里部分代码省略.........
示例7: _lines
function _lines($lines, $class, $prefix = false, $elem = false)
{
if (!$prefix) {
$prefix = HTML::raw(' ');
}
$prefix = HTML::td(array('class' => 'prefix', 'width' => "1%"), $prefix);
foreach ($lines as $line) {
if (!trim($line)) {
$line = HTML::raw(' ');
} elseif ($elem) {
$line = new HtmlElement($elem, $line);
}
$this->_block->pushContent(HTML::tr(array('valign' => 'top'), $prefix, HTML::td(array('class' => $class), $line)));
}
}
示例8: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
include_once 'lib/InlineParser.php';
$table = array();
$lines = preg_split('/\\s*?\\n\\s*/', $argstr);
foreach ($lines as $line) {
if (!$line) {
continue;
}
$line = trim($line);
// If line ends with a '|', remove it
if ($line[strlen($line) - 1] == '|') {
$line = substr($line, 0, -1);
}
if ($line[0] != '|') {
// trigger_error(sprintf(_("Line %s does not begin with a '|'."), $line), E_USER_WARNING);
} else {
$table[] = $this->_parse_row($line, $basepage);
}
}
$nbrows = sizeof($table);
// If table is empty, do not generate table markup
if ($nbrows == 0) {
return HTML::raw('');
}
$nbcols = sizeof($table[0]);
for ($i = 0; $i < $nbrows; $i++) {
for ($j = 0; $j < $nbcols; $j++) {
if (preg_match('/@@/', $table[$i][$j])) {
$table[$i][$j] = compute_tablecell($table, $i, $j, $nbrows, $nbcols);
}
}
}
$htmltable = HTML::table(array('class' => "bordered"));
foreach ($table as $row) {
$htmlrow = HTML::tr();
foreach ($row as $cell) {
if ($cell && $cell[0] == '=') {
$cell = trim(substr($cell, 1));
$htmlrow->pushContent(HTML::th(TransformInline($cell, 2.0, $basepage)));
} else {
if (is_numeric($cell)) {
$htmlrow->pushContent(HTML::td(array('style' => "text-align:right"), $cell));
} else {
$htmlrow->pushContent(HTML::td(TransformInline($cell, 2.0, $basepage)));
}
}
}
$htmltable->pushContent($htmlrow);
}
return $htmltable;
}
示例9: _upgrade_db_init
function _upgrade_db_init(&$dbh)
{
global $request, $DBParams, $DBAuthParams;
if (!in_array($DBParams['dbtype'], array('SQL', 'ADODB', 'PDO'))) {
return;
}
if (DBADMIN_USER) {
// if need to connect as the root user, for CREATE and ALTER privileges
$AdminParams = $DBParams;
if ($DBParams['dbtype'] == 'SQL') {
$dsn = DB::parseDSN($AdminParams['dsn']);
} else {
// ADODB or PDO
$dsn = parseDSN($AdminParams['dsn']);
}
$AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], DBADMIN_USER, DBADMIN_PASSWD, $dsn['hostspec'], $dsn['database']);
if (DEBUG & _DEBUG_SQL and $DBParams['dbtype'] == 'PDO') {
echo "<br>\nDBParams['dsn']: '", $DBParams['dsn'], "'";
echo "<br>\ndsn: '", print_r($dsn), "'";
echo "<br>\nAdminParams['dsn']: '", $AdminParams['dsn'], "'";
}
$dbh = WikiDB::open($AdminParams);
} elseif ($dbadmin = $request->getArg('dbadmin')) {
if (empty($dbadmin['user']) or isset($dbadmin['cancel'])) {
$dbh =& $request->_dbi;
} else {
$AdminParams = $DBParams;
if ($DBParams['dbtype'] == 'SQL') {
$dsn = DB::parseDSN($AdminParams['dsn']);
} else {
$dsn = parseDSN($AdminParams['dsn']);
}
$AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], $dbadmin['user'], $dbadmin['passwd'], $dsn['hostspec'], $dsn['database']);
$dbh = WikiDB::open($AdminParams);
}
} else {
// Check if the privileges are enough. Need CREATE and ALTER perms.
// And on windows: SELECT FROM mysql, possibly: UPDATE mysql.
$form = HTML::form(array("method" => "post", "action" => $request->getPostURL(), "accept-charset" => $GLOBALS['charset']), HTML::p(_("Upgrade requires database privileges to CREATE and ALTER the phpwiki database."), HTML::br(), _("And on windows at least the privilege to SELECT FROM mysql, and possibly UPDATE mysql")), HiddenInputs(array('action' => 'upgrade')), HTML::table(array("cellspacing" => 4), HTML::tr(HTML::td(array('align' => 'right'), _("DB admin user:")), HTML::td(HTML::input(array('name' => "dbadmin[user]", 'size' => 12, 'maxlength' => 256, 'value' => 'root')))), HTML::tr(HTML::td(array('align' => 'right'), _("DB admin password:")), HTML::td(HTML::input(array('name' => "dbadmin[passwd]", 'type' => 'password', 'size' => 12, 'maxlength' => 256)))), HTML::tr(HTML::td(array('align' => 'center', 'colspan' => 2), Button("submit:", _("Submit"), 'wikiaction'), HTML::raw(' '), Button("submit:dbadmin[cancel]", _("Cancel"), 'button')))));
$form->printXml();
echo "</div><!-- content -->\n";
echo asXML(Template("bottom"));
echo "</body></html>\n";
$request->finish();
exit;
}
}
示例10: _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;
}
示例11: _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);
}
示例12: 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;
}
示例13: 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;
}
}
}
示例14: _do_email_verification
function _do_email_verification(&$request, &$args)
{
$dbi = $request->getDbh();
$pagelist = new PageList('pagename', 0, $args);
//$args['return_url'] = 'action=email-verification-verified';
$email = new _PageList_Column_email('email', _("E-Mail"), 'left');
$emailVerified = new _PageList_Column_emailVerified('emailVerified', _("Verification Status"), 'center');
$pagelist->_columns[] = $email;
$pagelist->_columns[] = $emailVerified;
//This is the best method to find all users (Db and PersonalPage)
$current_user = $request->_user;
if (empty($args['verify'])) {
$group = $request->getGroup();
$allusers = $group->_allUsers();
} else {
$allusers = array_keys($args['user']);
}
foreach ($allusers as $username) {
if (ENABLE_USER_NEW) {
$user = WikiUser($username);
} else {
$user = new WikiUser($request, $username);
}
$prefs = $user->getPreferences();
if ($prefs->get('email')) {
if (!$prefs->get('userid')) {
$prefs->set('userid', $username);
}
if (!empty($pagelist->_rows)) {
$group = (int) (count($pagelist->_rows) / $pagelist->_group_rows);
} else {
$group = 0;
}
$class = $group % 2 ? 'oddrow' : 'evenrow';
$row = HTML::tr(array('class' => $class));
$page_handle = $dbi->getPage($username);
$row->pushContent($pagelist->_columns[0]->format($pagelist, $page_handle, $page_handle));
$row->pushContent($email->format($pagelist, $prefs, $page_handle));
if (!empty($args['verify'])) {
$prefs->_prefs['email']->set('emailVerified', empty($args['verified'][$username]) ? 0 : 2);
$user->setPreferences($prefs);
}
$row->pushContent($emailVerified->format($pagelist, $prefs, $args['verify']));
$pagelist->_rows[] = $row;
}
}
$request->_user = $current_user;
if (!empty($args['verify'])) {
return HTML($pagelist->_generateTable(false));
} else {
$args['verify'] = 1;
$args['return_url'] = $request->getURLtoSelf();
return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs($args, 'wikiadminutils'), HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), HiddenInputs($request->getArgs()), $pagelist->_generateTable(false), HTML::p(Button('submit:', _("Change Verification Status"), 'wikiadmin'), HTML::Raw(' '), Button('cancel', _("Cancel"))));
}
}
示例15: run
function run($dbi, $argstr, &$request, $basepage)
{
$this->disallowed_extensions = explode("\n", "ad[ep]\nasd\nba[st]\nchm\ncmd\ncom\ncgi\ncpl\ncrt\ndll\neml\nexe\nhlp\nhta\nin[fs]\nisp\njse?\nlnk\nmd[betw]\nms[cipt]\nnws\nocx\nops\npcd\np[ir]f\nphp\npl\npy\nreg\nsc[frt]\nsh[bsm]?\nswf\nurl\nvb[esx]?\nvxd\nws[cfh]");
//removed "\{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\}"
$args = $this->getArgs($argstr, $request);
extract($args);
$file_dir = getUploadFilePath();
//$url_prefix = SERVER_NAME . DATA_PATH;
$form = HTML::form(array('action' => $request->getPostURL(), 'enctype' => 'multipart/form-data', 'method' => 'post'));
$contents = HTML::div(array('class' => 'wikiaction'));
$contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE)));
/// MV add pv
/// @todo: have a generic method to transmit pv
if (!empty($_REQUEST['pv'])) {
$contents->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'pv', 'value' => $_REQUEST['pv'])));
}
$contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => '50')));
$contents->pushContent(HTML::raw(" "));
$contents->pushContent(HTML::input(array('value' => _("Upload"), 'type' => 'submit')));
$form->pushContent($contents);
$message = HTML();
if ($request->isPost() and $this->only_authenticated) {
// Make sure that the user is logged in.
$user = $request->getUser();
if (!$user->isAuthenticated()) {
$message->pushContent(HTML::h2(_("ACCESS DENIED: You must log in to upload files.")), HTML::br(), HTML::br());
$result = HTML();
$result->pushContent($form);
$result->pushContent($message);
return $result;
}
}
$userfile = $request->getUploadedFile('userfile');
if ($userfile) {
$userfile_name = $userfile->getName();
$userfile_name = trim(basename($userfile_name));
$userfile_tmpname = $userfile->getTmpName();
$err_header = HTML::h2(fmt("ERROR uploading '%s': ", $userfile_name));
/// MV add
/// Wiki attachments
$wa = new WikiAttachment(GROUP_ID);
$rev = $wa->createRevision($userfile_name, $userfile->getSize(), $userfile->getType(), $userfile->getTmpName());
if ($rev >= 0) {
$prev = $rev + 1;
$interwiki = new PageType_interwikimap();
$link = $interwiki->link("Upload:{$prev}/{$userfile_name}");
$message->pushContent(HTML::h2(_("File successfully uploaded.")));
$message->pushContent(HTML::ul(HTML::li($link)));
// the upload was a success and we need to mark this event in the "upload log"
if ($logfile) {
$upload_log = $file_dir . basename($logfile);
$this->log($userfile, $upload_log, $message);
}
if ($autolink) {
require_once "lib/loadsave.php";
$pagehandle = $dbi->getPage($page);
if ($pagehandle->exists()) {
// don't replace default contents
$current = $pagehandle->getCurrentRevision();
$version = $current->getVersion();
$text = $current->getPackedContent();
$newtext = $text . "\n* [Upload:{$userfile_name}]";
$meta = $current->_data;
$meta['summary'] = sprintf(_("uploaded %s"), $userfile_name);
$pagehandle->save($newtext, $version + 1, $meta);
}
}
} else {
$message->pushContent($err_header);
$message->pushContent(HTML::br(), _("Uploading failed."), HTML::br());
}
} else {
$message->pushContent(HTML::br(), HTML::br());
}
/// {{{ Codendi Specific
// URL arguments
if (array_key_exists('offset', $_REQUEST)) {
$offset = $_REQUEST['offset'];
} else {
$offset = 0;
}
if (array_key_exists('limit', $_REQUEST)) {
$limit = $_REQUEST['limit'];
} else {
$limit = 10;
}
$attchTab = HTML::table(array('border' => '1', 'width' => '100%'));
$attchTab->pushContent(HTML::tr(HTML::th(_("Attachment")), HTML::th(_("Number of revision"))));
$wai =& WikiAttachment::getListWithCounter(GROUP_ID, user_getid(), array('offset' => $offset, 'nb' => $limit));
$wai->rewind();
while ($wai->valid()) {
$wa =& $wai->current();
$filename = basename($wa->getFilename());
$url = getUploadDataPath() . urlencode($filename);
$line = HTML::tr();
$line->pushContent(HTML::td(HTML::a(array('href' => $url), "Attach:" . $filename)));
$line->pushContent(HTML::td($wa->count()));
$attchTab->pushContent($line);
$wai->next();
}
//.........这里部分代码省略.........