本文整理汇总了PHP中nggAdmin::import_zipfile方法的典型用法代码示例。如果您正苦于以下问题:PHP nggAdmin::import_zipfile方法的具体用法?PHP nggAdmin::import_zipfile怎么用?PHP nggAdmin::import_zipfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggAdmin
的用法示例。
在下文中一共展示了nggAdmin::import_zipfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processor
/**
* Perform the upload and add a new hook for plugins
*
* @return void
*/
function processor()
{
global $wpdb, $ngg, $nggdb;
$defaultpath = $ngg->options['gallerypath'];
if (isset($_POST['addgallery'])) {
check_admin_referer('ngg_addgallery');
if (!nggGallery::current_user_can('NextGEN Add new gallery')) {
wp_die(__('Cheatin’ uh?'));
}
$newgallery = esc_attr($_POST['galleryname']);
if (!empty($newgallery)) {
nggAdmin::create_gallery($newgallery, $defaultpath);
}
}
if (isset($_POST['zipupload'])) {
check_admin_referer('ngg_addgallery');
if (!nggGallery::current_user_can('NextGEN Upload a zip')) {
wp_die(__('Cheatin’ uh?'));
}
if ($_FILES['zipfile']['error'] == 0 || !empty($_POST['zipurl'])) {
nggAdmin::import_zipfile(intval($_POST['zipgalselect']));
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if (isset($_POST['importfolder'])) {
check_admin_referer('ngg_addgallery');
if (!nggGallery::current_user_can('NextGEN Import image folder')) {
wp_die(__('Cheatin’ uh?'));
}
$galleryfolder = $_POST['galleryfolder'];
if (!empty($galleryfolder) and $defaultpath != $galleryfolder) {
nggAdmin::import_gallery($galleryfolder);
}
}
if (isset($_POST['uploadimage'])) {
check_admin_referer('ngg_addgallery');
if (!nggGallery::current_user_can('NextGEN Upload in all galleries')) {
wp_die(__('Cheatin’ uh?'));
}
if ($_FILES['imagefiles']['error'][0] == 0) {
$messagetext = nggAdmin::upload_images();
} else {
nggGallery::show_error(__('Upload failed! ' . nggAdmin::decode_upload_error($_FILES['imagefiles']['error'][0]), 'nggallery'));
}
}
if (isset($_POST['swf_callback'])) {
if ($_POST['galleryselect'] == '0') {
nggGallery::show_error(__('No gallery selected !', 'nggallery'));
} else {
if ($_POST['swf_callback'] == '-1') {
nggGallery::show_error(__('Upload failed! ', 'nggallery'));
} else {
$gallery = $nggdb->find_gallery((int) $_POST['galleryselect']);
nggAdmin::import_gallery($gallery->path);
}
}
}
if (isset($_POST['disable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = false;
update_option('ngg_options', $ngg->options);
}
if (isset($_POST['enable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = true;
update_option('ngg_options', $ngg->options);
}
do_action('ngg_update_addgallery_page');
}
示例2: nggallery_admin_add_gallery
function nggallery_admin_add_gallery()
{
global $wpdb, $ngg;
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
$filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
// link for the flash file
$swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
$swf_upload_link = wp_nonce_url($swf_upload_link, 'ngg_swfupload');
//flash doesn't seem to like encoded ampersands, so convert them back here
$swf_upload_link = str_replace('&', '&', $swf_upload_link);
$defaultpath = $ngg->options['gallerypath'];
if ($_POST['addgallery']) {
check_admin_referer('ngg_addgallery');
$newgallery = attribute_escape($_POST['galleryname']);
if (!empty($newgallery)) {
nggAdmin::create_gallery($newgallery, $defaultpath);
}
}
if ($_POST['zipupload']) {
check_admin_referer('ngg_addgallery');
if ($_FILES['zipfile']['error'] == 0) {
$messagetext = nggAdmin::import_zipfile(intval($_POST['zipgalselect']));
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if ($_POST['importfolder']) {
check_admin_referer('ngg_addgallery');
$galleryfolder = $_POST['galleryfolder'];
if (!empty($galleryfolder) and $defaultpath != $galleryfolder) {
nggAdmin::import_gallery($galleryfolder);
}
}
if ($_POST['uploadimage']) {
check_admin_referer('ngg_addgallery');
if ($_FILES['MF__F_0_0']['error'] == 0) {
$messagetext = nggAdmin::upload_images();
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if (isset($_POST['swf_callback'])) {
if ($_POST['galleryselect'] == "0") {
nggGallery::show_error(__('No gallery selected !', 'nggallery'));
} else {
// get the path to the gallery
$galleryID = (int) $_POST['galleryselect'];
$gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$galleryID}' ");
nggAdmin::import_gallery($gallerypath);
}
}
if (isset($_POST['disable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = false;
update_option('ngg_options', $ngg->options);
}
if (isset($_POST['enable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = true;
update_option('ngg_options', $ngg->options);
}
//get all galleries (after we added new ones)
$gallerylist = nggdb::find_all_galleries();
?>
<?php
if ($ngg->options['swfUpload']) {
?>
<!-- SWFUpload script -->
<script type="text/javascript">
var ngg_swf_upload;
window.onload = function () {
ngg_swf_upload = new SWFUpload({
// Backend settings
upload_url : "<?php
echo $swf_upload_link;
?>
",
flash_url : "<?php
echo NGGALLERY_URLPATH;
?>
admin/js/swfupload.swf",
// Button Settings
button_placeholder_id : "spanButtonPlaceholder",
button_width: 300,
button_height: 27,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
// File Upload Settings
file_size_limit : "<?php
echo wp_max_upload_size();
?>
b",
file_types : "*.jpg;*.gif;*.png",
file_types_description : "<?php
_e('Image Files', 'nggallery');
?>
//.........这里部分代码省略.........