@@ -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.'>' |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function __construct($config = array()) |
99 | 99 | { |
100 | - $this->CI =& get_instance(); |
|
100 | + $this->CI = & get_instance(); |
|
101 | 101 | $this->CI->load->language('profiler'); |
102 | 102 | |
103 | 103 | // default all sections to display |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // Key words we want bolded |
239 | 239 | $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); |
240 | 240 | |
241 | - $output = "\n\n"; |
|
241 | + $output = "\n\n"; |
|
242 | 242 | $count = 0; |
243 | 243 | |
244 | 244 | foreach ($dbs as $name => $db) |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | .' (<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_httpheaders_table\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show')."</span>)</legend>\n\n\n" |
464 | 464 | .'<table style="width:100%;display:none;" id="ci_profiler_httpheaders_table">'."\n"; |
465 | 465 | |
466 | - foreach (array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD',' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_FORWARDED_FOR', 'HTTP_DNT') as $header) |
|
466 | + foreach (array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD', ' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_FORWARDED_FOR', 'HTTP_DNT') as $header) |
|
467 | 467 | { |
468 | 468 | $val = isset($_SERVER[$header]) ? $_SERVER[$header] : ''; |
469 | 469 | $output .= '<tr><td style="vertical-align:top;width:50%;padding:5px;color:#900;background-color:#ddd;">' |
@@ -206,8 +206,7 @@ discard block |
||
206 | 206 | if ($cobject instanceof CI_DB) |
207 | 207 | { |
208 | 208 | $dbs[get_class($this->CI).':$'.$name] = $cobject; |
209 | - } |
|
210 | - elseif ($cobject instanceof CI_Model) |
|
209 | + } elseif ($cobject instanceof CI_Model) |
|
211 | 210 | { |
212 | 211 | foreach (get_object_vars($cobject) as $mname => $mobject) |
213 | 212 | { |
@@ -264,8 +263,7 @@ discard block |
||
264 | 263 | { |
265 | 264 | $output .= '<tr><td style="width:100%;color:#0000FF;font-weight:normal;background-color:#eee;padding:5px;">' |
266 | 265 | .$this->CI->lang->line('profiler_no_queries')."</td></tr>\n"; |
267 | - } |
|
268 | - else |
|
266 | + } else |
|
269 | 267 | { |
270 | 268 | foreach ($db->queries as $key => $val) |
271 | 269 | { |
@@ -307,8 +305,7 @@ discard block |
||
307 | 305 | if (count($_GET) === 0) |
308 | 306 | { |
309 | 307 | $output .= '<div style="color:#cd6e00;font-weight:normal;padding:4px 0 4px 0;">'.$this->CI->lang->line('profiler_no_get').'</div>'; |
310 | - } |
|
311 | - else |
|
308 | + } else |
|
312 | 309 | { |
313 | 310 | $output .= "\n\n<table style=\"width:100%;border:none;\">\n"; |
314 | 311 | |
@@ -345,8 +342,7 @@ discard block |
||
345 | 342 | if (count($_POST) === 0 && count($_FILES) === 0) |
346 | 343 | { |
347 | 344 | $output .= '<div style="color:#009900;font-weight:normal;padding:4px 0 4px 0;">'.$this->CI->lang->line('profiler_no_post').'</div>'; |
348 | - } |
|
349 | - else |
|
345 | + } else |
|
350 | 346 | { |
351 | 347 | $output .= "\n\n<table style=\"width:100%;\">\n"; |
352 | 348 | |
@@ -360,8 +356,7 @@ discard block |
||
360 | 356 | if (is_array($val) OR is_object($val)) |
361 | 357 | { |
362 | 358 | $output .= '<pre>'.htmlspecialchars(stripslashes(print_r($val, TRUE))).'</pre>'; |
363 | - } |
|
364 | - else |
|
359 | + } else |
|
365 | 360 | { |
366 | 361 | $output .= htmlspecialchars(stripslashes($val)); |
367 | 362 | } |
@@ -354,7 +354,7 @@ |
||
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | - $this->userdata =& $_SESSION; |
|
357 | + $this->userdata = & $_SESSION; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | // ------------------------------------------------------------------------ |
@@ -73,18 +73,15 @@ discard block |
||
73 | 73 | { |
74 | 74 | log_message('debug', 'Session: Initialization under CLI aborted.'); |
75 | 75 | return; |
76 | - } |
|
77 | - elseif ((bool) ini_get('session.auto_start')) |
|
76 | + } elseif ((bool) ini_get('session.auto_start')) |
|
78 | 77 | { |
79 | 78 | log_message('error', 'Session: session.auto_start is enabled in php.ini. Aborting.'); |
80 | 79 | return; |
81 | - } |
|
82 | - elseif ( ! empty($params['driver'])) |
|
80 | + } elseif ( ! empty($params['driver'])) |
|
83 | 81 | { |
84 | 82 | $this->_driver = $params['driver']; |
85 | 83 | unset($params['driver']); |
86 | - } |
|
87 | - elseif ($driver = config_item('sess_driver')) |
|
84 | + } elseif ($driver = config_item('sess_driver')) |
|
88 | 85 | { |
89 | 86 | $this->_driver = $driver; |
90 | 87 | } |
@@ -105,8 +102,7 @@ discard block |
||
105 | 102 | if (is_php('5.4')) |
106 | 103 | { |
107 | 104 | session_set_save_handler($class, TRUE); |
108 | - } |
|
109 | - else |
|
105 | + } else |
|
110 | 106 | { |
111 | 107 | session_set_save_handler( |
112 | 108 | array($class, 'open'), |
@@ -119,8 +115,7 @@ discard block |
||
119 | 115 | |
120 | 116 | register_shutdown_function('session_write_close'); |
121 | 117 | } |
122 | - } |
|
123 | - else |
|
118 | + } else |
|
124 | 119 | { |
125 | 120 | log_message('error', "Session: Driver '".$this->_driver."' doesn't implement SessionHandlerInterface. Aborting."); |
126 | 121 | return; |
@@ -147,8 +142,7 @@ discard block |
||
147 | 142 | if ( ! isset($_SESSION['__ci_last_regenerate'])) |
148 | 143 | { |
149 | 144 | $_SESSION['__ci_last_regenerate'] = time(); |
150 | - } |
|
151 | - elseif ($_SESSION['__ci_last_regenerate'] < (time() - $regenerate_time)) |
|
145 | + } elseif ($_SESSION['__ci_last_regenerate'] < (time() - $regenerate_time)) |
|
152 | 146 | { |
153 | 147 | $this->sess_regenerate((bool) config_item('sess_regenerate_destroy')); |
154 | 148 | } |
@@ -237,8 +231,7 @@ discard block |
||
237 | 231 | if (class_exists($prefix.$class, FALSE)) |
238 | 232 | { |
239 | 233 | return $prefix.$class; |
240 | - } |
|
241 | - else |
|
234 | + } else |
|
242 | 235 | { |
243 | 236 | log_message('debug', 'Session: '.$prefix.$class.".php found but it doesn't declare class ".$prefix.$class.'.'); |
244 | 237 | } |
@@ -264,8 +257,7 @@ discard block |
||
264 | 257 | if (isset($params['cookie_lifetime'])) |
265 | 258 | { |
266 | 259 | $params['cookie_lifetime'] = (int) $params['cookie_lifetime']; |
267 | - } |
|
268 | - else |
|
260 | + } else |
|
269 | 261 | { |
270 | 262 | $params['cookie_lifetime'] = ( ! isset($expiration) && config_item('sess_expire_on_close')) |
271 | 263 | ? 0 : (int) $expiration; |
@@ -275,8 +267,7 @@ discard block |
||
275 | 267 | if (empty($params['cookie_name'])) |
276 | 268 | { |
277 | 269 | $params['cookie_name'] = ini_get('session.name'); |
278 | - } |
|
279 | - else |
|
270 | + } else |
|
280 | 271 | { |
281 | 272 | ini_set('session.name', $params['cookie_name']); |
282 | 273 | } |
@@ -296,8 +287,7 @@ discard block |
||
296 | 287 | if (empty($expiration)) |
297 | 288 | { |
298 | 289 | $params['expiration'] = (int) ini_get('session.gc_maxlifetime'); |
299 | - } |
|
300 | - else |
|
290 | + } else |
|
301 | 291 | { |
302 | 292 | $params['expiration'] = (int) $expiration; |
303 | 293 | ini_set('session.gc_maxlifetime', $expiration); |
@@ -473,8 +463,7 @@ discard block |
||
473 | 463 | { |
474 | 464 | $k = $v; |
475 | 465 | $v = $ttl; |
476 | - } |
|
477 | - else |
|
466 | + } else |
|
478 | 467 | { |
479 | 468 | $v += time(); |
480 | 469 | } |
@@ -572,8 +561,7 @@ discard block |
||
572 | 561 | if (isset($_SESSION[$key])) |
573 | 562 | { |
574 | 563 | return $_SESSION[$key]; |
575 | - } |
|
576 | - elseif ($key === 'session_id') |
|
564 | + } elseif ($key === 'session_id') |
|
577 | 565 | { |
578 | 566 | return session_id(); |
579 | 567 | } |
@@ -654,8 +642,7 @@ discard block |
||
654 | 642 | if (isset($key)) |
655 | 643 | { |
656 | 644 | return isset($_SESSION[$key]) ? $_SESSION[$key] : NULL; |
657 | - } |
|
658 | - elseif (empty($_SESSION)) |
|
645 | + } elseif (empty($_SESSION)) |
|
659 | 646 | { |
660 | 647 | return array(); |
661 | 648 | } |
@@ -711,7 +711,6 @@ discard block |
||
711 | 711 | * |
712 | 712 | * Legacy CI_Session compatibility method |
713 | 713 | * |
714 | - * @param mixed $data Session data key(s) |
|
715 | 714 | * @return void |
716 | 715 | */ |
717 | 716 | public function unset_userdata($key) |
@@ -879,7 +878,6 @@ discard block |
||
879 | 878 | * |
880 | 879 | * Legacy CI_Session compatibility method |
881 | 880 | * |
882 | - * @param mixed $data Session data key(s) |
|
883 | 881 | * @return void |
884 | 882 | */ |
885 | 883 | public function unset_tempdata($key) |
@@ -84,7 +84,7 @@ |
||
84 | 84 | */ |
85 | 85 | public function __construct(&$params) |
86 | 86 | { |
87 | - $this->_config =& $params; |
|
87 | + $this->_config = & $params; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // ------------------------------------------------------------------------ |
@@ -266,8 +266,7 @@ |
||
266 | 266 | if ($reduce_linebreaks === TRUE) |
267 | 267 | { |
268 | 268 | $table['#<p>\n*</p>#'] = ''; |
269 | - } |
|
270 | - else |
|
269 | + } else |
|
271 | 270 | { |
272 | 271 | // If we have empty paragraph tags we add a non-breaking space |
273 | 272 | // otherwise most browsers won't treat them as true paragraphs |
@@ -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 |
@@ -88,12 +88,10 @@ discard block |
||
88 | 88 | if ( ! $this->_db instanceof CI_DB_query_builder) |
89 | 89 | { |
90 | 90 | throw new Exception('Query Builder not enabled for the configured database. Aborting.'); |
91 | - } |
|
92 | - elseif ($this->_db->pconnect) |
|
91 | + } elseif ($this->_db->pconnect) |
|
93 | 92 | { |
94 | 93 | throw new Exception('Configured database connection is persistent. Aborting.'); |
95 | - } |
|
96 | - elseif ($this->_db->cache_on) |
|
94 | + } elseif ($this->_db->cache_on) |
|
97 | 95 | { |
98 | 96 | throw new Exception('Configured database connection has cache enabled. Aborting.'); |
99 | 97 | } |
@@ -102,8 +100,7 @@ discard block |
||
102 | 100 | if (strpos($db_driver, 'mysql') !== FALSE) |
103 | 101 | { |
104 | 102 | $this->_platform = 'mysql'; |
105 | - } |
|
106 | - elseif (in_array($db_driver, array('postgre', 'pdo_pgsql'), TRUE)) |
|
103 | + } elseif (in_array($db_driver, array('postgre', 'pdo_pgsql'), TRUE)) |
|
107 | 104 | { |
108 | 105 | $this->_platform = 'postgre'; |
109 | 106 | } |
@@ -206,8 +203,7 @@ discard block |
||
206 | 203 | |
207 | 204 | $this->_row_exists = FALSE; |
208 | 205 | $this->_session_id = $session_id; |
209 | - } |
|
210 | - elseif ($this->_lock === FALSE) |
|
206 | + } elseif ($this->_lock === FALSE) |
|
211 | 207 | { |
212 | 208 | return FALSE; |
213 | 209 | } |
@@ -334,8 +330,7 @@ discard block |
||
334 | 330 | } |
335 | 331 | |
336 | 332 | return FALSE; |
337 | - } |
|
338 | - elseif ($this->_platform === 'postgre') |
|
333 | + } elseif ($this->_platform === 'postgre') |
|
339 | 334 | { |
340 | 335 | $arg = "hashtext('".$session_id."')".($this->_config['match_ip'] ? ", hashtext('".$_SERVER['REMOTE_ADDR']."')" : ''); |
341 | 336 | if ($this->_db->simple_query('SELECT pg_advisory_lock('.$arg.')')) |
@@ -375,8 +370,7 @@ discard block |
||
375 | 370 | } |
376 | 371 | |
377 | 372 | return FALSE; |
378 | - } |
|
379 | - elseif ($this->_platform === 'postgre') |
|
373 | + } elseif ($this->_platform === 'postgre') |
|
380 | 374 | { |
381 | 375 | if ($this->_db->simple_query('SELECT pg_advisory_unlock('.$this->_lock.')')) |
382 | 376 | { |
@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $this->_config['save_path'] = rtrim($this->_config['save_path'], '/\\'); |
94 | 94 | ini_set('session.save_path', $this->_config['save_path']); |
95 | - } |
|
96 | - else |
|
95 | + } else |
|
97 | 96 | { |
98 | 97 | $this->_config['save_path'] = rtrim(ini_get('session.save_path'), '/\\'); |
99 | 98 | } |
@@ -118,8 +117,7 @@ discard block |
||
118 | 117 | { |
119 | 118 | throw new Exception("Session: Configured save path '".$this->_config['save_path']."' is not a directory, doesn't exist or cannot be created."); |
120 | 119 | } |
121 | - } |
|
122 | - elseif ( ! is_writable($save_path)) |
|
120 | + } elseif ( ! is_writable($save_path)) |
|
123 | 121 | { |
124 | 122 | throw new Exception("Session: Configured save path '".$this->_config['save_path']."' is not writable by the PHP process."); |
125 | 123 | } |
@@ -158,8 +156,7 @@ discard block |
||
158 | 156 | log_message('error', "Session: File '".$this->_file_path.$session_id."' doesn't exist and cannot be created."); |
159 | 157 | return FALSE; |
160 | 158 | } |
161 | - } |
|
162 | - elseif (($this->_file_handle = fopen($this->_file_path.$session_id, 'r+b')) === FALSE) |
|
159 | + } elseif (($this->_file_handle = fopen($this->_file_path.$session_id, 'r+b')) === FALSE) |
|
163 | 160 | { |
164 | 161 | log_message('error', "Session: Unable to open file '".$this->_file_path.$session_id."'."); |
165 | 162 | return FALSE; |
@@ -188,8 +185,7 @@ discard block |
||
188 | 185 | elseif ($this->_file_handler === FALSE) |
189 | 186 | { |
190 | 187 | return FALSE; |
191 | - } |
|
192 | - else |
|
188 | + } else |
|
193 | 189 | { |
194 | 190 | rewind($this->_file_handle); |
195 | 191 | } |
@@ -232,8 +228,7 @@ discard block |
||
232 | 228 | if ( ! is_resource($this->_file_handle)) |
233 | 229 | { |
234 | 230 | return FALSE; |
235 | - } |
|
236 | - elseif ($this->_fingerprint === md5($session_data)) |
|
231 | + } elseif ($this->_fingerprint === md5($session_data)) |
|
237 | 232 | { |
238 | 233 | return ($this->_file_new) |
239 | 234 | ? TRUE |
@@ -308,8 +303,7 @@ discard block |
||
308 | 303 | return file_exists($this->_file_path.$session_id) |
309 | 304 | ? (unlink($this->_file_path.$session_id) && $this->_cookie_destroy()) |
310 | 305 | : TRUE; |
311 | - } |
|
312 | - elseif ($this->_file_path !== NULL) |
|
306 | + } elseif ($this->_file_path !== NULL) |
|
313 | 307 | { |
314 | 308 | clearstatcache(); |
315 | 309 | return file_exists($this->_file_path.$session_id) |