本文整理汇总了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);
}
}
示例2: Context
public function Context()
{
if (class_exists('Frontend')) {
return (object) Frontend::instance();
}
return (object) Administration::instance();
}
示例3: getInstance
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例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);
}
}
示例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);
}
}
示例6: cleanupSections
public function cleanupSections($context)
{
$callback = Administration::instance()->getPageCallback();
if ($callback['driver'] === 'blueprintssections') {
MigrationManager::cleanup();
}
}
示例7: __construct
public function __construct($args)
{
$this->_Parent =& $args['parent'];
$this->_callback = Administration::instance()->getPageCallback();
$this->_section = $this->getSection();
$this->_static = $this->isStaticSection();
}
示例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);
}
}
示例9: __viewIndex
public function __viewIndex()
{
$this->setTitle(__('%1$s – %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);
}
示例10: driver
public static function driver()
{
if (class_exists('Administration')) {
return Administration::instance()->Configuration;
}
return Frontend::instance()->Configuration;
}
示例11: __dbConnectionResource
private static function __dbConnectionResource()
{
if (class_exists('Frontend')) {
return Frontend::instance()->Database->getConnectionResource();
}
return Administration::instance()->Database->getConnectionResource();
}
示例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);
}
}
示例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);
}
}
示例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&redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE);
}
}
示例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();
}