Created
April 8, 2018 00:18
-
-
Save RiverVanRain/ba41185a55040a8a5552d180ff8a2469 to your computer and use it in GitHub Desktop.
Test the memcache issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ElggWire extends ElggObject { | |
/** | |
* Set subtype to thewire | |
* | |
* @return void | |
*/ | |
protected function initializeAttributes() { | |
parent::initializeAttributes(); | |
$this->attributes['subtype'] = 'thewire'; | |
} | |
/** | |
* Can a user comment on this wire post? | |
* | |
* @see ElggObject::canComment() | |
* | |
* @param int $user_guid User guid (default is logged in user) | |
* @param bool $default Default permission | |
* | |
* @return bool | |
* | |
* @since 1.8.0 | |
*/ | |
public function canComment($user_guid = 0, $default = null) { | |
$result = parent::canComment($user_guid, $default); | |
if ($result == false) { | |
return $result; | |
} | |
return false; | |
} | |
public function hi() { | |
return 'hi'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* View a wire post | |
* | |
* @uses $vars['entity'] | |
*/ | |
elgg_require_js('elgg/thewire'); | |
$full = elgg_extract('full_view', $vars, FALSE); | |
$post = elgg_extract('entity', $vars, FALSE); | |
if (!$post) { | |
return true; | |
} | |
// make compatible with posts created with original Curverider plugin | |
$thread_id = $post->wire_thread; | |
if (!$thread_id) { | |
$post->wire_thread = $post->guid; | |
} | |
$owner = $post->getOwnerEntity(); | |
$owner_icon = elgg_view_entity_icon($owner, 'tiny'); | |
$owner_link = elgg_view('output/url', array( | |
'href' => "thewire/owner/$owner->username", | |
'text' => $owner->name, | |
'is_trusted' => true, | |
)); | |
$author_text = elgg_echo('byline', array($owner_link)); | |
$date = elgg_view_friendly_time($post->time_created); | |
$subtitle = "$author_text $date"; | |
$metadata = ''; | |
if (!elgg_in_context('widgets')) { | |
// only show entity menu outside of widgets | |
$metadata = elgg_view_menu('entity', array( | |
'entity' => $post, | |
'handler' => 'thewire', | |
'sort_by' => 'priority', | |
'class' => 'elgg-menu-hz', | |
)); | |
} | |
$params = array( | |
'entity' => $post, | |
'title' => false, | |
'metadata' => $metadata, | |
'subtitle' => $subtitle, | |
'content' => thewire_filter($post->description) . $post->hi(), | |
'tags' => false, | |
'icon' => $owner_icon, | |
'class' => 'thewire-post', | |
); | |
$params = $params + $vars; | |
echo elgg_view('object/elements/summary', $params); | |
if ($post->reply) { | |
echo "<div class=\"thewire-parent hidden\" id=\"thewire-previous-{$post->guid}\">"; | |
echo "</div>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment