summaryrefslogtreecommitdiffstats
path: root/system/helpers/smiley_helper.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-05-17 14:53:07 +0200
committerTimothy Warren <tim@timshomepage.net>2012-05-17 14:53:07 +0200
commit0ab28ced4d4f20d5857fae9ec0e20452d4ac181b (patch)
treefae554725bd9b187f9b298e5702f951ac394a6d7 /system/helpers/smiley_helper.php
parentd013c63462b4eaa2ac2f684b2ad498a9c4fb7dd5 (diff)
parente30b3f7afafa2c016cf78cc8bb8a457c2dbcda8c (diff)
merge upstream
Diffstat (limited to 'system/helpers/smiley_helper.php')
-rw-r--r--system/helpers/smiley_helper.php103
1 files changed, 40 insertions, 63 deletions
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 638100e9c..5e6de08af 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -37,18 +37,19 @@
// ------------------------------------------------------------------------
-/**
- * Smiley Javascript
- *
- * Returns the javascript required for the smiley insertion. Optionally takes
- * an array of aliases to loosely couple the smiley array to the view.
- *
- * @param mixed alias name or array of alias->field_id pairs
- * @param string field_id if alias name was passed in
- * @return array
- */
if ( ! function_exists('smiley_js'))
{
+ /**
+ * Smiley Javascript
+ *
+ * Returns the javascript required for the smiley insertion. Optionally takes
+ * an array of aliases to loosely couple the smiley array to the view.
+ *
+ * @param mixed alias name or array of alias->field_id pairs
+ * @param string field_id if alias name was passed in
+ * @param bool
+ * @return array
+ */
function smiley_js($alias = '', $field_id = '', $inline = TRUE)
{
static $do_setup = TRUE;
@@ -118,17 +119,20 @@ EOF;
// ------------------------------------------------------------------------
-/**
- * Get Clickable Smileys
- *
- * Returns an array of image tag links that can be clicked to be inserted
- * into a form field.
- *
- * @param string the URL to the folder containing the smiley images
- * @return array
- */
+
if ( ! function_exists('get_clickable_smileys'))
{
+ /**
+ * Get Clickable Smileys
+ *
+ * Returns an array of image tag links that can be clicked to be inserted
+ * into a form field.
+ *
+ * @param string the URL to the folder containing the smiley images
+ * @param array
+ * @param array
+ * @return array
+ */
function get_clickable_smileys($image_url, $alias = '', $smileys = NULL)
{
// For backward compatibility with js_insert_smiley
@@ -166,17 +170,18 @@ if ( ! function_exists('get_clickable_smileys'))
// ------------------------------------------------------------------------
-/**
- * Parse Smileys
- *
- * Takes a string as input and swaps any contained smileys for the actual image
- *
- * @param string the text to be parsed
- * @param string the URL to the folder containing the smiley images
- * @return string
- */
if ( ! function_exists('parse_smileys'))
{
+ /**
+ * Parse Smileys
+ *
+ * Takes a string as input and swaps any contained smileys for the actual image
+ *
+ * @param string the text to be parsed
+ * @param string the URL to the folder containing the smiley images
+ * @param array
+ * @return string
+ */
function parse_smileys($str = '', $image_url = '', $smileys = NULL)
{
if ($image_url == '' OR ( ! is_array($smileys) && FALSE === ($smileys = _get_smiley_array())))
@@ -198,15 +203,15 @@ if ( ! function_exists('parse_smileys'))
// ------------------------------------------------------------------------
-/**
- * Get Smiley Array
- *
- * Fetches the config/smiley.php file
- *
- * @return mixed
- */
if ( ! function_exists('_get_smiley_array'))
{
+ /**
+ * Get Smiley Array
+ *
+ * Fetches the config/smiley.php file
+ *
+ * @return mixed
+ */
function _get_smiley_array()
{
if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
@@ -222,33 +227,5 @@ if ( ! function_exists('_get_smiley_array'))
}
}
-// ------------------------------------------------------------------------
-
-/**
- * JS Insert Smiley
- *
- * Generates the javascript function needed to insert smileys into a form field
- *
- * DEPRECATED as of version 1.7.2, use smiley_js instead
- *
- * @param string form name
- * @param string field name
- * @return string
- */
-if ( ! function_exists('js_insert_smiley'))
-{
- function js_insert_smiley($form_name = '', $form_field = '')
- {
- return <<<EOF
-<script type="text/javascript">
- function insert_smiley(smiley)
- {
- document.{$form_name}.{$form_field}.value += " " + smiley;
- }
-</script>
-EOF;
- }
-}
-
/* End of file smiley_helper.php */
/* Location: ./system/helpers/smiley_helper.php */ \ No newline at end of file