| 1 |
<?php |
<?php |
| 2 |
// $Id: spaces.module,v 1.25.4.33.2.28 2009/09/05 21:56:45 yhahn Exp $ |
// $Id: spaces.module,v 1.25.4.33.2.29 2009/09/06 17:09:18 yhahn Exp $ |
| 3 |
|
|
| 4 |
define('SPACES_FEATURE_DISABLED', 0); |
define('SPACES_FEATURE_DISABLED', 0); |
| 5 |
|
|
| 744 |
// Weights are a bit trickier |
// Weights are a bit trickier |
| 745 |
// Sorting features in a preset according to their weights |
// Sorting features in a preset according to their weights |
| 746 |
if (isset($preset['weights']) && is_array($preset['weights'])) { |
if (isset($preset['weights']) && is_array($preset['weights'])) { |
| 747 |
|
// Exclude any weight values that don't correspond to entries in the features array. |
| 748 |
|
$preset['weights'] = array_intersect_key($preset['weights'], $space->features); |
| 749 |
|
|
| 750 |
|
// Fill in excessively high weight entries for any features that don't exist in |
| 751 |
|
// the weights array. |
| 752 |
|
$i = 0; |
| 753 |
|
foreach (array_diff_key($space->features, $preset['weights']) as $feature) { |
| 754 |
|
$preset['weights'][$feature] = 1000 + $i; |
| 755 |
|
$i++; |
| 756 |
|
} |
| 757 |
|
|
| 758 |
// Ensure the keys line up to begin with |
// Ensure the keys line up to begin with |
| 759 |
ksort($preset['weights']); |
ksort($preset['weights']); |
| 760 |
ksort($space->features); |
ksort($space->features); |