aboutsummaryrefslogtreecommitdiff
path: root/views/default/object
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/object')
-rw-r--r--views/default/object/plugin.php4
-rw-r--r--views/default/object/plugin/full.php40
-rw-r--r--views/default/object/plugin/invalid.php5
3 files changed, 27 insertions, 22 deletions
diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php
index 2f64cfcc9..5c7138e96 100644
--- a/views/default/object/plugin.php
+++ b/views/default/object/plugin.php
@@ -7,6 +7,10 @@
*
*/
+if (!elgg_in_context('admin')) {
+ forward('/', 403);
+}
+
$plugin = $vars['entity'];
if (!$plugin->isValid()) {
diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php
index 8955178a6..db0a52416 100644
--- a/views/default/object/plugin/full.php
+++ b/views/default/object/plugin/full.php
@@ -17,19 +17,17 @@ $reordering = elgg_extract('display_reordering', $vars, false);
$priority = $plugin->getPriority();
$active = $plugin->isActive();
-$name = $plugin->getManifest()->getName();
$can_activate = $plugin->canActivate();
$max_priority = elgg_get_max_plugin_priority();
$actions_base = '/action/admin/plugins/';
-
-$ts = time();
-$token = generate_action_token($ts);
+$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
// build reordering links
$links = '';
+$classes = array('elgg-plugin');
if ($reordering) {
- $draggable = 'elgg-state-draggable';
+ $classes[] = 'elgg-state-draggable';
// top and up link only if not at top
if ($priority > 1) {
@@ -89,7 +87,7 @@ if ($reordering) {
)) . "</li>";
}
} else {
- $draggable = 'elgg-state-undraggable';
+ $classes[] = 'elgg-state-undraggable';
}
@@ -101,22 +99,22 @@ $options = array(
'is_trusted' => true,
);
if ($active) {
- $active_class = 'elgg-state-active';
+ $classes[] = 'elgg-state-active';
$action = 'deactivate';
$options['text'] = elgg_echo('admin:plugins:deactivate');
$options['class'] = "elgg-button elgg-button-cancel";
if (!$can_activate) {
- $active_class = 'elgg-state-active';
+ $classes[] = 'elgg-state-active';
$options['class'] = 'elgg-button elgg-state-warning';
}
} else if ($can_activate) {
- $active_class = 'elgg-state-inactive';
+ $classes[] = 'elgg-state-inactive';
$action = 'activate';
$options['text'] = elgg_echo('admin:plugins:activate');
$options['class'] = "elgg-button elgg-button-submit";
} else {
- $active_class = 'elgg-state-inactive';
+ $classes[] = 'elgg-state-inactive';
$action = '';
$options['text'] = elgg_echo('admin:plugins:cannot_activate');
$options['class'] = "elgg-button elgg-button-disabled";
@@ -132,18 +130,20 @@ if ($action) {
}
$action_button = elgg_view('output/url', $options);
-// Display categories
+// Display categories and make category classes
+$categories = $plugin->getManifest()->getCategories();
$categories_html = '';
if ($categories) {
- $categories_arr = array();
$base_url = elgg_get_site_url() . "admin/plugins?category=";
foreach ($categories as $category) {
+ $css_class = preg_replace('/[^a-z0-9-]/i', '-', $category);
+ $classes[] = "elgg-plugin-category-$css_class";
+
$url = $base_url . urlencode($category);
- $categories_arr[] = "<a href=\"$url\">" . htmlspecialchars($category) . '</a>';
+ $friendly_category = htmlspecialchars(ElggPluginManifest::getFriendlyCategory($category));
+ $categories_html .= "<li class=\"elgg-plugin-category prm\"><a href=\"$url\">$friendly_category</a></li>";
}
-
- $categories_html = implode(', ', $categories_arr);
}
$screenshots_html = '';
@@ -196,7 +196,7 @@ if ($files) {
?>
-<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="<?php echo $plugin->getID(); ?>">
+<div class="<?php echo implode(' ', $classes); ?>" id="<?php echo $css_id; ?>">
<div class="elgg-image-block">
<div class="elgg-image-alt">
<?php if ($links) : ?>
@@ -218,7 +218,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
}
?>
<div class="elgg-head">
- <h3><?php echo $plugin->getManifest()->getName(). " $version $settings_link"; ?></h3>
+ <h3><?php echo $plugin->getManifest()->getName() . " $version $settings_link"; ?></h3>
</div>
<?php
if ($plugin->getManifest()->getApiVersion() < 1.8) {
@@ -247,7 +247,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
<div class="pts">
<?php
echo elgg_view('output/url', array(
- 'href' => "#elgg-plugin-manifest-{$plugin->getID()}",
+ 'href' => "#elgg-plugin-manifest-$css_id",
'text' => elgg_echo("admin:plugins:label:moreinfo"),
'rel' => 'toggle',
));
@@ -255,7 +255,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
</div>
</div>
</div>
- <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>">
+ <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $css_id; ?>">
<?php
if ($screenshots_html) {
@@ -266,7 +266,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
if ($categories_html) {
?>
- <div><?php echo elgg_echo('admin:plugins:label:categories') . ": " . $categories_html; ?></div>
+ <div><?php echo elgg_echo('admin:plugins:label:categories') . ": <ul class=\"elgg-plugin-categories\">$categories_html</ul>"; ?></div>
<?php
}
diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php
index bb518cd53..f24e1836c 100644
--- a/views/default/object/plugin/invalid.php
+++ b/views/default/object/plugin/invalid.php
@@ -16,6 +16,7 @@ $id = $plugin->getID();
$path = htmlspecialchars($plugin->getPath());
$message = elgg_echo('admin:plugins:warning:invalid', array($id));
$error = $plugin->getError();
+$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
?>
@@ -27,14 +28,14 @@ $error = $plugin->getError();
<div class="pts">
<?php
echo elgg_view('output/url', array(
- 'href' => "#elgg-plugin-manifest-{$plugin->getID()}",
+ 'href' => "#elgg-plugin-manifest-$css_id",
'text' => elgg_echo("admin:plugins:label:moreinfo"),
'rel' => 'toggle',
));
?>
</div>
- <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>">
+ <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $css_id; ?>">
<p><?php echo elgg_echo('admin:plugins:label:location') . ": " . $path; ?></p>
<p><?php echo $error; ?></p>
</div>