コード例 #1
0
function _wppa_alb_to_enum_children($alb)
{
    global $wpdb;
    static $child_cache;
    // Done this one before?
    if (isset($child_cache[$alb])) {
        return $child_cache[$alb];
    }
    // Get the data
    $result = $alb;
    $children = $wpdb->get_results($wpdb->prepare("SELECT `id` FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s", $alb), ARRAY_A);
    if ($children) {
        foreach ($children as $child) {
            $result .= '.' . _wppa_alb_to_enum_children($child['id']);
            $result = trim($result, '.');
        }
    }
    // Store in cache
    $child_cache[$alb] = $result;
    // Return requested data
    return $child_cache[$alb];
}
コード例 #2
0
function _wppa_alb_to_enum_children($alb)
{
    global $wpdb;
    $result = $alb;
    $children = $wpdb->get_results($wpdb->prepare("SELECT `id` FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s", $alb), ARRAY_A);
    if ($children) {
        foreach ($children as $child) {
            $result .= '.' . _wppa_alb_to_enum_children($child['id']);
            $result = trim($result, '.');
        }
    }
    return trim($result, '.');
}