当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTimeObj::getDateFormatMappings方法代码示例

本文整理汇总了PHP中DateTimeObj::getDateFormatMappings方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeObj::getDateFormatMappings方法的具体用法?PHP DateTimeObj::getDateFormatMappings怎么用?PHP DateTimeObj::getDateFormatMappings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateTimeObj的用法示例。


在下文中一共展示了DateTimeObj::getDateFormatMappings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 /**
  * This function initialises a lot of the basic elements that make up a Symphony
  * backend page such as the default stylesheets and scripts, the navigation and
  * the footer. Any alerts are also appended by this function. `view()` is called to
  * build the actual content of the page. The `InitialiseAdminPageHead` delegate
  * allows extensions to add elements to the `<head>`.
  *
  * @see view()
  * @uses InitialiseAdminPageHead
  * @param array $context
  *  An associative array describing this pages context. This
  *  can include the section handle, the current entry_id, the page
  *  name and any flags such as 'saved' or 'created'. This list is not exhaustive
  *  and extensions can add their own keys to the array.
  * @throws InvalidArgumentException
  * @throws SymphonyErrorPage
  */
 public function build(array $context = array())
 {
     $this->_context = $context;
     if (!$this->canAccessPage()) {
         Administration::instance()->throwCustomError(__('You are not authorised to access this page.'), __('Access Denied'), Page::HTTP_STATUS_UNAUTHORIZED);
     }
     $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);
     // Add styles
     $this->addStylesheetToHead(ASSETS_URL . '/css/symphony.min.css', 'screen', 2, false);
     // Calculate timezone offset from UTC
     $timezone = new DateTimeZone(Symphony::Configuration()->get('timezone', 'region'));
     $datetime = new DateTime('now', $timezone);
     $timezoneOffset = intval($timezone->getOffset($datetime)) / 60;
     // Add scripts
     $environment = array('root' => URL, 'symphony' => SYMPHONY_URL, 'path' => '/' . Symphony::Configuration()->get('admin-path', 'symphony'), 'route' => getCurrentPage(), 'version' => Symphony::Configuration()->get('version', 'symphony'), 'lang' => Lang::get(), 'user' => array('fullname' => Symphony::Author()->getFullName(), 'name' => Symphony::Author()->get('first_name'), 'type' => Symphony::Author()->get('user_type'), 'id' => Symphony::Author()->get('id')), 'datetime' => array('formats' => DateTimeObj::getDateFormatMappings(), 'timezone-offset' => $timezoneOffset), 'env' => array_merge(array('page-namespace' => Symphony::getPageNamespace()), $this->_context));
     $this->addElementToHead(new XMLElement('script', json_encode($environment), array('type' => 'application/json', 'id' => 'environment')), 4);
     $this->addScriptToHead(ASSETS_URL . '/js/symphony.min.js', 6, false);
     // Initialise page containers
     $this->Wrapper = new XMLElement('div', null, array('id' => 'wrapper'));
     $this->Header = new XMLElement('header', null, array('id' => 'header'));
     $this->Context = new XMLElement('div', null, array('id' => 'context'));
     $this->Breadcrumbs = new XMLElement('div', null, array('id' => 'breadcrumbs'));
     $this->Contents = new XMLElement('div', null, array('id' => 'contents', 'role' => 'main'));
     $this->Form = Widget::Form(Administration::instance()->getCurrentPageURL(), 'post', null, null, array('role' => 'form'));
     /**
      * Allows developers to insert items into the page HEAD. Use
      * `Administration::instance()->Page` for access to the page object.
      *
      * @since In Symphony 2.3.2 this delegate was renamed from
      *  `InitaliseAdminPageHead` to the correct spelling of
      *  `InitialiseAdminPageHead`. The old delegate is supported
      *  until Symphony 3.0
      *
      * @delegate InitialiseAdminPageHead
      * @param string $context
      *  '/backend/'
      */
     Symphony::ExtensionManager()->notifyMembers('InitialiseAdminPageHead', '/backend/');
     Symphony::ExtensionManager()->notifyMembers('InitaliseAdminPageHead', '/backend/');
     $this->addHeaderToPage('Content-Type', 'text/html; charset=UTF-8');
     $this->addHeaderToPage('Cache-Control', 'no-cache, must-revalidate, max-age=0');
     $this->addHeaderToPage('Expires', 'Mon, 12 Dec 1982 06:14:00 GMT');
     $this->addHeaderToPage('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
     $this->addHeaderToPage('Pragma', 'no-cache');
     // If not set by another extension, lock down the backend
     if (!array_key_exists('x-frame-options', $this->headers())) {
         $this->addHeaderToPage('X-Frame-Options', 'SAMEORIGIN');
     }
     if (!array_key_exists('access-control-allow-origin', $this->headers())) {
         $this->addHeaderToPage('Access-Control-Allow-Origin', URL);
     }
     if (isset($_REQUEST['action'])) {
         $this->action();
         Symphony::Profiler()->sample('Page action run', PROFILE_LAP);
     }
     $h1 = new XMLElement('h1');
     $h1->appendChild(Widget::Anchor(Symphony::Configuration()->get('sitename', 'general'), rtrim(URL, '/') . '/'));
     $this->Header->appendChild($h1);
     $this->appendUserLinks();
     $this->appendNavigation();
     // Add Breadcrumbs
     $this->Context->prependChild($this->Breadcrumbs);
     $this->Contents->appendChild($this->Form);
     $this->view();
     $this->appendAlert();
     Symphony::Profiler()->sample('Page content created', PROFILE_LAP);
 }
开发者ID:roshinebagha,项目名称:Symphony-Test,代码行数:88,代码来源:class.administrationpage.php


注:本文中的DateTimeObj::getDateFormatMappings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。