@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() |
36 | 36 | { |
37 | - $CI =& get_instance(); |
|
37 | + $CI = & get_instance(); |
|
38 | 38 | $CI->load->helper('file'); |
39 | 39 | |
40 | 40 | $path = $CI->config->item('cache_path'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $data = read_file($this->_cache_path.$id); |
61 | 61 | $data = unserialize($data); |
62 | 62 | |
63 | - if (time() > $data['time'] + $data['ttl']) |
|
63 | + if (time() > $data['time'] + $data['ttl']) |
|
64 | 64 | { |
65 | 65 | unlink($this->_cache_path.$id); |
66 | 66 | return FALSE; |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | $_doctypes = array( |
4 | 6 | 'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | class CI_Cache_memcached extends CI_Driver { |
29 | 29 | |
30 | - private $_memcached; // Holds the memcached object |
|
30 | + private $_memcached; // Holds the memcached object |
|
31 | 31 | |
32 | - protected $_memcache_conf = array( |
|
32 | + protected $_memcache_conf = array( |
|
33 | 33 | 'default' => array( |
34 | 34 | 'default_host' => '127.0.0.1', |
35 | 35 | 'default_port' => 11211, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | private function _setup_memcached() |
149 | 149 | { |
150 | 150 | // Try to load memcached server info from the config file. |
151 | - $CI =& get_instance(); |
|
151 | + $CI = & get_instance(); |
|
152 | 152 | if ($CI->config->load('memcached', TRUE, TRUE)) |
153 | 153 | { |
154 | 154 | if (is_array($CI->config->config['memcached'])) |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -67,8 +69,7 @@ discard block |
||
67 | 69 | if (get_class($this->_memcached) == 'Memcached') |
68 | 70 | { |
69 | 71 | return $this->_memcached->set($id, array($data, time(), $ttl), $ttl); |
70 | - } |
|
71 | - else if (get_class($this->_memcached) == 'Memcache') |
|
72 | + } else if (get_class($this->_memcached) == 'Memcache') |
|
72 | 73 | { |
73 | 74 | return $this->_memcached->set($id, array($data, time(), $ttl), 0, $ttl); |
74 | 75 | } |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | class CI_Log { |
28 | 28 | |
29 | 29 | protected $_log_path; |
30 | - protected $_threshold = 1; |
|
31 | - protected $_date_fmt = 'Y-m-d H:i:s'; |
|
32 | - protected $_enabled = TRUE; |
|
33 | - protected $_levels = array('ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); |
|
30 | + protected $_threshold = 1; |
|
31 | + protected $_date_fmt = 'Y-m-d H:i:s'; |
|
32 | + protected $_enabled = TRUE; |
|
33 | + protected $_levels = array('ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Constructor |
37 | 37 | */ |
38 | 38 | public function __construct() |
39 | 39 | { |
40 | - $config =& get_config(); |
|
40 | + $config = & get_config(); |
|
41 | 41 | |
42 | 42 | $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/'; |
43 | 43 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | return FALSE; |
97 | 97 | } |
98 | 98 | |
99 | - $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n"; |
|
99 | + $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt).' --> '.$msg."\n"; |
|
100 | 100 | |
101 | 101 | flock($fp, LOCK_EX); |
102 | 102 | fwrite($fp, $message); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -10,260 +10,260 @@ |
||
10 | 10 | |
11 | 11 | |
12 | 12 | |
13 | - $this->page++; |
|
14 | - if(!isset($this->pages[$this->page])) // solves the problem of overwriting a page if it already exists |
|
15 | - $this->pages[$this->page] = ''; |
|
16 | - $this->state =2; |
|
17 | - $this->x = $this->lMargin; |
|
18 | - $this->y = $this->tMargin; |
|
19 | - $this->FontFamily = ''; |
|
20 | - // Check page size and orientation |
|
21 | - if($orientation=='') |
|
22 | - $orientation = $this->DefOrientation; |
|
23 | - else |
|
24 | - $orientation = strtoupper($orientation[0]); |
|
25 | - if($size=='') |
|
26 | - $size = $this->DefPageSize; |
|
27 | - else |
|
28 | - $size = $this->_getpagesize($size); |
|
29 | - if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
|
30 | - { |
|
31 | - // New size or orientation |
|
32 | - if($orientation=='P') |
|
33 | - { |
|
34 | - $this->w = $size[0]; |
|
35 | - $this->h = $size[1]; |
|
36 | - } |
|
37 | - else |
|
38 | - { |
|
39 | - $this->w = $size[1]; |
|
40 | - $this->h = $size[0]; |
|
41 | - } |
|
42 | - $this->wPt = $this->w*$this->k; |
|
43 | - $this->hPt = $this->h*$this->k; |
|
44 | - $this->PageBreakTrigger = $this->h-$this->bMargin; |
|
45 | - $this->CurOrientation = $orientation; |
|
46 | - $this->CurPageSize = $size; |
|
47 | - } |
|
48 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
49 | - $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
13 | + $this->page++; |
|
14 | + if(!isset($this->pages[$this->page])) // solves the problem of overwriting a page if it already exists |
|
15 | + $this->pages[$this->page] = ''; |
|
16 | + $this->state =2; |
|
17 | + $this->x = $this->lMargin; |
|
18 | + $this->y = $this->tMargin; |
|
19 | + $this->FontFamily = ''; |
|
20 | + // Check page size and orientation |
|
21 | + if($orientation=='') |
|
22 | + $orientation = $this->DefOrientation; |
|
23 | + else |
|
24 | + $orientation = strtoupper($orientation[0]); |
|
25 | + if($size=='') |
|
26 | + $size = $this->DefPageSize; |
|
27 | + else |
|
28 | + $size = $this->_getpagesize($size); |
|
29 | + if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
|
30 | + { |
|
31 | + // New size or orientation |
|
32 | + if($orientation=='P') |
|
33 | + { |
|
34 | + $this->w = $size[0]; |
|
35 | + $this->h = $size[1]; |
|
36 | + } |
|
37 | + else |
|
38 | + { |
|
39 | + $this->w = $size[1]; |
|
40 | + $this->h = $size[0]; |
|
41 | + } |
|
42 | + $this->wPt = $this->w*$this->k; |
|
43 | + $this->hPt = $this->h*$this->k; |
|
44 | + $this->PageBreakTrigger = $this->h-$this->bMargin; |
|
45 | + $this->CurOrientation = $orientation; |
|
46 | + $this->CurPageSize = $size; |
|
47 | + } |
|
48 | + if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
49 | + $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | function Footer() { |
53 | - // Check if Footer for this page already exists (do the same for Header()) |
|
54 | - if(!isset($this->footerset[$this->page])) { |
|
55 | - $this->SetY(-15); |
|
56 | - // Page number |
|
57 | - $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
|
58 | - // set footerset |
|
59 | - $this->footerset[$this->page] = true; |
|
60 | - } |
|
53 | + // Check if Footer for this page already exists (do the same for Header()) |
|
54 | + if(!isset($this->footerset[$this->page])) { |
|
55 | + $this->SetY(-15); |
|
56 | + // Page number |
|
57 | + $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
|
58 | + // set footerset |
|
59 | + $this->footerset[$this->page] = true; |
|
60 | + } |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | function morepagestable($datas, $lineheight=8) { |
64 | - // some things to set and 'remember' |
|
65 | - $l = $this->lMargin; |
|
66 | - $startheight = $h = $this->GetY(); |
|
67 | - $startpage = $currpage = $maxpage = $this->page; |
|
64 | + // some things to set and 'remember' |
|
65 | + $l = $this->lMargin; |
|
66 | + $startheight = $h = $this->GetY(); |
|
67 | + $startpage = $currpage = $maxpage = $this->page; |
|
68 | 68 | |
69 | - // calculate the whole width |
|
70 | - $fullwidth = 0; |
|
71 | - foreach($this->tablewidths AS $width) { |
|
72 | - $fullwidth += $width; |
|
73 | - } |
|
69 | + // calculate the whole width |
|
70 | + $fullwidth = 0; |
|
71 | + foreach($this->tablewidths AS $width) { |
|
72 | + $fullwidth += $width; |
|
73 | + } |
|
74 | 74 | |
75 | - // Now let's start to write the table |
|
76 | - foreach($datas AS $row => $data) { |
|
77 | - $this->page = $currpage; |
|
78 | - // write the horizontal borders |
|
75 | + // Now let's start to write the table |
|
76 | + foreach($datas AS $row => $data) { |
|
77 | + $this->page = $currpage; |
|
78 | + // write the horizontal borders |
|
79 | 79 | |
80 | - // write the content and remember the height of the highest col |
|
81 | - foreach($data AS $col => $txt) { |
|
82 | - $this->page = $currpage; |
|
83 | - $this->SetXY($l,$h); |
|
80 | + // write the content and remember the height of the highest col |
|
81 | + foreach($data AS $col => $txt) { |
|
82 | + $this->page = $currpage; |
|
83 | + $this->SetXY($l,$h); |
|
84 | 84 | |
85 | - if($col == 5) |
|
86 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
87 | - else |
|
88 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
89 | - $l += $this->tablewidths[$col]; |
|
85 | + if($col == 5) |
|
86 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
87 | + else |
|
88 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
89 | + $l += $this->tablewidths[$col]; |
|
90 | 90 | |
91 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
92 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
93 | - if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
94 | - $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
|
95 | - } |
|
96 | - if($this->page > $maxpage) |
|
97 | - $maxpage = $this->page; |
|
98 | - } |
|
91 | + if(!isset($tmpheight[$row.'-'.$this->page])) |
|
92 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
93 | + if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
94 | + $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
|
95 | + } |
|
96 | + if($this->page > $maxpage) |
|
97 | + $maxpage = $this->page; |
|
98 | + } |
|
99 | 99 | |
100 | - // get the height we were in the last used page |
|
101 | - $h = $tmpheight[$row.'-'.$maxpage]; |
|
102 | - // set the "pointer" to the left margin |
|
103 | - $l = $this->lMargin; |
|
104 | - // set the $currpage to the last page |
|
105 | - $currpage = $maxpage; |
|
106 | - } |
|
107 | - // draw the borders |
|
108 | - // we start adding a horizontal line on the last page |
|
109 | - $this->page = $maxpage; |
|
110 | - $this->Line($l,$h,$fullwidth+$l,$h); |
|
111 | - // now we start at the top of the document and walk down |
|
112 | - for($i = $startpage; $i <= $maxpage; $i++) { |
|
113 | - $this->page = $i; |
|
114 | - $l = $this->lMargin; |
|
115 | - $t = ($i == $startpage) ? $startheight : $this->tMargin; |
|
116 | - $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
117 | - $this->Line($l,$t,$l,$lh); |
|
118 | - foreach($this->tablewidths AS $width) { |
|
119 | - $l += $width; |
|
120 | - $this->Line($l,$t,$l,$lh); |
|
121 | - } |
|
122 | - } |
|
123 | - // set it to the last page, if not it'll cause some problems |
|
124 | - $this->page = $maxpage; |
|
100 | + // get the height we were in the last used page |
|
101 | + $h = $tmpheight[$row.'-'.$maxpage]; |
|
102 | + // set the "pointer" to the left margin |
|
103 | + $l = $this->lMargin; |
|
104 | + // set the $currpage to the last page |
|
105 | + $currpage = $maxpage; |
|
106 | + } |
|
107 | + // draw the borders |
|
108 | + // we start adding a horizontal line on the last page |
|
109 | + $this->page = $maxpage; |
|
110 | + $this->Line($l,$h,$fullwidth+$l,$h); |
|
111 | + // now we start at the top of the document and walk down |
|
112 | + for($i = $startpage; $i <= $maxpage; $i++) { |
|
113 | + $this->page = $i; |
|
114 | + $l = $this->lMargin; |
|
115 | + $t = ($i == $startpage) ? $startheight : $this->tMargin; |
|
116 | + $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
117 | + $this->Line($l,$t,$l,$lh); |
|
118 | + foreach($this->tablewidths AS $width) { |
|
119 | + $l += $width; |
|
120 | + $this->Line($l,$t,$l,$lh); |
|
121 | + } |
|
122 | + } |
|
123 | + // set it to the last page, if not it'll cause some problems |
|
124 | + $this->page = $maxpage; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | 129 | function table_total($datas, $lineheight=8) { |
130 | - // some things to set and 'remember' |
|
131 | - $l = $this->lMargin; |
|
132 | - $startheight = $h = $this->GetY(); |
|
133 | - $startpage = $currpage = $maxpage = $this->page; |
|
130 | + // some things to set and 'remember' |
|
131 | + $l = $this->lMargin; |
|
132 | + $startheight = $h = $this->GetY(); |
|
133 | + $startpage = $currpage = $maxpage = $this->page; |
|
134 | 134 | |
135 | - // calculate the whole width |
|
136 | - $fullwidth = 0; |
|
137 | - foreach($this->tablewidths AS $width) { |
|
138 | - $fullwidth += $width; |
|
139 | - } |
|
135 | + // calculate the whole width |
|
136 | + $fullwidth = 0; |
|
137 | + foreach($this->tablewidths AS $width) { |
|
138 | + $fullwidth += $width; |
|
139 | + } |
|
140 | 140 | |
141 | - // Now let's start to write the table |
|
142 | - foreach($datas AS $row => $data) { |
|
143 | - $this->page = $currpage; |
|
144 | - // write the horizontal borders |
|
141 | + // Now let's start to write the table |
|
142 | + foreach($datas AS $row => $data) { |
|
143 | + $this->page = $currpage; |
|
144 | + // write the horizontal borders |
|
145 | 145 | if($data != "") |
146 | - $this->Line(100,$h,200,$h); |
|
147 | - // write the content and remember the height of the highest col |
|
148 | - foreach($data AS $col => $txt) { |
|
149 | - $this->page = $currpage; |
|
150 | - $this->SetXY($l,$h); |
|
146 | + $this->Line(100,$h,200,$h); |
|
147 | + // write the content and remember the height of the highest col |
|
148 | + foreach($data AS $col => $txt) { |
|
149 | + $this->page = $currpage; |
|
150 | + $this->SetXY($l,$h); |
|
151 | 151 | |
152 | - if($col == 3) |
|
153 | - $this->SetFont('Arial', 'B', 8); |
|
154 | - else |
|
155 | - $this->SetFont('Arial', '', 8); |
|
156 | - if($col == 5) |
|
157 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
158 | - else |
|
159 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
160 | - $l += $this->tablewidths[$col]; |
|
152 | + if($col == 3) |
|
153 | + $this->SetFont('Arial', 'B', 8); |
|
154 | + else |
|
155 | + $this->SetFont('Arial', '', 8); |
|
156 | + if($col == 5) |
|
157 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
158 | + else |
|
159 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
160 | + $l += $this->tablewidths[$col]; |
|
161 | 161 | |
162 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
163 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
164 | - if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
165 | - $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
|
166 | - } |
|
167 | - if($this->page > $maxpage) |
|
168 | - $maxpage = $this->page; |
|
169 | - } |
|
162 | + if(!isset($tmpheight[$row.'-'.$this->page])) |
|
163 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
164 | + if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
165 | + $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
|
166 | + } |
|
167 | + if($this->page > $maxpage) |
|
168 | + $maxpage = $this->page; |
|
169 | + } |
|
170 | 170 | |
171 | - // get the height we were in the last used page |
|
172 | - $h = $tmpheight[$row.'-'.$maxpage]; |
|
173 | - // set the "pointer" to the left margin |
|
174 | - $l = $this->lMargin; |
|
175 | - // set the $currpage to the last page |
|
176 | - $currpage = $maxpage; |
|
177 | - } |
|
178 | - // draw the borders |
|
179 | - // we start adding a horizontal line on the last page |
|
180 | - $this->page = $maxpage; |
|
171 | + // get the height we were in the last used page |
|
172 | + $h = $tmpheight[$row.'-'.$maxpage]; |
|
173 | + // set the "pointer" to the left margin |
|
174 | + $l = $this->lMargin; |
|
175 | + // set the $currpage to the last page |
|
176 | + $currpage = $maxpage; |
|
177 | + } |
|
178 | + // draw the borders |
|
179 | + // we start adding a horizontal line on the last page |
|
180 | + $this->page = $maxpage; |
|
181 | 181 | |
182 | - $this->Line(100,$h,200,$h); |
|
182 | + $this->Line(100,$h,200,$h); |
|
183 | 183 | |
184 | - // now we start at the top of the document and walk down |
|
185 | - for($i = $startpage; $i <= $maxpage; $i++) { |
|
186 | - $this->page = $i; |
|
187 | - $l = $this->lMargin; |
|
188 | - $t = ($i == $startpage) ? $startheight : $this->tMargin; |
|
189 | - $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
184 | + // now we start at the top of the document and walk down |
|
185 | + for($i = $startpage; $i <= $maxpage; $i++) { |
|
186 | + $this->page = $i; |
|
187 | + $l = $this->lMargin; |
|
188 | + $t = ($i == $startpage) ? $startheight : $this->tMargin; |
|
189 | + $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
190 | 190 | |
191 | - foreach($this->tablewidths AS $width) { |
|
192 | - $l += $width; |
|
193 | - if($width != '30') |
|
194 | - { |
|
195 | - $this->Line(100,$t,100,$lh); |
|
196 | - $this->Line($l,$t,$l,$lh); |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - // set it to the last page, if not it'll cause some problems |
|
201 | - $this->page = $maxpage; |
|
191 | + foreach($this->tablewidths AS $width) { |
|
192 | + $l += $width; |
|
193 | + if($width != '30') |
|
194 | + { |
|
195 | + $this->Line(100,$t,100,$lh); |
|
196 | + $this->Line($l,$t,$l,$lh); |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + // set it to the last page, if not it'll cause some problems |
|
201 | + $this->page = $maxpage; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | 205 | function export_pdf($datas, $lineheight=8) { |
206 | - // some things to set and 'remember' |
|
207 | - $l = $this->lMargin; |
|
208 | - $startheight = $h = $this->GetY(); |
|
209 | - $startpage = $currpage = $maxpage = $this->page; |
|
206 | + // some things to set and 'remember' |
|
207 | + $l = $this->lMargin; |
|
208 | + $startheight = $h = $this->GetY(); |
|
209 | + $startpage = $currpage = $maxpage = $this->page; |
|
210 | 210 | |
211 | - // calculate the whole width |
|
212 | - $fullwidth = 0; |
|
213 | - foreach($this->tablewidths AS $width) { |
|
214 | - $fullwidth += $width; |
|
215 | - } |
|
211 | + // calculate the whole width |
|
212 | + $fullwidth = 0; |
|
213 | + foreach($this->tablewidths AS $width) { |
|
214 | + $fullwidth += $width; |
|
215 | + } |
|
216 | 216 | |
217 | - // Now let's start to write the table |
|
218 | - foreach($datas AS $row => $data) { |
|
219 | - $this->page = $currpage; |
|
220 | - // write the horizontal borders |
|
217 | + // Now let's start to write the table |
|
218 | + foreach($datas AS $row => $data) { |
|
219 | + $this->page = $currpage; |
|
220 | + // write the horizontal borders |
|
221 | 221 | $this->Line($l,$h,$fullwidth+$l,$h); |
222 | - // write the content and remember the height of the highest col |
|
223 | - foreach($data AS $col => $txt) { |
|
224 | - $this->page = $currpage; |
|
225 | - $this->SetXY($l,$h); |
|
222 | + // write the content and remember the height of the highest col |
|
223 | + foreach($data AS $col => $txt) { |
|
224 | + $this->page = $currpage; |
|
225 | + $this->SetXY($l,$h); |
|
226 | 226 | |
227 | - if($col == 5) |
|
228 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
229 | - else |
|
230 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
231 | - $l += $this->tablewidths[$col]; |
|
227 | + if($col == 5) |
|
228 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
229 | + else |
|
230 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
231 | + $l += $this->tablewidths[$col]; |
|
232 | 232 | |
233 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
234 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
235 | - if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
236 | - $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
|
237 | - } |
|
238 | - if($this->page > $maxpage) |
|
239 | - $maxpage = $this->page; |
|
240 | - } |
|
233 | + if(!isset($tmpheight[$row.'-'.$this->page])) |
|
234 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
235 | + if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
236 | + $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
|
237 | + } |
|
238 | + if($this->page > $maxpage) |
|
239 | + $maxpage = $this->page; |
|
240 | + } |
|
241 | 241 | |
242 | - // get the height we were in the last used page |
|
243 | - $h = $tmpheight[$row.'-'.$maxpage]; |
|
244 | - // set the "pointer" to the left margin |
|
245 | - $l = $this->lMargin; |
|
246 | - // set the $currpage to the last page |
|
247 | - $currpage = $maxpage; |
|
248 | - } |
|
249 | - // draw the borders |
|
250 | - // we start adding a horizontal line on the last page |
|
251 | - $this->page = $maxpage; |
|
252 | - $this->Line($l,$h,$fullwidth+$l,$h); |
|
253 | - // now we start at the top of the document and walk down |
|
254 | - for($i = $startpage; $i <= $maxpage; $i++) { |
|
255 | - $this->page = $i; |
|
256 | - $l = $this->lMargin; |
|
257 | - $t = ($i == $startpage) ? $startheight : $this->tMargin; |
|
258 | - $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
259 | - $this->Line($l,$t,$l,$lh); |
|
260 | - foreach($this->tablewidths AS $width) { |
|
261 | - $l += $width; |
|
262 | - $this->Line($l,$t,$l,$lh); |
|
263 | - } |
|
264 | - } |
|
265 | - // set it to the last page, if not it'll cause some problems |
|
266 | - $this->page = $maxpage; |
|
242 | + // get the height we were in the last used page |
|
243 | + $h = $tmpheight[$row.'-'.$maxpage]; |
|
244 | + // set the "pointer" to the left margin |
|
245 | + $l = $this->lMargin; |
|
246 | + // set the $currpage to the last page |
|
247 | + $currpage = $maxpage; |
|
248 | + } |
|
249 | + // draw the borders |
|
250 | + // we start adding a horizontal line on the last page |
|
251 | + $this->page = $maxpage; |
|
252 | + $this->Line($l,$h,$fullwidth+$l,$h); |
|
253 | + // now we start at the top of the document and walk down |
|
254 | + for($i = $startpage; $i <= $maxpage; $i++) { |
|
255 | + $this->page = $i; |
|
256 | + $l = $this->lMargin; |
|
257 | + $t = ($i == $startpage) ? $startheight : $this->tMargin; |
|
258 | + $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
259 | + $this->Line($l,$t,$l,$lh); |
|
260 | + foreach($this->tablewidths AS $width) { |
|
261 | + $l += $width; |
|
262 | + $this->Line($l,$t,$l,$lh); |
|
263 | + } |
|
264 | + } |
|
265 | + // set it to the last page, if not it'll cause some problems |
|
266 | + $this->page = $maxpage; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | |
12 | 12 | |
13 | 13 | $this->page++; |
14 | - if(!isset($this->pages[$this->page])) // solves the problem of overwriting a page if it already exists |
|
14 | + if ( ! isset($this->pages[$this->page])) // solves the problem of overwriting a page if it already exists |
|
15 | 15 | $this->pages[$this->page] = ''; |
16 | - $this->state =2; |
|
16 | + $this->state = 2; |
|
17 | 17 | $this->x = $this->lMargin; |
18 | 18 | $this->y = $this->tMargin; |
19 | 19 | $this->FontFamily = ''; |
20 | 20 | // Check page size and orientation |
21 | - if($orientation=='') |
|
21 | + if ($orientation == '') |
|
22 | 22 | $orientation = $this->DefOrientation; |
23 | 23 | else |
24 | 24 | $orientation = strtoupper($orientation[0]); |
25 | - if($size=='') |
|
25 | + if ($size == '') |
|
26 | 26 | $size = $this->DefPageSize; |
27 | 27 | else |
28 | 28 | $size = $this->_getpagesize($size); |
29 | - if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
|
29 | + if ($orientation != $this->CurOrientation || $size[0] != $this->CurPageSize[0] || $size[1] != $this->CurPageSize[1]) |
|
30 | 30 | { |
31 | 31 | // New size or orientation |
32 | - if($orientation=='P') |
|
32 | + if ($orientation == 'P') |
|
33 | 33 | { |
34 | 34 | $this->w = $size[0]; |
35 | 35 | $this->h = $size[1]; |
@@ -39,28 +39,28 @@ discard block |
||
39 | 39 | $this->w = $size[1]; |
40 | 40 | $this->h = $size[0]; |
41 | 41 | } |
42 | - $this->wPt = $this->w*$this->k; |
|
43 | - $this->hPt = $this->h*$this->k; |
|
44 | - $this->PageBreakTrigger = $this->h-$this->bMargin; |
|
42 | + $this->wPt = $this->w * $this->k; |
|
43 | + $this->hPt = $this->h * $this->k; |
|
44 | + $this->PageBreakTrigger = $this->h - $this->bMargin; |
|
45 | 45 | $this->CurOrientation = $orientation; |
46 | 46 | $this->CurPageSize = $size; |
47 | 47 | } |
48 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
48 | + if ($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) |
|
49 | 49 | $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
50 | 50 | } |
51 | 51 | |
52 | 52 | function Footer() { |
53 | 53 | // Check if Footer for this page already exists (do the same for Header()) |
54 | - if(!isset($this->footerset[$this->page])) { |
|
54 | + if ( ! isset($this->footerset[$this->page])) { |
|
55 | 55 | $this->SetY(-15); |
56 | 56 | // Page number |
57 | - $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
|
57 | + $this->Cell(0, 10, 'Page '.$this->PageNo().'/{nb}', 0, 0, 'C'); |
|
58 | 58 | // set footerset |
59 | 59 | $this->footerset[$this->page] = true; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | -function morepagestable($datas, $lineheight=8) { |
|
63 | +function morepagestable($datas, $lineheight = 8) { |
|
64 | 64 | // some things to set and 'remember' |
65 | 65 | $l = $this->lMargin; |
66 | 66 | $startheight = $h = $this->GetY(); |
@@ -68,32 +68,32 @@ discard block |
||
68 | 68 | |
69 | 69 | // calculate the whole width |
70 | 70 | $fullwidth = 0; |
71 | - foreach($this->tablewidths AS $width) { |
|
71 | + foreach ($this->tablewidths AS $width) { |
|
72 | 72 | $fullwidth += $width; |
73 | 73 | } |
74 | 74 | |
75 | 75 | // Now let's start to write the table |
76 | - foreach($datas AS $row => $data) { |
|
76 | + foreach ($datas AS $row => $data) { |
|
77 | 77 | $this->page = $currpage; |
78 | 78 | // write the horizontal borders |
79 | 79 | |
80 | 80 | // write the content and remember the height of the highest col |
81 | - foreach($data AS $col => $txt) { |
|
81 | + foreach ($data AS $col => $txt) { |
|
82 | 82 | $this->page = $currpage; |
83 | - $this->SetXY($l,$h); |
|
83 | + $this->SetXY($l, $h); |
|
84 | 84 | |
85 | - if($col == 5) |
|
86 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
85 | + if ($col == 5) |
|
86 | + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, "R"); |
|
87 | 87 | else |
88 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
88 | + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt); |
|
89 | 89 | $l += $this->tablewidths[$col]; |
90 | 90 | |
91 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
91 | + if ( ! isset($tmpheight[$row.'-'.$this->page])) |
|
92 | 92 | $tmpheight[$row.'-'.$this->page] = 0; |
93 | - if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
93 | + if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
94 | 94 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
95 | 95 | } |
96 | - if($this->page > $maxpage) |
|
96 | + if ($this->page > $maxpage) |
|
97 | 97 | $maxpage = $this->page; |
98 | 98 | } |
99 | 99 | |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | // draw the borders |
108 | 108 | // we start adding a horizontal line on the last page |
109 | 109 | $this->page = $maxpage; |
110 | - $this->Line($l,$h,$fullwidth+$l,$h); |
|
110 | + $this->Line($l, $h, $fullwidth + $l, $h); |
|
111 | 111 | // now we start at the top of the document and walk down |
112 | - for($i = $startpage; $i <= $maxpage; $i++) { |
|
112 | + for ($i = $startpage; $i <= $maxpage; $i++) { |
|
113 | 113 | $this->page = $i; |
114 | 114 | $l = $this->lMargin; |
115 | 115 | $t = ($i == $startpage) ? $startheight : $this->tMargin; |
116 | - $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
117 | - $this->Line($l,$t,$l,$lh); |
|
118 | - foreach($this->tablewidths AS $width) { |
|
116 | + $lh = ($i == $maxpage) ? $h : $this->h - $this->bMargin; |
|
117 | + $this->Line($l, $t, $l, $lh); |
|
118 | + foreach ($this->tablewidths AS $width) { |
|
119 | 119 | $l += $width; |
120 | - $this->Line($l,$t,$l,$lh); |
|
120 | + $this->Line($l, $t, $l, $lh); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | // set it to the last page, if not it'll cause some problems |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | -function table_total($datas, $lineheight=8) { |
|
129 | +function table_total($datas, $lineheight = 8) { |
|
130 | 130 | // some things to set and 'remember' |
131 | 131 | $l = $this->lMargin; |
132 | 132 | $startheight = $h = $this->GetY(); |
@@ -134,37 +134,37 @@ discard block |
||
134 | 134 | |
135 | 135 | // calculate the whole width |
136 | 136 | $fullwidth = 0; |
137 | - foreach($this->tablewidths AS $width) { |
|
137 | + foreach ($this->tablewidths AS $width) { |
|
138 | 138 | $fullwidth += $width; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Now let's start to write the table |
142 | - foreach($datas AS $row => $data) { |
|
142 | + foreach ($datas AS $row => $data) { |
|
143 | 143 | $this->page = $currpage; |
144 | 144 | // write the horizontal borders |
145 | - if($data != "") |
|
146 | - $this->Line(100,$h,200,$h); |
|
145 | + if ($data != "") |
|
146 | + $this->Line(100, $h, 200, $h); |
|
147 | 147 | // write the content and remember the height of the highest col |
148 | - foreach($data AS $col => $txt) { |
|
148 | + foreach ($data AS $col => $txt) { |
|
149 | 149 | $this->page = $currpage; |
150 | - $this->SetXY($l,$h); |
|
150 | + $this->SetXY($l, $h); |
|
151 | 151 | |
152 | - if($col == 3) |
|
152 | + if ($col == 3) |
|
153 | 153 | $this->SetFont('Arial', 'B', 8); |
154 | 154 | else |
155 | 155 | $this->SetFont('Arial', '', 8); |
156 | - if($col == 5) |
|
157 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
156 | + if ($col == 5) |
|
157 | + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, "R"); |
|
158 | 158 | else |
159 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
159 | + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt); |
|
160 | 160 | $l += $this->tablewidths[$col]; |
161 | 161 | |
162 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
162 | + if ( ! isset($tmpheight[$row.'-'.$this->page])) |
|
163 | 163 | $tmpheight[$row.'-'.$this->page] = 0; |
164 | - if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
164 | + if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
165 | 165 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
166 | 166 | } |
167 | - if($this->page > $maxpage) |
|
167 | + if ($this->page > $maxpage) |
|
168 | 168 | $maxpage = $this->page; |
169 | 169 | } |
170 | 170 | |
@@ -179,21 +179,21 @@ discard block |
||
179 | 179 | // we start adding a horizontal line on the last page |
180 | 180 | $this->page = $maxpage; |
181 | 181 | |
182 | - $this->Line(100,$h,200,$h); |
|
182 | + $this->Line(100, $h, 200, $h); |
|
183 | 183 | |
184 | 184 | // now we start at the top of the document and walk down |
185 | - for($i = $startpage; $i <= $maxpage; $i++) { |
|
185 | + for ($i = $startpage; $i <= $maxpage; $i++) { |
|
186 | 186 | $this->page = $i; |
187 | 187 | $l = $this->lMargin; |
188 | 188 | $t = ($i == $startpage) ? $startheight : $this->tMargin; |
189 | - $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
189 | + $lh = ($i == $maxpage) ? $h : $this->h - $this->bMargin; |
|
190 | 190 | |
191 | - foreach($this->tablewidths AS $width) { |
|
191 | + foreach ($this->tablewidths AS $width) { |
|
192 | 192 | $l += $width; |
193 | - if($width != '30') |
|
193 | + if ($width != '30') |
|
194 | 194 | { |
195 | - $this->Line(100,$t,100,$lh); |
|
196 | - $this->Line($l,$t,$l,$lh); |
|
195 | + $this->Line(100, $t, 100, $lh); |
|
196 | + $this->Line($l, $t, $l, $lh); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | -function export_pdf($datas, $lineheight=8) { |
|
205 | +function export_pdf($datas, $lineheight = 8) { |
|
206 | 206 | // some things to set and 'remember' |
207 | 207 | $l = $this->lMargin; |
208 | 208 | $startheight = $h = $this->GetY(); |
@@ -210,32 +210,32 @@ discard block |
||
210 | 210 | |
211 | 211 | // calculate the whole width |
212 | 212 | $fullwidth = 0; |
213 | - foreach($this->tablewidths AS $width) { |
|
213 | + foreach ($this->tablewidths AS $width) { |
|
214 | 214 | $fullwidth += $width; |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Now let's start to write the table |
218 | - foreach($datas AS $row => $data) { |
|
218 | + foreach ($datas AS $row => $data) { |
|
219 | 219 | $this->page = $currpage; |
220 | 220 | // write the horizontal borders |
221 | - $this->Line($l,$h,$fullwidth+$l,$h); |
|
221 | + $this->Line($l, $h, $fullwidth + $l, $h); |
|
222 | 222 | // write the content and remember the height of the highest col |
223 | - foreach($data AS $col => $txt) { |
|
223 | + foreach ($data AS $col => $txt) { |
|
224 | 224 | $this->page = $currpage; |
225 | - $this->SetXY($l,$h); |
|
225 | + $this->SetXY($l, $h); |
|
226 | 226 | |
227 | - if($col == 5) |
|
228 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
227 | + if ($col == 5) |
|
228 | + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt, 0, "R"); |
|
229 | 229 | else |
230 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
230 | + $this->MultiCell($this->tablewidths[$col], $lineheight, $txt); |
|
231 | 231 | $l += $this->tablewidths[$col]; |
232 | 232 | |
233 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
233 | + if ( ! isset($tmpheight[$row.'-'.$this->page])) |
|
234 | 234 | $tmpheight[$row.'-'.$this->page] = 0; |
235 | - if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
235 | + if ($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
|
236 | 236 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
237 | 237 | } |
238 | - if($this->page > $maxpage) |
|
238 | + if ($this->page > $maxpage) |
|
239 | 239 | $maxpage = $this->page; |
240 | 240 | } |
241 | 241 | |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | // draw the borders |
250 | 250 | // we start adding a horizontal line on the last page |
251 | 251 | $this->page = $maxpage; |
252 | - $this->Line($l,$h,$fullwidth+$l,$h); |
|
252 | + $this->Line($l, $h, $fullwidth + $l, $h); |
|
253 | 253 | // now we start at the top of the document and walk down |
254 | - for($i = $startpage; $i <= $maxpage; $i++) { |
|
254 | + for ($i = $startpage; $i <= $maxpage; $i++) { |
|
255 | 255 | $this->page = $i; |
256 | 256 | $l = $this->lMargin; |
257 | 257 | $t = ($i == $startpage) ? $startheight : $this->tMargin; |
258 | - $lh = ($i == $maxpage) ? $h : $this->h-$this->bMargin; |
|
259 | - $this->Line($l,$t,$l,$lh); |
|
260 | - foreach($this->tablewidths AS $width) { |
|
258 | + $lh = ($i == $maxpage) ? $h : $this->h - $this->bMargin; |
|
259 | + $this->Line($l, $t, $l, $lh); |
|
260 | + foreach ($this->tablewidths AS $width) { |
|
261 | 261 | $l += $width; |
262 | - $this->Line($l,$t,$l,$lh); |
|
262 | + $this->Line($l, $t, $l, $lh); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | // set it to the last page, if not it'll cause some problems |
@@ -11,21 +11,25 @@ discard block |
||
11 | 11 | |
12 | 12 | |
13 | 13 | $this->page++; |
14 | - if(!isset($this->pages[$this->page])) // solves the problem of overwriting a page if it already exists |
|
14 | + if(!isset($this->pages[$this->page])) { |
|
15 | + // solves the problem of overwriting a page if it already exists |
|
15 | 16 | $this->pages[$this->page] = ''; |
17 | + } |
|
16 | 18 | $this->state =2; |
17 | 19 | $this->x = $this->lMargin; |
18 | 20 | $this->y = $this->tMargin; |
19 | 21 | $this->FontFamily = ''; |
20 | 22 | // Check page size and orientation |
21 | - if($orientation=='') |
|
22 | - $orientation = $this->DefOrientation; |
|
23 | - else |
|
24 | - $orientation = strtoupper($orientation[0]); |
|
25 | - if($size=='') |
|
26 | - $size = $this->DefPageSize; |
|
27 | - else |
|
28 | - $size = $this->_getpagesize($size); |
|
23 | + if($orientation=='') { |
|
24 | + $orientation = $this->DefOrientation; |
|
25 | + } else { |
|
26 | + $orientation = strtoupper($orientation[0]); |
|
27 | + } |
|
28 | + if($size=='') { |
|
29 | + $size = $this->DefPageSize; |
|
30 | + } else { |
|
31 | + $size = $this->_getpagesize($size); |
|
32 | + } |
|
29 | 33 | if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
30 | 34 | { |
31 | 35 | // New size or orientation |
@@ -33,8 +37,7 @@ discard block |
||
33 | 37 | { |
34 | 38 | $this->w = $size[0]; |
35 | 39 | $this->h = $size[1]; |
36 | - } |
|
37 | - else |
|
40 | + } else |
|
38 | 41 | { |
39 | 42 | $this->w = $size[1]; |
40 | 43 | $this->h = $size[0]; |
@@ -45,9 +48,10 @@ discard block |
||
45 | 48 | $this->CurOrientation = $orientation; |
46 | 49 | $this->CurPageSize = $size; |
47 | 50 | } |
48 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
49 | - $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
50 | -} |
|
51 | + if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) { |
|
52 | + $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
53 | + } |
|
54 | + } |
|
51 | 55 | |
52 | 56 | function Footer() { |
53 | 57 | // Check if Footer for this page already exists (do the same for Header()) |
@@ -82,19 +86,22 @@ discard block |
||
82 | 86 | $this->page = $currpage; |
83 | 87 | $this->SetXY($l,$h); |
84 | 88 | |
85 | - if($col == 5) |
|
86 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
87 | - else |
|
88 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
89 | + if($col == 5) { |
|
90 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
91 | + } else { |
|
92 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
93 | + } |
|
89 | 94 | $l += $this->tablewidths[$col]; |
90 | 95 | |
91 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
92 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
96 | + if(!isset($tmpheight[$row.'-'.$this->page])) { |
|
97 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
98 | + } |
|
93 | 99 | if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
94 | 100 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
95 | 101 | } |
96 | - if($this->page > $maxpage) |
|
97 | - $maxpage = $this->page; |
|
102 | + if($this->page > $maxpage) { |
|
103 | + $maxpage = $this->page; |
|
104 | + } |
|
98 | 105 | } |
99 | 106 | |
100 | 107 | // get the height we were in the last used page |
@@ -142,30 +149,35 @@ discard block |
||
142 | 149 | foreach($datas AS $row => $data) { |
143 | 150 | $this->page = $currpage; |
144 | 151 | // write the horizontal borders |
145 | - if($data != "") |
|
146 | - $this->Line(100,$h,200,$h); |
|
152 | + if($data != "") { |
|
153 | + $this->Line(100,$h,200,$h); |
|
154 | + } |
|
147 | 155 | // write the content and remember the height of the highest col |
148 | 156 | foreach($data AS $col => $txt) { |
149 | 157 | $this->page = $currpage; |
150 | 158 | $this->SetXY($l,$h); |
151 | 159 | |
152 | - if($col == 3) |
|
153 | - $this->SetFont('Arial', 'B', 8); |
|
154 | - else |
|
155 | - $this->SetFont('Arial', '', 8); |
|
156 | - if($col == 5) |
|
157 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
158 | - else |
|
159 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
160 | + if($col == 3) { |
|
161 | + $this->SetFont('Arial', 'B', 8); |
|
162 | + } else { |
|
163 | + $this->SetFont('Arial', '', 8); |
|
164 | + } |
|
165 | + if($col == 5) { |
|
166 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
167 | + } else { |
|
168 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
169 | + } |
|
160 | 170 | $l += $this->tablewidths[$col]; |
161 | 171 | |
162 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
163 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
172 | + if(!isset($tmpheight[$row.'-'.$this->page])) { |
|
173 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
174 | + } |
|
164 | 175 | if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
165 | 176 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
166 | 177 | } |
167 | - if($this->page > $maxpage) |
|
168 | - $maxpage = $this->page; |
|
178 | + if($this->page > $maxpage) { |
|
179 | + $maxpage = $this->page; |
|
180 | + } |
|
169 | 181 | } |
170 | 182 | |
171 | 183 | // get the height we were in the last used page |
@@ -224,19 +236,22 @@ discard block |
||
224 | 236 | $this->page = $currpage; |
225 | 237 | $this->SetXY($l,$h); |
226 | 238 | |
227 | - if($col == 5) |
|
228 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
229 | - else |
|
230 | - $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
239 | + if($col == 5) { |
|
240 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt,0,"R"); |
|
241 | + } else { |
|
242 | + $this->MultiCell($this->tablewidths[$col],$lineheight,$txt); |
|
243 | + } |
|
231 | 244 | $l += $this->tablewidths[$col]; |
232 | 245 | |
233 | - if(!isset($tmpheight[$row.'-'.$this->page])) |
|
234 | - $tmpheight[$row.'-'.$this->page] = 0; |
|
246 | + if(!isset($tmpheight[$row.'-'.$this->page])) { |
|
247 | + $tmpheight[$row.'-'.$this->page] = 0; |
|
248 | + } |
|
235 | 249 | if($tmpheight[$row.'-'.$this->page] < $this->GetY()) { |
236 | 250 | $tmpheight[$row.'-'.$this->page] = $this->GetY(); |
237 | 251 | } |
238 | - if($this->page > $maxpage) |
|
239 | - $maxpage = $this->page; |
|
252 | + if($this->page > $maxpage) { |
|
253 | + $maxpage = $this->page; |
|
254 | + } |
|
240 | 255 | } |
241 | 256 | |
242 | 257 | // get the height we were in the last used page |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | var $lang; |
33 | 33 | var $local_time; |
34 | 34 | var $template = ''; |
35 | - var $start_day = 'sunday'; |
|
36 | - var $month_type = 'long'; |
|
35 | + var $start_day = 'sunday'; |
|
36 | + var $month_type = 'long'; |
|
37 | 37 | var $day_type = 'abr'; |
38 | - var $show_next_prev = FALSE; |
|
39 | - var $next_prev_url = ''; |
|
38 | + var $show_next_prev = FALSE; |
|
39 | + var $next_prev_url = ''; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Constructor |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function __construct($config = array()) |
47 | 47 | { |
48 | - $this->CI =& get_instance(); |
|
48 | + $this->CI = & get_instance(); |
|
49 | 49 | |
50 | 50 | if ( ! in_array('calendar_lang.php', $this->CI->lang->is_loaded, TRUE)) |
51 | 51 | { |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | $adjusted_date = $this->adjust_date($month, $year); |
117 | 117 | |
118 | - $month = $adjusted_date['month']; |
|
119 | - $year = $adjusted_date['year']; |
|
118 | + $month = $adjusted_date['month']; |
|
119 | + $year = $adjusted_date['year']; |
|
120 | 120 | |
121 | 121 | // Determine the total days in the month |
122 | 122 | $total_days = $this->get_total_days($month, $year); |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | // Set the current month/year/day |
139 | 139 | // We use this to determine the "today" date |
140 | - $cur_year = date("Y", $this->local_time); |
|
141 | - $cur_month = date("m", $this->local_time); |
|
142 | - $cur_day = date("j", $this->local_time); |
|
140 | + $cur_year = date("Y", $this->local_time); |
|
141 | + $cur_month = date("m", $this->local_time); |
|
142 | + $cur_day = date("j", $this->local_time); |
|
143 | 143 | |
144 | 144 | $is_current_month = ($cur_year == $year AND $cur_month == $month) ? TRUE : FALSE; |
145 | 145 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if ($this->show_next_prev == TRUE) |
159 | 159 | { |
160 | 160 | // Add a trailing slash to the URL if needed |
161 | - $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); |
|
161 | + $this->next_prev_url = preg_replace("/(.+?)\/*$/", "\\1/", $this->next_prev_url); |
|
162 | 162 | |
163 | 163 | $adjusted_date = $this->adjust_date($month - 1, $year); |
164 | 164 | $out .= str_replace('{previous_url}', $this->next_prev_url.$adjusted_date['year'].'/'.$adjusted_date['month'], $this->temp['heading_previous_cell']); |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | |
193 | 193 | $day_names = $this->get_day_names(); |
194 | 194 | |
195 | - for ($i = 0; $i < 7; $i ++) |
|
195 | + for ($i = 0; $i < 7; $i++) |
|
196 | 196 | { |
197 | - $out .= str_replace('{week_day}', $day_names[($start_day + $i) %7], $this->temp['week_day_cell']); |
|
197 | + $out .= str_replace('{week_day}', $day_names[($start_day + $i) % 7], $this->temp['week_day_cell']); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $out .= "\n"; |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | { |
339 | 339 | $date = array(); |
340 | 340 | |
341 | - $date['month'] = $month; |
|
342 | - $date['year'] = $year; |
|
341 | + $date['month'] = $month; |
|
342 | + $date['year'] = $year; |
|
343 | 343 | |
344 | 344 | while ($date['month'] > 12) |
345 | 345 | { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | function get_total_days($month, $year) |
375 | 375 | { |
376 | - $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
376 | + $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
377 | 377 | |
378 | 378 | if ($month < 1 OR $month > 12) |
379 | 379 | { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | function default_template() |
406 | 406 | { |
407 | - return array ( |
|
407 | + return array( |
|
408 | 408 | 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">', |
409 | 409 | 'heading_row_start' => '<tr>', |
410 | 410 | 'heading_previous_cell' => '<th><a href="{previous_url}"><<</a></th>', |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | $today = array('cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today'); |
453 | 453 | |
454 | - foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) |
|
454 | + foreach (array('table_open', 'table_close', 'heading_row_start', 'heading_previous_cell', 'heading_title_cell', 'heading_next_cell', 'heading_row_end', 'week_row_start', 'week_day_cell', 'week_row_end', 'cal_row_start', 'cal_cell_start', 'cal_cell_content', 'cal_cell_no_content', 'cal_cell_blank', 'cal_cell_end', 'cal_row_end', 'cal_cell_start_today', 'cal_cell_content_today', 'cal_cell_no_content_today', 'cal_cell_end_today') as $val) |
|
455 | 455 | { |
456 | 456 | if (preg_match("/\{".$val."\}(.*?)\{\/".$val."\}/si", $this->template, $match)) |
457 | 457 | { |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -98,20 +100,25 @@ discard block |
||
98 | 100 | function generate($year = '', $month = '', $data = array()) |
99 | 101 | { |
100 | 102 | // Set and validate the supplied month/year |
101 | - if ($year == '') |
|
102 | - $year = date("Y", $this->local_time); |
|
103 | + if ($year == '') { |
|
104 | + $year = date("Y", $this->local_time); |
|
105 | + } |
|
103 | 106 | |
104 | - if ($month == '') |
|
105 | - $month = date("m", $this->local_time); |
|
107 | + if ($month == '') { |
|
108 | + $month = date("m", $this->local_time); |
|
109 | + } |
|
106 | 110 | |
107 | - if (strlen($year) == 1) |
|
108 | - $year = '200'.$year; |
|
111 | + if (strlen($year) == 1) { |
|
112 | + $year = '200'.$year; |
|
113 | + } |
|
109 | 114 | |
110 | - if (strlen($year) == 2) |
|
111 | - $year = '20'.$year; |
|
115 | + if (strlen($year) == 2) { |
|
116 | + $year = '20'.$year; |
|
117 | + } |
|
112 | 118 | |
113 | - if (strlen($month) == 1) |
|
114 | - $month = '0'.$month; |
|
119 | + if (strlen($month) == 1) { |
|
120 | + $month = '0'.$month; |
|
121 | + } |
|
115 | 122 | |
116 | 123 | $adjusted_date = $this->adjust_date($month, $year); |
117 | 124 | |
@@ -219,15 +226,13 @@ discard block |
||
219 | 226 | // Cells with content |
220 | 227 | $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_content_today'] : $this->temp['cal_cell_content']; |
221 | 228 | $out .= str_replace('{day}', $day, str_replace('{content}', $data[$day], $temp)); |
222 | - } |
|
223 | - else |
|
229 | + } else |
|
224 | 230 | { |
225 | 231 | // Cells with no content |
226 | 232 | $temp = ($is_current_month == TRUE AND $day == $cur_day) ? $this->temp['cal_cell_no_content_today'] : $this->temp['cal_cell_no_content']; |
227 | 233 | $out .= str_replace('{day}', $day, $temp); |
228 | 234 | } |
229 | - } |
|
230 | - else |
|
235 | + } else |
|
231 | 236 | { |
232 | 237 | // Blank cells |
233 | 238 | $out .= $this->temp['cal_cell_blank']; |
@@ -265,8 +270,7 @@ discard block |
||
265 | 270 | if ($this->month_type == 'short') |
266 | 271 | { |
267 | 272 | $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'); |
268 | - } |
|
269 | - else |
|
273 | + } else |
|
270 | 274 | { |
271 | 275 | $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'); |
272 | 276 | } |
@@ -295,18 +299,17 @@ discard block |
||
295 | 299 | */ |
296 | 300 | function get_day_names($day_type = '') |
297 | 301 | { |
298 | - if ($day_type != '') |
|
299 | - $this->day_type = $day_type; |
|
302 | + if ($day_type != '') { |
|
303 | + $this->day_type = $day_type; |
|
304 | + } |
|
300 | 305 | |
301 | 306 | if ($this->day_type == 'long') |
302 | 307 | { |
303 | 308 | $day_names = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); |
304 | - } |
|
305 | - elseif ($this->day_type == 'short') |
|
309 | + } elseif ($this->day_type == 'short') |
|
306 | 310 | { |
307 | 311 | $day_names = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); |
308 | - } |
|
309 | - else |
|
312 | + } else |
|
310 | 313 | { |
311 | 314 | $day_names = array('su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'); |
312 | 315 | } |
@@ -456,8 +459,7 @@ discard block |
||
456 | 459 | if (preg_match("/\{".$val."\}(.*?)\{\/".$val."\}/si", $this->template, $match)) |
457 | 460 | { |
458 | 461 | $this->temp[$val] = $match['1']; |
459 | - } |
|
460 | - else |
|
462 | + } else |
|
461 | 463 | { |
462 | 464 | if (in_array($val, $today, TRUE)) |
463 | 465 | { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | class CI_Driver_Library { |
31 | 31 | |
32 | - protected $valid_drivers = array(); |
|
32 | + protected $valid_drivers = array(); |
|
33 | 33 | protected static $lib_name; |
34 | 34 | |
35 | 35 | // The first time a child is used it won't exist, so we instantiate it |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | // ------------------------------------------------------------------------ |
4 | 6 | |
@@ -59,8 +61,7 @@ discard block |
||
59 | 61 | if ($download == "") |
60 | 62 | { |
61 | 63 | return $str; |
62 | - } |
|
63 | - else |
|
64 | + } else |
|
64 | 65 | { |
65 | 66 | echo $str; |
66 | 67 | } |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class CI_Pagination { |
28 | 28 | |
29 | - var $base_url = ''; // The page we are linking to |
|
29 | + var $base_url = ''; // The page we are linking to |
|
30 | 30 | var $prefix = ''; // A custom prefix added to the path. |
31 | 31 | var $suffix = ''; // A custom suffix added to the path. |
32 | 32 | |
33 | - var $total_rows = 0; // Total number of items (database results) |
|
33 | + var $total_rows = 0; // Total number of items (database results) |
|
34 | 34 | var $per_page = 10; // Max number of items you want shown per page |
35 | - var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page |
|
36 | - var $cur_page = 0; // The current page being viewed |
|
37 | - var $use_page_numbers = FALSE; // Use page number for segment instead of offset |
|
38 | - var $first_link = '‹ First'; |
|
35 | + var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page |
|
36 | + var $cur_page = 0; // The current page being viewed |
|
37 | + var $use_page_numbers = FALSE; // Use page number for segment instead of offset |
|
38 | + var $first_link = '‹ First'; |
|
39 | 39 | var $next_link = '>'; |
40 | 40 | var $prev_link = '<'; |
41 | 41 | var $last_link = 'Last ›'; |
42 | - var $uri_segment = 3; |
|
43 | - var $full_tag_open = ''; |
|
42 | + var $uri_segment = 3; |
|
43 | + var $full_tag_open = ''; |
|
44 | 44 | var $full_tag_close = ''; |
45 | 45 | var $first_tag_open = ''; |
46 | 46 | var $first_tag_close = ' '; |
47 | - var $last_tag_open = ' '; |
|
47 | + var $last_tag_open = ' '; |
|
48 | 48 | var $last_tag_close = ''; |
49 | - var $first_url = ''; // Alternative URL for the First Page. |
|
50 | - var $cur_tag_open = ' <strong>'; |
|
49 | + var $first_url = ''; // Alternative URL for the First Page. |
|
50 | + var $cur_tag_open = ' <strong>'; |
|
51 | 51 | var $cur_tag_close = '</strong>'; |
52 | 52 | var $next_tag_open = ' '; |
53 | 53 | var $next_tag_close = ' '; |
54 | 54 | var $prev_tag_open = ' '; |
55 | 55 | var $prev_tag_close = ''; |
56 | - var $num_tag_open = ' '; |
|
56 | + var $num_tag_open = ' '; |
|
57 | 57 | var $num_tag_close = ''; |
58 | - var $page_query_string = FALSE; |
|
58 | + var $page_query_string = FALSE; |
|
59 | 59 | var $query_string_segment = 'per_page'; |
60 | 60 | var $display_pages = TRUE; |
61 | - var $anchor_class = ''; |
|
61 | + var $anchor_class = ''; |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Constructor |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // Determine the current page number. |
143 | - $CI =& get_instance(); |
|
143 | + $CI = & get_instance(); |
|
144 | 144 | |
145 | 145 | if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) |
146 | 146 | { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->cur_page = $CI->input->get($this->query_string_segment); |
150 | 150 | |
151 | 151 | // Prep the current page - no funny business! |
152 | - $this->cur_page = (int) $this->cur_page; |
|
152 | + $this->cur_page = (int)$this->cur_page; |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | else |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->cur_page = $CI->uri->segment($this->uri_segment); |
160 | 160 | |
161 | 161 | // Prep the current page - no funny business! |
162 | - $this->cur_page = (int) $this->cur_page; |
|
162 | + $this->cur_page = (int)$this->cur_page; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | if ( ! $this->use_page_numbers) |
204 | 204 | { |
205 | - $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); |
|
205 | + $this->cur_page = floor(($this->cur_page / $this->per_page) + 1); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // Calculate the start and end numbers. These determine |
@@ -218,21 +218,21 @@ discard block |
||
218 | 218 | } |
219 | 219 | else |
220 | 220 | { |
221 | - $this->base_url = rtrim($this->base_url, '/') .'/'; |
|
221 | + $this->base_url = rtrim($this->base_url, '/').'/'; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | // And here we go... |
225 | 225 | $output = ''; |
226 | 226 | |
227 | 227 | // Render the "First" link |
228 | - if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) |
|
228 | + if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) |
|
229 | 229 | { |
230 | 230 | $first_url = ($this->first_url == '') ? $this->base_url : $this->first_url; |
231 | 231 | $output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; |
232 | 232 | } |
233 | 233 | |
234 | 234 | // Render the "previous" link |
235 | - if ($this->prev_link !== FALSE AND $this->cur_page != 1) |
|
235 | + if ($this->prev_link !== FALSE AND $this->cur_page != 1) |
|
236 | 236 | { |
237 | 237 | if ($this->use_page_numbers) |
238 | 238 | { |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | if ($this->display_pages !== FALSE) |
260 | 260 | { |
261 | 261 | // Write the digit links |
262 | - for ($loop = $start -1; $loop <= $end; $loop++) |
|
262 | + for ($loop = $start - 1; $loop <= $end; $loop++) |
|
263 | 263 | { |
264 | 264 | if ($this->use_page_numbers) |
265 | 265 | { |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -133,8 +135,7 @@ discard block |
||
133 | 135 | if ($this->use_page_numbers) |
134 | 136 | { |
135 | 137 | $base_page = 1; |
136 | - } |
|
137 | - else |
|
138 | + } else |
|
138 | 139 | { |
139 | 140 | $base_page = 0; |
140 | 141 | } |
@@ -151,8 +152,7 @@ discard block |
||
151 | 152 | // Prep the current page - no funny business! |
152 | 153 | $this->cur_page = (int) $this->cur_page; |
153 | 154 | } |
154 | - } |
|
155 | - else |
|
155 | + } else |
|
156 | 156 | { |
157 | 157 | if ($CI->uri->segment($this->uri_segment) != $base_page) |
158 | 158 | { |
@@ -189,8 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | $this->cur_page = $num_pages; |
191 | 191 | } |
192 | - } |
|
193 | - else |
|
192 | + } else |
|
194 | 193 | { |
195 | 194 | if ($this->cur_page > $this->total_rows) |
196 | 195 | { |
@@ -215,8 +214,7 @@ discard block |
||
215 | 214 | if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) |
216 | 215 | { |
217 | 216 | $this->base_url = rtrim($this->base_url).'&'.$this->query_string_segment.'='; |
218 | - } |
|
219 | - else |
|
217 | + } else |
|
220 | 218 | { |
221 | 219 | $this->base_url = rtrim($this->base_url, '/') .'/'; |
222 | 220 | } |
@@ -237,8 +235,7 @@ discard block |
||
237 | 235 | if ($this->use_page_numbers) |
238 | 236 | { |
239 | 237 | $i = $uri_page_number - 1; |
240 | - } |
|
241 | - else |
|
238 | + } else |
|
242 | 239 | { |
243 | 240 | $i = $uri_page_number - $this->per_page; |
244 | 241 | } |
@@ -246,8 +243,7 @@ discard block |
||
246 | 243 | if ($i == 0 && $this->first_url != '') |
247 | 244 | { |
248 | 245 | $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; |
249 | - } |
|
250 | - else |
|
246 | + } else |
|
251 | 247 | { |
252 | 248 | $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix; |
253 | 249 | $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; |
@@ -264,8 +260,7 @@ discard block |
||
264 | 260 | if ($this->use_page_numbers) |
265 | 261 | { |
266 | 262 | $i = $loop; |
267 | - } |
|
268 | - else |
|
263 | + } else |
|
269 | 264 | { |
270 | 265 | $i = ($loop * $this->per_page) - $this->per_page; |
271 | 266 | } |
@@ -275,16 +270,14 @@ discard block |
||
275 | 270 | if ($this->cur_page == $loop) |
276 | 271 | { |
277 | 272 | $output .= $this->cur_tag_open.$loop.$this->cur_tag_close; // Current page |
278 | - } |
|
279 | - else |
|
273 | + } else |
|
280 | 274 | { |
281 | 275 | $n = ($i == $base_page) ? '' : $i; |
282 | 276 | |
283 | 277 | if ($n == '' && $this->first_url != '') |
284 | 278 | { |
285 | 279 | $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close; |
286 | - } |
|
287 | - else |
|
280 | + } else |
|
288 | 281 | { |
289 | 282 | $n = ($n == '') ? '' : $this->prefix.$n.$this->suffix; |
290 | 283 | |
@@ -301,8 +294,7 @@ discard block |
||
301 | 294 | if ($this->use_page_numbers) |
302 | 295 | { |
303 | 296 | $i = $this->cur_page + 1; |
304 | - } |
|
305 | - else |
|
297 | + } else |
|
306 | 298 | { |
307 | 299 | $i = ($this->cur_page * $this->per_page); |
308 | 300 | } |
@@ -316,8 +308,7 @@ discard block |
||
316 | 308 | if ($this->use_page_numbers) |
317 | 309 | { |
318 | 310 | $i = $num_pages; |
319 | - } |
|
320 | - else |
|
311 | + } else |
|
321 | 312 | { |
322 | 313 | $i = (($num_pages * $this->per_page) - $this->per_page); |
323 | 314 | } |
@@ -26,55 +26,55 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class CI_Image_lib { |
28 | 28 | |
29 | - var $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2 |
|
29 | + var $image_library = 'gd2'; // Can be: imagemagick, netpbm, gd, gd2 |
|
30 | 30 | var $library_path = ''; |
31 | - var $dynamic_output = FALSE; // Whether to send to browser or write to disk |
|
31 | + var $dynamic_output = FALSE; // Whether to send to browser or write to disk |
|
32 | 32 | var $source_image = ''; |
33 | - var $new_image = ''; |
|
34 | - var $width = ''; |
|
33 | + var $new_image = ''; |
|
34 | + var $width = ''; |
|
35 | 35 | var $height = ''; |
36 | 36 | var $quality = '90'; |
37 | 37 | var $create_thumb = FALSE; |
38 | 38 | var $thumb_marker = '_thumb'; |
39 | - var $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values |
|
40 | - var $master_dim = 'auto'; // auto, height, or width. Determines what to use as the master dimension |
|
39 | + var $maintain_ratio = TRUE; // Whether to maintain aspect ratio when resizing or use hard values |
|
40 | + var $master_dim = 'auto'; // auto, height, or width. Determines what to use as the master dimension |
|
41 | 41 | var $rotation_angle = ''; |
42 | 42 | var $x_axis = ''; |
43 | 43 | var $y_axis = ''; |
44 | 44 | |
45 | 45 | // Watermark Vars |
46 | - var $wm_text = ''; // Watermark text if graphic is not used |
|
47 | - var $wm_type = 'text'; // Type of watermarking. Options: text/overlay |
|
46 | + var $wm_text = ''; // Watermark text if graphic is not used |
|
47 | + var $wm_type = 'text'; // Type of watermarking. Options: text/overlay |
|
48 | 48 | var $wm_x_transp = 4; |
49 | 49 | var $wm_y_transp = 4; |
50 | - var $wm_overlay_path = ''; // Watermark image path |
|
51 | - var $wm_font_path = ''; // TT font |
|
52 | - var $wm_font_size = 17; // Font size (different versions of GD will either use points or pixels) |
|
53 | - var $wm_vrt_alignment = 'B'; // Vertical alignment: T M B |
|
54 | - var $wm_hor_alignment = 'C'; // Horizontal alignment: L R C |
|
55 | - var $wm_padding = 0; // Padding around text |
|
56 | - var $wm_hor_offset = 0; // Lets you push text to the right |
|
57 | - var $wm_vrt_offset = 0; // Lets you push text down |
|
58 | - var $wm_font_color = '#ffffff'; // Text color |
|
59 | - var $wm_shadow_color = ''; // Dropshadow color |
|
60 | - var $wm_shadow_distance = 2; // Dropshadow distance |
|
61 | - var $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image |
|
50 | + var $wm_overlay_path = ''; // Watermark image path |
|
51 | + var $wm_font_path = ''; // TT font |
|
52 | + var $wm_font_size = 17; // Font size (different versions of GD will either use points or pixels) |
|
53 | + var $wm_vrt_alignment = 'B'; // Vertical alignment: T M B |
|
54 | + var $wm_hor_alignment = 'C'; // Horizontal alignment: L R C |
|
55 | + var $wm_padding = 0; // Padding around text |
|
56 | + var $wm_hor_offset = 0; // Lets you push text to the right |
|
57 | + var $wm_vrt_offset = 0; // Lets you push text down |
|
58 | + var $wm_font_color = '#ffffff'; // Text color |
|
59 | + var $wm_shadow_color = ''; // Dropshadow color |
|
60 | + var $wm_shadow_distance = 2; // Dropshadow distance |
|
61 | + var $wm_opacity = 50; // Image opacity: 1 - 100 Only works with image |
|
62 | 62 | |
63 | 63 | // Private Vars |
64 | - var $source_folder = ''; |
|
64 | + var $source_folder = ''; |
|
65 | 65 | var $dest_folder = ''; |
66 | - var $mime_type = ''; |
|
66 | + var $mime_type = ''; |
|
67 | 67 | var $orig_width = ''; |
68 | 68 | var $orig_height = ''; |
69 | 69 | var $image_type = ''; |
70 | - var $size_str = ''; |
|
70 | + var $size_str = ''; |
|
71 | 71 | var $full_src_path = ''; |
72 | 72 | var $full_dst_path = ''; |
73 | - var $create_fnc = 'imagecreatetruecolor'; |
|
74 | - var $copy_fnc = 'imagecopyresampled'; |
|
75 | - var $error_msg = array(); |
|
76 | - var $wm_use_drop_shadow = FALSE; |
|
77 | - var $wm_use_truetype = FALSE; |
|
73 | + var $create_fnc = 'imagecreatetruecolor'; |
|
74 | + var $copy_fnc = 'imagecopyresampled'; |
|
75 | + var $error_msg = array(); |
|
76 | + var $wm_use_drop_shadow = FALSE; |
|
77 | + var $wm_use_truetype = FALSE; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Constructor |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $this->thumb_marker = ''; |
255 | 255 | } |
256 | 256 | |
257 | - $xp = $this->explode_name($this->dest_image); |
|
257 | + $xp = $this->explode_name($this->dest_image); |
|
258 | 258 | |
259 | 259 | $filename = $xp['name']; |
260 | 260 | $file_ext = $xp['ext']; |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | // Reassign the width and height |
406 | 406 | if ($this->rotation_angle == 90 OR $this->rotation_angle == 270) |
407 | 407 | { |
408 | - $this->width = $this->orig_height; |
|
409 | - $this->height = $this->orig_width; |
|
408 | + $this->width = $this->orig_height; |
|
409 | + $this->height = $this->orig_width; |
|
410 | 410 | } |
411 | 411 | else |
412 | 412 | { |
413 | - $this->width = $this->orig_width; |
|
414 | - $this->height = $this->orig_height; |
|
413 | + $this->width = $this->orig_width; |
|
414 | + $this->height = $this->orig_height; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -502,13 +502,13 @@ discard block |
||
502 | 502 | // if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor') AND $v2_override == FALSE) |
503 | 503 | if ($this->image_library == 'gd2' AND function_exists('imagecreatetruecolor')) |
504 | 504 | { |
505 | - $create = 'imagecreatetruecolor'; |
|
506 | - $copy = 'imagecopyresampled'; |
|
505 | + $create = 'imagecreatetruecolor'; |
|
506 | + $copy = 'imagecopyresampled'; |
|
507 | 507 | } |
508 | 508 | else |
509 | 509 | { |
510 | - $create = 'imagecreate'; |
|
511 | - $copy = 'imagecopyresized'; |
|
510 | + $create = 'imagecreate'; |
|
511 | + $copy = 'imagecopyresized'; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | $dst_img = $create($this->width, $this->height); |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | // With NetPBM we have to create a temporary image. |
695 | 695 | // If you try manipulating the original it fails so |
696 | 696 | // we have to rename the temp file. |
697 | - copy ($this->dest_folder.'netpbm.tmp', $this->full_dst_path); |
|
698 | - unlink ($this->dest_folder.'netpbm.tmp'); |
|
697 | + copy($this->dest_folder.'netpbm.tmp', $this->full_dst_path); |
|
698 | + unlink($this->dest_folder.'netpbm.tmp'); |
|
699 | 699 | @chmod($this->full_dst_path, FILE_WRITE_MODE); |
700 | 700 | |
701 | 701 | return TRUE; |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | // going to have to figure out how to determine the color |
723 | 723 | // of the alpha channel in a future release. |
724 | 724 | |
725 | - $white = imagecolorallocate($src_img, 255, 255, 255); |
|
725 | + $white = imagecolorallocate($src_img, 255, 255, 255); |
|
726 | 726 | |
727 | 727 | // Rotate it! |
728 | 728 | $dst_img = imagerotate($src_img, $this->rotation_angle, $white); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | for ($i = 0; $i < $height; $i++) |
778 | 778 | { |
779 | 779 | $left = 0; |
780 | - $right = $width-1; |
|
780 | + $right = $width - 1; |
|
781 | 781 | |
782 | 782 | while ($left < $right) |
783 | 783 | { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | for ($i = 0; $i < $width; $i++) |
798 | 798 | { |
799 | 799 | $top = 0; |
800 | - $bot = $height-1; |
|
800 | + $bot = $height - 1; |
|
801 | 801 | |
802 | 802 | while ($top < $bot) |
803 | 803 | { |
@@ -880,10 +880,10 @@ discard block |
||
880 | 880 | $this->get_image_properties(); |
881 | 881 | |
882 | 882 | // Fetch watermark image properties |
883 | - $props = $this->get_image_properties($this->wm_overlay_path, TRUE); |
|
884 | - $wm_img_type = $props['image_type']; |
|
885 | - $wm_width = $props['width']; |
|
886 | - $wm_height = $props['height']; |
|
883 | + $props = $this->get_image_properties($this->wm_overlay_path, TRUE); |
|
884 | + $wm_img_type = $props['image_type']; |
|
885 | + $wm_width = $props['width']; |
|
886 | + $wm_height = $props['height']; |
|
887 | 887 | |
888 | 888 | // Create two image resources |
889 | 889 | $wm_img = $this->image_create_gd($this->wm_overlay_path, $wm_img_type); |
@@ -998,8 +998,8 @@ discard block |
||
998 | 998 | $this->get_image_properties(); |
999 | 999 | |
1000 | 1000 | // Set RGB values for text and shadow |
1001 | - $this->wm_font_color = str_replace('#', '', $this->wm_font_color); |
|
1002 | - $this->wm_shadow_color = str_replace('#', '', $this->wm_shadow_color); |
|
1001 | + $this->wm_font_color = str_replace('#', '', $this->wm_font_color); |
|
1002 | + $this->wm_shadow_color = str_replace('#', '', $this->wm_shadow_color); |
|
1003 | 1003 | |
1004 | 1004 | $R1 = hexdec(substr($this->wm_font_color, 0, 2)); |
1005 | 1005 | $G1 = hexdec(substr($this->wm_font_color, 2, 2)); |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | if ($this->wm_font_size == '') |
1034 | 1034 | $this->wm_font_size = '17'; |
1035 | 1035 | |
1036 | - $fontwidth = $this->wm_font_size-($this->wm_font_size/4); |
|
1036 | + $fontwidth = $this->wm_font_size - ($this->wm_font_size / 4); |
|
1037 | 1037 | $fontheight = $this->wm_font_size; |
1038 | 1038 | $this->wm_vrt_offset += $this->wm_font_size; |
1039 | 1039 | } |
@@ -1058,9 +1058,9 @@ discard block |
||
1058 | 1058 | { |
1059 | 1059 | case "T" : |
1060 | 1060 | break; |
1061 | - case "M": $y_axis += ($this->orig_height/2)+($fontheight/2); |
|
1061 | + case "M": $y_axis += ($this->orig_height / 2) + ($fontheight / 2); |
|
1062 | 1062 | break; |
1063 | - case "B": $y_axis += ($this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight/2)); |
|
1063 | + case "B": $y_axis += ($this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight / 2)); |
|
1064 | 1064 | break; |
1065 | 1065 | } |
1066 | 1066 | |
@@ -1074,13 +1074,13 @@ discard block |
||
1074 | 1074 | break; |
1075 | 1075 | case "R": |
1076 | 1076 | if ($this->wm_use_drop_shadow) |
1077 | - $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text)); |
|
1078 | - $x_axis += ($this->orig_width - $fontwidth*strlen($this->wm_text)); |
|
1077 | + $x_shad += ($this->orig_width - $fontwidth * strlen($this->wm_text)); |
|
1078 | + $x_axis += ($this->orig_width - $fontwidth * strlen($this->wm_text)); |
|
1079 | 1079 | break; |
1080 | 1080 | case "C": |
1081 | 1081 | if ($this->wm_use_drop_shadow) |
1082 | - $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); |
|
1083 | - $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); |
|
1082 | + $x_shad += floor(($this->orig_width - $fontwidth * strlen($this->wm_text)) / 2); |
|
1083 | + $x_axis += floor(($this->orig_width - $fontwidth * strlen($this->wm_text)) / 2); |
|
1084 | 1084 | break; |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1286,10 +1286,10 @@ discard block |
||
1286 | 1286 | if ( ! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) |
1287 | 1287 | return; |
1288 | 1288 | |
1289 | - $new_width = ceil($this->orig_width*$this->height/$this->orig_height); |
|
1290 | - $new_height = ceil($this->width*$this->orig_height/$this->orig_width); |
|
1289 | + $new_width = ceil($this->orig_width * $this->height / $this->orig_height); |
|
1290 | + $new_height = ceil($this->width * $this->orig_height / $this->orig_width); |
|
1291 | 1291 | |
1292 | - $ratio = (($this->orig_height/$this->orig_width) - ($this->height/$this->width)); |
|
1292 | + $ratio = (($this->orig_height / $this->orig_width) - ($this->height / $this->width)); |
|
1293 | 1293 | |
1294 | 1294 | if ($this->master_dim != 'width' AND $this->master_dim != 'height') |
1295 | 1295 | { |
@@ -1345,14 +1345,14 @@ discard block |
||
1345 | 1345 | $v['width'] = $vals['0']; |
1346 | 1346 | $v['height'] = $vals['1']; |
1347 | 1347 | $v['image_type'] = $vals['2']; |
1348 | - $v['size_str'] = $vals['3']; |
|
1348 | + $v['size_str'] = $vals['3']; |
|
1349 | 1349 | $v['mime_type'] = $mime; |
1350 | 1350 | |
1351 | 1351 | return $v; |
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | $this->orig_width = $vals['0']; |
1355 | - $this->orig_height = $vals['1']; |
|
1355 | + $this->orig_height = $vals['1']; |
|
1356 | 1356 | $this->image_type = $vals['2']; |
1357 | 1357 | $this->size_str = $vals['3']; |
1358 | 1358 | $this->mime_type = $mime; |
@@ -1402,11 +1402,11 @@ discard block |
||
1402 | 1402 | |
1403 | 1403 | if ($vals['new_width'] == 0) |
1404 | 1404 | { |
1405 | - $vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']); |
|
1405 | + $vals['new_width'] = ceil($vals['width'] * $vals['new_height'] / $vals['height']); |
|
1406 | 1406 | } |
1407 | 1407 | elseif ($vals['new_height'] == 0) |
1408 | 1408 | { |
1409 | - $vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']); |
|
1409 | + $vals['new_height'] = ceil($vals['new_width'] * $vals['height'] / $vals['width']); |
|
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | return $vals; |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | */ |
1490 | 1490 | function set_error($msg) |
1491 | 1491 | { |
1492 | - $CI =& get_instance(); |
|
1492 | + $CI = & get_instance(); |
|
1493 | 1493 | $CI->lang->load('imglib'); |
1494 | 1494 | |
1495 | 1495 | if (is_array($msg)) |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -176,8 +178,7 @@ discard block |
||
176 | 178 | if (function_exists('realpath') AND @realpath($this->source_image) !== FALSE) |
177 | 179 | { |
178 | 180 | $full_source_path = str_replace("\\", "/", realpath($this->source_image)); |
179 | - } |
|
180 | - else |
|
181 | + } else |
|
181 | 182 | { |
182 | 183 | $full_source_path = $this->source_image; |
183 | 184 | } |
@@ -205,21 +206,18 @@ discard block |
||
205 | 206 | { |
206 | 207 | $this->dest_image = $this->source_image; |
207 | 208 | $this->dest_folder = $this->source_folder; |
208 | - } |
|
209 | - else |
|
209 | + } else |
|
210 | 210 | { |
211 | 211 | if (strpos($this->new_image, '/') === FALSE) |
212 | 212 | { |
213 | 213 | $this->dest_folder = $this->source_folder; |
214 | 214 | $this->dest_image = $this->new_image; |
215 | - } |
|
216 | - else |
|
215 | + } else |
|
217 | 216 | { |
218 | 217 | if (function_exists('realpath') AND @realpath($this->new_image) !== FALSE) |
219 | 218 | { |
220 | 219 | $full_dest_path = str_replace("\\", "/", realpath($this->new_image)); |
221 | - } |
|
222 | - else |
|
220 | + } else |
|
223 | 221 | { |
224 | 222 | $full_dest_path = $this->new_image; |
225 | 223 | } |
@@ -229,8 +227,7 @@ discard block |
||
229 | 227 | { |
230 | 228 | $this->dest_folder = $full_dest_path.'/'; |
231 | 229 | $this->dest_image = $this->source_image; |
232 | - } |
|
233 | - else |
|
230 | + } else |
|
234 | 231 | { |
235 | 232 | $x = explode('/', $full_dest_path); |
236 | 233 | $this->dest_image = end($x); |
@@ -283,17 +280,20 @@ discard block |
||
283 | 280 | * from the actual file |
284 | 281 | * |
285 | 282 | */ |
286 | - if ($this->width == '') |
|
287 | - $this->width = $this->orig_width; |
|
283 | + if ($this->width == '') { |
|
284 | + $this->width = $this->orig_width; |
|
285 | + } |
|
288 | 286 | |
289 | - if ($this->height == '') |
|
290 | - $this->height = $this->orig_height; |
|
287 | + if ($this->height == '') { |
|
288 | + $this->height = $this->orig_height; |
|
289 | + } |
|
291 | 290 | |
292 | 291 | // Set the quality |
293 | 292 | $this->quality = trim(str_replace("%", "", $this->quality)); |
294 | 293 | |
295 | - if ($this->quality == '' OR $this->quality == 0 OR ! is_numeric($this->quality)) |
|
296 | - $this->quality = 90; |
|
294 | + if ($this->quality == '' OR $this->quality == 0 OR ! is_numeric($this->quality)) { |
|
295 | + $this->quality = 90; |
|
296 | + } |
|
297 | 297 | |
298 | 298 | // Set the x/y coordinates |
299 | 299 | $this->x_axis = ($this->x_axis == '' OR ! is_numeric($this->x_axis)) ? 0 : $this->x_axis; |
@@ -407,8 +407,7 @@ discard block |
||
407 | 407 | { |
408 | 408 | $this->width = $this->orig_height; |
409 | 409 | $this->height = $this->orig_width; |
410 | - } |
|
411 | - else |
|
410 | + } else |
|
412 | 411 | { |
413 | 412 | $this->width = $this->orig_width; |
414 | 413 | $this->height = $this->orig_height; |
@@ -426,8 +425,7 @@ discard block |
||
426 | 425 | if ($this->rotation_angle == 'hor' OR $this->rotation_angle == 'vrt') |
427 | 426 | { |
428 | 427 | return $this->image_mirror_gd(); |
429 | - } |
|
430 | - else |
|
428 | + } else |
|
431 | 429 | { |
432 | 430 | return $this->image_rotate_gd(); |
433 | 431 | } |
@@ -479,8 +477,7 @@ discard block |
||
479 | 477 | $gd_version = str_replace('0', '', $this->gd_version()); |
480 | 478 | $v2_override = ($gd_version == 2) ? TRUE : FALSE; |
481 | 479 | } |
482 | - } |
|
483 | - else |
|
480 | + } else |
|
484 | 481 | { |
485 | 482 | // If resizing the x/y axis must be zero |
486 | 483 | $this->x_axis = 0; |
@@ -504,8 +501,7 @@ discard block |
||
504 | 501 | { |
505 | 502 | $create = 'imagecreatetruecolor'; |
506 | 503 | $copy = 'imagecopyresampled'; |
507 | - } |
|
508 | - else |
|
504 | + } else |
|
509 | 505 | { |
510 | 506 | $create = 'imagecreate'; |
511 | 507 | $copy = 'imagecopyresized'; |
@@ -513,9 +509,11 @@ discard block |
||
513 | 509 | |
514 | 510 | $dst_img = $create($this->width, $this->height); |
515 | 511 | |
516 | - if ($this->image_type == 3) // png we can actually preserve transparency |
|
512 | + if ($this->image_type == 3) { |
|
513 | + // png we can actually preserve transparency |
|
517 | 514 | { |
518 | 515 | imagealphablending($dst_img, FALSE); |
516 | + } |
|
519 | 517 | imagesavealpha($dst_img, TRUE); |
520 | 518 | } |
521 | 519 | |
@@ -525,8 +523,7 @@ discard block |
||
525 | 523 | if ($this->dynamic_output == TRUE) |
526 | 524 | { |
527 | 525 | $this->image_display_gd($dst_img); |
528 | - } |
|
529 | - else |
|
526 | + } else |
|
530 | 527 | { |
531 | 528 | // Or save it |
532 | 529 | if ( ! $this->image_save_gd($dst_img)) |
@@ -578,8 +575,7 @@ discard block |
||
578 | 575 | if ($action == 'crop') |
579 | 576 | { |
580 | 577 | $cmd .= " -crop ".$this->width."x".$this->height."+".$this->x_axis."+".$this->y_axis." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; |
581 | - } |
|
582 | - elseif ($action == 'rotate') |
|
578 | + } elseif ($action == 'rotate') |
|
583 | 579 | { |
584 | 580 | switch ($this->rotation_angle) |
585 | 581 | { |
@@ -592,8 +588,7 @@ discard block |
||
592 | 588 | } |
593 | 589 | |
594 | 590 | $cmd .= " ".$angle." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; |
595 | - } |
|
596 | - else // Resize |
|
591 | + } else // Resize |
|
597 | 592 | { |
598 | 593 | $cmd .= " -resize ".$this->width."x".$this->height." \"$this->full_src_path\" \"$this->full_dst_path\" 2>&1"; |
599 | 594 | } |
@@ -654,8 +649,7 @@ discard block |
||
654 | 649 | if ($action == 'crop') |
655 | 650 | { |
656 | 651 | $cmd_inner = 'pnmcut -left '.$this->x_axis.' -top '.$this->y_axis.' -width '.$this->width.' -height '.$this->height; |
657 | - } |
|
658 | - elseif ($action == 'rotate') |
|
652 | + } elseif ($action == 'rotate') |
|
659 | 653 | { |
660 | 654 | switch ($this->rotation_angle) |
661 | 655 | { |
@@ -672,8 +666,7 @@ discard block |
||
672 | 666 | } |
673 | 667 | |
674 | 668 | $cmd_inner = 'pnmflip -'.$angle.' '; |
675 | - } |
|
676 | - else // Resize |
|
669 | + } else // Resize |
|
677 | 670 | { |
678 | 671 | $cmd_inner = 'pnmscale -xysize '.$this->width.' '.$this->height; |
679 | 672 | } |
@@ -731,8 +724,7 @@ discard block |
||
731 | 724 | if ($this->dynamic_output == TRUE) |
732 | 725 | { |
733 | 726 | $this->image_display_gd($dst_img); |
734 | - } |
|
735 | - else |
|
727 | + } else |
|
736 | 728 | { |
737 | 729 | // Or save it |
738 | 730 | if ( ! $this->image_save_gd($dst_img)) |
@@ -791,8 +783,7 @@ discard block |
||
791 | 783 | $right--; |
792 | 784 | } |
793 | 785 | } |
794 | - } |
|
795 | - else |
|
786 | + } else |
|
796 | 787 | { |
797 | 788 | for ($i = 0; $i < $width; $i++) |
798 | 789 | { |
@@ -817,8 +808,7 @@ discard block |
||
817 | 808 | if ($this->dynamic_output == TRUE) |
818 | 809 | { |
819 | 810 | $this->image_display_gd($src_img); |
820 | - } |
|
821 | - else |
|
811 | + } else |
|
822 | 812 | { |
823 | 813 | // Or save it |
824 | 814 | if ( ! $this->image_save_gd($src_img)) |
@@ -853,8 +843,7 @@ discard block |
||
853 | 843 | if ($this->wm_type == 'overlay') |
854 | 844 | { |
855 | 845 | return $this->overlay_watermark(); |
856 | - } |
|
857 | - else |
|
846 | + } else |
|
858 | 847 | { |
859 | 848 | return $this->text_watermark(); |
860 | 849 | } |
@@ -899,11 +888,13 @@ discard block |
||
899 | 888 | $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); |
900 | 889 | $this->wm_hor_alignment = strtoupper(substr($this->wm_hor_alignment, 0, 1)); |
901 | 890 | |
902 | - if ($this->wm_vrt_alignment == 'B') |
|
903 | - $this->wm_vrt_offset = $this->wm_vrt_offset * -1; |
|
891 | + if ($this->wm_vrt_alignment == 'B') { |
|
892 | + $this->wm_vrt_offset = $this->wm_vrt_offset * -1; |
|
893 | + } |
|
904 | 894 | |
905 | - if ($this->wm_hor_alignment == 'R') |
|
906 | - $this->wm_hor_offset = $this->wm_hor_offset * -1; |
|
895 | + if ($this->wm_hor_alignment == 'R') { |
|
896 | + $this->wm_hor_offset = $this->wm_hor_offset * -1; |
|
897 | + } |
|
907 | 898 | |
908 | 899 | // Set the base x and y axis values |
909 | 900 | $x_axis = $this->wm_hor_offset + $this->wm_padding; |
@@ -946,8 +937,7 @@ discard block |
||
946 | 937 | { |
947 | 938 | // copy the image directly, the image's alpha transparency being the sole determinant of blending |
948 | 939 | imagecopy($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height); |
949 | - } |
|
950 | - else |
|
940 | + } else |
|
951 | 941 | { |
952 | 942 | // set our RGB value from above to be transparent and merge the images with the specified opacity |
953 | 943 | imagecolortransparent($wm_img, imagecolorat($wm_img, $this->wm_x_transp, $this->wm_y_transp)); |
@@ -958,8 +948,7 @@ discard block |
||
958 | 948 | if ($this->dynamic_output == TRUE) |
959 | 949 | { |
960 | 950 | $this->image_display_gd($src_img); |
961 | - } |
|
962 | - else |
|
951 | + } else |
|
963 | 952 | { |
964 | 953 | if ( ! $this->image_save_gd($src_img)) |
965 | 954 | { |
@@ -1019,25 +1008,27 @@ discard block |
||
1019 | 1008 | // invert the offset. Note: The horizontal |
1020 | 1009 | // offset flips itself automatically |
1021 | 1010 | |
1022 | - if ($this->wm_vrt_alignment == 'B') |
|
1023 | - $this->wm_vrt_offset = $this->wm_vrt_offset * -1; |
|
1011 | + if ($this->wm_vrt_alignment == 'B') { |
|
1012 | + $this->wm_vrt_offset = $this->wm_vrt_offset * -1; |
|
1013 | + } |
|
1024 | 1014 | |
1025 | - if ($this->wm_hor_alignment == 'R') |
|
1026 | - $this->wm_hor_offset = $this->wm_hor_offset * -1; |
|
1015 | + if ($this->wm_hor_alignment == 'R') { |
|
1016 | + $this->wm_hor_offset = $this->wm_hor_offset * -1; |
|
1017 | + } |
|
1027 | 1018 | |
1028 | 1019 | // Set font width and height |
1029 | 1020 | // These are calculated differently depending on |
1030 | 1021 | // whether we are using the true type font or not |
1031 | 1022 | if ($this->wm_use_truetype == TRUE) |
1032 | 1023 | { |
1033 | - if ($this->wm_font_size == '') |
|
1034 | - $this->wm_font_size = '17'; |
|
1024 | + if ($this->wm_font_size == '') { |
|
1025 | + $this->wm_font_size = '17'; |
|
1026 | + } |
|
1035 | 1027 | |
1036 | 1028 | $fontwidth = $this->wm_font_size-($this->wm_font_size/4); |
1037 | 1029 | $fontheight = $this->wm_font_size; |
1038 | 1030 | $this->wm_vrt_offset += $this->wm_font_size; |
1039 | - } |
|
1040 | - else |
|
1031 | + } else |
|
1041 | 1032 | { |
1042 | 1033 | $fontwidth = imagefontwidth($this->wm_font_size); |
1043 | 1034 | $fontheight = imagefontheight($this->wm_font_size); |
@@ -1048,8 +1039,9 @@ discard block |
||
1048 | 1039 | $y_axis = $this->wm_vrt_offset + $this->wm_padding; |
1049 | 1040 | |
1050 | 1041 | // Set verticle alignment |
1051 | - if ($this->wm_use_drop_shadow == FALSE) |
|
1052 | - $this->wm_shadow_distance = 0; |
|
1042 | + if ($this->wm_use_drop_shadow == FALSE) { |
|
1043 | + $this->wm_shadow_distance = 0; |
|
1044 | + } |
|
1053 | 1045 | |
1054 | 1046 | $this->wm_vrt_alignment = strtoupper(substr($this->wm_vrt_alignment, 0, 1)); |
1055 | 1047 | $this->wm_hor_alignment = strtoupper(substr($this->wm_hor_alignment, 0, 1)); |
@@ -1073,13 +1065,15 @@ discard block |
||
1073 | 1065 | case "L": |
1074 | 1066 | break; |
1075 | 1067 | case "R": |
1076 | - if ($this->wm_use_drop_shadow) |
|
1077 | - $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text)); |
|
1068 | + if ($this->wm_use_drop_shadow) { |
|
1069 | + $x_shad += ($this->orig_width - $fontwidth*strlen($this->wm_text)); |
|
1070 | + } |
|
1078 | 1071 | $x_axis += ($this->orig_width - $fontwidth*strlen($this->wm_text)); |
1079 | 1072 | break; |
1080 | 1073 | case "C": |
1081 | - if ($this->wm_use_drop_shadow) |
|
1082 | - $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); |
|
1074 | + if ($this->wm_use_drop_shadow) { |
|
1075 | + $x_shad += floor(($this->orig_width - $fontwidth*strlen($this->wm_text))/2); |
|
1076 | + } |
|
1083 | 1077 | $x_axis += floor(($this->orig_width -$fontwidth*strlen($this->wm_text))/2); |
1084 | 1078 | break; |
1085 | 1079 | } |
@@ -1087,14 +1081,15 @@ discard block |
||
1087 | 1081 | // Add the text to the source image |
1088 | 1082 | if ($this->wm_use_truetype) |
1089 | 1083 | { |
1090 | - if ($this->wm_use_drop_shadow) |
|
1091 | - imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); |
|
1084 | + if ($this->wm_use_drop_shadow) { |
|
1085 | + imagettftext($src_img, $this->wm_font_size, 0, $x_shad, $y_shad, $drp_color, $this->wm_font_path, $this->wm_text); |
|
1086 | + } |
|
1092 | 1087 | imagettftext($src_img, $this->wm_font_size, 0, $x_axis, $y_axis, $txt_color, $this->wm_font_path, $this->wm_text); |
1093 | - } |
|
1094 | - else |
|
1088 | + } else |
|
1095 | 1089 | { |
1096 | - if ($this->wm_use_drop_shadow) |
|
1097 | - imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); |
|
1090 | + if ($this->wm_use_drop_shadow) { |
|
1091 | + imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color); |
|
1092 | + } |
|
1098 | 1093 | imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color); |
1099 | 1094 | } |
1100 | 1095 | |
@@ -1102,8 +1097,7 @@ discard block |
||
1102 | 1097 | if ($this->dynamic_output == TRUE) |
1103 | 1098 | { |
1104 | 1099 | $this->image_display_gd($src_img); |
1105 | - } |
|
1106 | - else |
|
1100 | + } else |
|
1107 | 1101 | { |
1108 | 1102 | $this->image_save_gd($src_img); |
1109 | 1103 | } |
@@ -1127,11 +1121,13 @@ discard block |
||
1127 | 1121 | */ |
1128 | 1122 | function image_create_gd($path = '', $image_type = '') |
1129 | 1123 | { |
1130 | - if ($path == '') |
|
1131 | - $path = $this->full_src_path; |
|
1124 | + if ($path == '') { |
|
1125 | + $path = $this->full_src_path; |
|
1126 | + } |
|
1132 | 1127 | |
1133 | - if ($image_type == '') |
|
1134 | - $image_type = $this->image_type; |
|
1128 | + if ($image_type == '') { |
|
1129 | + $image_type = $this->image_type; |
|
1130 | + } |
|
1135 | 1131 | |
1136 | 1132 | |
1137 | 1133 | switch ($image_type) |
@@ -1280,11 +1276,13 @@ discard block |
||
1280 | 1276 | */ |
1281 | 1277 | function image_reproportion() |
1282 | 1278 | { |
1283 | - if ( ! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) |
|
1284 | - return; |
|
1279 | + if ( ! is_numeric($this->width) OR ! is_numeric($this->height) OR $this->width == 0 OR $this->height == 0) { |
|
1280 | + return; |
|
1281 | + } |
|
1285 | 1282 | |
1286 | - if ( ! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) |
|
1287 | - return; |
|
1283 | + if ( ! is_numeric($this->orig_width) OR ! is_numeric($this->orig_height) OR $this->orig_width == 0 OR $this->orig_height == 0) { |
|
1284 | + return; |
|
1285 | + } |
|
1288 | 1286 | |
1289 | 1287 | $new_width = ceil($this->orig_width*$this->height/$this->orig_height); |
1290 | 1288 | $new_height = ceil($this->width*$this->orig_height/$this->orig_width); |
@@ -1301,8 +1299,7 @@ discard block |
||
1301 | 1299 | if ($this->master_dim == 'height') |
1302 | 1300 | { |
1303 | 1301 | $this->width = $new_width; |
1304 | - } |
|
1305 | - else |
|
1302 | + } else |
|
1306 | 1303 | { |
1307 | 1304 | $this->height = $new_height; |
1308 | 1305 | } |
@@ -1325,8 +1322,9 @@ discard block |
||
1325 | 1322 | // For now we require GD but we should |
1326 | 1323 | // find a way to determine this using IM or NetPBM |
1327 | 1324 | |
1328 | - if ($path == '') |
|
1329 | - $path = $this->full_src_path; |
|
1325 | + if ($path == '') { |
|
1326 | + $path = $this->full_src_path; |
|
1327 | + } |
|
1330 | 1328 | |
1331 | 1329 | if ( ! file_exists($path)) |
1332 | 1330 | { |
@@ -1391,8 +1389,9 @@ discard block |
||
1391 | 1389 | |
1392 | 1390 | foreach ($allowed as $item) |
1393 | 1391 | { |
1394 | - if ( ! isset($vals[$item]) OR $vals[$item] == '') |
|
1395 | - $vals[$item] = 0; |
|
1392 | + if ( ! isset($vals[$item]) OR $vals[$item] == '') { |
|
1393 | + $vals[$item] = 0; |
|
1394 | + } |
|
1396 | 1395 | } |
1397 | 1396 | |
1398 | 1397 | if ($vals['width'] == 0 OR $vals['height'] == 0) |
@@ -1403,8 +1402,7 @@ discard block |
||
1403 | 1402 | if ($vals['new_width'] == 0) |
1404 | 1403 | { |
1405 | 1404 | $vals['new_width'] = ceil($vals['width']*$vals['new_height']/$vals['height']); |
1406 | - } |
|
1407 | - elseif ($vals['new_height'] == 0) |
|
1405 | + } elseif ($vals['new_height'] == 0) |
|
1408 | 1406 | { |
1409 | 1407 | $vals['new_height'] = ceil($vals['new_width']*$vals['height']/$vals['width']); |
1410 | 1408 | } |
@@ -1501,8 +1499,7 @@ discard block |
||
1501 | 1499 | $this->error_msg[] = $msg; |
1502 | 1500 | log_message('error', $msg); |
1503 | 1501 | } |
1504 | - } |
|
1505 | - else |
|
1502 | + } else |
|
1506 | 1503 | { |
1507 | 1504 | $msg = ($CI->lang->line($msg) == FALSE) ? $msg : $CI->lang->line($msg); |
1508 | 1505 | $this->error_msg[] = $msg; |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | var $active = TRUE; |
32 | 32 | var $results = array(); |
33 | 33 | var $strict = FALSE; |
34 | - var $_template = NULL; |
|
35 | - var $_template_rows = NULL; |
|
36 | - var $_test_items_visible = array(); |
|
34 | + var $_template = NULL; |
|
35 | + var $_template_rows = NULL; |
|
36 | + var $_test_items_visible = array(); |
|
37 | 37 | |
38 | 38 | public function __construct() |
39 | 39 | { |
40 | 40 | // These are the default items visible when a test is run. |
41 | - $this->_test_items_visible = array ( |
|
41 | + $this->_test_items_visible = array( |
|
42 | 42 | 'test_name', |
43 | 43 | 'test_datatype', |
44 | 44 | 'res_datatype', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $back = $this->_backtrace(); |
110 | 110 | |
111 | - $report[] = array ( |
|
111 | + $report[] = array( |
|
112 | 112 | 'test_name' => $test_name, |
113 | 113 | 'test_datatype' => gettype($test), |
114 | 114 | 'res_datatype' => $extype, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $result = $this->result(); |
141 | 141 | } |
142 | 142 | |
143 | - $CI =& get_instance(); |
|
143 | + $CI = & get_instance(); |
|
144 | 144 | $CI->load->language('unit_test'); |
145 | 145 | |
146 | 146 | $this->_parse_template(); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | function result($results = array()) |
222 | 222 | { |
223 | - $CI =& get_instance(); |
|
223 | + $CI = & get_instance(); |
|
224 | 224 | $CI->load->language('unit_test'); |
225 | 225 | |
226 | 226 | if (count($results) == 0) |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -95,13 +97,13 @@ discard block |
||
95 | 97 | $expected = str_replace('is_float', 'is_double', $expected); |
96 | 98 | $result = ($expected($test)) ? TRUE : FALSE; |
97 | 99 | $extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected)); |
98 | - } |
|
99 | - else |
|
100 | + } else |
|
100 | 101 | { |
101 | - if ($this->strict == TRUE) |
|
102 | - $result = ($test === $expected) ? TRUE : FALSE; |
|
103 | - else |
|
104 | - $result = ($test == $expected) ? TRUE : FALSE; |
|
102 | + if ($this->strict == TRUE) { |
|
103 | + $result = ($test === $expected) ? TRUE : FALSE; |
|
104 | + } else { |
|
105 | + $result = ($test == $expected) ? TRUE : FALSE; |
|
106 | + } |
|
105 | 107 | |
106 | 108 | $extype = gettype($expected); |
107 | 109 | } |
@@ -157,8 +159,7 @@ discard block |
||
157 | 159 | if ($val == $CI->lang->line('ut_passed')) |
158 | 160 | { |
159 | 161 | $val = '<span style="color: #0C0;">'.$val.'</span>'; |
160 | - } |
|
161 | - elseif ($val == $CI->lang->line('ut_failed')) |
|
162 | + } elseif ($val == $CI->lang->line('ut_failed')) |
|
162 | 163 | { |
163 | 164 | $val = '<span style="color: #C00;">'.$val.'</span>'; |
164 | 165 | } |
@@ -249,8 +250,7 @@ discard block |
||
249 | 250 | } |
250 | 251 | $temp[$CI->lang->line('ut_'.$k)] = $v; |
251 | 252 | } |
252 | - } |
|
253 | - else |
|
253 | + } else |
|
254 | 254 | { |
255 | 255 | if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val)))) |
256 | 256 | { |