@@ -139,8 +139,7 @@ discard block |
||
139 | 139 | if ($data === FALSE) |
140 | 140 | { |
141 | 141 | $data = array('data' => 0, 'ttl' => 60); |
142 | - } |
|
143 | - elseif ( ! is_int($data['data'])) |
|
142 | + } elseif ( ! is_int($data['data'])) |
|
144 | 143 | { |
145 | 144 | return FALSE; |
146 | 145 | } |
@@ -167,8 +166,7 @@ discard block |
||
167 | 166 | if ($data === FALSE) |
168 | 167 | { |
169 | 168 | $data = array('data' => 0, 'ttl' => 60); |
170 | - } |
|
171 | - elseif ( ! is_int($data['data'])) |
|
169 | + } elseif ( ! is_int($data['data'])) |
|
172 | 170 | { |
173 | 171 | return FALSE; |
174 | 172 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | parent::__construct($params); |
83 | 83 | |
84 | - $CI =& get_instance(); |
|
84 | + $CI = & get_instance(); |
|
85 | 85 | isset($CI->db) OR $CI->load->database(); |
86 | 86 | $this->_db = $CI->db; |
87 | 87 |
@@ -99,12 +99,10 @@ discard block |
||
99 | 99 | if (class_exists('Memcached', FALSE)) |
100 | 100 | { |
101 | 101 | $this->_memcached = new Memcached(); |
102 | - } |
|
103 | - elseif (class_exists('Memcache', FALSE)) |
|
102 | + } elseif (class_exists('Memcache', FALSE)) |
|
104 | 103 | { |
105 | 104 | $this->_memcached = new Memcache(); |
106 | - } |
|
107 | - else |
|
105 | + } else |
|
108 | 106 | { |
109 | 107 | log_message('error', 'Cache: Failed to create Memcache(d) object; extension not loaded?'); |
110 | 108 | } |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | TRUE, |
125 | 123 | $cache_server['weight'] |
126 | 124 | ); |
127 | - } |
|
128 | - else |
|
125 | + } else |
|
129 | 126 | { |
130 | 127 | $this->_memcached->addServer( |
131 | 128 | $cache_server['hostname'], |
@@ -172,8 +169,7 @@ discard block |
||
172 | 169 | if (get_class($this->_memcached) === 'Memcached') |
173 | 170 | { |
174 | 171 | return $this->_memcached->set($id, $data, $ttl); |
175 | - } |
|
176 | - elseif (get_class($this->_memcached) === 'Memcache') |
|
172 | + } elseif (get_class($this->_memcached) === 'Memcache') |
|
177 | 173 | { |
178 | 174 | return $this->_memcached->set($id, $data, 0, $ttl); |
179 | 175 | } |
@@ -81,7 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | parent::__construct($params); |
83 | 83 | |
84 | - $CI =& get_instance(); |
|
84 | + $CI = & get_instance(); |
|
85 | 85 | isset($CI->db) OR $CI->load->database(); |
86 | 86 | $this->_db = $CI->db; |
87 | 87 |
@@ -107,8 +107,7 @@ discard block |
||
107 | 107 | if ($config['socket_type'] === 'unix') |
108 | 108 | { |
109 | 109 | $success = $this->_redis->connect($config['socket']); |
110 | - } |
|
111 | - else // tcp socket |
|
110 | + } else // tcp socket |
|
112 | 111 | { |
113 | 112 | $success = $this->_redis->connect($config['host'], $config['port'], $config['timeout']); |
114 | 113 | } |
@@ -122,8 +121,7 @@ discard block |
||
122 | 121 | { |
123 | 122 | log_message('error', 'Cache: Redis authentication failed.'); |
124 | 123 | } |
125 | - } |
|
126 | - catch (RedisException $e) |
|
124 | + } catch (RedisException $e) |
|
127 | 125 | { |
128 | 126 | log_message('error', 'Cache: Redis connection refused ('.$e->getMessage().')'); |
129 | 127 | } |
@@ -175,8 +173,7 @@ discard block |
||
175 | 173 | |
176 | 174 | isset($this->_serialized[$id]) OR $this->_serialized[$id] = TRUE; |
177 | 175 | $data = serialize($data); |
178 | - } |
|
179 | - elseif (isset($this->_serialized[$id])) |
|
176 | + } elseif (isset($this->_serialized[$id])) |
|
180 | 177 | { |
181 | 178 | $this->_serialized[$id] = NULL; |
182 | 179 | $this->_redis->sRemove('_ci_redis_serialized', $id); |
@@ -1,40 +1,40 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * CodeIgniter |
|
4 | - * |
|
5 | - * An open source application development framework for PHP |
|
6 | - * |
|
7 | - * This content is released under the MIT License (MIT) |
|
8 | - * |
|
9 | - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
10 | - * |
|
11 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
12 | - * of this software and associated documentation files (the "Software"), to deal |
|
13 | - * in the Software without restriction, including without limitation the rights |
|
14 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
15 | - * copies of the Software, and to permit persons to whom the Software is |
|
16 | - * furnished to do so, subject to the following conditions: |
|
17 | - * |
|
18 | - * The above copyright notice and this permission notice shall be included in |
|
19 | - * all copies or substantial portions of the Software. |
|
20 | - * |
|
21 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
22 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
23 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
24 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
25 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
26 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
27 | - * THE SOFTWARE. |
|
28 | - * |
|
29 | - * @package CodeIgniter |
|
30 | - * @author EllisLab Dev Team |
|
31 | - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
32 | - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
33 | - * @license http://opensource.org/licenses/MIT MIT License |
|
34 | - * @link http://codeigniter.com |
|
35 | - * @since Version 3.0.0 |
|
36 | - * @filesource |
|
37 | - */ |
|
3 | + * CodeIgniter |
|
4 | + * |
|
5 | + * An open source application development framework for PHP |
|
6 | + * |
|
7 | + * This content is released under the MIT License (MIT) |
|
8 | + * |
|
9 | + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
10 | + * |
|
11 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
12 | + * of this software and associated documentation files (the "Software"), to deal |
|
13 | + * in the Software without restriction, including without limitation the rights |
|
14 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
15 | + * copies of the Software, and to permit persons to whom the Software is |
|
16 | + * furnished to do so, subject to the following conditions: |
|
17 | + * |
|
18 | + * The above copyright notice and this permission notice shall be included in |
|
19 | + * all copies or substantial portions of the Software. |
|
20 | + * |
|
21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
22 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
24 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
26 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
27 | + * THE SOFTWARE. |
|
28 | + * |
|
29 | + * @package CodeIgniter |
|
30 | + * @author EllisLab Dev Team |
|
31 | + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
32 | + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
33 | + * @license http://opensource.org/licenses/MIT MIT License |
|
34 | + * @link http://codeigniter.com |
|
35 | + * @since Version 3.0.0 |
|
36 | + * @filesource |
|
37 | + */ |
|
38 | 38 | defined('BASEPATH') OR exit('No direct script access allowed'); |
39 | 39 | |
40 | 40 | /** |
@@ -81,7 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | parent::__construct($params); |
83 | 83 | |
84 | - $CI =& get_instance(); |
|
84 | + $CI = & get_instance(); |
|
85 | 85 | isset($CI->db) OR $CI->load->database(); |
86 | 86 | $this->_db = $CI->db; |
87 | 87 |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function __construct($config = array()) |
131 | 131 | { |
132 | - $this->CI =& get_instance(); |
|
132 | + $this->CI = & get_instance(); |
|
133 | 133 | $this->CI->lang->load('calendar'); |
134 | 134 | |
135 | 135 | empty($config) OR $this->initialize($config); |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | |
206 | 206 | $adjusted_date = $this->adjust_date($month, $year); |
207 | 207 | |
208 | - $month = $adjusted_date['month']; |
|
209 | - $year = $adjusted_date['year']; |
|
208 | + $month = $adjusted_date['month']; |
|
209 | + $year = $adjusted_date['year']; |
|
210 | 210 | |
211 | 211 | // Determine the total days in the month |
212 | 212 | $total_days = $this->get_total_days($month, $year); |
213 | 213 | |
214 | 214 | // Set the starting day of the week |
215 | 215 | $start_days = array('sunday' => 0, 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6); |
216 | - $start_day = isset($start_days[$this->start_day]) ? $start_days[$this->start_day] : 0; |
|
216 | + $start_day = isset($start_days[$this->start_day]) ? $start_days[$this->start_day] : 0; |
|
217 | 217 | |
218 | 218 | // Set the starting day number |
219 | 219 | $local_date = mktime(12, 0, 0, $month, 1, $year); |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | |
228 | 228 | // Set the current month/year/day |
229 | 229 | // We use this to determine the "today" date |
230 | - $cur_year = date('Y', $local_time); |
|
231 | - $cur_month = date('m', $local_time); |
|
232 | - $cur_day = date('j', $local_time); |
|
230 | + $cur_year = date('Y', $local_time); |
|
231 | + $cur_month = date('m', $local_time); |
|
232 | + $cur_day = date('j', $local_time); |
|
233 | 233 | |
234 | 234 | $is_current_month = ($cur_year == $year && $cur_month == $month); |
235 | 235 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | |
271 | 271 | $day_names = $this->get_day_names(); |
272 | 272 | |
273 | - for ($i = 0; $i < 7; $i ++) |
|
273 | + for ($i = 0; $i < 7; $i++) |
|
274 | 274 | { |
275 | - $out .= str_replace('{week_day}', $day_names[($start_day + $i) %7], $this->replacements['week_day_cell']); |
|
275 | + $out .= str_replace('{week_day}', $day_names[($start_day + $i) % 7], $this->replacements['week_day_cell']); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | $out .= "\n".$this->replacements['week_row_end']."\n"; |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | { |
424 | 424 | $date = array(); |
425 | 425 | |
426 | - $date['month'] = $month; |
|
427 | - $date['year'] = $year; |
|
426 | + $date['month'] = $month; |
|
427 | + $date['year'] = $year; |
|
428 | 428 | |
429 | 429 | while ($date['month'] > 12) |
430 | 430 | { |
@@ -184,12 +184,10 @@ discard block |
||
184 | 184 | if (empty($year)) |
185 | 185 | { |
186 | 186 | $year = date('Y', $local_time); |
187 | - } |
|
188 | - elseif (strlen($year) === 1) |
|
187 | + } elseif (strlen($year) === 1) |
|
189 | 188 | { |
190 | 189 | $year = '200'.$year; |
191 | - } |
|
192 | - elseif (strlen($year) === 2) |
|
190 | + } elseif (strlen($year) === 2) |
|
193 | 191 | { |
194 | 192 | $year = '20'.$year; |
195 | 193 | } |
@@ -197,8 +195,7 @@ discard block |
||
197 | 195 | if (empty($month)) |
198 | 196 | { |
199 | 197 | $month = date('m', $local_time); |
200 | - } |
|
201 | - elseif (strlen($month) === 1) |
|
198 | + } elseif (strlen($month) === 1) |
|
202 | 199 | { |
203 | 200 | $month = '0'.$month; |
204 | 201 | } |
@@ -294,8 +291,7 @@ discard block |
||
294 | 291 | $temp = ($is_current_month === TRUE && $day == $cur_day) ? |
295 | 292 | $this->replacements['cal_cell_content_today'] : $this->replacements['cal_cell_content']; |
296 | 293 | $out .= str_replace(array('{content}', '{day}'), array($data[$day], $day), $temp); |
297 | - } |
|
298 | - else |
|
294 | + } else |
|
299 | 295 | { |
300 | 296 | // Cells with no content |
301 | 297 | $temp = ($is_current_month === TRUE && $day == $cur_day) ? |
@@ -304,8 +300,7 @@ discard block |
||
304 | 300 | } |
305 | 301 | |
306 | 302 | $out .= ($is_current_month === TRUE && $day == $cur_day) ? $this->replacements['cal_cell_end_today'] : $this->replacements['cal_cell_end']; |
307 | - } |
|
308 | - elseif ($this->show_other_days === TRUE) |
|
303 | + } elseif ($this->show_other_days === TRUE) |
|
309 | 304 | { |
310 | 305 | $out .= $this->replacements['cal_cell_start_other']; |
311 | 306 | |
@@ -315,16 +310,14 @@ discard block |
||
315 | 310 | $prev_month = $this->adjust_date($month - 1, $year); |
316 | 311 | $prev_month_days = $this->get_total_days($prev_month['month'], $prev_month['year']); |
317 | 312 | $out .= str_replace('{day}', $prev_month_days + $day, $this->replacements['cal_cell_other']); |
318 | - } |
|
319 | - else |
|
313 | + } else |
|
320 | 314 | { |
321 | 315 | // Day of next month |
322 | 316 | $out .= str_replace('{day}', $day - $total_days, $this->replacements['cal_cell_other']); |
323 | 317 | } |
324 | 318 | |
325 | 319 | $out .= $this->replacements['cal_cell_end_other']; |
326 | - } |
|
327 | - else |
|
320 | + } else |
|
328 | 321 | { |
329 | 322 | // Blank cells |
330 | 323 | $out .= $this->replacements['cal_cell_start'].$this->replacements['cal_cell_blank'].$this->replacements['cal_cell_end']; |
@@ -355,8 +348,7 @@ discard block |
||
355 | 348 | if ($this->month_type === 'short') |
356 | 349 | { |
357 | 350 | $month_names = array('01' => 'cal_jan', '02' => 'cal_feb', '03' => 'cal_mar', '04' => 'cal_apr', '05' => 'cal_may', '06' => 'cal_jun', '07' => 'cal_jul', '08' => 'cal_aug', '09' => 'cal_sep', '10' => 'cal_oct', '11' => 'cal_nov', '12' => 'cal_dec'); |
358 | - } |
|
359 | - else |
|
351 | + } else |
|
360 | 352 | { |
361 | 353 | $month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december'); |
362 | 354 | } |
@@ -387,12 +379,10 @@ discard block |
||
387 | 379 | if ($this->day_type === 'long') |
388 | 380 | { |
389 | 381 | $day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); |
390 | - } |
|
391 | - elseif ($this->day_type === 'short') |
|
382 | + } elseif ($this->day_type === 'short') |
|
392 | 383 | { |
393 | 384 | $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); |
394 | - } |
|
395 | - else |
|
385 | + } else |
|
396 | 386 | { |
397 | 387 | $day_names = array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'); |
398 | 388 | } |
@@ -528,14 +518,12 @@ discard block |
||
528 | 518 | if (preg_match('/\{'.$val.'\}(.*?)\{\/'.$val.'\}/si', $this->template, $match)) |
529 | 519 | { |
530 | 520 | $this->replacements[$val] = $match[1]; |
531 | - } |
|
532 | - elseif (in_array($val, $today, TRUE)) |
|
521 | + } elseif (in_array($val, $today, TRUE)) |
|
533 | 522 | { |
534 | 523 | $this->replacements[$val] = $this->replacements[substr($val, 0, -6)]; |
535 | 524 | } |
536 | 525 | } |
537 | - } |
|
538 | - elseif (is_array($this->template)) |
|
526 | + } elseif (is_array($this->template)) |
|
539 | 527 | { |
540 | 528 | $this->replacements = array_merge($this->replacements, $this->template); |
541 | 529 | } |
@@ -173,8 +173,7 @@ discard block |
||
173 | 173 | if (class_exists($child_name, FALSE)) |
174 | 174 | { |
175 | 175 | $class_name = $child_name; |
176 | - } |
|
177 | - else |
|
176 | + } else |
|
178 | 177 | { |
179 | 178 | $msg = 'Unable to load the requested driver: '.$class_name; |
180 | 179 | log_message('error', $msg); |
@@ -274,8 +273,7 @@ discard block |
||
274 | 273 | } |
275 | 274 | |
276 | 275 | self::$_reflections[$class_name] = array($this->_methods, $this->_properties); |
277 | - } |
|
278 | - else |
|
276 | + } else |
|
279 | 277 | { |
280 | 278 | list($this->_methods, $this->_properties) = self::$_reflections[$class_name]; |
281 | 279 | } |
@@ -588,8 +588,7 @@ |
||
588 | 588 | if (is_dir($locpath.$file) && $file[0] !== '.') |
589 | 589 | { |
590 | 590 | $this->mirror($locpath.$file.'/', $rempath.$file.'/'); |
591 | - } |
|
592 | - elseif ($file[0] !== '.') |
|
591 | + } elseif ($file[0] !== '.') |
|
593 | 592 | { |
594 | 593 | // Get the file extension so we can se the upload type |
595 | 594 | $ext = $this->_getext($file); |
@@ -81,7 +81,7 @@ |
||
81 | 81 | { |
82 | 82 | parent::__construct($params); |
83 | 83 | |
84 | - $CI =& get_instance(); |
|
84 | + $CI = & get_instance(); |
|
85 | 85 | isset($CI->db) OR $CI->load->database(); |
86 | 86 | $this->_db = $CI->db; |
87 | 87 |
@@ -54,105 +54,105 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @var string |
56 | 56 | */ |
57 | - public $image_library = 'gd2'; |
|
57 | + public $image_library = 'gd2'; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Path to the graphic library (if applicable) |
61 | 61 | * |
62 | 62 | * @var string |
63 | 63 | */ |
64 | - public $library_path = ''; |
|
64 | + public $library_path = ''; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Whether to send to browser or write to disk |
68 | 68 | * |
69 | 69 | * @var bool |
70 | 70 | */ |
71 | - public $dynamic_output = FALSE; |
|
71 | + public $dynamic_output = FALSE; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Path to original image |
75 | 75 | * |
76 | 76 | * @var string |
77 | 77 | */ |
78 | - public $source_image = ''; |
|
78 | + public $source_image = ''; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Path to the modified image |
82 | 82 | * |
83 | 83 | * @var string |
84 | 84 | */ |
85 | - public $new_image = ''; |
|
85 | + public $new_image = ''; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Image width |
89 | 89 | * |
90 | 90 | * @var int |
91 | 91 | */ |
92 | - public $width = ''; |
|
92 | + public $width = ''; |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Image height |
96 | 96 | * |
97 | 97 | * @var int |
98 | 98 | */ |
99 | - public $height = ''; |
|
99 | + public $height = ''; |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Quality percentage of new image |
103 | 103 | * |
104 | 104 | * @var int |
105 | 105 | */ |
106 | - public $quality = 90; |
|
106 | + public $quality = 90; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Whether to create a thumbnail |
110 | 110 | * |
111 | 111 | * @var bool |
112 | 112 | */ |
113 | - public $create_thumb = FALSE; |
|
113 | + public $create_thumb = FALSE; |
|
114 | 114 | |
115 | 115 | /** |
116 | 116 | * String to add to thumbnail version of image |
117 | 117 | * |
118 | 118 | * @var string |
119 | 119 | */ |
120 | - public $thumb_marker = '_thumb'; |
|
120 | + public $thumb_marker = '_thumb'; |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Whether to maintain aspect ratio when resizing or use hard values |
124 | 124 | * |
125 | 125 | * @var bool |
126 | 126 | */ |
127 | - public $maintain_ratio = TRUE; |
|
127 | + public $maintain_ratio = TRUE; |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * auto, height, or width. Determines what to use as the master dimension |
131 | 131 | * |
132 | 132 | * @var string |
133 | 133 | */ |
134 | - public $master_dim = 'auto'; |
|
134 | + public $master_dim = 'auto'; |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Angle at to rotate image |
138 | 138 | * |
139 | 139 | * @var string |
140 | 140 | */ |
141 | - public $rotation_angle = ''; |
|
141 | + public $rotation_angle = ''; |
|
142 | 142 | |
143 | 143 | /** |
144 | 144 | * X Coordinate for manipulation of the current image |
145 | 145 | * |
146 | 146 | * @var int |
147 | 147 | */ |
148 | - public $x_axis = ''; |
|
148 | + public $x_axis = ''; |
|
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Y Coordinate for manipulation of the current image |
152 | 152 | * |
153 | 153 | * @var int |
154 | 154 | */ |
155 | - public $y_axis = ''; |
|
155 | + public $y_axis = ''; |
|
156 | 156 | |
157 | 157 | // -------------------------------------------------------------------------- |
158 | 158 | // Watermark Vars |
@@ -163,112 +163,112 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @var string |
165 | 165 | */ |
166 | - public $wm_text = ''; |
|
166 | + public $wm_text = ''; |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Type of watermarking. Options: text/overlay |
170 | 170 | * |
171 | 171 | * @var string |
172 | 172 | */ |
173 | - public $wm_type = 'text'; |
|
173 | + public $wm_type = 'text'; |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Default transparency for watermark |
177 | 177 | * |
178 | 178 | * @var int |
179 | 179 | */ |
180 | - public $wm_x_transp = 4; |
|
180 | + public $wm_x_transp = 4; |
|
181 | 181 | |
182 | 182 | /** |
183 | 183 | * Default transparency for watermark |
184 | 184 | * |
185 | 185 | * @var int |
186 | 186 | */ |
187 | - public $wm_y_transp = 4; |
|
187 | + public $wm_y_transp = 4; |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Watermark image path |
191 | 191 | * |
192 | 192 | * @var string |
193 | 193 | */ |
194 | - public $wm_overlay_path = ''; |
|
194 | + public $wm_overlay_path = ''; |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * TT font |
198 | 198 | * |
199 | 199 | * @var string |
200 | 200 | */ |
201 | - public $wm_font_path = ''; |
|
201 | + public $wm_font_path = ''; |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Font size (different versions of GD will either use points or pixels) |
205 | 205 | * |
206 | 206 | * @var int |
207 | 207 | */ |
208 | - public $wm_font_size = 17; |
|
208 | + public $wm_font_size = 17; |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Vertical alignment: T M B |
212 | 212 | * |
213 | 213 | * @var string |
214 | 214 | */ |
215 | - public $wm_vrt_alignment = 'B'; |
|
215 | + public $wm_vrt_alignment = 'B'; |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * Horizontal alignment: L R C |
219 | 219 | * |
220 | 220 | * @var string |
221 | 221 | */ |
222 | - public $wm_hor_alignment = 'C'; |
|
222 | + public $wm_hor_alignment = 'C'; |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Padding around text |
226 | 226 | * |
227 | 227 | * @var int |
228 | 228 | */ |
229 | - public $wm_padding = 0; |
|
229 | + public $wm_padding = 0; |
|
230 | 230 | |
231 | 231 | /** |
232 | 232 | * Lets you push text to the right |
233 | 233 | * |
234 | 234 | * @var int |
235 | 235 | */ |
236 | - public $wm_hor_offset = 0; |
|
236 | + public $wm_hor_offset = 0; |
|
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Lets you push text down |
240 | 240 | * |
241 | 241 | * @var int |
242 | 242 | */ |
243 | - public $wm_vrt_offset = 0; |
|
243 | + public $wm_vrt_offset = 0; |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * Text color |
247 | 247 | * |
248 | 248 | * @var string |
249 | 249 | */ |
250 | - protected $wm_font_color = '#ffffff'; |
|
250 | + protected $wm_font_color = '#ffffff'; |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Dropshadow color |
254 | 254 | * |
255 | 255 | * @var string |
256 | 256 | */ |
257 | - protected $wm_shadow_color = ''; |
|
257 | + protected $wm_shadow_color = ''; |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Dropshadow distance |
261 | 261 | * |
262 | 262 | * @var int |
263 | 263 | */ |
264 | - public $wm_shadow_distance = 2; |
|
264 | + public $wm_shadow_distance = 2; |
|
265 | 265 | |
266 | 266 | /** |
267 | 267 | * Image opacity: 1 - 100 Only works with image |
268 | 268 | * |
269 | 269 | * @var int |
270 | 270 | */ |
271 | - public $wm_opacity = 50; |
|
271 | + public $wm_opacity = 50; |
|
272 | 272 | |
273 | 273 | // -------------------------------------------------------------------------- |
274 | 274 | // Private Vars |
@@ -279,63 +279,63 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @var string |
281 | 281 | */ |
282 | - public $source_folder = ''; |
|
282 | + public $source_folder = ''; |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Destination image folder |
286 | 286 | * |
287 | 287 | * @var string |
288 | 288 | */ |
289 | - public $dest_folder = ''; |
|
289 | + public $dest_folder = ''; |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Image mime-type |
293 | 293 | * |
294 | 294 | * @var string |
295 | 295 | */ |
296 | - public $mime_type = ''; |
|
296 | + public $mime_type = ''; |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * Original image width |
300 | 300 | * |
301 | 301 | * @var int |
302 | 302 | */ |
303 | - public $orig_width = ''; |
|
303 | + public $orig_width = ''; |
|
304 | 304 | |
305 | 305 | /** |
306 | 306 | * Original image height |
307 | 307 | * |
308 | 308 | * @var int |
309 | 309 | */ |
310 | - public $orig_height = ''; |
|
310 | + public $orig_height = ''; |
|
311 | 311 | |
312 | 312 | /** |
313 | 313 | * Image format |
314 | 314 | * |
315 | 315 | * @var string |
316 | 316 | */ |
317 | - public $image_type = ''; |
|
317 | + public $image_type = ''; |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Size of current image |
321 | 321 | * |
322 | 322 | * @var string |
323 | 323 | */ |
324 | - public $size_str = ''; |
|
324 | + public $size_str = ''; |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Full path to source image |
328 | 328 | * |
329 | 329 | * @var string |
330 | 330 | */ |
331 | - public $full_src_path = ''; |
|
331 | + public $full_src_path = ''; |
|
332 | 332 | |
333 | 333 | /** |
334 | 334 | * Full path to destination image |
335 | 335 | * |
336 | 336 | * @var string |
337 | 337 | */ |
338 | - public $full_dst_path = ''; |
|
338 | + public $full_dst_path = ''; |
|
339 | 339 | |
340 | 340 | /** |
341 | 341 | * File permissions |
@@ -349,35 +349,35 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @var string |
351 | 351 | */ |
352 | - public $create_fnc = 'imagecreatetruecolor'; |
|
352 | + public $create_fnc = 'imagecreatetruecolor'; |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Name of function to copy image |
356 | 356 | * |
357 | 357 | * @var string |
358 | 358 | */ |
359 | - public $copy_fnc = 'imagecopyresampled'; |
|
359 | + public $copy_fnc = 'imagecopyresampled'; |
|
360 | 360 | |
361 | 361 | /** |
362 | 362 | * Error messages |
363 | 363 | * |
364 | 364 | * @var array |
365 | 365 | */ |
366 | - public $error_msg = array(); |
|
366 | + public $error_msg = array(); |
|
367 | 367 | |
368 | 368 | /** |
369 | 369 | * Whether to have a drop shadow on watermark |
370 | 370 | * |
371 | 371 | * @var bool |
372 | 372 | */ |
373 | - protected $wm_use_drop_shadow = FALSE; |
|
373 | + protected $wm_use_drop_shadow = FALSE; |
|
374 | 374 | |
375 | 375 | /** |
376 | 376 | * Whether to use truetype fonts |
377 | 377 | * |
378 | 378 | * @var bool |
379 | 379 | */ |
380 | - public $wm_use_truetype = FALSE; |
|
380 | + public $wm_use_truetype = FALSE; |
|
381 | 381 | |
382 | 382 | /** |
383 | 383 | * Initialize Image Library |
@@ -413,30 +413,30 @@ discard block |
||
413 | 413 | $this->$val = ''; |
414 | 414 | } |
415 | 415 | |
416 | - $this->image_library = 'gd2'; |
|
417 | - $this->dynamic_output = FALSE; |
|
418 | - $this->quality = 90; |
|
416 | + $this->image_library = 'gd2'; |
|
417 | + $this->dynamic_output = FALSE; |
|
418 | + $this->quality = 90; |
|
419 | 419 | $this->create_thumb = FALSE; |
420 | 420 | $this->thumb_marker = '_thumb'; |
421 | - $this->maintain_ratio = TRUE; |
|
422 | - $this->master_dim = 'auto'; |
|
423 | - $this->wm_type = 'text'; |
|
421 | + $this->maintain_ratio = TRUE; |
|
422 | + $this->master_dim = 'auto'; |
|
423 | + $this->wm_type = 'text'; |
|
424 | 424 | $this->wm_x_transp = 4; |
425 | 425 | $this->wm_y_transp = 4; |
426 | 426 | $this->wm_font_size = 17; |
427 | 427 | $this->wm_vrt_alignment = 'B'; |
428 | 428 | $this->wm_hor_alignment = 'C'; |
429 | - $this->wm_padding = 0; |
|
429 | + $this->wm_padding = 0; |
|
430 | 430 | $this->wm_hor_offset = 0; |
431 | 431 | $this->wm_vrt_offset = 0; |
432 | - $this->wm_font_color = '#ffffff'; |
|
433 | - $this->wm_shadow_distance = 2; |
|
432 | + $this->wm_font_color = '#ffffff'; |
|
433 | + $this->wm_shadow_distance = 2; |
|
434 | 434 | $this->wm_opacity = 50; |
435 | 435 | $this->create_fnc = 'imagecreatetruecolor'; |
436 | - $this->copy_fnc = 'imagecopyresampled'; |
|
437 | - $this->error_msg = array(); |
|
438 | - $this->wm_use_drop_shadow = FALSE; |
|
439 | - $this->wm_use_truetype = FALSE; |
|
436 | + $this->copy_fnc = 'imagecopyresampled'; |
|
437 | + $this->error_msg = array(); |
|
438 | + $this->wm_use_drop_shadow = FALSE; |
|
439 | + $this->wm_use_truetype = FALSE; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | // -------------------------------------------------------------------- |
@@ -711,13 +711,13 @@ discard block |
||
711 | 711 | // Reassign the width and height |
712 | 712 | if ($this->rotation_angle === 90 OR $this->rotation_angle === 270) |
713 | 713 | { |
714 | - $this->width = $this->orig_height; |
|
715 | - $this->height = $this->orig_width; |
|
714 | + $this->width = $this->orig_height; |
|
715 | + $this->height = $this->orig_width; |
|
716 | 716 | } |
717 | 717 | else |
718 | 718 | { |
719 | - $this->width = $this->orig_width; |
|
720 | - $this->height = $this->orig_height; |
|
719 | + $this->width = $this->orig_width; |
|
720 | + $this->height = $this->orig_height; |
|
721 | 721 | } |
722 | 722 | |
723 | 723 | // Choose resizing function |
@@ -795,13 +795,13 @@ discard block |
||
795 | 795 | */ |
796 | 796 | if ($this->image_library === 'gd2' && function_exists('imagecreatetruecolor')) |
797 | 797 | { |
798 | - $create = 'imagecreatetruecolor'; |
|
799 | - $copy = 'imagecopyresampled'; |
|
798 | + $create = 'imagecreatetruecolor'; |
|
799 | + $copy = 'imagecopyresampled'; |
|
800 | 800 | } |
801 | 801 | else |
802 | 802 | { |
803 | - $create = 'imagecreate'; |
|
804 | - $copy = 'imagecopyresized'; |
|
803 | + $create = 'imagecreate'; |
|
804 | + $copy = 'imagecopyresized'; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | $dst_img = $create($this->width, $this->height); |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | |
863 | 863 | if ($action === 'crop') |
864 | 864 | { |
865 | - $cmd .= ' -crop '.$this->width.'x'.$this->height.'+'.$this->x_axis.'+'.$this->y_axis.' "'.$this->full_src_path.'" "'.$this->full_dst_path .'" 2>&1'; |
|
865 | + $cmd .= ' -crop '.$this->width.'x'.$this->height.'+'.$this->x_axis.'+'.$this->y_axis.' "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1'; |
|
866 | 866 | } |
867 | 867 | elseif ($action === 'rotate') |
868 | 868 | { |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | } |
874 | 874 | else // Resize |
875 | 875 | { |
876 | - if($this->maintain_ratio === TRUE) |
|
876 | + if ($this->maintain_ratio === TRUE) |
|
877 | 877 | { |
878 | 878 | $cmd .= ' -resize '.$this->width.'x'.$this->height.' "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1'; |
879 | 879 | } |
@@ -1146,10 +1146,10 @@ discard block |
||
1146 | 1146 | $this->get_image_properties(); |
1147 | 1147 | |
1148 | 1148 | // Fetch watermark image properties |
1149 | - $props = $this->get_image_properties($this->wm_overlay_path, TRUE); |
|
1150 | - $wm_img_type = $props['image_type']; |
|
1151 | - $wm_width = $props['width']; |
|
1152 | - $wm_height = $props['height']; |
|
1149 | + $props = $this->get_image_properties($this->wm_overlay_path, TRUE); |
|
1150 | + $wm_img_type = $props['image_type']; |
|
1151 | + $wm_width = $props['width']; |
|
1152 | + $wm_height = $props['height']; |
|
1153 | 1153 | |
1154 | 1154 | // Create two image resources |
1155 | 1155 | $wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type); |
@@ -1589,7 +1589,7 @@ discard block |
||
1589 | 1589 | { |
1590 | 1590 | if ($this->width > 0 && $this->height > 0) |
1591 | 1591 | { |
1592 | - $this->master_dim = ((($this->orig_height/$this->orig_width) - ($this->height/$this->width)) < 0) |
|
1592 | + $this->master_dim = ((($this->orig_height / $this->orig_width) - ($this->height / $this->width)) < 0) |
|
1593 | 1593 | ? 'width' : 'height'; |
1594 | 1594 | } |
1595 | 1595 | else |
@@ -1605,11 +1605,11 @@ discard block |
||
1605 | 1605 | |
1606 | 1606 | if ($this->master_dim === 'width') |
1607 | 1607 | { |
1608 | - $this->height = (int) ceil($this->width*$this->orig_height/$this->orig_width); |
|
1608 | + $this->height = (int) ceil($this->width * $this->orig_height / $this->orig_width); |
|
1609 | 1609 | } |
1610 | 1610 | else |
1611 | 1611 | { |
1612 | - $this->width = (int) ceil($this->orig_width*$this->height/$this->orig_height); |
|
1612 | + $this->width = (int) ceil($this->orig_width * $this->height / $this->orig_height); |
|
1613 | 1613 | } |
1614 | 1614 | } |
1615 | 1615 | |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | $this->orig_width = $vals[0]; |
1659 | - $this->orig_height = $vals[1]; |
|
1659 | + $this->orig_height = $vals[1]; |
|
1660 | 1660 | $this->image_type = $vals[2]; |
1661 | 1661 | $this->size_str = $vals[3]; |
1662 | 1662 | $this->mime_type = $mime; |
@@ -1707,11 +1707,11 @@ discard block |
||
1707 | 1707 | |
1708 | 1708 | if ($vals['new_width'] === 0) |
1709 | 1709 | { |
1710 | - $vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']); |
|
1710 | + $vals['new_width'] = ceil($vals['width'] * $vals['new_height'] / $vals['height']); |
|
1711 | 1711 | } |
1712 | 1712 | elseif ($vals['new_height'] === 0) |
1713 | 1713 | { |
1714 | - $vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']); |
|
1714 | + $vals['new_height'] = ceil($vals['new_width'] * $vals['height'] / $vals['width']); |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | return $vals; |
@@ -1788,7 +1788,7 @@ discard block |
||
1788 | 1788 | */ |
1789 | 1789 | public function set_error($msg) |
1790 | 1790 | { |
1791 | - $CI =& get_instance(); |
|
1791 | + $CI = & get_instance(); |
|
1792 | 1792 | $CI->lang->load('imglib'); |
1793 | 1793 | |
1794 | 1794 | if (is_array($msg)) |
@@ -472,8 +472,7 @@ discard block |
||
472 | 472 | $val = (strlen($matches[1]) === 6) |
473 | 473 | ? '#'.$matches[1] |
474 | 474 | : '#'.$matches[1][0].$matches[1][0].$matches[1][1].$matches[1][1].$matches[1][2].$matches[1][2]; |
475 | - } |
|
476 | - else |
|
475 | + } else |
|
477 | 476 | { |
478 | 477 | continue; |
479 | 478 | } |
@@ -514,8 +513,7 @@ discard block |
||
514 | 513 | if (($full_source_path = realpath($this->source_image)) !== FALSE) |
515 | 514 | { |
516 | 515 | $full_source_path = str_replace('\\', '/', $full_source_path); |
517 | - } |
|
518 | - else |
|
516 | + } else |
|
519 | 517 | { |
520 | 518 | $full_source_path = $this->source_image; |
521 | 519 | } |
@@ -542,19 +540,16 @@ discard block |
||
542 | 540 | { |
543 | 541 | $this->dest_image = $this->source_image; |
544 | 542 | $this->dest_folder = $this->source_folder; |
545 | - } |
|
546 | - elseif (strpos($this->new_image, '/') === FALSE) |
|
543 | + } elseif (strpos($this->new_image, '/') === FALSE) |
|
547 | 544 | { |
548 | 545 | $this->dest_folder = $this->source_folder; |
549 | 546 | $this->dest_image = $this->new_image; |
550 | - } |
|
551 | - else |
|
547 | + } else |
|
552 | 548 | { |
553 | 549 | if (strpos($this->new_image, '/') === FALSE && strpos($this->new_image, '\\') === FALSE) |
554 | 550 | { |
555 | 551 | $full_dest_path = str_replace('\\', '/', realpath($this->new_image)); |
556 | - } |
|
557 | - else |
|
552 | + } else |
|
558 | 553 | { |
559 | 554 | $full_dest_path = $this->new_image; |
560 | 555 | } |
@@ -564,8 +559,7 @@ discard block |
||
564 | 559 | { |
565 | 560 | $this->dest_folder = $full_dest_path.'/'; |
566 | 561 | $this->dest_image = $this->source_image; |
567 | - } |
|
568 | - else |
|
562 | + } else |
|
569 | 563 | { |
570 | 564 | $x = explode('/', $full_dest_path); |
571 | 565 | $this->dest_image = end($x); |
@@ -641,8 +635,7 @@ discard block |
||
641 | 635 | if ($this->wm_shadow_color !== '') |
642 | 636 | { |
643 | 637 | $this->wm_use_drop_shadow = TRUE; |
644 | - } |
|
645 | - elseif ($this->wm_use_drop_shadow === TRUE && $this->wm_shadow_color === '') |
|
638 | + } elseif ($this->wm_use_drop_shadow === TRUE && $this->wm_shadow_color === '') |
|
646 | 639 | { |
647 | 640 | $this->wm_use_drop_shadow = FALSE; |
648 | 641 | } |
@@ -713,8 +706,7 @@ discard block |
||
713 | 706 | { |
714 | 707 | $this->width = $this->orig_height; |
715 | 708 | $this->height = $this->orig_width; |
716 | - } |
|
717 | - else |
|
709 | + } else |
|
718 | 710 | { |
719 | 711 | $this->width = $this->orig_width; |
720 | 712 | $this->height = $this->orig_height; |
@@ -771,8 +763,7 @@ discard block |
||
771 | 763 | $gd_version = str_replace('0', '', $this->gd_version()); |
772 | 764 | $v2_override = ($gd_version == 2); |
773 | 765 | } |
774 | - } |
|
775 | - else |
|
766 | + } else |
|
776 | 767 | { |
777 | 768 | // If resizing the x/y axis must be zero |
778 | 769 | $this->x_axis = 0; |
@@ -797,8 +788,7 @@ discard block |
||
797 | 788 | { |
798 | 789 | $create = 'imagecreatetruecolor'; |
799 | 790 | $copy = 'imagecopyresampled'; |
800 | - } |
|
801 | - else |
|
791 | + } else |
|
802 | 792 | { |
803 | 793 | $create = 'imagecreate'; |
804 | 794 | $copy = 'imagecopyresized'; |
@@ -806,9 +796,11 @@ discard block |
||
806 | 796 | |
807 | 797 | $dst_img = $create($this->width, $this->height); |
808 | 798 | |
809 | - if ($this->image_type === 3) // png we can actually preserve transparency |
|
799 | + if ($this->image_type === 3) { |
|
800 | + // png we can actually preserve transparency |
|
810 | 801 | { |
811 | 802 | imagealphablending($dst_img, FALSE); |
803 | + } |
|
812 | 804 | imagesavealpha($dst_img, TRUE); |
813 | 805 | } |
814 | 806 | |
@@ -818,11 +810,12 @@ discard block |
||
818 | 810 | if ($this->dynamic_output === TRUE) |
819 | 811 | { |
820 | 812 | $this->image_display_gd($dst_img); |
821 | - } |
|
822 | - elseif ( ! $this->image_save_gd($dst_img)) // Or save it |
|
813 | + } elseif ( ! $this->image_save_gd($dst_img)) { |
|
814 | + // Or save it |
|
823 | 815 | { |
824 | 816 | return FALSE; |
825 | 817 | } |
818 | + } |
|
826 | 819 | |
827 | 820 | // Kill the file handles |
828 | 821 | imagedestroy($dst_img); |
@@ -863,21 +856,18 @@ discard block |
||
863 | 856 | if ($action === 'crop') |
864 | 857 | { |
865 | 858 | $cmd .= ' -crop '.$this->width.'x'.$this->height.'+'.$this->x_axis.'+'.$this->y_axis.' "'.$this->full_src_path.'" "'.$this->full_dst_path .'" 2>&1'; |
866 | - } |
|
867 | - elseif ($action === 'rotate') |
|
859 | + } elseif ($action === 'rotate') |
|
868 | 860 | { |
869 | 861 | $angle = ($this->rotation_angle === 'hor' OR $this->rotation_angle === 'vrt') |
870 | 862 | ? '-flop' : '-rotate '.$this->rotation_angle; |
871 | 863 | |
872 | 864 | $cmd .= ' '.$angle.' "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1'; |
873 | - } |
|
874 | - else // Resize |
|
865 | + } else // Resize |
|
875 | 866 | { |
876 | 867 | if($this->maintain_ratio === TRUE) |
877 | 868 | { |
878 | 869 | $cmd .= ' -resize '.$this->width.'x'.$this->height.' "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1'; |
879 | - } |
|
880 | - else |
|
870 | + } else |
|
881 | 871 | { |
882 | 872 | $cmd .= ' -resize '.$this->width.'x'.$this->height.'\! "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1'; |
883 | 873 | } |
@@ -940,8 +930,7 @@ discard block |
||
940 | 930 | if ($action === 'crop') |
941 | 931 | { |
942 | 932 | $cmd_inner = 'pnmcut -left '.$this->x_axis.' -top '.$this->y_axis.' -width '.$this->width.' -height '.$this->height; |
943 | - } |
|
944 | - elseif ($action === 'rotate') |
|
933 | + } elseif ($action === 'rotate') |
|
945 | 934 | { |
946 | 935 | switch ($this->rotation_angle) |
947 | 936 | { |
@@ -958,8 +947,7 @@ discard block |
||
958 | 947 | } |
959 | 948 | |
960 | 949 | $cmd_inner = 'pnmflip -'.$angle.' '; |
961 | - } |
|
962 | - else // Resize |
|
950 | + } else // Resize |
|
963 | 951 | { |
964 | 952 | $cmd_inner = 'pnmscale -xysize '.$this->width.' '.$this->height; |
965 | 953 | } |
@@ -1019,11 +1007,12 @@ discard block |
||
1019 | 1007 | if ($this->dynamic_output === TRUE) |
1020 | 1008 | { |
1021 | 1009 | $this->image_display_gd($dst_img); |
1022 | - } |
|
1023 | - elseif ( ! $this->image_save_gd($dst_img)) // ... or save it |
|
1010 | + } elseif ( ! $this->image_save_gd($dst_img)) { |
|
1011 | + // ... or save it |
|
1024 | 1012 | { |
1025 | 1013 | return FALSE; |
1026 | 1014 | } |
1015 | + } |
|
1027 | 1016 | |
1028 | 1017 | // Kill the file handles |
1029 | 1018 | imagedestroy($dst_img); |
@@ -1072,8 +1061,7 @@ discard block |
||
1072 | 1061 | $right--; |
1073 | 1062 | } |
1074 | 1063 | } |
1075 | - } |
|
1076 | - else |
|
1064 | + } else |
|
1077 | 1065 | { |
1078 | 1066 | for ($i = 0; $i < $width; $i++) |
1079 | 1067 | { |
@@ -1098,11 +1086,12 @@ discard block |
||
1098 | 1086 | if ($this->dynamic_output === TRUE) |
1099 | 1087 | { |
1100 | 1088 | $this->image_display_gd($src_img); |
1101 | - } |
|
1102 | - elseif ( ! $this->image_save_gd($src_img)) // ... or save it |
|
1089 | + } elseif ( ! $this->image_save_gd($src_img)) { |
|
1090 | + // ... or save it |
|
1103 | 1091 | { |
1104 | 1092 | return FALSE; |
1105 | 1093 | } |
1094 | + } |
|
1106 | 1095 | |
1107 | 1096 | // Kill the file handles |
1108 | 1097 | imagedestroy($src_img); |
@@ -1165,11 +1154,13 @@ discard block |
||
1165 | 1154 | $this->wm_vrt_alignment = strtoupper($this->wm_vrt_alignment[0]); |
1166 | 1155 | $this->wm_hor_alignment = strtoupper($this->wm_hor_alignment[0]); |
1167 | 1156 | |
1168 | - if ($this->wm_vrt_alignment === 'B') |
|
1169 | - $this->wm_vrt_offset = $this->wm_vrt_offset * -1; |
|
1157 | + if ($this->wm_vrt_alignment === 'B') { |
|
1158 | + $this->wm_vrt_offset = $this->wm_vrt_offset * -1; |
|
1159 | + } |
|
1170 | 1160 | |
1171 | - if ($this->wm_hor_alignment === 'R') |
|
1172 | - $this->wm_hor_offset = $this->wm_hor_offset * -1; |
|
1161 | + if ($this->wm_hor_alignment === 'R') { |
|
1162 | + $this->wm_hor_offset = $this->wm_hor_offset * -1; |
|
1163 | + } |
|
1173 | 1164 | |
1174 | 1165 | // Set the base x and y axis values |
1175 | 1166 | $x_axis = $this->wm_hor_offset + $this->wm_padding; |
@@ -1179,8 +1170,7 @@ discard block |
||
1179 | 1170 | if ($this->wm_vrt_alignment === 'M') |
1180 | 1171 | { |
1181 | 1172 | $y_axis += ($this->orig_height / 2) - ($wm_height / 2); |
1182 | - } |
|
1183 | - elseif ($this->wm_vrt_alignment === 'B') |
|
1173 | + } elseif ($this->wm_vrt_alignment === 'B') |
|
1184 | 1174 | { |
1185 | 1175 | $y_axis += $this->orig_height - $wm_height; |
1186 | 1176 | } |
@@ -1189,8 +1179,7 @@ discard block |
||
1189 | 1179 | if ($this->wm_hor_alignment === 'C') |
1190 | 1180 | { |
1191 | 1181 | $x_axis += ($this->orig_width / 2) - ($wm_width / 2); |
1192 | - } |
|
1193 | - elseif ($this->wm_hor_alignment === 'R') |
|
1182 | + } elseif ($this->wm_hor_alignment === 'R') |
|
1194 | 1183 | { |
1195 | 1184 | $x_axis += $this->orig_width - $wm_width; |
1196 | 1185 | } |
@@ -1210,8 +1199,7 @@ discard block |
||
1210 | 1199 | { |
1211 | 1200 | // copy the image directly, the image's alpha transparency being the sole determinant of blending |
1212 | 1201 | imagecopy($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height); |
1213 | - } |
|
1214 | - else |
|
1202 | + } else |
|
1215 | 1203 | { |
1216 | 1204 | // set our RGB value from above to be transparent and merge the images with the specified opacity |
1217 | 1205 | imagecolortransparent($wm_img, imagecolorat($wm_img, $this->wm_x_transp, $this->wm_y_transp)); |
@@ -1229,11 +1217,12 @@ discard block |
||
1229 | 1217 | if ($this->dynamic_output === TRUE) |
1230 | 1218 | { |
1231 | 1219 | $this->image_display_gd($src_img); |
1232 | - } |
|
1233 | - elseif ( ! $this->image_save_gd($src_img)) // ... or save it |
|
1220 | + } elseif ( ! $this->image_save_gd($src_img)) { |
|
1221 | + // ... or save it |
|
1234 | 1222 | { |
1235 | 1223 | return FALSE; |
1236 | 1224 | } |
1225 | + } |
|
1237 | 1226 | |
1238 | 1227 | imagedestroy($src_img); |
1239 | 1228 | imagedestroy($wm_img); |
@@ -1297,16 +1286,14 @@ discard block |
||
1297 | 1286 | $temp = $temp[2] - $temp[0]; |
1298 | 1287 | |
1299 | 1288 | $fontwidth = $temp / strlen($this->wm_text); |
1300 | - } |
|
1301 | - else |
|
1289 | + } else |
|
1302 | 1290 | { |
1303 | 1291 | $fontwidth = $this->wm_font_size - ($this->wm_font_size / 4); |
1304 | 1292 | } |
1305 | 1293 | |
1306 | 1294 | $fontheight = $this->wm_font_size; |
1307 | 1295 | $this->wm_vrt_offset += $this->wm_font_size; |
1308 | - } |
|
1309 | - else |
|
1296 | + } else |
|
1310 | 1297 | { |
1311 | 1298 | $fontwidth = imagefontwidth($this->wm_font_size); |
1312 | 1299 | $fontheight = imagefontheight($this->wm_font_size); |
@@ -1328,8 +1315,7 @@ discard block |
||
1328 | 1315 | if ($this->wm_vrt_alignment === 'M') |
1329 | 1316 | { |
1330 | 1317 | $y_axis += ($this->orig_height / 2) + ($fontheight / 2); |
1331 | - } |
|
1332 | - elseif ($this->wm_vrt_alignment === 'B') |
|
1318 | + } elseif ($this->wm_vrt_alignment === 'B') |
|
1333 | 1319 | { |
1334 | 1320 | $y_axis += $this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight / 2); |
1335 | 1321 | } |
@@ -1338,8 +1324,7 @@ discard block |
||
1338 | 1324 | if ($this->wm_hor_alignment === 'R') |
1339 | 1325 | { |
1340 | 1326 | $x_axis += $this->orig_width - ($fontwidth * strlen($this->wm_text)) - $this->wm_shadow_distance; |
1341 | - } |
|
1342 | - elseif ($this->wm_hor_alignment === 'C') |
|
1327 | + } elseif ($this->wm_hor_alignment === 'C') |
|
1343 | 1328 | { |
1344 | 1329 | $x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2); |
1345 | 1330 | } |
@@ -1363,8 +1348,7 @@ discard block |
||
1363 | 1348 | if ($this->wm_use_truetype) |
1364 | 1349 | { |
1365 | 1350 | imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); |
1366 | - } |
|
1367 | - else |
|
1351 | + } else |
|
1368 | 1352 | { |
1369 | 1353 | imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); |
1370 | 1354 | } |
@@ -1383,8 +1367,7 @@ discard block |
||
1383 | 1367 | if ($this->wm_use_truetype) |
1384 | 1368 | { |
1385 | 1369 | imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); |
1386 | - } |
|
1387 | - else |
|
1370 | + } else |
|
1388 | 1371 | { |
1389 | 1372 | imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); |
1390 | 1373 | } |
@@ -1400,8 +1383,7 @@ discard block |
||
1400 | 1383 | if ($this->dynamic_output === TRUE) |
1401 | 1384 | { |
1402 | 1385 | $this->image_display_gd($src_img); |
1403 | - } |
|
1404 | - else |
|
1386 | + } else |
|
1405 | 1387 | { |
1406 | 1388 | $this->image_save_gd($src_img); |
1407 | 1389 | } |
@@ -1591,13 +1573,11 @@ discard block |
||
1591 | 1573 | { |
1592 | 1574 | $this->master_dim = ((($this->orig_height/$this->orig_width) - ($this->height/$this->width)) < 0) |
1593 | 1575 | ? 'width' : 'height'; |
1594 | - } |
|
1595 | - else |
|
1576 | + } else |
|
1596 | 1577 | { |
1597 | 1578 | $this->master_dim = ($this->height === 0) ? 'width' : 'height'; |
1598 | 1579 | } |
1599 | - } |
|
1600 | - elseif (($this->master_dim === 'width' && $this->width === 0) |
|
1580 | + } elseif (($this->master_dim === 'width' && $this->width === 0) |
|
1601 | 1581 | OR ($this->master_dim === 'height' && $this->height === 0)) |
1602 | 1582 | { |
1603 | 1583 | return; |
@@ -1606,8 +1586,7 @@ discard block |
||
1606 | 1586 | if ($this->master_dim === 'width') |
1607 | 1587 | { |
1608 | 1588 | $this->height = (int) ceil($this->width*$this->orig_height/$this->orig_width); |
1609 | - } |
|
1610 | - else |
|
1589 | + } else |
|
1611 | 1590 | { |
1612 | 1591 | $this->width = (int) ceil($this->orig_width*$this->height/$this->orig_height); |
1613 | 1592 | } |
@@ -1708,8 +1687,7 @@ discard block |
||
1708 | 1687 | if ($vals['new_width'] === 0) |
1709 | 1688 | { |
1710 | 1689 | $vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']); |
1711 | - } |
|
1712 | - elseif ($vals['new_height'] === 0) |
|
1690 | + } elseif ($vals['new_height'] === 0) |
|
1713 | 1691 | { |
1714 | 1692 | $vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']); |
1715 | 1693 | } |
@@ -1799,8 +1777,7 @@ discard block |
||
1799 | 1777 | $this->error_msg[] = $msg; |
1800 | 1778 | log_message('error', $msg); |
1801 | 1779 | } |
1802 | - } |
|
1803 | - else |
|
1780 | + } else |
|
1804 | 1781 | { |
1805 | 1782 | $msg = ($CI->lang->line($msg) === FALSE) ? $msg : $CI->lang->line($msg); |
1806 | 1783 | $this->error_msg[] = $msg; |
@@ -258,7 +258,7 @@ |
||
258 | 258 | |
259 | 259 | // Run migrations that are inside the target range |
260 | 260 | if ( |
261 | - ($method === 'up' && $number > $current_version && $number <= $target_version) OR |
|
261 | + ($method === 'up' && $number > $current_version && $number <= $target_version) OR |
|
262 | 262 | ($method === 'down' && $number <= $current_version && $number > $target_version) |
263 | 263 | ) |
264 | 264 | { |
@@ -201,8 +201,7 @@ discard block |
||
201 | 201 | if ($this->_migration_type === 'sequential') |
202 | 202 | { |
203 | 203 | $target_version = sprintf('%03d', $target_version); |
204 | - } |
|
205 | - else |
|
204 | + } else |
|
206 | 205 | { |
207 | 206 | $target_version = (string) $target_version; |
208 | 207 | } |
@@ -219,8 +218,7 @@ discard block |
||
219 | 218 | { |
220 | 219 | // Moving Up |
221 | 220 | $method = 'up'; |
222 | - } |
|
223 | - else |
|
221 | + } else |
|
224 | 222 | { |
225 | 223 | // Moving Down, apply in reverse order |
226 | 224 | $method = 'down'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @var string |
57 | 57 | */ |
58 | - protected $base_url = ''; |
|
58 | + protected $base_url = ''; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Prefix |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function __construct($params = array()) |
331 | 331 | { |
332 | - $this->CI =& get_instance(); |
|
332 | + $this->CI = & get_instance(); |
|
333 | 333 | $this->CI->load->language('pagination'); |
334 | 334 | foreach (array('first_link', 'next_link', 'prev_link', 'last_link') as $key) |
335 | 335 | { |
@@ -545,13 +545,13 @@ discard block |
||
545 | 545 | // to a page number, so we can generate the surrounding number links. |
546 | 546 | if ( ! $this->use_page_numbers) |
547 | 547 | { |
548 | - $this->cur_page = (int) floor(($this->cur_page/$this->per_page) + 1); |
|
548 | + $this->cur_page = (int) floor(($this->cur_page / $this->per_page) + 1); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | // Calculate the start and end numbers. These determine |
552 | 552 | // which number to start and end the digit links with. |
553 | - $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; |
|
554 | - $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; |
|
553 | + $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; |
|
554 | + $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; |
|
555 | 555 | |
556 | 556 | // And here we go... |
557 | 557 | $output = ''; |
@@ -430,8 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | // Unset the controll, method, old-school routing options |
432 | 432 | unset($get['c'], $get['m'], $get[$this->query_string_segment]); |
433 | - } |
|
434 | - else |
|
433 | + } else |
|
435 | 434 | { |
436 | 435 | $get = array(); |
437 | 436 | } |
@@ -463,8 +462,7 @@ discard block |
||
463 | 462 | // Add the page segment to the end of the query string, where the |
464 | 463 | // page number will be appended. |
465 | 464 | $base_url .= $query_string_sep.http_build_query(array_merge($get, array($this->query_string_segment => ''))); |
466 | - } |
|
467 | - else |
|
465 | + } else |
|
468 | 466 | { |
469 | 467 | // Standard segment mode. |
470 | 468 | // Generate our saved query string to append later after the page number. |
@@ -496,8 +494,7 @@ discard block |
||
496 | 494 | if ($this->page_query_string === TRUE) |
497 | 495 | { |
498 | 496 | $this->cur_page = $this->CI->input->get($this->query_string_segment); |
499 | - } |
|
500 | - else |
|
497 | + } else |
|
501 | 498 | { |
502 | 499 | // Default to the last segment number if one hasn't been defined. |
503 | 500 | if ($this->uri_segment === 0) |
@@ -518,8 +515,7 @@ discard block |
||
518 | 515 | if ( ! ctype_digit($this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0)) |
519 | 516 | { |
520 | 517 | $this->cur_page = $base_page; |
521 | - } |
|
522 | - else |
|
518 | + } else |
|
523 | 519 | { |
524 | 520 | // Make sure we're using integers for comparisons later. |
525 | 521 | $this->cur_page = (int) $this->cur_page; |
@@ -533,8 +529,7 @@ discard block |
||
533 | 529 | { |
534 | 530 | $this->cur_page = $num_pages; |
535 | 531 | } |
536 | - } |
|
537 | - elseif ($this->cur_page > $this->total_rows) |
|
532 | + } elseif ($this->cur_page > $this->total_rows) |
|
538 | 533 | { |
539 | 534 | $this->cur_page = ($num_pages - 1) * $this->per_page; |
540 | 535 | } |
@@ -578,8 +573,7 @@ discard block |
||
578 | 573 | // First page |
579 | 574 | $output .= $this->prev_tag_open.'<a href="'.$first_url.'"'.$attributes.$this->_attr_rel('prev').'>' |
580 | 575 | .$this->prev_link.'</a>'.$this->prev_tag_close; |
581 | - } |
|
582 | - else |
|
576 | + } else |
|
583 | 577 | { |
584 | 578 | $append = $this->prefix.$i.$this->suffix; |
585 | 579 | $output .= $this->prev_tag_open.'<a href="'.$base_url.$append.'"'.$attributes.$this->_attr_rel('prev').'>' |
@@ -604,14 +598,12 @@ discard block |
||
604 | 598 | { |
605 | 599 | // Current page |
606 | 600 | $output .= $this->cur_tag_open.$loop.$this->cur_tag_close; |
607 | - } |
|
608 | - elseif ($i === $base_page) |
|
601 | + } elseif ($i === $base_page) |
|
609 | 602 | { |
610 | 603 | // First page |
611 | 604 | $output .= $this->num_tag_open.'<a href="'.$first_url.'"'.$attributes.$this->_attr_rel('start').'>' |
612 | 605 | .$loop.'</a>'.$this->num_tag_close; |
613 | - } |
|
614 | - else |
|
606 | + } else |
|
615 | 607 | { |
616 | 608 | $append = $this->prefix.$i.$this->suffix; |
617 | 609 | $output .= $this->num_tag_open.'<a href="'.$base_url.$append.'"'.$attributes.'>' |