This commit is contained in:
Manuel Raynaud
2013-09-30 10:35:34 +02:00
parent 43b5a129f7
commit c65ec67bdf
168 changed files with 577 additions and 818 deletions

View File

@@ -156,7 +156,7 @@ class FileManager
* @param ImageCreateOrUpdateEvent $event Image event
* @param FolderImage|ContentImage|CategoryImage|ProductImage $modelImage Image to save
*
* @return int Nb lines modified
* @return int Nb lines modified
* @throws \Thelia\Exception\ImageException
* @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action
*/
@@ -215,7 +215,7 @@ class FileManager
* @param FolderDocument|ContentDocument|CategoryDocument|ProductDocument $modelDocument Document to save
*
* @throws \Thelia\Model\Exception\InvalidArgumentException
* @return int Nb lines modified
* @return int Nb lines modified
* @todo refactor make all documents using propel inheritance and factorise image behaviour into one single clean action
*/
public function saveDocument(DocumentCreateOrUpdateEvent $event, $modelDocument)
@@ -296,7 +296,6 @@ class FileManager
);
}
/**
* Delete image from file storage and database
*
@@ -313,7 +312,6 @@ class FileManager
$model->delete();
}
/**
* Get image model from type
*
@@ -723,4 +721,4 @@ class FileManager
self::TYPE_MODULE,
);
}
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Tools;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
use Thelia\Model\Lang;
/**
@@ -69,19 +67,19 @@ class I18n
$askedLocale
)->findOne();
/* or default translation */
if(null === $i18n) {
if (null === $i18n) {
$i18n = $i18nQueryClass::create()
->filterById($id)
->filterByLocale(
Lang::getDefaultLanguage()->getLocale()
)->findOne();
}
if(null === $i18n) { // @todo something else ?
if (null === $i18n) { // @todo something else ?
$i18n = new $i18nClass();;
$i18n->setId($id);
foreach($needed as $need) {
foreach ($needed as $need) {
$method = sprintf('set%s', $need);
if(method_exists($i18n, $method)) {
if (method_exists($i18n, $method)) {
$i18n->$method('DEFAULT ' . strtoupper($need));
} else {
// @todo throw sg ?

View File

@@ -25,17 +25,16 @@ namespace Thelia\Tools;
class Image
{
static public function isImage($filePath, $allowedImageTypes = null)
public static function isImage($filePath, $allowedImageTypes = null)
{
$imageFile = getimagesize($filePath);
$imageType = $imageFile[2];
if(!is_array($allowedImageTypes) && $imageType != IMAGETYPE_UNKNOWN) {
if (!is_array($allowedImageTypes) && $imageType != IMAGETYPE_UNKNOWN) {
return true;
}
if(in_array($imageType , $allowedImageTypes))
{
if (in_array($imageType , $allowedImageTypes)) {
return true;
}

View File

@@ -91,6 +91,7 @@ class URL
$schemeAuthority = "$scheme://$host"."$port";
}
return $schemeAuthority.$this->requestContext->getBaseUrl();
}
@@ -240,7 +241,7 @@ class URL
} else {
$allParametersWithoutView = $request->query->all();
$view = $request->attributes->get('_view');
if(isset($allOtherParameters['view'])) {
if (isset($allOtherParameters['view'])) {
unset($allOtherParameters['view']);
}
$this->retriever->rewrittenUrl = null;