mirror of
https://github.com/typemill/typemill.git
synced 2025-08-06 14:16:46 +02:00
Version 1.3.7: Image Field for Themes and Plugins
This commit is contained in:
@@ -86,7 +86,7 @@ class Fields
|
||||
}
|
||||
else
|
||||
{
|
||||
$field->unsetAttribute('chhecked');
|
||||
$field->unsetAttribute('checked');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -506,7 +506,9 @@ class Folder
|
||||
{
|
||||
# if it is the first round, create an empty array
|
||||
if(!$i){ $i = 0; $breadcrumb = array();}
|
||||
|
||||
|
||||
if(!$searchArray){ return $breadcrumb;}
|
||||
|
||||
while($i < count($searchArray))
|
||||
{
|
||||
if(!isset($content[$searchArray[$i]])){ return false; }
|
||||
|
@@ -27,6 +27,15 @@ class Validation
|
||||
return false;
|
||||
}, 'invalid values');
|
||||
|
||||
Validator::addRule('image_types', function($field, $value, array $params, array $fields) use ($user)
|
||||
{
|
||||
$allowed = ['jpg', 'jpeg', 'png'];
|
||||
$pathinfo = pathinfo($value);
|
||||
$extension = strtolower($pathinfo['extension']);
|
||||
if(array_search($extension, $allowed)){ return true; }
|
||||
return false;
|
||||
}, 'only jpg, jpeg, png allowed');
|
||||
|
||||
Validator::addRule('userAvailable', function($field, $value, array $params, array $fields) use ($user)
|
||||
{
|
||||
$userdata = $user->getUser($value);
|
||||
@@ -434,6 +443,7 @@ class Validation
|
||||
case "image":
|
||||
$v->rule('noHTML', $fieldName);
|
||||
$v->rule('lengthMax', $fieldName, 1000);
|
||||
$v->rule('image_types', $fieldName);
|
||||
break;
|
||||
default:
|
||||
$v->rule('lengthMax', $fieldName, 1000);
|
||||
|
Reference in New Issue
Block a user