本文整理汇总了PHP中WPFB_Core::GetMaxUlSize方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::GetMaxUlSize方法的具体用法?PHP WPFB_Core::GetMaxUlSize怎么用?PHP WPFB_Core::GetMaxUlSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::GetMaxUlSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Display
function Display()
{
global $is_IE, $is_opera;
$id = $this->id;
$upload_size_unit = $max_upload_size = WPFB_Core::GetMaxUlSize();
$sizes = array('KB', 'MB', 'GB');
for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
$upload_size_unit /= 1024;
}
if ($u < 0) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
do_action('pre-upload-ui');
$plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => false, 'max_file_size' => $max_upload_size . 'b', 'url' => add_query_arg('wpfb_action', 'upload', WPFB_Core::$ajax_url_public), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $this->GetAjaxAuthData());
$plupload_init = apply_filters('plupload_init', $plupload_init);
?>
<script type="text/javascript">
var resize_height = 1024, resize_width = 1024, // this is for img resizing (not used here!)
wpUploaderInit = <?php
echo json_encode($plupload_init);
?>
;
</script>
<input type="hidden" id="file_flash_upload" name="file_flash_upload" value="0" />
<div id="plupload-upload-ui" class="hide-if-no-js">
<?php
do_action('pre-plupload-upload-ui');
// hook change, old name: 'pre-flash-upload-ui'
?>
<div id="drag-drop-area">
<div class="drag-drop-inside">
<p class="drag-drop-info"><?php
_e('Drop files here - or -', 'wp-filebase');
?>
</p>
<div class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php
esc_attr_e('Select Files');
?>
" class="button" /></div>
<div class="drag-drop-info-spacer"></div>
</div>
</div>
<p class="upload-flash-bypass">
<?php
printf(__('You are using the multi-file uploader. Problems? Try the <a href="%1$s">browser uploader</a> instead.'), esc_url(add_query_arg('flash', 0)));
?>
</p>
</div>
<?php
if (($is_IE || $is_opera) && $max_upload_size > 100 * 1024 * 1024) {
?>
<span class="big-file-warning"><?php
_e('Your browser has some limitations uploading large files with the multi-file uploader. Please use the browser uploader for files over 100MB.');
?>
</span>
<?php
}
?>
<div id="media-upload-error"></div>
<div id="file-upload-progress" class="media-item" style="width: auto;"></div>
<?php
//do_action('post-upload-ui');
}
示例2: _e
?>
" />
</div>
<div id="wpfilebase-upload-tabs">
<div id="file-upload-wrap" <?php
echo $file->IsRemote() ? 'class="hidden"' : '';
?>
>
<div id="html-upload-ui">
<label for="file_upload"><?php
_e('Choose File', WPFB);
?>
</label>
<input type="file" name="file_upload" id="file_upload" /><br />
<?php
printf(str_replace('%d%s', '%s', __('Maximum upload file size: %d%s')), WPFB_Output::FormatFilesize(WPFB_Core::GetMaxUlSize()));
?>
<b> <a href="#" onclick="alert(this.title); return false;" title="<?php
printf(__('Ask your webhoster to increase this limit, it is set in %s.', WPFB), 'php.ini');
?>
">?</a></b>
<p class="upload-html-bypass hide-if-no-js"><?php
_e('You are using the Browser uploader.');
printf(__('Try the <a href="%s">Flash uploader</a> instead.'), esc_url(add_query_arg('flash', 1)));
?>
</div>
<div id="flash-upload-ui"><?php
$adv_uploader->Display();
?>
</div> <!-- flash-upload-ui -->
<?php
示例3: FileForm
static function FileForm($prefix, $form_url, $vars, $secret_key = null)
{
unset($vars['adv_uploader']);
// dont use adv_uploader arg for noncing! TODO
?>
<div class="form-wrap">
<form enctype="multipart/form-data" name="<?php
echo $prefix;
?>
form" id="<?php
echo $prefix;
?>
form" method="post" action="<?php
echo $form_url;
?>
">
<div>
<?php
self::DisplayExtendedFormFields($prefix, $secret_key, $vars);
?>
<?php
if (empty($adv_uploader)) {
?>
<label for="<?php
echo $prefix;
?>
file_upload"><?php
_e('Choose File', WPFB);
?>
</label>
<input type="file" name="file_upload" id="<?php
echo $prefix;
?>
file_upload" /><br /> <!-- style="width: 160px" size="10" -->
<?php
} else {
$adv_uploader->Display($prefix);
}
?>
<small><?php
printf(str_replace('%d%s', '%s', __('Maximum upload file size: %d%s.')), WPFB_Output::FormatFilesize(WPFB_Core::GetMaxUlSize()));
?>
</small>
<?php
if (empty($auto_submit)) {
?>
<div style="float: right; text-align:right;"><input type="submit" class="button-primary" name="submit-btn" value="<?php
_e('Add New', WPFB);
?>
" /></div>
<?php
}
?>
</div>
</form>
</div>
<?php
}
示例4: _e
</div>
<div id="wpfilebase-upload-tabs">
<div id="file-upload-wrap" <?php
echo $file->IsRemote() ? 'class="hidden"' : '';
?>
>
<div id="file_thumbnail_preview"></div>
<div id="html-upload-ui">
<label for="file_upload"><?php
_e('Choose File', 'wp-filebase');
?>
</label>
<input type="file" name="file_upload" id="file_upload" /><br />
<?php
printf(__('Maximum upload file size: %s.'), WPFB_Output::FormatFilesize(WPFB_Core::GetMaxUlSize()));
?>
<b> <a href="#" onclick="return alert(this.title) && false;" title="<?php
printf(__('Ask your webhoster to increase this limit, it is set in %s.', 'wp-filebase'), 'php.ini');
?>
">?</a></b>
<p class="upload-html-bypass hide-if-no-js"><?php
_e('You are using the Browser uploader.');
printf(__('Try the <a href="%s">Drag&Drop uploader</a> instead.', 'wp-filebase'), esc_url(add_query_arg('flash', 1)));
?>
</div>
<div id="flash-upload-ui"><?php
$adv_uploader->Display();
?>
<script> jQuery('#file-upload-progress').appendTo('#wpfilebase-upload-menu').addClass('admin-scheme-color-3');</script>
</div> <!-- flash-upload-ui -->
示例5: Init
public function Init($cotainer_id, $browser_btn_id = '', $error_el_id = null, $drop_el_id = null)
{
if (empty($drop_el_id)) {
$drop_el_id = $cotainer_id;
}
if (empty($browser_btn_id)) {
$browser_btn_id = $cotainer_id . '-btn';
echo '<input type="button" value="Select Files" id="' . $browser_btn_id . '" style="display:none;" />';
}
$max_upload_size = WPFB_Core::GetMaxUlSize();
if (is_admin()) {
self::PrintScripts();
}
$plupload_init = array('runtimes' => 'html5,gears,silverlight,flash,html4', 'browse_button' => $browser_btn_id, 'container' => $cotainer_id, 'drop_element' => $drop_el_id, 'file_data_name' => 'async-upload', 'multiple_queues' => $this->multi, 'max_file_size' => $max_upload_size . 'b', 'url' => WPFB_Core::PluginUrl('wpfb-async-upload.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => $this->images_only ? __('Images') : __('Allowed Files'), 'extensions' => $this->images_only ? 'jpg,gif,png,bmp' : '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array_merge($this->GetAjaxAuthData(), $this->post_params));
$jss = md5(uniqid());
?>
<script type="text/javascript">
init_<?php
echo $jss;
?>
= (function() {
if('undefined' == typeof plupload) {
setTimeout(init_<?php
echo $jss;
?>
, 100);
return;
}
var uploader = new plupload.Uploader(<?php
echo json_encode($plupload_init);
?>
);
uploader.bind('Init', function(up) {
var uploaddiv = jQuery('#<?php
echo $cotainer_id;
?>
');
var dropdiv = jQuery('#<?php
echo $drop_el_id;
?>
');
uploaddiv.data('uploader', up);
if ( !jQuery(document.body).hasClass('mobile') ) {
dropdiv.addClass('drag-drop');
dropdiv.bind('dragover', function(e){ dropdiv.addClass('drag-over'); })
.bind('dragleave', function(e){ dropdiv.removeClass('drag-over'); })
.bind('drop', function(e){ dropdiv.removeClass('drag-over'); });
} else {
dropdiv.removeClass('drag-drop');
//dropdiv.hide();
}
// if ( up.runtime == 'html4' )
// jQuery('.upload-flash-bypass').hide();
});
uploader.init();
var mobile = <?php
echo (int) wp_is_mobile();
?>
;
var supported = <?php
echo (int) (!wp_is_mobile() || function_exists('_device_can_upload') && _device_can_upload());
?>
;
var supports_dragdrop = uploader.features.dragdrop && !mobile;
// Generate drag/drop helper classes.
(function( dropzone, supported ) {
var timer, active;
if ( ! dropzone )
return;
dropzone.toggleClass( 'supports-drag-drop', !! supported );
if ( ! supported )
return dropzone.unbind('.wp-uploader');
// 'dragenter' doesn't fire correctly,
// simulate it with a limited 'dragover'
dropzone.bind( 'dragover.wp-uploader', function(){
if ( timer )
clearTimeout( timer );
if ( active )
return;
dropzone.trigger('dropzone:enter').addClass('drag-over');
active = true;
});
dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function(){
// Using an instant timer prevents the drag-over class from
// being quickly removed and re-added when elements inside the
//.........这里部分代码省略.........
示例6: Init
public function Init($cotainer_id, $browser_btn_id, $drop_el_id, $error_el_id)
{
$max_upload_size = WPFB_Core::GetMaxUlSize();
wp_print_scripts('plupload-all');
wp_print_scripts('wp-plupload');
$plupload_init = array('runtimes' => 'html5,gears,silverlight,flash,html4', 'browse_button' => $browser_btn_id, 'container' => $cotainer_id, 'drop_element' => $drop_el_id, 'file_data_name' => 'async-upload', 'multiple_queues' => $this->multi, 'max_file_size' => $max_upload_size . 'b', 'url' => WPFB_PLUGIN_URI . 'wpfb-async-upload.php', 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => $this->images_only ? __('Images') : __('Allowed Files'), 'extensions' => $this->images_only ? 'jpg,gif,png,bmp' : '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array_merge($this->GetAjaxAuthData(), $this->post_params));
?>
<script type="text/javascript">
(function() {
var uploader = new plupload.Uploader(<?php
echo json_encode($plupload_init);
?>
);
uploader.bind('Init', function(up) {
//var uploaddiv = jQuery('#<?php
echo $cotainer_id;
?>
');
var dropdiv = jQuery('#<?php
echo $drop_el_id;
?>
');
if ( !jQuery(document.body).hasClass('mobile') ) {
dropdiv.addClass('drag-drop');
dropdiv.bind('dragover', function(e){
dropdiv.addClass('drag-over');
}).bind('dragleave, drop', function(){
dropdiv.removeClass('drag-over');
});
} else {
dropdiv.removeClass('drag-drop');
dropdiv.hide();
}
// if ( up.runtime == 'html4' )
// jQuery('.upload-flash-bypass').hide();
});
uploader.init();
var mobile = <?php
echo (int) wp_is_mobile();
?>
;
var supported = <?php
echo (int) (!wp_is_mobile() || function_exists('_device_can_upload') && _device_can_upload());
?>
;
var supports_dragdrop = uploader.features.dragdrop && !mobile;
// Generate drag/drop helper classes.
(function( dropzone, supported ) {
var timer, active;
if ( ! dropzone )
return;
dropzone.toggleClass( 'supports-drag-drop', !! supported );
if ( ! supported )
return dropzone.unbind('.wp-uploader');
// 'dragenter' doesn't fire correctly,
// simulate it with a limited 'dragover'
dropzone.bind( 'dragover.wp-uploader', function(){
if ( timer )
clearTimeout( timer );
if ( active )
return;
dropzone.trigger('dropzone:enter').addClass('drag-over');
active = true;
});
dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function(){
// Using an instant timer prevents the drag-over class from
// being quickly removed and re-added when elements inside the
// dropzone are repositioned.
//
// See http://core.trac.wordpress.org/ticket/21705
timer = setTimeout( function() {
active = false;
dropzone.trigger('dropzone:leave').removeClass('drag-over');
}, 0 );
});
}( jQuery('#<?php
echo $drop_el_id;
?>
'), supports_dragdrop ));
uploader.bind('FilesAdded', function(up, files) {
var hundredmb = 100 * 1024 * 1024, max = parseInt(up.settings.max_file_size, 10);
jQuery('#<?php
echo $error_el_id;
?>
//.........这里部分代码省略.........