Skip to content

Commit

Permalink
Merge pull request #33 from tkaratug/dev
Browse files Browse the repository at this point in the history
v2.2.0 Updates
  • Loading branch information
tkaratug committed Jun 16, 2018
2 parents e564255 + b947955 commit 13a7cd9
Show file tree
Hide file tree
Showing 23 changed files with 454 additions and 5,812 deletions.
6 changes: 3 additions & 3 deletions App/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'Response' => System\Libs\Http\Response::class,
'Curl' => System\Libs\Http\Curl::class,
'Restful' => System\Libs\Http\Restful::class,
'Jwt' => System\Libs\Http\Jwt::class,
'Event' => System\Libs\Event\Event::class,
'View' => System\Libs\View\View::class,
'Session' => System\Libs\Session\Session::class,
Expand Down Expand Up @@ -52,6 +53,7 @@
'Response' => System\Facades\Response::class,
'Curl' => System\Facades\Curl::class,
'Restful' => System\Facades\Restful::class,
'Jwt' => System\Facades\Jwt::class,
'Event' => System\Facades\Event::class,
'View' => System\Facades\View::class,
'Session' => System\Facades\Session::class,
Expand All @@ -76,9 +78,7 @@
* Middlewares
*/
'middlewares' => [
'default' => [
'Csrf' => App\Middlewares\Csrf::class,
],
'default' => [],

'manual' => [
'Auth' => App\Middlewares\Auth::class,
Expand Down
22 changes: 0 additions & 22 deletions App/Middlewares/Csrf.php

This file was deleted.

13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
v2.2.0
- [Yeni] JWT kütüphanesi eklendi.
- [Yeni] Validation kütüphanesinde, form verilerinin request() methodu ile topluca tanımlanması sağlandı.
- [Yeni] Validation kütüphanesinde, array form elemanlarının da dikkate alınması sağlandı.
- [Düzeltme] PHPMailer kütüphanesi, composer'a eklendi.
- [Düzeltme] Farklı namespace'lerde aynı isimli Model tanımlama ile ilgili hata giderildi.
- [Düzeltme] Model'de namespace tanımlandığında, diğer modelleri de etkileme hatası giderildi.
- [Düzetlem] route() fonksiyonunun ikinci parametre almadığı durumlarda verdiği hata giderildi.
- [Düzeltme] Request kütüphanesinde, server header'larındaki warning hataları giderildi.
- [Düzeltme] Request kütüphanesindeki filter() methodunda, dizi elemanlarını da filtreleyen düzenleme yapıldı.
- [Düzeltme] base_url() methodundaki http/https detect hatası giderildi.
- [Düzeltme] Image kütüphanesinde, show() methodundaki return hatası giderildi.

v2.1.1
- [Düzeltme] Database kütüphanesinde bulunan in() ve notIn() methodlarındaki bug giderildi.

Expand Down
30 changes: 30 additions & 0 deletions System/Facades/Jwt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/*************************************************
* Titan-2 Mini Framework
* Facade of Jwt Library
*
* Author : Turan Karatuğ
* Web : http://www.titanphp.com
* Docs : http://kilavuz.titanphp.com
* Github : http://github.com/tkaratug/titan2
* License : MIT
*
*************************************************/
namespace System\Facades;

use System\Facades\Facade;

class Jwt extends Facade
{

/**
* Get the registered name of the component.
*
* @param string
*/
protected static function getFacadeAccessor()
{
return 'Jwt';
}

}
2 changes: 1 addition & 1 deletion System/Kernel/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
define('ENV', 'development');

// Framework Version
define('VERSION', '2.1.1');
define('VERSION', '2.2.0');

// Default Timezone
define('TIMEZONE', 'Europe/Istanbul');
2 changes: 1 addition & 1 deletion System/Kernel/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function public_path($file)
if (!function_exists('base_url')) {
function base_url($url = null)
{
if (stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true)
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
$protocol = 'https';
else
$protocol = 'http';
Expand Down
19 changes: 12 additions & 7 deletions System/Kernel/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,24 @@ public function helper($file)
}

/**
* Include model file
* Include model
*
* @param string $file
* @param string $key
* @return void
*/
public static function model($file, $namespace = null)
public static function model($key)
{
if (is_null($namespace)) {
$filePath = MODEL_DIR . ucfirst($file) . '.php';
$class = 'App\\Models\\' . ucfirst($file);
} else {
if (strpos($key, '.')) {
$model = explode('.', $key);
$file = base64_decode($model[0]);
$namespace = base64_decode($model[1]);

$filePath = MODEL_DIR . ucfirst($namespace) . '/' . ucfirst($file) . '.php';
$class = 'App\\Models\\' . ucfirst($namespace) . '\\' . ucfirst($file);
} else {
$file = base64_decode($key);
$filePath = MODEL_DIR . ucfirst($file) . '.php';
$class = 'App\\Models\\' . ucfirst($file);
}

if (file_exists($filePath)) {
Expand Down
20 changes: 20 additions & 0 deletions System/Languages/English/Date.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/*************************************************
* Titan-2 Mini Framework
* Date Object's English Language File
*
* Author : Turan Karatuğ
* Web : http://www.titanphp.com
* Docs : http://kilavuz.titanphp.com
* Github : http://github.com/tkaratug/titan2
* License : MIT
*
*************************************************/
$lang['date']['just'] = 'Just';
$lang['date']['seconds_ago'] = '%s Seconds Ago';
$lang['date']['minutes_ago'] = '%s Minute(s) Ago';
$lang['date']['hours_ago'] = '%s Hour(s) Ago';
$lang['date']['days_ago'] = '%s Day(s) Ago';
$lang['date']['weeks_ago'] = '%s Week(s) Ago';
$lang['date']['months_ago'] = '%s Month(s) Ago';
$lang['date']['years_ago'] = '%s Year(s) Ago';
20 changes: 20 additions & 0 deletions System/Languages/Turkish/Date.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/*************************************************
* Titan-2 Mini Framework
* Date Object's Turkish Language File
*
* Author : Turan Karatuğ
* Web : http://www.titanphp.com
* Docs : http://kilavuz.titanphp.com
* Github : http://github.com/tkaratug/titan2
* License : MIT
*
*************************************************/
$lang['date']['just'] = 'Az Önce';
$lang['date']['seconds_ago'] = '%s Saniye Önce';
$lang['date']['minutes_ago'] = '%s Dakika Önce';
$lang['date']['hours_ago'] = '%s Saat Önce';
$lang['date']['days_ago'] = '%s Gün Önce';
$lang['date']['weeks_ago'] = '%s Hafta Önce';
$lang['date']['months_ago'] = '%s Ay Önce';
$lang['date']['years_ago'] = '%s Yıl Önce';
41 changes: 36 additions & 5 deletions System/Libs/Database/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class Model
// Model Collection
private $modelCollection = [];

// Default Namespace
private $namespace = null;

/**
* Return instance of model
*
Expand All @@ -28,14 +31,42 @@ class Model
*/
public function run($model, $namespace = null)
{
if (array_key_exists($model, $this->modelCollection))
return $this->modelCollection[$model];
if ($namespace !== null)
$this->namespace = $namespace;

$model = base64_encode($model);

if ($this->namespace !== null) {
$namespace = base64_encode($this->namespace);
$key = $model . '.' . $namespace;
} else {
$key = $model;
}

// Reset namespace
$this->namespace = null;

if (array_key_exists($key, $this->modelCollection))
return $this->modelCollection[$key];
else {
$db = Import::model($model, $namespace);
$this->modelCollection[$model] = $db;
$db = Import::model($key);
$this->modelCollection[$key] = $db;

return $this->modelCollection[$model];
return $this->modelCollection[$key];
}
}

/**
* Set namespace
*
* @param string $namespace
* @return $this
*/
public function namespace($namespace)
{
$this->namespace = $namespace;

return $this;
}

}
4 changes: 2 additions & 2 deletions System/Libs/Date/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ public function humantime($time = null)
return lang('date', 'seconds_ago', $second);
}
} else if ($minute < 60) {
return lang('date', 'minues_ago', $minute);
return lang('date', 'minutes_ago', $minute);
} else if ($hour < 24) {
return lang('date', 'hours_ago', $hour);
} else if ($day < 7) {
Expand Down Expand Up @@ -990,4 +990,4 @@ private function dateNormalize(&$base, &$result)
return $result;
}

}
}
Loading

0 comments on commit 13a7cd9

Please sign in to comment.