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


PHP ElggObject::getOwnerGUID方法代码示例

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


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

示例1: ElggObject

}
if (count($uploaded_images)) {
    // Create a new batch object to contain these photos
    $batch = new ElggObject();
    $batch->subtype = "tidypics_batch";
    $batch->access_id = $album->access_id;
    $batch->container_guid = $album->getGUID();
    if ($batch->save()) {
        foreach ($uploaded_images as $uploaded_guid) {
            add_entity_relationship($uploaded_guid, "belongs_to_batch", $batch->getGUID());
        }
    }
    $album->prependImageList($uploaded_images);
    // "added images to album" river
    if ($img_river_view == "batch" && $album->new_album == false) {
        add_to_river('river/object/tidypics_batch/create', 'create', $batch->getOwnerGUID(), $batch->getGUID());
    }
    // "created album" river
    if ($album->new_album) {
        $album->new_album = false;
        $album->first_upload = true;
        add_to_river('river/object/album/create', 'create', $album->getOwnerGUID(), $album->getGUID());
        // "created album" notifications
        // we throw the notification manually here so users are not told about the new album until
        // there are at least a few photos in it
        if ($album->shouldNotify()) {
            object_notifications('create', 'object', $album);
            $album->last_notified = time();
        }
    } else {
        // "added image to album" notifications
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:31,代码来源:upload.php

示例2: thewire_tools_save_post

/**
 * Save a wire post, overrules the default function because we need to support groups
 *
 * @param string $text        the text of the post
 * @param int    $userid      the owner of the post
 * @param int    $access_id   the access level of the post
 * @param int    $parent_guid is this a reply on another post
 * @param string $method      which method was used
 *
 * @return bool|int the GUID of the new wire post or false
 */
function thewire_tools_save_post($text, $userid, $access_id, $parent_guid = 0, $method = "site")
{
    // set correct container
    $container_guid = $userid;
    // check the access id
    if ($access_id == ACCESS_PRIVATE) {
        // private wire posts aren"t allowed
        $access_id = ACCESS_LOGGED_IN;
    } elseif (thewire_tools_groups_enabled()) {
        // allow the saving of a wire post in a group (if enabled)
        if (!in_array($access_id, array(ACCESS_FRIENDS, ACCESS_LOGGED_IN, ACCESS_PUBLIC))) {
            // try to find a group with access_id
            $group_options = array("type" => "group", "limit" => 1, "metadata_name_value_pairs" => array("group_acl" => $access_id));
            $groups = elgg_get_entities_from_metadata($group_options);
            if (!empty($groups)) {
                $group = $groups[0];
                if ($group->thewire_enable == "no") {
                    // not allowed to post in this group
                    register_error(elgg_echo("thewire_tools:groups:error:not_enabled"));
                    // let creation of object fail
                    return false;
                } else {
                    $container_guid = $group->getGUID();
                }
            }
        }
    }
    // create the new post
    $post = new ElggObject();
    $post->subtype = "thewire";
    $post->owner_guid = $userid;
    $post->container_guid = $container_guid;
    $post->access_id = $access_id;
    // only xxx characters allowed (see plugin setting)
    $text = elgg_substr($text, 0, thewire_tools_get_wire_length());
    // no html tags allowed so we escape
    $post->description = htmlspecialchars($text, ENT_NOQUOTES, "UTF-8");
    $post->method = $method;
    //method: site, email, api, ...
    $tags = thewire_get_hashtags($text);
    if (!empty($tags)) {
        $post->tags = $tags;
    }
    // must do this before saving so notifications pick up that this is a reply
    if ($parent_guid) {
        $post->reply = true;
    }
    $guid = $post->save();
    // set thread guid
    if ($parent_guid) {
        $post->addRelationship($parent_guid, "parent");
        // name conversation threads by guid of first post (works even if first post deleted)
        $parent_post = get_entity($parent_guid);
        $post->wire_thread = $parent_post->wire_thread;
    } else {
        // first post in this thread
        $post->wire_thread = $guid;
    }
    if ($guid) {
        add_to_river("river/object/thewire/create", "create", $post->getOwnerGUID(), $post->getGUID());
        // let other plugins know we are setting a user status
        $params = array("entity" => $post, "user" => $post->getOwnerEntity(), "message" => $post->description, "url" => $post->getURL(), "origin" => "thewire");
        elgg_trigger_plugin_hook("status", "user", $params);
    }
    return $guid;
}
开发者ID:T4SG,项目名称:Bangalore-Team-5,代码行数:77,代码来源:functions.php

示例3: elseif

    } else {
        if (strtotime($expiration_date) < time()) {
            $page->unpublished = true;
        }
    }
}
// save the page
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 && !$page->unpublished) {
        add_to_river("river/object/page/create", "create", $user->getGUID(), $page->getGUID());
    } elseif ($page->getOwnerGUID() != $user->getGUID()) {
        // not the owner edited the page, notify the owner
        $subject = elgg_echo("pages_tools:notify:edit:subject", array($page->title));
        $msg = elgg_echo("pages_tools:notify:edit:message", array($page->title, $user->name, $page->getURL()));
        notify_user($page->getOwnerGUID(), $user->getGUID(), $subject, $msg);
    }
    forward($page->getURL());
} else {
    register_error(elgg_echo("pages:error:no_save"));
    forward(REFERER);
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:edit.php

示例4: foreach

}
if (sizeof($input) > 0) {
    // don't change access if not an owner/admin
    $user = elgg_get_logged_in_user_entity();
    foreach ($input as $name => $value) {
        $publication->{$name} = $value;
    }
}
// need to add check to make sure user can write to container
$publication->container_guid = $container_guid;
if ($publication->save()) {
    if (($icon_file = get_resized_image_from_uploaded_file("image", 100, 100)) && ($icon_sizes = elgg_get_config("icon_sizes"))) {
        // create icon
        $prefix = "publications/" . $publication->getGUID();
        $fh = new ElggFile();
        $fh->owner_guid = $publication->getOwnerGUID();
        foreach ($icon_sizes as $icon_name => $icon_info) {
            if ($icon_file = get_resized_image_from_uploaded_file("image", $icon_info["w"], $icon_info["h"], $icon_info["square"], $icon_info["upscale"])) {
                $fh->setFilename($prefix . $icon_name . ".jpg");
                if ($fh->open("write")) {
                    $fh->write($icon_file);
                    $fh->close();
                }
            }
        }
        $publication->icontime = time();
    }
    system_message(elgg_echo('publications:saved'));
    forward($publication->getURL());
} else {
    register_error(elgg_echo('publications:error:notsaved'));
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:31,代码来源:edit.php

示例5: thewire_tools_save_post

/**
 * Save a wire post, overrules the default function because we need to support groups
 *
 * @param string $text         the text of the post
 * @param int    $userid       the owner of the post
 * @param int    $access_id    the access level of the post
 * @param int    $parent_guid  is this a reply on another post
 * @param string $method       which method was used
 * @param int    $reshare_guid is the a (re)share of some content item
 *
 * @return bool|int the GUID of the new wire post or false
 */
function thewire_tools_save_post($text, $userid, $access_id, $parent_guid = 0, $method = "site", $reshare_guid = 0)
{
    // set correct container
    $container_guid = $userid;
    // check the access id
    if ($access_id == ACCESS_PRIVATE) {
        // private wire posts aren't allowed
        $access_id = ACCESS_LOGGED_IN;
    } elseif (thewire_tools_groups_enabled()) {
        // allow the saving of a wire post in a group (if enabled)
        if (!in_array($access_id, [ACCESS_FRIENDS, ACCESS_LOGGED_IN, ACCESS_PUBLIC])) {
            // try to find a group with access_id
            $group_options = ['type' => 'group', 'limit' => 1, 'metadata_name_value_pairs' => ['group_acl' => $access_id]];
            $groups = elgg_get_entities_from_metadata($group_options);
            if (!empty($groups)) {
                $group = $groups[0];
                if ($group->thewire_enable == 'no') {
                    // not allowed to post in this group
                    register_error(elgg_echo('thewire_tools:groups:error:not_enabled'));
                    // let creation of object fail
                    return false;
                } else {
                    $container_guid = $group->getGUID();
                }
            }
        }
    }
    // create the new post
    $post = new ElggObject();
    $post->subtype = 'thewire';
    $post->owner_guid = $userid;
    $post->container_guid = $container_guid;
    $post->access_id = $access_id;
    // only xxx characters allowed (see plugin setting of thewire, 0 is unlimited)
    $max_length = thewire_tools_get_wire_length();
    if ($max_length) {
        $text = elgg_substr($text, 0, $max_length);
    }
    // no html tags allowed so we escape
    $post->description = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
    $post->method = $method;
    //method: site, email, api, ...
    $tags = thewire_get_hashtags($text);
    if (!empty($tags)) {
        $post->tags = $tags;
    }
    // must do this before saving so notifications pick up that this is a reply
    if ($parent_guid) {
        $post->reply = true;
    }
    $guid = $post->save();
    if ($guid) {
        // set thread guid
        if ($parent_guid) {
            $post->addRelationship($parent_guid, 'parent');
            // name conversation threads by guid of first post (works even if first post deleted)
            $parent_post = get_entity($parent_guid);
            $post->wire_thread = $parent_post->wire_thread;
        } else {
            // first post in this thread
            $post->wire_thread = $guid;
        }
        // add reshare
        if ($reshare_guid) {
            $post->addRelationship($reshare_guid, 'reshare');
        }
        // add to river
        elgg_create_river_item(['view' => 'river/object/thewire/create', 'action_type' => 'create', 'subject_guid' => $post->getOwnerGUID(), 'object_guid' => $post->getGUID()]);
        // let other plugins know we are setting a user status
        $params = ['entity' => $post, 'user' => $post->getOwnerEntity(), 'message' => $post->description, 'url' => $post->getURL(), 'origin' => 'thewire'];
        elgg_trigger_plugin_hook('status', 'user', $params);
    }
    return $guid;
}
开发者ID:coldtrick,项目名称:thewire_tools,代码行数:86,代码来源:functions.php

示例6: simplekaltura_update_video

/**
 * Helper function to update a simplekaltura video object
 * @param ElggObject 		$video - The elgg object to update
 * @param KalturaMediaEntry	$entry - The kaltura entry, or null if none
 * @return bool
 */
function simplekaltura_update_video($video, $entry = null)
{
    // Don't necessarily need an entry here, if updating an existing video
    if (!$entry) {
        // Assume we're grabbing the entry of the current video
        $entry = simplekaltura_get_entry($video->kaltura_entryid, true);
    }
    // Set up an array of metadata mappings to populate
    $metadata_names = array('duration', 'thumbnailUrl', 'plays', 'views', 'downloadUrl');
    // Set metadata
    foreach ($metadata_names as $name) {
        create_metadata($video->getGUID(), $name, $entry->{$name}, '', $video->getOwnerGUID(), $video->access_id, FALSE);
    }
    // Store the whole shebang just in case (?? not sure if I need this..)
    create_metadata($video->getGUID(), 'raw_entry', serialize($entry), '', $video->getOwnerGUID(), $video->access_id, FALSE);
    return true;
}
开发者ID:beck24,项目名称:Simplekaltura,代码行数:23,代码来源:simplekaltura_lib.php


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