  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: shipping.php 425 2006-02-14 11:31:42Z hpdl $ |
| |
| 3 | + | $Id: shipping.php 427 2006-02-14 13:17:50Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
43 | 43 | | $Qmodules->freeResult(); |
| |
44 | 44 | | |
| |
45 | 45 | | if (empty($this->_modules) === false) { |
  |
46 | | - | $include_modules = array(); |
| |
47 | | - | |
|
48 | 46 | | if ((empty($module) === false) && in_array(substr($module['id'], 0, strpos($module['id'], '_')), $this->_modules)) { |
  |
49 | | - | $include_modules[] = array('class' => 'osC_Shipping_' . substr($module['id'], 0, strpos($module['id'], '_')), |
| |
50 | | - | 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr(basename(__FILE__), (strrpos(basename(__FILE__), '.')+1))); |
| |
51 | | - | } else { |
| |
52 | | - | foreach ($this->_modules as $value) { |
| |
53 | | - | $include_modules[] = array('class' => 'osC_Shipping_' . $value, |
| |
54 | | - | 'file' => $value . '.' . substr(basename(__FILE__), (strrpos(basename(__FILE__), '.')+1))); |
| |
55 | | - | } |
| |
| 47 | + | $this->_modules = array($module['id']); |
|
56 | 48 | | } |
| |
57 | 49 | | |
| |
58 | 50 | | $osC_Language->load('modules-shipping'); |
| |
59 | 51 | | |
  |
60 | | - | foreach ($include_modules as $module) { |
| |
61 | | - | include('includes/modules/shipping/' . $module['file']); |
| |
| 52 | + | foreach ($this->_modules as $module) { |
| |
| 53 | + | include('includes/modules/shipping/' . $module . '.' . substr(basename(__FILE__), (strrpos(basename(__FILE__), '.')+1))); |
|
62 | 54 | | |
  |
63 | | - | $GLOBALS[$module['class']] = new $module['class'](); |
| |
64 | | - | $GLOBALS[$module['class']]->initialize(); |
| |
| 55 | + | $module_class = 'osC_Shipping_' . $module; |
| |
| 56 | + | |
| |
| 57 | + | $GLOBALS[$module_class] = new $module_class(); |
| |
| 58 | + | $GLOBALS[$module_class]->initialize(); |
|
65 | 59 | | } |
  |
| 60 | + | |
| |
| 61 | + | usort($this->_modules, array('osC_Shipping', '_usortModules')); |
|
66 | 62 | | } |
| |
67 | 63 | | } |
| |
68 | 64 | | |
| |
|
|
 |
… |
|
272 | 268 | | osC_Cache::clear('languages'); |
| |
273 | 269 | | } |
| |
274 | 270 | | } |
  |
| 271 | + | |
| |
| 272 | + | function _usortModules($a, $b) { |
| |
| 273 | + | if ($GLOBALS['osC_Shipping_' . $a]->sort_order == $GLOBALS['osC_Shipping_' . $b]->sort_order) { |
| |
| 274 | + | return strnatcasecmp($GLOBALS['osC_Shipping_' . $a]->title, $GLOBALS['osC_Shipping_' . $a]->title); |
| |
| 275 | + | } |
| |
| 276 | + | |
| |
| 277 | + | return ($GLOBALS['osC_Shipping_' . $a]->sort_order < $GLOBALS['osC_Shipping_' . $b]->sort_order) ? -1 : 1; |
| |
| 278 | + | } |
  |
275 | 279 | | } |
| |
276 | 280 | | ?> |