Mount GoogleDrive with elFinder
/** •# Google Drive volume driver need "google-api-php-client 1.1.7" package" •* google-api-php-client: https://github.com/google/google-api-php-client/releases •* copy directory "google-api-php-client" and paste in elFinder php directory •* Google Drive developer console: https://console.developers.google.com •* Create login in google developer console and create app and get clientid, clientsecret, redirecturi •* create new project ->Enable and manage APIs ->Drive API ->Enable ->Goto Credentials •* Create Credentials ->oAuth Client ->web Applicaton •* Application Name Optional, Authorized redirect URIs should be your elFinder connector path •* copy oAuth client ID and client secret */ // Required for drive.google.com connector support
// Required for drive.google.com connector support include_once dirname(FILE).DIRECTORY_SEPARATOR.'elFinderVolumeGoogleDrive.class.php';
// Google Drive driver need next three settings. You can get at https://console.developers.google.com define('ELFINDER_GOOGLEDRIVE_CLIENTID', ' '); define('ELFINDER_GOOGLEDRIVE_CLIENTSECRET', ' '); define('ELFINDER_GOOGLEDRIVE_REDIRECTURI', 'http://localhost:8080/elfinder/php/connector.minimal.php');
if (isset($_GET['code'])) { $callback = new elFinderVolumeGoogleDrive(); $callback->netmountPrepare(array()); //prepare callback url exit(); }
====================================================================
googledrive: {
name : 'GoogleDrive.com',
inputs: {
//offline :
if (data.mode == 'makebtn') {
$(f.host[0]).removeClass('elfinder-info-spinner');
f.host.find('input').hover(function(){$(this).toggleClass('ui-state-hover');});
$(f.host[1]).val('');
f.path.val('/').next().remove(); // change root to /
f.user.val('');
f.pass.val('');
//f.offline.parent().parent().show();
} else {
$(f.host[0]).html('GoogleDrive.com ').removeClass('elfinder-info-spinner');
if (data.reset) {
p.trigger('change', 'reset');
return;
}
$(f.host[0]).parent().append($('<span class="elfinder-button-icon elfinder-button-icon-reload" title="'+fm.i18n('reAuth')+'">')
.on('click', function() {
$(f.host[1]).val('reauth');
p.trigger('change', 'reset');
}));
$(f.host[1]).val('googledrive');
if (data.folders) {
f.path.next().remove().end().after(
$('<div/>').append(
$('<select class="ui-corner-all" style="max-width:200px;">').append(
$($.map(data.folders, function(n,i){return '<option value="'+i+'">'+fm.escape(n)+'</option>'}).join(''))
).on('change', function(){f.path.val($(this).val());})
)
);
}
f.user.val('done');
f.pass.val('done');
f.offline.parent().parent().hide();
}
},
fail: function(fm, err){
this.protocol.trigger('change', 'reset');
}
}
},