Skip to content

Commit 4ea9750

Browse files
committed
unwanted variables are removed
1 parent b48ce53 commit 4ea9750

File tree

79 files changed

+1099
-1297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1099
-1297
lines changed

src/CmsServiceProvider.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace Ramesh\Cms;
44

55
use Illuminate\Support\ServiceProvider;
6-
76
use Ramesh\Cms\Controller\CmsController;
8-
use Cms;
97
use Ramesh\Cms\providers\ModuleServiceProvider;
108
use Ramesh\Cms\providers\CommandProvider;
119
use Illuminate\Support\Facades\Schema;
@@ -35,15 +33,14 @@ public function boot()
3533
], 'config');
3634

3735
$this->publishes([
38-
__DIR__.'/stubs/skin' => public_path('skin'),
36+
__DIR__ . '/stubs/skin' => public_path('skin'),
3937
], 'public');
4038

4139
$this->publishes([
42-
__DIR__.'/stubs/cms' => base_path('cms'),
40+
__DIR__ . '/stubs/cms' => base_path('cms'),
4341
], 'public');
4442

4543
Schema::defaultStringLength(191);
46-
4744
}
4845

4946
/**
@@ -57,15 +54,13 @@ public function register()
5754
return new CmsController();
5855
});
5956
$loader = require base_path() . '/vendor/autoload.php';
60-
$loader->setPsr4('cms\\core\\',base_path('cms/core'));
57+
$loader->setPsr4('cms\\core\\', base_path('cms/core'));
6158
//$loader->setPsr4('cms\\',base_path('cms/theme1'));
6259

6360

6461
$this->app->register(ModuleServiceProvider::class);
6562
$this->app->register(CommandProvider::class);
6663

6764
include_once('Helper.php');
68-
6965
}
70-
7166
}

src/Commands/CmsPublish.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace Ramesh\Cms\Commands;
44

55
use Illuminate\Console\Command;
6-
use Ramesh\Cms\CmsServiceProvider;
7-
use Cms;
8-
use App;
6+
97
class CmsPublish extends Command
108
{
119
/**

src/Commands/Seed.php

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
use Illuminate\Console\Command;
66
use Cms;
7-
use File;
7+
use Illuminate\Support\Facades\File;
8+
89
class Seed extends Command
910
{
1011
/**
@@ -47,40 +48,33 @@ public function handle()
4748

4849
$class = $this->option('class');
4950

50-
if($module)
51-
{
52-
if($class) {
51+
if ($module) {
52+
if ($class) {
5353
$this->call('db:seed', [
54-
'--class' => Cms::getPath() . '\\' . $module . '\\Database\\seeds\\'.$class
54+
'--class' => Cms::getPath() . '\\' . $module . '\\Database\\seeds\\' . $class
5555
]);
56-
}
57-
else
58-
{
59-
$module_path = base_path().'/' . Cms::getPath() . '/' . Cms::getModulesPath() . '/'.Cms::getCurrentTheme().'/' . $module . '/Database/seeds';
56+
} else {
57+
$module_path = base_path() . '/' . Cms::getPath() . '/' . Cms::getModulesPath() . '/' . Cms::getCurrentTheme() . '/' . $module . '/Database/seeds';
6058
$files = $this->getAllFileInFolder($module_path);
6159
foreach ($files as $file) {
6260
$class_name = preg_replace('/\..+$/', '', $file);
6361
$this->call('db:seed', [
64-
'--class' => Cms::getPath() . '\\' . $module . '\\Database\\seeds\\'.$class_name
62+
'--class' => Cms::getPath() . '\\' . $module . '\\Database\\seeds\\' . $class_name
6563
]);
6664
}
67-
6865
}
69-
}else
70-
{
66+
} else {
7167
$cms = Cms::allModulesPath(false);
72-
foreach ($cms as $module)
73-
{
68+
foreach ($cms as $module) {
7469

7570

76-
if($class) {
77-
if (File::exists(base_path().'/' . $module . '/Database/seeds/'.$class.'.php')) {
71+
if ($class) {
72+
if (File::exists(base_path() . '/' . $module . '/Database/seeds/' . $class . '.php')) {
7873
$this->call('db:seed', [
7974
'--class' => $module . '\\Database\\seeds\\' . $class
8075
]);
8176
}
82-
}
83-
else {
77+
} else {
8478

8579
$files = $this->getAllFileInFolder(base_path() . '/' . $module . '/Database/seeds');
8680
//print_r($files);
@@ -94,10 +88,9 @@ public function handle()
9488
//echo 'hai';
9589
}
9690
}
97-
9891
}
9992
}
100-
//echo 'success';
93+
//echo 'success';
10194
}
10295

10396
protected function getAllFileInFolder($folder)
@@ -108,7 +101,6 @@ protected function getAllFileInFolder($folder)
108101
foreach ($files as $file) {
109102
$path[] = $file->getfileName();
110103
}
111-
112104
}
113105
return $path;
114106
}

src/Controller/ModuleController.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
2-
namespace Ramesh\Cms\Controller;
32

3+
namespace Ramesh\Cms\Controller;
44

55
class ModuleController extends CmsController
66
{
@@ -26,28 +26,26 @@ public function getName()
2626
*/
2727
public function getJson()
2828
{
29-
3029
}
3130
/*
3231
* get module id
3332
*/
3433
public function getId()
3534
{
36-
3735
}
3836
/*
3937
* get module path
4038
*/
4139
public function getPath()
4240
{
43-
return base_path().DIRECTORY_SEPARATOR.parent::getPath().DIRECTORY_SEPARATOR.parent::getModulesLocalPath().parent::getCurrentTheme().DIRECTORY_SEPARATOR.$this->name;
41+
return base_path() . DIRECTORY_SEPARATOR . parent::getPath() . DIRECTORY_SEPARATOR . parent::getModulesLocalPath() . parent::getCurrentTheme() . DIRECTORY_SEPARATOR . $this->name;
4442
}
4543
/*
4644
* get module core path
4745
*/
4846
public function getCorePath()
4947
{
50-
return base_path().DIRECTORY_SEPARATOR.parent::getPath().DIRECTORY_SEPARATOR.parent::getModulesCorePath().DIRECTORY_SEPARATOR.$this->name;
48+
return base_path() . DIRECTORY_SEPARATOR . parent::getPath() . DIRECTORY_SEPARATOR . parent::getModulesCorePath() . DIRECTORY_SEPARATOR . $this->name;
5149
}
5250

