public function setupOnce() { parent::setupOnce(); $this->resetDBSchema(); // apply the ChangesetTrackable extension DataObject::add_extension('SiteTree', 'ChangesetTrackable'); }
public static function add_sortable_class($className) { if (!self::is_sortable_class($className)) { DataObject::add_extension($className, 'SortableDataObject'); self::$sortable_classes[] = $className; } }
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; }
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"); }
/** * 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'); } }
/** * 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); } } }
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', '*****@*****.**'); define('EMAIL_ADMINS', 'davis.dimalen@gmail.com, davis.dimalen@gmail.com'); define('TOAST_ADMIN', '*****@*****.**'); $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();
<?php DataObject::add_extension('Page', 'UnderConstruction_Decorator'); DataObject::add_extension('Page_Controller', 'UnderConstruction_Extension'); DataObject::add_extension('SiteConfig', 'UnderConstruction_Settings');
* @package securefiles * @author Hamish Campbell <*****@*****.**> * @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();
{ 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');
<?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);
/** * 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')"); }
<?php DataObject::add_extension("Order", "OrderNumberSoldDecorator"); Object::add_extension("Product", "BuyableNumberSoldDecorator"); Object::add_extension("ProductVariation", "BuyableNumberSoldDecorator");
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'); ?>
<?php DataObject::add_extension('Page', 'ABTestingPageExtension'); DataObject::add_extension('SiteConfig', 'ABTestingConfigExtension');
<?php DataObject::add_extension("ProductAttributeType", "ProductAttributeTypeColourDecorator"); DataObject::add_extension("ProductAttributeValue", "ProductAttributeValueColourDecorator"); DataObject::add_extension("ProductVariation", "ProductVariationColourDecorator"); DataObject::add_extension("Product", "ProductColourDecorator"); Object::add_extension('Page_Controller', 'ProductColoursController');
<?php /** * Copyright 2010, 2011 pixeltricks GmbH * * This file is part of SilvercartPrepaymentPayment. * * SilvercartPaypalPayment 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. * * SilvercartPrepaymentPayment 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 SilvercartPrepaymentPayment. If not, see <http://www.gnu.org/licenses/>. * * @package Silvercart * @subpackage Config * @ignore */ DataObject::add_extension('SilvercartPaymentPrepayment', 'SilvercartDataObjectMultilingualDecorator');
<?php DataObject::add_extension('File', 'DynamicTemplateExtension'); File::$allowed_extensions[] = "ss";
Translatable::set_current_locale('fr_FR'); $form = $cmsMain->getEditForm($frPage->ID); $form->loadDataFrom(array('Title' => 'Translated', 'ViewerGroups' => $group->ID)); $form->saveInto($frPage); $frPage->write(); $this->assertEquals('Translated', $frPage->Title); $this->assertEquals(array($group->ID), $frPage->ViewerGroups()->column('ID')); $adminUser->logOut(); Translatable::set_current_locale($origLocale); } } class TranslatableTest_DataObject extends DataObject implements TestOnly { // add_extension() used to add decorator at end of file static $db = array('TranslatableProperty' => 'Text'); } class TranslatableTest_Decorator extends DataObjectDecorator implements TestOnly { function extraStatics() { return array('db' => array('TranslatableDecoratedProperty' => 'Text')); } } class TranslatableTest_Page extends Page implements TestOnly { // static $extensions is inherited from SiteTree, // we don't need to explicitly specify the fields static $db = array('TranslatableProperty' => 'Text'); } DataObject::add_extension('TranslatableTest_DataObject', 'TranslatableTest_Decorator');
<?php DataObject::add_extension('Order', 'EcommerceGoogleAnaltyicsOrderDecorator'); Object::add_extension('CheckoutPage_Controller', 'EcommerceGoogleAnaltyics'); Object::add_extension('AccountPage_Controller', 'EcommerceGoogleAnaltyics');
public function setUpOnce() { DataObject::add_extension('SiteTree', 'SolrIndexable'); parent::setUpOnce(); }
{ function canOne($member = null) { return true; } function canTwo($member = null) { return true; } function canThree($member = null) { } } class DataObjectDecoratorTest_Faves extends DataObjectDecorator implements TestOnly { public function extraStatics() { return array('many_many' => array('Faves' => 'Page')); } } class DataObjectDecoratorTest_AppliedToDO extends DataObjectDecorator implements TestOnly { public function testMethodApplied() { return "hello world"; } } DataObject::add_extension('DataObjectDecoratorTest_MyObject', 'DataObjectDecoratorTest_Ext1'); DataObject::add_extension('DataObjectDecoratorTest_MyObject', 'DataObjectDecoratorTest_Ext2'); DataObject::add_extension('DataObjectDecoratorTest_MyObject', 'DataObjectDecoratorTest_Faves');
/** * Enable the default configuration of Zend Search Lucene searching on the * given data classes. * * @param Array $searchableClasses An array of classnames to scan. Can * choose from SiteTree and/or File. * To not scan any classes, for example * if we will define custom fields to scan, * pass in an empty array. * Defaults to scan SiteTree and File. */ public static function enable($searchableClasses = array('SiteTree', 'File')) { // We can't enable the search engine if we don't have QueuedJobs installed. if (!ClassInfo::exists('QueuedJobService')) { die('<strong>' . _t('ZendSearchLucene.ERROR', 'Error') . '</strong>: ' . _t('ZendSearchLucene.QueuedJobsRequired', 'Lucene requires the Queued jobs module. See ' . '<a href="http://www.silverstripe.org/queued-jobs-module/">' . 'http://www.silverstripe.org/queued-jobs-module/</a>.')); } if (!is_array($searchableClasses)) { $searchableClasses = array($searchableClasses); } foreach ($searchableClasses as $class) { if (isset(self::$defaultColumns[$class])) { Object::add_extension($class, "ZendSearchLuceneSearchable('" . self::$defaultColumns[$class] . "')"); } else { user_error("I don't know the default search columns for class '{$class}'"); return; } } Object::add_extension('ContentController', 'ZendSearchLuceneContentController'); DataObject::add_extension('SiteConfig', 'ZendSearchLuceneSiteConfig'); Object::add_extension('LeftAndMain', 'ZendSearchLuceneCMSDecorator'); Object::add_extension('StringField', 'ZendSearchLuceneTextHighlightDecorator'); // Set up default encoding and analyzer Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding(ZendSearchLuceneSearchable::$encoding); Zend_Search_Lucene_Analysis_Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English()); }
<?php /* * This file is needed to identify this as a SilverStripe module */ // Extend the Member with e-commerce related fields. DataObject::add_extension('Member', 'EcommerceRole'); // Extend Payment with e-commerce relationship. DataObject::add_extension('Payment', 'EcommercePayment'); Director::addRules(50, array(ShoppingCart_Controller::$URLSegment . '/$Action/$ID' => 'ShoppingCart_Controller'));
<?php Member::add_extension('Member', 'BusinessMember'); DataObject::add_extension('SiteTree', 'BrowseBusinessDecorator'); Object::add_extension('ContentController', 'BrowseBusinessDecorator_Controller'); //=============================== START business_directory ===================================== //BrowseBusinessDecorator::get_classes_that_can_have_businesses_as_children(array("BusinessListingPage")); //=============================== END business_directory =====================================
} } class DataExtensionTest_Ext2 extends DataExtension implements TestOnly { function canOne($member = null) { return true; } function canTwo($member = null) { return true; } function canThree($member = null) { } } class DataExtensionTest_Faves extends DataExtension implements TestOnly { public static $many_many = array('Faves' => 'DataExtensionTest_RelatedObject'); } class DataExtensionTest_AppliedToDO extends DataExtension implements TestOnly { public function testMethodApplied() { return "hello world"; } } DataObject::add_extension('DataExtensionTest_MyObject', 'DataExtensionTest_Ext1'); DataObject::add_extension('DataExtensionTest_MyObject', 'DataExtensionTest_Ext2'); DataObject::add_extension('DataExtensionTest_MyObject', 'DataExtensionTest_Faves');
{ $fields = singleton('FormScaffolderTest_Article')->getFrontEndFields(); $this->assertFalse($fields->hasTabSet(), 'getFrontEndFields() doesnt produce a TabSet by default'); } } class FormScaffolderTest_Article extends DataObject implements TestOnly { static $db = array('Title' => 'Varchar', 'Content' => 'HTMLText'); static $has_one = array('Author' => 'FormScaffolderTest_Author'); static $many_many = array('Tags' => 'FormScaffolderTest_Tag'); } class FormScaffolderTest_Author extends Member implements TestOnly { static $has_one = array('ProfileImage' => 'Image'); static $has_many = array('Articles' => 'FormScaffolderTest_Article'); } class FormScaffolderTest_Tag extends DataObject implements TestOnly { static $db = array('Title' => 'Varchar'); static $belongs_many_many = array('Articles' => 'FormScaffolderTest_Article'); } class FormScaffolderTest_ArticleDecorator extends DataObjectDecorator implements TestOnly { static $db = array('DecoratedField' => 'Varchar'); function updateCMSFields(&$fields) { $fields->addFieldToTab('Root.Main', new TextField('AddedDecoratorField')); } } DataObject::add_extension('FormScaffolderTest_Article', 'FormScaffolderTest_ArticleDecorator');
global $project; $project = 'mysite'; global $database; $database = 'SS_mysite'; global $databaseConfig; $databaseConfig = array( "type" => "MySQLDatabase", "server" => "localhost", "username" => "root", "password" => "", "database" => "SS_mysite", ); // Sites running on the following servers will be // run in development mode. See // http://doc.silverstripe.com/doku.php?id=devmode // for a description of what dev mode does. Director::set_dev_servers(array( 'localhost', '127.0.0.1', )); Security::setDefaultAdmin('admin', 'password'); SSViewer::set_theme('mysite'); DataObject::add_extension('SiteTree', 'Taggable'); ?>
{ return "decorated dynamic field"; } } class DataObjectTest_ValidatedObject extends DataObject implements TestOnly { 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'); } DataObject::add_extension('DataObjectTest_Team', 'DataObjectTest_Team_Decorator');
<?php DataObject::add_extension('SiteConfig', 'RiskAssessmentSiteConfig'); DataObject::add_extension('RiskWorksheet', 'WorkflowApplicable'); DataObject::add_extension('SiteTree', 'WorkflowApplicable'); Director::addRules(20, array('worksheets//$Action/$ID/$OtherID' => 'WorksheetController'));