diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2010-07-21 21:30:13 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-07-23 23:05:39 -0700 |
| commit | 48c2e73048be15c7d575293e0e5c69b93ab92398 (patch) | |
| tree | de066a8cad94aa29bb51bcce1e562fed0f30081b /modules/tag | |
| parent | 2cb87631b769c55a7af2b308f0e8975c11369138 (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.php | 13 | ||||
| -rw-r--r-- | modules/tag/controllers/tags.php | 6 |
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)); } } |
