• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wppa_cache_album函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wppa_cache_album函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_cache_album函数的具体用法?PHP wppa_cache_album怎么用?PHP wppa_cache_album使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wppa_cache_album函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wppa_do_frontend_file_upload

function wppa_do_frontend_file_upload($file, $alb)
{
    global $wpdb;
    // Log upload attempt
    wppa_log('Upl', 'FE Upload attempt of file ' . $file['name'] . ', size=' . filesize($file['tmp_name']));
    $album = wppa_cache_album($alb);
    if (!wppa_allow_uploads($alb) || !wppa_allow_user_uploads()) {
        wppa_alert(__('Max uploads reached', 'wp-photo-album-plus'));
        return false;
    }
    if ($file['error'] != '0') {
        wppa_alert(__('Error during upload', 'wp-photo-album-plus'));
        return false;
    }
    $imgsize = getimagesize($file['tmp_name']);
    if (!is_array($imgsize)) {
        wppa_alert(__('Uploaded file is not an image', 'wp-photo-album-plus'));
        return false;
    }
    if ($imgsize[2] < 1 || $imgsize[2] > 3) {
        wppa_alert(sprintf(__('Only gif, jpg and png image files are supported. Returned filetype = %d.', 'wp-photo-album-plus'), $imagesize[2]));
        return false;
    }
    $ms = wppa_opt('upload_fronend_maxsize');
    if ($ms) {
        // Max size configured
        if ($imgsize[0] > $ms || $imgsize[0] > $ms) {
            wppa_alert(sprintf(__('Uploaded file is larger than the allowed maximum of %d x %d pixels.', 'wp-photo-album-plus'), $ms, $ms));
            return false;
        }
    }
    if (wppa_switch('void_dups')) {
        // Check for already exists
        if (wppa_file_is_in_album(wppa_sanitize_file_name($file['name']), $alb)) {
            wppa_alert(sprintf(__('Uploaded file %s already exists in this album.', 'wp-photo-album-plus'), wppa_sanitize_file_name($file['name'])));
            return false;
        }
    }
    $mayupload = wppa_check_memory_limit('', $imgsize[0], $imgsize[1]);
    if ($mayupload === false) {
        $maxsize = wppa_check_memory_limit(false);
        if (is_array($maxsize)) {
            wppa_alert(sprintf(__('The image is too big. Max photo size: %d x %d (%2.1f MegaPixel)', 'wp-photo-album-plus'), $maxsize['maxx'], $maxsize['maxy'], $maxsize['maxp'] / (1024 * 1024)));
            return false;
        }
    }
    switch ($imgsize[2]) {
        // mime type
        case 1:
            $ext = 'gif';
            break;
        case 2:
            $ext = 'jpg';
            break;
        case 3:
            $ext = 'png';
            break;
    }
    if (wppa_get_post('user-name')) {
        $name = wppa_get_post('user-name');
    } else {
        $name = $file['name'];
    }
    $name = wppa_sanitize_photo_name($name);
    $desc = balanceTags(wppa_get_post('user-desc'), true);
    $linktarget = '_self';
    $status = wppa_switch('upload_moderate') && !current_user_can('wppa_admin') ? 'pending' : 'publish';
    $filename = wppa_sanitize_file_name($file['name']);
    $id = wppa_create_photo_entry(array('album' => $alb, 'ext' => $ext, 'name' => $name, 'description' => $desc, 'status' => $status, 'filename' => $filename));
    if (!$id) {
        wppa_alert(__('Could not insert photo into db.', 'wp-photo-album-plus'));
        return false;
    } else {
        wppa_save_source($file['tmp_name'], $filename, $alb);
        wppa_update_album(array('id' => $alb, 'modified' => time()));
        wppa_flush_treecounts($alb);
        wppa_flush_upldr_cache('photoid', $id);
    }
    if (wppa_make_the_photo_files($file['tmp_name'], $id, $ext)) {
        // Repair photoname if not standard
        if (!wppa_get_post('user-name')) {
            wppa_set_default_name($id, $file['name']);
        }
        // Custom data
        if (wppa_switch('fe_custom_fields')) {
            $custom_data = array('', '', '', '', '', '', '', '', '', '');
            for ($i = '0'; $i < '10'; $i++) {
                if (isset($_POST['wppa-user-custom-' . $i])) {
                    $custom_data[$i] = strip_tags($_POST['wppa-user-custom-' . $i]);
                }
            }
            wppa_update_photo(array('id' => $id, 'custom' => serialize($custom_data)));
        }
        // Default tags
        wppa_set_default_tags($id);
        // Custom tags
        $tags = wppa_get_photo_item($id, 'tags');
        $oldt = $tags;
        for ($i = '1'; $i < '4'; $i++) {
            if (isset($_POST['wppa-user-tags-' . $i])) {
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-functions.php


示例2: wppa_set_default_tags

function wppa_set_default_tags($id)
{
    global $wpdb;
    $thumb = wppa_cache_thumb($id);
    $album = wppa_cache_album($thumb['album']);
    $tags = wppa_sanitize_tags(str_replace(array('\'', '"'), ',', wppa_filter_iptc(wppa_filter_exif($album['default_tags'], $id), $id)));
    if ($tags) {
        wppa_update_photo(array('id' => $id, 'tags' => $tags));
        wppa_clear_taglist();
        wppa_cache_thumb('invalidate', $id);
    }
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:12,代码来源:wppa-utils.php


示例3: wppa_do_frontend_file_upload

function wppa_do_frontend_file_upload($file, $alb)
{
    global $wpdb;
    global $wppa_supported_video_extensions;
    global $wppa_supported_audio_extensions;
    // Log upload attempt
    wppa_log('Upl', 'FE Upload attempt of file ' . $file['name'] . ', size=' . filesize($file['tmp_name']));
    $album = wppa_cache_album($alb);
    // Legal here?
    if (!wppa_allow_uploads($alb) || !wppa_allow_user_uploads()) {
        wppa_alert(__('Max uploads reached', 'wp-photo-album-plus'));
        return false;
    }
    // No error during upload?
    if ($file['error'] != '0') {
        wppa_alert(__('Error during upload', 'wp-photo-album-plus'));
        return false;
    }
    // Find the filename
    $filename = wppa_sanitize_file_name($file['name']);
    $filename = wppa_strip_ext($filename);
    // See if this filename with any extension already exists in this album
    $id = $wpdb->get_var("SELECT `id` FROM `" . WPPA_PHOTOS . "` WHERE `filename` LIKE '" . $filename . ".%' AND `album` = " . $alb);
    // Addition to an av item?
    if ($id) {
        $is_av = wppa_get_photo_item($id, 'ext') == 'xxx';
    } else {
        $is_av = false;
    }
    // see if audio / video and process
    if (wppa_switch('enable_video') && wppa_switch('user_upload_video_on') && in_array(strtolower(wppa_get_ext($file['name'])), $wppa_supported_video_extensions) || wppa_switch('enable_audio') && wppa_switch('user_upload_audio_on') && in_array(strtolower(wppa_get_ext($file['name'])), $wppa_supported_audio_extensions)) {
        $is_av = true;
        // Find the name
        if (wppa_get_post('user-name')) {
            $name = wppa_get_post('user-name');
        } else {
            $name = $file['name'];
        }
        $name = wppa_sanitize_photo_name($name);
        $filename .= '.xxx';
        // update entry
        if ($id) {
            wppa_update_photo(array('id' => $id, 'ext' => 'xxx', 'filename' => $filename));
        }
        // Add new entry
        if (!$id) {
            $id = wppa_create_photo_entry(array('album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => $name, 'description' => balanceTags(wppa_get_post('user-desc'), true)));
            if (!$id) {
                wppa_alert(__('Could not insert media into db.', 'wp-photo-album-plus'));
                return false;
            }
        }
        // Housekeeping
        wppa_update_album(array('id' => $alb, 'modified' => time()));
        wppa_flush_treecounts($alb);
        wppa_flush_upldr_cache('photoid', $id);
        // Add video filetype
        $ext = strtolower(wppa_get_ext($file['name']));
        $newpath = wppa_strip_ext(wppa_get_photo_path($id)) . '.' . $ext;
        copy($file['tmp_name'], $newpath);
        // Repair name if not standard
        if (!wppa_get_post('user-name')) {
            wppa_set_default_name($id, $file['name']);
        }
        // tags
        wppa_fe_add_tags($id);
        // custom
        wppa_fe_add_custom($id);
        // Done!
        return $id;
    }
    // If not already an existing audio / video; Forget the id from a previously found item with the same filename.
    if (!$is_av) {
        $id = false;
    }
    // Is it an image?
    $imgsize = getimagesize($file['tmp_name']);
    if (!is_array($imgsize)) {
        wppa_alert(__('Uploaded file is not an image', 'wp-photo-album-plus'));
        return false;
    }
    // Is it a supported image filetype?
    if ($imgsize[2] != IMAGETYPE_GIF && $imgsize[2] != IMAGETYPE_JPEG && $imgsize[2] != IMAGETYPE_PNG) {
        wppa_alert(sprintf(__('Only gif, jpg and png image files are supported. Returned info = %s.', 'wp-photo-album-plus'), wppa_serialize($imgsize)), false, false);
        return false;
    }
    // Is it not too big?
    $ms = wppa_opt('upload_fronend_maxsize');
    if ($ms) {
        // Max size configured
        if ($imgsize[0] > $ms || $imgsize[1] > $ms) {
            wppa_alert(sprintf(__('Uploaded file is larger than the allowed maximum of %d x %d pixels.', 'wp-photo-album-plus'), $ms, $ms));
            return false;
        }
    }
    // Check for already exists
    if (wppa_switch('void_dups')) {
        if (wppa_file_is_in_album(wppa_sanitize_file_name($file['name']), $alb)) {
            wppa_alert(sprintf(__('Uploaded file %s already exists in this album.', 'wp-photo-album-plus'), wppa_sanitize_file_name($file['name'])));
            return false;
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-functions.php


示例4: wppa_do_maintenance_proc

function wppa_do_maintenance_proc($slug)
{
    global $wpdb;
    global $thumb;
    global $wppa_opt;
    global $wppa_session;
    global $wppa_supported_video_extensions;
    global $wppa_supported_audio_extensions;
    // Check for multiple maintenance procs
    if (!wppa_switch('wppa_maint_ignore_concurrency_error')) {
        $all_slugs = array('wppa_remake_index_albums', 'wppa_remove_empty_albums', 'wppa_remake_index_photos', 'wppa_apply_new_photodesc_all', 'wppa_append_to_photodesc', 'wppa_remove_from_photodesc', 'wppa_remove_file_extensions', 'wppa_readd_file_extensions', 'wppa_regen_thumbs', 'wppa_rerate', 'wppa_recup', 'wppa_file_system', 'wppa_cleanup', 'wppa_remake', 'wppa_list_index', 'wppa_blacklist_user', 'wppa_un_blacklist_user', 'wppa_rating_clear', 'wppa_viewcount_clear', 'wppa_iptc_clear', 'wppa_exif_clear', 'wppa_watermark_all', 'wppa_create_all_autopages', 'wppa_leading_zeros', 'wppa_add_gpx_tag', 'wppa_optimize_ewww', 'wppa_comp_sizes', 'wppa_edit_tag');
        foreach (array_keys($all_slugs) as $key) {
            if ($all_slugs[$key] != $slug) {
                if (get_option($all_slugs[$key] . '_togo', '0')) {
                    // Process running
                    return __('You can run only one maintenance procedure at a time', 'wppa') . '||' . $slug . '||' . __('Error', 'wppa') . '||' . '' . '||' . '';
                }
            }
        }
    }
    // Lock this proc
    update_option($slug . '_user', wppa_get_user());
    // Initialize
    $endtime = time() + '5';
    // Allow for 5 seconds
    $chunksize = '1000';
    $lastid = strval(intval(get_option($slug . '_last', '0')));
    $errtxt = '';
    $id = '0';
    $topid = '0';
    $reload = '';
    if (!isset($wppa_session)) {
        $wppa_session = array();
    }
    if (!isset($wppa_session[$slug . '_fixed'])) {
        $wppa_session[$slug . '_fixed'] = '0';
    }
    if (!isset($wppa_session[$slug . '_deleted'])) {
        $wppa_session[$slug . '_deleted'] = '0';
    }
    if (!isset($wppa_session[$slug . '_skipped'])) {
        $wppa_session[$slug . '_skipped'] = '0';
    }
    if ($lastid == '0') {
        $wppa_session[$slug . '_fixed'] = '0';
        $wppa_session[$slug . '_deleted'] = '0';
        $wppa_session[$slug . '_skipped'] = '0';
    }
    // Pre-processing needed?
    if ($lastid == '0') {
        switch ($slug) {
            case 'wppa_remake_index_albums':
                $wpdb->query("UPDATE `" . WPPA_INDEX . "` SET `albums` = ''");
                break;
            case 'wppa_remake_index_photos':
                $wpdb->query("UPDATE `" . WPPA_INDEX . "` SET `photos` = ''");
                wppa_index_compute_skips();
                break;
            case 'wppa_recup':
                $wpdb->query("DELETE FROM `" . WPPA_IPTC . "` WHERE `photo` <> '0'");
                $wpdb->query("DELETE FROM `" . WPPA_EXIF . "` WHERE `photo` <> '0'");
                break;
            case 'wppa_file_system':
                if (get_option('wppa_file_system') == 'flat') {
                    update_option('wppa_file_system', 'to-tree');
                }
                if (get_option('wppa_file_system') == 'tree') {
                    update_option('wppa_file_system', 'to-flat');
                }
                break;
            case 'wppa_cleanup':
                $orphan_album = get_option('wppa_orphan_album', '0');
                $album_exists = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM`" . WPPA_ALBUMS . "` WHERE `id` = %s", $orphan_album));
                if (!$album_exists) {
                    $orphan_album = false;
                }
                if (!$orphan_album) {
                    $orphan_album = wppa_create_album_entry(array('name' => __('Orphan photos', 'wppa'), 'a_parent' => '-1', 'description' => __('This album contains refound lost photos', 'wppa')));
                    update_option('wppa_orphan_album', $orphan_album);
                }
                break;
        }
    }
    // Dispatch on albums / photos / single actions
    switch ($slug) {
        case 'wppa_remake_index_albums':
        case 'wppa_remove_empty_albums':
            // Process albums
            $table = WPPA_ALBUMS;
            $topid = $wpdb->get_var("SELECT `id` FROM `" . WPPA_ALBUMS . "` ORDER BY `id` DESC LIMIT 1");
            $albums = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `id` > " . $lastid . " ORDER BY `id` LIMIT 100", ARRAY_A);
            wppa_cache_album('add', $albums);
            if ($albums) {
                foreach ($albums as $album) {
                    $id = $album['id'];
                    switch ($slug) {
                        case 'wppa_remake_index_albums':
                            wppa_index_add('album', $id);
                            break;
                        case 'wppa_remove_empty_albums':
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-maintenance.php


示例5: do_album_navigator

    function do_album_navigator($parent, $page, $skip, $propclass, $extraclause = '')
    {
        global $wpdb;
        static $level;
        static $ca;
        if (!$level) {
            $level = '1';
            if (isset($_REQUEST['wppa-album'])) {
                $ca = $_REQUEST['wppa-album'];
            } elseif (isset($_REQUEST['album'])) {
                $ca = $_REQUEST['album'];
            } else {
                $ca = '0';
            }
            $ca = wppa_force_numeric_else($ca, '0');
            if ($ca && !wppa_album_exists($ca)) {
                //				wppa_log('dbg', 'Non-existent album '.$ca.' in url. Referrer= '.$_ENV["HTTP_REFERER"].', Request uri= '.$_ENV["REQUEST_URI"]);
                $ca = '0';
            }
        } else {
            $level++;
        }
        $slide = wppa_opt('album_navigator_widget_linktype') == 'slide' ? '&amp;wppa-slide=1' : '';
        $w = $this->get_widget_id();
        $p = $parent;
        $result = '';
        $albums = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s " . $extraclause . wppa_get_album_order(max('0', $parent)), $parent), ARRAY_A);
        if (!empty($albums)) {
            wppa_cache_album('add', $albums);
            $result .= '<ul>';
            foreach ($albums as $album) {
                $a = $album['id'];
                $treecount = wppa_treecount_a($a);
                if ($treecount['albums'] || $treecount['photos'] > wppa_opt('min_thumbs') || $skip == 'no') {
                    $result .= '
						<li class="anw-' . $w . '-' . $p . $propclass . '" style="list-style:none; display:' . ($level == '1' ? '' : 'none') . ';">';
                    if (wppa_has_children($a)) {
                        $result .= '
							<div style="cursor:default;width:12px;float:left;text-align:center;font-weight:bold;" class="anw-' . $w . '-' . $a . '-" onclick="jQuery(\'.anw-' . $w . '-' . $a . '\').css(\'display\',\'\'); jQuery(\'.anw-' . $w . '-' . $a . '-\').css(\'display\',\'none\');" >' . ($a == $ca ? '&raquo;' : '+') . '</div>
							<div style="cursor:default;width:12px;float:left;text-align:center;font-weight:bold;display:none;" class="anw-' . $w . '-' . $a . '" onclick="jQuery(\'.anw-' . $w . '-' . $a . '-\').css(\'display\',\'\'); jQuery(\'.anw-' . $w . '-' . $a . '\').css(\'display\',\'none\'); jQuery(\'.p-' . $w . '-' . $a . '\').css(\'display\',\'none\');" >' . ($a == $ca ? '&raquo;' : '-') . '</div>';
                    } else {
                        $result .= '
							<div style="width:12px;float:left;" >&nbsp;' . ($a == $ca ? '&raquo;' : '') . '</div>';
                    }
                    $result .= '
							<a href="' . wppa_encrypt_url(wppa_get_permalink($page) . '&amp;wppa-album=' . $a . '&amp;wppa-cover=0&amp;wppa-occur=1' . $slide) . '">' . wppa_get_album_name($a) . '</a>
						</li>';
                    $newpropclass = $propclass . ' p-' . $w . '-' . $p;
                    $result .= '<li class="anw-' . $w . '-' . $p . $propclass . '" style="list-style:none;" >' . $this->do_album_navigator($a, $page, $skip, $newpropclass, $extraclause) . '</li>';
                }
            }
            $result .= '</ul>';
            if ($level == '1' && $ca) {
                // && $parent != '-1' ) {
                $result .= '<script type="text/javascript" >';
                while ($ca != '0' && $ca != '-1') {
                    $result .= '
								jQuery(\'.anw-' . $w . '-' . $ca . '\').css(\'display\',\'\'); jQuery(\'.anw-' . $w . '-' . $ca . '-\').css(\'display\',\'none\');';
                    $ca = wppa_get_parentalbumid($ca);
                }
                $result .= '</script>';
            }
        }
        $level--;
        return str_replace('<ul></ul>', '', $result);
    }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:66,代码来源:wppa-album-navigator-widget.php


示例6: wppa_the_album_title

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>');
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:47,代码来源:wppa-album-covers.php


示例7: wppa_index_quick_remove

function wppa_index_quick_remove($type, $id)
{
    global $wpdb;
    if ($type == 'album') {
        $album = wppa_cache_album($id);
        $words = stripslashes($album['name']) . ' ' . stripslashes($album['description']) . ' ' . $album['cats'];
        $words = wppa_index_raw_to_words($words);
        foreach ($words as $word) {
            $indexline = $wpdb->get_row("SELECT * FROM `" . WPPA_INDEX . "` WHERE `slug` = '" . $word . "'", ARRAY_A);
            $array = wppa_index_string_to_array($indexline['albums']);
            foreach (array_keys($array) as $k) {
                if ($array[$k] == $id) {
                    unset($array[$k]);
                    $string = wppa_index_array_to_string($array);
                    if ($string || $indexline['photos']) {
                        $wpdb->query("UPDATE `" . WPPA_INDEX . "` SET `albums` = '" . $string . "' WHERE `id` = " . $indexline['id']);
                    } else {
                        $wpdb->query("DELETE FROM `" . WPPA_INDEX . "` WHERE `id` = " . $indexline['id']);
                    }
                }
            }
        }
    } elseif ($type == 'photo') {
        $thumb = wppa_cache_thumb($id);
        // Find the raw text
        $words = stripslashes($thumb['name']) . ' ' . $thumb['filename'] . ' ' . stripslashes($thumb['description']) . ' ' . $thumb['tags'];
        $coms = $wpdb->get_results($wpdb->prepare("SELECT `comment` FROM `" . WPPA_COMMENTS . "` WHERE `photo` = %s AND `status` = 'approved'", $thumb['id']), ARRAY_A);
        if ($coms) {
            foreach ($coms as $com) {
                $words .= ' ' . stripslashes($com['comment']);
            }
        }
        $words = wppa_index_raw_to_words($words, 'noskips');
        foreach ($words as $word) {
            $indexline = $wpdb->get_row("SELECT * FROM `" . WPPA_INDEX . "` WHERE `slug` = '" . $word . "'", ARRAY_A);
            $array = wppa_index_string_to_array($indexline['photos']);
            foreach (array_keys($array) as $k) {
                if ($array[$k] == $id) {
                    unset($array[$k]);
                    $string = wppa_index_array_to_string($array);
                    if ($string || $indexline['albums']) {
                        $wpdb->query("UPDATE `" . WPPA_INDEX . "` SET `photos` = '" . $string . "' WHERE `id` = " . $indexline['id']);
                    } else {
                        $wpdb->query("DELETE FROM `" . WPPA_INDEX . "` WHERE `id` = " . $indexline['id']);
                    }
                }
            }
        }
    }
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:50,代码来源:wppa-index.php


示例8: wppa_walbum_select

function wppa_walbum_select($sel = '')
{
    global $wpdb;
    $albums = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` ORDER BY `name`", ARRAY_A);
    wppa_dbg_q('Q-Asel');
    wppa_cache_album('add', $albums);
    if (is_numeric($sel)) {
        $type = 1;
    } elseif (strchr($sel, ',')) {
        $type = 2;
        // Array
        $albs = explode(',', $sel);
    } elseif ($sel == 'all') {
        $type = 3;
    } elseif ($sel == 'sep') {
        $type = 4;
    } elseif ($sel == 'all-sep') {
        $type = 5;
    } elseif ($sel == 'topten') {
        $type = 6;
    } else {
        $type = 0;
    }
    // Nothing yet
    $result = '<option value="" >' . __('- select (another) album or a set -', 'wp-photo-album-plus') . '</option>';
    foreach ($albums as $album) {
        switch ($type) {
            case 1:
                $dis = $album['id'] == $sel;
                break;
            case 2:
                $dis = in_array($album['id'], $albs);
                break;
            case 3:
                $dis = true;
                break;
            case 4:
                $dis = $album['a_parent'] == '-1';
                break;
            case 5:
                $dis = $album['a_parent'] != '-1';
                break;
            case 6:
                $dis = false;
                break;
            default:
                $dis = false;
        }
        if ($dis) {
            $dis = 'disabled="disabled"';
        } else {
            $dis = '';
        }
        $result .= '<option ' . $dis . ' value="' . $album['id'] . '">( ' . $album['id'] . ' )';
        if ($album['id'] < '1000') {
            $result .= '&nbsp;';
        }
        if ($album['id'] < '100') {
            $result .= '&nbsp;';
        }
        if ($album['id'] < '10') {
            $result .= '&nbsp;';
        }
        $result .= __(stripslashes($album['name'])) . '</option>';
    }
    $sel = $type == 3 ? 'selected="selected"' : '';
    $result .= '<option value="all" ' . $sel . ' >' . __('- all albums -', 'wp-photo-album-plus') . '</option>';
    $sel = $type == 4 ? 'selected="selected"' : '';
    $result .= '<option value="sep" ' . $sel . ' >' . __('- all -separate- albums -', 'wp-photo-album-plus') . '</option>';
    $sel = $type == 5 ? 'selected="selected"' : '';
    $result .= '<option value="all-sep" ' . $sel . ' >' . __('- all albums except -separate-', 'wp-photo-album-plus') . '</option>';
    $sel = $type == 6 ? 'selected="selected"' : '';
    $result .= '<option value="topten" ' . $sel . ' >' . __('- top rated photos -', 'wp-photo-album-plus') . '</option>';
    $result .= '<option value="clr" >' . __('- start over -', 'wp-photo-album-plus') . '</option>';
    return $result;
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:76,代码来源:wppa-widget-functions.php


示例9: wppa_update_album

function wppa_update_album($args)
{
    global $wpdb;
    if (!is_array($args)) {
        return false;
    }
    if (!$args['id']) {
        return false;
    }
    if (!wppa_cache_album($args['id'])) {
        return false;
    }
    $id = $args['id'];
    foreach (array_keys($args) as $itemname) {
        $itemvalue = $args[$itemname];
        $doit = false;
        // Sanitize input
        switch ($itemname) {
            case 'id':
                break;
            case 'name':
                $itemvalue = wppa_strip_tags($itemvalue, 'all');
                $doit = true;
                break;
            case 'description':
                $itemvalue = balanceTags($itemvalue, true);
                $itemvalue = wppa_strip_tags($itemvalue, 'script&style');
                $doit = true;
                break;
            case 'modified':
                if (!$itemvalue) {
                    $itemvalue = time();
                }
                $doit = true;
                break;
            case 'cats':
                $itemvalue = wppa_sanitize_tags($itemvalue);
                $doit = true;
                break;
            case 'scheduledtm':
                $doit = true;
                break;
            case 'main_photo':
                if (wppa_is_int($itemvalue)) {
                    $doit = true;
                }
                break;
            default:
                wppa_log('Error', 'Not implemented in wppa_update_album(): ' . $itemname);
                return false;
        }
        if ($doit) {
            if ($wpdb->query($wpdb->prepare("UPDATE `" . WPPA_ALBUMS . "` SET `" . $itemname . "` = %s WHERE `id` = %s LIMIT 1", $itemvalue, $id))) {
                wppa_cache_album('invalidate');
            }
        }
    }
    return true;
    /*
    		`a_order`,
    		`main_photo`,
    		`a_parent`,
    		`p_order_by`,
    		`cover_linktype`,
    		`cover_linkpage`,
    		`owner`,
    		`upload_limit`,
    		`alt_thumbsize`,
    		`default_tags`,
    		`cover_type`,
    		`suba_order_by`,
    		`views`,
    		`cats`
    */
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:75,代码来源:wppa-wpdb-update.php


示例10: wppa_the_album_title

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>');
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:31,代码来源:wppa-album-covers.php


示例11: wppa_the_album_title

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>';
}
开发者ID:billadams,项目名称:forever-frame,代码行数:19,代码来源:wppa-album-covers.php


示例12: _wppa_admin

function _wppa_admin()
{
    global $wpdb;
    global $q_config;
    global $wppa_revno;
    if (get_option('wppa_revision') != $wppa_revno) {
        wppa_check_database(true);
    }
    echo '
<script type="text/javascript">
	/* <![CDATA[ */
	wppaAjaxUrl = "' . admin_url('admin-ajax.php') . '";
	wppaUploadToThisAlbum = "' . __('Upload to this album', 'wp-photo-album-plus') . '";
	wppaImageDirectory = "' . wppa_get_imgdir() . '";
	/* ]]> */
</script>
';
    // Delete trashed comments
    $query = "DELETE FROM " . WPPA_COMMENTS . " WHERE status='trash'";
    $wpdb->query($query);
    $sel = 'selected="selected"';
    // warn if the uploads directory is no writable
    if (!is_writable(WPPA_UPLOAD_PATH)) {
        wppa_error_message(__('Warning:', 'wp-photo-album-plus') . sprintf(__('The uploads directory does not exist or is not writable by the server. Please make sure that %s is writeable by the server.', 'wp-photo-album-plus'), WPPA_UPLOAD_PATH));
    }
    // Fix orphan albums and deleted target pages
    $albs = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "`", ARRAY_A);
    // Now we have tham, put them in cache
    wppa_cache_album('add', $albs);
    if ($albs) {
        foreach ($albs as $alb) {
            if ($alb['a_parent'] > '0' && wppa_get_parentalbumid($alb['a_parent']) == '-9') {
                // Parent died?
                $wpdb->query("UPDATE `" . WPPA_ALBUMS . "` SET `a_parent` = '-1' WHERE `id` = '" . $alb['id'] . "'");
            }
            if ($alb['cover_linkpage'] > '0') {
                $iret = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . $wpdb->posts . "` WHERE `ID` = %s AND `post_type` = 'page' AND `post_status` = 'publish'", $alb['cover_linkpage']));
                if (!$iret) {
                    // Page gone?
                    $wpdb->query("UPDATE `" . WPPA_ALBUMS . "` SET `cover_linkpage` = '0' WHERE `id` = '" . $alb['id'] . "'");
                }
            }
        }
    }
    if (isset($_REQUEST['tab'])) {
        // album edit page
        if ($_REQUEST['tab'] == 'edit') {
            if (isset($_REQUEST['edit_id'])) {
                $ei = $_REQUEST['edit_id'];
                if ($ei != 'new' && $ei != 'search' && !is_numeric($ei)) {
                    wp_die('Security check failure 1');
                }
            }
            if ($_REQUEST['edit_id'] == 'search') {
                $back_url = get_admin_url() . 'admin.php?page=wppa_admin_menu';
                if (isset($_REQUEST['wppa-searchstring'])) {
                    $back_url .= '&wppa-searchstring=' . wppa_sanitize_searchstring($_REQUEST['wppa-searchstring']);
                }
                $back_url .= '#wppa-edit-search-tag';
                ?>
<a name="manage-photos" id="manage-photos" ></a>
				<h2><?php 
                _e('Manage Photos', 'wp-photo-album-plus');
                if (isset($_REQUEST['bulk'])) {
                    echo ' - <small><i>' . __('Copy / move / delete / edit name / edit description / change status', 'wp-photo-album-plus') . '</i></small>';
                } elseif (isset($_REQUEST['quick'])) {
                    echo ' - <small><i>' . __('Edit photo information except copy and move', 'wp-photo-album-plus') . '</i></small>';
                } else {
                    echo ' - <small><i>' . __('Edit photo information', 'wp-photo-album-plus') . '</i></small>';
                }
                ?>
</h2>

<a href="<?php 
                echo $back_url;
                ?>
"><?php 
                _e('Back to album table', 'wp-photo-album-plus');
                ?>
</a><br /><br />

				<?php 
                if (isset($_REQUEST['bulk'])) {
                    wppa_album_photos_bulk($ei);
                } else {
                    wppa_album_photos($ei);
                }
                ?>
				<br /><a href="#manage-photos"><?php 
                _e('Top of page', 'wp-photo-album-plus');
                ?>
</a>
				<br /><a href="<?php 
                echo $back_url;
                ?>
"><?php 
                _e('Back to album table', 'wp-photo-album-plus');
                ?>
</a>
<?php 
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-album-admin-autosave.php


示例13: wppa_do_maintenance_proc


//.........这里部分代码省略.........
                    echo __('Feature must be enabled in Table IV-A28 first', 'wp-photo-album-plus') . '||' . $slug . '||||||';
                    wppa_exit();
                }
                break;
            case 'wppa_move_all_photos':
                $fromalb = get_option('wppa_move_all_photos_from');
                if (!wppa_album_exists($fromalb)) {
                    echo sprintf(__('From album %d does not exist', 'wp-photo-album-plus'), $fromalb);
                    wppa_exit();
                }
                $toalb = get_option('wppa_move_all_photos_to');
                if (!wppa_album_exists($toalb)) {
                    echo sprintf(__('To album %d does not exist', 'wp-photo-album-plus'), $toalb);
                    wppa_exit();
                }
                if ($fromalb == $toalb) {
                    echo __('From and To albums are identical', 'wp-photo-album-plus');
                    wppa_exit();
                }
                break;
        }
        wppa_save_session();
    }
    // Dispatch on albums / photos / single actions
    switch ($slug) {
        case 'wppa_remake_index_albums':
        case 'wppa_remove_empty_albums':
        case 'wppa_sanitize_cats':
        case 'wppa_crypt_albums':
            // Process albums
            $table = WPPA_ALBUMS;
            $topid = $wpdb->get_var("SELECT `id` FROM `" . WPPA_ALBUMS . "` ORDER BY `id` DESC LIMIT 1");
            $albums = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` WHERE `id` > " . $lastid . " ORDER BY `id` LIMIT 100", ARRAY_A);
            wppa_cache_album('add', $albums);
            if ($albums) {
                foreach ($albums as $album) {
                    $id = $album['id'];
                    switch ($slug) {
                        case 'wppa_remake_index_albums':
                            // If done as cron job, no initial clear has been done
                            if (wppa_is_cron()) {
                                wppa_index_remove('album', $id);
                            }
                            wppa_index_add('album', $id);
                            break;
                        case 'wppa_remove_empty_albums':
                            $p = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `album` = %s", $id));
                            $a = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` = %s", $id));
                            if (!$a && !$p) {
                                $wpdb->query($wpdb->prepare("DELETE FROM `" . WPPA_ALBUMS . "` WHERE `id` = %s", $id));
                                wppa_delete_album_source($id);
                                wppa_flush_treecounts($id);
                                wppa_index_remove('album', $id);
                            }
                            break;
                        case 'wppa_sanitize_cats':
                            $cats = $album['cats'];
                            if ($cats) {
                                wppa_update_album(array('id' => $album['id'], 'cats' => wppa_sanitize_tags($cats)));
                            }
                            break;
                        case 'wppa_crypt_albums':
                            wppa_update_album(array('id' => $album['id'], 'crypt' => wppa_get_unique_album_crypt()));
                            break;
                    }
                    // Test for timeout / ready
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-maintenance.php


示例14: wppa_album_select_a

function wppa_album_select_a($args)
{
    global $wpdb;
    $args = wp_parse_args($args, array('exclude' => '', 'selected' => '', 'disabled' => '', 'addpleaseselect' => false, 'addnone' => false, 'addall' => false, 'addgeneric' => false, 'addblank' => false, 'addselected' => false, 'addseparate' => false, 'addselbox' => false, 'disableancestors' => false, 'checkaccess' => false, 'checkowner' => false, 'checkupload' => false, 'addmultiple' => false, 'addnumbers' => false, 'path' => false, 'root' => false, 'content' => false, 'sort' => true));
    // Provide default selection if no selected given
    if ($args['selected'] === '') {
        $args['selected'] = wppa_get_last_album();
    }
    // See if selection is valid
    if ($args['selected'] == $args['exclude'] || $args['checkupload'] && !wppa_allow_uploads($args['selected']) || $args['disableancestors'] && wppa_is_ancestor($args['exclude'], $args['selected'])) {
        $args['selected'] = '0';
    }
    $albums = $wpdb->get_results("SELECT * FROM `" . WPPA_ALBUMS . "` " . wppa_get_album_order($args['root']), ARRAY_A);
    // Add to secondary cache
    if ($albums) {
        wppa_cache_album('add', $albums);
    }
    if ($albums) {
        // Filter for root
        if ($args['root']) {
            $root = $args['root'];
            switch ($root) {
                // case '0': all, will be skipped as it returns false in 'if ( $args['root'] )'
                case '-2':
                    // Generic only
                    foreach (array_keys($albums) as $albidx) {
                        if (wppa_is_separate($albums[$albidx]['id'])) {
                            unset($albums[$albidx]);
                        }
                    }
                    break;
                case '-1':
                    // Separate only
                    foreach (array_keys($albums) as $albidx) {
                        if (!wppa_is_separate($albums[$albidx]['id'])) {
                            unset($albums[$albidx]);
                        }
                    }
                    break;
                default:
                    foreach (array_keys($albums) as $albidx) {
                        if (!wppa_is_ancestor($root, $albums[$albidx]['id'])) {
                            unset($albums[$albidx]);
                        }
                    }
                    break;
            }
        }
        // Filter for must have content
        if ($args['content']) {
            foreach (array_keys($albums) as $albidx) {
                if (wppa_get_photo_count($albums[$albidx]['id']) <= wppa_get_mincount()) {
                    unset($albums[$albidx]);
                }
            }
        }
        // Add paths
        if ($args['path']) {
            $albums = wppa_add_paths($albums);
        } else {
            foreach (array_keys($albums) as $index) {
                $albums[$index]['name'] = __(stripslashes($albums[$index]['name']));
            }
        }
        // Sort
        if ($args['sort']) {
            $albums = wppa_array_sort($albums, 'name');
        }
    }
    // Output
    $result = '';
    $selected = $args['selected'] == '0' ? ' selected="selected"' : '';
    if ($args['addpleaseselect']) {
        $result .= '<option value="0" disabled="disabled" ' . $selected . ' >' . (is_admin() ? __('- select an album -', 'wppa') : __a('- select an album -')) . '</option>';
    }
    $selected = $args['selec 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wppa_cache_thumb函数代码示例发布时间:2022-05-23
下一篇:
PHP wppa_album_select_a函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap