From 2edb99ce3a62a382f208ba44ca0aa8af0c35d162 Mon Sep 17 00:00:00 2001 From: Skylar Kelty Date: Tue, 11 Nov 2014 09:54:57 +0000 Subject: [PATCH] OUwiki: Migrate textlib to core_text [M2.7] [ISSUE37] #12423 --- basicpage.php | 2 +- csv_writer.php | 2 +- locallib.php | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/basicpage.php b/basicpage.php index 3e080d5..72e4267 100644 --- a/basicpage.php +++ b/basicpage.php @@ -40,7 +40,7 @@ } // Restrict page name -if (textlib::strlen($pagename) > 200) { +if (core_text::strlen($pagename) > 200) { print_error('pagenametoolong', 'ouwiki'); } // Convert nbsp to space diff --git a/csv_writer.php b/csv_writer.php index f8d1de0..b694f98 100644 --- a/csv_writer.php +++ b/csv_writer.php @@ -76,7 +76,7 @@ public function __construct($filename, $format = null) { */ public function quote($varstr) { if ($this->_excelcsv) { - return textlib::convert('"'.str_replace('"', "'", $varstr).'"', 'UTF-8', 'UTF-16LE'); + return core_text::convert('"'.str_replace('"', "'", $varstr).'"', 'UTF-8', 'UTF-16LE'); } else { return '"'.str_replace('"', "'", $varstr).'"'; } diff --git a/locallib.php b/locallib.php index d9a8f57..11fb21c 100644 --- a/locallib.php +++ b/locallib.php @@ -681,7 +681,7 @@ function ouwiki_get_current_page($subwiki, $pagename, $option = OUWIKI_GETPAGE_R $params = array($subwiki->id); $pagename_s = 'UPPER(p.title) = ?'; - $params[] = textlib::strtoupper($pagename); + $params[] = core_text::strtoupper($pagename); $jointype = $option == OUWIKI_GETPAGE_REQUIREVERSION ? 'JOIN' : 'LEFT JOIN'; @@ -714,7 +714,7 @@ function ouwiki_get_current_page($subwiki, $pagename, $option = OUWIKI_GETPAGE_R } // Update any missing link records that might exist - $uppertitle = textlib::strtoupper($pagename); + $uppertitle = core_text::strtoupper($pagename); try { $DB->execute("UPDATE {ouwiki_links} SET tomissingpage = NULL, topageid = ? @@ -804,7 +804,7 @@ function ouwiki_get_page_version($subwiki, $pagename, $versionid) { LEFT JOIN {user} u ON v.userid = u.id WHERE p.subwikiid = ? AND v.id = ? AND UPPER(p.title) = ?"; - $pagename = textlib::strtoupper($pagename); + $pagename = core_text::strtoupper($pagename); $pageversion = $DB->get_record_sql($sql, array($subwiki->id, $versionid, $pagename)); $pageversion->recentversions = false; @@ -1974,8 +1974,8 @@ function ouwiki_save_new_version($course, $cm, $ouwiki, $subwiki, $pagename, $co $link->tomissingpage = null; foreach ($externallinks as $url) { // Restrict length of URL - if (textlib::strlen($url) > 255) { - $url = textlib::substr($url, 0, 255); + if (core_text::strlen($url) > 255) { + $url = core_text::substr($url, 0, 255); } $link->tourl = $url; try { @@ -2067,11 +2067,11 @@ function ouwiki_get_wiki_link_details($wikilink) { // Trim to 200 characters or less (note: because we don't want to cut it off // in the middle of a character, we use proper UTF-8 functions) - if (textlib::strlen($wikilink) > 200) { - $wikilink = textlib::substr($wikilink, 0, 200); - $space = textlib::strrpos($wikilink, ' '); + if (core_text::strlen($wikilink) > 200) { + $wikilink = core_text::substr($wikilink, 0, 200); + $space = core_text::strrpos($wikilink, ' '); if ($space > 150) { - $wikilink = textlib::substr($wikilink, 0, $space); + $wikilink = core_text::substr($wikilink, 0, $space); } }