XOOPS Cube Legacy base repository
修订版 | 3057f07453c6dcaff1587f203c8c3a220294de62 (tree) |
---|---|
时间 | 2011-11-16 22:15:09 |
作者 | nbuy <nbuy@704c...> |
Commiter | nbuy |
revise for speedup
git-svn-id: https://xoopscube.svn.sourceforge.net/svnroot/xoopscube/Package_Legacy/trunk@1055 704cf05f-ae62-4b0e-a484-234ee0250e75
@@ -264,7 +264,7 @@ class Legacy_Controller extends XCube_Controller | ||
264 | 264 | $arr = localtime($iTime); |
265 | 265 | $arr[5] += 1900; |
266 | 266 | $arr[4]++; |
267 | - $iTztime = gmmktime($arr[2], $arr[1], $arr[0], $arr[4], $arr[3], $arr[5], $arr[8]); | |
267 | + $iTztime = gmmktime($arr[2], $arr[1], $arr[0], $arr[4], $arr[3], $arr[5]); | |
268 | 268 | $offset = doubleval(($iTztime-$iTime)/(60*60)); |
269 | 269 | $zonelist = |
270 | 270 | array |
@@ -775,17 +775,15 @@ class Legacy_Controller extends XCube_Controller | ||
775 | 775 | $dir = XOOPS_ROOT_PATH . '/modules/' . $mod_dir . $dirname . '/'; |
776 | 776 | if(is_dir($dir)) { |
777 | 777 | $files = glob($dir.'*.class.php'); |
778 | - if (is_array($files)) { | |
778 | + if ($files) { | |
779 | 779 | foreach($files as $file) { |
780 | 780 | require_once $file; |
781 | - if (preg_match("/(\w+)\.class\.php/", $file, $matches)) { | |
782 | - $className = ucfirst($mod_dir) . "_" . $matches[1]; | |
781 | + $className = ucfirst($mod_dir) . "_" . basename($file, '.class.php'); | |
783 | 782 | |
784 | 783 | if (XC_CLASS_EXISTS($className) && !isset($this->_mLoadedFilterNames[$className])) { |
785 | 784 | $this->_mLoadedFilterNames[$className] = true; |
786 | 785 | $this->addActionFilter(new $className($this)); |
787 | 786 | } |
788 | - } | |
789 | 787 | } |
790 | 788 | } |
791 | 789 | } |
@@ -61,7 +61,7 @@ class XoopsSimpleObject extends AbstractXoopsObject | ||
61 | 61 | 'data_type' => $dataType, |
62 | 62 | 'value' => null, |
63 | 63 | 'required' => $required ? true : false, |
64 | - 'maxlength' => $size ? intval($size) : null | |
64 | + 'maxlength' => $size ? (int)$size : null | |
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->assignVar($key, $value); |
@@ -75,28 +75,23 @@ class XoopsSimpleObject extends AbstractXoopsObject | ||
75 | 75 | switch ($vars['data_type']) { |
76 | 76 | case XOBJ_DTYPE_BOOL: |
77 | 77 | $vars['value'] = $value ? 1 : 0; |
78 | - break; | |
78 | + return; | |
79 | 79 | |
80 | 80 | case XOBJ_DTYPE_INT: |
81 | - $vars['value'] = $value !== null ? intval($value) : null; | |
82 | - break; | |
81 | + $vars['value'] = $value !== null ? (int)$value : null; | |
82 | + return; | |
83 | 83 | |
84 | 84 | case XOBJ_DTYPE_FLOAT: |
85 | - $vars['value'] = $value !== null ? floatval($value) : null; | |
86 | - break; | |
85 | + $vars['value'] = $value !== null ? (float)$value : null; | |
86 | + return; | |
87 | 87 | |
88 | 88 | case XOBJ_DTYPE_STRING: |
89 | - if ($vars['maxlength'] !== null && strlen($value) > $vars['maxlength']) { | |
90 | - $vars['value'] = xoops_substr($value, 0, $vars['maxlength'], null); | |
91 | - } | |
92 | - else { | |
93 | - $vars['value'] = $value; | |
94 | - } | |
95 | - break; | |
89 | + $vars['value'] = ($vars['maxlength'] !== null && strlen($value) > $vars['maxlength']) ? xoops_substr($value, 0, $vars['maxlength'], null) : $value; | |
90 | + return; | |
96 | 91 | |
97 | 92 | case XOBJ_DTYPE_TEXT: |
98 | 93 | $vars['value'] = $value; |
99 | - break; | |
94 | + return; | |
100 | 95 | } |
101 | 96 | } |
102 | 97 |
@@ -157,20 +152,17 @@ class XoopsSimpleObject extends AbstractXoopsObject | ||
157 | 152 | case XOBJ_DTYPE_BOOL: |
158 | 153 | case XOBJ_DTYPE_INT: |
159 | 154 | case XOBJ_DTYPE_FLOAT: |
160 | - $value = $vars['value']; | |
161 | - break; | |
155 | + return $vars['value']; | |
162 | 156 | |
163 | 157 | case XOBJ_DTYPE_STRING: |
164 | 158 | $root =& XCube_Root::getSingleton(); |
165 | 159 | $textFilter =& $root->getTextFilter(); |
166 | - $value = $textFilter->toShow($vars['value']); | |
167 | - break; | |
160 | + return $textFilter->toShow($vars['value']); | |
168 | 161 | |
169 | 162 | case XOBJ_DTYPE_TEXT: |
170 | 163 | $root =& XCube_Root::getSingleton(); |
171 | 164 | $textFilter =& $root->getTextFilter(); |
172 | - $value = $textFilter->toShowTarea($vars['value'], 0, 1, 1, 1, 1); | |
173 | - break; | |
165 | + return $textFilter->toShowTarea($vars['value'], 0, 1, 1, 1, 1); | |
174 | 166 | } |
175 | 167 | |
176 | 168 | return $value; |