Skip to content

Commit

Permalink
OUwiki: Migrate textlib to core_text [M2.7] [ISSUE37] #12423
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-unikent authored and sammarshallou committed Dec 4, 2014
1 parent a8c3e0a commit 2edb99c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion basicpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion csv_writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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).'"';
}
Expand Down
18 changes: 9 additions & 9 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 = ?
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 2edb99c

Please sign in to comment.