: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Display number of files/selected files and its size in statusbar
* @author Dmitry (dio) Levashov
jQuery.fn.elfinderstat = function(fm) {
return this.each(function() {
var size = jQuery(this).addClass('elfinder-stat-size'),
sel = jQuery('<div class="elfinder-stat-selected"></div>')
.on('click', 'a', function(e) {
var hash = jQuery(this).data('hash');
fm.exec('opendir', [ hash ]);
titleitems = fm.i18n('items'),
titlesel = fm.i18n('selected'),
titlesize = fm.i18n('size'),
setstat = function(files) {
if (cwd.sizeInfo || cwd.size) {
jQuery.each(files, function(i, file) {
s += parseInt(file.size) || 0;
if (hasSize === true && file.mime === 'directory' && !file.sizeInfo) {
size.html(titleitems+': <span class="elfinder-stat-incsearch"></span>'+c+', <span class="elfinder-stat-size'+(hasSize? ' elfinder-stat-size-recursive' : '')+'">'+fm.i18n(hasSize? 'sum' : 'size')+': '+fm.formatSize(s)+'</span>')
.attr('title', size.text());
fm.trigger('uistatchange');
setIncsearchStat = function(data) {
size.find('span.elfinder-stat-incsearch').html(data? data.hashes.length + ' / ' : '');
size.attr('title', size.text());
fm.trigger('uistatchange');
setSelect = function(files) {
if (files.length === 1) {
if (fm.searchStatus.state === 2) {
path = fm.escape(file.path? file.path.replace(/\/[^\/]*$/, '') : '..');
dirs.push('<a href="#elf_'+file.phash+'" data-hash="'+file.hash+'" title="'+path+'">'+path+'</a>');
dirs.push(fm.escape(file.i18 || file.name));
sel.html(dirs.join('/') + (s > 0 ? ', '+fm.formatSize(s) : ''));
} else if (files.length) {
jQuery.each(files, function(i, file) {
s += parseInt(file.size)||0;
sel.html(c ? titlesel+': '+c+', '+titlesize+': '+fm.formatSize(s) : ' ');
sel.attr('title', sel.text());
fm.trigger('uistatchange');
fm.getUI('statusbar').prepend(size).append(sel).show();
if (fm.UA.Mobile && jQuery.fn.tooltip) {
fm.getUI('statusbar').tooltip({
'ui-tooltip': 'elfinder-ui-tooltip ui-widget-shadow'
tooltipClass: 'elfinder-ui-tooltip ui-widget-shadow',
.bind('cwdhasheschange', function(e) {
setstat(jQuery.map(e.data, function(h) { return fm.file(h); }));
var files = e.data.changed || [],
jQuery.each(files, function() {
if (this.hash === cwdHash) {
size.children('.elfinder-stat-size').addClass('elfinder-stat-size-recursive').html(fm.i18n('sum')+': '+fm.formatSize(this.size));
size.attr('title', size.text());
setSelect(fm.selectedFiles());
.bind('open', function() {
.bind('incsearch', function(e) {
setIncsearchStat(e.data);
.bind('incsearchend', function() {