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

PHP wppa_get_photo_item函数代码示例

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

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



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

示例1: wppa_has_audio

function wppa_has_audio($id)
{
    global $wppa_supported_audio_extensions;
    if (!$id) {
        return false;
    }
    // No id
    $ext = wppa_get_photo_item($id, 'ext');
    if ($ext != 'xxx') {
        return false;
    }
    // This is not a audio
    $result = array();
    $path = wppa_get_photo_path($id);
    $raw_path = wppa_strip_ext($path);
    foreach ($wppa_supported_audio_extensions as $ext) {
        if (is_file($raw_path . '.' . $ext)) {
            $result[$ext] = $ext;
        }
    }
    if (empty($result)) {
        return false;
        // Its multimedia but not audio
    }
    return $result;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:26,代码来源:wppa-audio.php


示例2: wppa_encrypt_photo

function wppa_encrypt_photo($id)
{
    // Feature enabled?
    if (!wppa_switch('use_encrypted_links')) {
        return $id;
    }
    // Yes
    if (strlen($id) < 12) {
        $crypt = wppa_get_photo_item($id, 'crypt');
    } else {
        $crypt = $id;
        // Already encrypted
    }
    return $crypt;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:15,代码来源:wppa-encrypt.php


示例3: wppa_flush_upldr_cache

function wppa_flush_upldr_cache($key = '', $id = '')
{
    $upldrcache = wppa_get_upldr_cache();
    foreach (array_keys($upldrcache) as $widget_id) {
        switch ($key) {
            case 'widgetid':
                if ($id == $widget_id) {
                    unset($upldrcache[$widget_id]);
                }
            case 'photoid':
                $usr = wppa_get_photo_item($id, 'owner');
                if (isset($upldrcache[$widget_id][$usr])) {
                    unset($upldrcache[$widget_id][$usr]);
                }
                break;
            case 'username':
                $usr = $id;
                if (isset($upldrcache[$widget_id][$usr])) {
                    unset($upldrcache[$widget_id][$usr]);
                }
                break;
            case 'all':
                $upldrcache = array();
                break;
            default:
                wppa_dbg_msg('Missing key in wppa_flush_upldr_cache()', 'red');
                break;
        }
    }
    update_option('wppa_upldr_cache', $upldrcache);
}
开发者ID:billadams,项目名称:forever-frame,代码行数:31,代码来源:wppa-statistics.php


示例4: wppa_do_maintenance_proc


//.........这里部分代码省略.........
                                $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `description` = %s WHERE `id` = %s", $description, $id));
                            }
                            break;
                        case 'wppa_remove_from_photodesc':
                            $value = trim(wppa_opt('remove_text'));
                            if (!$value) {
                                return 'Unexpected error: missing text to remove||' . $slug . '||Error||0';
                            }
                            $description = rtrim(str_replace($value, '', $photo['description']));
                            if ($description != $photo['description']) {
                                // Modified photo description
                                $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `description` = %s WHERE `id` = %s", $description, $id));
                            }
                            break;
                        case 'wppa_remove_file_extensions':
                            if (!wppa_is_video($id)) {
                                $name = str_replace(array('.jpg', '.png', '.gif', '.JPG', '.PNG', '.GIF'), '', $photo['name']);
                                if ($name != $photo['name']) {
                                    // Modified photo name
                                    $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `name` = %s WHERE `id` = %s", $name, $id));
                                }
                            }
                            break;
                        case 'wppa_readd_file_extensions':
                            if (!wppa_is_video($id)) {
                                $name = str_replace(array('.jpg', '.png', 'gif', '.JPG', '.PNG', '.GIF'), '', $photo['name']);
                                if ($name == $photo['name']) {
                                    // Name had no fileextension
                                    $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `name` = %s WHERE `id` = %s", $name . '.' . $photo['ext'], $id));
                                }
                            }
                            break;
                        case 'wppa_all_ext_to_lower':
                            $EXT = wppa_get_photo_item($id, 'ext');
                            $ext = strtolower($EXT);
                            if ($EXT != $ext) {
                                wppa_update_photo(array('id' => $id, 'ext' => $ext));
                                $fixed_this = true;
                            }
                            $EXT = strtoupper($ext);
                            $rawpath = wppa_strip_ext(wppa_get_photo_path($id));
                            $rawthumb = wppa_strip_ext(wppa_get_thumb_path($id));
                            $fixed_this = false;
                            if (wppa_is_multi($id)) {
                            } else {
                                if (is_file($rawpath . '.' . $EXT)) {
                                    if (is_file($rawpath . '.' . $ext)) {
                                        unlink($rawpath . '.' . $EXT);
                                    } else {
                                        rename($rawpath . '.' . $EXT, $rawpath . '.' . $ext);
                                    }
                                    $fixed_this = true;
                                }
                                if (is_file($rawthumb . '.' . $EXT)) {
                                    if (is_file($rawthumb . '.' . $ext)) {
                                        unlink($rawthumb . '.' . $EXT);
                                    } else {
                                        rename($rawthumb . '.' . $EXT, $rawthumb . '.' . $ext);
                                    }
                                    $fixed_this = true;
                                }
                            }
                            if ($fixed_this) {
                                $wppa_session[$slug . '_fixed']++;
                            } else {
                                $wppa_session[$slug . '_skipped']++;
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-maintenance.php


示例5: wppa_get_thumbphotoxy

function wppa_get_thumbphotoxy($id, $key, $force = false)
{
    $result = wppa_get_photo_item($id, $key);
    if ($result && !$force) {
        return $result;
        // Value found
    }
    if ($key == 'thumbx' || $key == 'thumby') {
        $file = wppa_get_thumb_path($id);
    } else {
        $file = wppa_get_photo_path($id);
    }
    if (wppa_get_ext($file) == 'xxx') {
        //		if ( $key == 'photox' || $key == 'photoy' ) {
        $file = wppa_fix_poster_ext($file, $id);
        //		}
    }
    if (!is_file($file) && !$force) {
        return '0';
        // File not found
    }
    if (is_file($file)) {
        $size = getimagesize($file);
    } else {
        $size = array('0', '0');
    }
    if (is_array($size)) {
        if ($key == 'thumbx' || $key == 'thumby') {
            wppa_update_photo(array('id' => $id, 'thumbx' => $size[0], 'thumby' => $size[1]));
        } else {
            wppa_update_photo(array('id' => $id, 'photox' => $size[0], 'photoy' => $size[1]));
        }
        wppa_cache_photo('invalidate', $id);
    }
    if ($key == 'thumbx' || $key == 'photox') {
        return $size[0];
    } else {
        return $size[1];
    }
}
开发者ID:billadams,项目名称:forever-frame,代码行数:40,代码来源:wppa-items.php


示例6: wppa_add_metatags

function wppa_add_metatags()
{
    global $wpdb;
    // Share info for sm that uses og
    $id = wppa_get_get('photo');
    if (!wppa_photo_exists($id)) {
        $id = false;
    }
    if ($id) {
        // SM may not accept images from the cloud.
        wppa('for_sm', true);
        $imgurl = wppa_get_photo_url($id);
        wppa('for_sm', false);
        if (wppa_is_video($id)) {
            $imgurl = wppa_fix_poster_ext($imgurl, $id);
        }
    } else {
        $imgurl = '';
    }
    if ($id) {
        if (wppa_switch('og_tags_on')) {
            $thumb = wppa_cache_thumb($id);
            if ($thumb) {
                $title = wppa_get_photo_name($id);
                $desc = wppa_get_og_desc($id);
                $url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                $site = get_bloginfo('name');
                $mime = wppa_get_mime_type($id);
                echo '
<!-- WPPA+ Og Share data -->
<meta property="og:site_name" content="' . esc_attr(sanitize_text_field($site)) . '" />
<meta property="og:type" content="article" />
<meta property="og:url" content="' . $url . '" />
<meta property="og:title" content="' . esc_attr(sanitize_text_field($title)) . '" />';
                if ($mime) {
                    echo '
<meta property="og:image" content="' . esc_url(sanitize_text_field($imgurl)) . '" />
<meta property="og:image:type" content="' . $mime . '" />
<meta property="og:image:width" content="' . wppa_get_photox($id) . '" />
<meta property="og:image:height" content="' . wppa_get_photoy($id) . '" />';
                }
                if ($desc) {
                    echo '
<meta property="og:description" content="' . esc_attr(sanitize_text_field($desc)) . '" />';
                }
                echo '
<!-- WPPA+ End Og Share data -->
';
            }
        }
        if (wppa_switch('share_twitter') && wppa_opt('twitter_account')) {
            $thumb = wppa_cache_thumb($id);
            // Twitter wants at least 280px in width, and at least 150px in height
            if ($thumb) {
                $x = wppa_get_photo_item($id, 'photox');
                $y = wppa_get_photo_item($id, 'photoy');
            }
            if ($thumb && $x >= 280 && $y >= 150) {
                $title = wppa_get_photo_name($id);
                $desc = wppa_get_og_desc($id);
                $url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                $site = get_bloginfo('name');
                echo '
<!-- WPPA+ Twitter Share data -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:creator" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:title" content="' . esc_attr(sanitize_text_field($title)) . '">
<meta name="twitter:description" content="' . esc_attr(sanitize_text_field($desc)) . '">
<meta name="twitter:image" content="' . esc_url(sanitize_text_field($imgurl)) . '">
<!-- WPPA+ End Twitter Share data -->
';
            } elseif ($thumb && $x >= 120 && $y >= 120) {
                $title = wppa_get_photo_name($id);
                $desc = wppa_get_og_desc($id);
                $url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                $site = get_bloginfo('name');
                echo '
<!-- WPPA+ Twitter Share data -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="' . wppa_opt('twitter_account') . '">
<meta name="twitter:title" content="' . esc_attr(sanitize_text_field($title)) . '">
<meta name="twitter:description" content="' . esc_attr(sanitize_text_field($desc)) . '">
<meta name="twitter:image" content="' . esc_url(sanitize_text_field($imgurl)) . '">
<!-- WPPA+ End Twitter Share data -->
';
            }
        }
    }
    // To make sure we are on a page that contains at least [wppa] we check for Get var 'wppa-album'.
    // This also narrows the selection of featured photos to those that exist in the current album.
    $done = array();
    $album = '';
    if (isset($_REQUEST['album'])) {
        $album = $_REQUEST['album'];
    } elseif (isset($_REQUEST['wppa-album'])) {
        $album = $_REQUEST['wppa-album'];
    }
    $album = strip_tags($album);
    if (strlen($album == 12)) {
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-non-admin.php


示例7: wppa_update_single_photo

function wppa_update_single_photo($file, $id, $name)
{
    global $wpdb;
    $photo = $wpdb->get_row($wpdb->prepare("SELECT `id`, `name`, `ext`, `album`, `filename` FROM `" . WPPA_PHOTOS . "` WHERE `id` = %s", $id), ARRAY_A);
    // Find extension
    $ext = $photo['ext'];
    if ($ext == 'xxx') {
        $ext = strtolower(wppa_get_ext($file));
        // Copy from source
        if ($ext == 'jpeg') {
            $ext = 'jpg';
        }
    }
    // Make the files
    wppa_make_the_photo_files($file, $id, $ext);
    // and add watermark ( optionally ) to fullsize image only
    wppa_add_watermark($id);
    // create new thumbnail
    wppa_create_thumbnail($id);
    // Save source
    wppa_save_source($file, $name, $photo['album']);
    // Update filename if not present. this is for backward compatibility when there were no filenames saved yet
    if (!wppa_get_photo_item($id, 'filename')) {
        wppa_update_photo(array('id' => $id, 'filename' => $name));
    }
    // Update modified timestamp
    wppa_update_modified($id);
    wppa_dbg_msg('Update single photo: ' . $name . ' in album ' . $photo['album'], 'green');
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:29,代码来源:wppa-admin-functions.php


示例8: wppa_get_like_title_a

function wppa_get_like_title_a($id)
{
    global $wpdb;
    //static $c;
    //wppa_log('obs', 'wppa_get_like_title_a', true);
    //$c++;
    $me = wppa_get_user();
    $likes = wppa_get_photo_item($id, 'rating_count');
    //$wpdb->get_var( "SELECT COUNT(*) FROM `" . WPPA_RATING . "` WHERE `photo` = $id" );
    $mylike = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_RATING . "` WHERE `photo` = {$id} AND `user` = '{$me}'");
    if ($mylike) {
        if ($likes > 1) {
            $text = sprintf(_n('You and %d other person like this', 'You and %d other people like this', $likes - 1), $likes - 1);
        } else {
            $text = __('You are the first one who likes this', 'wp-photo-album-plus');
        }
        $text .= "\n" . __('Click again if you do no longer like this', 'wp-photo-album-plus');
    } else {
        if ($likes) {
            $text = sprintf(_n('%d person likes this', '%d people like this', $likes, 'wp-photo-album-plus'), $likes);
        } else {
            $text = __('Be the first one to like this', 'wp-photo-album-plus');
        }
    }
    $result['title'] = $text;
    $result['mine'] = $mylike;
    $result['total'] = $likes;
    $result['display'] = sprintf(_n('%d like', '%d likes', $likes), $likes);
    return $result;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:30,代码来源:wppa-utils.php


示例9: 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


示例10: wppa_index_add

function wppa_index_add($type, $id)
{
    global $wpdb;
    global $acount;
    global $pcount;
    if ($type == 'album') {
        $album = wppa_cache_album($id);
        // Find the raw text, all qTranslate languages
        $words = stripslashes($album['name']) . ' ' . stripslashes($album['description']);
        if (wppa_switch('search_cats')) {
            $words .= ' ' . $album['cats'];
        }
        $words = wppa_index_raw_to_words($words);
        foreach ($words as $word) {
            $indexline = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPPA_INDEX . "` WHERE `slug` = %s", $word), ARRAY_A);
            if (!$indexline) {
                // create new entry
                $id = wppa_create_index_entry(array('slug' => $word, 'albums' => $album['id']));
            } else {
                // Add to entry
                $oldalbums = wppa_index_string_to_array($indexline['albums']);
                if (!in_array($album['id'], $oldalbums)) {
                    $oldalbums[] = $album['id'];
                    sort($oldalbums);
                    $newalbums = wppa_index_array_to_string($oldalbums);
                    $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_INDEX . "` SET `albums` = %s WHERE `id` = %s", $newalbums, $indexline['id']));
                }
            }
        }
        $acount++;
    } elseif ($type == 'photo') {
        $thumb = wppa_cache_thumb($id);
        // Find the raw text
        $desc = stripslashes($thumb['description']);
        $desc = wppa_filter_iptc($desc, $thumb['id']);
        // Render IPTC tags
        $desc = wppa_filter_exif($desc, $thumb['id']);
        // Render EXIF tags
        $custom = wppa_get_photo_item($id, 'custom');
        if ($custom) {
            $custom_data = unserialize($custom);
            for ($i = 0; $i < 10; $i++) {
                if (wppa_switch('custom_visible_' . $i)) {
                    // May be displayed
                    $desc = str_replace('w#cd' . $i, __(stripslashes($custom_data[$i])), $desc);
                    // Data
                } else {
                    $desc = str_replace('w#cd' . $i, '', $desc);
                    // Data
                }
            }
        }
        $words = stripslashes($thumb['name']) . ' ' . $thumb['filename'] . ' ' . $desc;
        if (wppa_switch('search_tags')) {
            $words .= ' ' . $thumb['tags'];
        }
        // Tags
        if (wppa_switch('search_comments')) {
            $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);
        // convert raw string to sanitized array
        foreach ($words as $word) {
            $indexline = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPPA_INDEX . "` WHERE `slug` = %s", $word), ARRAY_A);
            if (!$indexline) {
                // create new entry
                $id = wppa_create_index_entry(array('slug' => $word, 'photos' => $thumb['id']));
            } else {
                // Add to entry
                $oldphotos = wppa_index_string_to_array($indexline['photos']);
                if (!in_array($thumb['id'], $oldphotos)) {
                    $oldphotos[] = $thumb['id'];
                    sort($oldphotos);
                    $newphotos = wppa_index_array_to_string($oldphotos);
                    $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_INDEX . "` SET `photos` = %s WHERE `id` = %s", $newphotos, $indexline['id']));
                }
            }
        }
        $pcount++;
    } else {
        wppa_dbg_msg('Error, unimplemented type in wppa_index_add().', 'red', 'force');
    }
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:88,代码来源:wppa-index.php


