function sp_compile_forums_mobile($forums, $parent = 0, $level = 0, $valueURL = false)
{
    $out = '';
    $indent = '    ';
    foreach ($forums as $forum) {
        if ($forum->parent == $parent && $forum->forum_id != $parent) {
            $out .= '<p><a href="' . $forum->forum_permalink . '">';
            $out .= str_repeat($indent, $level) . sp_create_name_extract($forum->forum_name) . "</a></p>\n";
            if (!empty($forum->children)) {
                $out .= sp_compile_forums_mobile($forums, $forum->forum_id, $level + 1, $valueURL);
            }
        }
    }
    return $out;
}
function sp_QuickLinksForumMobile($args = '', $label = '')
{
    global $spThisUser;
    $defs = array('tagIdControl' => 'spQuickLinksForumMobile', 'tagClass' => 'spControl', 'tagIdList' => 'spQuickLinksMobileForumList', 'listClass' => 'spQuickLinksList', 'listDataClass' => 'spQuickLinksGroup', 'length' => 40, 'showSubs' => 1, 'openIcon' => 'sp_GroupOpen.png', 'closeIcon' => 'sp_GroupClose.png', 'echo' => 1);
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_QuickLinksForumMobile_args', $a);
    extract($a, EXTR_SKIP);
    # sanitize before use
    $tagIdControl = esc_attr($tagIdControl);
    $tagClass = esc_attr($tagClass);
    $tagIdList = esc_attr($tagIdList);
    $listClass = esc_attr($listClass);
    $listDataClass = esc_attr($listDataClass);
    $openIcon = sp_paint_file_icon(SPTHEMEICONSURL, sanitize_file_name($openIcon));
    $closeIcon = sp_paint_file_icon(SPTHEMEICONSURL, sanitize_file_name($closeIcon));
    $showSubs = (int) $showSubs;
    $length = (int) $length;
    $echo = (int) $echo;
    # load data and check if empty or denied
    $groups = new spGroupView('', false);
    if ($groups->groupViewStatus == 'no access' || $groups->groupViewStatus == 'no data') {
        return;
    }
    if (!empty($label)) {
        $label = sp_filter_title_display($label);
    }
    if (empty($length)) {
        $length = 40;
    }
    $level = 0;
    $indent = '&nbsp;&nbsp;';
    $out = '';
    if ($groups->pageData) {
        $out .= "<div class='{$tagClass}' id='{$tagIdControl}'>\n";
        $out .= "<p id='spQLFTitle' onclick='spjOpenQL(\"{$tagIdList}\", \"spQLFOpener\", \"{$openIcon}\", \"{$closeIcon}\");'>{$label}<span id='spQLFOpener'><img src='{$openIcon}' /></span></p>\n";
        $out .= "</div>";
        $out .= sp_InsertBreak('echo=false');
        $out .= "<div id='{$tagIdList}' class='{$listClass}' style='display:none'>\n";
        foreach ($groups->pageData as $group) {
            $out .= "<div class='{$listDataClass}'><div>" . esc_attr($indent . sp_create_name_extract($group->group_name)) . "</div>\n";
            if ($group->forums) {
                foreach ($group->forums as $forum) {
                    $out .= '<p><a href="' . $forum->forum_permalink . '">';
                    $out .= sp_create_name_extract($forum->forum_name, $length) . '</a></p>' . "\n";
                    if (!empty($forum->subforums) && $showSubs) {
                        $out .= sp_compile_forums_mobile($forum->subforums, $forum->forum_id, 1, true);
                    }
                }
            }
            $out .= "</div>\n";
        }
        $out .= "</div>\n";
    }
    $out = apply_filters('sph_QuickLinksForumMobile', $out, $a);
    if ($echo) {
        echo $out;
    } else {
        return $out;
    }
}