From 91a2c04a24c320df37ea980f11245eb4e086879e Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 21 Jul 2010 21:30:13 -0700 Subject: 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 --- modules/watermark/controllers/admin_watermarks.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'modules/watermark') diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index 8b217b4a..922b050b 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -35,7 +35,7 @@ class Admin_Watermarks_Controller extends Admin_Controller { } public function form_edit() { - print json_encode(array("form" => (string) watermark::get_edit_form())); + json::reply(array("form" => (string) watermark::get_edit_form())); } public function edit() { @@ -49,16 +49,16 @@ class Admin_Watermarks_Controller extends Admin_Controller { log::success("watermark", t("Watermark changed")); message::success(t("Watermark changed")); - print json_encode( + json::reply( array("result" => "success", "location" => url::site("admin/watermarks"))); } else { - print json_encode(array("result" => "error", "form" => (string) $form)); + json::reply(array("result" => "error", "form" => (string) $form)); } } public function form_delete() { - print json_encode(array("form" => (string) watermark::get_delete_form())); + json::reply(array("form" => (string) watermark::get_delete_form())); } public function delete() { @@ -79,16 +79,14 @@ class Admin_Watermarks_Controller extends Admin_Controller { log::success("watermark", t("Watermark deleted")); message::success(t("Watermark deleted")); } - print json_encode( - array("result" => "success", - "location" => url::site("admin/watermarks"))); + json::reply(array("result" => "success", "location" => url::site("admin/watermarks"))); } else { - print json_encode(array("result" => "error", "form" => (string) $form)); + json::reply(array("result" => "error", "form" => (string) $form)); } } public function form_add() { - print json_encode(array("form" => (string) watermark::get_add_form())); + json::reply(array("form" => (string) watermark::get_add_form())); } public function add() { @@ -120,11 +118,9 @@ class Admin_Watermarks_Controller extends Admin_Controller { message::success(t("Watermark saved")); log::success("watermark", t("Watermark saved")); - print json_encode( - array("result" => "success", - "location" => url::site("admin/watermarks"))); + json::reply(array("result" => "success", "location" => url::site("admin/watermarks"))); } else { - print json_encode(array("result" => "error", "form" => rawurlencode((string) $form))); + json::reply(array("result" => "error", "form" => rawurlencode((string) $form))); } } -- cgit v1.2.3