예제 #1
0
/**
 * load all blocks
 * @return array array of blocks
 */
function pnBlockLoadAll()
{
    // Load core and old-style blocks
    $dib = opendir('includes/blocks/');
    while ($f = readdir($dib)) {
        // itevo
        if (substr($f, -4) == ".php") {
            // itevo
            $block = substr($f, 0, -4);
            pnBlockLoad('Core', $block);
        }
    }
    closedir($dib);
    // Load new-style blocks from system and modules tree
    $mods = pnModGetAllMods();
    //while (list($name, $directory, $mid) = $result->fields) {
    foreach ($mods as $mod) {
        $name = $mod['name'];
        $directory = $mod['directory'];
        $blockdir = 'modules/' . pnVarPrepForOS($directory) . '/pnblocks';
        if (!@is_dir($blockdir)) {
            continue;
        }
        $dib = opendir($blockdir);
        while ($f = readdir($dib)) {
            // itevo
            if (substr($f, -4) == ".php") {
                // itevo
                $block = substr($f, 0, -4);
                pnBlockLoad($name, $block);
            }
        }
    }
    // Return information gathered
    return $GLOBALS['blocks_modules'];
}
예제 #2
0
/**
 * get list of administration modules
 * @author Jim McDonald <*****@*****.**>
 * @link http://www.mcdee.net
 * @return array array of module information arrays
 */
function pnModGetAdminMods()
{
    static $adminmods = array();
    if (empty($adminmods)) {
        $mods = pnModGetAllMods();
        foreach ($mods as $mod) {
            if ($mod['admin_capable']) {
                array_push($adminmods, $mod);
            }
        }
    }
    return $adminmods;
}