summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-29 16:21:43 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-29 16:21:43 +0100
commitcc4b00347c9ff061488bc88194002be701f4190f (patch)
tree899984be1b01268cff965aa30d31e5f56a8701a3 /user_guide_src/source
parente1d6c46b7d5e3d82dc6953af29f0b02ccb03e2dc (diff)
Added CI_Output::get_header()
(an improved version of PR #645) Also fixed get_content_type() to only return the MIME value and created Output library unit tests for both of these methods.
Diffstat (limited to 'user_guide_src/source')
-rw-r--r--user_guide_src/source/changelog.rst3
-rw-r--r--user_guide_src/source/libraries/output.rst30
2 files changed, 27 insertions, 6 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index ab1d99dab..09c425d0a 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -294,8 +294,9 @@ Release Date: Not Released
- Added support for HTTP-Only cookies with new config option *cookie_httponly* (default FALSE).
- Renamed method ``_call_hook()`` to ``call_hook()`` in the :doc:`Hooks Library <general/hooks>`.
- :doc:`Output Library <libraries/output>` changes include:
- - Added method ``get_content_type()``.
- Added a second argument to method ``set_content_type()`` that allows setting the document charset as well.
+ - Added method ``get_content_type()``.
+ - Added method ``get_header()``.
- ``$config['time_reference']`` now supports all timezone strings supported by PHP.
- :doc:`Config Library <libraries/config>` changes include:
- Changed ``site_url()`` method to accept an array as well.
diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst
index 82b1a56a5..a3d67b847 100644
--- a/user_guide_src/source/libraries/output.rst
+++ b/user_guide_src/source/libraries/output.rst
@@ -53,17 +53,37 @@ You can also set the character set of the document, by passing a second argument
$this->output->set_content_type('css', 'utf-8');
-$this->output->get_content_type();
-==========================================
+$this->output->get_content_type()
+=================================
-Returns the Content-Type HTTP header that's currently in use.
+Returns the Content-Type HTTP header that's currently in use,
+excluding the character set value.
$mime = $this->output->get_content_type();
.. note:: If not set, the default return value is 'text/html'.
-$this->output->get_output();
-=============================
+$this->output->get_header()
+===========================
+
+Gets the requested HTTP header value, if set.
+
+If the header is not set, NULL will be returned.
+If an empty value is passed to the method, it will return FALSE.
+
+Example::
+
+ $this->output->set_content_type('text/plain', 'UTF-8');
+ echo $this->output->get_header('content-type');
+ // Outputs: text/plain; charset=utf-8
+
+.. note:: The header name is compared in a case-insensitive manner.
+
+.. note:: Raw headers sent via PHP's native ``header()`` function are
+ also detected.
+
+$this->output->get_output()
+===========================
Permits you to manually retrieve any output that has been sent for
storage in the output class. Usage example::