mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-08 01:18:48 +00:00
Merge branch '3.6-rc'
This commit is contained in:
commit
39dd3dffe0
733 changed files with 10943 additions and 8237 deletions
|
@ -1,6 +1,6 @@
|
|||
[donation_link]: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=3PMY37SL9L888&lc=US&item_name=JavaScript%20file%20uploader¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
||||
|
||||
This plugin uses XHR for uploading multiple files with progress-bar in FF3.6+, Safari4+,
|
||||
This addon uses XHR for uploading multiple files with progress-bar in FF3.6+, Safari4+,
|
||||
Chrome and falls back to hidden iframe based upload in other browsers,
|
||||
providing good user experience everywhere.
|
||||
|
||||
|
@ -17,13 +17,13 @@ providing good user experience everywhere.
|
|||
* tested in IE7,8; Firefox 3,3.6,4; Safari4,5; Chrome; Opera10.60;
|
||||
|
||||
### License ###
|
||||
This plugin is open sourced under <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPL 2</a> or later.
|
||||
This addon is open sourced under <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPL 2</a> or later.
|
||||
If this license doesn't suit you mail me at andrew (at) valums.com.
|
||||
|
||||
Please [donate][donation_link] if you are willing to support the further development of file upload plugin.
|
||||
Please [donate][donation_link] if you are willing to support the further development of file upload addon.
|
||||
|
||||
### Known Issues ###
|
||||
Plugin breaks back button functionality in Opera.
|
||||
Addon breaks back button functionality in Opera.
|
||||
|
||||
### Getting started ###
|
||||
The fileuploader.js contains two classes that are meant to be used directly.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Name: JS Uploader
|
||||
* Description: JavaScript photo/image uploader. Uses Valum 'qq' Uploader.
|
||||
|
@ -15,21 +14,23 @@
|
|||
* Module Author: Chris Case
|
||||
*
|
||||
*/
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
||||
function js_upload_install() {
|
||||
register_hook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
|
||||
register_hook('photo_post_init', 'addon/js_upload/js_upload.php', 'js_upload_post_init');
|
||||
register_hook('photo_post_file', 'addon/js_upload/js_upload.php', 'js_upload_post_file');
|
||||
register_hook('photo_post_end', 'addon/js_upload/js_upload.php', 'js_upload_post_end');
|
||||
Addon::registerHook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
|
||||
Addon::registerHook('photo_post_init', 'addon/js_upload/js_upload.php', 'js_upload_post_init');
|
||||
Addon::registerHook('photo_post_file', 'addon/js_upload/js_upload.php', 'js_upload_post_file');
|
||||
Addon::registerHook('photo_post_end', 'addon/js_upload/js_upload.php', 'js_upload_post_end');
|
||||
}
|
||||
|
||||
|
||||
function js_upload_uninstall() {
|
||||
unregister_hook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
|
||||
unregister_hook('photo_post_init', 'addon/js_upload/js_upload.php', 'js_upload_post_init');
|
||||
unregister_hook('photo_post_file', 'addon/js_upload/js_upload.php', 'js_upload_post_file');
|
||||
unregister_hook('photo_post_end', 'addon/js_upload/js_upload.php', 'js_upload_post_end');
|
||||
Addon::unregisterHook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form');
|
||||
Addon::unregisterHook('photo_post_init', 'addon/js_upload/js_upload.php', 'js_upload_post_init');
|
||||
Addon::unregisterHook('photo_post_file', 'addon/js_upload/js_upload.php', 'js_upload_post_file');
|
||||
Addon::unregisterHook('photo_post_end', 'addon/js_upload/js_upload.php', 'js_upload_post_end');
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,11 +40,11 @@ function js_upload_form(&$a,&$b) {
|
|||
|
||||
$b['addon_text'] .= '<link href="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.css" rel="stylesheet" type="text/css">';
|
||||
$b['addon_text'] .= '<script src="' . $a->get_baseurl() . '/addon/js_upload/file-uploader/client/fileuploader.js" type="text/javascript"></script>';
|
||||
|
||||
$upload_msg = t('Upload a file');
|
||||
$drop_msg = t('Drop files here to upload');
|
||||
$cancel = t('Cancel');
|
||||
$failed = t('Failed');
|
||||
|
||||
$upload_msg = L10n::t('Upload a file');
|
||||
$drop_msg = L10n::t('Drop files here to upload');
|
||||
$cancel = L10n::t('Cancel');
|
||||
$failed = L10n::t('Failed');
|
||||
|
||||
$maximagesize = intval(get_config('system','maximagesize'));
|
||||
|
||||
|
@ -300,25 +301,25 @@ class qqFileUploader {
|
|||
function handleUpload(){
|
||||
|
||||
if (!$this->file){
|
||||
return array('error' => t('No files were uploaded.'));
|
||||
return ['error' => L10n::t('No files were uploaded.')];
|
||||
}
|
||||
|
||||
$size = $this->file->getSize();
|
||||
|
||||
if ($size == 0) {
|
||||
return array('error' => t('Uploaded file is empty'));
|
||||
return ['error' => L10n::t('Uploaded file is empty')];
|
||||
}
|
||||
|
||||
// if ($size > $this->sizeLimit) {
|
||||
|
||||
// return array('error' => t('Uploaded file is too large'));
|
||||
// return array('error' => L10n::t('Uploaded file is too large'));
|
||||
// }
|
||||
|
||||
|
||||
$maximagesize = get_config('system','maximagesize');
|
||||
|
||||
if(($maximagesize) && ($size > $maximagesize)) {
|
||||
return array('error' => t('Image exceeds size limit of ') . $maximagesize );
|
||||
return ['error' => L10n::t('Image exceeds size limit of ') . $maximagesize ];
|
||||
|
||||
}
|
||||
|
||||
|
@ -329,7 +330,7 @@ class qqFileUploader {
|
|||
|
||||
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
|
||||
$these = implode(', ', $this->allowedExtensions);
|
||||
return array('error' => t('File has an invalid extension, it should be one of ') . $these . '.');
|
||||
return ['error' => L10n::t('File has an invalid extension, it should be one of ') . $these . '.'];
|
||||
}
|
||||
|
||||
if ($this->file->save()){
|
||||
|
@ -339,9 +340,9 @@ class qqFileUploader {
|
|||
'filename' => $filename . '.' . $ext
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'error'=> t('Upload was cancelled, or server error encountered'),
|
||||
'path' => $this->file->getPath(),
|
||||
return [
|
||||
'error'=> L10n::t('Upload was cancelled, or server error encountered'),
|
||||
'path' => $this->file->getPath(),
|
||||
'filename' => $filename . '.' . $ext
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ msgstr ""
|
|||
"Project-Id-Version: friendica\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2013-02-27 05:01-0500\n"
|
||||
"PO-Revision-Date: 2014-09-10 12:26+0000\n"
|
||||
"PO-Revision-Date: 2017-09-20 06:08+0000\n"
|
||||
"Last-Translator: fabrixxm <fabrix.xm@gmail.com>\n"
|
||||
"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue