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


PHP Administration::instance方法代码示例

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


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

示例1: initaliseAdminPageHead

 public function initaliseAdminPageHead($context)
 {
     if (!extension_loaded('gd')) {
         Administration::instance()->Page->pageAlert(__('You don\'t have the GD library installed. Admin Rainbow Headline will remain disabled until you\'ve installed it.'), Alert::ERROR);
         return;
     }
     $page = Administration::instance()->Page;
     $color = General::Sanitize(Symphony::Configuration()->get('headline_color', 'admin_rainbow_headline'));
     if ($color != "" && $color != "#") {
         $rgb = sscanf($color, '#%2x%2x%2x');
         $luminance = 0.2126 * $rgb[0] + 0.7151999999999999 * $rgb[1] + 0.0722 * $rgb[2];
         $style = "\n\t\t\t\t\t\tbody #header h1 { background-color: " . $color . "; }";
         if ($luminance > 125) {
             $style .= "\n\t\t\t\t\t\tbody #header a { color: #333333; text-shadow: -1px 2px 3px rgba(0,0,0,0.3); }\n\t\t\t\t\t\tbody #header a:hover { color: #000000; }";
         }
         $page->addElementToHead(new XMLElement("style", $style, array("type" => "text/css", "media" => "screen, projection")), 100012);
         $imagehandle = imagecreatetruecolor(16, 16);
         $colorhandle = imagecolorallocate($imagehandle, $rgb[0], $rgb[1], $rgb[2]);
         imagefill($imagehandle, 0, 0, $colorhandle);
         ob_start();
         imagepng($imagehandle);
         $ico64data = base64_encode(ob_get_contents());
         ob_end_clean();
         $page->addElementToHead(new XMLElement("link", NULL, array("rel" => "shortcut icon", "href" => "data:image/png;base64," . $ico64data, "type" => "image/png")), 100013);
         unset($colorhandle);
         unset($ico64data);
         imagedestroy($imagehandle);
     }
 }
开发者ID:nils-werner,项目名称:admin_rainbow_headline,代码行数:29,代码来源:extension.driver.php

示例2: Context

 public function Context()
 {
     if (class_exists('Frontend')) {
         return (object) Frontend::instance();
     }
     return (object) Administration::instance();
 }
开发者ID:klaftertief,项目名称:entry_versions,代码行数:7,代码来源:class.entryversionsmanager.php

示例3: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:gpichurov,项目名称:ittalents_season5,代码行数:7,代码来源:Administration.php

