summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/controllers/admin_tags.php6
-rw-r--r--modules/tag/controllers/tags.php1
-rw-r--r--modules/tag/helpers/tag_event.php9
-rw-r--r--modules/tag/helpers/tag_theme.php12
-rw-r--r--modules/tag/module.info4
-rw-r--r--modules/tag/views/admin_tags.html.php1
6 files changed, 18 insertions, 15 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php
index af5055ff..dcdc16b9 100644
--- a/modules/tag/controllers/admin_tags.php
+++ b/modules/tag/controllers/admin_tags.php
@@ -53,8 +53,8 @@ class Admin_Tags_Controller extends Admin_Controller {
$name = $tag->name;
Database::instance()->delete("items_tags", array("tag_id" => "$tag->id"));
$tag->delete();
- message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
- log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
+ message::success(t("Deleted tag %tag_name", array("tag_name" => p::clean($name))));
+ log::success("tags", t("Deleted tag %tag_name", array("tag_name" => p::clean($name))));
print json_encode(
array("result" => "success",
@@ -98,7 +98,7 @@ class Admin_Tags_Controller extends Admin_Controller {
$tag->save();
$message = t("Renamed tag %old_name to %new_name",
- array("old_name" => $old_name, "new_name" => $tag->name));
+ array("old_name" => p::clean($old_name), "new_name" => p::clean($tag->name)));
message::success($message);
log::success("tags", $message);
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index eeeb28d7..85f6d16e 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -37,6 +37,7 @@ class Tags_Controller extends REST_Controller {
$template->set_global("children", $tag->items($page_size, $offset));
$template->set_global("children_count", $children_count);
$template->content = new View("dynamic.html");
+ $template->content->title = $tag->name;
print $template;
}
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index 946326c0..7a170bf8 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -34,10 +34,13 @@ class tag_event_Core {
if (!empty($iptc["2#025"])) {
foreach($iptc["2#025"] as $tag) {
$tag = str_replace("\0", "", $tag);
- if (function_exists("mb_detect_encoding") && mb_detect_encoding($tag) != "UTF-8") {
- $tag = utf8_encode($tag);
+ foreach (preg_split("/[,;]/", $tag) as $word) {
+ $word = preg_replace('/\s+/', '.', trim($word));
+ if (function_exists("mb_detect_encoding") && mb_detect_encoding($word) != "UTF-8") {
+ $word = utf8_encode($word);
+ }
+ $tags[$word] = 1;
}
- $tags[$tag] = 1;
}
}
}
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index a32d71b6..fe30354f 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -19,15 +19,15 @@
*/
class tag_theme_Core {
static function head($theme) {
- $url = url::file("modules/tag/js/tag.js");
- return "<script src=\"$url\" type=\"text/javascript\"></script>";
+ $theme->script("modules/tag/js/tag.js");
+ }
+
+ static function admin_head($theme) {
+ $theme->script("modules/tag/js/tag.js");
}
static function sidebar_blocks($theme) {
// @todo this needs to be data driven
- if (!$theme->item()) {
- return;
- }
$block = new Block();
$block->css_id = "gTag";
@@ -35,7 +35,7 @@ class tag_theme_Core {
$block->content = new View("tag_block.html");
$block->content->cloud = tag::cloud(30);
- if ($theme->page_type() != "tag" && access::can("edit", $theme->item())) {
+ if ($theme->item() && $theme->page_type() != "tag" && access::can("edit", $theme->item())) {
$controller = new Tags_Controller();
$block->content->form = tag::get_add_form($theme->item());
} else {
diff --git a/modules/tag/module.info b/modules/tag/module.info
index 562d5c32..e505dd81 100644
--- a/modules/tag/module.info
+++ b/modules/tag/module.info
@@ -1,3 +1,3 @@
-name = Tags
-description = Allows users to tag photos and albums
+name = "Tags"
+description = "Allows users to tag photos and albums"
version = 1
diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php
index 21661c48..7d201da7 100644
--- a/modules/tag/views/admin_tags.html.php
+++ b/modules/tag/views/admin_tags.html.php
@@ -1,5 +1,4 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<script src="<?= url::file("modules/tag/js/tag.js") ?>" type="text/javascript"></script>
<script>
var TAG_RENAME_URL = "<?= url::site("admin/tags/rename/__ID__") ?>";
$("document").ready(function() {