5351
/**********get configuration values*****************/
@@ -61,7 +59,4 @@ public function getModuleConfig()
6159
{
6260
return parent::getConfig()['module'];
6361
}
64-
65-
66-
6762
}

src/Controller/ModulesController.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
2-
namespace Ramesh\Cms\Controller;
32

3+
namespace Ramesh\Cms\Controller;
44

55
class ModulesController extends CmsController
66
{
77

88

99
public function __construct()
1010
{
11-
1211
}
1312

1413
/*
@@ -18,8 +17,4 @@ public function getName()
1817
{
1918
return $this->name;
2019
}
21-
22-
23-
24-
2520
}

src/providers/ModuleServiceProvider.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44

55
use Illuminate\Support\ServiceProvider;
66
use Illuminate\Foundation\AliasLoader;
7-
8-
9-
use Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider;
10-
use Intervention\Image\ImageServiceProvider;
11-
127
use Cms;
138

149
class ModuleServiceProvider extends ServiceProvider
@@ -20,7 +15,6 @@ class ModuleServiceProvider extends ServiceProvider
2015
*/
2116
public function boot()
2217
{
23-
2418
}
2519

2620
/**
@@ -32,17 +26,14 @@ public function register()
3226
{
3327
$this->registerLibrary();
3428

35-
if(!config('cms') || config('cms')=='')
36-
{
29+
if (!config('cms') || config('cms') == '') {
3730
//first time
38-
}
39-
else{
31+
} else {
4032
$this->registerNamespace();
4133

4234
$this->registerComposerAutoload();
4335
$this->registerHelpers();
4436
}
45-
4637
}
4738
/*
4839
* register module providers
@@ -51,7 +42,7 @@ protected function registerProviders()
5142
{
5243
$res = Cms::allModuleProvider();
5344
//print_r($res);exit;
54-
45+
5546
foreach ($res as $key => $provider) {
5647
$this->app->register($provider);
5748
}
@@ -65,37 +56,33 @@ protected function registerComposerAutoload()
6556
$loader = require base_path() . '/vendor/autoload.php';
6657
$composers = Cms::allModulesComposer();
6758
foreach ($composers as $composer) {
68-
foreach($composer['autoload'] as $autoload) {
59+
foreach ($composer['autoload'] as $autoload) {
6960
foreach ($autoload as $key => $value)
70-
$loader->setPsr4($key,base_path().DIRECTORY_SEPARATOR.$value);
61+
$loader->setPsr4($key, base_path() . DIRECTORY_SEPARATOR . $value);
7162
}
7263
}
73-
74-
7564
}
7665
protected function registerNamespace()
7766
{
7867
$modules = Cms::allModules();
7968
$loader = require base_path() . '/vendor/autoload.php';
80-
foreach($modules as $module)
81-
{
82-
if($module['type']=='local')
83-
{
84-
$loader->setPsr4('cms\\'.$module['name'].'\\',$module['path']);
69+
foreach ($modules as $module) {
70+
if ($module['type'] == 'local') {
71+
$loader->setPsr4('cms\\' . $module['name'] . '\\', $module['path']);
8572
}
8673
}
8774

8875
$this->registerProviders();
89-
// exit;
76+
// exit;
9077
}
9178
/*
9279
* Register Helpers
9380
*/
9481
protected function registerHelpers()
9582
{
9683

97-
foreach(Cms::allModulesHelpers() as $aliaas => $value) {
98-
$this->app->booting(function () use($aliaas,$value) {
84+
foreach (Cms::allModulesHelpers() as $aliaas => $value) {
85+
$this->app->booting(function () use ($aliaas, $value) {
9986
$loader = AliasLoader::getInstance();
10087
$loader->alias($aliaas, $value);
10188
});
@@ -112,6 +99,5 @@ protected function registerLibrary()
11299

113100
$loader = AliasLoader::getInstance();
114101
$loader->alias('Image', \Intervention\Image\Facades\Image::class);
115-
116102
}
117103
}

src/stubs/cms/core/admin/Controllers/AdminAuth.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace cms\core\admin\Controllers;
44

5-
use User;
6-
use Hash;
7-
use Session;
5+
use cms\core\user\helpers\User;
86
use Carbon\Carbon;
97
use Illuminate\Http\Request;
108

@@ -32,24 +30,24 @@ public function dologin(Request $request)
3230
'password' => 'required',
3331
]);
3432

35-
$user = User::check(['username'=>$request->username,'password'=>$request->password]);
33+
$user = User::check(['username' => $request->username, 'password' => $request->password]);
3634

37-
if($user) {
38-
$users = UserModel::where('username','=',$request->username)->first();
39-
Session::put(['ACTIVE_USER' => strval($users->id)
40-
,'ACTIVE_USERNAME' => $users->username,
35+
if ($user) {
36+
$users = UserModel::where('username', '=', $request->username)->first();
37+
$request->session()->put([
38+
'ACTIVE_USER' => strval($users->id), 'ACTIVE_USERNAME' => $users->username,
4139
'ACTIVE_GROUP' => 'Super Admin',
4240
'ACTIVE_EMAIL' => $users->email,
4341
'ACTIVE_MOBILE' => $users->mobile,
44-
'ACTIVE_USERIMAGE' => $users->images]);
42+
'ACTIVE_USERIMAGE' => $users->images
43+
]);
4544
//change offline to online
4645
$users->online = 1;
4746
$users->ip = request()->ip();
4847
$users->lastactive = Carbon::now();
4948
$users->save();
5049
return redirect()->route('backenddashboard');
51-
}
52-
else
50+
} else
5351
return redirect()->back()
5452
->withInput($request->input())
5553
->withErrors(['Wrong Information']);
@@ -78,8 +76,7 @@ public function logout(Request $request)
7876

7977
$request->session()->flush();
8078

81-
Session::flash("success","Logout Successfull");
79+
$request->session()->flash("success", "Logout Successfull");
8280
return redirect('administrator/login');
8381
}
84-
8582
}

