|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79634 - website/public_html/beta/common/code
From: dnljms_at_[hidden]
Date: 2012-07-21 03:18:51
Author: danieljames
Date: 2012-07-21 03:18:50 EDT (Sat, 21 Jul 2012)
New Revision: 79634
URL: http://svn.boost.org/trac/boost/changeset/79634
Log:
Website: Function for sort function callback.
Text files modified:
website/public_html/beta/common/code/boost_feed.php | 3 +--
website/public_html/beta/common/code/boost_libraries.php | 6 ++----
website/public_html/beta/common/code/boost_utility.php | 10 ++++++++++
3 files changed, 13 insertions(+), 6 deletions(-)
Modified: website/public_html/beta/common/code/boost_feed.php
==============================================================================
--- website/public_html/beta/common/code/boost_feed.php (original)
+++ website/public_html/beta/common/code/boost_feed.php 2012-07-21 03:18:50 EDT (Sat, 21 Jul 2012)
@@ -98,8 +98,7 @@
function sort_by($field)
{
- $f = '_field_cmp_'.strtolower(str_replace('-','_',$field)).'_';
- uasort($this->db,$f);
+ uasort($this->db, sort_by_field($field));
}
function echo_download_table($guid)
Modified: website/public_html/beta/common/code/boost_libraries.php
==============================================================================
--- website/public_html/beta/common/code/boost_libraries.php (original)
+++ website/public_html/beta/common/code/boost_libraries.php 2012-07-21 03:18:50 EDT (Sat, 21 Jul 2012)
@@ -118,15 +118,13 @@
function sort_by($field)
{
- $f = '_field_cmp_'.strtolower(str_replace('-','_',$field)).'_';
- uasort($this->db, $f);
+ uasort($this->db, sort_by_field($field));
}
function get($sort = null, $filter = null) {
$libs = $filter ? array_filter($this->db, $filter) : $this->db;
if($sort) {
- $f = '_field_cmp_'.strtolower(str_replace('-','_',$sort)).'_';
- uasort($libs, $f);
+ uasort($libs, sort_by_field($sort));
}
return $libs;
}
Modified: website/public_html/beta/common/code/boost_utility.php
==============================================================================
--- website/public_html/beta/common/code/boost_utility.php (original)
+++ website/public_html/beta/common/code/boost_utility.php 2012-07-21 03:18:50 EDT (Sat, 21 Jul 2012)
@@ -6,6 +6,16 @@
*/
require_once(dirname(__FILE__) . '/boost.php');
+/**
+ * Return a callback to comparing the given field.
+ * @return callable
+ */
+
+function sort_by_field($field)
+{
+ return '_field_cmp_'.strtolower(str_replace('-','_',$field)).'_';
+}
+
function _field_cmp_($r,$a,$b)
{
if ($r == 0) { return _field_cmp_name_($a,$b); }
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk