function htmlspecialchars_deep_decode($mixed, $quote_style = ENT_QUOTES, $charset = 'UTF-8') { if (is_array($mixed)) { foreach ($mixed as $key => $value) { $mixed[$key] = htmlspecialchars_deep_decode($value, $quote_style, $charset); } } elseif (is_string($mixed)) { $mixed = htmlspecialchars_decode($mixed, $quote_style); } return $mixed; }
function commentsGet($data, $limit = false, $count_only = false, $orderby = false) { global $cms_db_tables; $table = $cms_db_tables['table_comments']; if (empty($orderby)) { $orderby[0] = 'updated_on'; $orderby[1] = 'DESC'; } else { // $orderby = $orderby; } $cache_group = "comments/global"; if (intval($data['id']) != 0) { $cache_group = "comments/{$data['id']}"; } if (trim($data['to_table']) != '' and trim($data['to_table_id']) != '') { $cache_group = "comments/{$data['to_table']}/{$data['to_table_id']}"; } $get = CI::model('core')->getDbData($table, $data, $limit, $offset = false, $orderby, $cache_group, false, $ids = false, $count_only); if ($count_only) { return $get; } $real_comments = array(); if (empty($get)) { return false; } foreach ($get as $comment) { if (!empty($cms_db_tables)) { foreach ($cms_db_tables as $k => $v) { //var_dump($k, $v); if (strtolower($comment['to_table']) == strtolower($k)) { $id = $comment['to_table_id']; $real_comments[] = $comment; } } } } $real_comments = htmlspecialchars_deep_decode($real_comments); return $real_comments; }