示例4: __appendAssets

 public function __appendAssets($context)
 {
     if (isset(Administration::instance()->Page->_context['section_handle']) && in_array(Administration::instance()->Page->_context['page'], array('new', 'edit'))) {
         Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/multiselect_to_checkboxes/assets/mtoc.css', 'screen', 221);
         Administration::instance()->Page->addScriptToHead(URL . '/extensions/multiselect_to_checkboxes/assets/jquery.symphony.mtoc.js', 222);
     }
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:7,代码来源:extension.driver.php

示例5: initaliseAdminPageHead

 public function initaliseAdminPageHead($context)
 {
     $page = Administration::instance()->Page;
     if ($page instanceof contentPublish) {
         $callback = Administration::instance()->getPageCallback();
         if ($callback['context']['page'] !== 'edit') {
             return;
         }
         $sm = new SectionManager(Administration::instance());
         $current_section = $sm->fetch($sm->fetchIDFromHandle($callback['context']['section_handle']));
         $current_section_hash = $this->serialiseSectionSchema($current_section);
         $duplicate_sections = array();
         foreach ($sm->fetch() as $section) {
             $section_hash = $this->serialiseSectionSchema($section);
             if ($section_hash == $current_section_hash && $section->get('handle')) {
                 $duplicate_sections[$section->get('handle')] = $section->get('name');
             }
         }
         if (count($duplicate_sections) < 2) {
             $duplicate_sections = NULL;
         }
         Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('duplicate-entry', " . json_encode(array('current-section' => $callback['context']['section_handle'], 'duplicate-sections' => $duplicate_sections)) . ");", array('type' => 'text/javascript')), time());
         $page->addScriptToHead(URL . '/extensions/duplicate_entry/assets/duplicate_entry.js', 10001);
         // add particular css for SSM
         Administration::instance()->Page->addElementToHead(new XMLElement('style', "body.inline.subsection #duplicate-entry { display: none; visibility: collapse }", array('type' => 'text/css')), time() + 101);
     }
 }
开发者ID:symphonists,项目名称:duplicate_entry,代码行数:27,代码来源:extension.driver.php

示例6: cleanupSections

 public function cleanupSections($context)
 {
     $callback = Administration::instance()->getPageCallback();
     if ($callback['driver'] === 'blueprintssections') {
         MigrationManager::cleanup();
     }
 }
开发者ID:rainerborene,项目名称:schema_migration,代码行数:7,代码来源:extension.driver.php

示例7: __construct

 public function __construct($args)
 {
     $this->_Parent =& $args['parent'];
     $this->_callback = Administration::instance()->getPageCallback();
     $this->_section = $this->getSection();
     $this->_static = $this->isStaticSection();
 }
开发者ID:knupska,项目名称:static_section,代码行数:7,代码来源:extension.driver.php

示例8: dInitialiseAdminPageHead

 public function dInitialiseAdminPageHead()
 {
     if (!$this->getValidDependencies()) {
         $message = __('Sections Event depends on Members and EXSL Function Manager extensions. Make sure they are installed.');
         Administration::instance()->Page->pageAlert($message, Alert::NOTICE);
     }
 }
开发者ID:andrewminton,项目名称:sections_event,代码行数:7,代码来源:extension.driver.php

示例9: __viewIndex

 public function __viewIndex()
 {
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Utilities'))));
     $this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new utility'), 'class' => 'create button')));
     $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
     $utilities = $utilities['filelist'];
     $uTableHead = array(array(__('Name'), 'col'));
     $uTableBody = array();
     $colspan = count($uTableHead);
     if (!is_array($utilities) or empty($utilities)) {
         $uTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
     } else {
         foreach ($utilities as $util) {
             $uRow = Widget::TableData(Widget::Anchor($util, ADMIN_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/'));
             $uRow->appendChild(Widget::Input("items[{$util}]", null, 'checkbox'));
             $uTableBody[] = Widget::TableRow(array($uRow));
         }
     }
     $table = Widget::Table(Widget::TableHead($uTableHead), null, Widget::TableBody($uTableBody), array('id' => 'utilities-list'));
     $this->Form->appendChild($table);
     $tableActions = $this->createElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:27,代码来源:content.blueprintsutilities.php

示例10: driver

 public static function driver()
 {
     if (class_exists('Administration')) {
         return Administration::instance()->Configuration;
     }
     return Frontend::instance()->Configuration;
 }
开发者ID:bauhouse,项目名称:library,代码行数:7,代码来源:class.configurationaccessor.php

示例11: __dbConnectionResource

 private static function __dbConnectionResource()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database->getConnectionResource();
     }
     return Administration::instance()->Database->getConnectionResource();
 }
开发者ID:bauhouse,项目名称:sym-spectrum-members,代码行数:7,代码来源:class.asdc.php

示例12: appendAssets

 public static function appendAssets()
 {
     if (class_exists('Administration') && Administration::instance() instanceof Administration && Administration::instance()->Page instanceof HTMLPage) {
         Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/field_metakeys/assets/field_metakeys.publish.css', 'screen', 100, false);
         Administration::instance()->Page->addScriptToHead(URL . '/extensions/field_metakeys/assets/field_metakeys.publish.js', 100, false);
     }
 }
开发者ID:korelogic,项目名称:field_metakeys,代码行数:7,代码来源:extension.driver.php

示例13: initializeAdmin

 public function initializeAdmin($context)
 {
     $page = Administration::instance()->Page;
     $context = $page->getContext();
     $callback = Administration::instance()->getPageCallback();
     // only proceed on New or Edit publish pages
     if ($page instanceof contentPublish and in_array($context['page'], array('new', 'edit'))) {
         $page->addStylesheetToHead(URL . '/extensions/publish_tabs/assets/publish_tabs.publish.css', 'screen', 9001);
         $page->addScriptToHead(URL . '/extensions/publish_tabs/assets/publish_tabs.publish.js', 9002);
         include_once TOOLKIT . '/class.sectionmanager.php';
         $section_id = SectionManager::fetchIDFromHandle($callback['context']['section_handle']);
         $section = SectionManager::fetch($section_id);
         if (!$section instanceof Section) {
             return;
         }
         $tabs = array();
         $current_tab = '';
         $index = -1;
         foreach ($section->fetchFieldsSchema() as $i => $field) {
             if ($i == 0 && $field['type'] != 'publish_tabs') {
                 $current_tab = 'untitled-tab';
                 $tabs[++$index]['tab_id'] = $current_tab;
             }
             if ($field['type'] == 'publish_tabs') {
                 $current_tab = $field['id'];
                 $tabs[++$index]['tab_id'] = $current_tab;
             } else {
                 $tabs[$index][$field['location']][] = 'field-' . $field['id'];
             }
         }
         $page->addElementToHead(new XMLElement('script', "Symphony.Context.add('publish-tabs', " . json_encode($tabs) . ")", array('type' => 'text/javascript')), 9003);
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:33,代码来源:extension.driver.php

示例14: __appendAlert

 /**
  * Append notice that the site is currently in maintenance mode offering a link
  * to switch to live mode if no other alert is set.
  *
  * @param array $context
  *  delegate context
  */
 public function __appendAlert($context)
 {
     // Site in maintenance mode
     if (Symphony::Configuration()->get('enabled', 'maintenance_mode') == 'yes') {
         Administration::instance()->Page->pageAlert(__('This site is currently in maintenance mode.') . ' <a href="' . SYMPHONY_URL . '/system/preferences/?action=toggle-maintenance-mode&amp;redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE);
     }
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:14,代码来源:extension.driver.php

示例15: start

 public static function start($lifetime = 0, $path = '/', $domain = NULL)
 {
     if (!self::$_initialized) {
         ## Crude method of determining if we're in the admin or frontend
         if (class_exists('Frontend')) {
             self::$_db =& Frontend::instance()->Database;
         } elseif (class_exists('Administration')) {
             self::$_db =& Administration::instance()->Database;
         } else {
             return false;
         }
         if (!is_object(self::$_db) || !self::$_db->isConnected()) {
             return false;
         }
         self::$_cache = new Cacheable(self::$_db);
         $installed = self::$_cache->check('_session_config');
         if (!$installed) {
             if (!self::createTable()) {
                 return false;
             }
             self::$_cache->write('_session_config', true);
         }
         ini_set('session.save_handler', 'user');
         session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
         session_set_cookie_params($lifetime, $path, $domain ? $domain : self::getDomain(), false, false);
         self::$_initialized = true;
         if (session_id() == '') {
             session_start();
         }
     }
     return session_id();
 }
开发者ID:bauhouse,项目名称:sym-fluid960gs,代码行数:32,代码来源:class.session.php


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