예제 #1
0
파일: start.php 프로젝트: remy40/gvrs
function gvthewire_save_post($text, $userid, $access_id, $parent_guid = 0, $method = "site", $container_guid = 0)
{
    $post = new ElggObject();
    $post->subtype = "thewire";
    $post->owner_guid = $userid;
    $post->access_id = $access_id;
    if ($container_guid) {
        $post->container_guid = $container_guid;
    }
    $text = elgg_substr($text, 0, gvthewire_get_character_limit());
    // 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 ($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->owner_guid, $post->guid);
        // 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;
}
예제 #2
0
파일: add.php 프로젝트: remy40/gvrs
 */
elgg_load_js('elgg.thewire');
$post = elgg_extract('post', $vars);
$container_guid = $vars['container_guid'];
error_log("FORMS : container_guid: {$container_guid}");
$text = elgg_echo('post');
if ($post) {
    $text = elgg_echo('thewire:reply');
}
if ($post) {
    echo elgg_view('input/hidden', array('name' => 'parent_guid', 'value' => $post->guid));
}
if ($container_guid) {
    echo elgg_view('input/hidden', array('name' => 'container_guid', 'value' => $container_guid));
}
echo elgg_view('input/plaintext', array('name' => 'body', 'class' => 'mtm', 'id' => 'thewire-textarea'));
?>
<div id="thewire-characters-remaining">
	<span><?php 
echo gvthewire_get_character_limit();
?>
</span> <?php 
echo elgg_echo('thewire:charleft');
?>
</div>
<div class="elgg-foot mts">
<?php 
echo elgg_view('input/submit', array('value' => $text, 'id' => 'thewire-submit-button'));
?>
</div>