@@ -11,10 +11,10 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Env |
| 13 | 13 | { |
| 14 | - public function __invoke($filePath ,$key, $default = null) |
|
| 14 | + public function __invoke($filePath, $key, $default = null) |
|
| 15 | 15 | { |
| 16 | 16 | if (file_exists($filePath . '.env')) { |
| 17 | - $_dotenv = new Dotenv($filePath ); |
|
| 17 | + $_dotenv = new Dotenv($filePath); |
|
| 18 | 18 | $_dotenv->load(); |
| 19 | 19 | unset($_dotenv); |
| 20 | 20 | }else { |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $_dotenv = new Dotenv($filePath ); |
| 18 | 18 | $_dotenv->load(); |
| 19 | 19 | unset($_dotenv); |
| 20 | - }else { |
|
| 20 | + } else { |
|
| 21 | 21 | return ''; |
| 22 | 22 | } |
| 23 | 23 | $value = getenv($key); |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | 'showSlimEnvironmentPanel' => 1, |
| 10 | 10 | 'showSlimRequestPanel' => 1, |
| 11 | 11 | 'showSlimResponsePanel' => 1, |
| 12 | - 'showSlimContainer' =>1 , |
|
| 12 | + 'showSlimContainer' =>1, |
|
| 13 | 13 | 'showEloquentORMPanel' => 1, |
| 14 | - 'showIdiormPanel' => 1,// > 0 mean you enable logging |
|
| 14 | + 'showIdiormPanel' => 1, // > 0 mean you enable logging |
|
| 15 | 15 | // but show or not panel you decide in browser in panel selector |
| 16 | - 'showDoctrinePanel' => 'em',// here also enable logging and you must enter your Doctrine container name |
|
| 16 | + 'showDoctrinePanel' => 'em', // here also enable logging and you must enter your Doctrine container name |
|
| 17 | 17 | // and also as above show or not panel you decide in browser in panel selector |
| 18 | 18 | 'showProfilerPanel' => 1, |
| 19 | 19 | 'showVendorVersionsPanel' => 1, |
@@ -2,15 +2,15 @@ |
||
| 2 | 2 | return [ |
| 3 | 3 | 'databases'=>[ |
| 4 | 4 | 'db' => [ |
| 5 | - 'driver' => $env(__APP_ROOT__,'DB_DRIVER', 'mysql'), |
|
| 6 | - 'host' => $env(__APP_ROOT__,'DB_HOST', 'localhost'), |
|
| 7 | - 'database' => $env(__APP_ROOT__,'DB_NAME', 'cafesaba'), |
|
| 8 | - 'username' => $env(__APP_ROOT__,'DB_USERNAME', 'root'), |
|
| 9 | - 'password' => $env(__APP_ROOT__,'DB_PASS', ''), |
|
| 10 | - 'charset' => $env(__APP_ROOT__,'DB_CHARSET', 'utf8'), |
|
| 11 | - 'collation' => $env(__APP_ROOT__,'DB_COLLATION', 'utf8_unicode_ci'), |
|
| 12 | - 'prefix' => $env(__APP_ROOT__,'DB_PREFIX', ''), |
|
| 13 | - 'port' => $env(__APP_ROOT__,'DB_PORT', 3306), |
|
| 5 | + 'driver' => $env(__APP_ROOT__, 'DB_DRIVER', 'mysql'), |
|
| 6 | + 'host' => $env(__APP_ROOT__, 'DB_HOST', 'localhost'), |
|
| 7 | + 'database' => $env(__APP_ROOT__, 'DB_NAME', 'cafesaba'), |
|
| 8 | + 'username' => $env(__APP_ROOT__, 'DB_USERNAME', 'root'), |
|
| 9 | + 'password' => $env(__APP_ROOT__, 'DB_PASS', ''), |
|
| 10 | + 'charset' => $env(__APP_ROOT__, 'DB_CHARSET', 'utf8'), |
|
| 11 | + 'collation' => $env(__APP_ROOT__, 'DB_COLLATION', 'utf8_unicode_ci'), |
|
| 12 | + 'prefix' => $env(__APP_ROOT__, 'DB_PREFIX', ''), |
|
| 13 | + 'port' => $env(__APP_ROOT__, 'DB_PORT', 3306), |
|
| 14 | 14 | ], |
| 15 | 15 | ] |
| 16 | 16 | ]; |
| 17 | 17 | \ No newline at end of file |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | use Illuminate\Database\Capsule\Manager as Capsule; |
| 7 | 7 | $env = new \Core\Helpers\Env(); |
| 8 | 8 | $config = include 'databases.php'; |
| 9 | -$capsule = new Capsule; |
|
| 9 | +$capsule = new Capsule; |
|
| 10 | 10 | $capsule->addConnection($config['databases']['db']); |
| 11 | 11 | $capsule->setAsGlobal(); |
| 12 | 12 | $capsule->bootEloquent(); |
| 13 | 13 | $container = new ArrayObject(); |
| 14 | 14 | $container['phpmig.adapter'] = new Adapter\Illuminate\Database($capsule, 'migrations'); |
| 15 | -$container['phpmig.migrations_path'] = 'database/migrations'; |
|
| 15 | +$container['phpmig.migrations_path'] = 'database/migrations'; |
|
| 16 | 16 | $container['phpmig.migrations_template_path'] = 'core/resources/templates/create_migration.txt'; |
| 17 | 17 | return $container; |
| 18 | 18 | \ No newline at end of file |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | 'displayErrorDetails' => true, |
| 6 | 6 | 'app' => [ |
| 7 | 7 | 'log_timer' => true, |
| 8 | - 'debug'=>true , |
|
| 8 | + 'debug'=>true, |
|
| 9 | 9 | 'image' => [ |
| 10 | 10 | 'dir' => __APP_ROOT__ . 'public/uploads' |
| 11 | 11 | ], |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | 'm' => [400,250,70], |
| 11 | 11 | 'l' => [800,600,80], |
| 12 | 12 | 'thumb' => [250, 250,80,true], |
| 13 | - ], |
|
| 13 | + ], |
|
| 14 | 14 | ], |
| 15 | 15 | 'category_photo' => [ |
| 16 | 16 | 'dimensions' => [ |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | 'l' => [800,600,80], |
| 19 | 19 | 'thumb' => [250, 250,80,true], |
| 20 | 20 | 's' => [150, 80,80], |
| 21 | - ], |
|
| 21 | + ], |
|
| 22 | 22 | ], |
| 23 | 23 | 'minquality' => 200 // kamtar az in width va height nemigirim |
| 24 | 24 | ] |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | 'quality' => 100, |
| 8 | 8 | 'user_photo' => [ |
| 9 | 9 | 'dimensions' => [ |
| 10 | - 'm' => [400,250,70], |
|
| 11 | - 'l' => [800,600,80], |
|
| 12 | - 'thumb' => [250, 250,80,true], |
|
| 10 | + 'm' => [400, 250, 70], |
|
| 11 | + 'l' => [800, 600, 80], |
|
| 12 | + 'thumb' => [250, 250, 80, true], |
|
| 13 | 13 | ], |
| 14 | 14 | ], |
| 15 | 15 | 'category_photo' => [ |
| 16 | 16 | 'dimensions' => [ |
| 17 | - 'm' => [400,250,70], |
|
| 18 | - 'l' => [800,600,80], |
|
| 19 | - 'thumb' => [250, 250,80,true], |
|
| 20 | - 's' => [150, 80,80], |
|
| 17 | + 'm' => [400, 250, 70], |
|
| 18 | + 'l' => [800, 600, 80], |
|
| 19 | + 'thumb' => [250, 250, 80, true], |
|
| 20 | + 's' => [150, 80, 80], |
|
| 21 | 21 | ], |
| 22 | 22 | ], |
| 23 | 23 | 'minquality' => 200 // kamtar az in width va height nemigirim |
@@ -5,43 +5,43 @@ |
||
| 5 | 5 | $dir = scandir($path); |
| 6 | 6 | $ex_folders = array('..', '.'); |
| 7 | 7 | |
| 8 | - return array_diff($dir,$ex_folders); |
|
| 8 | + return array_diff($dir, $ex_folders); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | /*folder*/ |
| 13 | -function getImageDirName($photoid, $type = 'user_photo' ,$collectionNum =1000) |
|
| 13 | +function getImageDirName($photoid, $type = 'user_photo', $collectionNum = 1000) |
|
| 14 | 14 | { |
| 15 | 15 | $folderName = null; |
| 16 | 16 | switch ($type) { |
| 17 | 17 | case 'user_photo': |
| 18 | 18 | $folderName = (int) ($photoid / $collectionNum); |
| 19 | 19 | $folderName++; |
| 20 | - $dir = 'user_photo/'.$folderName.'/'; |
|
| 20 | + $dir = 'user_photo/' . $folderName . '/'; |
|
| 21 | 21 | break; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if ($folderName) { |
| 25 | 25 | $folderName = $dir; |
| 26 | - }else{ |
|
| 26 | + }else { |
|
| 27 | 27 | $folderName = (int) ($photoid / $collectionNum); |
| 28 | 28 | $folderName++; |
| 29 | - $folderName = $type.'/'.$folderName.'/'; |
|
| 29 | + $folderName = $type . '/' . $folderName . '/'; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | return $folderName; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -function getImageFileName($photoid,$fileType='l',$type='user_photo') |
|
| 35 | +function getImageFileName($photoid, $fileType = 'l', $type = 'user_photo') |
|
| 36 | 36 | { |
| 37 | 37 | $fileName = null; |
| 38 | 38 | |
| 39 | 39 | switch ($type) { |
| 40 | 40 | case 'user_photo': |
| 41 | - $fileName = 'user'.(int)$photoid.'-'.$fileType; |
|
| 41 | + $fileName = 'user' . (int) $photoid . '-' . $fileType; |
|
| 42 | 42 | break; |
| 43 | 43 | case 'category_photo': |
| 44 | - $fileName = 'category'.(int)$photoid.'-'.$fileType; |
|
| 44 | + $fileName = 'category' . (int) $photoid . '-' . $fileType; |
|
| 45 | 45 | break; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | if ($folderName) { |
| 25 | 25 | $folderName = $dir; |
| 26 | - }else{ |
|
| 26 | + } else{ |
|
| 27 | 27 | $folderName = (int) ($photoid / $collectionNum); |
| 28 | 28 | $folderName++; |
| 29 | 29 | $folderName = $type.'/'.$folderName.'/'; |
@@ -7,70 +7,70 @@ |
||
| 7 | 7 | class ImageService extends _Service |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - public function cropResize($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
| 10 | + public function cropResize($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
| 11 | 11 | { |
| 12 | 12 | $image = GImage::open($src); |
| 13 | 13 | $image->cropResize($width, $height); |
| 14 | - $destUrl = $destUrl.'.'.$fileExt; |
|
| 15 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
| 14 | + $destUrl = $destUrl . '.' . $fileExt; |
|
| 15 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | return $image; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function scaleResize($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
| 21 | + public function scaleResize($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
| 22 | 22 | { |
| 23 | 23 | $image = GImage::open($src); |
| 24 | 24 | $image->scaleResize($width, $height); |
| 25 | - $destUrl = $destUrl.'.'.$fileExt; |
|
| 26 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
| 25 | + $destUrl = $destUrl . '.' . $fileExt; |
|
| 26 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | return $image; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function resize($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
| 32 | + public function resize($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
| 33 | 33 | { |
| 34 | 34 | $image = GImage::open($src); |
| 35 | 35 | $image->resize($width, $height); |
| 36 | - $destUrl = $destUrl.'.'.$fileExt; |
|
| 37 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
| 36 | + $destUrl = $destUrl . '.' . $fileExt; |
|
| 37 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | return $image; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function zoomCrop($src,$destUrl, $width, $height, $quality = 80,$fileExt = 'jpg') |
|
| 43 | + public function zoomCrop($src, $destUrl, $width, $height, $quality = 80, $fileExt = 'jpg') |
|
| 44 | 44 | { |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | $image = GImage::open($src); |
| 48 | 48 | $image->zoomCrop($width, $height); |
| 49 | - $destUrl = $destUrl.'.'.$fileExt; |
|
| 50 | - $image->save($destUrl, $fileExt = 'jpg', $quality ); |
|
| 49 | + $destUrl = $destUrl . '.' . $fileExt; |
|
| 50 | + $image->save($destUrl, $fileExt = 'jpg', $quality); |
|
| 51 | 51 | return $image; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function createPhotos($src,$photoid,$type='user_photo', $dimensions = false) |
|
| 54 | + public function createPhotos($src, $photoid, $type = 'user_photo', $dimensions = false) |
|
| 55 | 55 | { |
| 56 | 56 | |
| 57 | 57 | // Get default dimensions |
| 58 | - $dest = realpath('.'.$GLOBALS['settings']['image']['upload_path']); |
|
| 58 | + $dest = realpath('.' . $GLOBALS['settings']['image']['upload_path']); |
|
| 59 | 59 | $defaultDimensions = $dimensions ? $dimensions : $GLOBALS['settings']['image'][$type]['dimensions']; |
| 60 | 60 | foreach ($defaultDimensions as $keys=>$dimension) |
| 61 | 61 | { |
| 62 | - if(!isset($dimension[2])) $dimension[2] = 100; // quality |
|
| 63 | - if(!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
| 62 | + if (!isset($dimension[2])) $dimension[2] = 100; // quality |
|
| 63 | + if (!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
| 64 | 64 | |
| 65 | - $destUrl = $dest.'/'.getImageDirName($photoid,$type).getImageFileName($photoid,$keys,$type); |
|
| 66 | - if(isset($dimension[3]) && $dimension[3] == true){ |
|
| 67 | - $image = $this->zoomCrop($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
|
| 65 | + $destUrl = $dest . '/' . getImageDirName($photoid, $type) . getImageFileName($photoid, $keys, $type); |
|
| 66 | + if (isset($dimension[3]) && $dimension[3] == true) { |
|
| 67 | + $image = $this->zoomCrop($src, trim($destUrl), $dimension[0], $dimension[1], $dimension[2], $dimension[4]); |
|
| 68 | 68 | }else { |
| 69 | - $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
|
| 69 | + $image = $this->cropResize($src, trim($destUrl), $dimension[0], $dimension[1], $dimension[2], $dimension[4]); |
|
| 70 | 70 | } |
| 71 | 71 | // $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
| 72 | 72 | |
| 73 | - if($image ){ |
|
| 73 | + if ($image) { |
|
| 74 | 74 | $cropedArr[$keys] = $src; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -59,13 +59,19 @@ |
||
| 59 | 59 | $defaultDimensions = $dimensions ? $dimensions : $GLOBALS['settings']['image'][$type]['dimensions']; |
| 60 | 60 | foreach ($defaultDimensions as $keys=>$dimension) |
| 61 | 61 | { |
| 62 | - if(!isset($dimension[2])) $dimension[2] = 100; // quality |
|
| 63 | - if(!isset($dimension[4])) $dimension[4] = 'jpg'; // quality |
|
| 62 | + if(!isset($dimension[2])) { |
|
| 63 | + $dimension[2] = 100; |
|
| 64 | + } |
|
| 65 | + // quality |
|
| 66 | + if(!isset($dimension[4])) { |
|
| 67 | + $dimension[4] = 'jpg'; |
|
| 68 | + } |
|
| 69 | + // quality |
|
| 64 | 70 | |
| 65 | 71 | $destUrl = $dest.'/'.getImageDirName($photoid,$type).getImageFileName($photoid,$keys,$type); |
| 66 | 72 | if(isset($dimension[3]) && $dimension[3] == true){ |
| 67 | 73 | $image = $this->zoomCrop($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
| 68 | - }else { |
|
| 74 | + } else { |
|
| 69 | 75 | $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
| 70 | 76 | } |
| 71 | 77 | // $image = $this->cropResize($src,trim($destUrl),$dimension[0], $dimension[1], $dimension[2],$dimension[4]); |
@@ -10,18 +10,18 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | public function up() |
| 12 | 12 | { |
| 13 | - Capsule::schema()->create('categories', function ($table) { |
|
| 13 | + Capsule::schema()->create('categories', function($table) { |
|
| 14 | 14 | $table->increments('id'); |
| 15 | 15 | $table->string('title')->nullable(); |
| 16 | 16 | $table->string('slug')->unique(); |
| 17 | 17 | $table->text('body')->nullable(); |
| 18 | 18 | $table->integer('item_cnt')->unsigned()->default(0); |
| 19 | - $table->enum('is_active',['yes','no'])->default('yes'); |
|
| 20 | - $table->enum('has_pic',['yes','no'])->default('no'); |
|
| 19 | + $table->enum('is_active', ['yes', 'no'])->default('yes'); |
|
| 20 | + $table->enum('has_pic', ['yes', 'no'])->default('no'); |
|
| 21 | 21 | |
| 22 | - $table->string('meta_title',128)->nullable(); |
|
| 23 | - $table->string('meta_description',256)->nullable(); |
|
| 24 | - $table->string('meta_keywords',64)->nullable(); |
|
| 22 | + $table->string('meta_title', 128)->nullable(); |
|
| 23 | + $table->string('meta_description', 256)->nullable(); |
|
| 24 | + $table->string('meta_keywords', 64)->nullable(); |
|
| 25 | 25 | |
| 26 | 26 | /*Add Soft Delete To Articles*/ |
| 27 | 27 | $table->softDeletes(); |