本文整理汇总了PHP中Object::remove_extension方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::remove_extension方法的具体用法?PHP Object::remove_extension怎么用?PHP Object::remove_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::remove_extension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_up_once
static function set_up_once() {
// needs to recreate the database schema with language properties
self::kill_temp_db();
// store old defaults
if(class_exists('Translatable')) {
self::$origTranslatableSettings['has_extension'] = singleton('SiteTree')->hasExtension('Translatable');
self::$origTranslatableSettings['default_locale'] = Translatable::default_locale();
// overwrite locale
Translatable::set_default_locale("en_US");
// refresh the extended statics - different fields in $db with Translatable enabled
if(self::$origTranslatableSettings['has_extension']) {
Object::remove_extension('SiteTree', 'Translatable');
Object::remove_extension('SiteConfig', 'Translatable');
}
}
// recreate database with new settings
$dbname = self::create_temp_db();
DB::set_alternative_database_name($dbname);
parent::set_up_once();
}
示例2: testRebuildZendSearchLuceneIndex
function testRebuildZendSearchLuceneIndex()
{
// Setup
Object::remove_extension('ContentController', 'ZendSearchLuceneContentController');
Object::remove_extension('SiteConfig', 'ZendSearchLuceneSiteConfig');
Object::remove_extension('LeftAndMain', 'ZendSearchLuceneCMSDecorator');
Object::remove_extension('SiteTree', 'ZendSearchLuceneSearchable');
Object::remove_extension('File', 'ZendSearchLuceneSearchable');
ZendSearchLuceneSearchable::$pageLength = 10;
ZendSearchLuceneSearchable::$alwaysShowPages = 3;
ZendSearchLuceneSearchable::$maxShowPages = 8;
ZendSearchLuceneSearchable::$encoding = 'utf-8';
ZendSearchLuceneSearchable::$cacheDirectory = TEMP_FOLDER;
ZendSearchLuceneWrapper::$indexName = 'Test';
ZendSearchLuceneSearchable::enable();
$index = ZendSearchLuceneWrapper::getIndex(true);
// Blank database
$this->assertEquals(0, $index->count());
// Count number of SiteTree and File objects
$SiteTreeCount = DataObject::get('SiteTree')->count();
$FileCount = DataObject::get('File')->count();
$IndexableCount = $SiteTreeCount + $FileCount;
// Re-index database
$obj = new ZendSearchLuceneCMSDecorator();
$obj->rebuildZendSearchLuceneIndex();
// Has correct number of items?
$this->assertEquals($IndexableCount, ZendSearchLuceneWrapper::getIndex()->count());
}
示例3: tearDown
function tearDown()
{
Object::remove_extension("SiteTree", "FilesystemPublisher('../FilesystemPublisherTest-static-folder/')");
SiteTree::$write_homepage_map = true;
FilesystemPublisher::$domain_based_caching = $this->orig['domain_based_caching'];
parent::tearDown();
}
示例4: remove
/**
* Removes commenting from a {@link DataObject}. Does not remove existing comments
* but does remove the extension.
*
* @param string $class Class to remove {@link CommentsExtension} from
*/
public static function remove($class)
{
if (isset(self::$enabled_classes[$class])) {
unset(self::$enabled_classes[$class]);
}
Object::remove_extension($class, 'CommentsExtension');
}
示例5: testEnableWithCustomClasses
public function testEnableWithCustomClasses()
{
FulltextSearchable::enable(array('File'));
$this->assertTrue(Object::has_extension('File', 'FulltextSearchable'));
// TODO This shouldn't need all arguments included
Object::remove_extension('File', 'FulltextSearchable(\'"Filename","Title","Content"\')');
$this->assertFalse(Object::has_extension('File', 'FulltextSearchable'));
}
示例6: remove_weight
public static function remove_weight($weight)
{
self::$weights = array_diff(self::$weights, array($weight));
$class = "NewsWeight{$weight}";
if (ClassInfo::exists($class)) {
Object::remove_extension('NewsHolder', $class);
}
}
示例7: tearDown
function tearDown()
{
parent::tearDown();
Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
FilesystemPublisher::$domain_based_caching = $this->orig['domain_based_caching'];
if (file_exists(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder')) {
Filesystem::removeFolder(BASE_PATH . '/assets/FilesystemPublisherTest-static-folder');
}
}
示例8: tear_down_once
static function tear_down_once()
{
if (!self::$origTranslatableSettings['has_extension']) {
Object::remove_extension('SiteTree', 'Translatable');
}
Translatable::set_default_locale(self::$origTranslatableSettings['default_locale']);
self::kill_temp_db();
self::create_temp_db();
parent::tear_down_once();
}
示例9: testUpdateCMSActions
function testUpdateCMSActions()
{
// Setup
Object::remove_extension('ContentController', 'ZendSearchLuceneContentController');
Object::remove_extension('SiteConfig', 'ZendSearchLuceneSiteConfig');
Object::remove_extension('LeftAndMain', 'ZendSearchLuceneCMSDecorator');
Object::remove_extension('SiteTree', 'ZendSearchLuceneSearchable');
Object::remove_extension('File', 'ZendSearchLuceneSearchable');
ZendSearchLuceneSearchable::$pageLength = 10;
ZendSearchLuceneSearchable::$alwaysShowPages = 3;
ZendSearchLuceneSearchable::$maxShowPages = 8;
ZendSearchLuceneSearchable::$encoding = 'utf-8';
ZendSearchLuceneSearchable::$cacheDirectory = TEMP_FOLDER;
ZendSearchLuceneWrapper::$indexName = 'Test';
ZendSearchLuceneSearchable::enable(array());
$config = SiteConfig::current_site_config();
$this->assertTrue(is_object($config->getCMSActions()->fieldByName('rebuildZendSearchLuceneIndex')));
}
示例10: tearDownOnce
/**
* tearDown method that's called once per test class rather once per test method.
*/
function tearDownOnce()
{
// If we have made changes to the extensions present, then migrate the database schema.
if ($this->extensionsToReapply || $this->extensionsToRemove) {
// Remove extensions added for testing
foreach ($this->extensionsToRemove as $class => $extensions) {
foreach ($extensions as $extension) {
Object::remove_extension($class, $extension);
}
}
// Reapply ones removed
foreach ($this->extensionsToReapply as $class => $extensions) {
foreach ($extensions as $extension) {
Object::add_extension($class, $extension);
}
}
}
if ($this->extensionsToReapply || $this->extensionsToRemove || $this->extraDataObjects) {
$this->resetDBSchema();
}
}
示例11: removeExtensions
/**
* Remove given extensions from Member. This is useful for
* removing extensions that could produce a biased
* test result, as some extensions applied by project
* code or modules can do this.
*
* @param array $extensions
* @return array The removed extensions
*/
protected function removeExtensions($extensions)
{
if ($extensions) {
foreach ($extensions as $extension) {
Object::remove_extension('Member', $extension);
}
}
return $extensions;
}
示例12: testOnAfterDelete
public function testOnAfterDelete()
{
// Setup
Object::remove_extension('SiteTree', 'ZendSearchLuceneSearchable');
Object::remove_extension('File', 'ZendSearchLuceneSearchable');
ZendSearchLuceneSearchable::$pageLength = 10;
ZendSearchLuceneSearchable::$alwaysShowPages = 3;
ZendSearchLuceneSearchable::$maxShowPages = 8;
ZendSearchLuceneSearchable::$encoding = 'utf-8';
ZendSearchLuceneSearchable::$cacheDirectory = TEMP_FOLDER;
ZendSearchLuceneWrapper::$indexName = 'Test';
ZendSearchLuceneSearchable::enable();
// Blank the index
ZendSearchLuceneWrapper::getIndex(true);
// There shouldn't be anything with asdf in there
$this->assertEquals(0, count(ZendSearchLuceneWrapper::find('asdf')));
$page = DataObject::get_one('Page');
$page->Content = 'asdf';
$page->write();
// There should now be a result
$this->assertGreaterThan(0, count(ZendSearchLuceneWrapper::find('asdf')));
$page->delete();
// There should now be no result again
$this->assertEquals(0, count(ZendSearchLuceneWrapper::find('asdf')));
}
示例13: disable
/**
* Disable the multilingual feature
*
* @deprecated 2.4 Use Object::remove_extension('SiteTree', 'Translatable')
*/
static function disable()
{
Object::remove_extension('SiteTree', 'Translatable');
}
示例14: remove_sortable_class
public static function remove_sortable_class($class)
{
Object::remove_extension($class, 'SortableDataObject');
}
示例15: disable
/**
* Disable the multilingual feature
*
* @deprecated 2.4 Use Object::remove_extension('SiteTree', 'Translatable')
*/
static function disable()
{
if (class_exists('SiteTree')) {
Object::remove_extension('SiteTree', 'Translatable');
}
}