diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2012-11-27 11:17:37 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2012-11-27 11:17:37 +0100 |
commit | 10da75f3645ff2121bbaf9d603f2e1465eddab78 (patch) | |
tree | 86bea83370406d7640844aaa47123da1c4061719 /program/lib/Roundcube | |
parent | 0c82e95c59ab7a5823c69fcbc4f1b2745b7b86f9 (diff) |
Move shortcut functions to framework class
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r-- | program/lib/Roundcube/rcube.php | 24 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_output_html.php | 2 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_string_replacer.php | 4 |
3 files changed, 27 insertions, 3 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 1ce6241c8..c3aa8ffa5 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -894,6 +894,30 @@ class rcube /** + * Quote a given string. + * Shortcut function for rcube_utils::rep_specialchars_output() + * + * @return string HTML-quoted string + */ + public static function Q($str, $mode = 'strict', $newlines = true) + { + return rcube_utils::rep_specialchars_output($str, 'html', $mode, $newlines); + } + + + /** + * Quote a given string for javascript output. + * Shortcut function for rcube_utils::rep_specialchars_output() + * + * @return string JS-quoted string + */ + public static function JQ($str) + { + return rcube_utils::rep_specialchars_output($str, 'js'); + } + + + /** * Construct shell command, execute it and return output as string. * Keywords {keyword} are replaced with arguments * diff --git a/program/lib/Roundcube/rcube_output_html.php b/program/lib/Roundcube/rcube_output_html.php index 6c9dfdd1f..f861ff95e 100644 --- a/program/lib/Roundcube/rcube_output_html.php +++ b/program/lib/Roundcube/rcube_output_html.php @@ -843,7 +843,7 @@ class rcube_output_html extends rcube_output break; case 'javascript': case 'js': - $label = rcmail::JQ($label); + $label = rcube::JQ($label); break; default: $label = html::quote($label); diff --git a/program/lib/Roundcube/rcube_string_replacer.php b/program/lib/Roundcube/rcube_string_replacer.php index 9af6b33e0..0467b866a 100644 --- a/program/lib/Roundcube/rcube_string_replacer.php +++ b/program/lib/Roundcube/rcube_string_replacer.php @@ -96,7 +96,7 @@ class rcube_string_replacer $i = $this->add($prefix . html::a(array( 'href' => $url_prefix . $url, 'target' => '_blank' - ), rcmail::Q($url)) . $suffix); + ), rcube::Q($url)) . $suffix); } // Return valid link for recognized schemes, otherwise, return the unmodified string for unrecognized schemes. @@ -116,7 +116,7 @@ class rcube_string_replacer $i = $this->add(html::a(array( 'href' => 'mailto:' . $href, - 'onclick' => "return ".rcmail::JS_OBJECT_NAME.".command('compose','".rcmail::JQ($href)."',this)", + 'onclick' => "return ".rcmail::JS_OBJECT_NAME.".command('compose','".rcube::JQ($href)."',this)", ), rcmail::Q($href)) . $suffix); return $i >= 0 ? $this->get_replacement($i) : ''; |