Commit 82e34c68 authored by Tino Goratsch's avatar Tino Goratsch

another round of PSR-2 styling fixes

parent 12d11273
......@@ -241,5 +241,3 @@ $lang = array(
"Select Thumbnails" => "Kies duimnaels",
"Download files" => "Laai lêers af",
);
?>
\ No newline at end of file
......@@ -266,5 +266,3 @@ $lang = array(
"Confirmation" => "Потвърждение",
"Warning" => "Внимание"
);
?>
\ No newline at end of file
......@@ -124,5 +124,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Carregant arxiu {number} de {count}... {progress}",
"Failed to upload {filename}!" => "Error al carregar {filename}",
);
?>
\ No newline at end of file
......@@ -128,5 +128,3 @@ $lang = array(
"Confirmation" => "Potvrzení",
"Warning" => "Varování",
);
?>
\ No newline at end of file
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Uploader fil {number} af {count} ... {progress}",
"Failed to upload {filename}!" => "Kunne ikke uploade {filename}!",
);
?>
\ No newline at end of file
......@@ -128,5 +128,3 @@ $lang = array(
"Confirmation" => "Bestätigung",
"Warning" => "Warnung"
);
?>
\ No newline at end of file
......@@ -128,5 +128,3 @@ $lang = array(
"Confirmation" => "Επιβεβαίωση",
"Warning" => "Προειδοποίηση",
);
?>
\ No newline at end of file
......@@ -21,5 +21,3 @@ $lang = array(
'_dateTimeMid' => "%a %b %e %Y %I:%M %p",
'_dateTimeSmall' => "%m/%d/%Y %I:%M %p",
);
?>
\ No newline at end of file
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Cargando archivo {number} de {count}... {progress}",
"Failed to upload {filename}!" => "¡No se pudo cargar el archivo {filename}!",
);
?>
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Laen üles faili {number} {count}-st... {progress}",
"Failed to upload {filename}!" => "{filename} üleslaadimine ebaõnnestus!",
);
?>
\ No newline at end of file
......@@ -263,5 +263,3 @@ $lang = array(
"Failed to upload {filename}!" => "! {filename} خطا در ارسال"
);
?>
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Siirretään tiedostoa {number}/{count} ... {progress}",
"Failed to upload {filename}!" => "Siirto epäonnistui {filename}!",
);
?>
\ No newline at end of file
......@@ -129,5 +129,3 @@ $lang = array(
"Confirmation" => "Confirmation",
"Warning" => "Avertissement",
);
?>
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "מעלה קובץ {number} מתוך {count}... {progress}",
"Failed to upload {filename}!" => "העלאת הקובץ נכשלה!",
);
?>
\ No newline at end of file
......@@ -128,5 +128,3 @@ $lang = array(
"Confirmation" => "Megerősítés",
"Warning" => "Figyelem"
);
?>
\ No newline at end of file
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Mengunggah file {number} of {count}... {progress}",
"Failed to upload {filename}!" => "Gagal untuk mengunggah {filename}",
);
?>
\ No newline at end of file
......@@ -128,5 +128,3 @@ $lang = array(
"Confirmation" => "Conferma",
"Warning" => "Attenzione",
);
?>
\ No newline at end of file
......@@ -129,5 +129,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "ファイルをアップロード中({number}/{count})... {progress}",
"Failed to upload {filename}!" => "{filename}のアップロードに失敗しました",
);
?>
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Augšupielādējot failu {number} no {count}... {progress}",
"Failed to upload {filename}!" => "Neizdevās augšupielādēt {filename}!",
);
?>
\ No newline at end of file
......@@ -129,5 +129,3 @@ $lang = array(
"Confirmation" => "Bevestiging",
"Warning" => "Waarschuwing",
);
?>
......@@ -238,5 +238,3 @@ $lang = array(
"Select Thumbnails" => "Velg miniatyrbilde",
"Download files" => "Last ned filer",
);
?>
\ No newline at end of file
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Wysyłanie pliku nr {number} spośród {count} ... {progress}",
"Failed to upload {filename}!" => "Wysyłanie pliku {filename} nie powiodło się!",
);
?>
\ No newline at end of file
......@@ -126,5 +126,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Enviando arquivo {number} de {count}... {progress}",
"Failed to upload {filename}!" => "Falha no envio do arquivo {filename}!",
);
?>
\ No newline at end of file
......@@ -239,5 +239,3 @@ $lang = array(
"Select Thumbnails" => "Seleccionar miniaturas",
"Download files" => "Sacar ficheiros",
);
?>
......@@ -122,5 +122,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Încărcare fișier {number} din {count}... {progress}",
"Failed to upload {filename}!" => "Încărcare {filename} eșuată!",
);
?>
\ No newline at end of file
......@@ -129,5 +129,3 @@ $lang = array(
"Confirmation" => "Подтверждение",
"Warning" => "Предупреждение",
);
?>
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Nahrávam súbor {number} z {count}... {progress}",
"Failed to upload {filename}!" => "Nepodarilo sa nahrať súbor {filename}!",
);
?>
\ No newline at end of file
......@@ -123,5 +123,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Ladda upp fil {number} av {count} ... {progress}",
"Failed to upload {filename}!" => "Uppladdning misslyckad {filename}!",
);
?>
\ No newline at end of file
......@@ -128,5 +128,3 @@ $lang = array(
"Confirmation" => "Onay",
"Warning" => "Uyarı",
);
?>
<?php
/** Ukrainian localization file for KCFinder
* author: Myroslav Dobra
* E-mail: dmaraptor@mail.ru
* author: Myroslav Dobra
* E-mail: dmaraptor@mail.ru
*/
$lang = array(
......@@ -124,5 +124,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "Завантаження файлу {number} з {count}... {progress}",
"Failed to upload {filename}!" => "Помилка завантаження {filename}!",
);
?>
\ No newline at end of file
......@@ -127,5 +127,3 @@ $lang = array(
"Next" => "Sau",
"Confirmation" => "Xác nhận",
"Warning" => "Cảnh báo",);
?>
......@@ -126,5 +126,3 @@ $lang = array(
"Uploading file {number} of {count}... {progress}" => "正在上传文件{number} / {count}... {progress}",
"Failed to upload {filename}!" => "上传失败{filename}!",
);
?>
\ No newline at end of file
......@@ -13,30 +13,34 @@ namespace kcfinder;
* @version 0.1
*/
class fastImage
class class_fastImage
{
private $strpos = 0;
private $str;
private $uri;
private $type;
private $handle;
public function __construct($uri = null)
{
if ($uri) $this->load($uri);
}
public function load($uri)
{
if ($this->handle) $this->close();
$this->uri = $uri;
private $strpos = 0;
private $str;
private $uri;
private $type;
private $handle;
public function __construct($uri = null)
{
if ($uri) {
$this->load($uri);
}
}
public function load($uri)
{
if ($this->handle) {
$this->close();
}
$this->uri = $uri;
// Joy - this is a fix for URLs missing "http:"
if ($uri[0] == '/' && $uri[1] == '/') {
$uri = 'http:' . $uri;
$uri = 'http:' . $uri;
}
$this->handle = fopen(
$this->handle = fopen(
$uri,
'r',
false,
......@@ -44,39 +48,38 @@ class fastImage
'http'=> array('timeout' => 0.5),
))
);
}
public function isValid()
{
return empty($this->handle) ? false : true;
}
public function close()
{
if (is_resource($this->handle)) fclose($this->handle);
}
}
public function isValid()
{
return empty($this->handle) ? false : true;
}
public function getSize()
{
$this->strpos = 0;
if ($this->getType())
public function close()
{
return array_values($this->parseSize());
if (is_resource($this->handle)) {
fclose($this->handle);
}
}
return false;
}
public function getSize()
{
$this->strpos = 0;
if ($this->getType()) {
return array_values($this->parseSize());
}
return false;
}
public function getType()
{
$this->strpos = 0;
if (!$this->type)
public function getType()
{
switch ($this->getChars(2))
{
$this->strpos = 0;
if (!$this->type) {
switch ($this->getChars(2)) {
case "BM":
return $this->type = 'bmp';
case "GI":
......@@ -88,18 +91,17 @@ class fastImage
default:
return false;
}
}
return $this->type;
}
}
return $this->type;
}
private function parseSize()
{
$this->strpos = 0;
switch ($this->type)
private function parseSize()
{
$this->strpos = 0;
switch ($this->type) {
case 'png':
return $this->parseSizeForPNG();
case 'gif':
......@@ -110,73 +112,66 @@ class fastImage
return $this->parseSizeForJPEG();
}
return null;
}
return null;
}
private function parseSizeForPNG()
{
$chars = $this->getChars(25);
return unpack("N*", substr($chars, 16, 8));
}
private function parseSizeForPNG()
{
$chars = $this->getChars(25);
return unpack("N*", substr($chars, 16, 8));
}
private function parseSizeForGIF()
{
$chars = $this->getChars(11);
return unpack("S*", substr($chars, 6, 4));
}
private function parseSizeForGIF()
{
$chars = $this->getChars(11);
return unpack("S*", substr($chars, 6, 4));
}
private function parseSizeForBMP()
{
$chars = $this->getChars(29);
$chars = substr($chars, 14, 14);
$type = unpack('C', $chars);
return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8));
}
private function parseSizeForBMP()
{
$chars = $this->getChars(29);
$chars = substr($chars, 14, 14);
$type = unpack('C', $chars);
return (reset($type) == 40) ? unpack('L*', substr($chars, 4)) : unpack('L*', substr($chars, 4, 8));
}
private function parseSizeForJPEG()
{
$state = null;
$i = 0;
while (true)
private function parseSizeForJPEG()
{
switch ($state)
{
$state = null;
$i = 0;
while (true) {
switch ($state) {
default:
$this->getChars(2);
$state = 'started';
break;
case 'started':
$b = $this->getByte();
if ($b === false) return false;
if ($b === false) {
return false;
}
$state = $b == 0xFF ? 'sof' : 'started';
break;
case 'sof':
$b = $this->getByte();
if (in_array($b, range(0xe0, 0xef)))
{
$state = 'skipframe';
}
elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF))))
{
$state = 'readsize';
}
elseif ($b == 0xFF)
{
$state = 'sof';
}
else
{
$state = 'skipframe';
if (in_array($b, range(0xe0, 0xef))) {
$state = 'skipframe';
} elseif (in_array($b, array_merge(range(0xC0, 0xC3), range(0xC5, 0xC7), range(0xC9, 0xCB), range(0xCD, 0xCF)))) {
$state = 'readsize';
} elseif ($b == 0xFF) {
$state = 'sof';
} else {
$state = 'skipframe';
}
break;
......@@ -195,61 +190,56 @@ class fastImage
return array($this->readInt(substr($c, 5, 2)), $this->readInt(substr($c, 3, 2)));
}
}
}
}
private function getChars($n)
{
$response = null;
private function getChars($n)
{
$response = null;
// do we need more data?
if ($this->strpos + $n -1 >= strlen($this->str))
{
$end = ($this->strpos + $n);
if ($this->strpos + $n -1 >= strlen($this->str)) {
$end = ($this->strpos + $n);
while (strlen($this->str) < $end && $response !== false)
{
// read more from the file handle
while (strlen($this->str) < $end && $response !== false) {
// read more from the file handle
$need = $end - ftell($this->handle);
if ($response = fread($this->handle, $need))
{
$this->str .= $response;
if ($response = fread($this->handle, $need)) {
$this->str .= $response;
} else {
return false;
}
}
else
{
return false;
}
}
}
$result = substr($this->str, $this->strpos, $n);
$this->strpos += $n;
$result = substr($this->str, $this->strpos, $n);
$this->strpos += $n;
return $result;
}
return $result;
}
private function getByte()
{
$c = $this->getChars(1);
$b = unpack("C", $c);
private function getByte()
{
$c = $this->getChars(1);
$b = unpack("C", $c);
return reset($b);
}
return reset($b);
}
private function readInt($str)
{
$size = unpack("C*", $str);
private function readInt($str)
{
$size = unpack("C*", $str);
return ($size[1] << 8) + $size[2];
}
return ($size[1] << 8) + $size[2];
}
public function __destruct()
{
$this->close();
}
}
\ No newline at end of file
public function __destruct()
{
$this->close();
}
}
......@@ -14,7 +14,8 @@
namespace kcfinder;
abstract class image {
abstract class class_image
{
const DEFAULT_JPEG_QUALITY = 75;
/** Image resource or object
......@@ -43,7 +44,8 @@ abstract class image {
* @param string $property
* @return mixed */
final public function __get($property) {
final public function __get($property)
{
return property_exists($this, $property) ? $this->$property : null;
}
......@@ -59,14 +61,16 @@ abstract class image {
* @param mixed $image
* @param array $options */
public function __construct($image, array $options=array()) {
public function __construct($image, array $options=array())
{
$this->image = $this->width = $this->height = null;
$imageDetails = $this->buildImage($image);