sort settings/featured

This commit is contained in:
zotlabs 2018-03-02 12:41:50 -08:00
parent dbe73cdcbe
commit b38ce967f3
2 changed files with 22 additions and 3 deletions

View File

@ -57,7 +57,10 @@ class Featured {
} }
call_hooks('feature_settings', $settings_addons); call_hooks('feature_settings', $settings_addons);
$this->sortpanels($settings_addons);
$tpl = get_markup_template("settings_addons.tpl"); $tpl = get_markup_template("settings_addons.tpl");
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_featured"), '$form_security_token' => get_form_security_token("settings_featured"),
@ -67,5 +70,15 @@ class Featured {
)); ));
return $o; return $o;
} }
} function sortpanels(&$s) {
$a = explode('<div class="panel">',$s);
if($a) {
usort($a,'featured_sort');
$s = implode('<div class="panel">',$a);
}
}
}

View File

@ -3311,4 +3311,10 @@ function purify_filename($s) {
return $s; return $s;
} }
// callback for sorting the settings/featured entries.
function featured_sort($a,$b) {
$s1 = substr($a,strpos($a,'id='),20);
$s2 = substr($b,strpos($b,'id='),20);
return(strcmp($s1,$s2));
}