Ejemplo n.º 1
0
function wpsc_product_image_forms($product_data = '')
{
    global $closed_postboxes;
    if ($product_data == 'empty') {
        $display = "style='display:none;'";
    }
    //echo "<pre>".print_r($product_data,true)."</pre>";
    //As in WordPress,  If Mac and mod_security, no Flash
    $flash = true;
    if (false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security')) {
        $flash = false;
    }
    $flash_action_url = admin_url('async-upload.php');
    $flash = apply_filters('flash_uploader', $flash);
    ?>
	<div id='wpsc_product_image_forms' class='postbox <?php 
    echo array_search('wpsc_product_image_forms', $product_data['closed_postboxes']) !== false ? 'closed' : '';
    ?>
' <?php 
    echo array_search('wpsc_product_image_forms', $product_data['hidden_postboxes']) !== false ? 'style="display: none;"' : '';
    ?>
 >
		<h3 class='hndle'> <?php 
    echo TXT_WPSC_PRODUCTIMAGES;
    ?>
</h3>
		<div class='inside'>
		
		<?php 
    if ($flash) {
        ?>
			<script type="text/javascript" >
			/* <![CDATA[ */
			jQuery("span#spanButtonPlaceholder").livequery(function() {
				swfu = new SWFUpload({
					button_text: '<span class="button"><?php 
        _e('Select Files');
        ?>
</span>',
					button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
					button_height: "24",
					button_width: "132",
					button_image_url: '<?php 
        echo includes_url('images/upload.png');
        ?>
',
					button_placeholder_id: "spanButtonPlaceholder",
					upload_url : "<?php 
        echo attribute_escape($flash_action_url);
        ?>
",
					flash_url : "<?php 
        echo includes_url('js/swfupload/swfupload.swf');
        ?>
",
					file_post_name: "async-upload",
					file_types: "<?php 
        echo apply_filters('upload_file_glob', '*.*');
        ?>
",
					post_params : {
						"product_id" : parseInt(jQuery('#product_id').val()),
						"auth_cookie" : "<?php 
        if (is_ssl()) {
            echo $_COOKIE[SECURE_AUTH_COOKIE];
        } else {
            echo $_COOKIE[AUTH_COOKIE];
        }
        ?>
",
						"_wpnonce" : "<?php 
        echo wp_create_nonce('product-swfupload');
        ?>
",
						"wpsc_admin_action" : "wpsc_add_image"
					},
					file_size_limit : "<?php 
        echo wp_max_upload_size();
        ?>
b",
					file_dialog_start_handler : wpsc_fileDialogStart,
					file_queued_handler : wpsc_fileQueued,
					upload_start_handler : wpsc_uploadStart,
					upload_progress_handler : wpsc_uploadProgress,
					upload_error_handler : wpsc_uploadError,
					upload_success_handler : wpsc_uploadSuccess,
					upload_complete_handler : wpsc_uploadComplete,
					file_queue_error_handler : wpsc_fileQueueError,
					file_dialog_complete_handler : wpsc_fileDialogComplete,
					swfupload_pre_load_handler: wpsc_swfuploadPreLoad,
					swfupload_load_failed_handler: wpsc_swfuploadLoadFailed,
					custom_settings : {
						degraded_element_id : "browser-image-uploader", // id of the element displayed when swfupload is unavailable
						swfupload_element_id : "flash-image-uploader" // id of the element displayed when swfupload is available
					},
					<?php 
        if (defined('WPSC_ADD_DEBUG_PAGE') && constant('WPSC_ADD_DEBUG_PAGE') == true) {
            ?>
						debug: true
						<?php 
        } else {
            ?>
						debug: false
						<?php 
        }
        ?>
				});
			});
		/* ]]> */
		</script>
		
		<?php 
    }
    ?>
		
    <div class='flash-image-uploader'>
			<span id='spanButtonPlaceholder'></span><br />
				<div id='media-items'> </div>
				<p><?php 
    echo wpsc_check_memory_limit();
    ?>
</p>
				<p><?php 
    echo TXT_WPSC_FLASH_UPLOADER;
    ?>
</p>
				<?php 
    if (!function_exists('gold_shpcrt_display_gallery')) {
        ?>
					<p><?php 
        _e('To upload multiple product thumbnails you must <a href="http://www.instinct.co.nz/shop/">install the premium upgrade</a>');
        ?>
</p>
					<?php 
    }
    ?>
    </div>
    
    
		
		  <div class='browser-image-uploader'>
				<h4><?php 
    _e("Select an image to upload:");
    ?>
</h4>
				<ul>  
					<li>
						<input type="file" value="" name="image" />
						<input type="hidden" value="1" name="image_resize" />
					</li>
					<li>
						<?php 
    echo wpsc_check_memory_limit();
    ?>
					</li>
				</ul>
				<p><?php 
    echo TXT_WPSC_BROWSER_UPLOADER;
    ?>
</p>
				<br />
				
			</div>
			<p><strong <?php 
    echo $display;
    ?>
><?php 
    echo TXT_WPSC_MANAGE_YOUR_THUMBNAILS;
    ?>
</strong></p>
			<?php 
    edit_multiple_image_gallery($product_data);
    ?>

		</div>
		<div style='clear:both'></div>
	</div>
	<?php 
    return $output;
}
Ejemplo n.º 2
0
function wpsc_product_image_forms()
{
    _wpsc_deprecated_function(__FUNCTION__, '3.8.13');
    global $post;
    edit_multiple_image_gallery($post);
    ?>

    <p><strong <?php 
    if (isset($display)) {
        echo $display;
    }
    ?>
><a href="media-upload.php?parent_page=wpsc-edit-products&amp;post_id=<?php 
    echo $post->ID;
    ?>
&amp;type=image&amp;tab=gallery&amp;TB_iframe=1&amp;width=640&amp;height=566" class="thickbox" title="<?php 
    esc_attr_e('Manage Product Images', 'wp-e-commerce');
    ?>
"><?php 
    esc_html_e('Manage Product Images', 'wp-e-commerce');
    ?>
</a></strong></p>
<?php 
}
function wpsc_product_image_forms()
{
    global $post;
    edit_multiple_image_gallery($post);
    ?>

    <p><strong <?php 
    if (isset($display)) {
        echo $display;
    }
    ?>
><a href="media-upload.php?parent_page=wpsc-edit-products&post_id=<?php 
    echo $post->ID;
    ?>
&type=image&tab=gallery&TB_iframe=1&width=640&height=566" class="thickbox" title="Manage Your Product Images"><?php 
    _e('Manage Product Images', 'wpsc');
    ?>
</a></strong></p>
<?php 
}