本文整理汇总了PHP中HTMLPage类的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPage类的具体用法?PHP HTMLPage怎么用?PHP HTMLPage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* This method initializes the `$result`, `$sort` and `$order` variables by using the
* `$_REQUEST` array. The `$result` is passed by reference, and is return of calling the
* `$object->sort()` method. It is this method that actually invokes the sorting inside
* the `$object`.
*
* @param HTMLPage $object
* The object responsible for sorting the items. It must implement a `sort()` method.
* @param array $result
* This variable stores an array sorted objects. Once set, its value is available
* to the client class of Sortable.
* @param string $sort
* This variable stores the field (or axis) the objects are sorted by. Once set,
* its value is available to the client class of `Sortable`.
* @param string $order
* This variable stores the sort order (i.e. 'asc' or 'desc'). Once set, its value
* is available to the client class of Sortable.
* @param array $params (optional)
* An array of parameters that can be passed to the context-based method.
*/
public static function initialize(HTMLPage $object, &$result, &$sort, &$order, array $params = array())
{
if (isset($_REQUEST['sort'])) {
$sort = $_REQUEST['sort'];
} else {
$sort = null;
}
if (isset($_REQUEST['order'])) {
$order = $_REQUEST['order'] == 'desc' ? 'desc' : 'asc';
} else {
$order = null;
}
$result = $object->sort($sort, $order, $params);
}
示例2: display
/**
* Called by index.php, this function is responsible for rendering the current
* page on the Frontend. Two delegates are fired, AdminPagePreGenerate and
* AdminPagePostGenerate. This function runs the Profiler for the page build
* process.
*
* @uses AdminPagePreGenerate
* @uses AdminPagePostGenerate
* @see core.Symphony#__buildPage()
* @see boot.getCurrentPage()
* @param string $page
* The result of getCurrentPage, which returns the $_GET['symphony-page']
* variable.
* @throws Exception
* @throws SymphonyErrorPage
* @return string
* The HTML of the page to return
*/
public function display($page)
{
Symphony::Profiler()->sample('Page build process started');
$this->__buildPage($page);
// Add XSRF token to form's in the backend
if (self::isXSRFEnabled() && isset($this->Page->Form)) {
$this->Page->Form->prependChild(XSRF::formToken());
}
/**
* Immediately before generating the admin page. Provided with the page object
* @delegate AdminPagePreGenerate
* @param string $context
* '/backend/'
* @param HTMLPage $oPage
* An instance of the current page to be rendered, this will usually be a class that
* extends HTMLPage. The Symphony backend uses a convention of contentPageName
* as the class that extends the HTMLPage
*/
Symphony::ExtensionManager()->notifyMembers('AdminPagePreGenerate', '/backend/', array('oPage' => &$this->Page));
$output = $this->Page->generate();
/**
* Immediately after generating the admin page. Provided with string containing page source
* @delegate AdminPagePostGenerate
* @param string $context
* '/backend/'
* @param string $output
* The resulting backend page HTML as a string, passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('AdminPagePostGenerate', '/backend/', array('output' => &$output));
Symphony::Profiler()->sample('Page built');
return $output;
}
示例3: __construct
public function __construct($html, $encoding, $pageNumber, $paragraphsPerPage = HTMLPager::PARAGRAPH_LIMIT)
{
$dom = new DOMDocument();
libxml_use_internal_errors(true);
libxml_clear_errors();
// clean up any errors belonging to other operations
$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', $encoding));
foreach (libxml_get_errors() as $error) {
Kurogo::log(LOG_WARNING, "HTMLPager got loadHTML warning (line {$error->line}; column {$error->column}) {$error->message}", 'data');
}
libxml_clear_errors();
// free up memory associated with the errors
libxml_use_internal_errors(false);
$body = $dom->getElementsByTagName("body")->item(0);
$currentPage = NULL;
$pages = array();
$currentParagraphCount = 0;
foreach ($body->childNodes as $node) {
if ($currentPage == NULL) {
// need to start a new page
if ($node->nodeName == "#text" && trim($node->nodeValue) == "") {
continue;
// this node is blank so do not start a new page yet
}
$currentPage = new HTMLPage();
$pages[] = $currentPage;
}
$currentPage->addNode($node);
if ($node->nodeName == "p") {
$currentParagraphCount++;
}
if ($currentParagraphCount == $paragraphsPerPage) {
$currentPage = NULL;
$currentParagraphCount = 0;
}
}
$this->pages = $pages;
$this->pageCount = count($pages);
if ($pageNumber >= 0 && $pageNumber < $this->pageCount) {
$this->pageNumber = $pageNumber;
}
}
示例4: index
public function index()
{
if ($post = $this->input->post('contact')) {
$validation = new Validation($post);
$validation->pre_filter('trim')->add_rules('email', 'email', 'required')->add_rules('subject', 'required')->add_rules('body', 'required');
if (!$validation->validate()) {
return $this->template->content = Kohana::debug($validation->errors());
}
$post = $validation->as_array();
$message = sprintf("%s used the contact form to say: \n\n %s", $post['email'], $post['body']);
$subject = sprintf('[ProjectsLounge Contact] %s', $post['subject']);
email::send('horia@hdragomir.com', 'contact@projectslounge.com', $subject, $message);
return url::redirect('contact/thanks');
}
HTMLPage::add_style('forms');
HTMLPage::add_style('contact');
$this->template->content = View::factory('contact/form');
}
示例5: HTMLPage
<?php
include_once TOOLKIT . '/class.htmlpage.php';
$Page = new HTMLPage();
$Page->Html->setElementStyle('html');
$Page->Html->setDTD('<!DOCTYPE html>');
$Page->Html->setAttribute('xml:lang', 'en');
$Page->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$Page->addStylesheetToHead(URL . '/symphony/assets/error.css', 'screen', 30);
$Page->addHeaderToPage('HTTP/1.0 500 Server Error');
$Page->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$Page->addHeaderToPage('Symphony-Error-Type', 'database');
$Page->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Database Error'))));
$div = new XMLElement('div', NULL, array('id' => 'description'));
$div->appendChild(new XMLElement('h1', __('Symphony Database Error')));
$div->appendChild(new XMLElement('p', $additional['message']));
$div->appendChild(new XMLElement('p', '<code>' . $additional['error']['num'] . ': ' . $additional['error']['msg'] . '</code>'));
if (!empty($error['query'])) {
$div->appendChild(new XMLElement('p', '<code>' . $additional['error']['query'] . '</code>'));
}
$Page->Body->appendChild($div);
print $Page->generate();
exit;
示例6: build
/**
* Called when page is generated, this function calls each of the other
* other functions in this page to build the Header, the Navigation,
* the Jump menu and finally the content. This function calls it's parent
* generate function
*
* @see toolkit.HTMLPage#generate()
* @return string
*/
public function build()
{
$this->buildIncludes();
$header = new XMLElement('div');
$header->setAttribute('id', 'header');
$jump = new XMLElement('div');
$jump->setAttribute('id', 'jump');
$content = new XMLElement('div');
$content->setAttribute('id', 'content');
$this->buildHeader($header);
$this->buildNavigation($header);
$this->buildJump($jump);
$header->appendChild($jump);
$this->Body->appendChild($header);
$this->buildContent($content);
$this->Body->appendChild($content);
return parent::generate();
}
示例7: HTMLPage
<?php
include_once TOOLKIT . '/class.htmlpage.php';
$Page = new HTMLPage();
$Page->Html->setElementStyle('html');
$Page->Html->setDTD('<!DOCTYPE html>');
$Page->Html->setAttribute('xml:lang', 'en');
$Page->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$Page->addStylesheetToHead(SYMPHONY_URL . '/assets/basic.css', 'screen', 30);
$Page->addStylesheetToHead(SYMPHONY_URL . '/assets/error.css', 'screen', 30);
$Page->addHeaderToPage('HTTP/1.0 500 Server Error');
$Page->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$Page->addHeaderToPage('Symphony-Error-Type', 'xslt');
$Page->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('XSLT Processing Error'))));
$div = new XMLElement('div', NULL, array('id' => 'description'));
$div->appendChild(new XMLElement('h1', __('XSLT Processing Error')));
$div->appendChild(new XMLElement('p', __('This page could not be rendered due to the following XSLT processing errors.')));
$Page->Body->appendChild($div);
$ul = new XMLElement('ul', NULL, array('id' => 'details'));
$errors_grouped = array();
list($key, $val) = $e->getAdditional()->proc->getError(false, true);
do {
if (preg_match('/^loadXML\\(\\)/i', $val['message']) && preg_match_all('/line:\\s+(\\d+)/i', $val['message'], $matches)) {
$errors_grouped['xml'][] = array('line' => $matches[1][0], 'raw' => $val);
} elseif (preg_match_all('/pages\\/([^.\\/]+\\.xsl)\\s+line\\s+(\\d+)/i', $val['message'], $matches)) {
$errors_grouped['page'][$matches[1][0]][] = array('line' => $matches[2][0], 'raw' => $val);
} elseif (preg_match_all('/utilities\\/([^.\\/]+\\.xsl)\\s+line\\s+(\\d+)/i', $val['message'], $matches)) {
$errors_grouped['utility'][$matches[1][0]][] = array('line' => $matches[2][0], 'raw' => $val);
} else {
$errors_grouped['general'][] = $val;
}
示例8: edit
public function edit($id)
{
$user = User_Model::current();
$project = ORM::factory('project', $id);
if (!$user->loaded && $project->user_can($user, 'edit')) {
return $this->template->content = 'oh, come on!';
}
if ($post = $this->input->post('project')) {
$validation = Projects_utils::projects_edit_validation($post);
if (!$project->validate($validation, true)) {
return $this->template->content = Kohana::debug($validation->errors());
}
if ($additional_user_emails = $this->input->post('additional_user_emails')) {
$additional_user_roles = $this->input->post('additional_user_roles');
foreach ($additional_user_emails as $email) {
Profiles_utils::reserve_email_if_available($email);
}
$additional_users = array_combine($additional_user_emails, $additional_user_roles);
$project->add_user_roles($additional_users);
}
url::redirect($project->local_url);
} else {
HTMLPage::add_style('forms');
$this->template->content = View::factory('projects/edit')->bind('project_types', Projects_utils::get_project_types_dropdown_array())->bind('project', $project)->bind('user', $user);
}
}
示例9: HTMLPage
<?php
include_once TOOLKIT . '/class.htmlpage.php';
$Page = new HTMLPage();
$Page->Html->setElementStyle('html');
$Page->Html->setDTD('<!DOCTYPE html>');
$Page->Html->setAttribute('xml:lang', 'en');
$Page->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$Page->addElementToHead(new XMLElement('link', NULL, array('rel' => 'icon', 'href' => URL . '/symphony/assets/images/bookmark.png', 'type' => 'image/png')), 20);
$Page->addStylesheetToHead(URL . '/symphony/assets/error.css', 'screen', 30);
$Page->addHeaderToPage('HTTP/1.0 500 Server Error');
$Page->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$Page->addHeaderToPage('Symphony-Error-Type', 'generic');
if (isset($additional['header'])) {
$Page->addHeaderToPage($additional['header']);
}
$Page->setTitle(__('%1$s – %2$s', array(__('Symphony'), $heading)));
$div = new XMLElement('div', NULL, array('id' => 'description'));
$div->appendChild(new XMLElement('h1', $heading));
$div->appendChild(is_object($errstr) ? $errstr : new XMLElement('p', trim($errstr)));
$Page->Body->appendChild($div);
print $Page->generate();
exit;
示例10: HTMLPage
<?php
include_once TOOLKIT . '/class.htmlpage.php';
$Page = new HTMLPage();
$Page->Html->setElementStyle('html');
$Page->Html->setDTD('<!DOCTYPE html>');
$Page->Html->setAttribute('xml:lang', 'en');
$Page->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$Page->addStylesheetToHead(SYMPHONY_URL . '/assets/css/symphony.css', 'screen', 30);
$Page->addStylesheetToHead(SYMPHONY_URL . '/assets/css/symphony.frames.css', 'screen', 31);
$Page->addHeaderToPage('Status', '500 Internal Server Error', 500);
$Page->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$Page->addHeaderToPage('Symphony-Error-Type', 'generic');
if (isset($e->getAdditional()->header)) {
$Page->addHeaderToPage($e->getAdditional()->header);
}
$Page->setTitle(__('%1$s – %2$s', array(__('Symphony'), $e->getHeading())));
$Page->Body->setAttribute('id', 'error');
$div = new XMLElement('div', NULL, array('class' => 'frame'));
$div->appendChild(new XMLElement('h1', $e->getHeading()));
$div->appendChild($e->getMessageObject() instanceof XMLElement ? $e->getMessageObject() : new XMLElement('p', trim($e->getMessage())));
$Page->Body->appendChild($div);
$output = $Page->generate();
header(sprintf('Content-Length: %d', strlen($output)));
echo $output;
exit;
示例11: array
function __construct(&$parent)
{
parent::__construct();
$this->Html->setElementStyle('html');
$this->_Parent = $parent;
$this->_navigation = array();
$this->Alert = NULL;
}
示例12: __construct
public function __construct(Site $site, $url = null)
{
if (!isset($url)) {
$url = $site->requestUrl;
}
$template = $site->modules->getModulePrefix('PageSystem') . '/page/nopage';
parent::__construct($site, null, $template, array('status' => '404 Not Found', 'requestUrl' => $url));
$this->headers->setContentTypeCharset('utf-8');
$this->headers->setStatus(404, 'Not Found');
$this->title = $this->headers->getStatus();
}
示例13: __construct
public function __construct(&$parent)
{
parent::__construct($parent);
$this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$this->Html->setElementStyle('html');
$this->Html->setDTD('<!DOCTYPE html>');
//PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"
$this->Html->setAttribute('lang', Lang::get());
$this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/basic.css', 'screen', 40);
$this->addStylesheetToHead(SYMPHONY_URL . '/assets/login.css', 'screen', 40);
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Login'))));
Administration::instance()->Profiler->sample('Page template created', PROFILE_LAP);
}
示例14: __construct
public function __construct()
{
parent::__construct();
$this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$this->Html->setElementStyle('html');
$this->Html->setDTD('<!DOCTYPE html>');
$this->Html->setAttribute('lang', Lang::get());
$this->addElementToHead(new XMLElement('meta', null, array('charset' => 'UTF-8')), 0);
$this->addElementToHead(new XMLElement('meta', null, array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1')), 1);
$this->addElementToHead(new XMLElement('meta', null, array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), 2);
$this->addStylesheetToHead(APPLICATION_URL . '/assets/css/symphony.min.css', 'screen', null, false);
$this->setTitle(__('%1$s – %2$s', array(__('Login'), Symphony::Configuration()->get('sitename', 'general'))));
$this->Body->setAttribute('id', 'login');
Symphony::Profiler()->sample('Page template created', PROFILE_LAP);
}
示例15: XMLElement
function __construct(&$parent)
{
parent::__construct();
$this->_Parent = $parent;
$this->_invalidPassword = false;
$this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
$this->Html->setElementStyle('html');
$this->Html->setDTD('<!DOCTYPE html>');
//PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"
$this->Html->setAttribute('lang', __LANG__);
$this->addElementToHead(new XMLElement('meta', NULL, array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8')), 0);
$this->addStylesheetToHead(URL . '/symphony/assets/login.css', 'screen', 40);
$this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Login'))));
$this->_Parent->Profiler->sample('Page template created', PROFILE_LAP);
}