当前位置: 首页>>代码示例>>PHP>>正文


PHP ElggObject::deleteMetadata方法代码示例

本文整理汇总了PHP中ElggObject::deleteMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggObject::deleteMetadata方法的具体用法?PHP ElggObject::deleteMetadata怎么用?PHP ElggObject::deleteMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ElggObject的用法示例。


在下文中一共展示了ElggObject::deleteMetadata方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testWritesInvalidate

 public function testWritesInvalidate()
 {
     // elgg_delete_metadata
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     $this->cache->inject($this->guid2, ['bing' => 'bar']);
     elgg_delete_metadata(array('guid' => $this->guid1));
     $this->assertFalse($this->cache->isLoaded($this->guid1));
     $this->assertTrue($this->cache->isLoaded($this->guid2));
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     $this->cache->inject($this->guid2, ['bing' => 'bar']);
     elgg_delete_metadata(['guids' => [$this->guid1, $this->guid2]]);
     $this->assertFalse($this->cache->isLoaded($this->guid1));
     $this->assertFalse($this->cache->isLoaded($this->guid2));
     // setMetadata
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     $this->obj1->setMetadata($this->name, $this->value);
     $this->assertFalse($this->cache->isLoaded($this->obj1));
     // deleteMetadata
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     $this->obj1->deleteMetadata($this->name);
     $this->assertFalse($this->cache->isLoaded($this->guid1));
     // create_metadata
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     create_metadata($this->guid1, 'foo', 'bar', 'text');
     $this->assertFalse($this->cache->isLoaded($this->guid1));
     // disableMetadata
     $this->obj1->setMetadata($this->name, $this->value);
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     $this->obj1->disableMetadata($this->name);
     $this->assertFalse($this->cache->isLoaded($this->guid1));
     // enableMetadata
     $this->cache->inject($this->guid1, ['foo' => 'bar']);
     $this->obj1->enableMetadata($this->name);
     $this->assertFalse($this->cache->isLoaded($this->guid1));
 }
开发者ID:ibou77,项目名称:elgg,代码行数:35,代码来源:ElggCoreMetadataCacheTest.php

示例2: approve_content

function approve_content(\ElggObject $object)
{
    $object->deleteMetadata(QUARANTINED);
    $access_id = $object->{ORIGINAL_ACCESS_ID};
    // delete it so our update handler doesn't re-set it
    $object->deleteMetadata(ORIGINAL_ACCESS_ID);
    if ($access_id !== null) {
        $object->access_id = (int) $access_id;
        $handle = State::$handle_updates;
        State::$handle_updates = false;
        $object->save();
        State::$handle_updates = $handle;
    } else {
        $access_id = $object->access_id;
    }
    // just in case plugins look at river.access_id
    update_river_access_by_object($object->guid, $access_id);
}
开发者ID:Elgg,项目名称:probation,代码行数:18,代码来源:functions.php

示例3: videolist_2012022501

/**
 * Downloads the thumbnail and saves into data folder
 *
 * @param ElggObject $item
 * @return bool
 */
