00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class Helper extends Object {
00038
00039
00040
00041
00042
00043
00044 var $tags = array('link' => '<a href="%s" %s>%s</a>',
00045 'mailto' => '<a href="mailto:%s" %s>%s</a>',
00046 'form' => '<form %s>',
00047 'input' => '<input name="data[%s][%s]" %s/>',
00048 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>',
00049 'hidden' => '<input type="hidden" name="data[%s][%s]" %s/>',
00050 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>',
00051 'checkbox' => '<input type="checkbox" name="data[%s][%s]" %s/>',
00052 'radio' => '<input type="radio" name="data[%s][%s]" id="%s" %s />%s',
00053 'selectstart' => '<select name="data[%s][%s]" %s>',
00054 'selectmultiplestart' => '<select name="data[%s][%s][]" %s>',
00055 'selectempty' => '<option value="" %s> </option>',
00056 'selectoption' => '<option value="%s" %s>%s</option>',
00057 'selectend' => '</select>',
00058 'password' => '<input type="password" name="data[%s][%s]" %s/>',
00059 'file' => '<input type="file" name="data[%s][%s]" %s/>',
00060 'file_no_model' => '<input type="file" name="%s" %s/>',
00061 'submit' => '<input type="submit" %s/>',
00062 'image' => '<img src="%s" %s/>',
00063 'tableheader' => '<th%s>%s</th>',
00064 'tableheaderrow' => '<tr%s>%s</tr>',
00065 'tablecell' => '<td%s>%s</td>',
00066 'tablerow' => '<tr%s>%s</tr>',
00067 'block' => '<div%s>%s</div>',
00068 'blockstart' => '<div%s>',
00069 'blockend' => '</div>',
00070 'css' => '<link rel="%s" type="text/css" href="%s" %s/>',
00071 'style' => '<style type="text/css"%s>%s</style>',
00072 'charset' => '<meta http-equiv="Content-Type" content="text/html; charset=%s" />',
00073 'javascriptblock' => '<script type="text/javascript">%s</script>',
00074 'javascriptlink' => '<script type="text/javascript" src="%s"></script>');
00075
00076
00077
00078
00079
00080 function loadConfig() {
00081
00082 if (file_exists(APP . 'config' . DS . 'tags.ini.php')) {
00083 $tags = $this->readConfigFile(APP . 'config' . DS . 'tags.ini.php');
00084 $this->tags = am($this->tags, $tags);
00085 }
00086 return $this->tags;
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 function output($str, $return = false) {
00099 if (AUTO_OUTPUT && $return === false) {
00100 echo $str;
00101 } else {
00102 return $str;
00103 }
00104 }
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 function assign($keyName, $values) {
00116 return str_replace('%%' . array_keys($values) . '%%', array_values($values), $this->tags[$keyName]);
00117 }
00118
00119
00120
00121
00122
00123
00124 function readConfigFile($fileName) {
00125 $fileLineArray = file($fileName);
00126
00127 foreach ($fileLineArray as $fileLine) {
00128 $dataLine = trim($fileLine);
00129 $firstChar = substr($dataLine, 0, 1);
00130
00131 if ($firstChar != ';' && $dataLine != '') {
00132 if ($firstChar == '[' && substr($dataLine, -1, 1) == ']') {
00133
00134
00135
00136 } else {
00137 $delimiter = strpos($dataLine, '=');
00138
00139 if ($delimiter > 0) {
00140 $key = strtolower(trim(substr($dataLine, 0, $delimiter)));
00141 $value = trim(stripcslashes(substr($dataLine, $delimiter + 1)));
00142
00143 if (substr($value, 0, 1) == '"' && substr($value, -1) == '"') {
00144 $value = substr($value, 1, -1);
00145 }
00146
00147 $iniSetting[$key] = $value;
00148
00149 } else {
00150 $iniSetting[strtolower(trim($dataLine))] = '';
00151 }
00152 }
00153 } else {
00154 }
00155 }
00156
00157 return $iniSetting;
00158 }
00159
00160
00161
00162
00163
00164 function afterRender() {
00165 }
00166 }
00167 ?>