@@ -35,10 +35,10 @@ |
||
35 | 35 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
36 | 36 | { |
37 | 37 | if ($xlen != 1) { |
38 | - $xbeg .= ',' . $xlen; |
|
38 | + $xbeg .= ','.$xlen; |
|
39 | 39 | } |
40 | 40 | if ($ylen != 1) { |
41 | - $ybeg .= ',' . $ylen; |
|
41 | + $ybeg .= ','.$ylen; |
|
42 | 42 | } |
43 | 43 | $this->_second_block = "--- $ybeg ----\n"; |
44 | 44 | return "***************\n*** $xbeg ****"; |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
35 | 35 | { |
36 | 36 | if ($xlen != 1) { |
37 | - $xbeg .= ',' . $xlen; |
|
37 | + $xbeg .= ','.$xlen; |
|
38 | 38 | } |
39 | 39 | if ($ylen != 1) { |
40 | - $ybeg .= ',' . $ylen; |
|
40 | + $ybeg .= ','.$ylen; |
|
41 | 41 | } |
42 | 42 | return "@@ -$xbeg +$ybeg @@"; |
43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | function _changed($orig, $final) |
61 | 61 | { |
62 | - return $this->_deleted($orig) . $this->_added($final); |
|
62 | + return $this->_deleted($orig).$this->_added($final); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * of elements as $to_lines. |
30 | 30 | */ |
31 | 31 | function Text_Diff_Mapped($from_lines, $to_lines, |
32 | - $mapped_from_lines, $mapped_to_lines) |
|
32 | + $mapped_from_lines, $mapped_to_lines) |
|
33 | 33 | { |
34 | 34 | assert(count($from_lines) == count($mapped_from_lines)); |
35 | 35 | assert(count($to_lines) == count($mapped_to_lines)); |
@@ -46,17 +46,17 @@ |
||
46 | 46 | continue; |
47 | 47 | } |
48 | 48 | switch ($line[0]) { |
49 | - case ' ': |
|
50 | - $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); |
|
51 | - break; |
|
49 | + case ' ': |
|
50 | + $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); |
|
51 | + break; |
|
52 | 52 | |
53 | - case '+': |
|
54 | - $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); |
|
55 | - break; |
|
53 | + case '+': |
|
54 | + $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); |
|
55 | + break; |
|
56 | 56 | |
57 | - case '-': |
|
58 | - $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); |
|
59 | - break; |
|
57 | + case '-': |
|
58 | + $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); |
|
59 | + break; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 |
@@ -124,9 +124,9 @@ |
||
124 | 124 | array_push($edits, |
125 | 125 | new Text_Diff_Op_copy( |
126 | 126 | $this->_getLines($from_lines, $from_line_no, |
127 | - $from_line_no + count($from_lines) - 1), |
|
127 | + $from_line_no + count($from_lines) - 1), |
|
128 | 128 | $this->_getLines($to_lines, $to_line_no, |
129 | - $to_line_no + count($to_lines) - 1))); |
|
129 | + $to_line_no + count($to_lines) - 1))); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $edits; |
@@ -93,29 +93,29 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | switch ($match[3]) { |
96 | - case 'd': |
|
97 | - // deleted lines |
|
98 | - array_push($edits, |
|
99 | - new Text_Diff_Op_delete( |
|
100 | - $this->_getLines($from_lines, $from_line_no, $match[2]))); |
|
101 | - $to_line_no++; |
|
102 | - break; |
|
103 | - |
|
104 | - case 'c': |
|
105 | - // changed lines |
|
106 | - array_push($edits, |
|
107 | - new Text_Diff_Op_change( |
|
108 | - $this->_getLines($from_lines, $from_line_no, $match[2]), |
|
109 | - $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
110 | - break; |
|
111 | - |
|
112 | - case 'a': |
|
113 | - // added lines |
|
114 | - array_push($edits, |
|
115 | - new Text_Diff_Op_add( |
|
116 | - $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
117 | - $from_line_no++; |
|
118 | - break; |
|
96 | + case 'd': |
|
97 | + // deleted lines |
|
98 | + array_push($edits, |
|
99 | + new Text_Diff_Op_delete( |
|
100 | + $this->_getLines($from_lines, $from_line_no, $match[2]))); |
|
101 | + $to_line_no++; |
|
102 | + break; |
|
103 | + |
|
104 | + case 'c': |
|
105 | + // changed lines |
|
106 | + array_push($edits, |
|
107 | + new Text_Diff_Op_change( |
|
108 | + $this->_getLines($from_lines, $from_line_no, $match[2]), |
|
109 | + $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
110 | + break; |
|
111 | + |
|
112 | + case 'a': |
|
113 | + // added lines |
|
114 | + array_push($edits, |
|
115 | + new Text_Diff_Op_add( |
|
116 | + $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
117 | + $from_line_no++; |
|
118 | + break; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $fp = fopen($to_file, 'w'); |
50 | 50 | fwrite($fp, implode("\n", $to_lines)); |
51 | 51 | fclose($fp); |
52 | - $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file); |
|
52 | + $diff = shell_exec($this->_diffCommand.' '.$from_file.' '.$to_file); |
|
53 | 53 | unlink($from_file); |
54 | 54 | unlink($to_file); |
55 | 55 |
@@ -6,17 +6,17 @@ |
||
6 | 6 | class PEAR5 |
7 | 7 | { |
8 | 8 | /** |
9 | - * If you have a class that's mostly/entirely static, and you need static |
|
10 | - * properties, you can use this method to simulate them. Eg. in your method(s) |
|
11 | - * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar'); |
|
12 | - * You MUST use a reference, or they will not persist! |
|
13 | - * |
|
14 | - * @access public |
|
15 | - * @param string $class The calling classname, to prevent clashes |
|
16 | - * @param string $var The variable to retrieve. |
|
17 | - * @return mixed A reference to the variable. If not set it will be |
|
18 | - * auto initialised to NULL. |
|
19 | - */ |
|
9 | + * If you have a class that's mostly/entirely static, and you need static |
|
10 | + * properties, you can use this method to simulate them. Eg. in your method(s) |
|
11 | + * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar'); |
|
12 | + * You MUST use a reference, or they will not persist! |
|
13 | + * |
|
14 | + * @access public |
|
15 | + * @param string $class The calling classname, to prevent clashes |
|
16 | + * @param string $var The variable to retrieve. |
|
17 | + * @return mixed A reference to the variable. If not set it will be |
|
18 | + * auto initialised to NULL. |
|
19 | + */ |
|
20 | 20 | static function &getStaticProperty($class, $var) |
21 | 21 | { |
22 | 22 | static $properties; |
@@ -250,7 +250,7 @@ |
||
250 | 250 | $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost; |
251 | 251 | } |
252 | 252 | $links .= $this->_spacesBefore |
253 | - . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : ''); |
|
253 | + . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : ''); |
|
254 | 254 | } |
255 | 255 | return $links; |
256 | 256 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if (($index % $this->_perPage) > 0) { |
94 | - $pageID = ceil((float)$index / (float)$this->_perPage); |
|
94 | + $pageID = ceil((float) $index / (float) $this->_perPage); |
|
95 | 95 | } else { |
96 | 96 | $pageID = $index / $this->_perPage; |
97 | 97 | } |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | */ |
118 | 118 | function getPageRangeByPageId($pageid = null) |
119 | 119 | { |
120 | - $pageid = isset($pageid) ? (int)$pageid : $this->_currentPage; |
|
120 | + $pageid = isset($pageid) ? (int) $pageid : $this->_currentPage; |
|
121 | 121 | if (isset($this->_pageData[$pageid]) || is_null($this->_itemData)) { |
122 | 122 | // I'm sure I'm missing something here, but this formula works |
123 | 123 | // so I'm using it until I find something simpler. |
124 | - $start = ((($pageid + (($this->_delta - ($pageid % $this->_delta))) % $this->_delta) / $this->_delta) - 1) * $this->_delta +1; |
|
124 | + $start = ((($pageid + (($this->_delta - ($pageid % $this->_delta))) % $this->_delta) / $this->_delta) - 1) * $this->_delta + 1; |
|
125 | 125 | return array( |
126 | 126 | max($start, 1), |
127 | - min($start+$this->_delta-1, $this->_totalPages) |
|
127 | + min($start + $this->_delta - 1, $this->_totalPages) |
|
128 | 128 | ); |
129 | 129 | } else { |
130 | 130 | return array(0, 0); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @return array Back/pages/next links |
155 | 155 | */ |
156 | - function getLinks($pageID=null, $next_html='') |
|
156 | + function getLinks($pageID = null, $next_html = '') |
|
157 | 157 | { |
158 | 158 | //BC hack |
159 | 159 | if (!empty($next_html)) { |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | $links = ''; |
241 | 241 | $limits = $this->getPageRangeByPageId($this->_currentPage); |
242 | 242 | |
243 | - for ($i=$limits[0]; $i<=min($limits[1], $this->_totalPages); $i++) { |
|
243 | + for ($i = $limits[0]; $i <= min($limits[1], $this->_totalPages); $i++) { |
|
244 | 244 | if ($i != $this->_currentPage) { |
245 | 245 | $this->range[$i] = false; |
246 | 246 | $this->_linkData[$this->_urlVar] = $i; |
247 | 247 | $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i); |
248 | 248 | } else { |
249 | 249 | $this->range[$i] = true; |
250 | - $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost; |
|
250 | + $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost; |
|
251 | 251 | } |
252 | 252 | $links .= $this->_spacesBefore |
253 | 253 | . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : ''); |
@@ -107,7 +107,7 @@ |
||
107 | 107 | * |
108 | 108 | * @param integer $pageid PageID to get offsets for |
109 | 109 | * |
110 | - * @return array First and last offsets |
|
110 | + * @return integer[] First and last offsets |
|
111 | 111 | * @access public |
112 | 112 | */ |
113 | 113 | function getPageRangeByPageId($pageid = null) |
@@ -169,8 +169,8 @@ |
||
169 | 169 | static function &factory($options = array()) |
170 | 170 | { |
171 | 171 | $mode = (isset($options['mode']) ? ucfirst($options['mode']) : 'Jumping'); |
172 | - $classname = 'Pager_' . $mode; |
|
173 | - $classfile = 'Pager' . DIRECTORY_SEPARATOR . $mode . '.php'; |
|
172 | + $classname = 'Pager_'.$mode; |
|
173 | + $classfile = 'Pager'.DIRECTORY_SEPARATOR.$mode.'.php'; |
|
174 | 174 | |
175 | 175 | // Attempt to include a custom version of the named class, but don't treat |
176 | 176 | // a failure as fatal. The caller may have already included their own |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table |
126 | 126 | if ($event_config[$event_name]["sending_mail_once"]) { |
127 | - $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name) |
|
127 | + $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name) |
|
128 | 128 | VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'") |
129 | 129 | '; |
130 | 130 | Database::query($sql); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | // Second, we send to people linked to the event |
136 | 136 | // So, we get everyone |
137 | 137 | $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname |
138 | - FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue |
|
138 | + FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue |
|
139 | 139 | INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id |
140 | - WHERE event_type_name = "' . $event_name . '"'; |
|
140 | + WHERE event_type_name = "' . $event_name.'"'; |
|
141 | 141 | $result = Database::store_result(Database::query($sql), 'ASSOC'); |
142 | 142 | // for each of the linked users |
143 | 143 | foreach ($result as $key => $value) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table |
179 | 179 | if ($event_config[$event_name]["sending_mail_once"]) { |
180 | - $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' |
|
180 | + $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' |
|
181 | 181 | (user_from, user_to, event_type_name) |
182 | 182 | VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'"); |
183 | 183 | '; |
@@ -202,16 +202,16 @@ discard block |
||
202 | 202 | $current_language = api_get_interface_language(); |
203 | 203 | |
204 | 204 | $sql = 'SELECT COUNT(*) as total |
205 | - FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em |
|
206 | - INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l |
|
205 | + FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em |
|
206 | + INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l |
|
207 | 207 | ON em.language_id = l.id |
208 | 208 | WHERE |
209 | - em.event_type_name = "' . $event_name . '" and |
|
209 | + em.event_type_name = "' . $event_name.'" and |
|
210 | 210 | l.dokeos_folder = "'.$current_language.'" and |
211 | 211 | em.activated = 1'; |
212 | 212 | |
213 | 213 | $exists = Database::store_result(Database::query($sql), 'ASSOC'); |
214 | - if ($exists[0]["total"]) { |
|
214 | + if ($exists[0]["total"]) { |
|
215 | 215 | return true; |
216 | 216 | } else { |
217 | 217 | return false; |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | private static function getMessage($event_name, $language) |
229 | 229 | { |
230 | 230 | $sql = 'SELECT message, subject, l.dokeos_folder |
231 | - FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em |
|
232 | - INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l |
|
231 | + FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em |
|
232 | + INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l |
|
233 | 233 | ON em.language_id = l.id |
234 | 234 | WHERE |
235 | - em.event_type_name = "' . $event_name . '" AND |
|
236 | - (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND |
|
235 | + em.event_type_name = "' . $event_name.'" AND |
|
236 | + (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND |
|
237 | 237 | em.message <> "" |
238 | 238 | '; |
239 | 239 | return Database::store_result(Database::query($sql), 'ASSOC'); |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data) |
275 | 275 | { |
276 | 276 | foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) { |
277 | - $message = str_replace('((' . $key . '))', $event_data[$word], $message); |
|
278 | - $subject = str_replace('((' . $key . '))', $event_data[$word], $subject); |
|
277 | + $message = str_replace('(('.$key.'))', $event_data[$word], $message); |
|
278 | + $subject = str_replace('(('.$key.'))', $event_data[$word], $subject); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |