[opw-web] Move escapenewlines() utility function to utils.php



commit 49248e1ad09e43117aa64fc99590fbee8e9a757a
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Mar 14 21:11:37 2016 -0400

    Move escapenewlines() utility function to utils.php
    
    This is useful any time we want to put text into a text-field that
    might have newlines in it.

 modules/mod_contract.php |    6 ------
 utils.php                |    6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/modules/mod_contract.php b/modules/mod_contract.php
index d07e869..b0b12f3 100644
--- a/modules/mod_contract.php
+++ b/modules/mod_contract.php
@@ -17,12 +17,6 @@ $program_data = $cache->get_program_data($program_id);
 
 $user->restrict($program_data != null);
 
-function escapenewlines($text) {
-    $text = str_replace("\n", "&#10;", $text);
-    $text = str_replace("\r", "&#13;", $text);
-    return $text;
-}
-
 if ($action == 'edit_student' || $action == 'edit_mentor') {
     $user->restrict($user->is_admin);
 
diff --git a/utils.php b/utils.php
index 64a8086..514a709 100644
--- a/utils.php
+++ b/utils.php
@@ -262,4 +262,10 @@ function get_role_string($role, $has_project) {
   return $lang->get($role_key);
 }
 
+function escapenewlines($text) {
+    $text = str_replace("\n", "&#10;", $text);
+    $text = str_replace("\r", "&#13;", $text);
+    return $text;
+}
+
 ?>
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]