本文整理汇总了PHP中ContentController::add_extension方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentController::add_extension方法的具体用法?PHP ContentController::add_extension怎么用?PHP ContentController::add_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentController
的用法示例。
在下文中一共展示了ContentController::add_extension方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enable
public static function enable($searchableClasses = array('SiteTree'))
{
// Chris Bolt, removed file
// Chris Bolt add site tree extension
SiteTree::add_extension('BoltSearchIndexedSiteTree');
$defaultColumns = array('SiteTree' => '"Title","MenuTitle","Content","MetaDescription","SearchIndex"');
if (!is_array($searchableClasses)) {
$searchableClasses = array($searchableClasses);
}
foreach ($searchableClasses as $class) {
if (!class_exists($class)) {
continue;
}
if (isset($defaultColumns[$class])) {
Config::inst()->update($class, 'create_table_options', array(MySQLSchemaManager::ID => 'ENGINE=MyISAM'));
$class::add_extension("FulltextSearchable('{$defaultColumns[$class]}')");
} else {
throw new Exception("FulltextSearchable::enable() I don't know the default search columns for class '{$class}'");
}
}
self::$searchable_classes = $searchableClasses;
if (class_exists("ContentController")) {
ContentController::add_extension("ContentControllerSearchExtension");
}
}
示例2: enable
/**
* Enable the default configuration of MySQL full-text searching on the given data classes.
* It can be used to limit the searched classes, but not to add your own classes.
* For this purpose, please use {@link Object::add_extension()} directly:
* <code>
* MyObject::add_extension("FulltextSearchable('MySearchableField,'MyOtherField')");
* </code>
*
* Caution: This is a wrapper method that should only be used in _config.php,
* and only be called once in your code.
*
* @param Array $searchableClasses The extension will be applied to all DataObject subclasses
* listed here. Default: {@link SiteTree} and {@link File}.
*/
public static function enable($searchableClasses = array('SiteTree', 'File'))
{
$defaultColumns = array('SiteTree' => '"Title","MenuTitle","Content","MetaDescription"', 'File' => '"Filename","Title","Content"');
if (!is_array($searchableClasses)) {
$searchableClasses = array($searchableClasses);
}
foreach ($searchableClasses as $class) {
if (!class_exists($class)) {
continue;
}
if (isset($defaultColumns[$class])) {
Config::inst()->update($class, 'create_table_options', array('MySQLDatabase' => 'ENGINE=MyISAM'));
$class::add_extension("FulltextSearchable('{$defaultColumns[$class]}')");
} else {
throw new Exception("FulltextSearchable::enable() I don't know the default search columns for class '{$class}'");
}
}
self::$searchable_classes = $searchableClasses;
if (class_exists("ContentController")) {
ContentController::add_extension("ContentControllerSearchExtension");
}
}
示例3: define
<?php
define('MOBILE_DIR', 'mobile');
SiteConfig::add_extension('MobileSiteConfigExtension');
ContentController::add_extension('MobileSiteControllerExtension');
Security::add_extension('MobileSiteControllerExtension');
SiteTree::add_extension('MobileSiteTreeExtension');
示例4: getTempFolder
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomHtmlForms is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CustomHtmlForms. If not, see <http://www.gnu.org/licenses/>.
*
* @package CustomHtmlForm
* @subpackage Config
* @ignore
*/
ContentController::add_extension('CustomHtmlFormPage_Controller');
Security::add_extension('CustomHtmlFormPage_Controller');
SiteConfig::add_extension('CustomHtmlFormConfiguration');
$cacheBaseDir = getTempFolder() . DIRECTORY_SEPARATOR . 'cache';
$cacheDir = $cacheBaseDir . DIRECTORY_SEPARATOR . 'CustomHtmlForm';
if (Director::isDev()) {
$cachelifetime = 1;
} else {
$cachelifetime = 86400;
}
if (!is_dir($cacheDir)) {
if (!is_dir($cacheBaseDir)) {
mkdir($cacheBaseDir);
}
mkdir($cacheDir);
}
示例5: array
<?php
LeftAndMain::require_css('express/css/custom.css');
SiteTree::add_extension('ExpressSiteTree');
ContentController::add_extension('ExpressSiteTree_Controller');
SiteConfig::add_extension('CustomSiteConfig');
// Don't allow h1 in the editor
HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'p,pre,address,h2,h3,h4,h5,h6');
// Add in start and type attributes for ol
HtmlEditorConfig::get('cms')->setOption('extended_valid_elements', 'img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|title|align|allowfullscreen|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt],ol[start|type]');
// Macrons
HtmlEditorConfig::get('cms')->enablePlugins(array('ssmacron' => '../../../framework/thirdparty/tinymce_ssmacron/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsAfter('charmap', 'ssmacron');
GD::set_default_quality(90);
FulltextSearchable::enable();
// Configure document converter.
if (class_exists('DocumentConverterDecorator')) {
DocumentImportIFrameField_Importer::set_docvert_username('ss-express');
DocumentImportIFrameField_Importer::set_docvert_password('hLT7pCaJrYVz');
DocumentImportIFrameField_Importer::set_docvert_url('http://docvert.silverstripe.com:8888/');
Page::add_extension('DocumentConverterDecorator');
}
// Default translations
if (class_exists('Translatable')) {
Translatable::set_default_locale('en_NZ');
Translatable::set_allowed_locales(array('en_NZ', 'mi_NZ', 'zh_cmn', 'en_GB'));
SiteTree::add_extension('Translatable');
SiteConfig::add_extension('Translatable');
}
Config::inst()->update('i18n', 'common_locales', array("mi_NZ" => array(0 => 'Māori')));
Config::inst()->update('i18n', 'common_languages', array("mi" => array(0 => 'Māori')));
示例6:
<?php
/**
* The subsites module modifies the behaviour of the CMS - in the SiteTree and Group databases - to store information
* about a number of sub-sites, rather than a single site.
*/
SiteTree::add_extension('SiteTreeSubsites');
ContentController::add_extension('ControllerSubsites');
CMSPageAddController::add_extension('CMSPageAddControllerExtension');
LeftAndMain::add_extension('LeftAndMainSubsites');
LeftAndMain::add_extension('ControllerSubsites');
Group::add_extension('GroupSubsites');
ErrorPage::add_extension('ErrorPageSubsite');
SiteConfig::add_extension('SiteConfigSubsites');
SS_Report::add_excluded_reports('SubsiteReportWrapper');
//Display in cms menu
SecurityAdmin::add_extension('SubsiteMenuExtension');
CMSMain::add_extension('SubsiteMenuExtension');
CMSPagesController::add_extension('SubsiteMenuExtension');
SubsiteAdmin::add_extension('SubsiteMenuExtension');
CMSSettingsController::add_extension('SubsiteMenuExtension');
CMSMenu::remove_menu_item('SubsiteXHRController');
示例7: define
<?php
// define this directory
define('DEVTOOLS_DIR', 'dev-tools');
// create definition of site name (based on SS_PRIMARY_DOMAIN)
$siteName = SS_PRIMARY_DOMAIN;
$siteName = str_replace('http://', '', $siteName);
$siteName = str_replace('https://', '', $siteName);
$siteName = str_replace('.', '_', $siteName);
define('SS_SITE_NAME', $siteName);
// detect if we're using the old domain and need to flag the issue
$fullDomain = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
if ($fullDomain != SS_PRIMARY_DOMAIN && SS_ENVIRONMENT_TYPE == 'live') {
define('DEVTOOLS_ISOLDDOMAIN', true);
// if we're disabled, include our cms-disabling javascript
Requirements::customScript('var ss_primary_domain = "' . SS_PRIMARY_DOMAIN . '";');
LeftAndMain::require_javascript(DEVTOOLS_DIR . '/js/disable-cms.js');
} else {
define('DEVTOOLS_ISOLDDOMAIN', false);
}
// add functionality to SiteTree
ContentController::add_extension('DebugTools_ContentControllerExtension');
SiteConfig::add_extension('DebugTools_SiteConfigExtension');
Member::add_extension('DebugTools_MemberExtension');
// include css
LeftAndMain::require_css(DEVTOOLS_DIR . '/css/cms.css');
// specify editor css file (this needs to be pure CSS, not SCSS)
HtmlEditorConfig::get('cms')->setOption('content_css', '/site/cms/editor.css');
// enable our log jam logger
LogJam::EnableLog();
示例8:
<?php
/**
* Copyright 2013 pixeltricks GmbH
*
* This file is part of the Widgetsets module.
*
* Widgetsets module is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* It is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this package. If not, see <http://www.gnu.org/licenses/>.
*
* @package Widgetsets
* @subpackage Config
*/
SiteTree::add_extension('WidgetSetPageExtension');
ContentController::add_extension('WidgetSetPageExtension_Controller');
Widget::add_extension('WidgetSetWidgetExtension');
WidgetSetWidgetExtension::preventWidgetCreationByClass('WidgetSetWidget');
示例9:
<?php
//
ContentController::remove_extension('WidgetContentControllerExtension');
ContentController::add_extension('ElementalContentControllerExtension');