本文整理汇总了PHP中wppa_error_message函数的典型用法代码示例。如果您正苦于以下问题:PHP wppa_error_message函数的具体用法?PHP wppa_error_message怎么用?PHP wppa_error_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppa_error_message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wppa_insert_photo
function wppa_insert_photo($file = '', $alb = '', $name = '', $desc = '', $porder = '0', $id = '0', $linkurl = '', $linktitle = '')
{
global $wpdb;
global $warning_given_small;
$album = wppa_cache_album($alb);
if (!wppa_allow_uploads($alb)) {
if (is_admin() && !wppa('ajax')) {
wppa_error_message(sprintf(__('Album %s is full', 'wp-photo-album-plus'), wppa_get_album_name($alb)));
} else {
wppa_alert(sprintf(__('Album %s is full', 'wp-photo-album-plus'), wppa_get_album_name($alb)));
}
return false;
}
if ($file != '' && $alb != '') {
// Get the name if not given
if ($name == '') {
$name = basename($file);
}
// Sanitize name
$filename = wppa_sanitize_file_name($name);
$name = wppa_sanitize_photo_name($name);
// If not dups allowed and its already here, quit
if (isset($_POST['wppa-nodups']) || wppa_switch('void_dups')) {
$exists = wppa_file_is_in_album($filename, $alb);
if ($exists) {
if (isset($_POST['del-after-p'])) {
unlink($file);
$msg = __('Photo %s already exists in album number %s. Removed from depot.', 'wp-photo-album-plus');
} else {
$msg = __('Photo %s already exists in album number %s.', 'wp-photo-album-plus');
}
wppa_warning_message(sprintf($msg, $name, $alb));
return false;
}
}
// Verify file exists
if (!wppa('is_remote') && !file_exists($file)) {
if (!is_dir(dirname($file))) {
wppa_error_message('Error: Directory ' . dirname($file) . ' does not exist.');
return false;
}
if (!is_writable(dirname($file))) {
wppa_error_message('Error: Directory ' . dirname($file) . ' is not writable.');
return false;
}
wppa_error_message('Error: File ' . $file . ' does not exist.');
return false;
}
// else {
// wppa_ok_message( 'Good: File '.$file.' exists.' );
// }
// Get and verify the size
$img_size = getimagesize($file);
if ($img_size) {
if (wppa_check_memory_limit('', $img_size['0'], $img_size['1']) === false) {
wppa_error_message(sprintf(__('ERROR: Attempt to upload a photo that is too large to process (%s).', 'wp-photo-album-plus'), $name) . wppa_check_memory_limit());
wppa('ajax_import_files_error', __('Too big', 'wp-photo-album-plus'));
return false;
}
if (!$warning_given_small && ($img_size['0'] < wppa_get_minisize() && $img_size['1'] < wppa_get_minisize())) {
wppa_warning_message(__('WARNING: You are uploading photos that are too small. Photos must be larger than the thumbnail size and larger than the coverphotosize.', 'wp-photo-album-plus'));
wppa('ajax_import_files_error', __('Too small', 'wp-photo-album-plus'));
$warning_given_small = true;
}
} else {
wppa_error_message(__('ERROR: Unable to retrieve image size of', 'wp-photo-album-plus') . ' ' . $name . ' ' . __('Are you sure it is a photo?', 'wp-photo-album-plus'));
wppa('ajax_import_files_error', __('No imagesize', 'wp-photo-album-plus'));
return false;
}
// Get ext based on mimetype, regardless of ext
switch ($img_size[2]) {
// mime type
case 1:
$ext = 'gif';
break;
case 2:
$ext = 'jpg';
break;
case 3:
$ext = 'png';
break;
default:
wppa_error_message(__('Unsupported mime type encountered:', 'wp-photo-album-plus') . ' ' . $img_size[2] . '.');
return false;
}
// Get an id if not yet there
if ($id == '0') {
$id = wppa_nextkey(WPPA_PHOTOS);
}
// Get opt deflt desc if empty
if ($desc == '' && wppa_switch('apply_newphoto_desc')) {
$desc = stripslashes(wppa_opt('newphoto_description'));
}
// Reset rating
$mrat = '0';
// Find ( new ) owner
$owner = wppa_get_user();
// Validate album
if (!is_numeric($alb) || $alb < '1') {
wppa_error_message(__('Album not known while trying to add a photo', 'wp-photo-album-plus'));
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-admin-functions.php
示例2: wppa_is_time_up
function wppa_is_time_up($count = '')
{
global $wppa_starttime;
$timnow = microtime(true);
$laptim = $timnow - $wppa_starttime;
$maxwppatim = wppa_opt('max_execution_time');
$maxinitim = ini_get('max_execution_time');
if ($maxwppatim && $maxinitim) {
$maxtim = min($maxwppatim, $maxinitim);
} elseif ($maxwppatim) {
$maxtim = $maxwppatim;
} elseif ($maxinitim) {
$maxtim = $maxinitim;
} else {
return false;
}
wppa_dbg_msg('Maxtim = ' . $maxtim . ', elapsed = ' . $laptim, 'red');
if (!$maxtim) {
return false;
}
// No limit or no value
if ($maxtim - $laptim > '5') {
return false;
}
if ($count) {
if (is_admin()) {
if (wppa_switch('auto_continue')) {
wppa_warning_message(sprintf(__('Time out after processing %s items.', 'wp-photo-album-plus'), $count));
} else {
wppa_error_message(sprintf(__('Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus'), $count));
}
} else {
wppa_alert(sprintf(__('Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus'), $count));
}
}
return true;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:37,代码来源:wppa-utils.php
示例3: wppa_maintenance_messages
function wppa_maintenance_messages()
{
if (!current_user_can('wppa_settings')) {
return;
}
if (get_option('wppa_remake_index_photos_status') || get_option('wppa_index_need_remake', 'no') == 'yes') {
wppa_error_message(__('</strong>The photo index table needs to be rebuilt. Please run <b>Photo Albums -> Settings</b> admin page <b>Table VIII-A9</b><strong>', 'wppa'));
update_option('wppa_remake_index_photos_status', 'required');
}
if (get_option('wppa_remake_index_albums_status') || get_option('wppa_index_need_remake', 'no') == 'yes') {
wppa_error_message(__('</strong>The album index table needs to be rebuilt. Please run <b>Photo Albums -> Settings</b> admin page <b>Table VIII-A8</b><strong>', 'wppa'));
update_option('wppa_remake_index_albums_status', 'required');
}
if (wppa_switch('wppa_rating_on') && get_option('wppa_rerate_status')) {
wppa_error_message(__('</strong>The avarage ratings need to be recalculated. Please run <b>Photo Albums -> Settings</b> admin page <b>Table VIII-A5</b><strong>', 'wppa'));
}
}
开发者ID:billadams,项目名称:forever-frame,代码行数:17,代码来源:wppa.php
示例4: wppa_get_thumbs
function wppa_get_thumbs()
{
global $wpdb;
global $thumbs;
global $wppa_session;
// Log we are in
wppa_dbg_msg('Get_thumbs entered, mocc = ' . wppa('mocc') . ', Start_album=' . wppa('start_album') . ', Cover=' . wppa('is_cover'));
// Done already this occ?
if (is_array($thumbs)) {
wppa_dbg_msg('Cached thumbs used');
return $thumbs;
}
// A cover -> no thumbs
if (wppa('is_cover')) {
wppa_dbg_msg('Its cover, leave get_thumbs');
return false;
}
// Albums only -> no thumbs
if (wppa('albums_only')) {
wppa_dbg_msg('Albums only, leave get_thumbs');
return false;
}
// Init
$count_first = true;
// Start timer
$time = -microtime(true);
// Make Album clause
$fullalb = wppa('start_album');
// See if album is an enumeration or range
if (strpos($fullalb, '.') == false) {
$album_clause = ' `album` = ' . $fullalb;
} else {
$ids = wppa_series_to_array($fullalb);
$album_clause = ' `album` IN ( ' . implode(',', $ids) . ' )';
}
// So far so good
// Now make the query, dependant of type of selection
// Init
$query = '';
// Single image slideshow?
if (wppa('start_photo') && wppa('is_single')) {
$query = $wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', wppa('start_photo'));
} elseif (wppa('is_upldr')) {
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
if (!is_user_logged_in()) {
$status .= " AND `status` <> 'private'";
}
if (wppa('start_album')) {
$query = $wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE " . $album_clause . " AND `owner` = %s AND ( ( " . $status . " ) OR `owner` = %s ) " . "ORDER BY `timestamp` DESC", wppa('is_upldr'), wppa_get_user());
} else {
$query = $wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE `owner` = %s AND ( ( " . $status . " ) OR `owner` = %s ) " . "ORDER BY `timestamp` DESC", wppa('is_upldr'), wppa_get_user());
}
} elseif (wppa('is_topten')) {
$max = wppa('topten_count');
switch (wppa_opt('topten_sortby')) {
case 'mean_rating':
$sortby = '`mean_rating` DESC, `rating_count` DESC, `views` DESC';
break;
case 'rating_count':
$sortby = '`rating_count` DESC, `mean_rating` DESC, `views` DESC';
break;
case 'views':
$sortby = '`views` DESC, `mean_rating` DESC, `rating_count` DESC';
break;
default:
wppa_error_message('Unimplemented sorting method');
$sortby = '';
break;
}
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
if (!is_user_logged_in()) {
$status .= " AND `status` <> 'private'";
}
if (wppa('start_album')) {
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE " . $album_clause . " AND ( " . $status . " ) " . "ORDER BY " . $sortby . " LIMIT " . $max;
} else {
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE ( " . $status . " ) " . "ORDER BY " . $sortby . " LIMIT " . $max;
}
$count_first = false;
} elseif (wppa('is_featen')) {
$max = wppa('featen_count');
if (wppa('start_album')) {
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE " . $album_clause . " AND `status` = 'featured' " . "ORDER BY RAND( " . wppa_get_randseed() . " ) DESC LIMIT " . $max;
} else {
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE `status` = 'featured' " . "ORDER BY RAND( " . wppa_get_randseed() . " ) DESC LIMIT " . $max;
}
$count_first = false;
} elseif (wppa('is_lasten')) {
$max = wppa('lasten_count');
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
if (!is_user_logged_in()) {
$status .= " AND `status` <> 'private'";
}
$order_by = wppa_switch('lasten_use_modified') ? 'modified' : 'timestamp';
// If you want only 'New' photos in the selection, the period must be <> 0;
if (wppa_switch('wppa_lasten_limit_new') && wppa_opt('max_photo_newtime')) {
$newtime = " `" . $order_by . "` >= " . (time() - wppa_opt('max_photo_newtime'));
if (current_user_can('wppa_moderate')) {
if (wppa('start_album')) {
$query = "SELECT * FROM `" . WPPA_PHOTOS . "` " . "WHERE ( " . $album_clause . " ) AND ( " . $newtime . " ) " . "ORDER BY `" . $order_by . "` DESC LIMIT " . $max;
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-functions.php
示例5: wppa_import_dir_to_album
function wppa_import_dir_to_album($file, $parent)
{
global $photocount;
global $wpdb;
global $wppa_session;
// Session should survive the default hour
wppa_extend_session();
// see if album exists
if (is_dir($file)) {
// Check parent
if (wppa_switch('import_parent_check')) {
$alb = wppa_get_album_id(basename($file), $parent);
// If parent = 0 ( top-level album ) and album not found,
// try a 'separate' album ( i.e. parent = -1 ) with this name
if (!$alb && $parent == '0') {
$alb = wppa_get_album_id(basename($file), '-1');
}
} else {
$alb = wppa_get_album_id(basename($file), false);
}
if (!$alb) {
// Album must be created
$name = basename($file);
$uplim = wppa_opt('upload_limit_count') . '/' . wppa_opt('upload_limit_time');
$alb = wppa_create_album_entry(array('name' => $name, 'a_parent' => $parent));
if ($alb === false) {
wppa_error_message(__('Could not create album.', 'wp-photo-album-plus') . '<br/>Query = ' . $query);
wp_die('Sorry, cannot continue');
} else {
wppa_set_last_album($alb);
wppa_flush_treecounts($alb);
wppa_index_add('album', $alb);
wppa_create_pl_htaccess();
wppa_ok_message(__('Album #', 'wp-photo-album-plus') . ' ' . $alb . ' ( ' . $name . ' ) ' . __('Added.', 'wp-photo-album-plus'));
if (wppa_switch('newpag_create') && $parent <= '0') {
// Create post object
$my_post = array('post_title' => $name, 'post_content' => str_replace('w#album', $alb, wppa_opt('newpag_content')), 'post_status' => wppa_opt('newpag_status'), 'post_type' => wppa_opt('newpag_type'));
// Insert the post into the database
$pagid = wp_insert_post($my_post);
if ($pagid) {
wppa_ok_message(sprintf(__('Page <a href="%s" target="_blank" >%s</a> created.', 'wp-photo-album-plus'), home_url() . '?page_id=' . $pagid, $name));
$wpdb->query($wpdb->prepare("UPDATE `" . WPPA_ALBUMS . "` SET `cover_linkpage` = %s WHERE `id` = %s", $pagid, $alb));
} else {
wppa_error_message(__('Could not create page.', 'wp-photo-album-plus'));
}
}
}
}
// Now import the files
$photofiles = glob($file . '/*');
if ($photofiles) {
foreach ($photofiles as $photofile) {
if (!is_dir($photofile)) {
if (!isset($wppa_session[$photofile]) || !wppa_switch('keep_import_files')) {
if (wppa_albumphoto_exists($alb, basename($photofile))) {
if (!wppa_switch('keep_import_files')) {
wppa_warning_message('Photo ' . basename($photofile) . ' already exists in album ' . $alb . '. Removed. (2)');
}
} else {
$bret = wppa_insert_photo($photofile, $alb, basename($photofile));
$photocount++;
}
if (!wppa_switch('keep_import_files')) {
@unlink($photofile);
}
$wppa_session[$photofile] = true;
}
if (wppa_is_time_up($photocount)) {
return false;
}
}
}
}
// Now go deeper, process the subdirs
$subdirs = glob($file . '/*');
if ($subdirs) {
foreach ($subdirs as $subdir) {
if (is_dir($subdir)) {
if (basename($subdir) != '.' && basename($subdir) != '..') {
$bret = wppa_import_dir_to_album($subdir, $alb);
if (!$bret) {
return false;
}
// Time out
}
}
}
}
@rmdir($file);
// Try to remove dir, ignore error
} else {
wppa_dbg_msg('Invalid file in wppa_import_dir_to_album(): ' . $file);
return false;
}
return true;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:96,代码来源:wppa-import.php
示例6: wppa_check_dirs
function wppa_check_dirs()
{
if (!is_multisite()) {
// check if uploads dir exists
$upload_dir = wp_upload_dir();
$dir = $upload_dir['basedir'];
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('The uploads directory does not exist, please do a regular WP upload first.', 'wp-photo-album-plus') . '<br/>' . $dir);
return false;
} else {
if (WPPA_DEBUG) {
wppa_ok_message(__('Successfully created uploads directory.', 'wp-photo-album-plus') . '<br/>' . $dir);
}
}
}
@chmod($dir, 0755);
}
// check if wppa dir exists
$dir = WPPA_UPLOAD_PATH;
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('Could not create the wppa directory.', 'wp-photo-album-plus') . wppa_credirmsg($dir));
return false;
} else {
if (WPPA_DEBUG) {
wppa_ok_message(__('Successfully created wppa directory.', 'wp-photo-album-plus') . '<br/>' . $dir);
}
}
}
@chmod($dir, 0755);
// check if thumbs dir exists
$dir = WPPA_UPLOAD_PATH . '/thumbs';
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('Could not create the wppa thumbs directory.', 'wp-photo-album-plus') . wppa_credirmsg($dir));
return false;
} else {
if (WPPA_DEBUG) {
wppa_ok_message(__('Successfully created wppa thumbs directory.', 'wp-photo-album-plus') . '<br/>' . $dir);
}
}
}
@chmod($dir, 0755);
// check if watermarks dir exists
$dir = WPPA_UPLOAD_PATH . '/watermarks';
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('Could not create the wppa watermarks directory.', 'wp-photo-album-plus') . wppa_credirmsg($dir));
return false;
} else {
if (WPPA_DEBUG) {
wppa_ok_message(__('Successfully created wppa watermarks directory.', 'wp-photo-album-plus') . '<br/>' . $dir);
}
}
}
@chmod($dir, 0755);
// check if fonts dir exists
$dir = WPPA_UPLOAD_PATH . '/fonts';
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('Could not create the wppa fonts directory.', 'wp-photo-album-plus') . wppa_credirmsg($dir));
return false;
} else {
if (WPPA_DEBUG) {
wppa_ok_message(__('Successfully created wppa fonts directory.', 'wp-photo-album-plus') . '<br/>' . $dir);
}
}
}
@chmod($dir, 0755);
// check if depot dir exists
if (!is_multisite()) {
// check if users depot dir exists
$dir = WPPA_CONTENT_PATH . '/wppa-depot';
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('Unable to create depot directory.', 'wp-photo-album-plus') . wppa_credirmsg($dir));
return false;
} else {
if (WPPA_DEBUG) {
wppa_ok_message(__('Successfully created wppa depot directory.', 'wp-photo-album-plus') . '<br/>' . $dir);
}
}
}
@chmod($dir, 0755);
}
// check the user depot directory
$dir = WPPA_DEPOT_PATH;
if (!is_dir($dir)) {
wppa_mktree($dir);
if (!is_dir($dir)) {
wppa_error_message(__('Unable to create user depot directory', 'wp-photo-album-plus') . wppa_credirmsg($dir));
return false;
} else {
//.........这里部分代码省略.........
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:101,代码来源:wppa-setup.php
示例7: wppa_del_album
function wppa_del_album($id, $move = '')
{
global $wpdb;
if ($move && !wppa_have_access($move)) {
wppa_error_message(__('Unable to move photos to album %s. Album not deleted.', 'wp-photo-album-plus'));
return false;
}
// Photos in the album
$photos = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `album` = %s', $id), ARRAY_A);
if (empty($move)) {
// will delete all the album's photos
if (is_array($photos)) {
$cnt = '0';
foreach ($photos as $photo) {
$t = -microtime(true);
wppa_delete_photo($photo['id']);
$cnt++;
$t += microtime(true);
// wppa_dbg_msg('Del photo took :'.$t, 'red', 'force');
// Time up?
if (wppa_is_time_up()) {
wppa_flush_treecounts($id);
$msg = sprintf(__('Time is out after %d photo deletes. Please redo this operation', 'wp-photo-album-plus'), $cnt);
if (wppa('ajax')) {
echo $msg;
} else {
wppa_error_message($msg);
}
return;
}
}
}
} else {
// Move
if (is_array($photos)) {
foreach ($photos as $photo) {
$wpdb->query($wpdb->prepare('UPDATE `' . WPPA_PHOTOS . '` SET `album` = %s WHERE `id` = %s', $move, $photo['id']));
wppa_move_source($photo['filename'], $photo['album'], $move);
if (wppa_is_time_up()) {
wppa_error_message('Time is out. Please redo this operation');
return;
}
}
}
wppa_flush_treecounts($move);
}
// First flush treecounts, otherwise we do not know the parent if any
wppa_flush_treecounts($id);
// Now delete the album
$wpdb->query($wpdb->prepare('DELETE FROM `' . WPPA_ALBUMS . '` WHERE `id` = %s LIMIT 1', $id));
wppa_delete_album_source($id);
wppa_index_remove('album', $id);
$msg = __('Album Deleted.', 'wp-photo-album-plus');
if (wppa('ajax')) {
echo $msg;
} else {
wppa_update_message($msg);
}
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:59,代码来源:wppa-album-admin-autosave.php
示例8: wppa_get_date_time_select_html
function wppa_get_date_time_select_html($type, $id, $selectable = true)
{
$type = strtoupper(substr($type, 0, 1)) . strtolower(substr($type, 1));
if ($type == 'Photo') {
$thumb = wppa_cache_thumb($id);
} elseif ($type == 'Album') {
$album = wppa_cache_album($id);
} else {
wppa_error_message('Uniplemented type: ' . $type . ' in wppa_get_date_time_select_html()');
}
$opt_months = array('1' => __('Jan', 'wp-photo-album-plus'), '2' => __('Feb', 'wp-photo-album-plus'), '3' => __('Mar', 'wp-photo-album-plus'), '4' => __('Apr', 'wp-photo-album-plus'), '5' => __('May', 'wp-photo-album-plus'), '6' => __('Jun', 'wp-photo-album-plus'), '7' => __('Jul', 'wp-photo-album-plus'), '8' => __('Aug', 'wp-photo-album-plus'), '9' => __('Sep', 'wp-photo-album-plus'), '10' => __('Oct', 'wp-photo-album-plus'), '11' => __('Nov', 'wp-photo-album-plus'), '12' => __('Dec', 'wp-photo-album-plus'));
$val_months = array('1' => '01', '2' => '02', '3' => '03', '4' => '04', '5' => '05', '6' => '06', '7' => '07', '8' => '08', '9' => '09', '10' => '10', '11' => '11', '12' => '12');
$opt_years = array('2014', '2015', '2016', '2017', '2018', '2019', '2020');
$val_years = $opt_years;
$opt_days = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31');
$val_days = $opt_days;
$opt_hours = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
$val_hours = $opt_hours;
$opt_mins = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59');
$val_mins = $opt_mins;
$curval = $type == 'Photo' ? $thumb['scheduledtm'] : $album['scheduledtm'];
if (!$curval) {
$curval = wppa_get_default_scheduledtm();
}
$temp = explode(',', $curval);
$cur_day = $temp[2];
$cur_month = $temp[1];
$cur_year = $temp[0];
$cur_hour = $temp[3];
$cur_min = $temp[4];
$result = '';
if ($selectable) {
$result .= '<select name="wppa-day" id="wppa-day-' . $id . '" class="wppa-datetime-' . $id . '" onchange="wppaAjaxUpdate' . $type . '(' . $id . ', \'day\', this);" >';
foreach (array_keys($opt_days) as $key) {
$sel = $val_days[$key] == $cur_day ? 'selected="selected"' : '';
$result .= '<option value="' . $val_days[$key] . '" ' . $sel . ' >' . $opt_days[$key] . '</option>';
}
$result .= '</select >';
$result .= '<select name="wppa-month" id="wppa-month-' . $id . '" class="wppa-datetime-' . $id . '" onchange="wppaAjaxUpdate' . $type . '(' . $id . ', \'month\', this);" >';
foreach (array_keys($opt_months) as $key) {
$sel = $val_months[$key] == $cur_month ? 'selected="selected"' : '';
$result .= '<option value="' . $val_months[$key] . '" ' . $sel . ' >' . $opt_months[$key] . '</option>';
}
$result .= '</select >';
$result .= '<select name="wppa-year" id="wppa-year-' . $id . '" class="wppa-datetime-' . $id . '" onchange="wppaAjaxUpdate' . $type . '(' . $id . ', \'year\', this);" >';
foreach (array_keys($opt_years) as $key) {
$sel = $val_years[$key] == $cur_year ? 'selected="selected"' : '';
$result .= '<option value="' . $val_years[$key] . '" ' . $sel . ' >' . $opt_years[$key] . '</option>';
}
$result .= '</select >@';
$result .= '<select name="wppa-hour" id="wppa-hour-' . $id . '" class="wppa-datetime-' . $id . '" onchange="wppaAjaxUpdate' . $type . '(' . $id . ', \'hour\', this);" >';
foreach (array_keys($opt_hours) as $key) {
$sel = $val_hours[$key] == $cur_hour ? 'selected="selected"' : '';
$result .= '<option value="' . $val_hours[$key] . '" ' . $sel . ' >' . $opt_hours[$key] . '</option>';
}
$result .= '</select >:';
$result .= '<select name="wppa-min" id="wppa-min-' . $id . '" class="wppa-datetime-' . $id . '" onchange="wppaAjaxUpdate' . $type . '(' . $id . ', \'min\', this);">';
foreach (array_keys($opt_mins) as $key) {
$sel = $val_mins[$key] == $cur_min ? 'selected="selected"' : '';
$result .= '<option value="' . $val_mins[$key] . '" ' . $sel . ' >' . $opt_mins[$key] . '</option>';
}
$result .= '</select >';
} else {
$result .= '<span class="wppa-datetime-' . $id . '" >' . $cur_day . ' ' . $opt_months[strval(intval($cur_month))] . ' ' . $cur_year . '@' . $cur_hour . ':' . $cur_min . '</span>';
}
return $result;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:67,代码来源:wppa-date-time.php
示例9: wppa_cat_message
function wppa_cat_message()
{
wppa_error_message(__('</strong>The cats system needs to be converted. Please run <b>Photo Albums -> Settings</b> admin page <b>Table VIII-B17</b><strong>', 'wp-photo-album-plus'));
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:4,代码来源:wppa.php
示例10: wppa_get_thumbs
function wppa_get_thumbs()
{
global $wpdb;
global $wppa;
global $thumbs;
global $wppa_session;
if ($wppa['is_owner'] && !$wppa['start_album']) {
return false;
}
// No owner album( s ) -> no photos
wppa_dbg_msg('get_thumbs entered: ' . $wppa['mocc'] . ' Start_album=' . $wppa['start_album'] . ', Cover=' . $wppa['is_cover']);
if ($wppa['is_cover']) {
wppa_dbg_msg('its cover, leave get_thumbs');
return;
}
if ($wppa['albums_only']) {
return false;
}
if (is_array($thumbs)) {
// Done already?
wppa_dbg_msg('cached thumbs used');
return $thumbs;
}
$time = -microtime(true);
// See if album is an enumeration or range
$fullalb = $wppa['start_album'];
// Assume not
if (strpos($fullalb, '.') !== false) {
$ids = wppa_series_to_array($fullalb);
$fullalb = implode(' OR `album` = ', $ids);
}
// Single image slideshow?
if ($wppa['start_photo'] && $wppa['is_single']) {
$thumbs = $wpdb->get_results($wpdb->prepare('SELECT * FROM `' . WPPA_PHOTOS . '` WHERE `id` = %s', $wppa['start_photo']), ARRAY_A);
wppa_dbg_q('Q-SIS');
} elseif ($wppa['is_upldr']) {
$max = '1000000';
$alb = $fullalb;
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
if (!is_user_logged_in()) {
$status .= " AND `status` <> 'private'";
}
if ($alb) {
$query = $wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE ( `album` = " . $alb . " ) AND `owner` = %s AND ( ( " . $status . " ) OR `owner` = %s ) ORDER BY `timestamp` DESC LIMIT %d", $wppa['is_upldr'], wppa_get_user(), $max);
//, ARRAY_A );
} else {
$query = $wpdb->prepare("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `owner` = %s AND ( ( " . $status . " ) OR `owner` = %s ) ORDER BY `timestamp` DESC LIMIT %d", $wppa['is_upldr'], wppa_get_user(), $max);
//, ARRAY_A );
}
$thumbs = $wpdb->get_results($query, ARRAY_A);
wppa_dbg_q('Q-UPL');
} elseif ($wppa['is_topten']) {
$max = $wppa['topten_count'];
$alb = $fullalb;
switch (wppa_opt('topten_sortby')) {
case 'mean_rating':
$sortby = '`mean_rating` DESC, `rating_count` DESC, `views` DESC';
break;
case 'rating_count':
$sortby = '`rating_count` DESC, `mean_rating` DESC, `views` DESC';
break;
case 'views':
$sortby = '`views` DESC, `mean_rating` DESC, `rating_count` DESC';
break;
default:
wppa_error_message('Unimplemented sorting method');
$sortby = '';
break;
}
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
if (!is_user_logged_in()) {
$status .= " AND `status` <> 'private'";
}
if ($alb) {
$thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE ( `album` = " . $alb . " AND " . $status . " ) ORDER BY " . $sortby . " LIMIT " . $max, ARRAY_A);
} else {
$thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE ( " . $status . " ) ORDER BY " . $sortby . " LIMIT " . $max, ARRAY_A);
}
wppa_dbg_q('Q-TT');
} elseif ($wppa['is_featen']) {
$max = $wppa['featen_count'];
$alb = $fullalb;
if ($alb) {
$thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' AND ( `album` = " . $alb . " ) ORDER BY RAND( " . wppa_get_randseed() . " ) DESC LIMIT " . $max, ARRAY_A);
} else {
$thumbs = $wpdb->get_results("SELECT * FROM `" . WPPA_PHOTOS . "` WHERE `status` = 'featured' ORDER BY RAND( " . wppa_get_randseed() . " ) DESC LIMIT " . $max, ARRAY_A);
}
wppa_dbg_q('Q-FT');
} elseif ($wppa['is_lasten']) {
$max = $wppa['lasten_count'];
$alb = $fullalb;
$status = "`status` <> 'pending' AND `status` <> 'scheduled'";
if (!is_user_logged_in()) {
$status .= " AND `status` <> 'private'";
}
// If you want only 'New' photos in the selection, the period must be <> 0;
if (wppa_switch('wppa_lasten_limit_new') && wppa_opt('max_photo_newtime')) {
$newtime = " `timestamp` >= " . (time() - wppa_opt('max_photo_newtime'));
if (current_user_can('wppa_moderate')) {
if ($alb) {
//.........这里部分代码省略.........
开发者ID:billadams,项目名称:forever-frame,代码行数:101,代码来源:wppa-functions.php
示例11: wppa_get_widgetphotos
function wppa_get_widgetphotos($alb, $option = '')
{
global $wpdb;
if (!$alb) {
return false;
}
$photos = false;
$query = '';
// Compile status clause
switch (wppa_opt('potd_status_filter')) {
case 'publish':
$statusclause = " `status` = 'publish' ";
break;
case 'featured':
$statusclause = " `status` = 'featured' ";
break;
case 'gold':
$statusclause = " `status` = 'gold' ";
break;
case 'silver':
$statusclause = " `status` = 'silver' ";
break;
case 'bronze':
$statusclause = " `status` = 'bronze' ";
break;
case 'anymedal':
$statusclause = " `status` IN ( 'gold', 'silver', 'bronze' ) ";
break;
default:
$statusclause = " `status` <> 'scheduled' ";
if (!is_user_logged_in()) {
$statusclause .= " AND `status` <> 'private' ";
}
}
// If physical album(s) and include subalbums is active, make it an enumeration(with ',' as seperator)
if (wppa_opt('potd_album_type') == 'physical' && wppa_switch('potd_include_subs')) {
$alb = str_replace(',', '.', $alb);
$alb = wppa_expand_enum(wppa_alb_to_enum_children($alb));
$alb = str_replace('.', ',', $alb);
}
// If physical albums and inverse selection is active, invert selection
if (wppa_opt('potd_album_type') == 'physical' && wppa_switch('potd_inverse')) {
$albs = explode(',', $alb);
$all = $wpdb->get_col("SELECT `id` FROM `" . WPPA_ALBUMS . "` ");
$alb = implode(',', array_diff($all, $albs));
}
/* Now find out the final query */
/* Physical albums */
// Is it a single album?
if (wppa_is_int($alb)) {
$query = $wpdb->prepare("SELECT `id`, `p_order` " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `album` = %s " . "AND " . $statusclause . $option, $alb);
} elseif (strchr($alb, ',')) {
$alb = trim($alb, ',');
$query = "SELECT `id`, `p_order` " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE `album` IN ( " . $alb . " ) " . "AND " . $statusclause . $option;
} elseif ($alb == 'all') {
$query = "SELECT `id`, `p_order` " . "FROM `" . WPPA_PHOTOS . "` " . "WHERE " . $statusclause . $option;
} elseif ($alb == 'sep') {
$albs = $wpdb->get_results("SELECT `id`, `a_parent` FROM `" . WPPA_ALBUMS . "`", ARRAY_A);
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` WHERE ( `album` = '0' ";
$first = true;
foreach ($albs as $a) {
if ($a['a_parent'] == '-1') {
$query .= "OR `album` = '" . $a['id'] . "' ";
}
}
$query .= ") AND " . $statusclause . $option;
} elseif ($alb == 'all-sep') {
$albs = $wpdb->get_results("SELECT `id`, `a_parent` FROM `" . WPPA_ALBUMS . "`", ARRAY_A);
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` WHERE ( `album` IN ('0'";
foreach ($albs as $a) {
if ($a['a_parent'] != '-1') {
$query .= ",'" . $a['id'] . "'";
}
}
$query .= ") ) AND " . $statusclause . $option;
} elseif ($alb == 'topten') {
// Find the 'top' policy
switch (wppa_opt('topten_sortby')) {
case 'mean_rating':
$sortby = '`mean_rating` DESC, `rating_count` DESC, `views` DESC';
break;
case 'rating_count':
$sortby = '`rating_count` DESC, `mean_rating` DESC, `views` DESC';
break;
case 'views':
$sortby = '`views` DESC, `mean_rating` DESC, `rating_count` DESC';
break;
default:
wppa_error_message('Unimplemented sorting method');
$sortby = '';
break;
}
// It is assumed that status is ok for top rated photos
$query = "SELECT `id`, `p_order` FROM `" . WPPA_PHOTOS . "` ORDER BY " . $sortby . " LIMIT " . wppa_opt('topten_count');
$query .= $option;
}
// Do the query
if ($query) {
$photos = $wpdb->get_results($query, ARRAY_A);
wppa_dbg_msg('Potd query: ' . $query);
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:wppa-widget-functions.php
示例12: wppa_verify_page
function wppa_verify_page($xslug)
{
global $wpdb;
global $wppa_opt;
// Does slug exist?
if (!isset($wppa_opt[$xslug])) {
wppa_error_message('Unexpected error in wppa_verify_page()', 'red', 'force');
return;
}
// A page number 0 is allowed ( same post/page )
if (!$wppa_opt[$xslug]) {
return;
}
$slug = substr($xslug, 5);
// If page vanished, update to 0
$iret = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `" . $wpdb->posts . "` WHERE `post_type` = 'page' AND `post_status` = 'publish' AND `ID` = %s", wppa_opt($slug)));
if (!$iret) {
wppa_update_option($slug, '0');
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:20,代码来源:wppa-settings-autosave.php
示例13: wppa_write_photo_file
function wppa_write_photo_file($photo)
{
global $wppa_zip;
global $wppa_temp;
global $wppa_temp_idx;
if ($photo) {
$fname = WPPA_DEPOT_PATH . '/' . $photo['id'] . '.pmf';
$file = fopen($fname, 'wb');
$err = false;
if ($file) {
if (fwrite($file, "name=" . $photo['name'] . "\n") !== FALSE) {
if (fwrite($file, "desc=" . wppa_nl_to_txt($photo['description']) . "\n") !== FALSE) {
if (fwrite($file, "pord=" . $photo['p_order'] . "\n") !== FALSE) {
if (fwrite($file, "albm=" . wppa_get_album_name($photo['album'], 'raw') . "\n") !== FALSE) {
if (fwrite($file, "lnku=" . $photo['linkurl'] . "\n") !== FALSE) {
if (fwrite($file, "lnkt=" . $photo['linktitle'] . "\n") !== FALSE) {
/*
ext tinytext NOT NULL,
mean_rating tinytext NOT NULL,
linktarget tinytext NOT NULL,
owner text NOT NULL,
timestamp tinytext NOT NULL,
status tinytext NOT NULL,
rating_count bigint(20) NOT NULL default '0',
tags tinytext NOT NULL,
alt tinytext NOT NULL,
filename tinytext NOT NULL,
modified tinytext NOT NULL,
location tinytext NOT NULL,
*/
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
} else {
$err = true;
}
if ($err) {
wppa_error_message(sprintf(__('Cannot write to file %s.', 'wp-photo-album-plus'), $fname));
fclose($file);
return false;
} else {
fclose($file);
if ($wppa_zip) {
$wppa_zip->addFile($fname, basename($fname));
}
$wppa_temp[$wppa_temp_idx] = $fname;
$wppa_temp_idx++;
}
} else {
wppa_error_message(__('Could not open photo output file.', 'wp-photo-album-plus'));
return false;
}
} else {
wppa_error_message(__('Could not read photo data.', 'wp-photo-album-plus'));
return false;
}
return true;
}
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:70,代码来源:wppa-export.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 `filena
|
请发表评论