本文整理汇总了PHP中nggdb::delete_gallery方法的典型用法代码示例。如果您正苦于以下问题:PHP nggdb::delete_gallery方法的具体用法?PHP nggdb::delete_gallery怎么用?PHP nggdb::delete_gallery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggdb
的用法示例。
在下文中一共展示了nggdb::delete_gallery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_processor_galleries
function post_processor_galleries()
{
global $wpdb, $ngg, $nggdb;
// bulk update in a single gallery
if (isset($_POST['bulkaction']) && isset($_POST['doaction'])) {
check_admin_referer('ngg_bulkgallery');
switch ($_POST['bulkaction']) {
case 'no_action':
// No action
break;
case 'recover_images':
// Recover images from backup
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_recover_image', $_POST['doaction'], __('Recover from backup', 'nggallery'));
break;
case 'set_watermark':
// Set watermark
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_set_watermark', $_POST['doaction'], __('Set watermark', 'nggallery'));
break;
case 'import_meta':
// Import Metadata
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_import_metadata', $_POST['doaction'], __('Import metadata', 'nggallery'));
break;
case 'delete_gallery':
// Delete gallery
if (is_array($_POST['doaction'])) {
$deleted = false;
foreach ($_POST['doaction'] as $id) {
// get the path to the gallery
$gallery = nggdb::find_gallery($id);
if ($gallery) {
//TODO:Remove also Tag reference, look here for ids instead filename
$imagelist = $wpdb->get_col("SELECT filename FROM {$wpdb->nggpictures} WHERE galleryid = '{$gallery->gid}' ");
if ($ngg->options['deleteImg']) {
if (is_array($imagelist)) {
foreach ($imagelist as $filename) {
@unlink(WINABSPATH . $gallery->path . '/thumbs/thumbs_' . $filename);
@unlink(WINABSPATH . $gallery->path . '/' . $filename);
@unlink(WINABSPATH . $gallery->path . '/' . $filename . '_backup');
}
}
// delete folder
@rmdir(WINABSPATH . $gallery->path . '/thumbs');
@rmdir(WINABSPATH . $gallery->path);
}
}
do_action('ngg_delete_gallery', $id);
$deleted = nggdb::delete_gallery($id);
}
if ($deleted) {
nggGallery::show_message(__('Gallery deleted successfully ', 'nggallery'));
}
}
break;
}
}
if (isset($_POST['addgallery']) && isset($_POST['galleryname'])) {
check_admin_referer('ngg_addgallery');
if (!nggGallery::current_user_can('NextGEN Add new gallery')) {
wp_die(__('Cheatin’ uh?'));
}
// get the default path for a new gallery
$defaultpath = $ngg->options['gallerypath'];
$newgallery = esc_attr($_POST['galleryname']);
if (!empty($newgallery)) {
nggAdmin::create_gallery($newgallery, $defaultpath);
}
do_action('ngg_update_addgallery_page');
}
if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_ResizeImages'])) {
check_admin_referer('ngg_thickbox_form');
//save the new values for the next operation
$ngg->options['imgWidth'] = (int) $_POST['imgWidth'];
$ngg->options['imgHeight'] = (int) $_POST['imgHeight'];
// What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
update_option('ngg_options', $ngg->options);
$gallery_ids = explode(',', $_POST['TB_imagelist']);
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_resize_image', $gallery_ids, __('Resize images', 'nggallery'));
}
if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_NewThumbnail'])) {
check_admin_referer('ngg_thickbox_form');
//save the new values for the next operation
$ngg->options['thumbwidth'] = (int) $_POST['thumbwidth'];
$ngg->options['thumbheight'] = (int) $_POST['thumbheight'];
$ngg->options['thumbfix'] = isset($_POST['thumbfix']) ? true : false;
// What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
update_option('ngg_options', $ngg->options);
$gallery_ids = explode(',', $_POST['TB_imagelist']);
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_create_thumbnail', $gallery_ids, __('Create new thumbnails', 'nggallery'));
}
}
示例2: post_processor_galleries
function post_processor_galleries()
{
global $wpdb, $ngg, $nggdb;
// bulk update in a single gallery
if (isset($_POST['bulkaction']) && isset($_POST['doaction'])) {
check_admin_referer('ngg_bulkgallery');
switch ($_POST['bulkaction']) {
case 'no_action':
// No action
break;
case 'recover_images':
// Recover images from backup
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_recover_image', $_POST['doaction'], __('Recover from backup', 'nggallery'));
break;
case 'set_watermark':
// Set watermark
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_set_watermark', $_POST['doaction'], __('Set watermark', 'nggallery'));
break;
case 'import_meta':
// Import Metadata
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_import_metadata', $_POST['doaction'], __('Import metadata', 'nggallery'));
break;
case 'delete_gallery':
// Delete gallery
if (is_array($_POST['doaction'])) {
$deleted = false;
foreach ($_POST['doaction'] as $id) {
// get the path to the gallery
$gallery = nggdb::find_gallery($id);
if ($gallery) {
//TODO:Remove also Tag reference, look here for ids instead filename
$imagelist = $wpdb->get_col("SELECT pid FROM {$wpdb->nggpictures} WHERE galleryid = '{$gallery->gid}' ");
if ($ngg->options['deleteImg']) {
$storage = C_Component_Registry::get_instance()->get_utility('I_Gallery_Storage');
if (is_array($imagelist)) {
foreach ($imagelist as $pid) {
$storage->delete_image($pid);
}
}
// delete folder. abspath provided by nggdb::find_gallery()
$fs = C_Fs::get_instance();
@rmdir($fs->join_paths($gallery->abspath, 'thumbs'));
@rmdir($fs->join_paths($gallery->abspath, 'dynamic'));
@rmdir($gallery->abspath);
}
}
do_action('ngg_delete_gallery', $id);
$deleted = nggdb::delete_gallery($id);
}
if ($deleted) {
nggGallery::show_message(__('Gallery deleted successfully ', 'nggallery'));
}
}
break;
}
}
if (isset($_POST['addgallery']) && isset($_POST['galleryname'])) {
check_admin_referer('ngg_addgallery');
if (!nggGallery::current_user_can('NextGEN Add new gallery')) {
wp_die(__('Cheatin’ uh?', 'nggallery'));
}
// get the default path for a new gallery
$defaultpath = $ngg->options['gallerypath'];
$newgallery = $_POST['galleryname'];
if (!empty($newgallery)) {
nggAdmin::create_gallery($newgallery, $defaultpath);
}
do_action('ngg_update_addgallery_page');
}
if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_ResizeImages'])) {
check_admin_referer('ngg_thickbox_form');
//save the new values for the next operation
$ngg->options['imgWidth'] = (int) $_POST['imgWidth'];
$ngg->options['imgHeight'] = (int) $_POST['imgHeight'];
// What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
update_option('ngg_options', $ngg->options);
$gallery_ids = explode(',', $_POST['TB_imagelist']);
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_resize_image', $gallery_ids, __('Resize images', 'nggallery'));
}
if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_NewThumbnail'])) {
check_admin_referer('ngg_thickbox_form');
// save the new values for the next operation
$settings = C_NextGen_Settings::get_instance();
$settings->thumbwidth = (int) $_POST['thumbwidth'];
$settings->thumbheight = (int) $_POST['thumbheight'];
$settings->thumbfix = isset($_POST['thumbfix']) ? TRUE : FALSE;
$settings->save();
ngg_refreshSavedSettings();
// What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
$gallery_ids = explode(',', $_POST['TB_imagelist']);
// A prefix 'gallery_' will first fetch all ids from the selected galleries
nggAdmin::do_ajax_operation('gallery_create_thumbnail', $gallery_ids, __('Create new thumbnails', 'nggallery'));
}
}