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


PHP WPFB_Core::PluginUrl方法代码示例

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


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

示例1: AdminBar

 static function AdminBar()
 {
     global $wp_admin_bar;
     WPFB_Core::PrintJS();
     $wp_admin_bar->add_menu(array('id' => WPFB, 'title' => WPFB_PLUGIN_NAME, 'href' => admin_url('admin.php?page=wpfilebase_manage')));
     $wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-add-file', 'title' => __('Add File', WPFB), 'href' => admin_url('admin.php?page=wpfilebase_files#addfile')));
     $current_object = get_queried_object();
     $is_filebrowser = false;
     if (!empty($current_object) && !empty($current_object->post_type) && $current_object->ID > 0) {
         $is_filebrowser = $current_object->ID == WPFB_Core::$settings->file_browser_post_id;
         $link = esc_attr(WPFB_Core::PluginUrl('editor_plugin.php?manage_attachments=1&post_id=' . $current_object->ID));
         $wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-attachments', 'title' => __('Manage attachments', WPFB), 'href' => $link, 'meta' => array('onclick' => 'window.open("' . $link . '", "wpfb-manage-attachments", "width=680,height=400,menubar=no,location=no,resizable=no,status=no,toolbar=no,scrollbars=yes");return false;')));
     }
     $wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-add-file', 'title' => __('Sync Filebase', WPFB), 'href' => admin_url('admin.php?page=wpfilebase_manage&action=sync')));
     $wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-toggle-context-menu', 'title' => !empty(WPFB_Core::$settings->file_context_menu) ? __('Disable file context menu', WPFB) : __('Enable file context menu', WPFB), 'href' => 'javascript:;', 'meta' => array('onclick' => 'return wpfb_toggleContextMenu();')));
     if ($is_filebrowser) {
         $wp_admin_bar->add_menu(array('parent' => WPFB, 'id' => WPFB . '-toggle-drag-drop', 'title' => get_user_option('wpfb_set_fbdd') ? __('Disable file browser Drag & Drop', WPFB) : __('Enable file browser Drag & Drop', WPFB), 'href' => 'javascript:;', 'meta' => array('onclick' => 'jQuery.ajax({url:wpfbConf.ajurl,type:"POST",data:{action:"set-user-setting",name:"fbdd",value:' . (get_user_option('wpfb_set_fbdd') ? 0 : 1) . '},async:false});location.reload();return false;')));
     }
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:19,代码来源:AdminBar.php

示例2: GetIconUrl

 function GetIconUrl($size = null)
 {
     // todo: remove file operations!
     if ($this->is_category) {
         // add mtime for cache updates
         return empty($this->cat_icon) ? WP_CONTENT_URL . WPFB_Core::$settings->folder_icon : WPFB_Core::PluginUrl("wp-filebase_thumb.php?cid={$this->cat_id}&t=" . @filemtime($this->GetThumbPath()));
     }
     if (!empty($this->file_thumbnail)) {
         return WPFB_Core::PluginUrl('wp-filebase_thumb.php?fid=' . $this->file_id . '&name=' . $this->file_thumbnail);
         // name var only for correct caching!
     }
     $type = $this->GetType();
     $ext = substr($this->GetExtension(), 1);
     $img_path = ABSPATH . WPINC . '/images/';
     $img_url = get_option('siteurl') . '/' . WPINC . '/images/';
     $custom_folder = '/images/fileicons/';
     // check for custom icons
     if (file_exists(WP_CONTENT_DIR . $custom_folder . $ext . '.png')) {
         return WP_CONTENT_URL . $custom_folder . $ext . '.png';
     }
     if (file_exists(WP_CONTENT_DIR . $custom_folder . $type . '.png')) {
         return WP_CONTENT_URL . $custom_folder . $type . '.png';
     }
     // todo: cache file_exists
     if (file_exists($img_path . 'crystal/' . $ext . '.png')) {
         return $img_url . 'crystal/' . $ext . '.png';
     }
     if (file_exists($img_path . 'crystal/' . $type . '.png')) {
         return $img_url . 'crystal/' . $type . '.png';
     }
     if (file_exists($img_path . $ext . '.png')) {
         return $img_url . $ext . '.png';
     }
     if (file_exists($img_path . $type . '.png')) {
         return $img_url . $type . '.png';
     }
     // fallback to default
     if (file_exists($img_path . 'crystal/default.png')) {
         return $img_url . 'crystal/default.png';
     }
     if (file_exists($img_path . 'default.png')) {
         return $img_url . 'default.png';
     }
     // fallback to blank :(
     return $img_url . 'blank.gif';
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:46,代码来源:Item.php

示例3: InitClass

 static function InitClass()
 {
     self::$ajax_url = WPFB_Core::PluginUrl('wpfb-ajax.php');
     if (defined('WPFB_NO_CORE_INIT')) {
         return;
     }
     // used with CSS proxy
     //Load settings
     self::$settings = (object) get_option(WPFB_OPT_NAME);
     // load lang
     $lang_dir = defined('WPFB_LANG_DIR') ? '../../' . WPFB_LANG_DIR : basename(WPFB_PLUGIN_ROOT) . '/languages';
     load_plugin_textdomain(WPFB, 'wp-content/plugins/' . $lang_dir, $lang_dir);
     add_action('parse_query', array(__CLASS__, 'ParseQuery'));
     // search
     add_action('wp_enqueue_scripts', array(__CLASS__, 'EnqueueScripts'));
     add_action('wp_footer', array(__CLASS__, 'Footer'));
     add_action('generate_rewrite_rules', array(__CLASS__, 'GenRewriteRules'));
     add_action(WPFB . '_cron', array(__CLASS__, 'Cron'));
     add_action('wpfilebase_sync', array(__CLASS__, 'Sync'));
     // for Developers: New wp-filebase actions
     add_shortcode('wpfilebase', array(__CLASS__, 'ShortCode'));
     // for attachments and file browser
     add_filter('the_content', array(__CLASS__, 'ContentFilter'), 10);
     // must be lower than 11 (before do_shortcode) and after wpautop (>9)
     add_filter('ext2type', array(__CLASS__, 'Ext2TypeFilter'));
     add_filter('pre_set_site_transient_update_plugins', array(__CLASS__, 'PreSetPluginsTransientFilter'));
     add_filter('plugins_api', array(__CLASS__, 'PluginsApiFilter'), 10, 3);
     // register treeview stuff
     //wp_register_script('jquery-cookie', WPFB_PLUGIN_URI.'extras/jquery/jquery.cookie.js', array('jquery'));
     wp_register_script('jquery-treeview', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.js', array('jquery'), WPFB_VERSION);
     wp_register_script('jquery-treeview-edit', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.edit.js', array('jquery-treeview'), WPFB_VERSION);
     wp_register_script('jquery-treeview-async', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.async.js', array('jquery-treeview-edit'), WPFB_VERSION);
     wp_register_style('jquery-treeview', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.css', array(), WPFB_VERSION);
     // DataTables
     wp_register_script('jquery-dataTables', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/js/jquery.dataTables.min.js', array('jquery'), WPFB_VERSION);
     wp_register_style('jquery-dataTables', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/css/jquery.dataTables.css', array(), WPFB_VERSION);
     wp_register_script('jquery-dataTables-columnFilter', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/js/jquery.dataTables.columnFilter.js', array('jquery-dataTables'), WPFB_VERSION);
     wp_register_script(WPFB, WPFB_PLUGIN_URI . 'js/common.js', array('jquery'), WPFB_VERSION);
     // cond loading (see Footer)
     if (empty(WPFB_Core::$settings->disable_css)) {
         $wpfb_css = get_option('wpfb_css');
         if ($wpfb_css) {
             // static file?
             wp_enqueue_style(WPFB, strstr($wpfb_css, '//'), array(), WPFB_VERSION, 'all');
         } else {
             $upload_path = path_is_absolute(WPFB_Core::$settings->upload_path) ? '' : WPFB_Core::$settings->upload_path;
             wp_enqueue_style(WPFB, WPFB_Core::PluginUrl("wp-filebase_css.php?rp={$upload_path}"), array(), WPFB_VERSION, 'all');
         }
     }
     $wpfb_admin_page = is_admin() && !empty($_GET['page']) && strpos($_GET['page'], 'wpfilebase_') !== false || defined('WPFB_EDITOR_PLUGIN');
     if ($wpfb_admin_page) {
         wpfb_loadclass('Admin');
     }
     // live admin
     if ($wpfb_admin_page && @$_GET['page'] == 'wpfilebase_filebrowser' || (WPFB_Core::CurUserCanCreateCat() || WPFB_Core::CurUserCanUpload()) && !is_admin()) {
         wp_enqueue_script(WPFB . '-live-admin', WPFB_PLUGIN_URI . 'js/live-admin.js', array('jquery'), WPFB_VERSION);
         if (self::GetOpt('admin_bar')) {
             add_action('admin_bar_menu', array(__CLASS__, 'AdminBar'), 80);
         }
         if (self::GetOpt('file_context_menu')) {
             wp_enqueue_script('jquery-contextmenu', WPFB_PLUGIN_URI . 'extras/jquery/contextmenu/jquery.contextmenu.js', array('jquery'));
             wp_enqueue_style('jquery-contextmenu', WPFB_PLUGIN_URI . 'extras/jquery/contextmenu/jquery.contextmenu.css', array(), WPFB_VERSION);
         }
         wp_enqueue_style('wpfb-live-admin', WPFB_PLUGIN_URI . 'css/live-admin.css', array(), WPFB_VERSION);
     }
     // for admin
     if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
         self::MceAddBtns();
     }
     self::DownloadRedirect();
     if ((WPFB_Core::$settings->frontend_upload || current_user_can('upload_files')) && (!empty($_GET['wpfb_upload_file']) || !empty($_GET['wpfb_add_cat']))) {
         wpfb_call('Admin', empty($_GET['wpfb_upload_file']) ? 'ProcessWidgetAddCat' : 'ProcessWidgetUpload');
     }
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:74,代码来源:Core.php

示例4: PrintScripts

    function PrintScripts($prefix = '', $auto_submit = false)
    {
        $this->Scripts($prefix);
        $minify = true;
        if ($minify) {
            ob_start();
        }
        ?>
<script type="text/javascript">
/* <![CDATA[ */


function fileQueued(fileObj) {
	jQuery('#file-upload-progress').show().html('<div class="progress"><div class="percent">0%</div><div class="bar" style="width: 30px"></div></div><div class="filename original"> ' + fileObj.name + '</div>');

	jQuery('.progress', '#file-upload-progress').show();
	jQuery('.filename', '#file-upload-progress').show();

	jQuery("#media-upload-error").empty();
	jQuery('.upload-flash-bypass').hide();
	
	jQuery('#file-submit').prop('disabled', true);
	jQuery('#cancel-upload').show().prop('disabled', false);

	 /* delete already uploaded temp file */
	if(jQuery('#file_flash_upload').val() != '0') {
		jQuery.ajax({type: 'POST', async: true, url:"<?php 
        echo esc_attr(WPFB_Core::PluginUrl('wpfb-async-upload.php'));
        ?>
",
		data: {<?php 
        echo $this->GetAjaxAuthData(true);
        ?>
 , "delupload": jQuery('#file_flash_upload').val()},
		success: (function(data){})
		});
		jQuery('#file_flash_upload').val(0);
	}
}
           
function wpFileError(fileObj, message) {
	jQuery('#media-upload-error').show().html(message);
	jQuery('.upload-flash-bypass').show();
	jQuery("#file-upload-progress").hide().empty();
	jQuery('#cancel-upload').hide().prop('disabled', true);
}


function uploadError(fileObj, errorCode, message, uploader) {
	wpFileError(fileObj, "Error "+errorCode+": "+message);
}

function uploadSuccess(fileObj, serverData) {
	/* if async-upload returned an error message, place it in the media item div and return */
	if ( serverData.match('media-upload-error') || serverData.match('error-div') ) {
		wpFileError(fileObj, serverData);
		return;
	}
	
	var file_obj = jQuery.parseJSON(serverData);
	
	if(file_obj && 'undefined' != typeof(file_obj.file_id)) {		
		jQuery('#file_form_action').val("updatefile");
		jQuery('#file_id').val(file_obj.file_id);
		
		if(file_obj.file_thumbnail) {
			jQuery('#file_thumbnail_wrap').show();
			jQuery('#file_thumbnail_wrap').children('img').attr('src', file_obj.file_thumbnail_url);
			jQuery('#file_thumbnail_name').html(file_obj.file_thumbnail);
		} else {
			jQuery('#file_thumbnail_wrap').hide();
		}
		
		jQuery('#file_display_name').val(file_obj.file_display_name);
		jQuery('#file_version').val(file_obj.file_version);
		
		jQuery('#wpfb-file-nonce').val(file_obj.nonce);
	} else {
		jQuery('#file_flash_upload').val(serverData);
	}
	
	jQuery('#file-submit').prop('disabled', false);

	<?php 
        if ($auto_submit) {
            ?>
	jQuery('#file_flash_upload').closest("form").submit();
	<?php 
        }
        ?>
}

function uploadComplete(fileObj) {
	jQuery('#cancel-upload').hide().prop('disabled', true);
}

	
/* ]]> */
</script>
<?php 
//.........这里部分代码省略.........
开发者ID:parsonsc,项目名称:dofe,代码行数:101,代码来源:AdvUploader.php

示例5: Display

    function Display()
    {
        // #8545. wmode=transparent cannot be used with SWFUpload
        $upload_image_path = get_user_option('admin_color');
        if ('classic' != $upload_image_path) {
            $upload_image_path = 'fresh';
        }
        $upload_image_path = admin_url('images/upload-' . $upload_image_path . '.png?ver=20101205');
        ?>
<script type="text/javascript">
//<![CDATA[
var swfu;
SWFUpload.onload = function() {
	var settings = {
			button_text: '<span class="button"><?php 
        _e('Select Files');
        ?>
<\/span>',
			button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif; font-size: 11px; text-shadow: 0 1px 0 #FFFFFF; color:#464646; }',
			button_height: "23",
			button_width: "132",
			button_text_top_padding: 3,
			button_image_url: '<?php 
        echo $upload_image_path;
        ?>
',
			button_placeholder_id: "flash-browse-button",
			upload_url : "<?php 
        echo esc_attr(WPFB_Core::PluginUrl('wpfb-async-upload.php'));
        ?>
",
			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 : { <?php 
        echo $this->GetAjaxAuthData();
        ?>
 },
			file_size_limit : "<?php 
        require_once ABSPATH . 'wp-admin/includes/template.php';
        echo wp_max_upload_size();
        ?>
b",
			file_queue_limit: 1,
			
			file_dialog_start_handler : (function(){}),
			
			file_queued_handler : fileQueued,
			//upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			
			swfupload_pre_load_handler: swfuploadPreLoad,
			swfupload_load_failed_handler: swfuploadLoadFailed,
			
			custom_settings : {
				degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
				swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
			},
			debug: !!<?php 
        echo (int) WP_DEBUG;
        ?>
		};
		swfu = new SWFUpload(settings);
};
//]]>
</script>


<?php 
        do_action('pre-flash-upload-ui');
        ?>
	<div>
	<input type="hidden" id="file_flash_upload" name="file_flash_upload" value="0" />
	<div id="flash-browse-button"></div>
	<span><input id="cancel-upload" disabled="disabled" onclick="cancelUpload()" type="button" value="<?php 
        esc_attr_e('Cancel Upload');
        ?>
" class="button" /></span>
	</div>
	<div id="media-upload-error"></div>
	<div id="file-upload-progress" class="media-item" style="width: auto;"></div>
<?php 
        do_action('post-flash-upload-ui');
    }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:96,代码来源:SWFUpload.php

示例6: TplsTable


//.........这里部分代码省略.........
	<tbody>
<?php 
        foreach ($tpls as $tpl_tag => $tpl_src) {
            if (!empty($include) && !in_array($tpl_tag, $include) || !empty($exclude) && in_array($tpl_tag, $exclude)) {
                continue;
            }
            $edit_link = add_query_arg(array('action' => 'edit', 'type' => $type, 'tpl' => $tpl_tag));
            if ($list) {
                $tpl = WPFB_ListTpl::Get($tpl_tag);
            }
            ?>
	<tr id="tpl-<?php 
            echo "{$type}-{$tpl_tag}";
            ?>
" class="iedit" valign="top">
		<th scope="row" class="check-column"><input type="checkbox" name="tpl[]" value="<?php 
            echo esc_attr($tpl_tag);
            ?>
" /></th>
		<td class="column-title">
			<strong><a class="row-title" href="<?php 
            echo $edit_link;
            ?>
" title="<?php 
            printf(__('Edit &#8220;%s&#8221;'), $tpl_tag);
            ?>
"><?php 
            echo self::TplTitle($tpl_tag);
            ?>
</a></strong><br />
			<code>tpl=<?php 
            echo $tpl_tag;
            ?>
</code>
			<div class="row-actions"><span class='edit'><a href="<?php 
            echo $edit_link;
            ?>
" title="<?php 
            _e('Edit this item');
            ?>
"><?php 
            _e('Edit');
            ?>
</a></span>
			<?php 
            if (!in_array($tpl_tag, self::$protected_tags)) {
                ?>
<span class='trash'>| <a class='submitdelete' title='<?php 
                _e('Delete this item permanently');
                ?>
' href='<?php 
                echo wp_nonce_url(add_query_arg(array('action' => 'del', 'type' => $type, 'tpl' => $tpl_tag)), 'del-' . $type, 'wpfb-tpl-nonce') . '#' . $type;
                ?>
'><?php 
                _e('Delete');
                ?>
</a></span><?php 
            }
            ?>
			</div>
		</td>
		<td>
			<div class="entry-content wpfilebase-tpl-preview">
				<div id="tpl-preview_<?php 
            echo $tpl_tag;
            ?>
">
					<?php 
            if (!empty($_GET['iframe-preview'])) {
                ?>
					
					<iframe src="<?php 
                echo WPFB_Core::PluginUrl("tpl-preview.php?type={$type}&tag={$tpl_tag}");
                ?>
" style="width:100%;height:220px;"></iframe>
					<?php 
            } else {
                $table_found = !$list && strpos($tpl_src, '<table') !== false;
                if (!$list && !$table_found && strpos($tpl_src, '<tr') !== false) {
                    $tpl_src = "<table>{$tpl_src}</table>";
                }
                echo do_shortcode($list ? $tpl->Sample(self::$sample_cat, self::$sample_file) : $item->GenTpl(WPFB_TplLib::Parse($tpl_src), 'sample'));
            }
            ?>
				</div>
					
				<div style="height: 50px; float: left;"></div>
				<div class="clear"></div>
			</div>
		</td>
	</tr>
		
	<?php 
        }
        ?>
	</tbody>
</table>
<?php 
        self::TplForm($type);
    }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:101,代码来源:AdminGuiTpls.php

示例7: 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' => 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' => __('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 -', WPFB);
        ?>
		<span class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php 
        esc_attr_e('Select Files');
        ?>
" class="button" /></span>
		<span class="drag-drop-info-spacer"></span>
	</p>
	</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');
    }
开发者ID:parsonsc,项目名称:dofe,代码行数:72,代码来源:PLUpload.php

示例8: 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
//.........这里部分代码省略.........
开发者ID:parsonsc,项目名称:dofe,代码行数:101,代码来源:PLUploader.php


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