本文整理汇总了PHP中wppa_is_int函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_is_int函数的具体用法?PHP wppa_is_int怎么用?PHP wppa_is_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_is_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_orientate_image_file
function wppa_orientate_image_file($file, $ori)
{
// Validate args
if (!is_file($file)) {
wppa_log('Err', 'File not found (wppa_orientate_image_file())');
return false;
}
if (!wppa_is_int($ori) || $ori < '2' || $ori > '8') {
wppa_log('Err', 'Bad arg $ori:' . $ori . ' (wppa_orientate_image_file())');
return false;
}
// Load image
$source = wppa_imagecreatefromjpeg($file);
if (!$source) {
wppa_log('Err', 'Could not create memoryimage from jpg file ' . $file);
return false;
}
// Perform operation
switch ($ori) {
case '2':
$orientate = $source;
imageflip($orientate, IMG_FLIP_HORIZONTAL);
break;
case '3':
$orientate = imagerotate($source, 180, 0);
break;
case '4':
$orientate = $source;
imageflip($orientate, IMG_FLIP_VERTICAL);
break;
case '5':
$orientate = imagerotate($source, 270, 0);
imageflip($orientate, IMG_FLIP_HORIZONTAL);
break;
case '6':
$orientate = imagerotate($source, 270, 0);
break;
case '7':
$orientate = imagerotate($source, 90, 0);
imageflip($orientate, IMG_FLIP_HORIZONTAL);
break;
case '8':
$orientate = imagerotate($source, 90, 0);
break;
}
// Output
imagejpeg($orientate, $file, wppa_opt('jpeg_quality'));
// Accessable
wppa_chmod($file);
// Optimized
wppa_optimize_image_file($file);
// Free the memory
imagedestroy($source);
@imagedestroy($orientate);
// Done
return true;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:57,代码来源:wppa-photo-files.php
示例2: wppa_encrypt_album
function wppa_encrypt_album($album)
{
// Feature enabled?
if (!wppa_switch('use_encrypted_links')) {
return $album;
}
// Encrypted album enumeration must always be expanded
$album = wppa_expand_enum($album);
// Decompose possible album enumeration
$album_ids = strpos($album, '.') === false ? array($album) : explode('.', $album);
$album_crypts = array();
$i = 0;
// Process all tokens
while ($i < count($album_ids)) {
$id = $album_ids[$i];
// Check for existance of album, otherwise return dummy
if (wppa_is_int($id) && $id > '0' && !wppa_album_exists($id)) {
$id = '999999';
}
switch ($id) {
case '-3':
$crypt = get_option('wppa_album_crypt_3', false);
break;
case '-2':
$crypt = get_option('wppa_album_crypt_2', false);
break;
case '-1':
$crypt = get_option('wppa_album_crypt_1', false);
break;
case '':
case '0':
$crypt = get_option('wppa_album_crypt_0', false);
break;
case '999999':
$crypt = get_option('wppa_album_crypt_9', false);
break;
default:
if (strlen($id) < 12) {
$crypt = wppa_get_album_item($id, 'crypt');
} else {
$crypt = $id;
// Already encrypted
}
}
$album_crypts[$i] = $crypt;
$i++;
}
// Compose result
$result = implode('.', $album_crypts);
return $result;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:51,代码来源:wppa-encrypt.php
示例3: wppa_album_number_to_name_in_uri
function wppa_album_number_to_name_in_uri($uri)
{
if (wppa_switch('use_album_names_in_urls')) {
$apos = strpos($uri, 'album=');
if ($apos === false) {
return $uri;
} else {
$start = $apos + '6';
$end = strpos($uri, '&', $start);
}
$before = substr($uri, 0, $start);
if ($end) {
$albnum = substr($uri, $start, $end - $start);
if (wppa_is_int($albnum) && $albnum > '0') {
// Can convert single positive integer album ids only
$after = substr($uri, $end);
$albnam = stripslashes(wppa_get_album_item($albnum, 'name'));
$albnam = wppa_encode_uri_component($albnam);
$uri = $before . $albnam . $after;
}
} else {
$albnum = substr($uri, $start);
if (wppa_is_int($albnum) && $albnum > '0') {
// Can convert single positive integer album ids only
$albnam = stripslashes(wppa_get_album_item($albnum, 'name'));
$albnam = wppa_encode_uri_component($albnam);
$uri = $before . $albnam;
}
}
}
return $uri;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:32,代码来源:wppa-links.php
示例4: wppa_slide_custom
function wppa_slide_custom($opt = '')
{
if ($opt == 'optional' && !wppa_switch('custom_on')) {
return;
}
if (wppa('is_slideonly')) {
return;
}
/* Not when slideonly */
if (is_feed()) {
return;
}
$content = __(stripslashes(wppa_opt('custom_content')));
// w#albdesc
if (wppa_is_int(wppa('start_album')) && wppa('start_album') > '0') {
$content = str_replace('w#albdesc', wppa_get_album_desc(wppa('start_album')), $content);
} else {
$content = str_replace('w#albdesc', '', $content);
}
// w#fotomoto
if (wppa_switch('fotomoto_on')) {
$fontsize = wppa_opt('fotomoto_fontsize');
if ($fontsize) {
$s = '<style>.FotomotoToolbarClass{font-size:' . wppa_opt('fotomoto_fontsize') . 'px !important;}</style>';
} else {
$s = '';
}
$content = str_replace('w#fotomoto', $s . '<div' . ' id="wppa-fotomoto-container-' . wppa('mocc') . '"' . ' class="wppa-fotomoto-container"' . ' >' . '</div>' . '<div' . ' id="wppa-fotomoto-checkout-' . wppa('mocc') . '"' . ' class="wppa-fotomoto-checkout FotomotoToolbarClass"' . ' style="float:right; clear:none;"' . ' >' . '<ul' . ' class="FotomotoBar"' . ' style="list-style:none outside none;"' . ' >' . '<li>' . '<a' . ' onclick="FOTOMOTO.API.checkout(); return false;"' . ' >' . __('Checkout', 'wp-photo-album-plus') . '</a>' . '</li>' . '</ul>' . '</div>' . '<div' . ' style="clear:both;"' . ' >' . '</div>', $content);
} else {
$content = str_replace('w#fotomoto', '', $content);
}
$content = wppa_html($content);
wppa_out('<div' . ' id="wppa-custom-' . wppa('mocc') . '"' . ' class="wppa-box wppa-custom"' . ' style="' . __wcs('wppa-box') . __wcs('wppa-custom') . '"' . ' >' . $content . '</div>');
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:34,代码来源:wppa-slideshow.php
示例5: wppa_get_thumb_masonry
function wppa_get_thumb_masonry($id)
{
global $wpdb;
// Init
if (!$id) {
wppa_dbg_msg('Please check file wppa-theme.php or any other php file that calls wppa_thumb_masonry(). Argument 1: photo id is missing!', 'red', 'force');
die('Please check your configuration');
}
$result = '';
$cont_width = wppa_get_container_width();
$count_cols = ceil($cont_width / wppa_opt('thumbsize'));
// Get the photo info
$thumb = wppa_cache_thumb($id);
// Get the album info
$album = wppa_cache_album($thumb['album']);
// Get photo info
$is_video = wppa_is_video($id);
$has_audio = wppa_has_audio($id);
$imgsrc = wppa_fix_poster_ext(wppa_get_thumb_path($id), $id);
if (!wppa_is_video($id) && !is_file($imgsrc)) {
$result .= '<div' . ' class=""' . ' style="' . 'font-size:10px;' . 'color:red;' . 'width:' . wppa_opt('thumbsize') . 'px;' . 'position:static;' . 'float:left;' . '"' . ' >' . sprintf(__('Missing thumbnail image #%s', 'wp-photo-album-plus'), $id) . '</div>';
return $result;
}
$alt = $album['alt_thumbsize'] == 'yes' ? '_alt' : '';
$imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, wppa_opt('thumbsize' . $alt), 'optional', 'thumb');
// Verical style ?
if (wppa_opt('thumbtype') == 'masonry-v') {
$imgwidth = wppa_opt('thumbsize');
$imgheight = $imgwidth * wppa_get_thumbratioyx($id);
$imgstyle = 'width:100%; height:auto; margin:0; position:relative; box-sizing:border-box;';
$frame_h = '';
} else {
$imgheight = wppa_opt('thumbsize');
$imgwidth = $imgheight * wppa_get_thumbratioxy($id);
$imgstyle = 'height:100%;' . 'width:auto;' . 'margin:0;' . 'position:relative;' . 'box-sizing:border-box;' . '';
$frame_h = 'height:100%; ';
}
// Mouseover effect?
if (wppa_switch('use_thumb_opacity')) {
$opac = wppa_opt('thumb_opacity');
$imgstyle .= ' opacity:' . $opac / 100 . '; filter:alpha( opacity=' . $opac . ' );';
}
// Padding
if (wppa_is_int(wppa_opt('tn_margin') / 2)) {
$imgstyle .= ' padding:' . wppa_opt('tn_margin') / 2 . 'px;';
} else {
$p1 = floor(wppa_opt('tn_margin') / 2);
$p2 = ceil(wppa_opt('tn_margin') / 2);
$imgstyle .= ' padding:' . $p1 . 'px ' . $p2 . 'px ' . $p2 . 'px ' . $p1 . 'px;';
}
// Cursor
$cursor = $imgattr_a['cursor'];
// Popup ?
if (wppa_switch('use_thumb_popup')) {
// Landscape?
if ($imgwidth > $imgheight) {
$popwidth = wppa_opt('popupsize');
$popheight = round($popwidth * $imgheight / $imgwidth);
} else {
$popheight = wppa_opt('popupsize');
$popwidth = round($popheight * $imgwidth / $imgheight);
}
} else {
$popwidth = $imgwidth;
$popheight = $imgheight;
}
$imgurl = wppa_fix_poster_ext(wppa_get_thumb_url($id, '', $popwidth, $popheight), $id);
$events = wppa_get_imgevents('thumb', $id);
$imgalt = wppa_get_imgalt($id);
// returns something like ' alt="Any text" '
$title = esc_attr(wppa_get_masonry_title($id));
// esc_attr( wppa_get_photo_name( $id ) );
// Feed ?
if (is_feed()) {
$imgattr_a = wppa_get_imgstyle_a($id, $imgsrc, '100', '4', 'thumb');
$style = $imgattr_a['style'];
$result .= '<a href="' . get_permalink() . '">' . '<img' . ' src="' . $imgurl . '"' . ' ' . $imgalt . ($title ? ' title="' . $title . '"' : '') . ' style="' . $style . '"' . ' />' . '</a>';
return;
}
// Get the image link
if (wppa('is_topten')) {
$no_album = !wppa('start_album');
if ($no_album) {
$tit = __('View the top rated photos', 'wp-photo-album-plus');
} else {
$tit = esc_attr(__(stripslashes($thumb['description'])));
}
$link = wppa_get_imglnk_a('thumb', $id, '', $tit, '', $no_album);
} else {
$link = wppa_get_imglnk_a('thumb', $id);
}
// voor parent uplr
// Open the thumbframe
// Add class wppa-mas-h-{mocc} for ie if horizontal
$is_ie_or_chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Trident') || strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome');
$result .= '
<div' . ' id="thumbnail_frame_masonry_' . $id . '_' . wppa('mocc') . '"' . ($is_ie_or_chrome && wppa_opt('thumbtype') == 'masonry-h' ? ' class="wppa-mas-h-' . wppa('mocc') . '"' : '') . ' style="' . $frame_h . 'position:static;' . 'float:left;' . 'font-size:12px;' . 'line-height:8px;' . 'overflow:hidden;' . 'box-sizing:content-box;' . '" >';
// The medals
$result .= wppa_get_medal_html_a(array('id' => $id, 'size' => 'M', 'where' => 'top'));
// See if ajax possible
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-thumbnails.php
示例6: wppa_convert_to_pretty
function wppa_convert_to_pretty($xuri)
{
// Make local copy
$uri = $xuri;
// Only when permalink structure is not default
if (!get_option('permalink_structure')) {
return $uri;
}
// Not on front page, the redirection will fail...
// if ( is_front_page() ) {
// return $uri;
// }
// Any querystring?
if (strpos($uri, '?') === false) {
return $uri;
}
// Not during search. Otherwise wppa_test_for_search('at_session_start') returns '';
// and this will destroy use and display searchstrings in wppa_session_start()
// Fix in 6.3.9
if (strpos($uri, 'searchstring')) {
return $uri;
}
// Re-order
if (strpos($uri, '&') !== false) {
$amps = true;
$uri = str_replace('&', '&', $uri);
} else {
$amps = false;
}
$parts = explode('?', $uri);
// If is_front_page(), redirection will fail
// During ajax, is_front_page() returns always false
// So we test on the existence of a page id ( a single / ) instead
// If no slash found, its http://mysite.com/wppaspec/.... this will fail: return xuri
$temp = $parts[0];
// Befor the ?
$temp = rtrim($temp, '/');
// remove potential trailing slash
$temp = str_replace('//', '', $temp);
// Remove //
if (strpos($temp, '/') === false) {
return $xuri;
// return original
}
$args = explode('&', $parts[1]);
$order = array('occur', 'woccur', 'searchstring', 'supersearch', 'topten', 'lasten', 'comten', 'featen', 'lang', 'single', 'tag', 'photos-only', 'albums-only', 'rel', 'relcount', 'upldr', 'owner', 'rootsearch', 'slide', 'cover', 'page', 'album', 'photo', 'hilite', 'calendar', 'caldate', 'debug', 'inv');
$uri = $parts[0] . '?';
$first = true;
foreach ($order as $item) {
foreach (array_keys($args) as $argidx) {
if (strpos($args[$argidx], $item) === 0 || strpos($args[$argidx], 'wppa-' . $item) === 0) {
if (!$first) {
$uri .= '&';
}
$uri .= $args[$argidx];
unset($args[$argidx]);
$first = false;
}
}
}
foreach ($args as $arg) {
// append unprocessed items
$uri .= '&' . $arg;
}
if ($amps) {
$uri = str_replace('&', '&', $uri);
}
// First filter for short query args
$uri = wppa_trim_wppa_($uri);
/* if ( wppa_switch( 'use_short_qargs' ) ) {
$uri = str_replace( '?wppa-', '?', $uri );
$uri = str_replace( '&wppa-', '&', $uri );
$uri = str_replace( '&wppa-', '&', $uri );
}
*/
// Now filter for album names in urls
if (wppa_switch('use_album_names_in_urls')) {
$apos = strpos($uri, 'album=');
if ($apos !== false) {
$start = $apos + '6';
$end = strpos($uri, '&', $start);
}
$before = substr($uri, 0, $start);
if ($end) {
$albnum = substr($uri, $start, $end - $start);
if (wppa_is_int($albnum) && $albnum > '0') {
// Can convert single positive integer album ids only
$after = substr($uri, $end);
$albnam = stripslashes(wppa_get_album_item($albnum, 'name'));
$albnam = wppa_encode_uri_component($albnam);
$uri = $before . $albnam . $after;
}
} else {
$albnum = substr($uri, $start);
if (wppa_is_int($albnum) && $albnum > '0') {
// Can convert single positive integer album ids only
$albnam = stripslashes(wppa_get_album_item($albnum, 'name'));
$albnam = wppa_encode_uri_component($albnam);
$uri = $before . $albnam;
}
//.........这里部分代码省略.........
开发者ID:lchen01,项目名称:STEdwards,代码行数:101,代码来源:wppa-links.php
示例7: wppa_get_get
function wppa_get_get($index)
{
static $wppa_get_get_cache;
// Found this already?
if (isset($wppa_get_get_cache[$index])) {
return $wppa_get_get_cache[$index];
}
// See if set
if (isset($_GET['wppa-' . $index])) {
// New syntax first
$result = $_GET['wppa-' . $index];
} elseif (isset($_GET[$index])) {
// Old syntax
$result = $_GET[$index];
} else {
return false;
}
// Not set
if ($result == 'nil') {
return false;
}
// Nil simulates not set
if (!strlen($result)) {
$result = '1';
}
// Set but no value
// Sanitize
$result = strip_tags($result);
if (strpos($result, '<?') !== false) {
die('Security check failure #191');
}
if (strpos($result, '?>') !== false) {
die('Security check failure #192');
}
// Post processing needed?
if ($index == 'photo' && !wppa_is_int($result)) {
// Encrypted?
$result = wppa_decrypt_photo($result);
// By name?
$result = wppa_get_photo_id_by_name($result, wppa_get_album_id_by_name(wppa_get_get('album')));
if (!$result) {
return false;
}
// Non existing photo, treat as not set
}
if ($index == 'album') {
// Encrypted?
$result = wppa_decrypt_album($result);
if (!wppa_is_int($result)) {
$temp = wppa_get_album_id_by_name($result);
if (wppa_is_int($temp) && $temp > '0') {
$result = $temp;
} elseif (!wppa_series_to_array($result)) {
$result = false;
}
}
}
// Save in cache
$wppa_get_get_cache[$index] = $result;
return $result;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:61,代码来源:wppa-utils.php
示例8: wppa_get_album_id_by_name
function wppa_get_album_id_by_name($xname, $report_dups = false)
{
global $wpdb;
global $allalbums;
if (wppa_is_int($xname)) {
return $xname;
// Already numeric
}
if (wppa_is_enum($xname)) {
return $xname;
// Is enumeration
}
$name = wppa_decode_uri_component($xname);
$name = str_replace('\'', '%', $name);
// A trick for single quotes
$name = str_replace('"', '%', $name);
// A trick for double quotes
$name = stripslashes($name);
$albs = $wpdb->get_results("SELECT `id` FROM `" . WPPA_ALBUMS . "` WHERE `name` LIKE '%" . $name . "%'", ARRAY_A);
if ($albs) {
if (count($albs == 1)) {
wppa_dbg_msg('Alb ' . $albs[0]['id'], ' found for ' . $xname);
$aid = $albs[0]['id'];
} else {
wppa_dbg_msg('Dups found for ' . $xname);
if ($report_dups) {
$aid = false;
} else {
$aid = $albs[0]['id'];
}
}
} else {
$aid = false;
}
if ($aid) {
wppa_dbg_msg('Aid ' . $aid . ' found for ' . $name);
} else {
wppa_dbg_msg('No aid found for ' . $name);
}
return $aid;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:41,代码来源:wppa-functions.php
示例9: wppa_do_maintenance_proc
//.........这里部分代码省略.........
}
} else {
wppa_log('Debug', 'Could not recover lost photo file ' . $photo_file . ' The id is not free');
}
}
}
}
break;
case 'wppa_remake':
if (wppa_remake_files('', $id)) {
$wppa_session[$slug . '_fixed']++;
} else {
$wppa_session[$slug . '_skipped']++;
}
break;
case 'wppa_watermark_all':
if (!wppa_is_video($id)) {
if (wppa_add_watermark($id)) {
wppa_create_thumbnail($id);
// create new thumb
$wppa_session[$slug . '_fixed']++;
} else {
$wppa_session[$slug . '_skipped']++;
}
} else {
$wppa_session[$slug . '_skipped']++;
}
break;
case 'wppa_create_all_autopages':
wppa_get_the_auto_page($id);
break;
case 'wppa_leading_zeros':
$name = $photo['name'];
if (wppa_is_int($name)) {
$target_len = wppa_opt('wppa_zero_numbers');
$name = strval(intval($name));
while (strlen($name) < $target_len) {
$name = '0' . $name;
}
}
if ($name !== $photo['name']) {
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `name` = %s WHERE `id` = %s", $name, $id));
}
break;
case 'wppa_add_gpx_tag':
$tags = $photo['tags'];
$temp = explode('/', $photo['location']);
if (!isset($temp['2'])) {
$temp['2'] = false;
}
if (!isset($temp['3'])) {
$temp['3'] = false;
}
$lat = $temp['2'];
$lon = $temp['3'];
if ($lat < 0.01 && $lat > -0.01 && $lon < 0.01 && $lon > -0.01) {
$lat = false;
$lon = false;
}
if ($photo['location'] && strpos($tags, 'Gpx') === false && $lat && $lon) {
// Add it
$tags = wppa_sanitize_tags($tags . ',Gpx');
wppa_update_photo(array('id' => $photo['id'], 'tags' => $tags));
wppa_index_update('photo', $photo['id']);
wppa_clear_taglist();
} elseif (strpos($tags, 'Gpx') !== false && !$lat && !$lon) {
开发者ID:billadams,项目名称:forever-frame,代码行数:67,代码来源:wppa-maintenance.php
示例10: wppa_update_photo
function wppa_update_photo($args)
{
global $wpdb;
if (!is_array($args)) {
return false;
}
if (!$args['id']) {
return false;
}
$thumb = wppa_cache_thumb($args['id']);
if (!$thumb) {
return false;
}
$id = $args['id'];
// If Timestamp update, make sure modified is updated to now
if (isset($args['timestamp'])) {
$args['modified'] = time();
}
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 'timestamp':
case 'modified':
if (!$itemvalue) {
$itemvalue = time();
}
$doit = true;
break;
case 'scheduledtm':
case 'exifdtm':
case 'page_id':
$doit = true;
break;
case 'status':
$doit = true;
break;
case 'tags':
$itemvalue = wppa_sanitize_tags($itemvalue);
$doit = true;
break;
case 'thumbx':
case 'thumby':
case 'photox':
case 'photoy':
case 'videox':
case 'videoy':
$itemvalue = intval($itemvalue);
$doit = true;
break;
case 'ext':
$doit = true;
break;
case 'filename':
$itemvalue = wppa_sanitize_file_name($itemvalue);
$doit = true;
break;
case 'custom':
case 'stereo':
$doit = true;
break;
case 'crypt':
$doit = true;
break;
case 'owner':
$doit = true;
break;
case 'album':
if (wppa_is_int($itemvalue) && $itemvalue > 0) {
$doit = true;
} else {
wppa_log('err', 'Invalid album id found in wppa_update_album(): ' . $itemvalue);
}
break;
default:
wppa_log('Error', 'Not implemented in wppa_update_photo(): ' . $itemname);
return false;
}
if ($doit) {
if ($wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `" . $itemname . "` = %s WHERE `id` = %s LIMIT 1", $itemvalue, $id))) {
wppa_cache_photo('invalidate', $id);
}
}
}
return true;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:98,代码来源:wppa-wpdb-update.php
示例11: 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('translate_text', wppa_opt('custom_caption_4')), apply_filters('translate_text', wppa_opt('custom_caption_5')), apply_filters('translate_text', wppa_opt('custom_caption_6')), apply_filters('translate_text', wppa_opt('custom_caption_7')), apply_filters('translate_text', wppa_opt('custom_caption_8')), apply_filters('translate_text', wppa_opt('custom_caption_9')));
$types = array('text', 'textarea', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text');
$doit = array(wppa_switch('fe_edit_name'), wppa_switch('fe_edit_desc'), wppa_switch('fe_edit_tags'), wppa_switch('custom_edit_0'), wppa_switch('custom_edit_1'), wppa_switch('custom_edit_2'), wppa_switch('custom_edit_3'), wppa_switch('custom_edit_4'), wppa_switch('custom_edit_5'), wppa_switch('custom_edit_6'), wppa_switch('custom_edit_7'), wppa_switch('custom_edit_8'), wppa_switch('custom_edit_9'));
// Open page
echo '<div' . ' style="width:100%;margin-top:8px;padding:8px;display:block;box-sizing:border-box;background-color:#fff;"' . ' >' . '<h3>' . '<img' . ' style="height:50px;"' . ' src="' . wppa_get_thumb_url($photo) . '"' . ' alt="' . $photo . '"' . ' />' . ' ' . wppa_opt('fe_edit_caption') . '</h3>';
// Open form
echo '<form' . ' >' . '<input' . ' type="hidden"' . ' id="wppa-nonce-' . $photo . '"' . ' name="wppa-nonce"' . ' value="' . wp_create_nonce('wppa-nonce-' . $photo) . '"' . ' />';
// Get custom data
$custom = wppa_get_photo_item($photo, 'custom');
if ($custom) {
$custom_data = unserialize($custom);
} else {
$custom_data = array('', '', '', '', '', '', '', '', '', '');
}
// Items
foreach (array_keys($items) as $idx) {
if ($titles[$idx] && $doit[$idx]) {
echo '<h6>' . $titles[$idx] . '</h6>';
if (wppa_is_int(substr($items[$idx], -1))) {
$value = stripslashes($custom_data[substr($items[$idx], -1)]);
} else {
$value = wppa_get_photo_item($photo, $items[$idx]);
if ($items[$idx] == 'tags') {
$value = trim($value, ',');
}
}
if ($types[$idx] == 'text') {
echo '<input' . ' type="text"' . ' style="width:100%;"' . ' id="' . $items[$idx] . '"' . ' name="' . $items[$idx] . '"' . ' value="' . esc_attr($value) . '"' . ' />';
}
if ($types[$idx] == 'textarea') {
echo '<textarea' . ' style="width:100%;min-width:100%;max-width:100%;"' . ' id="' . $items[$idx] . '"' . ' name="' . $items[$idx] . '"' . ' >' . esc_textarea(stripslashes($value)) . '</textarea>';
}
}
}
// Submit
echo '<input' . ' type="button"' . ' style="margin-top:8px;margin-right:8px;"' . ' value="' . esc_attr(__('Send', 'wp-photo-album-plus')) . '"' . ' onclick="wppaUpdatePhotoNew(' . $photo . ');document.location.reload(true);"' . ' />';
// Cancel
echo '<input' . ' type="button"' . ' style="margin-top:8px;"' . ' value="' . esc_attr(__('Cancel', 'wp-photo-album-plus')) . '"' . ' onclick="jQuery( \'.ui-button\' ).trigger(\'click\')"' . ' />';
// Close form
echo '</form>';
// Close page
echo '</div>';
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:46,代码来源:wppa-photo-admin-autosave.php
示例12: wppa_bump_viewcount
function wppa_bump_viewcount($type, $id)
{
global $wpdb;
global $wppa_session;
if (!wppa_switch('track_viewcounts')) {
return;
}
if ($type != 'album' && $type != 'photo') {
die('Illegal $type in wppa_bump_viewcount: ' . $type);
}
if ($type == 'album') {
if (strlen($id) == 12) {
$id = wppa_decrypt_album($id);
}
} else {
if (strlen($id) == 12) {
$id = wppa_decrypt_photo($id);
}
}
if ($id < '1') {
return;
}
// Not a wppa image
if (!wppa_is_int($id)) {
return;
}
// Not an integer
if (!isset($wppa_session[$type])) {
$wppa_session[$type] = array();
}
if (!isset($wppa_session[$type][$id])) {
// This one not done yest
$wppa_session[$type][$id] = true;
// Mark as viewed
if ($type == 'album') {
$table = WPPA_ALBUMS;
} else {
$table = WPPA_PHOTOS;
}
$count = $wpdb->get_var("SELECT `views` FROM `" . $table . "` WHERE `id` = " . $id);
$count++;
$wpdb->query("UPDATE `" . $table . "` SET `views` = " . $count . " WHERE `id` = " . $id);
wppa_dbg_msg('Bumped viewcount for ' . $type . ' ' . $id . ' to ' . $count, 'red');
// If 'wppa_owner_to_name'
if ($type == 'photo') {
wppa_set_owner_to_name($id);
}
}
wppa_save_session();
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:50,代码来源:wppa-statistics.php
示例13: wppa_do_maintenance_proc
//.........这里部分代码省略.........
}
if (wppa_switch('remake_missing_only')) {
if (is_file(wppa_get_thumb_path($id)) && is_file(wppa_get_photo_path($id))) {
$doit = false;
}
}
if ($doit && wppa_remake_files('', $id)) {
$wppa_session[$slug . '_fixed']++;
} else {
$wppa_session[$slug . '_skipped']++;
}
break;
case 'wppa_watermark_all':
if (!wppa_is_video($id)) {
if (wppa_add_watermark($id)) {
wppa_create_thumbnail($id);
// create new thumb
$wppa_session[$slug . '_fixed']++;
} else {
$wppa_session[$slug . '_skipped']++;
}
} else {
$wppa_session[$slug . '_skipped']++;
}
break;
case 'wppa_create_all_autopages':
wppa_get_the_auto_page($id);
break;
case 'wppa_delete_all_autopages':
wppa_remove_the_auto_page($id);
break;
case 'wppa_leading_zeros':
$name = $photo['name'];
if (wppa_is_int($name)) {
$target_len = wppa_opt('zero_numbers');
$name = strval(intval($name));
while (strlen($name) < $target_len) {
$name = '0' . $name;
}
}
if ($name !== $photo['name']) {
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_PHOTOS . "` SET `name` = %s WHERE `id` = %s", $name, $id));
}
break;
case 'wppa_add_gpx_tag':
$tags = $photo['tags'];
$temp = explode('/', $photo['location']);
if (!isset($temp['2'])) {
$temp['2'] = false;
}
if (!isset($temp['3'])) {
$temp['3'] = false;
}
$lat = $temp['2'];
$lon = $temp['3'];
if ($lat < 0.01 && $lat > -0.01 && $lon < 0.01 && $lon > -0.01) {
$lat = false;
$lon = false;
}
if ($photo['location'] && strpos($tags, 'Gpx') === false && $lat && $lon) {
// Add it
$tags = wppa_sanitize_tags($tags . ',Gpx');
wppa_update_photo(array('id' => $photo['id'], 'tags' => $tags));
wppa_index_update('photo', $photo['id']);
wppa_clear_taglist();
} elseif (strpos($tags, 'Gpx') !== false && !$lat && !$lon) {
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:67,代码来源:wppa-maintenance.php
示例14: wppa_cache_thumb
function wppa_cache_thumb($id, $data = '')
{
global $wpdb;
static $thumb;
static $thumb_cache_2;
// $id?
if (!$id) {
return false;
}
// Invalidate ?
if ($id == 'invalidate') {
if (isset($thumb_cache_2[$data])) {
unset($thumb_cache_2[$data]);
}
$thumb = false;
return false;
}
// Add ?
if ($id == 'add') {
if (!$data) {
// Nothing to add
return false;
} elseif (isset($data['id'])) {
// Add a single thumb to 2nd level cache
if (count($data) < 31) {
wppa_log('Err', 'Attempt to cache add incomplete photo item ' . $data['id'] . '. Only ' . count($data) . ' items supplied.');
return false;
}
$thumb_cache_2[$data['id']] = $data;
// Looks valid
} elseif (count($data) > 10000) {
return false;
// Too many, may cause out of memory error
} else {
foreach ($data as $thumb) {
// Add multiple
if (isset($thumb['id'])) {
// Looks valid
if (count($thumb) < 31) {
wppa_log('Err', 'Attempt to cache add incomplete photo item ' . $thumb['id'] . '. Only ' . count($thumb) . ' items supplied.');
return false;
}
$thumb_cache_2[$thumb['id']] = $thumb;
}
}
}
return false;
}
// Count ?
if ($id == 'count') {
if (is_array($thumb_cache_2)) {
return count($thumb_cache_2);
} else {
return false;
}
}
// Error in arg?
if (!wppa_is_int($id) || $id < '1') {
wppa_dbg_msg('Invalid arg wppa_cache_thumb(' . $id . ')', 'red');
$thumb = false;
wppa('current_photo', false);
return false;
}
// In first level cache?
if (isset($thumb['id']) && $thumb['id'] == $id) {
wppa_dbg_cachecounts('photohit');
wppa('current_photo', $thumb);
return $thumb;
}
// In second level cache?
if (!empty($thumb_cache_2)) {
if (in_array($id, array_keys($thumb_cache_2))) {
$thumb = $thumb_cache_2[$id];
wppa('current_photo', $thumb);
wppa_dbg_cachecounts('photohit');
return $thumb;
}
}
// Not in cache, do query
$thumb = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `id` = %s", $id), ARRAY_A);
wppa_dbg_cachecounts('photomis');
// Found one?
if ($thumb) {
// Store in second level cache
$thumb_cache_2[$id] = $thumb;
wppa('current_photo', $thumb);
return $thumb;
} else {
wppa_dbg_msg('Photo ' . $id . ' does not exist', 'red');
wppa('current_photo', false);
return false;
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:93,代码来源:wppa-items.php
示例15: _wppa_sidebar_page_options
//.........这里部分代码省略.........
$opts[] = $day;
$day++;
}
$vals = $opts;
$html = '<span style="float:left;" >' . sprintf(__('Current day# = %s, offset =', 'wp-photo-album-plus'), wppa_local_date($date_key)) . '</span> ' . wppa_select($slug, $opts, $vals, $onch);
$photo_order = wppa_local_date($date_key) - get_option('wppa_potd_offset', '0');
while ($photo_order < '0') {
$photo_order += $n_days;
}
$html .= sprintf(__('Todays photo order# = %s.', 'wp-photo-album-plus'), $photo_order);
wppa_setting($slug, '11b', $name, $desc, $html, $help);
}
}
$name = __('Preview', 'wp-photo-album-plus');
$desc = __('Current "photo of the day":', 'wp-photo-album-plus');
$help = '';
$slug = 'wppa_potd_photo';
$photo = wppa_get_potd();
if ($photo) {
$html = '<div style="display:inline-block;width:25%;text-align:center;vertical-align:middle;">' . '<img src="' . wppa_fix_poster_ext(wppa_get_thumb_url($photo['id']), $photo['id']) . '" />' . '</div>' . '<div style="display:inline-block;width:75%;text-align:center;vertical-align:middle;" >' . __('Album', 'wp-photo-album-plus') . ': ' . wppa_get_album_name($photo['album']) . '<br />' . __('Uploader', 'wp-photo-album-plus') . ': ' . $photo['owner'] . '</div>';
} else {
$html = __('Not found.', 'wp-photo-album-plus');
}
wppa_setting($slug, '12', $name, $desc, $html, $help);
$name = __('Show selection', 'wp-photo-album-plus');
$desc = __('Show the photos in the current selection.', 'wp-photo-album-plus');
$help = '';
$slug = 'wppa_potd_preview';
$html = wppa_checkbox($slug, $onch);
wppa_setting($slug, '13', $name, $desc, $html, $help);
// Cose table body
echo '</tbody>';
// Table footer
echo '<tfoot style="font-weight: bold;" >' . '<tr>' . '<td>' . __('#', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Name', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Description', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Setting', 'wp-photo-album-plus') . '</td>' . '<td>' . __('Help', 'wp-photo-album-plus') . '</td>' . '</tr>' . '</tfoot>' . '</table>';
// Diagnostic
// echo
// 'Diagnostic: wppa_potd_album = ' . get_option( 'wppa_potd_album' ) . ' wppa_potd_photo = ' . get_option( 'wppa_potd_photo' );
// Status star must be here for js
echo '<img' . ' id="img_potd_photo"' . ' src="' . wppa_get_imgdir('star.ico') . '" style="height:12px;display:none;"' . ' />';
// The potd photo pool
echo '<table class="widefat wppa-table wppa-setting-table" >';
// Table header
echo '<thead>' . '<tr>' . '<td>' . __('Photos in the current selection', 'wp-photo-album-plus') . '</td>' . '</tr>' . '</thead>';
// Table body
if (wppa_switch('potd_preview')) {
echo '<tbody>' . '<tr>' . '<td>';
// Get the photos
$alb = wppa_opt('potd_album');
$opt = wppa_is_int($alb) ? ' ' . wppa_get_photo_order($alb) . ' ' : '';
$photos = wppa_get_widgetphotos($alb, $opt);
// Count them
$cnt = count($photos);
// Find current
$curid = wppa_opt('potd_photo');
// See if we do this
if (empty($photos)) {
_e('No photos in the selection', 'wp-photo-album-plus');
} elseif ($cnt > '5000') {
echo sprintf(__('There are too many photos in the selection to show a preview ( %d )', 'wp-photo-album-plus'), $cnt);
} else {
// Yes, display the pool
foreach ($photos as $photo) {
$id = $photo['id'];
// Open container div
echo '<div' . ' class="photoselect"' . ' style="' . 'width:180px;' . 'height:300px;' . '" >';
// Open image container div
echo '<div' . ' style="' . 'width:180px;' . 'height:135px;' . 'overflow:hidden;' . 'text-align:center;' . '" >';
// The image if a video
if (wppa_is_video($id)) {
echo wppa_get_video_html(array('id' => $id, 'style' => 'width:180px;'));
} else {
echo '<img' . ' src=" ' . wppa_fix_poster_ext(wppa_get_thumb_url($id), $id) . '"' . ' style="' . 'max-width:180px;' . 'max-height:135px;' . 'margin:auto;' . '"' . ' alt="' . esc_attr(wppa_get_photo_name($id)) . '" />';
// Audio ?
if (wppa_has_audio($id)) {
echo wppa_get_audio_html(array('id' => $id, 'style' => 'width:180px;' . 'position:relative;' . 'bottom:' . (wppa_get_audio_control_height() + 4) . 'px;'));
}
}
// Close image containe
|
请发表评论