diff options
Diffstat (limited to 'mod/embed/views/default')
-rw-r--r-- | mod/embed/views/default/embed/embed.php | 67 | ||||
-rw-r--r-- | mod/embed/views/default/embed/link.php | 2 |
2 files changed, 38 insertions, 31 deletions
diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php index 250a7a465..b57c3b289 100644 --- a/mod/embed/views/default/embed/embed.php +++ b/mod/embed/views/default/embed/embed.php @@ -12,7 +12,7 @@ $sections = elgg_get_array_value('sections', $vars, array()); $active_section = elgg_get_array_value('active_section', $vars, array_shift(array_keys($sections))); $upload_sections = elgg_get_array_value('upload_sections', $vars, array()); -$internal_name = elgg_get_array_value('internal_name', $vars, array()); +$internal_name = elgg_get_array_value('internal_name', $vars); if (!$sections) { $content = elgg_echo('embed:no_sections'); @@ -80,34 +80,38 @@ if (!$sections) { if (!elgg_view_exists($view)) { $view = "embed/item/$layout"; } - - // pull out some common tests - // embed requires ECML, but until we have plugin deps working - // we need to explicitly check and use a fallback. - if ($ecml_enabled = is_plugin_enabled('ecml')){ - $ecml_valid_keyword = ecml_is_valid_keyword($active_section); + + if (!isset($embed_info['items']) || !is_array($embed_info['items']) || !count($embed_info['items'])) { + $content .= elgg_echo('embed:no_section_content'); } else { - $ecml_valid_keyword = FALSE; - } - - $items_content = ''; - foreach ($embed_info['items'] as $item) { - $item_params = array( - 'section' => $active_section, - 'item' => $item, - 'ecml_enabled' => $ecml_enabled, - 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity', - 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'), - ); - - $items_content .= elgg_view($view, $item_params); + // pull out some common tests + // embed requires ECML, but until we have plugin deps working + // we need to explicitly check and use a fallback. + if ($ecml_enabled = is_plugin_enabled('ecml')){ + $ecml_valid_keyword = ecml_is_valid_keyword($active_section); + } else { + $ecml_valid_keyword = FALSE; + } + + $items_content = ''; + foreach ($embed_info['items'] as $item) { + $item_params = array( + 'section' => $active_section, + 'item' => $item, + 'ecml_enabled' => $ecml_enabled, + 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity', + 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'), + ); + + $items_content .= elgg_view($view, $item_params); + } + + $params['content'] = $items_content; + $params['count'] = $embed_info['count']; + + $content .= elgg_view('navigation/pagination', $params); + $content .= elgg_view("embed/layouts/$layout", $params); } - - $params['content'] = $items_content; - $params['count'] = $embed_info['count']; - - $content .= elgg_view('navigation/pagination', $params); - $content .= elgg_view("embed/layouts/$layout", $params); } else { $content .= elgg_echo('embed:no_section_content'); } @@ -115,21 +119,24 @@ if (!$sections) { $content .= elgg_echo('embed:invalid_section'); } } + echo $content; ?> <script type="text/javascript"> $(document).ready(function() { + var internal_name = '<?php echo addslashes($internal_name); ?>'; + // insert embed codes $('.embed_data').click(function() { - var embed_code = $(this).data('embed_code'); - elggEmbedInsertContent(embed_code, '<?php echo addslashes($internal_name); ?>'); + var embed_code = $(this).data('embed_code') + elggEmbedInsertContent(embed_code, internal_name); }); // tabs $('.embed_section').click(function() { var section = $(this).attr('id'); - var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=' + section; + var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=' + section + '&internal_name=' + internal_name; $('#facebox .body .content').load(url); return false; diff --git a/mod/embed/views/default/embed/link.php b/mod/embed/views/default/embed/link.php index 8776893ec..6740b8e1a 100644 --- a/mod/embed/views/default/embed/link.php +++ b/mod/embed/views/default/embed/link.php @@ -3,4 +3,4 @@ * Displays an "Embed media" link in longtext inputs. */ ?> -<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed'; ?>?internalname=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a> +<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed'; ?>?internal_name=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a> |