本文整理汇总了PHP中HTML::div方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::div方法的具体用法?PHP HTML::div怎么用?PHP HTML::div使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::div方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderContent
public function renderContent()
{
$content = '';
$list = '';
$records = $this->splitRecords($this->controller->getRecords());
$totalLength = 0;
foreach ($records as $day => $dayRecords) {
$filtered = [];
$totalDayLength = 0;
foreach ($dayRecords as $dayRecord) {
foreach ($dayRecord->getTags() as $tag) {
if ($tag->getName() == $this->getPath(1)) {
$filtered[] = $dayRecord;
$length = $dayRecord->getLength();
if (is_null($length)) {
$length = abs(time() - $dayRecord->getStart()->getTimestamp());
}
$totalDayLength += $length;
}
}
}
if (!empty($filtered)) {
$totalLength += $totalDayLength;
$lengthString = round($totalDayLength / 3600, 2);
$list .= HTML::div(['.title'], HTML::div(['.date'], $day) . HTML::div(['.length'], $lengthString));
$list .= new RecordList($filtered, 'record', false, false);
}
}
$content .= HTML::div(['.title', '.total'], HTML::div('total') . HTML::div(['.length'], round($totalLength / 3600, 2)));
$content .= $list;
return HTML::div($content);
}
示例2: __construct
public function __construct(array $objects, $edit = null, $add = true, $delete = true)
{
$this->list = '';
foreach ($objects as $object) {
$properties = $this->getProperties($object);
$propertyList = '';
foreach ($properties as $class => $property) {
$propertyList .= HTML::span(['class' => $class], $property);
}
$id = $object->getId();
if ($edit) {
$properties = HTML::span(['class' => 'properties'], HTML::a(['href' => "/edit/{$edit}/{$id}"], $propertyList));
} else {
$properties = HTML::span(['class' => 'properties'], $propertyList);
}
if ($delete) {
$deleteLink = HTML::span(['class' => 'delete'], HTML::a(['href' => "/delete/{$edit}/{$id}"], 'x'));
} else {
$deleteLink = '';
}
$this->list .= HTML::div(['class' => 'objectRow'], $properties . $deleteLink);
}
if ($add && $edit) {
$this->list .= HTML::div(HTML::span(HTML::a(['href' => "/edit/{$edit}/"], 'add ' . $edit)));
}
$this->list = HTML::div(['class' => 'objectList'], $this->list);
}
示例3: PurgePage
function PurgePage(&$request)
{
global $WikiTheme;
$page = $request->getPage();
$pagelink = WikiLink($page);
if ($request->getArg('cancel')) {
$request->redirect(WikiURL($page));
// noreturn
}
$current = $page->getCurrentRevision();
if (!$current or !($version = $current->getVersion())) {
$html = HTML::p(array('class' => 'error'), _("Sorry, this page does not exist."));
} elseif (!$request->isPost() || !$request->getArg('verify')) {
$purgeB = Button('submit:verify', _("Purge Page"), 'wikiadmin');
$cancelB = Button('submit:cancel', _("Cancel"), 'button');
// use generic wiki button look
$fieldset = HTML::fieldset(HTML::p(fmt("You are about to purge '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'purge')), HTML::div(array('class' => 'toolbar'), $purgeB, $WikiTheme->getButtonSeparator(), $cancelB)));
$sample = HTML::div(array('class' => 'transclusion'));
// simple and fast preview expanding only newlines
foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
$sample->pushContent($s, HTML::br());
}
$html = HTML($fieldset, HTML::div(array('class' => 'wikitext'), $sample));
} elseif ($request->getArg('currentversion') != $version) {
$html = HTML(HTML::p(array('class' => 'error'), _("Someone has edited the page!")), HTML::p(fmt("Since you started the purge process, someone has saved a new version of %s. Please check to make sure you still want to permanently purge the page from the database.", $pagelink)));
} else {
// Real purge.
$pagename = $page->getName();
$dbi = $request->getDbh();
$dbi->purgePage($pagename);
$dbi->touch();
$html = HTML::div(array('class' => 'feedback'), fmt("Purged page '%s' successfully.", $pagename));
}
GeneratePage($html, _("Purge Page"));
}
示例4: removePages
function removePages(&$request, $pages)
{
$result = HTML::div();
$ul = HTML::ul();
$dbi = $request->getDbh();
$count = 0;
foreach ($pages as $name) {
$name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
if (mayAccessPage('remove', $name)) {
$dbi->deletePage($name);
$ul->pushContent(HTML::li(fmt("Removed page '%s' successfully.", $name)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Didn't remove page '%s'. Access denied.", $name)));
}
}
if ($count) {
$dbi->touch();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently removed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently removed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages removed."));
return $result;
}
}
示例5: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
if ($numberlinks > 10 || $numberlinks < 0) {
$numberlinks = $this->def_numberlinks;
}
// Get name of the current page we are on
$thispage = $request->getArg('pagename');
$Pages = $request->session->get("PageTrail");
if (!is_array($Pages)) {
$Pages = array();
}
if (!isset($Pages[0]) or $duplicates || $thispage != $Pages[0]) {
array_unshift($Pages, $thispage);
$request->session->set("PageTrail", $Pages);
}
$numberlinks = min(count($Pages), $numberlinks);
if (!$invisible and $numberlinks) {
$html = HTML::div(array('class' => 'pagetrail'));
$html->pushContent(WikiLink($Pages[$numberlinks - 1], 'auto'));
for ($i = $numberlinks - 2; $i >= 0; $i--) {
if (!empty($Pages[$i])) {
$html->pushContent(PAGETRAIL_ARROW, WikiLink($Pages[$i], 'auto'));
}
}
return $html;
} else {
return HTML();
}
}
示例6: run
function run($dbi, $argstr, &$request, $basepage)
{
global $WikiTheme;
$args = $this->getArgs($argstr, $request);
extract($args);
if (!$src) {
return $this->error(fmt("%s parameter missing", "'src'"));
}
// FIXME: Better recursion detection.
// FIXME: Currently this doesnt work at all.
if ($src == $request->getURLtoSelf()) {
return $this->error(fmt("recursive inclusion of url %s", $src));
}
if (!IsSafeURL($src)) {
return $this->error(_("Bad url in src: remove all of <, >, \""));
}
$params = array('title' => _("Transcluded page"), 'src' => $src, 'width' => "100%", 'height' => $height, 'marginwidth' => 0, 'marginheight' => 0, 'class' => 'transclude', "onload" => "adjust_iframe_height(this);");
$noframe_msg[] = fmt("See: %s", HTML::a(array('href' => $src), $src));
$noframe_msg = HTML::div(array('class' => 'transclusion'), HTML::p(array(), $noframe_msg));
$iframe = HTML::div(HTML::iframe($params, $noframe_msg));
/* This doesn't work very well... maybe because CSS screws up NS4 anyway...
$iframe = new HtmlElement('ilayer', array('src' => $src), $iframe);
*/
return HTML(HTML::p(array('class' => 'transclusion-title'), fmt("Transcluded from %s", LinkURL($src))), $this->_js(), $iframe);
}
示例7: run
function run($dbi, $argstr, &$request, $basepage)
{
/* plugin not yet has arguments - save for later (copied from UpLoad)
$args = $this->getArgs($argstr, $request);
extract($args);
*/
$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)));
$contents->pushContent(HTML::input(array('name' => 'userfile', 'type' => 'file', 'size' => '50')));
$contents->pushContent(HTML::raw(" "));
$contents->pushContent(HTML::input(array('value' => _("Convert"), 'type' => 'submit')));
$form->pushContent($contents);
$message = HTML();
$userfile = $request->getUploadedFile('userfile');
if ($userfile) {
$userfile_name = $userfile->getName();
$userfile_name = basename($userfile_name);
$userfile_tmpname = $userfile->getTmpName();
if (!preg_match("/(\\.html|\\.htm)\$/i", $userfile_name)) {
$message->pushContent(_("Only files with extension HTML are allowed"), HTML::br(), HTML::br());
} else {
$message->pushContent(_("Processed {$userfile_name}"), HTML::br(), HTML::br());
$message->pushContent(_("Copy the output below and paste it into your Wiki page."), HTML::br());
$message->pushContent($this->_process($userfile_tmpname));
}
} else {
$message->pushContent(HTML::br(), HTML::br());
}
$result = HTML();
$result->pushContent($form);
$result->pushContent($message);
return $result;
}
示例8: run
function run($dbi, $argstr, &$request, $basepage)
{
extract($this->getArgs($argstr, $request));
$parser = new AtomParser();
assert(!empty($url));
$parser->parse_url($url);
$html = '';
$items = HTML::dl();
foreach ($parser->feed as $feed) {
$title = HTML::h3(HTML::a(array('href' => $feed["links"]["0"]["href"]), $feed["title"]));
$counter = 1;
foreach ($parser->entries as $entry) {
$item = HTML::dt(HTML::a(array('href' => $entry["links"]["0"]["href"]), $entry["title"]));
$items->pushContent($item);
if (!$titleonly) {
$description = HTML::dd(HTML::raw(html_entity_decode($entry["content"])));
} else {
$description = HTML::dd();
}
$items->pushContent($description);
if ($maxitem > 0 && $counter >= $maxitem) {
break;
}
$counter++;
}
$html = HTML::div(array('class' => 'rss'), $title);
$html->pushContent($items);
}
return $html;
}
示例9: run
function run($dbi, $argstr, &$request, $basepage)
{
if (!$basepage) {
return $this->error("{$basepage} unset?");
}
include_once "lib/BlockParser.php";
$page = $request->getPage($basepage);
return HTML::div(array('class' => 'boxright'), TransformText($argstr));
}
示例10: RemovePage
function RemovePage(&$request)
{
global $WikiTheme;
$page = $request->getPage();
$pagelink = WikiLink($page);
if ($request->getArg('cancel')) {
$request->redirect(WikiURL($page));
// noreturn
}
$current = $page->getCurrentRevision();
if (!$current or !($version = $current->getVersion())) {
$html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
} elseif (!$request->isPost() || !$request->getArg('verify')) {
$removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
$cancelB = Button('submit:cancel', _("Cancel"), 'button');
// use generic wiki button look
$html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
$sample = HTML::div(array('class' => 'transclusion'));
// simple and fast preview expanding only newlines
foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
$sample->pushContent($s, HTML::br());
}
$html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
} elseif ($request->getArg('currentversion') != $version) {
$html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s. Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
} else {
// Codendi specific: remove the deleted wiki page from ProjectWantedPages
$projectPageName = 'ProjectWantedPages';
$pagename = $page->getName();
$dbi = $request->getDbh();
require_once PHPWIKI_DIR . "/lib/loadsave.php";
$pagehandle = $dbi->getPage($projectPageName);
if ($pagehandle->exists()) {
// don't replace default contents
$current = $pagehandle->getCurrentRevision();
$version = $current->getVersion();
$text = $current->getPackedContent();
$meta = $current->_data;
}
$text = str_replace("* [{$pagename}]", "", $text);
$meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
$meta['author'] = user_getname();
$pagehandle->save($text, $version + 1, $meta);
//Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
require_once 'common/wiki/lib/WikiPage.class.php';
$wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
$wiki_page->resetPermissions();
// Real delete.
//$pagename = $page->getName();
$dbi = $request->getDbh();
$dbi->deletePage($pagename);
$dbi->touch();
$link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
$html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
}
GeneratePage($html, _("Remove Page"));
}
示例11: __construct
public function __construct($user = null)
{
if ($user) {
$linksLeft = ['home' => '/', 'records' => '/records', 'totals' => '/totals', 'todos' => '/todos'];
$linksRight = ['logout' => '/login', $user->__toString() => '/user'];
} else {
$linksLeft = ['home' => '/'];
$linksRight = ['login' => '/login', 'register' => '/user'];
}
$this->menu = HTML::div(['.menuBar'], HTML::div(['.menuLeft'], HTML::menu($linksLeft)) . HTML::div(['.menuRight'], HTML::menu($linksRight)));
}
示例12: Textarea
function Textarea($textarea, $wikitext, $name = 'edit[content]')
{
global $request;
$htmltextid = $this->_htmltextid;
$textarea->SetAttr('id', $htmltextid);
$iframe0 = new RawXml('<iframe id="iframe0" src="blank.htm" height="0" width="0" frameborder="0"></iframe>');
if ($request->getArg('mode') and $request->getArg('mode') == 'wysiwyg') {
$out = HTML(HTML::div(array('class' => 'hint'), _("Warning: This Wikiwyg editor has only Beta quality!")), $textarea, $iframe0, "\n");
} else {
$out = HTML($textarea, $iframe0, "\n");
}
return $out;
}
示例13: chmarkupPages
function chmarkupPages(&$dbi, &$request, $pages, $newmarkup)
{
$result = HTML::div();
$ul = HTML::ul();
$count = 0;
foreach ($pages as $name) {
$page = $dbi->getPage($name);
$current = $page->getCurrentRevision();
$markup = $current->get('markup');
if (!$markup or $newmarkup != $markup) {
if (!mayAccessPage('change', $name)) {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p(fmt("Access denied to change page '%s'.", WikiLink($name))));
} else {
$version = $current->getVersion();
$meta = $current->_data;
$meta['markup'] = $newmarkup;
// convert text?
$text = $current->getPackedContent();
$meta['summary'] = sprintf(_("Change markup type from %s to %s"), $markup, $newmarkup);
$meta['is_minor_edit'] = 1;
$meta['author'] = $request->_user->UserName();
unset($meta['mtime']);
// force new date
$page->save($text, $version + 1, $meta);
$current = $page->getCurrentRevision();
if ($current->get('markup') === $newmarkup) {
$ul->pushContent(HTML::li(fmt("change page '%s' to markup type '%s'.", WikiLink($name), $newmarkup)));
$count++;
} else {
$ul->pushContent(HTML::li(fmt("Couldn't change page '%s' to markup type '%s'.", WikiLink($name), $newmarkup)));
}
}
}
}
if ($count) {
$dbi->touch();
$result->setAttr('class', 'feedback');
if ($count == 1) {
$result->pushContent(HTML::p("One page has been permanently changed:"));
} else {
$result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count)));
}
$result->pushContent($ul);
return $result;
} else {
$result->setAttr('class', 'error');
$result->pushContent(HTML::p("No pages changed."));
return $result;
}
}
示例14: Textarea_PHP
function Textarea_PHP($textarea, $wikitext, $name = 'edit[content]')
{
global $LANG;
$this->FilePath = realpath(PHPWIKI_DIR . '/themes/default/FCKeditor') . "/";
$htmltextid = "edit-content";
include_once $this->FilePath . 'fckeditor.php';
$this->oFCKeditor = new FCKeditor($htmltextid);
$this->oFCKeditor->BasePath = $this->BasePath;
$this->oFCKeditor->Value = $textarea->_content[0]->asXML();
$this->oFCKeditor->Config['AutoDetectLanguage'] = true;
$this->oFCKeditor->Config['DefaultLanguage'] = $LANG;
$this->oFCKeditor->Create();
return HTML::div(array("id" => $this->_wikitextid, 'style' => 'display:none'), $wikitext);
}
示例15: run
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);
if (empty($this->source)) {
return HTML::div(array('class' => "error"), "Please provide a formula to AsciiMath plugin");
}
if (phpversion() >= '5') {
include "lib/ASCIIMathPHP/ASCIIMathPHP-2.0.cfg.php";
} else {
include "lib/ASCIIMathPHP/ASCIIMathPHP.cfg.php";
}
$ascii_math = new ASCIIMathPHP($symbol_arr, $this->source);
$ascii_math->genMathML();
return HTML::raw($ascii_math->getMathML());
}