Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
9e9ee931
Commit
9e9ee931
authored
Nov 10, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved session class.
parent
75ba2447
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
71 deletions
+61
-71
home.php
application/controllers/home.php
+1
-1
autoloader.php
laravel/autoloader.php
+18
-9
manager.php
laravel/database/manager.php
+1
-1
form.php
laravel/form.php
+14
-3
laravel.php
laravel/laravel.php
+1
-1
controller.php
laravel/routing/controller.php
+8
-34
manager.php
laravel/session/manager.php
+9
-3
url.php
laravel/url.php
+6
-18
index.php
public/index.php
+3
-1
No files found.
application/controllers/home.php
View file @
9e9ee931
<?php
class
Home_Controller
extends
Controller
{
class
Home_Controller
{
/*
|--------------------------------------------------------------------------
...
...
laravel/autoloader.php
View file @
9e9ee931
...
...
@@ -53,16 +53,11 @@ class Autoloader {
protected
static
function
find
(
$class
)
{
// After PHP namespaces were introduced, most libaries ditched underscores for
// for namespaces to indicate the class directory hierarchy. We will chec for
// for namespaces to indicate the class directory hierarchy. We will chec
k
for
// the present of namespace slashes to determine the directory separator.
if
(
strpos
(
$class
,
'\\'
)
!==
false
)
{
$library
=
substr
(
$class
,
0
,
strpos
(
$class
,
'\\'
));
}
else
{
$library
=
substr
(
$class
,
0
,
strpos
(
$class
,
'_'
));
}
$separator
=
(
strpos
(
$class
,
'\\'
)
!==
false
)
?
'\\'
:
'_'
;
$library
=
substr
(
$class
,
0
,
strpos
(
$class
,
$separator
));
$file
=
str_replace
(
'\\'
,
'/'
,
$class
);
...
...
@@ -95,6 +90,20 @@ class Autoloader {
return
$path
;
}
// Since not all controllers will be resolved by the controller resolver,
// we will do a quick check in the controller directory for the class.
// For instance, since base controllers would not be resolved by the
// controller class, we will need to resolve them here.
if
(
strpos
(
$class
,
'_Controller'
)
!==
false
)
{
$controller
=
str_replace
(
array
(
'_Controller'
,
'_'
),
array
(
''
,
'/'
),
$class
);
if
(
file_exists
(
$path
=
strtolower
(
CONTROLLER_PATH
.
$controller
.
EXT
)))
{
return
$path
;
}
}
}
}
\ No newline at end of file
laravel/database/manager.php
View file @
9e9ee931
...
...
@@ -65,7 +65,7 @@ class Manager {
return
call_user_func
(
$config
[
'connector'
],
$config
);
}
return
IoC
::
co
ntainer
()
->
co
re
(
"database.connectors.
{
$config
[
'driver'
]
}
"
)
->
connect
(
$config
);
return
IoC
::
core
(
"database.connectors.
{
$config
[
'driver'
]
}
"
)
->
connect
(
$config
);
}
/**
...
...
laravel/form.php
View file @
9e9ee931
...
...
@@ -52,7 +52,12 @@ class Form {
$attributes
[
'accept-charset'
]
=
Config
::
get
(
'application.encoding'
);
}
$append
=
(
$method
==
'PUT'
or
$method
==
'DELETE'
)
?
static
::
hidden
(
Request
::
spoofer
,
$method
)
:
''
;
$append
=
''
;
if
(
$method
==
'PUT'
or
$method
==
'DELETE'
)
{
$append
=
static
::
hidden
(
Request
::
spoofer
,
$method
);
}
return
'<form'
.
HTML
::
attributes
(
$attributes
)
.
'>'
.
$append
.
PHP_EOL
;
}
...
...
@@ -166,7 +171,11 @@ class Form {
{
static
::
$labels
[]
=
$name
;
return
'<label for="'
.
$name
.
'"'
.
HTML
::
attributes
(
$attributes
)
.
'>'
.
HTML
::
entities
(
$value
)
.
'</label>'
.
PHP_EOL
;
$attributes
=
HTML
::
attributes
(
$attributes
);
$value
=
HTML
::
entities
(
$value
);
return
'<label for="'
.
$name
.
'"'
.
$attributes
.
'>'
.
$value
.
'</label>'
.
PHP_EOL
;
}
/**
...
...
@@ -324,7 +333,9 @@ class Form {
*/
public
static
function
textarea
(
$name
,
$value
=
''
,
$attributes
=
array
())
{
$attributes
=
array_merge
(
$attributes
,
array
(
'id'
=>
static
::
id
(
$name
,
$attributes
),
'name'
=>
$name
));
$attributes
[
'name'
]
=
$name
;
$attributes
[
'id'
]
=
static
::
id
(
$name
,
$attributes
);
if
(
!
isset
(
$attributes
[
'rows'
]))
$attributes
[
'rows'
]
=
10
;
...
...
laravel/laravel.php
View file @
9e9ee931
...
...
@@ -30,7 +30,7 @@ if (Config::$items['session']['driver'] !== '')
$id
=
Cookie
::
get
(
Config
::
$items
[
'session'
][
'cookie'
]);
IoC
::
container
()
->
instance
(
'laravel.session'
,
new
Session
(
$driver
,
$id
));
IoC
::
container
()
->
instance
(
'laravel.session'
,
new
Session
\Manager
(
$driver
,
$id
));
}
/**
...
...
laravel/routing/controller.php
View file @
9e9ee931
...
...
@@ -130,9 +130,9 @@ abstract class Controller {
// If the controller has specified a layout view. The response
// returned by the controller method will be bound to that view
// and the layout will be considered the response.
if
(
!
is_null
(
$this
->
layout
)
and
$this
->
viewable
(
$response
))
if
(
is_null
(
$response
)
and
!
is_null
(
$this
->
layout
))
{
$response
=
$this
->
layout
->
with
(
'content'
,
$response
)
;
$response
=
$this
->
layout
;
}
}
...
...
@@ -149,34 +149,6 @@ abstract class Controller {
return
$response
;
}
/**
* Deteremine if a given response is considered "viewable".
*
* This is primarily used to determine which types of responses should be
* bound to the controller's layout and which should not. We do not want
* to bind redirects and file downloads to the layout, as this obviously
* would not make any sense.
*
* @param mixed $response
* @return bool
*/
protected
function
viewable
(
$response
)
{
if
(
$response
instanceof
Response
)
{
if
(
$response
instanceof
Redirect
)
{
return
false
;
}
elseif
(
$response
->
headers
[
'Content-Description'
]
==
'File Transfer'
)
{
return
false
;
}
}
return
true
;
}
/**
* Register filters on the controller's methods.
*
...
...
@@ -195,9 +167,9 @@ abstract class Controller {
*/
protected
function
filter
(
$name
,
$filters
)
{
$this
->
filters
[]
=
new
Filter_Collection
(
$name
,
$filters
);
$this
->
filters
[
$name
][
]
=
new
Filter_Collection
(
$name
,
$filters
);
return
$this
->
filters
[
count
(
$this
->
filters
)
-
1
];
return
$this
->
filters
[
$name
][
count
(
$this
->
filters
)
-
1
];
}
/**
...
...
@@ -209,11 +181,13 @@ abstract class Controller {
*/
protected
function
filters
(
$name
,
$method
)
{
if
(
!
isset
(
$this
->
filters
[
$name
]))
return
array
();
$filters
=
array
();
foreach
(
$this
->
filters
as
$filter
)
foreach
(
$this
->
filters
[
$name
]
as
$filter
)
{
if
(
$filter
->
name
===
$name
and
$filter
->
applies
(
$method
))
if
(
$filter
->
applies
(
$method
))
{
$filters
=
array_merge
(
$filters
,
$filter
->
filters
);
}
...
...
laravel/session.php
→
laravel/session
/manager
.php
View file @
9e9ee931
<?php
namespace
Laravel
;
<?php
namespace
Laravel
\Session
;
use
Closure
;
use
Laravel\Str
;
use
Laravel\Config
;
use
Laravel\Cookie
;
use
Laravel\Session\Drivers\Driver
;
use
Laravel\Session\Drivers\Sweeper
;
...
...
@@ -9,7 +12,7 @@ if (Config::$items['application']['key'] === '')
throw
new
\Exception
(
"An application key is required to use sessions."
);
}
class
Session
{
class
Manager
{
/**
* The session array that is stored by the driver.
...
...
@@ -266,7 +269,10 @@ class Session {
{
foreach
(
$this
->
session
[
'data'
]
as
$key
=>
$value
)
{
if
(
strpos
(
$key
,
':old:'
)
===
0
)
$this
->
forget
(
$key
);
if
(
strpos
(
$key
,
':old:'
)
===
0
)
{
$this
->
forget
(
$key
);
}
}
// Now that all of the "old" keys have been removed from the session data,
...
...
laravel/url.php
View file @
9e9ee931
...
...
@@ -10,6 +10,9 @@ class URL {
* <code>
* // Create a URL to a location within the application
* $url = URL::to('user/profile');
*
* // Create a HTTPS URL to a location within the application
* $url = URL::to('user/profile', true);
* </code>
*
* @param string $url
...
...
@@ -20,29 +23,14 @@ class URL {
{
if
(
filter_var
(
$url
,
FILTER_VALIDATE_URL
)
!==
false
)
return
$url
;
return
rtrim
(
static
::
root
(
$https
),
'/'
)
.
'/'
.
ltrim
(
$url
,
'/'
);
}
/**
* Get the URL to the root of the application.
*
* @param bool $https
* @return string
*/
protected
static
function
root
(
$https
=
false
)
{
$base
=
Config
::
$items
[
'application'
][
'url'
]
.
'/'
.
Config
::
$items
[
'application'
][
'index'
];
$root
=
Config
::
$items
[
'application'
][
'url'
]
.
'/'
.
Config
::
$items
[
'application'
][
'index'
];
// It is possible for the developer to totally disable the generation of links
// that use HTTPS. This is primarily to create a convenient test environment
// when using SSL is not an option. We will only replace the first occurence
// of "http" with "https" since URLs are sometimes passed in query strings.
if
(
$https
and
Config
::
$items
[
'application'
][
'ssl'
])
{
$
base
=
preg_replace
(
'~http://~'
,
'https://'
,
$base
,
1
);
$
root
=
preg_replace
(
'~http://~'
,
'https://'
,
$root
,
1
);
}
return
$base
;
return
rtrim
(
$root
,
'/'
)
.
'/'
.
ltrim
(
$url
,
'/'
)
;
}
/**
...
...
public/index.php
View file @
9e9ee931
...
...
@@ -28,4 +28,6 @@ $public = __DIR__;
// --------------------------------------------------------------
// Launch Laravel.
// --------------------------------------------------------------
require
$laravel
.
'/laravel.php'
;
\ No newline at end of file
require
$laravel
.
'/laravel.php'
;
echo
number_format
((
microtime
(
true
)
-
LARAVEL_START
)
*
1000
,
2
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment