Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
70b6cc59
Commit
70b6cc59
authored
Sep 06, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring.
parent
7eef380d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
45 deletions
+56
-45
application/composers.php
+1
-1
laravel/arr.php
+3
-7
laravel/asset.php
+36
-10
laravel/config.php
+1
-11
laravel/config/container.php
+6
-0
laravel/database/connection.php
+1
-1
laravel/database/query/postgres.php
+0
-5
laravel/facades.php
+1
-0
laravel/lang.php
+1
-4
laravel/routing/route.php
+5
-5
laravel/view.php
+1
-1
No files found.
application/composers.php
View file @
70b6cc59
...
@@ -39,7 +39,7 @@ return array(
...
@@ -39,7 +39,7 @@ return array(
|
|
*/
*/
'
global
'
=>
function
(
$view
,
$laravel
)
'
shared
'
=>
function
(
$view
,
$laravel
)
{
{
//
//
},
},
...
...
laravel/arr.php
View file @
70b6cc59
...
@@ -7,7 +7,7 @@ class Arr {
...
@@ -7,7 +7,7 @@ class Arr {
*
*
* If the specified key is null, the entire array will be returned. The array may
* If the specified key is null, the entire array will be returned. The array may
* also be accessed using JavaScript "dot" style notation. Retrieving items nested
* also be accessed using JavaScript "dot" style notation. Retrieving items nested
* in multiple arrays is
also
supported.
* in multiple arrays is supported.
*
*
* @param array $array
* @param array $array
* @param string $key
* @param string $key
...
@@ -35,12 +35,8 @@ class Arr {
...
@@ -35,12 +35,8 @@ class Arr {
* Set an array item to a given value.
* Set an array item to a given value.
*
*
* This method is primarly helpful for setting the value in an array with
* This method is primarly helpful for setting the value in an array with
* a variable depth, such as configuration arrays.
* a variable depth, such as configuration arrays. Like the Arr::get
*
* method, JavaScript "dot" syntax is supported.
* If the specified item doesn't exist, it will be created. If the item's
* parents do no exist, they will also be created as arrays.
*
* Like the Arr::get method, JavaScript "dot" syntax is supported.
*
*
* @param array $array
* @param array $array
* @param string $key
* @param string $key
...
...
laravel/asset.php
View file @
70b6cc59
...
@@ -9,7 +9,25 @@ class Asset {
...
@@ -9,7 +9,25 @@ class Asset {
*
*
* @var array
* @var array
*/
*/
public
static
$containers
=
array
();
public
$containers
=
array
();
/**
* The HTML writer instance.
*
* @var HTML
*/
protected
$html
;
/**
* Create a new asset manager instance.
*
* @param HTML $html
* @return void
*/
public
function
__construct
(
HTML
$html
)
{
$this
->
html
=
$html
;
}
/**
/**
* Get an asset container instance.
* Get an asset container instance.
...
@@ -21,14 +39,14 @@ class Asset {
...
@@ -21,14 +39,14 @@ class Asset {
* @param string $container
* @param string $container
* @return Asset_Container
* @return Asset_Container
*/
*/
public
static
function
container
(
$container
=
'default'
)
public
function
container
(
$container
=
'default'
)
{
{
if
(
!
isset
(
static
::
$
containers
[
$container
]))
if
(
!
isset
(
$this
->
containers
[
$container
]))
{
{
static
::
$containers
[
$container
]
=
new
Asset_Container
(
$container
);
$this
->
containers
[
$container
]
=
new
Asset_Container
(
$container
,
$this
->
html
);
}
}
return
static
::
$
containers
[
$container
];
return
$this
->
containers
[
$container
];
}
}
/**
/**
...
@@ -37,9 +55,9 @@ class Asset {
...
@@ -37,9 +55,9 @@ class Asset {
* This provides a convenient API, allowing the develop to skip the "container"
* This provides a convenient API, allowing the develop to skip the "container"
* method when using the default container.
* method when using the default container.
*/
*/
public
static
function
__callStatic
(
$method
,
$parameters
)
public
function
__call
(
$method
,
$parameters
)
{
{
return
call_user_func_array
(
array
(
static
::
container
(),
$method
),
$parameters
);
return
call_user_func_array
(
array
(
$this
->
container
(),
$method
),
$parameters
);
}
}
}
}
...
@@ -63,15 +81,23 @@ class Asset_Container {
...
@@ -63,15 +81,23 @@ class Asset_Container {
public
$assets
=
array
();
public
$assets
=
array
();
/**
/**
* The HTML writer instance.
*
* @var HTML
*/
protected
$html
;
/**
* Create a new asset container instance.
* Create a new asset container instance.
*
*
* @param string $name
* @param string $name
* @param
File $file
* @param
HTML $html
* @return void
* @return void
*/
*/
public
function
__construct
(
$name
)
public
function
__construct
(
$name
,
HTML
$html
)
{
{
$this
->
name
=
$name
;
$this
->
name
=
$name
;
$this
->
html
=
$html
;
}
}
/**
/**
...
@@ -225,7 +251,7 @@ class Asset_Container {
...
@@ -225,7 +251,7 @@ class Asset_Container {
$asset
=
$this
->
assets
[
$group
][
$name
];
$asset
=
$this
->
assets
[
$group
][
$name
];
return
HTML
::
$group
(
$asset
[
'source'
],
$asset
[
'attributes'
]);
return
$this
->
html
->
$group
(
$asset
[
'source'
],
$asset
[
'attributes'
]);
}
}
/**
/**
...
...
laravel/config.php
View file @
70b6cc59
...
@@ -43,10 +43,6 @@ class Config {
...
@@ -43,10 +43,6 @@ class Config {
/**
/**
* Get a configuration item.
* Get a configuration item.
*
*
* Configuration items are retrieved using "dot" notation. So, asking for the
* "application.timezone" configuration item would return the "timezone" option
* from the "application" configuration file.
*
* If the name of a configuration file is passed without specifying an item, the
* If the name of a configuration file is passed without specifying an item, the
* entire configuration array will be returned.
* entire configuration array will be returned.
*
*
...
@@ -71,9 +67,6 @@ class Config {
...
@@ -71,9 +67,6 @@ class Config {
/**
/**
* Set a configuration item.
* Set a configuration item.
*
*
* Like the get method, "dot" notation is used to set items, and setting items
* at any depth in the configuration array is supported.
*
* If a specific configuration item is not specified, the entire configuration
* If a specific configuration item is not specified, the entire configuration
* array will be replaced with the given value.
* array will be replaced with the given value.
*
*
...
@@ -124,10 +117,7 @@ class Config {
...
@@ -124,10 +117,7 @@ class Config {
$config
=
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
?
array_merge
(
$config
,
require
$path
)
:
$config
;
$config
=
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
?
array_merge
(
$config
,
require
$path
)
:
$config
;
}
}
if
(
count
(
$config
)
>
0
)
if
(
count
(
$config
)
>
0
)
$this
->
items
[
$file
]
=
$config
;
{
$this
->
items
[
$file
]
=
$config
;
}
return
isset
(
$this
->
items
[
$file
]);
return
isset
(
$this
->
items
[
$file
]);
}
}
...
...
laravel/config/container.php
View file @
70b6cc59
...
@@ -8,6 +8,12 @@ return array(
...
@@ -8,6 +8,12 @@ return array(
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
*/
*/
'laravel.asset'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
(
$container
)
{
return
new
Asset
(
$container
->
resolve
(
'laravel.html'
));
}),
'laravel.auth'
=>
array
(
'resolver'
=>
function
(
$container
)
'laravel.auth'
=>
array
(
'resolver'
=>
function
(
$container
)
{
{
return
new
Security\Authenticator
(
$container
->
resolve
(
'laravel.session'
),
$container
->
resolve
(
'laravel.hasher'
));
return
new
Security\Authenticator
(
$container
->
resolve
(
'laravel.session'
),
$container
->
resolve
(
'laravel.hasher'
));
...
...
laravel/database/connection.php
View file @
70b6cc59
...
@@ -87,7 +87,7 @@ class Connection {
...
@@ -87,7 +87,7 @@ class Connection {
{
{
$result
=
(
array
)
$this
->
first
(
$sql
,
$bindings
);
$result
=
(
array
)
$this
->
first
(
$sql
,
$bindings
);
return
(
strpos
(
strtolower
(
$sql
),
'select count'
)
===
0
)
?
(
int
)
reset
(
$result
)
:
(
float
)
reset
(
$result
);
return
(
strpos
(
strtolower
(
trim
(
$sql
)
),
'select count'
)
===
0
)
?
(
int
)
reset
(
$result
)
:
(
float
)
reset
(
$result
);
}
}
/**
/**
...
...
laravel/database/query/postgres.php
View file @
70b6cc59
...
@@ -7,11 +7,6 @@ class Postgres extends Query {
...
@@ -7,11 +7,6 @@ class Postgres extends Query {
/**
/**
* Insert an array of values into the database table and return the value of the ID column.
* Insert an array of values into the database table and return the value of the ID column.
*
*
* <code>
* // Insert into the "users" table and get the auto-incrementing ID
* $id = DB::table('users')->insert_get_id(array('email' => 'example@gmail.com'));
* </code>
*
* @param array $values
* @param array $values
* @return int
* @return int
*/
*/
...
...
laravel/facades.php
View file @
70b6cc59
...
@@ -20,6 +20,7 @@ abstract class Facade {
...
@@ -20,6 +20,7 @@ abstract class Facade {
}
}
class
Asset
extends
Facade
{
public
static
$resolve
=
'asset'
;
}
class
Auth
extends
Facade
{
public
static
$resolve
=
'auth'
;
}
class
Auth
extends
Facade
{
public
static
$resolve
=
'auth'
;
}
class
Cache
extends
Facade
{
public
static
$resolve
=
'cache'
;
}
class
Cache
extends
Facade
{
public
static
$resolve
=
'cache'
;
}
class
Config
extends
Facade
{
public
static
$resolve
=
'config'
;
}
class
Config
extends
Facade
{
public
static
$resolve
=
'config'
;
}
...
...
laravel/lang.php
View file @
70b6cc59
...
@@ -183,10 +183,7 @@ class Lang {
...
@@ -183,10 +183,7 @@ class Lang {
}
}
}
}
if
(
count
(
$language
)
>
0
)
if
(
count
(
$language
)
>
0
)
static
::
$lines
[
$this
->
language
.
$file
]
=
$language
;
{
static
::
$lines
[
$this
->
language
.
$file
]
=
$language
;
}
return
isset
(
static
::
$lines
[
$this
->
language
.
$file
]);
return
isset
(
static
::
$lines
[
$this
->
language
.
$file
]);
}
}
...
...
laravel/routing/route.php
View file @
70b6cc59
...
@@ -46,7 +46,7 @@ class Route {
...
@@ -46,7 +46,7 @@ class Route {
$this
->
key
=
$key
;
$this
->
key
=
$key
;
$this
->
callback
=
$callback
;
$this
->
callback
=
$callback
;
$this
->
parameters
=
$parameters
;
$this
->
parameters
=
$parameters
;
$this
->
uris
=
$this
->
parse
(
$key
);
$this
->
uris
=
$this
->
parse
_uris
(
$key
);
}
}
/**
/**
...
@@ -120,13 +120,13 @@ class Route {
...
@@ -120,13 +120,13 @@ class Route {
* @param string $key
* @param string $key
* @return array
* @return array
*/
*/
protected
function
parse
(
$key
)
protected
function
parse
_uris
(
$key
)
{
{
if
(
strpos
(
$key
,
', '
)
===
false
)
return
array
(
$this
->
extract
(
$key
));
if
(
strpos
(
$key
,
', '
)
===
false
)
return
array
(
$this
->
extract
_uri
(
$key
));
foreach
(
explode
(
', '
,
$key
)
as
$segment
)
foreach
(
explode
(
', '
,
$key
)
as
$segment
)
{
{
$uris
[]
=
$this
->
extract
(
$segment
);
$uris
[]
=
$this
->
extract
_uri
(
$segment
);
}
}
return
$uris
;
return
$uris
;
...
@@ -142,7 +142,7 @@ class Route {
...
@@ -142,7 +142,7 @@ class Route {
* @param string $segment
* @param string $segment
* @return string
* @return string
*/
*/
protected
function
extract
(
$segment
)
protected
function
extract
_uri
(
$segment
)
{
{
$segment
=
substr
(
$segment
,
strpos
(
$segment
,
' '
)
+
1
);
$segment
=
substr
(
$segment
,
strpos
(
$segment
,
' '
)
+
1
);
...
...
laravel/view.php
View file @
70b6cc59
...
@@ -144,7 +144,7 @@ class View_Composer {
...
@@ -144,7 +144,7 @@ class View_Composer {
*/
*/
public
function
compose
(
View
$view
)
public
function
compose
(
View
$view
)
{
{
if
(
isset
(
$this
->
composers
[
'
global'
]))
call_user_func
(
$this
->
composers
[
'global
'
],
$view
,
$this
->
container
);
if
(
isset
(
$this
->
composers
[
'
shared'
]))
call_user_func
(
$this
->
composers
[
'shared
'
],
$view
,
$this
->
container
);
if
(
isset
(
$this
->
composers
[
$view
->
view
]))
if
(
isset
(
$this
->
composers
[
$view
->
view
]))
{
{
...
...
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