示例11: wppa_is_multi

function wppa_is_multi($id)
{
    if (!$id) {
        return false;
    }
    // No id
    $ext = wppa_get_photo_item($id, 'ext');
    return $ext == 'xxx';
}
开发者ID:billadams,项目名称:forever-frame,代码行数:9,代码来源:wppa-utils.php


示例12: widget

 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     global $wpdb;
     global $wppa_opt;
     require_once dirname(__FILE__) . '/wppa-links.php';
     require_once dirname(__FILE__) . '/wppa-styles.php';
     require_once dirname(__FILE__) . '/wppa-functions.php';
     require_once dirname(__FILE__) . '/wppa-thumbnails.php';
     require_once dirname(__FILE__) . '/wppa-boxes-html.php';
     require_once dirname(__FILE__) . '/wppa-slideshow.php';
     wppa_initialize_runtime();
     extract($args);
     wppa('in_widget', 'featen');
     $instance = wp_parse_args((array) $instance, array('title' => '', 'album' => ''));
     $widget_title = apply_filters('widget_title', $instance['title']);
     $page = in_array(wppa_opt('featen_widget_linktype'), wppa('links_no_page')) ? '' : wppa_get_the_landing_page('featen_widget_linkpage', __('Featured photos', 'wp-photo-album-plus'));
     $max = wppa_opt('featen_count');
     $album = $instance['album'];
     $generic = $album == '-2';
     //		wppa( 'start_album', $album );
     //		if ( $generic ) {
     //			$album = '0';
     //			$max += '1000';
     //		}
     switch ($album) {
         // owner/public
         case '-3':
             $temp = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A);
             if ($temp) {
                 $c = '0';
                 $thumbs = array();
                 while ($c < $max && $c < count($temp)) {
                     $alb = wppa_get_photo_item($temp[$c]['id'], 'album');
                     $own = wppa_get_album_item($alb, 'owner');
                     if ($own == '---public---' || $own == wppa_get_user()) {
                         $thumbs[] = $temp[$c];
                     }
                     $c++;
                 }
             } else {
                 $thumbs = false;
             }
             break;
             // generic
         // generic
         case '-2':
             $temp = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A);
             if ($temp) {
                 $c = '0';
                 $thumbs = array();
                 while ($c < $max && $c < count($temp)) {
                     $alb = wppa_get_photo_item($temp[$c]['id'], 'album');
                     if (!wppa_is_separate($alb)) {
                         $thumbs[] = $temp[$c];
                     }
                     $c++;
                 }
             } else {
                 $thumbs = false;
             }
             break;
             // all
         // all
         case '0':
             $thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A);
             break;
             // album spec
         // album spec
         default:
             $thumbs = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status`= 'featured' AND `album` = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album), ARRAY_A);
     }
     $widget_content = "\n" . '<!-- WPPA+ FeaTen Widget start -->';
     $maxw = wppa_opt('featen_size');
     $maxh = $maxw;
     $lineheight = wppa_opt('fontsize_widget_thumb') * 1.5;
     $maxh += $lineheight;
     $count = '0';
     if ($thumbs) {
         foreach ($thumbs as $image) {
             $thumb = $image;
             if ($generic && wppa_is_separate($thumb['album'])) {
                 continue;
             }
             // Make the HTML for current picture
             $widget_content .= "\n" . '<div class="wppa-widget" style="width:' . $maxw . 'px; height:' . $maxh . 'px; margin:4px; display:inline; text-align:center; float:left;">';
             if ($image) {
                 $no_album = !$album;
                 if ($no_album) {
                     $tit = __('View the featured photos', 'wp-photo-album-plus');
                 } else {
                     $tit = esc_attr(__(stripslashes($image['description'])));
                 }
                 $link = wppa_get_imglnk_a('featen', $image['id'], '', $tit, '', $no_album, $album);
                 $file = wppa_get_thumb_path($image['id']);
                 $imgstyle_a = wppa_get_imgstyle_a($image['id'], $file, $maxw, 'center', 'ttthumb');
                 $imgstyle = $imgstyle_a['style'];
                 $width = $imgstyle_a['width'];
                 $height = $imgstyle_a['height'];
                 $cursor = $imgstyle_a['cursor'];
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-featen-widget.php


示例13: widget

 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     global $wpdb;
     wppa('in_widget', 'potd');
     wppa_bump_mocc();
     require_once dirname(__FILE__) . '/wppa-links.php';
     require_once dirname(__FILE__) . '/wppa-styles.php';
     require_once dirname(__FILE__) . '/wppa-functions.php';
     require_once dirname(__FILE__) . '/wppa-thumbnails.php';
     require_once dirname(__FILE__) . '/wppa-boxes-html.php';
     require_once dirname(__FILE__) . '/wppa-slideshow.php';
     wppa_initialize_runtime();
     extract($args);
     $widget_title = apply_filters('widget_title', $instance['title']);
     // get the photo  ($image)
     $image = wppa_get_potd();
     // Make the HTML for current picture
     $widget_content = "\n" . '<!-- WPPA+ Photo of the day Widget start -->';
     $ali = wppa_opt('potd_align');
     if ($ali != 'none') {
         $align = 'text-align:' . $ali . ';';
     } else {
         $align = '';
     }
     $widget_content .= "\n" . '<div class="wppa-widget-photo" style="' . $align . ' padding-top:2px;position:relative;" >';
     if ($image) {
         $id = $image['id'];
         $w = wppa_opt('potd_widget_width');
         $ratio = wppa_get_photoy($id) / wppa_get_photox($id);
         $h = round($w * $ratio);
         $usethumb = wppa_use_thumb_file($id, wppa_opt('potd_widget_width'), '0');
         $imgurl = wppa_fix_poster_ext($usethumb ? wppa_get_thumb_url($id, '', $w, $h) : wppa_get_photo_url($id, '', $w, $h), $id);
         $name = wppa_get_photo_name($id);
         $page = in_array(wppa_opt('potd_linktype'), wppa('links_no_page')) && !wppa_switch('potd_counter') ? '' : wppa_get_the_landing_page('potd_linkpage', __('Photo of the day', 'wp-photo-album-plus'));
         $link = wppa_get_imglnk_a('potdwidget', $id);
         $is_video = wppa_is_video($id);
         $has_audio = wppa_has_audio($id);
         if ($link['is_lightbox']) {
             $lightbox = ($is_video ? ' data-videohtml="' . esc_attr(wppa_get_video_body($id)) . '"' . ' data-videonatwidth="' . wppa_get_videox($id) . '"' . ' data-videonatheight="' . wppa_get_videoy($id) . '"' : '') . ($has_audio ? ' data-audiohtml="' . esc_attr(wppa_get_audio_body($id)) . '"' : '') . ' ' . wppa('rel') . '="' . wppa_opt('lightbox_name') . '"' . ' data-alt="' . esc_attr(wppa_get_imgalt($id, true)) . '"';
         } else {
             $lightbox = '';
         }
         if ($link) {
             if ($link['is_lightbox']) {
                 $cursor = ' cursor:url(' . wppa_get_imgdir() . wppa_opt('magnifier') . '),pointer;';
                 $title = wppa_zoom_in($id);
                 $ltitle = wppa_get_lbtitle('potd', $id);
             } else {
                 $cursor = ' cursor:pointer;';
                 $title = $link['title'];
                 $ltitle = $title;
             }
         } else {
             $cursor = ' cursor:default;';
             $title = esc_attr(stripslashes(__($image['name'], 'wp-photo-album-plus')));
         }
         // The medal if on top
         $widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
         // The link, if any
         if ($link) {
             $widget_content .= "\n\t" . '<a href = "' . $link['url'] . '" target="' . $link['target'] . '" ' . $lightbox . ' ' . wppa('lbtitle') . '="' . $ltitle . '">';
         }
         // The image
         if (wppa_is_video($id)) {
             $widget_content .= "\n\t\t" . wppa_get_video_html(array('id' => $id, 'width' => wppa_opt('potd_widget_width'), 'title' => $title, 'controls' => wppa_opt('potd_linktype') == 'none', 'cursor' => $cursor));
         } else {
             $widget_content .= '<img' . ' src="' . $imgurl . '"' . ' style="width: ' . wppa_opt('potd_widget_width') . 'px;' . $cursor . '"' . ' ' . wppa_get_imgalt($id) . ($title ? 'title="' . $title . '"' : '') . ' />';
         }
         // Close the link
         if ($link) {
             $widget_content .= '</a>';
         }
         // The medal if at the bottom
         $widget_content .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'bot'));
         // The counter
         if (wppa_switch('potd_counter')) {
             // If we want this
             $alb = wppa_get_photo_item($id, 'album');
             $c = $wpdb->get_var("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `album` = " . $alb) - 1;
             if ($c > 0) {
                 if (wppa_opt('potd_counter_link') == 'thumbs') {
                     $lnk = wppa_get_album_url($alb, $page, 'thumbs', '1');
                 } elseif (wppa_opt('potd_counter_link') == 'slide') {
                     $lnk = wppa_get_slideshow_url($alb, $page, $id, '1');
                 } elseif (wppa_opt('potd_counter_link') == 'single') {
                     $lnk = wppa_encrypt_url(get_permalink($page) . '?occur=1&photo=' . $id);
                     //	wppa_get_image_page_url_by_id( $id, true, false, $page );
                 } else {
                     wppa_log('Err', 'Unimplemented counter link type in wppa-potd-widget: ' . wppa_opt('potd_counter_link'));
                 }
                 $widget_content .= '<a href="' . $lnk . '" >' . '<div style="font-size:12px;position:absolute;right:4px;bottom:4px;" >+' . $c . '</div>' . '</a>';
             }
         }
         // Audio
         if (wppa_has_audio($id)) {
             $widget_content .= wppa_get_audio_html(array('id' => $id, 'width' => wppa_opt('potd_widget_width'), 'controls' => true));
         }
     } else {
         // No image
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-potd-widget.php


示例14: wppa_album_photos_bulk

function wppa_album_photos_bulk($album)
{
    global $wpdb;
    // Check input
    wppa_vfy_arg('wppa-page');
    // Init
    $count = '0';
    $abort = false;
    if (isset($_POST['wppa-bulk-action'])) {
        check_admin_referer('wppa-bulk', 'wppa-bulk');
        if (isset($_POST['wppa-bulk-photo'])) {
            $ids = $_POST['wppa-bulk-photo'];
            $newalb = isset($_POST['wppa-bulk-album']) ? $_POST['wppa-bulk-album'] : '0';
            $status = isset($_POST['wppa-bulk-status']) ? $_POST['wppa-bulk-status'] : '';
            $owner = isset($_POST['wppa-bulk-owner']) ? $_POST['wppa-bulk-owner'] : '';
            $totcount = count($ids);
            if (!is_numeric($newalb)) {
                wp_die('Security check failure 1');
            }
            if (is_array($ids)) {
                foreach (array_keys($ids) as $id) {
                    $skip = false;
                    switch ($_POST['wppa-bulk-action']) {
                        case 'wppa-bulk-delete':
                            wppa_delete_photo($id);
                            break;
                        case 'wppa-bulk-move-to':
                            if ($newalb) {
                                $photo = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . WPPA_PHOTOS . ' WHERE `id` = %s', $id), ARRAY_A);
                                if (wppa_switch('void_dups')) {
                                    // Check for already exists
                                    $exists = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `filename` = %s AND `album` = %s", $photo['filename'], $newalb));
                                    if ($exists) {
                                        // Already exists
                                        wppa_error_message(sprintf(__('A photo with filename %s already exists in album %s.', 'wp-photo-album-plus'), $photo['filename'], $newalb));
                                        $skip = true;
                                    }
                                }
                                if ($skip) {
                                    continue;
                                }
                                wppa_flush_treecounts($photo['album']);
                                // Current album
                                wppa_flush_treecounts($newalb);
                                // New album
                                $wpdb->query($wpdb->prepare('UPDATE `' . WPPA_PHOTOS . '` SET `album` = %s WHERE `id` = %s', $newalb, $id));
                                wppa_move_source($photo['filename'], $photo['album'], $newalb);
                            } else {
                                wppa_error_message('Unexpected error #4 in wppa_album_photos_bulk().');
                            }
                            break;
                        case 'wppa-bulk-copy-to':
                            if ($newalb) {
                                $photo = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . WPPA_PHOTOS . ' WHERE `id` = %s', $id), ARRAY_A);
                                if (wppa_switch('void_dups')) {
                                    // Check for already exists
                                    $exists = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_PHOTOS . "` WHERE `filename` = %s AND `album` = %s", $photo['filename'], $newalb));
                                    if ($exists) {
                                        // Already exists
                                        wppa_error_message(sprintf(__($exists . 'A photo with filename %s already exists in album %s.', 'wp-photo-album-plus'), $photo['filename'], $newalb));
                                        $skip = true;
                                    }
                                }
                                if ($skip) {
                                    continue;
                                }
                                wppa_copy_photo($id, $newalb);
                                wppa_flush_treecounts($newalb);
                            } else {
                                wppa_error_message('Unexpected error #3 in wppa_album_photos_bulk().');
                            }
                            break;
                        case 'wppa-bulk-status':
                            if (!in_array($status, array('publish', 'pending', 'featured', 'scheduled', 'gold', 'silver', 'bronze', 'private'))) {
                                wppa_log('error', 'Unknown status ' . strip_tags($status) . ' found in wppa-photo-admin-autosave.php -> wppa_album_photos_bulk()');
                                $status = 'publish';
                            }
                            if (current_user_can('wppa_admin') || current_user_can('wppa_moderate')) {
                                if ($status == 'publish' || $status == 'pending' || wppa_user_is('administrator') || !wppa_switch('ext_status_restricted')) {
                                    $wpdb->query("UPDATE `" . WPPA_PHOTOS . "` SET `status` = '" . $status . "' WHERE `id` = " . $id);
                                    wppa_flush_treecounts($id, wppa_get_photo_item($id, 'album'));
                                } else {
                                    wp_die('Security check failure 2');
                                }
                            } else {
                                wp_die('Security check failure 3');
                            }
                            break;
                        case 'wppa-bulk-owner':
                            if (wppa_user_is('administrator') && wppa_switch('photo_owner_change')) {
                                if ($owner) {
                                    $owner = sanitize_user($owner);
                                    $exists = $wpdb->get_var("SELECT COUNT(*) FROM `" . $wpdb->users . "` WHERE `user_login` = '" . $owner . "'");
                                    if ($exists) {
                                        $wpdb->query("UPDATE `" . WPPA_PHOTOS . "` SET `owner` = '" . $owner . "' WHERE `id` = " . $id);
                                    } else {
                                        wppa_error_message('A user with login name ' . $owner . ' does not exist.');
                                        $skip = true;
                                    }
                                } else {
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-photo-admin-autosave.php


示例15: wppa_is_stereo

function wppa_is_stereo($id)
{
    // Feature enabled?
    if (!wppa_switch('enable_stereo')) {
        return false;
    }
    return wppa_get_photo_item($id, 'stereo');
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:8,代码来源:wppa-stereo.php


示例16: wppa_fe_edit_new_style

function wppa_fe_edit_new_style($photo)
{
    $items = array('name', 'description', 'tags', 'custom_0', 'custom_1', 'custom_2', 'custom_3', 'custom_4', 'custom_5', 'custom_6', 'custom_7', 'custom_8', 'custom_9');
    $titles = array(__('Name', 'wp-photo-album-plus'), __('Description', 'wp-photo-album-plus'), __('Tags', 'wp-photo-album-plus'), apply_filters('translate_text', wppa_opt('custom_caption_0')), apply_filters('translate_text', wppa_opt('custom_caption_1')), apply_filters('translate_text', wppa_opt('custom_caption_2')), apply_filters('translate_text', wppa_opt('custom_caption_3')), apply_filters(' 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wppa_get_photo_path函数代码示例发布时间:2022-05-23
下一篇:
PHP wppa_get_imgdir函数代码示例发布时间: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