-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakerst.php
67 lines (60 loc) · 1.75 KB
/
makerst.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
mb_internal_encoding("UTF-8");
class Makerst {
var $_textdata;
var $_padded_textdata;
var $_maxlengthdata;
function __construct($textdata, $maxlengthdata) {
if (is_array($textdata)) {
$this->_textdata = $textdata;
}
if (is_array($maxlengthdata)) {
$this->_maxlengthdata = $maxlengthdata;
}
}
function _mb_str_pad($input, $length, $filltext=" ") {
if (1 != strlen($filltext)) {
$filltext = " ";
}
$filllen = $length - mb_strwidth($input);
if ($filllen > 0) {
for($j=0;$j<$filllen;$j++) {
$input .= " ";
}
}
return $input;
}
function lineout($separator=" ", $line="-") {
//$lineout = $separator;
$lineout = '';
foreach($this->_maxlengthdata as $val) {
for($i=0;$i<$val;$i++) {
$lineout .= $line;
}
$lineout .= $separator;
}
$lineout .= "\n";
return $lineout;
}
function _out($array, $separator=" ") {
if (is_array($array)) {
$len = count($this->_maxlengthdata);
//$outdata = $separator;
$outdata = '';
for($i=0; $i<$len; $i++) {
$outdata .= $this->_mb_str_pad($array[$i],$this->_maxlengthdata[$i]);
$outdata .= $separator;
}
return $outdata;
} else {
return false;
}
}
function outall($separator=" ") {
foreach ($this->_textdata as $arr){
$this->_padded_textdata .= $this->_out($arr,$separator);
$this->_padded_textdata .= "\n";
}
return $this->_padded_textdata;
}
}