function wppa_is_album_new($id)
{
    global $wpdb;
    $album = wppa_cache_album($id);
    $birthtime = $album['timestamp'];
    $timnow = time();
    $isnew = $timnow - $birthtime < wppa_opt('max_album_newtime');
    if ($isnew) {
        return true;
    }
    // A new ( grand )child?
    $children = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s", $id), ARRAY_A);
    wppa_dbg_q('Q-ian');
    if ($children) {
        foreach ($children as $child) {
            if (wppa_is_album_new($child['id'])) {
                return true;
            }
            // Found one? Done!
        }
    }
    return false;
}
function wppa_is_album_new($id)
{
    global $wpdb;
    global $wppa_children;
    // Feature enabled?
    if (!wppa_opt('max_album_newtime')) {
        return false;
    }
    // See if album self is new
    $album = wppa_cache_album($id);
    $birthtime = $album['timestamp'];
    $timnow = time();
    $isnew = $timnow - $birthtime < wppa_opt('max_album_newtime');
    if ($isnew) {
        return true;
    }
    // A new ( grand )child?
    if (isset($wppa_children[$id])) {
        $children = $wppa_children[$id];
    } else {
        $children = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s", $id), ARRAY_A);
        $wppa_children[$id] = $children;
    }
    if ($children) {
        foreach ($children as $child) {
            if (wppa_is_album_new($child['id'])) {
                return true;
            }
            // Found one? Done!
        }
    }
    return false;
}
Ejemplo n.º 3
0
function wppa_the_album_title($alb, $href_title, $onclick_title, $title, $target)
{
    global $wppa;
    $album = wppa_cache_album($alb);
    $wppa['out'] .= wppa_nltab('+') . '<h2 class="wppa-title" style="clear:none; ' . __wcs('wppa-title') . '">';
    if ($href_title) {
        if ($href_title == '#') {
            $wppa['out'] .= wppa_nltab() . '<a onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="cursor:pointer; ' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>';
        } else {
            $wppa['out'] .= wppa_nltab() . '<a href="' . $href_title . '" target="' . $target . '" onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>';
        }
    } else {
        $wppa['out'] .= wppa_get_album_name($alb);
    }
    if (wppa_is_album_new($alb)) {
        $wppa['out'] .= wppa_nltab() . '<img src="' . WPPA_URL . '/images/new.png" title="' . __a('New!') . '" class="wppa-albumnew" style="border:none; margin:0; padding:0; box-shadow:none; " alt="' . __a('New') . '" />';
    }
    $wppa['out'] .= wppa_nltab('-') . '</h2>';
}
function wppa_the_album_title($alb, $href_title, $onclick_title, $title, $target)
{
    $album = wppa_cache_album($alb);
    wppa_out('<h2 class="wppa-title" style="clear:none; ' . __wcs('wppa-title') . '">');
    if ($href_title) {
        if ($href_title == '#') {
            wppa_out('<a onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="cursor:pointer; ' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        } else {
            wppa_out('<a href="' . $href_title . '" target="' . $target . '" onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        }
    } else {
        wppa_out(wppa_get_album_name($alb));
    }
    $fsize = '12';
    if (wppa_is_album_new($alb)) {
        $type = 'new';
    } elseif (wppa_is_album_modified($alb)) {
        $type = 'mod';
    } else {
        $type = '';
    }
    $do_image = !wppa_switch('wppa_new_mod_label_is_text');
    if ($type) {
        if ($do_image) {
            wppa_out('<img' . ' src="' . wppa_opt($type . '_label_url') . '"' . ' title="' . __('New!', 'wp-photo-album-plus') . '"' . ' class="wppa-albumnew"' . ' style="border:none;margin:0;padding:0;box-shadow:none;"' . ' alt="' . __('New', 'wp-photo-album-plus') . '"' . ' />');
        } else {
            wppa_out(' <div' . ' style="' . 'display:inline;' . 'box-sizing:border-box;' . 'font-size:' . $fsize . 'px;' . 'line-height:' . $fsize . 'px;' . 'font-family:\'Arial Black\', Gadget, sans-serif;' . 'border-radius:4px;' . 'border-width:2px;' . 'border-style:solid;' . wppa_get_text_medal_color_style($type, '2') . '"' . ' >' . '&nbsp;' . __(wppa_opt($type . '_label_text')) . '&nbsp;' . '</div>');
        }
    }
    wppa_out('</h2>');
}
function wppa_the_album_title($alb, $href_title, $onclick_title, $title, $target)
{
    $album = wppa_cache_album($alb);
    wppa_out('<h2 class="wppa-title" style="clear:none; ' . __wcs('wppa-title') . '">');
    if ($href_title) {
        if ($href_title == '#') {
            wppa_out('<a onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="cursor:pointer; ' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        } else {
            wppa_out('<a href="' . $href_title . '" target="' . $target . '" onclick="' . $onclick_title . '" title="' . $title . '" class="wppa-title" style="' . __wcs('wppa-title') . '">' . wppa_get_album_name($alb) . '</a>');
        }
    } else {
        wppa_out(wppa_get_album_name($alb));
    }
    // Photo count?
    if (wppa_opt('count_on_title') != '-none-') {
        if (wppa_opt('count_on_title') == 'self') {
            $cnt = wppa_get_photo_count($alb);
        }
        if (wppa_opt('count_on_title') == 'total') {
            $temp = wppa_treecount_a($alb);
            $cnt = $temp['photos'];
            if (current_user_can('wppa_moderate')) {
                $cnt += $temp['pendphotos'];
            }
        }
        if ($cnt) {
            wppa_out(' <span class="wppa-cover-pcount" >(' . $cnt . ')</span>');
        }
    }
    $fsize = '12';
    if (wppa_is_album_new($alb)) {
        $type = 'new';
    } elseif (wppa_is_album_modified($alb)) {
        $type = 'mod';
    } else {
        $type = '';
    }
    $do_image = !wppa_switch('new_mod_label_is_text');
    if ($type) {
        if ($do_image) {
            wppa_out('<img' . ' src="' . wppa_opt($type . '_label_url') . '"' . ' title="' . __('New!', 'wp-photo-album-plus') . '"' . ' class="wppa-albumnew"' . ' style="border:none;margin:0;padding:0;box-shadow:none;"' . ' alt="' . __('New', 'wp-photo-album-plus') . '"' . ' />');
        } else {
            wppa_out(' <span' . ' style="' . 'display:inline;' . 'box-sizing:border-box;' . 'font-size:' . $fsize . 'px;' . 'line-height:' . $fsize . 'px;' . 'font-family:\'Arial Black\', Gadget, sans-serif;' . 'border-radius:4px;' . 'border-width:2px;' . 'border-style:solid;' . wppa_get_text_medal_color_style($type, '2') . '"' . ' >' . '&nbsp;' . __(wppa_opt($type . '_label_text')) . '&nbsp;' . '</span>');
        }
    }
    wppa_out('</h2>');
}