summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-01-18 13:51:39 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-01-18 13:51:39 -0500
commit7d759989e585cfec0ad62ea1373fbf61da71999e (patch)
tree849ad4ca24b51593ee4ba81e6cb90f6dd002a310
parent8627b174b04831a34dec9e74678958e83943437f (diff)
parentdffe24be0153e5cfd3d99068f7b7f36b92795121 (diff)
downloadpfsense-7d759989e585cfec0ad62ea1373fbf61da71999e.zip
pfsense-7d759989e585cfec0ad62ea1373fbf61da71999e.tar.gz
Merge pull request #2467 from NewEraCracker/widget-tunes
-rw-r--r--src/usr/local/www/index.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index 3816c0a..c9b60a8 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -120,15 +120,15 @@ $dirhandle = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
+ if (!stristr($filename, ".inc")) {
+ continue;
+ }
$phpincludefiles[] = $filename;
}
## Include each widget include file.
## These define vars that specify the widget title and title link.
foreach ($phpincludefiles as $includename) {
- if (!stristr($includename, ".inc")) {
- continue;
- }
if (file_exists($directory . $includename)) {
include($directory . $includename);
}
@@ -140,7 +140,7 @@ foreach (glob("/usr/local/www/widgets/widgets/*.widget.php") as $file) {
// Get the widget title that should be in a var defined in the widget's inc file.
$widgettitle = ${$name . '_title'};
- if ((strlen($widgettitle) == 0)) {
+ if (empty(trim($widgettitle))) {
// Fall back to constructing a title from the file name of the widget.
$widgettitle = ucwords(str_replace('_', ' ', $name));
}
@@ -277,7 +277,7 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") {
// Get the widget title that should be in a var defined in the widget's inc file.
$widgettitle = ${$file . '_title'};
- if ((strlen($widgettitle) == 0)) {
+ if (empty(trim($widgettitle))) {
// Fall back to constructing a title from the file name of the widget.
$widgettitle = ucwords(str_replace('_', ' ', $file));
}
@@ -328,12 +328,8 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
<?php
// Build the Available Widgets table using a sorted copy of the $widgets array
-function wgtcmp($a, $b) {
- return(strtolower($a['name']) > strtolower($b['name']));
-}
-
$available = $widgets;
-uasort($available, 'wgtcmp');
+uasort($available, function($a, $b){ return strcasecmp($a['name'], $b['name']); });
foreach ($available as $widgetname => $widgetconfig):
if ($widgetconfig['display'] == 'none'):
OpenPOWER on IntegriCloud