本文整理汇总了PHP中DataObject::add_extension方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::add_extension方法的具体用法?PHP DataObject::add_extension怎么用?PHP DataObject::add_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject::add_extension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupOnce
public function setupOnce()
{
parent::setupOnce();
$this->resetDBSchema();
// apply the ChangesetTrackable extension
DataObject::add_extension('SiteTree', 'ChangesetTrackable');
}
示例2: add_sortable_class
public static function add_sortable_class($className)
{
if (!self::is_sortable_class($className)) {
DataObject::add_extension($className, 'SortableDataObject');
self::$sortable_classes[] = $className;
}
}
示例3: add_sortable_class
public static function add_sortable_class($className)
{
DataObject::add_extension($className, 'SortableDataObject');
$dir = self::$sort_dir;
singleton($className)->set_stat("default_sort", "SortOrder {$dir}");
self::$sortable_classes[] = $className;
}
示例4: allow_assets_override
public static function allow_assets_override($bool)
{
if($bool) {
DataObject::add_extension("Folder","AssetManagerFolder");
SortableDataObject::add_sortable_class("File");
}
else
DataObject::remove_extension("Folder","AssetManagerFolder");
}
示例5: enable
/**
* Enable ClickBank module
*/
public static function enable()
{
DataObject::add_extension('SiteConfig', 'ClickBankSiteConfig');
if (class_exists('MemberProfileExtension')) {
DataObject::add_extension('MemberProfilePage', 'MemberProfilePageExtension');
DataObject::add_extension('MemberProfilePage_Controller', 'MemberProfilePageExtension_Controller');
DataObject::add_extension('Member', 'ClickBankMemberProfileExtension');
}
}
示例6: add_sortable_many_many_relations
/**
* Used in _config to set up any many_many sortable relationships.
*
* @param array where $key is the DataObject with the many_many relationships set on it
* and the $value is the name of the relationship.
*/
public static function add_sortable_many_many_relations(array $classes)
{
foreach ($classes as $id => $keys) {
$keys = (array) $keys;
$ownerClass = $id;
DataObject::add_extension($ownerClass, 'ManyManySortable');
foreach ($keys as $value) {
$componentName = $value;
self::add_sortable_many_many_relation($ownerClass, $componentName);
}
}
}
示例7: realpath
SortableDataObject::add_sortable_class('GetInvolvedDownload');
SortableDataObject::add_sortable_class('LearnDownload');
SortableDataObject::add_sortable_class('LearnLink');
SortableDataObject::add_sortable_class('Staff');
SortableDataObject::add_sortable_class('Collaborator');
SortableDataObject::add_sortable_class('KeyContact');
SortableDataObject::add_sortable_class('MediaReleaseDownload');
SortableDataObject::add_sortable_class('MediaReleaseLink');
SortableDataObject::add_sortable_class('YoutubeLink');
SortableDataObject::add_sortable_class('ActionLink');
SortableDataObject::add_sortable_class('FormCategory');
SortableDataObject::add_sortable_class('FormItem');
// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('lyc');
// Add custom SiteConfig data
DataObject::add_extension('SiteConfig', 'CustomSiteConfig');
Object::add_extension('DataObjectSet', 'DataObjectSetExtension');
//Object::add_extension('Member','MemberProfileExtension');
// log errors and warnings
//SS_Log::add_writer(new SS_LogFileWriter('/log'), SS_Log::WARN, '<=');
// or just errors
//SS_Log::add_writer(new SS_LogFileWriter('/log'), SS_Log::ERR);
ini_set('memory_limit', '1000M');
define('TESTING_ENTRY_FORM', false);
define('TESTING_EMAIL', 'davis.dimalen@gmail.com');
define('EMAIL_ADMINS', 'davis.dimalen@gmail.com, davis.dimalen@gmail.com');
define('TOAST_ADMIN', 'davis.dimalen@gmail.com');
$zend_lib_path = realpath('..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '_lib/ZendFramework/library';
set_include_path($zend_lib_path . PATH_SEPARATOR . get_include_path());
EventFilterForm::disable_all_security_tokens();
示例8:
<?php
DataObject::add_extension('Page', 'UnderConstruction_Decorator');
DataObject::add_extension('Page_Controller', 'UnderConstruction_Extension');
DataObject::add_extension('SiteConfig', 'UnderConstruction_Settings');
示例9: define
* @package securefiles
* @author Hamish Campbell <hn.campbell@gmail.com>
* @copyright copyright (c) 2010, Hamish Campbell
*/
define('MODULE_SECUREFILES_PATH', basename(dirname(__FILE__)));
Director::addRules(50, array(ASSETS_DIR . '/$Action' => 'SecureFileController'));
AssetAdmin::require_css(MODULE_SECUREFILES_PATH . '/css/SecureFiles.css');
// -------------------------------
/**
* Apply optional permission methods here. Include them in the reverse
* order that you would like them to appear in the CMS.
*/
// Assign file security by individual member:
// DataObject::add_extension('File', 'SecureFileMemberPermissionDecorator');
// Assign file security by member group:
// DataObject::add_extension('File', 'SecureFileGroupPermissionDecorator');
// Create time-limited access tokens:
// DataObject::add_extension('File', 'SecureFileTokenPermissionDecorator');
// -------------------------------
DataObject::add_extension('File', 'SecureFileDecorator');
/**
* For large files or heavily trafficed sites use x-sendfile headers to by-pass
* file handling in PHP. Supported in lighttpd and in Apache with mod_xsendfile
* available at http://tn123.ath.cx/mod_xsendfile/
*/
// SecureFileController::use_x_sendfile_method();
/**
* For testing or debug purposes, you can force this module to use the internal
* Sapphire send file method. Not recommended for production sites.
*/
// SecureFileController::use_ss_sendfile_method();
示例10: array
{
static $db = array('Name' => 'Varchar(50)');
protected function validate()
{
if (!empty($this->Name)) {
return new ValidationResult();
} else {
return new ValidationResult(false, "This object needs a name. Otherwise it will have an identity crisis!");
}
}
}
class DataObjectTest_Company extends DataObject
{
public static $has_one = array('CEO' => 'DataObjectTest_CEO', 'PreviousCEO' => 'DataObjectTest_CEO');
public static $has_many = array('CurrentStaff' => 'DataObjectTest_Staff.CurrentCompany', 'PreviousStaff' => 'DataObjectTest_Staff.PreviousCompany');
}
class DataObjectTest_Staff extends DataObject
{
public static $has_one = array('CurrentCompany' => 'DataObjectTest_Company', 'PreviousCompany' => 'DataObjectTest_Company');
}
class DataObjectTest_CEO extends DataObjectTest_Staff
{
public static $belongs_to = array('Company' => 'DataObjectTest_Company.CEO', 'PreviousCompany' => 'DataObjectTest_Company.PreviousCEO');
}
class DataObjectTest_TeamComment extends DataObject
{
static $db = array('Name' => 'Varchar', 'Comment' => 'Text');
static $has_one = array('Team' => 'DataObjectTest_Team');
}
DataObject::add_extension('DataObjectTest_Team', 'DataObjectTest_Team_Extension');
示例11:
<?php
require_once 'conf/ConfigureFromEnv.php';
// Set the site locale
i18n::set_locale('en_US');
// Extensions
DataObject::add_extension('SiteConfig', 'SiteConfigExtension');
// specify log files
$path = BASE_PATH . '/../logs';
SS_Log::add_writer(new SS_LogFileWriter($path . '/info.log'), SS_Log::WARN, '<=');
SS_Log::add_writer(new SS_LogFileWriter($path . '/errors.log'), SS_Log::ERR);
示例12: enable_versioning
/**
* Utility function to enable versioning in a simple call
*/
public static function enable_versioning()
{
DataObject::add_extension('DataObjectAsPage', 'VersionedDataObjectAsPage');
DataObject::add_extension('DataObjectAsPage', "Versioned('Stage', 'Live')");
}
示例13:
<?php
DataObject::add_extension("Order", "OrderNumberSoldDecorator");
Object::add_extension("Product", "BuyableNumberSoldDecorator");
Object::add_extension("ProductVariation", "BuyableNumberSoldDecorator");
示例14: canOne
function canOne($member = null) {
return true;
}
function canTwo($member = null) {
return false;
}
function canThree($member = null) {
}
}
class DataObjectDecoratorTest_Ext2 extends DataObjectDecorator implements TestOnly {
function canOne($member = null) {
return true;
}
function canTwo($member = null) {
return true;
}
function canThree($member = null) {
}
}
DataObject::add_extension('DataObjectDecoratorTest_MyObject', 'DataObjectDecoratorTest_Ext1');
DataObject::add_extension('DataObjectDecoratorTest_MyObject', 'DataObjectDecoratorTest_Ext2');
?>
示例15:
<?php
DataObject::add_extension('Page', 'ABTestingPageExtension');
DataObject::add_extension('SiteConfig', 'ABTestingConfigExtension');