function videolist_2012022501($item)
{
    require_once elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php';
    // get thumbnail image
    $thumbnail = file_get_contents($item->thumbnail);
    if (!$thumbnail) {
        return false;
    }
    $prefix = "videolist/" . $item->guid;
    $filehandler = new ElggFile();
    $filehandler->owner_guid = $item->owner_guid;
    $filehandler->setFilename($prefix . ".jpg");
    $filehandler->open("write");
    $filehandler->write($thumbnail);
    $filehandler->close();
    // update properties
    if ($item->url) {
        $item->video_url = $item->url;
        $item->deleteMetadata('url');
    }
    if ($item->desc) {
        $item->description = $item->desc;
        $item->deleteMetadata('desc');
        $item->save();
    }
    if ($item->embedurl) {
        $item->deleteMetadata('embedurl');
    }
    upgrade_change_subtype($item, 'videolist_item');
    // update river
    $options = array('object_guid' => $item->guid);
    $river_items = elgg_get_river($options);
    foreach ($river_items as $river_item) {
        if ($river_item->action_type == 'create') {
            upgrade_update_river($river_item->id, 'river/object/videolist_item/create', $item->guid, 0);
        }
    }
    return true;
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:45,代码来源:2012022501.php

示例4: testElggEntityMetadata

 public function testElggEntityMetadata()
 {
     // let's delete a non-existent metadata
     $this->assertFalse($this->entity->deleteMetadata('important'));
     // let's add the metadata
     $this->entity->important = 'indeed!';
     $this->assertIdentical('indeed!', $this->entity->important);
     $this->entity->less_important = 'true, too!';
     $this->assertIdentical('true, too!', $this->entity->less_important);
     // test deleting incorrectly
     // @link https://github.com/elgg/elgg/issues/2273
     $this->assertNull($this->entity->deleteMetadata('impotent'));
     $this->assertEqual($this->entity->important, 'indeed!');
     // get rid of one metadata
     $this->assertEqual($this->entity->important, 'indeed!');
     $this->assertTrue($this->entity->deleteMetadata('important'));
     $this->assertNull($this->entity->important);
     // get rid of all metadata
     $this->assertTrue($this->entity->deleteMetadata());
     $this->assertNull($this->entity->less_important);
 }
开发者ID:elgg,项目名称:elgg,代码行数:21,代码来源:ElggEntityTest.php

示例5: testWritesAreCached

 public function testWritesAreCached()
 {
     // delete should mark cache as known to be empty
     $this->obj1->deleteMetadata($this->name);
     $this->assertTrue($this->cache->isKnown($this->guid1, $this->name));
     $this->assertNull($this->cache->load($this->guid1, $this->name));
     // without name, delete should invalidate the entire entity
     $this->cache->save($this->guid1, $this->name, $this->value);
     elgg_delete_metadata(array('guid' => $this->guid1));
     $this->assertFalse($this->cache->isKnown($this->guid1, $this->name));
     // test set
     $this->obj1->setMetadata($this->name, $this->value);
     $this->assertIdentical($this->cache->load($this->guid1, $this->name), $this->value);
     // test set multiple
     $this->obj1->setMetadata($this->name, 1, 'integer', true);
     $this->assertIdentical($this->cache->load($this->guid1, $this->name), array($this->value, 1));
     // writes when access is ignore should invalidate
     $tmp_ignore = elgg_set_ignore_access(true);
     $this->obj1->setMetadata($this->name, $this->value);
     $this->assertFalse($this->cache->isKnown($this->guid1, $this->name));
     elgg_set_ignore_access($tmp_ignore);
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:22,代码来源:ElggCoreMetadataCacheTest.php

示例6: foreach

        // If is below, bring all child elements forward
        if ($page_guid == $tree_page->guid) {
            $previous_parent = $page->parent_guid;
            $children = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $page->getGUID()));
            if ($children) {
                foreach ($children as $child) {
                    $child->parent_guid = $previous_parent;
                }
            }
        }
    }
    $page->parent_guid = $parent_guid;
}
if ($page->save()) {
    //check in the page becaused the user just saved it
    if ($page->deleteMetadata("checkedOut")) {
        system_message(elgg_echo('pages:checked_in'));
    } else {
        system_message('Page could not be checked in. It is still locked for editing');
    }
    elgg_clear_sticky_form('page');
    // Now save description as an annotation
    $page->annotate('page', $page->description, $page->access_id);
    system_message(elgg_echo('pages:saved'));
    if ($new_page) {
        add_to_river('river/object/page/create', 'create', elgg_get_logged_in_user_guid(), $page->guid);
    }
    forward($page->getURL());
} else {
    register_error(elgg_echo('pages:error:notsaved'));
    forward(REFERER);
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:edit.php

示例7: elseif

 }
 if (!empty($metadata_hint)) {
     $field->metadata_hint = $metadata_hint;
 } elseif ($current_field) {
     unset($field->metadata_hint);
 }
 if (!empty($metadata_placeholder)) {
     $field->metadata_placeholder = $metadata_placeholder;
 } elseif ($current_field) {
     unset($field->metadata_placeholder);
 }
 $field->metadata_type = $metadata_type;
 if ($metadata_type == "dropdown" || $metadata_type == "go_radio" || $metadata_type == "multiselect") {
     $field->metadata_options = $new_options;
 } elseif ($current_field) {
     $field->deleteMetadata("metadata_options");
 }
 if ($type == "profile") {
     $field->show_on_register = $show_on_register;
     $field->mandatory = $mandatory;
     $field->user_editable = $user_editable;
 }
 $field->admin_only = $admin_only;
 $field->output_as_tags = $output_as_tags;
 $field->blank_available = $blank_available;
 if (empty($current_field)) {
     $field->order = $max_fields;
 }
 if ($field->save()) {
     system_message(elgg_echo("profiles_go:actions:new:success"));
 } else {
开发者ID:rosanamontes,项目名称:teranga.go,代码行数:31,代码来源:new.php

示例8: elseif

}
if (!empty($metadata_hint)) {
    $field->metadata_hint = $metadata_hint;
} elseif ($current_field) {
    unset($field->metadata_hint);
}
if (!empty($metadata_placeholder)) {
    $field->metadata_placeholder = $metadata_placeholder;
} elseif ($current_field) {
    unset($field->metadata_placeholder);
}
$field->metadata_type = $metadata_type;
if (in_array($metadata_type, ['dropdown', 'radio', 'multiselect'])) {
    $field->metadata_options = $new_options;
} elseif ($current_field) {
    $field->deleteMetadata('metadata_options');
}
if ($type == 'profile') {
    $field->show_on_register = $show_on_register;
    $field->mandatory = $mandatory;
    $field->user_editable = $user_editable;
}
$field->admin_only = $admin_only;
$field->output_as_tags = $output_as_tags;
$field->blank_available = $blank_available;
if (empty($current_field)) {
    $field->order = $max_fields;
}
if ($field->save()) {
    system_message(elgg_echo('profile_manager:actions:new:success'));
} else {
开发者ID:coldtrick,项目名称:profile_manager,代码行数:31,代码来源:new.php


注:本文中的ElggObject::deleteMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。