From bdb5d2b95792782ebc379e3348cad1812c1980b4 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 9 Mar 2011 03:07:40 +0000 Subject: Fixes #3058 pulls likes out as a plugin git-svn-id: http://code.elgg.org/elgg/trunk@8639 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggEntity.php | 18 ------------------ engine/lib/elgglib.php | 4 +--- engine/lib/navigation.php | 38 -------------------------------------- engine/lib/upgrades/2010121702.php | 10 ---------- engine/lib/views.php | 20 -------------------- 5 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 engine/lib/upgrades/2010121702.php (limited to 'engine') diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 69401a7e5..bfb7ce063 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -843,24 +843,6 @@ abstract class ElggEntity extends ElggData implements } } - /** - * Count how many people have liked this entity. - * - * @return int Number of likes - * @since 1.8.0 - */ - function countLikes() { - $type = $this->getType(); - $params = array('entity' => $this); - $number = elgg_trigger_plugin_hook('likes:count', $type, $params, false); - - if ($number) { - return $number; - } else { - return $this->getAnnotationCalculation('likes', 'count'); - } - } - /** * Gets an array of entities with a relationship to this entity. * diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 3cc4ddb1d..c97fa433c 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1795,7 +1795,7 @@ function elgg_walled_garden() { /** * Elgg's main init. * - * Handles core actions for comments and likes, the JS pagehandler, and the shutdown function. + * Handles core actions for comments, the JS pagehandler, and the shutdown function. * * @elgg_event_handler init system * @return void @@ -1805,8 +1805,6 @@ function elgg_init() { elgg_register_action('comments/add'); elgg_register_action('comments/delete'); - elgg_register_action('likes/add'); - elgg_register_action('likes/delete'); elgg_register_page_handler('js', 'js_page_handler'); elgg_register_page_handler('css', 'css_page_handler'); diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index b79156986..8c71de03a 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -226,35 +226,6 @@ function elgg_river_menu_setup($hook, $type, $return, $params) { ); $return[] = ElggMenuItem::factory($options); } - - // like this - if ($object->canAnnotate(0, 'likes')) { - if (!elgg_annotation_exists($object->getGUID(), 'likes')) { - $url = "action/likes/add?guid={$object->getGUID()}"; - $options = array( - 'name' => 'like', - 'href' => $url, - 'text' => elgg_echo('likes:likethis'), - 'is_action' => true, - 'priority' => 100, - ); - } else { - $likes = elgg_get_annotations(array( - 'guid' => $guid, - 'annotation_name' => 'likes', - 'owner_guid' => elgg_get_logged_in_user_guid() - )); - $url = elgg_get_site_url() . "action/likes/delete?annotation_id={$likes[0]->id}"; - $options = array( - 'name' => 'like', - 'href' => $url, - 'text' => elgg_echo('likes:remove'), - 'is_action' => true, - 'priority' => 100, - ); - } - $return[] = ElggMenuItem::factory($options); - } } } @@ -303,15 +274,6 @@ function elgg_entity_menu_setup($hook, $type, $return, $params) { $return[] = ElggMenuItem::factory($options); } - // likes - $options = array( - 'name' => 'likes', - 'text' => elgg_view_likes($entity), - 'href' => false, - 'priority' => 1000, - ); - $return[] = ElggMenuItem::factory($options); - return $return; } diff --git a/engine/lib/upgrades/2010121702.php b/engine/lib/upgrades/2010121702.php deleted file mode 100644 index 1c4a931b1..000000000 --- a/engine/lib/upgrades/2010121702.php +++ /dev/null @@ -1,10 +0,0 @@ -dbprefix}river - SET view='river/annotation/likes/create', action_type='create' - WHERE view='annotation/annotatelike' AND action_type='likes'"; -update_data($query); - diff --git a/engine/lib/views.php b/engine/lib/views.php index 09325c2c0..905458a9a 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1124,26 +1124,6 @@ function elgg_view_latest_comments($owner_guid, $type = 'object', $subtype = '', return elgg_view_module('aside', $title, $body); } -/** - * Returns the HTML for "likes" on entities. - * - * @param ElggEntity $entity The entity to like - * - * @return string|false The HTML for the likes, or false on failure - * - * @since 1.8.0 - * @see @elgg_view core/likes/display - */ -function elgg_view_likes($entity) { - if (!($entity instanceof ElggEntity)) { - return false; - } - - $params = array('entity' => $entity); - - return elgg_view('core/likes/display', $params); -} - /** * Wrapper function for the image block display pattern. * -- cgit v1.2.3