aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-08-27 18:54:13 -0700
committerBrett Profitt <brett.profitt@gmail.com>2011-08-27 18:54:13 -0700
commit146c55ddd745be06f6206e70884cb9e430ba6231 (patch)
tree8277881f60c3d09f1054997caba0bda5983f798d /mod/file
parent0179e8c68b0827d77c61a31c8c0d6bf4a277c785 (diff)
downloadelgg-146c55ddd745be06f6206e70884cb9e430ba6231.tar.gz
elgg-146c55ddd745be06f6206e70884cb9e430ba6231.tar.bz2
Fixes #2911. Embed plugins works again. Added menu for embed sections. This plugin is painfully messy.
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/start.php87
1 files changed, 17 insertions, 70 deletions
diff --git a/mod/file/start.php b/mod/file/start.php
index b94dc309a..749d7a519 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -57,11 +57,23 @@ function file_init() {
// temporary - see #2010
elgg_register_action("file/download", "$action_path/download.php");
-
// embed support
- elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections');
- elgg_register_plugin_hook_handler('embed_get_items', 'file', 'file_embed_get_items');
- elgg_register_plugin_hook_handler('embed_get_upload_sections', 'all', 'file_embed_get_upload_sections');
+ $item = ElggMenuItem::factory(array(
+ 'name' => 'file',
+ 'text' => elgg_echo('file'),
+ 'href' => '#',
+ 'section' => 'select'
+ ));
+ elgg_register_menu_item('embed:sections', $item);
+
+ $item = ElggMenuItem::factory(array(
+ 'name' => 'file_upload',
+ 'text' => elgg_echo('file:upload'),
+ 'href' => '#',
+ 'section' => 'upload'
+ ));
+
+ elgg_register_menu_item('embed:sections', $item);
}
/**
@@ -332,69 +344,4 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) {
$url = elgg_trigger_plugin_hook('file:icon:url', 'override', $params, $url);
return $url;
}
-}
-
-/**
- * Register file as an embed type.
- *
- * @param unknown_type $hook
- * @param unknown_type $type
- * @param unknown_type $value
- * @param unknown_type $params
- */
-function file_embed_get_sections($hook, $type, $value, $params) {
- $value['file'] = array(
- 'name' => elgg_echo('file'),
- 'layout' => 'list',
- 'icon_size' => 'small',
- );
-
- return $value;
-}
-
-/**
- * Return a list of files for embedding
- *
- * @param unknown_type $hook
- * @param unknown_type $type
- * @param unknown_type $value
- * @param unknown_type $params
- */
-function file_embed_get_items($hook, $type, $value, $params) {
- $options = array(
- 'owner_guid' => elgg_get_logged_in_user_guid(),
- 'type_subtype_pair' => array('object' => 'file'),
- 'count' => TRUE
- );
-
- if ($count = elgg_get_entities($options)) {
- $value['count'] += $count;
-
- unset($options['count']);
- $options['offset'] = $params['offset'];
- $options['limit'] = $params['limit'];
-
- $items = elgg_get_entities($options);
-
- $value['items'] = array_merge($items, $value['items']);
- }
-
- return $value;
-}
-
-/**
- * Register file as an embed type.
- *
- * @param unknown_type $hook
- * @param unknown_type $type
- * @param unknown_type $value
- * @param unknown_type $params
- */
-function file_embed_get_upload_sections($hook, $type, $value, $params) {
- $value['file'] = array(
- 'name' => elgg_echo('file'),
- 'view' => 'file/embed_upload'
- );
-
- return $value;
-}
+} \ No newline at end of file