aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-07 16:02:51 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-07 16:02:51 +0000
commit002f788efcd57f43a7347c12273779a163d2920a (patch)
tree4de2e47c352b00b52c1ab5ef3f2c4b11779b6e9b /engine/lib
parent4814c847028b8ef3bfcfd62a8a8807637172f8a4 (diff)
downloadelgg-002f788efcd57f43a7347c12273779a163d2920a.tar.gz
elgg-002f788efcd57f43a7347c12273779a163d2920a.tar.bz2
Added optional html_encode parameter to elgg_add_action_tokens_to_url() so it can be used in ajax calls.
git-svn-id: http://code.elgg.org/elgg/trunk@5651 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index b9c4b0998..764c230bf 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -744,7 +744,7 @@ function elgg_view_annotation(ElggAnnotation $annotation, $bypass = true, $debug
function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = true, $pagination = true) {
$count = (int) $count;
$limit = (int) $limit;
-
+
// do not require views to explicitly pass in the offset
if (!$offset = (int) $offset) {
$offset = sanitise_int(get_input('offset', 0));
@@ -1942,7 +1942,7 @@ function elgg_log($message, $level='NOTICE') {
*/
function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') {
global $CONFIG;
-
+
// plugin can return false to stop the default logging method
$params = array('level' => $level,
'msg' => $value,
@@ -2559,7 +2559,7 @@ interface Friendable {
/**
* Handles formatting of ampersands in urls
- *
+ *
* @param string $url
* @return string
* @since 1.8
@@ -2572,10 +2572,11 @@ function elgg_format_url($url) {
* Rebuilds a parsed (partial) URL
*
* @param array $parts Associative array of URL components like parse_url() returns
+ * @param bool $htmlencode HTML Encode the url?
* @return str Full URL
* @since 1.7
*/
-function elgg_http_build_url(array $parts) {
+function elgg_http_build_url(array $parts, $html_encode = TRUE) {
// build only what's given to us.
$scheme = isset($parts['scheme']) ? "{$parts['scheme']}://" : '';
$host = isset($parts['host']) ? "{$parts['host']}" : '';
@@ -2585,7 +2586,11 @@ function elgg_http_build_url(array $parts) {
$string = $scheme . $host . $port . $path . $query;
- return elgg_format_url($string);
+ if ($html_encode) {
+ return elgg_format_url($string);
+ } else {
+ return $string;
+ }
}
@@ -2593,10 +2598,11 @@ function elgg_http_build_url(array $parts) {
* Adds action tokens to URL
*
* @param str $link Full action URL
+ * @param bool $htmlencode html encode the url?
* @return str URL with action tokens
* @since 1.7
*/
-function elgg_add_action_tokens_to_url($url) {
+function elgg_add_action_tokens_to_url($url, $html_encode = TRUE) {
$components = parse_url($url);
if (isset($components['query'])) {
@@ -2615,7 +2621,7 @@ function elgg_add_action_tokens_to_url($url) {
$components['query'] = http_build_query($query);
// rebuild the full url
- return elgg_http_build_url($components);
+ return elgg_http_build_url($components, $html_encode);
}
/**