src/stubs/cms/core/admin/Middleware/AdminAuth.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
namespace cms\core\admin\Middleware;
44

55
use Closure;
6-
use Session;
7-
use User;
8-
use CGate;
6+
use cms\core\gate\helpers\CGate;
7+
98
class AdminAuth
109
{
1110
/**
@@ -17,18 +16,15 @@ class AdminAuth
1716
*/
1817
public function handle($request, Closure $next)
1918
{
20-
if(!ctype_digit(Session::get('ACTIVE_USER')) || !filter_var(Session::get('ACTIVE_EMAIL'), FILTER_VALIDATE_EMAIL)){
19+
if (!ctype_digit($request->session()->get('ACTIVE_USER')) || !filter_var($request->session()->get('ACTIVE_EMAIL'), FILTER_VALIDATE_EMAIL)) {
2120
return redirect('administrator/login');
22-
2321
}
24-
if(CGate::allows('Backend Access')!=true)
25-
{
22+
if (CGate::allows('Backend Access') != true) {
2623
$request->session()->flush();
27-
Session::flash("error","Access Denied");
24+
$request->session()->flash("error", "Access Denied");
2825
return redirect('administrator/login');
2926
}
3027

3128
return $next($request);
3229
}
33-
3430
}

0 commit comments

Comments
 (0)