本文整理汇总了PHP中wppa_log函数 的典型用法代码示例。如果您正苦于以下问题:PHP wppa_log函数的具体用法?PHP wppa_log怎么用?PHP wppa_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_log函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_album_cover
function wppa_album_cover($id)
{
global $wppa;
// Init alt/even
wppa('alt', 'alt');
// Find the cover type
$cover_type = wppa_get_album_item($id, 'cover_type') ? wppa_get_album_item($id, 'cover_type') : wppa_opt('wppa_cover_type');
// Use the default setting
// Find the cover photo position
$wppa['coverphoto_pos'] = wppa_opt('wppa_coverphoto_pos');
// Assume multicolumn responsive
$is_mcr = true;
// Dispatch on covertype
switch ($cover_type) {
case 'default':
$is_mcr = false;
case 'default-mcr':
wppa_album_cover_default($id, $is_mcr);
break;
case 'imagefactory':
$is_mcr = false;
case 'imagefactory-mcr':
if ($wppa['coverphoto_pos'] == 'left') {
$wppa['coverphoto_pos'] = 'top';
}
if ($wppa['coverphoto_pos'] == 'right') {
$wppa['coverphoto_pos'] = 'bottom';
}
wppa_album_cover_imagefactory($id, $is_mcr);
break;
case 'longdesc':
$is_mcr = false;
case 'longdesc-mcr':
if ($wppa['coverphoto_pos'] == 'top') {
$wppa['coverphoto_pos'] = 'left';
}
if ($wppa['coverphoto_pos'] == 'bottom') {
$wppa['coverphoto_pos'] = 'right';
}
wppa_album_cover_longdesc($id, $is_mcr);
break;
default:
$err = 'Unimplemented covertype: ' . $cover_type;
wppa_dbg_msg($err);
wppa_log('Err', $err);
}
}
开发者ID:billadams, 项目名称:forever-frame, 代码行数:47, 代码来源:wppa-album-covers.php
示例2: wppa_album_cover
function wppa_album_cover($id)
{
// Find the album specific cover type
$cover_type = wppa_get_album_item($id, 'cover_type');
// No type specified (0), use default
if (!$cover_type) {
$cover_type = wppa_opt('cover_type');
}
// Find the cover photo position
wppa('coverphoto_pos', wppa_opt('coverphoto_pos'));
// Assume multicolumn responsive
$is_mcr = true;
// Dispatch on covertype
switch ($cover_type) {
case 'default':
$is_mcr = false;
case 'default-mcr':
wppa_album_cover_default($id, $is_mcr);
break;
case 'imagefactory':
$is_mcr = false;
case 'imagefactory-mcr':
if (wppa('coverphoto_pos') == 'left') {
wppa('coverphoto_pos', 'top');
}
if (wppa('coverphoto_pos') == 'right') {
wppa('coverphoto_pos', 'bottom');
}
wppa_album_cover_imagefactory($id, $is_mcr);
break;
case 'longdesc':
$is_mcr = false;
case 'longdesc-mcr':
if (wppa('coverphoto_pos') == 'top') {
wppa('coverphoto_pos', 'left');
}
if (wppa('coverphoto_pos') == 'bottom') {
wppa('coverphoto_pos', 'right');
}
wppa_album_cover_longdesc($id, $is_mcr);
break;
default:
$err = 'Unimplemented covertype: ' . $cover_type;
wppa_dbg_msg($err);
wppa_log('Err', $err);
}
}
开发者ID:msayagh, 项目名称:Quercus-source-code-Maven, 代码行数:47, 代码来源:wppa-album-covers.php
示例3: wppa_create_pl_htaccess
function wppa_create_pl_htaccess($pl_dirname = '')
{
global $wpdb;
// Only supported on single sites at the moment
if (is_multisite() && !WPPA_MULTISITE_GLOBAL) {
return false;
}
// Where are the photo source files?
$source_root = str_replace(ABSPATH, '', wppa_opt('wppa_source_dir'));
// Find permalink root name
if (!$pl_dirname) {
$pl_dirname = wppa_opt('wppa_pl_dirname');
}
// If no pl_dirname, feature is disabled
if (!$pl_dirname) {
return false;
}
// Create pl root directory
$pl_root = WPPA_CONTENT_PATH . '/' . $pl_dirname;
if (!wppa_mktree($pl_root)) {
wppa_log('Error', 'Can not create ' . $pl_root);
return false;
}
// Create .htaccess file
$file = fopen($pl_root . '/.htaccess', 'wb');
if (!$file) {
wppa_log('Error', 'Can not create ' . $pl_root . '/.htaccess');
return false;
}
fwrite($file, '<IfModule mod_rewrite.c>');
fwrite($file, "\n" . 'RewriteEngine On');
// RewriteBase /wp-content/wppa-pl
fwrite($file, "\n" . 'RewriteBase /' . str_replace(ABSPATH, '', $pl_root));
$albs = $wpdb->get_results("SELECT `id`, `name` FROM `" . WPPA_ALBUMS . "` ORDER BY `name` DESC", ARRAY_A);
if ($albs) {
foreach ($albs as $alb) {
$fm = wppa_sanitize_file_name($alb['name'], false);
$to = $source_root . '/album-' . $alb['id'];
fwrite($file, "\n" . 'RewriteRule ^' . $fm . '/(.*) /' . $to . '/$1 [NC]');
}
}
fwrite($file, "\n" . '</IfModule>');
fclose($file);
return true;
}
开发者ID:billadams, 项目名称:forever-frame, 代码行数:45, 代码来源:wppa-htaccess.php
示例4: wppa_save_source
function wppa_save_source($file, $name, $alb)
{
$doit = true;
// Frontend not enabled and not ajax ?
if (!is_admin() && !wppa_switch('keep_source_frontend')) {
$doit = false;
}
// Frontend not enabled and ajax ?
if (isset($_REQUEST['wppa-action']) && $_REQUEST['wppa-action'] == 'do-fe-upload' && !wppa_switch('keep_source_frontend')) {
$doit = false;
}
// Backend not enabled ?
if ((!isset($_REQUEST['wppa-action']) || $_REQUEST['wppa-action'] != 'do-fe-upload') && is_admin() && !wppa_switch('keep_source_admin')) {
$doit = false;
}
if ($doit) {
if (!is_dir(wppa_opt('source_dir'))) {
@wppa_mktree(wppa_opt('source_dir'));
}
$sourcedir = wppa_get_source_dir();
if (!is_dir($sourcedir)) {
@wppa_mktree($sourcedir);
}
$albdir = wppa_get_source_album_dir($alb);
if (!is_dir($albdir)) {
@wppa_mktree($albdir);
}
if (!is_dir($albdir)) {
wppa_log('Err', 'Could not create source directory ' . $albdir);
}
$dest = $albdir . '/' . wppa_sanitize_file_name($name);
if ($file != $dest) {
@copy($file, $dest);
}
// Do not copy to self, and do not bother on failure
if (is_file($dest)) {
wppa_chmod($dest);
} else {
wppa_log('Err', 'Could not save ' . $dest, true);
}
}
}
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:42, 代码来源:wppa-source.php
示例5: wppa_save_session
function wppa_save_session()
{
global $wpdb;
global $wppa_session;
static $last_query;
// If no id can be found, give up
if (!wppa_get_session_id()) {
return false;
}
// If no id present, give up
if (!isset($wppa_session['id'])) {
return false;
}
// To prevent data overflow, only save the most recent 100 urls
$c = count($wppa_session['uris']);
if ($c > 100) {
array_shift($wppa_session['uris']);
}
// Compose the query
$query = $wpdb->prepare("UPDATE `" . WPPA_SESSION . "` SET `data` = %s WHERE `id` = %s", serialize($wppa_session), $wppa_session['id']);
// Only update if data differs from previous update
if ($query != $last_query) {
// Do the query
$iret = $wpdb->query($query);
// Remember last successfull query
if ($iret !== false) {
$last_query = $query;
// wppa_log('Dbg', 'Saved session '.$wppa_session['id']);
return true;
}
// No luck, maybe attemt to save a session that never started.
// Mostly robots that modify their own ip.
// Just ignore is the best way
wppa_log('Dbg', 'Could not save session ' . $wppa_session['id']);
// $wppa_session = false;
// $last_query = false;
// wppa_session_start();
return false;
}
// No error return
return true;
}
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:42, 代码来源:wppa-session.php
示例6: wppa_exif_clean_garbage
function wppa_exif_clean_garbage($photo)
{
global $wpdb;
$items = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . WPPA_EXIF . "` WHERE `photo` = %s", $photo), ARRAY_A);
if (is_array($items)) {
foreach ($items as $item) {
$txt = sanitize_text_field($item['description']);
$txt = str_replace(array(chr(0), chr(1), chr(2), chr(3), chr(4), chr(5), chr(6), chr(7)), '', $txt);
// Cleaned text empty?
if (!$txt) {
// Garbage
$wpdb->query($wpdb->prepare("DELETE FROM `" . WPPA_EXIF . "` WHERE `id` = %s", $item['id']));
// Current label still used?
$in_use = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . WPPA_EXIF . "` WHERE `photo` <> '0' AND `tag` = %s", $item['tag']));
if (!$in_use) {
$wpdb->query($wpdb->prepare("DELETE FROM `" . WPPA_EXIF . "` WHERE `photo` = '0' AND `tag` = %s", $item['tag']));
wppa_log('dbg', 'Exif tag label ' . $item['tag'] . ' removed.');
}
}
}
}
}
开发者ID:billadams, 项目名称:forever-frame, 代码行数:22, 代码来源:wppa-exif-iptc-common.php
示例7: wppa_get_photo_item
function wppa_get_photo_item($id, $item)
{
$photo = wppa_cache_photo($id);
if ($photo) {
if (isset($photo[$item])) {
return trim($photo[$item]);
} else {
wppa_log('Err', 'Photo item ' . $item . ' does not exist. ( get_photo_item )', true);
}
} else {
wppa_log('Err', 'Photo ' . $id . ' does not exist. ( get_photo_item )', true);
}
return false;
}
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:14, 代码来源:wppa-items.php
示例8: wppa_create_thumbnail
function wppa_create_thumbnail($id, $use_source = true)
{
// Find file to make thumbnail from
$source_path = wppa_fix_poster_ext(wppa_get_source_path($id), $id);
// Use source if requested and available
if ($use_source) {
if (!wppa_switch('watermark_thumbs') && is_file($source_path)) {
$file = $source_path;
// Use sourcefile
} else {
$file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
// Use photofile
}
// Non standard orientation files: never use source
$orient = wppa_get_exif_orientation($file);
if ($orient > '1') {
$file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
// Use photofile
}
} else {
$file = wppa_fix_poster_ext(wppa_get_photo_path($id), $id);
// Use photofile
}
// Max side
$max_side = wppa_get_minisize();
// Check file
if (!file_exists($file)) {
return false;
}
// No file, fail
$img_attr = getimagesize($file);
if (!$img_attr) {
return false;
}
// Not an image, fail
// Retrieve aspect
$asp_attr = explode(':', wppa_opt('thumb_aspect'));
// Get output path
$thumbpath = wppa_get_thumb_path($id);
if (wppa_get_ext($thumbpath) == 'xxx') {
// Video poster
$thumbpath = wppa_strip_ext($thumbpath) . '.jpg';
}
// Source size
$src_size_w = $img_attr[0];
$src_size_h = $img_attr[1];
// Temp convert width if stereo
if (wppa_get_photo_item($id, 'stereo')) {
$src_size_w /= 2;
}
// Mime type and thumb type
$mime = $img_attr[2];
$type = $asp_attr[2];
// Source native aspect
$src_asp = $src_size_h / $src_size_w;
// Required aspect
if ($type == 'none') {
$dst_asp = $src_asp;
} else {
$dst_asp = $asp_attr[0] / $asp_attr[1];
}
// Convert back width if stereo
if (wppa_get_photo_item($id, 'stereo')) {
$src_size_w *= 2;
}
// Create the source image
switch ($mime) {
// mime type
case 1:
// gif
$temp = @imagecreatefromgif($file);
if ($temp) {
$src = imagecreatetruecolor($src_size_w, $src_size_h);
imagecopy($src, $temp, 0, 0, 0, 0, $src_size_w, $src_size_h);
imagedestroy($temp);
} else {
$src = false;
}
break;
case 2:
// jpeg
if (!function_exists('wppa_imagecreatefromjpeg')) {
wppa_log('Error', 'Function wppa_imagecreatefromjpeg does not exist.');
}
$src = @wppa_imagecreatefromjpeg($file);
break;
case 3:
// png
$src = @imagecreatefrompng($file);
break;
}
if (!$src) {
wppa_log('Error', 'Image file ' . $file . ' is corrupt while creating thmbnail');
return true;
}
// Compute the destination image size
if ($dst_asp < 1.0) {
// Landscape
$dst_size_w = $max_side;
$dst_size_h = round($max_side * $dst_asp);
//.........这里部分代码省略.........
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:101, 代码来源:wppa-photo-files.php
示例9: wppa_error_message
function wppa_error_message($msg, $fixed = false, $id = '')
{
?>
<div id="wppa-er-<?php
echo $id;
?>
" class="error <?php
if ($fixed == 'fixed') {
echo fade;
}
?>
" <?php
if ($fixed == 'hidden') {
echo 'style="display:none;"';
}
if ($fixed == 'fixed') {
echo 'style="position: fixed;"';
}
?>
><p><strong><?php
echo $msg;
?>
</strong></p></div>
<?php
wppa_log('Error', $msg);
}
开发者ID:msayagh, 项目名称:Quercus-source-code-Maven, 代码行数:26, 代码来源:wppa-admin-functions.php
示例10: wppa_set_owner_to_name
function wppa_set_owner_to_name($id)
{
global $wpdb;
static $usercache;
// Feature enabled?
if (wppa_switch('owner_to_name')) {
// Get photo data.
$p = wppa_cache_thumb($id);
// Find user of whose display name equals photoname
if (isset($usercache[$p['name']])) {
$user = $usercache[$p['name']];
} else {
$user = $wpdb->get_var($wpdb->prepare("SELECT `user_login` FROM `" . $wpdb->users . "` WHERE `display_name` = %s", $p['name']));
if ($user) {
$usercache[$p['name']] = $user;
} else {
$usercache[$p['name']] = false;
// NULL is equal to ! isset() !!!
}
}
if ($user) {
if ($p['owner'] != $user) {
wppa_update_photo(array('id' => $id, 'owner' => $user));
wppa_cache_thumb('invalidate', $id);
wppa_log('Obs', 'Owner of photo ' . $id . ' in album ' . wppa_get_photo_item($id, 'album') . ' set to: ' . $user);
return true;
} else {
return '0';
}
}
}
return false;
}
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:33, 代码来源:wppa-utils.php
示例11: 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
示例12: wppa_session_end
function wppa_session_end()
{
global $wpdb;
global $wppa_session;
if (!wppa_get_session_id()) {
return false;
}
$iret = $wpdb->query($wpdb->prepare("UPDATE `" . WPPA_SESSION . "` SET `data` = %s WHERE `session` = %s", serialize($wppa_session), wppa_get_session_id()));
if ($iret === false) {
wppa_log('Error', 'Unable to save session.');
return false;
}
return true;
}
开发者ID:billadams, 项目名称:forever-frame, 代码行数:14, 代码来源:wppa-session.php
示例13: wppa_grant_albums
function wppa_grant_albums($xparent = false)
{
global $wpdb;
static $grant_parents;
static $my_albs_parents;
static $owner;
static $user;
// Feature enabled?
if (!wppa_switch('grant_an_album')) {
return false;
}
// Owners only?
if (!wppa_switch('owner_only')) {
return false;
}
// User logged in?
if (!is_user_logged_in()) {
return false;
}
// Can user upload?
if (!current_user_can('wppa_upload') && !wppa_switch('user_upload_on')) {
return false;
}
// Init
$albums_created = array();
// Get required data if not done already
// First get the grant parent album(s)
if (!is_array($grant_parents)) {
switch (wppa_opt('grant_parent_sel_method')) {
case 'selectionbox':
// Album ids are and expanded enumeration sep by , in the setting
$grant_parents = explode(',', wppa_opt('grant_parent'));
if (!is_array($grant_parents)) {
$grant_parents = array('0');
}
break;
case 'category':
// The option hold a category
$grant_parents = $wpdb->get_col("SELECT `id` " . "FROM `" . WPPA_ALBUMS . "` " . "WHERE `cats` LIKE '%," . wppa_opt('grant_parent') . ",%'");
break;
case 'indexsearch':
$temp = $wpdb->get_var("SELECT `albums` " . "FROM `" . WPPA_INDEX . "` " . "WHERE `slug` = '" . wppa_opt('grant_parent') . "'");
$grant_parents = explode('.', wppa_expand_enum($temp));
break;
}
}
if (!$owner) {
$owner = wppa_get_user('login');
// The current users login name
}
if (!is_array($my_albs_parents)) {
$query = $wpdb->prepare("SELECT DISTINCT `a_parent` FROM `" . WPPA_ALBUMS . "` WHERE `owner` = %s", $owner);
$my_albs_parents = $wpdb->get_col($query);
if (!is_array($my_albs_parents)) {
$my_albs_parents = array();
}
}
if (!$user) {
$user = wppa_get_user(wppa_opt('grant_name'));
// The current users name as how the album should be named
}
// If a parent is given and it is not a grant parent, quit
if ($xparent && !in_array($xparent, $grant_parents)) {
return false;
}
// If a parent is given, it will now be a grant parent (see directly above), only create the granted album inside this parent.
if ($xparent) {
$parents = array($xparent);
} else {
$parents = $grant_parents;
}
// Parent independant album data
$name = $user;
$desc = __('Default photo album for', 'wp-photo-album-plus') . ' ' . $user;
// May be multiple granted parents. Check for all parents.
foreach ($parents as $parent) {
// Create only grant album if: parent is either -1 or existing
if ($parent == '-1' || wppa_album_exists($parent)) {
if (!in_array($parent, $my_albs_parents, true)) {
// make an album for this user
$id = wppa_create_album_entry(array('name' => $name, 'description' => $desc, 'a_parent' => $parent));
if ($id) {
wppa_log('Obs', 'Album ' . wppa_get_album_name($parent) . '(' . $parent . ')' . ' -> ' . $id . ' for ' . $user . ' created.');
$albums_created[] = $id;
// Add this parent to the array of my albums parents
$my_albs_parents[] = $parent;
} else {
wppa_log('Err', 'Could not create subalbum of ' . $parent . ' for ' . $user);
}
wppa_flush_treecounts($parent);
wppa_index_add('album', $id);
}
}
}
// Remake permalink redirects
if (!empty($albums_created)) {
wppa_create_pl_htaccess();
}
return $albums_created;
}
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:100, 代码来源:wppa-setup.php
示例14: 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;
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:msayagh, 项目名称:Quercus-source-code-Maven, 代码行数:85, 代码来源:wppa-wpdb-update.php
示例15: 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
示例16: 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
示例17: wppa_fix_source_path
function wppa_fix_source_path()
{
if (strpos(wppa_opt('source_dir'), ABSPATH) === 0) {
return;
}
// Nothing to do here
$wp_content = trim(str_replace(home_url(), '', content_url()), '/');
// The source path should be: ( default ) WPPA_ABSPATH.WPPA_UPLOAD.'/wppa-source',
// Or at least below WPPA_ABSPATH
if (strpos(wppa_opt('source_dir'), WPPA_ABSPATH) === false) {
if (strpos(wppa_opt('source_dir'), $wp_content) !== false) {
// Its below wp-content
$temp = explode($wp_content, wppa_opt('source_dir'));
$temp['0'] = WPPA_ABSPATH;
wppa_update_option('wppa_source_dir', implode($wp_content, $temp));
wppa_log('Fix', 'Sourcepath set to ' . wppa_opt('source_dir'));
} else {
// Give up, set to default
wppa_update_option('wppa_source_dir', WPPA_ABSPATH . WPPA_UPLOAD . '/wppa-source');
wppa_log('Fix', 'Sourcepath set to default.');
}
}
}
开发者ID:uwmadisoncals, 项目名称:Cluster-Plugins, 代码行数:23, 代码来源:wppa-maintenance.php
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1221| 2022-08-30
DeekshithSN/shared-library
阅读:694| 2022-08-15
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1134| 2022-08-17
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:945| 2022-11-06
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1342| 2022-08-18
1. 真机调试获取不到数据
问题描述:在模拟器上可以获取到数据,但是在真机调试获
阅读:632| 2022-07-18
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:486| 2022-08-16
An issue has been discovered in GitLab CE/EE affecting all versions starting fro
阅读:867| 2022-07-08
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:643| 2022-11-06
shem8/MaterialLogin: Login view with material design
阅读:725| 2022-08-17
请发表评论