Yeah I thought that might be the case. I was trying to get a check-box control working with my themes admin options but the value wont save when changing from "false" to "true". If you manage to patch this I would really appreciate it if you could post a fix here in the forums or maybe update the Google code repository?
Also encase your interested, I have added below a few functions you may like to replace when including the themes extensions. I'm not sure how this competes as far as performance goes but you can differently use it for more than including files.
Add these functions to: library.functions.helper.php
/**
* Utility method for searching an array for key value pairs.
* @since 1.0
* @param array $array
* @param string $key
* @param string $value
* @return array $results
* @access public
*/
function scan_array($array, $key, $value)
{
$results = array();
if (is_array($array))
{
if ($array[$key] == $value)
{
$results[] = $array;
}
foreach ($array as $subarray)
{
$results = array_merge($results, scan_array($subarray, $key, $value));
}
}
return $results;
}
/**
* Utility method for scanning a directory for folders and files.
* @since 1.0
* @param string $directory
* @param integer $depth
* @param string $extension
* @return array $directory_tree
* @access public
*/
function scan_directory($directory, $depth = 1, $extension = false)
{
if (substr($directory, -1) == '/')
{
$directory = substr($directory, 0, -1);
}
if (!file_exists($directory) || !is_dir($directory))
{
return false;
}
elseif (is_readable($directory))
{
$directory_list = opendir($directory);
while (($file = readdir($directory_list)))
{
if ($file !== '.' && $file !== '..')
{
$path = $directory.'/'.$file;
if (is_readable($path))
{
$subdirectories = explode('/',$path);
if (is_dir($path) && $depth > 1)
{
$directory_tree[] = array(
'path' => $path,
'name' => end($subdirectories),
'kind' => 'directory',
'content' => scan_directory($path, $depth -1, $extension));
}
elseif (is_file($path))
{
$file_extension = end(explode('.', end($subdirectories)));
if ($extension === false || $extension == $file_extension)
{
$directory_tree[] = array(
'path' => $path,
'name' => end($subdirectories),
'extension' => $file_extension,
'size' => filesize($path),
'kind' => 'file');
}
}
}
}
}
closedir($directory_list);
return $directory_tree;
}
else
{
return false;
}
}
/**
* Utility method for scanning a directory for files.
* @since 1.0
* @param string $directory
* @param integer $depth
* @param string $extension
* @return array $directory_tree
* @access public
*/
function scan_files($directory, $depth = 1, $extension = false)
{
$files = scan_directory($directory, $depth, $extension);
if ($files)
{
$files = scan_array($files, 'kind', 'file');
}
return $files;
}
And then your function extensions() within library.functions.framework.php
could look something like.
function extensions()
{
$plugins = scan_files(THEMEMORE, 2, 'php');
if ($plugins)
{
if (!function_exists('get_plugin_data'))
{
require_once(ABSPATH.'/wp-admin/includes/plugin.php');
}
foreach ($plugins as $plugin)
{
$data = get_plugin_data($plugin['path']);
if (!empty($data['Name']) && !empty($data['Description']))
{
require_once($plugin['path']);
}
}
}
}