diff --git a/config/config.sample.php b/config/config.sample.php deleted file mode 100644 index 13bb96e..0000000 --- a/config/config.sample.php +++ /dev/null @@ -1,19 +0,0 @@ -id] = $obj; - } - array_multisort($order, SORT_ASC, $items); + +/** + * Helper function to sort items and agencies before generating + * @param array $items array of agency objects + * @param string $field field to sort by (optional, default ID) + * @param int $dir sort direction, either SORT_ASC or SORT_DESC (optional, default ASC) + */ +function dgs_sort( &$items, $field = 'id' , $dir = SORT_ASC ) { + + foreach ($items as $obj) + $order[ $obj->$field ] = $obj; + + array_multisort( $order, $dir, $items ); + } diff --git a/index.php b/index.php index 56eed40..fdc87eb 100644 --- a/index.php +++ b/index.php @@ -12,7 +12,6 @@ //output header dgs_header(); -dgs_sort($dgs_items); ?>

Slash Digital Strategy Generator

diff --git a/load.php b/load.php index f0acbdc..3dccfd8 100644 --- a/load.php +++ b/load.php @@ -34,25 +34,26 @@ // (3) Local /data/ directory, for non-expired cached files // (4) GSA GitHub Repo // (5) /config/ directory + // Note: change DGS_SCHEMA_BASE to FALSE and DGS_TTL to 0 in config.php to force local refresh //look for global var already established, no need to re-parse if ( isset( $$global_var ) ) continue; //check APC Cache, if it's installed - if ( DGS_REPORT_DIR && function_exists( 'apc_fetch' ) && $cache = apc_fetch ( $global_var ) ) { + if ( function_exists( 'apc_fetch' ) && $cache = apc_fetch ( $global_var ) ) { $$global_var = $cache->$plural; continue; } //look for /data/ files and parse (disk cache) - if ( DGS_REPORT_DIR && $file = dgs_get_disk_cache( $plural ) ) { + if ( $file = dgs_get_disk_cache( $plural ) ) { $$global_var = $file->$plural; continue; } //try GitHub (mmm... dogfood) - if ( DGS_REPORT_DIR && $file = dgs_get_live( $plural ) ) { + if ( DGS_SCHEMA_BASE && $file = dgs_get_live( $plural ) ) { $$global_var = $file->$plural; continue; }