本文整理汇总了PHP中remove_subtype函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_subtype函数的具体用法?PHP remove_subtype怎么用?PHP remove_subtype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_subtype函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSubtypeAddRemove
public function testSubtypeAddRemove()
{
$test_subtype = 'test_1389988642';
$object = new \ElggObject();
$object->subtype = $test_subtype;
$object->save();
$this->assertTrue(is_numeric(get_subtype_id('object', $test_subtype)));
$object->delete();
remove_subtype('object', $test_subtype);
$this->assertFalse(get_subtype_id('object', $test_subtype));
}
示例2: tearDown
/**
* Called after each test method.
*/
public function tearDown()
{
if ($this->entity1) {
$this->entity1->delete();
}
if ($this->entity2) {
$this->entity2->delete();
}
if ($this->entity3) {
$this->entity3->delete();
}
remove_subtype('object', 'elgg_relationship_test');
_elgg_services()->events = $this->original_events;
}
示例3: __destruct
/**
* Called after each test object.
*/
public function __destruct()
{
global $CONFIG;
foreach ($this->entities as $e) {
$e->delete();
}
// manually remove subtype entries since there is no way
// to using the API.
$subtype_arr = array();
foreach ($this->subtypes as $type => $subtypes) {
foreach ($subtypes as $subtype) {
remove_subtype($type, $subtype);
}
}
parent::__destruct();
}
示例4: testElggInstanceOf
/**
* Test elgg_instanceof()
*/
public function testElggInstanceOf()
{
$entity = new \ElggObject();
$entity->subtype = 'test_subtype';
$entity->save();
$this->assertTrue(elgg_instanceof($entity));
$this->assertTrue(elgg_instanceof($entity, 'object'));
$this->assertTrue(elgg_instanceof($entity, 'object', 'test_subtype'));
$this->assertFalse(elgg_instanceof($entity, 'object', 'invalid_subtype'));
$this->assertFalse(elgg_instanceof($entity, 'user', 'test_subtype'));
$entity->delete();
$bad_entity = false;
$this->assertFalse(elgg_instanceof($bad_entity));
$this->assertFalse(elgg_instanceof($bad_entity, 'object'));
$this->assertFalse(elgg_instanceof($bad_entity, 'object', 'test_subtype'));
remove_subtype('object', 'test_subtype');
}
示例5: testElggBatchReadHandlesBrokenEntities
public function testElggBatchReadHandlesBrokenEntities()
{
$num_test_entities = 8;
$guids = array();
for ($i = $num_test_entities; $i > 0; $i--) {
$entity = new \ElggObject();
$entity->type = 'object';
$entity->subtype = 'test_5357_subtype';
$entity->access_id = ACCESS_PUBLIC;
$entity->save();
$guids[] = $entity->guid;
_elgg_invalidate_cache_for_entity($entity->guid);
}
// break entities such that the first fetch has one incomplete
// and the second and third fetches have only incompletes!
$db_prefix = elgg_get_config('dbprefix');
delete_data("\n\t\t\tDELETE FROM {$db_prefix}objects_entity\n\t\t\tWHERE guid IN ({$guids[1]}, {$guids[2]}, {$guids[3]}, {$guids[4]}, {$guids[5]})\n\t\t");
$options = array('type' => 'object', 'subtype' => 'test_5357_subtype', 'order_by' => 'e.guid');
$entities_visited = array();
$batch = new \ElggBatch('elgg_get_entities', $options, null, 2);
/* @var \ElggEntity[] $batch */
foreach ($batch as $entity) {
$entities_visited[] = $entity->guid;
}
// The broken entities should not have been visited
$this->assertEqual($entities_visited, array($guids[0], $guids[6], $guids[7]));
// cleanup (including leftovers from previous tests)
$entity_rows = elgg_get_entities(array_merge($options, array('callback' => '', 'limit' => false)));
$guids = array();
foreach ($entity_rows as $row) {
$guids[] = $row->guid;
}
delete_data("DELETE FROM {$db_prefix}entities WHERE guid IN (" . implode(',', $guids) . ")");
delete_data("DELETE FROM {$db_prefix}objects_entity WHERE guid IN (" . implode(',', $guids) . ")");
remove_subtype('object', 'test_5357_subtype');
}
示例6: array
<?php
/**
* A series of actions to perform on plugin de-activation
*
* @package upload_users
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Jaakko Naakka / Mediamaisteri Group
* @author Ismayil Khayredinov / Arck Interactive
* @copyright Mediamaisteri Group 2009
* @copyright ArckInteractive 2013
* @link http://www.mediamaisteri.com/
* @link http://arckinteractive.com/
*/
// Remove incomplete uploads
$options = array('types' => 'object', 'subtypes' => 'upload_users_file', 'limit' => 0);
$batch = new ElggBatch('elgg_get_entities', $options);
foreach ($batch as $file) {
$file->delete();
}
remove_subtype('object', 'upload_users_file');
示例7: testElggEnityGetAndSetAnnotations
public function testElggEnityGetAndSetAnnotations()
{
$this->assertFalse(array_key_exists('non_existent', $this->entity->expose_annotations()));
$this->assertFalse($this->entity->getAnnotations('non_existent'));
// set and check temp annotation
$this->assertTrue($this->entity->annotate('non_existent', 'testing'));
$this->assertIdentical($this->entity->getAnnotations('non_existent'), array('testing'));
$this->assertTrue(array_key_exists('non_existent', $this->entity->expose_annotations()));
// save entity and check for annotation
$this->entity->subtype = 'testing';
$this->save_entity();
$this->assertFalse(array_key_exists('non_existent', $this->entity->expose_annotations()));
$annotations = $this->entity->getAnnotations('non_existent');
$this->assertIsA($annotations[0], 'ElggAnnotation');
$this->assertIdentical($annotations[0]->name, 'non_existent');
$this->assertEqual($this->entity->countAnnotations('non_existent'), 1);
$this->assertIdentical($annotations, elgg_get_annotations(array('guid' => $this->entity->getGUID())));
$this->assertIdentical($annotations, elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site')));
$this->assertIdentical($annotations, elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site', 'subtype' => 'testing')));
$this->assertIdentical(FALSE, elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site', 'subtype' => 'fail')));
// clear annotation
$this->assertTrue($this->entity->deleteAnnotations());
$this->assertEqual($this->entity->countAnnotations('non_existent'), 0);
$this->assertIdentical(array(), elgg_get_annotations(array('guid' => $this->entity->getGUID())));
$this->assertIdentical(array(), elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site')));
$this->assertIdentical(array(), elgg_get_annotations(array('guid' => $this->entity->getGUID(), 'type' => 'site', 'subtype' => 'testing')));
// clean up
$this->assertTrue($this->entity->delete());
remove_subtype('site', 'testing');
}
示例8: tearDown
/**
* Called after each test method.
*/
public function tearDown()
{
$this->entity->delete();
remove_subtype('object', 'elgg_annotation_test');
_elgg_services()->hooks = $this->original_hooks;
}
示例9: testSubtypeAddRemove
public function testSubtypeAddRemove()
{
$test_subtype = 'test_1389988642';
$object = new ElggObject();
$object->subtype = $test_subtype;
$object->save();
$this->assertIdentical($object->subtype, get_subtype_id('object', $test_subtype));
$object->delete();
remove_subtype('object', $test_subtype);
$this->assertFalse(get_subtype_id('object', $test_subtype));
}
示例10: __destruct
public function __destruct()
{
parent::__destruct();
remove_subtype('object', 'elgg_entity_test_subtype');
}
示例11: system_message
system_message(elgg_echo($name . " : application is deleted"));
forward(REFERER);
} else {
$entities = elgg_get_entities(array('types' => 'object', 'subtypes' => $name . 'token'));
foreach ($entities as $entity) {
$entity->delete();
}
$entities2 = elgg_get_entities(array('types' => 'object', 'subtypes' => $name . 'secret'));
foreach ($entities2 as $entity2) {
$entity2->delete();
}
remove_subtype('object', $name . 'secret');
remove_subtype('object', $name . 'token');
$plugin->unsetUserSetting($name . 'public', $user->guid);
$plugin->unsetUserSetting($name . 'private', $user->guid);
remove_subtype('object', 'app' . $name);
system_message(elgg_echo($name . " : application is deleted"));
forward(REFERER);
}
} else {
if (isset($public)) {
$result = $plugin->setUserSetting($name . 'public', $public, $user->guid);
if (!$result) {
register_error(elgg_echo('plugins:usersettings:save:fail', array($plugin_name)));
forward(REFERER);
}
} else {
$plugin->unsetUserSetting($name . 'public', $user->guid);
}
if (isset($private)) {
$result = $plugin->setUserSetting($name . 'private', $private, $user->guid);