summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-07-21 21:30:13 -0700
committerBharat Mediratta <bharat@menalto.com>2010-07-31 15:44:55 -0700
commit91a2c04a24c320df37ea980f11245eb4e086879e (patch)
tree2eea3bb8c750307b346d8112cdbfb0f44da6887d /modules/tag
parent89d18c0714f5c982ef9e8711a04490bdac8cae2d (diff)
More patches as part of #1225. Change the 'core' modules to use the json::reply
method to set the content type header and encode the response as a json object
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/controllers/admin_tags.php13
-rw-r--r--modules/tag/controllers/tags.php6
2 files changed, 7 insertions, 12 deletions
diff --git a/modules/tag/controllers/admin_tags.php b/modules/tag/controllers/admin_tags.php
index c2da7bc3..32c54945 100644
--- a/modules/tag/controllers/admin_tags.php
+++ b/modules/tag/controllers/admin_tags.php
@@ -37,7 +37,7 @@ class Admin_Tags_Controller extends Admin_Controller {
public function form_delete($id) {
$tag = ORM::factory("tag", $id);
if ($tag->loaded()) {
- print json_encode(array("form" => (string) tag::get_delete_form($tag)));
+ json::reply(array("form" => (string) tag::get_delete_form($tag)));
}
}
@@ -57,11 +57,9 @@ class Admin_Tags_Controller extends Admin_Controller {
message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
- print json_encode(
- array("result" => "success",
- "location" => url::site("admin/tags")));
+ json::reply(array("result" => "success", "location" => url::site("admin/tags")));
} else {
- print json_encode(array("result" => "error", "form" => (string) $form));
+ json::reply(array("result" => "error", "form" => (string) $form));
}
}
@@ -98,10 +96,9 @@ class Admin_Tags_Controller extends Admin_Controller {
message::success($message);
log::success("tags", $message);
- print json_encode(array("result" => "success",
- "location" => url::site("admin/tags")));
+ json::reply(array("result" => "success", "location" => url::site("admin/tags")));
} else {
- print json_encode(array("result" => "error", "form" => $in_place_edit->render()));
+ json::reply(array("result" => "error", "form" => $in_place_edit->render()));
}
}
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index f3d456d3..7fa8534c 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -67,11 +67,9 @@ class Tags_Controller extends Controller {
}
}
- print json_encode(
- array("result" => "success",
- "cloud" => (string)tag::cloud(30)));
+ json::reply(array("result" => "success", "cloud" => (string)tag::cloud(30)));
} else {
- print json_encode(array("result" => "error", "form" => (string) $form));
+ json::reply(array("result" => "error", "form" => (string) $form));
}
}