当前位置: 首页>>代码示例>>PHP>>正文


PHP nggAdmin::upload_images方法代码示例

本文整理汇总了PHP中nggAdmin::upload_images方法的典型用法代码示例。如果您正苦于以下问题:PHP nggAdmin::upload_images方法的具体用法?PHP nggAdmin::upload_images怎么用?PHP nggAdmin::upload_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nggAdmin的用法示例。


在下文中一共展示了nggAdmin::upload_images方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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');
        ?>
//.........这里部分代码省略.........
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:101,代码来源:addgallery.php

示例2: 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&#8217; 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&#8217; 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&#8217; 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&#8217; 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');
 }
开发者ID:popovdenis,项目名称:kmst,代码行数:75,代码来源:addgallery.php

示例3: show_add_Product

function show_add_Product()
{
    global $wpdb, $ngg, $nggdb;
    if (!empty($_POST['submit'])) {
        $_POST['galleryselect'] = 1;
        nggAdmin::upload_images();
        //$imagefiles = $_FILES['imagefiles'];
        /*	
        $title=$_POST['productName'];
        $content=$_POST['description']."<br/>[displayPrice]";
        $linkToWebSite=$_POST['linkWebSite'];
        $currency=$_POST['currency'];
        $price=$_POST['price'];
        $Image1=$_FILES['image1'];
        $Image2=$_FILES['image2'];
        $Image3=$_FILES['image3'];
        $Image4=$_FILES['image4'];
        $postType='post';
        $post = array('post_title' =>$title,'post_content' =>$content,'post_type' => $postType,'post_status' =>'publish' );
                 	$newPostId=wp_insert_post( $post, $wp_error );
        if (!empty($linkToWebSite)) add_post_meta($newPostId, 'LinkToWebsite', $linkToWebSite);
        add_post_meta($newPostId, 'Price', $price, false);
        add_post_meta($newPostId, 'Currency', $currency, false);
        */
        //creating gallery
        /*
               			$defaultpath = $ngg->options['gallerypath'];
                		$newgallery = esc_attr("Test");
                		nggAdmin::create_gallery($newgallery, $defaultpath);
        			nggAdmin::upload_images();
        */
    } else {
        ?>
	<form enctype="multipart/form-data" action="" method="POST">
		Product Name: <br/><input type="text" name="productName" size="60"/><br/>
		<br/>Description:<br/>
		<textarea name="description" rows="10" cols="70"></textarea><br/>

		<br/>
		Link to Website: <br/><input type="text" name="linkWebSite" size="60"/><br/>
			
		<br/>
		Price: 
		<br/>
			<select name="currency">
				<option value="Rs.">Rs</option>
			</select>
			<input type="text" name="price" size="10"/>
		<br/>	
		<br/>Upload Featured Image: <input name="imagefiles[]" type="file" /><br/>
		<br/>Upload Gallery Image 1: <input name="imagefiles[]" type="file" /><br/>
		<br/>Upload Gallery Image 2: <input name="imagefiles1" type="file" /><br/>
		<br/>Upload Gallery Image 3: <input name="imagefiles1" type="file" /><br/>
		
		<br/>

		<br/>
		<select name="category0">
			<option></option>
		</select>

		<?php 
        wp_list_categories();
        ?>

		<br/><input type="submit" name="submit" value="Add Product" />

	</form>

<?php 
    }
    return "";
}
开发者ID:noorbakerally,项目名称:Development,代码行数:73,代码来源:addProductForm.php


注:本文中的nggAdmin::upload_images方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。