本文整理匯總了PHP中misc::arrlist_multisort方法的典型用法代碼示例。如果您正苦於以下問題:PHP misc::arrlist_multisort方法的具體用法?PHP misc::arrlist_multisort怎麽用?PHP misc::arrlist_multisort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類misc
的用法示例。
在下文中一共展示了misc::arrlist_multisort方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_plugins
public static function get_plugins(&$conf, $force = 0)
{
// 緩存結果
static $plugins = array();
if (!empty($plugins) && !$force) {
return $plugins;
}
if (empty($conf['plugin_path'])) {
return array();
}
$path = $conf['plugin_path'];
if (!is_dir($path)) {
return array();
}
$settingfile = $conf['upload_path'] . 'plugin.json';
$setting = is_file($settingfile) ? (array) core::json_decode(file_get_contents($settingfile)) : array();
$arr = self::get_paths($path);
foreach ($arr as $v) {
$conffile = $path . $v . '/conf.php';
$pconf = is_file($conffile) ? (array) (include $conffile) : array();
!isset($pconf['enable']) && ($pconf['enable'] = isset($setting[$v]['enable']) ? $setting[$v]['enable'] : 0);
!isset($pconf['installed']) && ($pconf['installed'] = isset($setting[$v]['installed']) ? $setting[$v]['installed'] : 0);
!isset($pconf['pluginid']) && ($pconf['pluginid'] = isset($setting[$v]['pluginid']) ? $setting[$v]['pluginid'] : 0);
!isset($pconf['rank']) && ($pconf['rank'] = isset($setting[$v]['rank']) ? $setting[$v]['rank'] : 100);
// 按照正序排序
$plugins[$v] = $pconf;
}
//第二次根據 rank 排序
misc::arrlist_multisort($plugins, 'rank');
return $plugins;
}