public function upgrade() { if (!elgg_is_admin_logged_in()) { return; } // Rerun activate.php require_once hypeWall()->plugin->getPath() . 'activate.php'; // Run upgrades $this->upgrade20140211(); }
<?php $target_guid = elgg_extract('target_guid', $vars); $post_guids = elgg_extract('post_guids', $vars); elgg_entity_gatekeeper($target_guid); elgg_group_gatekeeper(true, $target_guid); $target = get_entity($target_guid); elgg_set_page_owner_guid($target->guid); elgg_push_breadcrumb(elgg_echo('wall'), hypeWall()->router->getPageHandlerId()); if (is_callable(array($target, 'getDisplayName'))) { $name = $target->getDisplayName(); } else { $name = $target instanceof ElggObject ? $target->title : $target->name; } $title = elgg_echo('wall:owner', array($name)); elgg_push_breadcrumb($title, hypeWall()->router->normalize($target->guid)); $content = elgg_view('lists/wall', array('entity' => $target, 'post_guids' => $post_guids)); if (elgg_is_xhr()) { echo $content; } else { $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => false)); echo elgg_view_page($title, $layout); }
<?php /** * Add session geopositioning data to the config */ if (!hypeWall()->config->get('geopositioning')) { return; } $geopositioning = json_encode(hypeWall()->geo->get()); ?> //<script> elgg.session.geopositioning = <?php echo $geopositioning; ?> ;
//if (elgg_get_plugin_setting('file', PLUGIN_ID)) { // elgg_register_menu_item('wall-filter', array( // 'name' => 'file', // 'text' => '<i class="wall-icon wall-icon-file"></i>', // 'title' => elgg_echo('wall:file'), // 'href' => '#wall-form-file', // 'class' => 'wall-tab', // 'priority' => 300 // )); // $forms .= elgg_view_form('wall/file', array( // 'id' => 'wall-form-file', // 'class' => 'wall-form hidden', // 'enctype' => 'multipart/form-data' // ), $vars); //} if (hypeWall()->config->get('content') && elgg_is_active_plugin('elgg_tokeninput')) { elgg_register_menu_item('wall-filter', array('name' => 'content', 'text' => '<i class="wall-icon wall-icon-content"></i>', 'title' => elgg_echo('wall:content'), 'href' => '#wall-form-content', 'selected' => $default == 'content', 'link_class' => 'wall-tab', 'priority' => 300)); $class = 'wall-form'; if ($default !== 'content') { $class .= ' hidden'; } $forms .= elgg_view_form('wall/content', array('id' => 'wall-form-content', 'class' => $class), $vars); } $forms .= elgg_view('framework/wall/container/extend', $vars); $tabs = elgg_view_menu('wall-filter', array('sort_by' => 'priority')); $class = elgg_in_context('activity') ? 'wall-river' : 'wall-to-wall'; if (elgg_in_context('widgets')) { $user_icon = $page_owner_icon = ''; $forms = $tabs . $forms; echo elgg_view_image_block($user_icon . $page_owner_icon, $forms, array('class' => "wall-container {$class}")); } else {
<?php if (!elgg_view_exists('input/tokeninput') || !hypeWall()->config->geopositioning) { return; } if (!$vars['value']) { $geopositioning = hypeWall()->geo->get(); if ($geopositioning['location']) { $vars['value'] = $geopositioning['location']; } else { if (elgg_instanceof($vars['entity'])) { $vars['value'] = $vars['entity']->location; } else { $vars['value'] = elgg_get_logged_in_user_entity()->location; } } } $vars['callback'] = 'hypeJunction\\Wall\\search_locations'; $vars['class'] = 'wall-location-tokeninput'; if (!isset($vars['multiple'])) { $vars['multiple'] = false; } if (!isset($vars['strict'])) { $vars['strict'] = false; } $vars['data-token-delimiter'] = ";"; $vars['data-allow-tab-out'] = true; echo '<label>' . elgg_echo('wall:location') . '</label>'; echo elgg_view('output/url', array('href' => '#', 'text' => elgg_echo('wall:find_me'), 'title' => elgg_echo('wall:tag:location:findme'), 'class' => 'wall-find-me')); echo elgg_view('input/tokeninput', $vars);
/** * Returns page handler ID * @return string */ public function getPageHandlerId() { return hypeWall()->config->get('pagehandler_id'); }
<?php $entity = elgg_extract('entity', $vars); $user = elgg_get_page_owner_entity(); echo '<div>'; echo '<label>' . elgg_echo('wall:usersettings:river_access_id') . '</label>'; echo '<div class="elgg-text-help">' . elgg_echo('wall:usersettings:river_access_id:help') . '</div>'; $user_write_access = get_write_access_array(); unset($user_write_access[ACCESS_PUBLIC]); unset($user_write_access[ACCESS_LOGGED_IN]); echo elgg_view('input/access', array('name' => 'params[river_access_id]', 'value' => elgg_get_plugin_user_setting('river_access_id', $user->guid, 'hypeWall'), 'options_values' => $user_write_access)); echo '</div>'; if (hypeWall()->config->third_party_wall) { echo '<div>'; echo '<label>' . elgg_echo('wall:usersettings:third_party_wall') . '</label>'; echo elgg_view('input/access', array('name' => 'params[third_party_wall]', 'value' => elgg_get_plugin_user_setting('third_party_wall', $user->guid, 'hypeWall'), 'options_values' => array(0 => elgg_echo('option:no'), 1 => elgg_echo('option:yes')))); echo '</div>'; }
<?php if (!elgg_view_exists('input/tokeninput') || !hypeWall()->config->get('tag_friends')) { return; } if (!$vars['value'] && elgg_instanceof($vars['entity'])) { $vars['value'] = elgg_get_entities_from_relationship(array('relationship' => 'tagged_in', 'relationship_guid' => $vars['entity']->guid, 'inverse_relationship' => true, 'limit' => false)); } $vars['callback'] = 'elgg_tokeninput_search_friends'; $vars['class'] = 'wall-tag-tokeninput'; if (!isset($vars['multiple'])) { $vars['multiple'] = true; } if (!isset($vars['strict'])) { $vars['strict'] = true; } echo '<label>' . elgg_echo('wall:tag_friends') . '</label>'; echo elgg_view('input/tokeninput', $vars);
/** * {@inheritdoc} */ public function execute() { hypeWall()->geo->set($this->location, $this->latitude, $this->longitude); }
/** * Get an array of wall subtypes * @return array */ function get_wall_subtypes() { return array_unique(array(hypeWall()->config->getPostSubtype(), 'hjwall')); }
<?php $input_type = hypeWall()->config->status_input_type; if (!$input_type) { $input_type = 'plaintext'; } if (!$vars['value'] && elgg_instanceof($vars['entity'])) { $vars['value'] = $vars['entity']->description; } $vars['class'] = "{$vars['class']} wall-input-status-wire"; $char_limit = hypeWall()->config->character_limit; if ($char_limit > 0) { $vars['data-limit'] = $char_limit; $counter = '<div class="wall-status-counter" data-counter>'; $counter .= '<span data-counter-indicator class="wall-chars-counter">'; $counter .= $char_limit; $counter .= '</span>'; $counter .= elgg_echo('wall:characters_remaining'); $counter .= '</div>'; } if (!isset($vars['name'])) { $vars['name'] = 'status'; } echo $counter; echo elgg_view("input/{$input_type}", $vars);
<?php /** * User Walls * * @package hypeJunction * @subpackage Wall * * @author Ismayil Khayredinov <*****@*****.**> */ require_once __DIR__ . '/autoloader.php'; hypeWall()->boot();
/** * {@inheritdoc} */ public function execute() { if (!$this->post) { if ($this->subtype == 'thewire' && is_callable('thewire_save_post')) { $guid = thewire_save_post($this->status, $this->poster->guid, $this->access_id, 0, 'wall'); $this->post = get_entity($guid); } else { $this->post = new Post(); $this->post->subtype = $this->subtype; $this->post->owner_guid = $this->poster->guid; $this->post->container_guid = $this->container->guid; $guid = $this->post->save(); } } $this->post->title = $this->title; $this->post->description = $this->status; $this->post->access_id = $this->access_id; if (!$this->post->guid) { $this->result->addError(elgg_echo('wall:create:error')); return; } if (Integration::isElggVersionBelow('1.9.0')) { $river_id = add_to_river('river/object/hjwall/create', 'create', $this->poster->guid, $this->post->guid); } else { // Create a river entry for this wall post $river_id = elgg_create_river_item(array('view' => 'river/object/hjwall/create', 'action_type' => 'create', 'subject_guid' => $this->post->owner_guid, 'object_guid' => $this->post->guid, 'target_guid' => $this->post->container_guid)); } $river = elgg_get_river(array('ids' => $river_id)); $this->river = $river ? $river[0] : null; $this->post->origin = 'wall'; $qualifiers = elgg_trigger_plugin_hook('extract:qualifiers', 'wall', array('source' => $this->post->description), array()); if (count($qualifiers['hashtags'])) { $this->post->tags = $qualifiers['hashtags']; } if (count($qualifiers['usernames'])) { foreach ($qualifiers['usernames'] as $username) { $user = get_user_by_username($username); if (elgg_instanceof($user) && !in_array($user->guid, $this->friend_guids)) { $this->friend_guids[] = $user->guid; } } } // Add 'tagged_in' relationships // If the access level for the post is not set to private, also create a river item // with the access level specified in their settings by the tagged user if (!empty($this->friend_guids)) { foreach ($this->friend_guids as $friend_guid) { if (add_entity_relationship($friend_guid, 'tagged_in', $this->post->guid)) { if (!in_array($this->access_id, array(ACCESS_PRIVATE, ACCESS_LOGGED_IN, ACCESS_PUBLIC))) { $river_access_id = elgg_get_plugin_user_setting('river_access_id', $friend_guid, 'hypeWall'); if (!is_null($river_access_id) && $river_access_id !== ACCESS_PRIVATE) { $river_id = elgg_create_river_item(array('view' => 'river/relationship/tagged/create', 'action_type' => 'tagged', 'subject_guid' => $friend_guid, 'object_guid' => $this->post->getGUID(), 'target_guid' => $this->post->getContainerGUID(), 'access_id' => $river_access_id)); } } } } } // Wall post access id is set to private, which means it should be visible only to the poster and tagged users // Creating a new ACL for that if ($this->access_id == ACCESS_PRIVATE && count($this->friend_guids)) { $members = $this->friend_guids; $members[] = $this->poster->guid; $members[] = $this->container->guid; $acl_id = AccessCollection::create($members); $this->post->access_id = $acl_id; $this->post->save(); } if (!empty($this->attachment_guids)) { foreach ($this->attachment_guids as $attachment_guid) { add_entity_relationship($attachment_guid, 'attached', $this->post->guid); } } // files being uploaded via $_FILES $uploads = hypeApps()->uploader->handle('upload_guids'); $uploaded_file_guids = []; if ($uploads) { foreach ($uploads as $upload) { if ($upload instanceof \ElggFile) { $file_obj = $upload; } else { if ($upload instanceof \hypeJunction\Files\Upload) { $file_obj = $upload->file; } } if ($file_obj->guid) { $uploaded_file_guids[] = $file_obj->guid; } } } // Something is broken in the hypeApps setter, so doing this hack for now $this->upload_guids = array_merge($this->upload_guids, $uploaded_file_guids); if (!empty($this->upload_guids)) { foreach ($this->upload_guids as $upload_guid) { $upload = get_entity($upload_guid); if ($upload) { $upload->description = $this->post->description; $upload->origin = 'wall'; $upload->access_id = $this->post->access_id; $upload->container_guid = $this->container->canWriteToContainer($this->poster->guid, 'object', 'file') ? $this->container->guid : ELGG_ENTITIES_ANY_VALUE; if ($upload->save()) { add_entity_relationship($upload_guid, 'attached', $this->post->guid); } } } } $this->post->setLocation($this->location); $this->post->address = $this->address; if ($this->post->address && $this->make_bookmark) { $document = elgg_trigger_plugin_hook('extract:meta', 'wall', array('src' => $this->post->address)); $bookmark = new ElggObject(); $bookmark->subtype = "bookmarks"; $bookmark->container_guid = $this->container->canWriteToContainer($this->poster->guid, 'object', 'bookmarks') ? $this->container->guid : ELGG_ENTITIES_ANY_VALUE; $bookmark->address = $this->post->address; $bookmark->access_id = $this->post->access_id; $bookmark->origin = 'wall'; if (!$document) { $bookmark->title = $this->post->title; $bookmark->description = $this->post->description; $bookmark->tags = $this->post->tags; } else { $bookmark->title = filter_tags($document->meta->title); $bookmark->description = filter_tags($document->meta->description); $bookmark->tags = string_to_tag_array(filter_tags($document->meta->keywords)); } $bookmark->save(); $this->bookmark = $bookmark; } if ($this->post->save()) { $message = $this->post->formatMessage(); $params = array('entity' => $this->post, 'user' => $this->poster, 'message' => $message, 'url' => $this->post->getURL(), 'origin' => 'wall'); elgg_trigger_plugin_hook('status', 'user', $params); // Trigger a publish event, so that we can send out notifications elgg_trigger_event('publish', 'object', $this->post); if (get_input('widget')) { elgg_push_context('widgets'); } if (elgg_is_xhr()) { $this->result->output .= elgg_list_river(array('object_guids' => $this->post->guid, 'pagination' => false, 'pagination_type' => false, 'limit' => 0)); } $this->result->addMessage(elgg_echo('wall:create:success')); if ($this->container instanceof \ElggUser) { $this->result->setForwardURL(hypeWall()->router->normalize("owner/{$this->container->username}")); } else { $this->result->setForwardURL(hypeWall()->router->normalize("container/{$this->container->guid}")); } } else { $this->result->addError(elgg_echo('wall:create:error')); } }
//)); //echo '</div>'; if (elgg_is_active_plugin('elgg_tokeninput')) { echo '<div>'; echo '<label>' . elgg_echo('wall:settings:content') . '</label>'; echo elgg_view('input/dropdown', array('name' => 'params[content]', 'value' => hypeWall()->config->content, 'options_values' => array(0 => elgg_echo('option:no'), 1 => elgg_echo('option:yes')))); echo '</div>'; } echo '<div>'; echo '<label>' . elgg_echo('wall:settings:default_form') . '</label>'; echo elgg_view('input/dropdown', array('name' => 'params[default_form]', 'value' => hypeWall()->config->default_form, 'options_values' => array('status' => elgg_echo('wall:settings:status'), 'url' => elgg_echo('wall:settings:url'), 'photo' => elgg_echo('wall:settings:photo'), 'content' => elgg_is_active_plugin('elgg_tokeninput') ? elgg_echo('wall:settings:content') : null))); echo '</div>'; echo '<h3>' . elgg_echo('wall:settings:features') . '</h3>'; if (elgg_is_active_plugin('elgg_tokeninput')) { echo '<div>'; echo '<label>' . elgg_echo('wall:settings:geopositioning') . '</label>'; echo elgg_view('input/dropdown', array('name' => 'params[geopositioning]', 'value' => hypeWall()->config->geopositioning, 'options_values' => array(0 => elgg_echo('option:no'), 1 => elgg_echo('option:yes')))); echo '</div>'; echo '<div>'; echo '<label>' . elgg_echo('wall:settings:tag_friends') . '</label>'; echo elgg_view('input/dropdown', array('name' => 'params[tag_friends]', 'value' => hypeWall()->config->tag_friends, 'options_values' => array(0 => elgg_echo('option:no'), 1 => elgg_echo('option:yes')))); echo '</div>'; } echo '<div>'; echo '<label>' . elgg_echo('wall:settings:third_party_wall') . '</label>'; echo elgg_view('input/dropdown', array('name' => 'params[third_party_wall]', 'value' => hypeWall()->config->third_party_wall, 'options_values' => array(0 => elgg_echo('option:no'), 1 => elgg_echo('option:yes')))); echo '</div>'; echo '<div>'; echo '<label>' . elgg_echo('wall:settings:status_input_type') . '</label>'; echo elgg_view('input/dropdown', array('name' => 'params[status_input_type]', 'value' => hypeWall()->config->status_input_type, 'options_values' => array('plaintext' => elgg_echo('wall:settings:status_input_type:plaintext'), 'text' => elgg_echo('wall:settings:status_input_type:text'), 'longtext' => elgg_echo('wall:settings:status_input_type:longtext')))); echo '</div>';