MDL-31461 Plagiarism - adjust api functions to allow better support for renderers
[moodle.git] / lib / excel / readme_moodle.txt
blobe5341caddbc665ba05306ee2964ca2e6dbefe6d9
1 20 Jul 2010
2 MDL-20876 - replaced deprecated split() with explode() or str_split() where appropriate
4 diff --git a/lib/excel/Parser.php b/lib/excel/Parser.php
5 index f91cf98..06b9e23 100644
6 --- a/lib/excel/Parser.php
7 +++ b/lib/excel/Parser.php
8 @@ -538,10 +538,10 @@ class Parser
9  
10      // Split the range into 2 cell refs
11      if(preg_match("/^([A-I]?[A-Z])(\d+)\:([A-I]?[A-Z])(\d+)$/",$range)) {
12 -        list($cell1, $cell2) = split(':', $range);
13 +        list($cell1, $cell2) = explode(':', $range);
14          }
15      elseif(preg_match("/^([A-I]?[A-Z])(\d+)\.\.([A-I]?[A-Z])(\d+)$/",$range)) {
16 -        list($cell1, $cell2) = split('\.\.', $range);
17 +        list($cell1, $cell2) = explode('..', $range);
18          }
19      else {
20          die("Unknown range separator");
21 @@ -993,4 +993,4 @@ class Parser
22      return $polish;
23      }
24    }
25 -?>
26 \ No newline at end of file
27 +?>
28 diff --git a/lib/excel/Worksheet.php b/lib/excel/Worksheet.php
29 index 1eb7682..d7c5cfc 100644
30 --- a/lib/excel/Worksheet.php
31 +++ b/lib/excel/Worksheet.php
32 @@ -909,7 +909,7 @@ class Worksheet extends BIFFwriter
33          $row     = $match[2];
34      
35          // Convert base26 column string to number
36 -        $chars = split('', $col);
37 +        $chars = str_split($col);
38          $expn  = 0;
39          $col   = 0;
40      
41 @@ -1530,13 +1530,13 @@ class Worksheet extends BIFFwriter
42          // Determine if the link contains a sheet reference and change some of the
43          // parameters accordingly.
44          // Split the dir name and sheet name (if it exists)
45 -        list($dir_long , $sheet) = split('/\#/', $url);
46 +        list($dir_long , $sheet) = explode('/#/', $url);
47          $link_type               = 0x01 | $absolute;
48      
49          if (isset($sheet)) {
50              $link_type |= 0x08;
51              $sheet_len  = pack("V", strlen($sheet) + 0x01);
52 -            $sheet      = join("\0", split('', $sheet));
53 +            $sheet      = join("\0", str_split($sheet));
54              $sheet     .= "\0\0\0";
55          }
56          else {
57 @@ -1555,7 +1555,7 @@ class Worksheet extends BIFFwriter
58          $dir_short   = preg_replace('/\.\.\\/', '', $dir_long) . "\0";
59      
60          // Store the long dir name as a wchar string (non-null terminated)
61 -        $dir_long       = join("\0", split('', $dir_long));
62 +        $dir_long       = join("\0", str_split($dir_long));
63          $dir_long       = $dir_long . "\0";
64      
65          // Pack the lengths of the dir strings
66 @@ -1644,7 +1644,7 @@ class Worksheet extends BIFFwriter
67          if (defined $sheet) {
68              $link_type |= 0x08;
69              $sheet_len  = pack("V", length($sheet) + 0x01);
70 -            $sheet      = join("\0", split('', $sheet));
71 +            $sheet      = join("\0", str_split($sheet));
72              $sheet     .= "\0\0\0";
73      }
74          else {
75 @@ -1665,7 +1665,7 @@ class Worksheet extends BIFFwriter
76      
77      
78          # Store the long dir name as a wchar string (non-null terminated)
79 -        $dir_long       = join("\0", split('', $dir_long));
80 +        $dir_long       = join("\0", str_split($dir_long));
81          $dir_long       = $dir_long . "\0";
82      
83      
84 @@ -2832,4 +2832,4 @@ class Worksheet extends BIFFwriter
85          $this->_append($header.$data);
86      }
87  }
88 -?>
89 \ No newline at end of file
90 +?>
94 18 Nov 2009
95 Description of WriteExcel modifications to remove functions deprecated as of php 5.3
97 Index: Parser.php
98 ===================================================================
99 RCS file: /cvsroot/moodle/moodle/lib/excel/Parser.php,v
100 retrieving revision 1.1
101 diff -u -r1.1 Parser.php
102 --- Parser.php  26 Sep 2003 04:18:02 -0000      1.1
103 +++ Parser.php  18 Nov 2009 03:58:49 -0000
104 @@ -466,7 +466,7 @@
105          {
106          return(pack("C", $this->ptg[$token]));
107          }
108 -    elseif(preg_match("/[A-Z0-9À-Ü\.]+/",$token))
109 +    elseif(preg_match("/[A-Z0-9ï¿œ-ï¿œ\.]+/",$token))
110          {
111          return($this->_convert_function($token,$this->_func_args));
112          }
113 @@ -723,21 +723,21 @@
114              break;
115          default:
116             // if it's a reference
117 -            if(eregi("^[A-I]?[A-Z][0-9]+$",$token) and 
118 -              !ereg("[0-9]",$this->_lookahead) and 
119 +            if(preg_match("/^[A-I]?[A-Z][0-9]+$/i",$token) and
120 +              !preg_match("/[0-9]/",$this->_lookahead) and
121                 ($this->_lookahead != ':') and ($this->_lookahead != '.'))
122                  {
123                  return($token);
124                  }
125              // if it's a range (A1:A2)
126 -            elseif(eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$token) and 
127 -                  !ereg("[0-9]",$this->_lookahead))
128 +            elseif(preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$token) and
129 +                  !preg_match("/[0-9]/",$this->_lookahead))
130                 {
131                 return($token);
132                 }
133              // if it's a range (A1..A2)
134 -            elseif(eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$token) and 
135 -                  !ereg("[0-9]",$this->_lookahead))
136 +            elseif(preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$token) and
137 +                  !preg_match("/[0-9]/",$this->_lookahead))
138                 {
139                 return($token);
140                 }
141 @@ -746,7 +746,7 @@
142                  return($token);
143                  }
144              // if it's a function call
145 -            elseif(eregi("^[A-Z0-9À-Ü\.]+$",$token) and ($this->_lookahead == "("))
146 +            elseif(preg_match("/^[A-Z0-9ï¿œ-ï¿œ\.]+$/i",$token) and ($this->_lookahead == "("))
148                 {
149                 return($token);
150 @@ -857,15 +857,15 @@
151          return($result);
152          }
153      // if it's a reference
154 -    if (eregi("^[A-I]?[A-Z][0-9]+$",$this->_current_token))
155 +    if (preg_match("/^[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
156          {
157          $result = $this->_create_tree($this->_current_token, '', '');
158          $this->_advance();
159          return($result);
160          }
161      // if it's a range
162 -    elseif (eregi("^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$",$this->_current_token) or 
163 -            eregi("^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$",$this->_current_token)) 
164 +    elseif (preg_match("/^[A-I]?[A-Z][0-9]+:[A-I]?[A-Z][0-9]+$/i",$this->_current_token) or
165 +            preg_match("/^[A-I]?[A-Z][0-9]+\.\.[A-I]?[A-Z][0-9]+$/i",$this->_current_token))
166          {
167          $result = $this->_current_token;
168          $this->_advance();
169 @@ -878,7 +878,7 @@
170          return($result);
171          }
172      // if it's a function call
173 -    elseif (eregi("^[A-Z0-9À-Ü\.]+$",$this->_current_token))
174 +    elseif (preg_match("/^[A-Z0-9ï¿œ-ï¿œ\.]+$/i",$this->_current_token))
175          {
176          $result = $this->_func();
177          return($result);
178 Index: Worksheet.php
179 ===================================================================
180 RCS file: /cvsroot/moodle/moodle/lib/excel/Worksheet.php,v
181 retrieving revision 1.1
182 diff -u -r1.1 Worksheet.php
183 --- Worksheet.php       26 Sep 2003 04:18:02 -0000      1.1
184 +++ Worksheet.php       18 Nov 2009 03:58:50 -0000
185 @@ -1264,10 +1264,10 @@
186          }
187      
188          // Strip the '=' or '@' sign at the beginning of the formula string
189 -        if (ereg("^=",$formula)) {
190 +        if (preg_match("/^=/",$formula)) {
191              $formula = preg_replace("/(^=)/","",$formula);
192          }
193 -        elseif(ereg("^@",$formula)) {
194 +        elseif(preg_match("/^@/",$formula)) {
195              $formula = preg_replace("/(^@)/","",$formula);
196          }
197          else {