Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
9e1b498f
Commit
9e1b498f
authored
Oct 18, 2013
by
resurtm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHP 5.4 supports $this with closures.
parent
89394db0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
21 deletions
+15
-21
Mutex.php
extensions/mutex/yii/mutex/Mutex.php
+2
-3
ErrorHandler.php
framework/yii/base/ErrorHandler.php
+3
-4
Connection.php
framework/yii/db/Connection.php
+3
-4
Module.php
framework/yii/debug/Module.php
+2
-3
ActionColumn.php
framework/yii/grid/ActionColumn.php
+3
-4
BaseListView.php
framework/yii/widgets/BaseListView.php
+2
-3
No files found.
extensions/mutex/yii/mutex/Mutex.php
View file @
9e1b498f
...
...
@@ -34,11 +34,10 @@ abstract class Mutex extends Component
public
function
init
()
{
if
(
$this
->
autoRelease
)
{
$mutex
=
$this
;
$locks
=
&
$this
->
_locks
;
register_shutdown_function
(
function
()
use
(
$
mutex
,
&
$locks
)
{
register_shutdown_function
(
function
()
use
(
$
this
,
&
$locks
)
{
foreach
(
$locks
as
$lock
)
{
$
mutex
->
release
(
$lock
);
$
this
->
release
(
$lock
);
}
});
}
...
...
framework/yii/base/ErrorHandler.php
View file @
9e1b498f
...
...
@@ -175,10 +175,9 @@ class ErrorHandler extends Component
$html
=
rtrim
(
$html
,
'\\'
);
}
elseif
(
strpos
(
$code
,
'()'
)
!==
false
)
{
// method/function call
$self
=
$this
;
$html
=
preg_replace_callback
(
'/^(.*)\(\)$/'
,
function
(
$matches
)
use
(
$self
)
{
return
'<a href="http://yiiframework.com/doc/api/2.0/'
.
$self
->
htmlEncode
(
$matches
[
1
])
.
'" target="_blank">'
.
$self
->
htmlEncode
(
$matches
[
1
])
.
'</a>()'
;
$html
=
preg_replace_callback
(
'/^(.*)\(\)$/'
,
function
(
$matches
)
use
(
$this
)
{
return
'<a href="http://yiiframework.com/doc/api/2.0/'
.
$this
->
htmlEncode
(
$matches
[
1
])
.
'" target="_blank">'
.
$this
->
htmlEncode
(
$matches
[
1
])
.
'</a>()'
;
},
$code
);
}
return
$html
;
...
...
framework/yii/db/Connection.php
View file @
9e1b498f
...
...
@@ -508,13 +508,12 @@ class Connection extends Component
*/
public
function
quoteSql
(
$sql
)
{
$db
=
$this
;
return
preg_replace_callback
(
'/(\\{\\{(%?[\w\-\. ]+%?)\\}\\}|\\[\\[([\w\-\. ]+)\\]\\])/'
,
function
(
$matches
)
use
(
$
db
)
{
function
(
$matches
)
use
(
$
this
)
{
if
(
isset
(
$matches
[
3
]))
{
return
$
db
->
quoteColumnName
(
$matches
[
3
]);
return
$
this
->
quoteColumnName
(
$matches
[
3
]);
}
else
{
return
str_replace
(
'%'
,
$
db
->
tablePrefix
,
$db
->
quoteTableName
(
$matches
[
2
]));
return
str_replace
(
'%'
,
$
this
->
tablePrefix
,
$this
->
quoteTableName
(
$matches
[
2
]));
}
},
$sql
);
}
...
...
framework/yii/debug/Module.php
View file @
9e1b498f
...
...
@@ -57,9 +57,8 @@ class Module extends \yii\base\Module
$this
->
dataPath
=
Yii
::
getAlias
(
$this
->
dataPath
);
$this
->
logTarget
=
Yii
::
$app
->
getLog
()
->
targets
[
'debug'
]
=
new
LogTarget
(
$this
);
// do not initialize view component before application is ready (needed when debug in preload)
$module
=
$this
;
Yii
::
$app
->
on
(
Application
::
EVENT_BEFORE_ACTION
,
function
()
use
(
$module
)
{
Yii
::
$app
->
getView
()
->
on
(
View
::
EVENT_END_BODY
,
array
(
$module
,
'renderToolbar'
));
Yii
::
$app
->
on
(
Application
::
EVENT_BEFORE_ACTION
,
function
()
use
(
$this
)
{
Yii
::
$app
->
getView
()
->
on
(
View
::
EVENT_END_BODY
,
array
(
$this
,
'renderToolbar'
));
});
foreach
(
array_merge
(
$this
->
corePanels
(),
$this
->
panels
)
as
$id
=>
$config
)
{
...
...
framework/yii/grid/ActionColumn.php
View file @
9e1b498f
...
...
@@ -88,11 +88,10 @@ class ActionColumn extends Column
*/
protected
function
renderDataCellContent
(
$model
,
$index
)
{
$column
=
$this
;
return
preg_replace_callback
(
'/\\{(\w+)\\}/'
,
function
(
$matches
)
use
(
$model
,
$column
)
{
return
preg_replace_callback
(
'/\\{(\w+)\\}/'
,
function
(
$matches
)
use
(
$this
,
$model
)
{
$name
=
$matches
[
1
];
if
(
isset
(
$
column
->
buttons
[
$name
]))
{
return
call_user_func
(
$
column
->
buttons
[
$name
],
$model
,
$column
);
if
(
isset
(
$
this
->
buttons
[
$name
]))
{
return
call_user_func
(
$
this
->
buttons
[
$name
],
$model
,
$this
);
}
else
{
return
''
;
}
...
...
framework/yii/widgets/BaseListView.php
View file @
9e1b498f
...
...
@@ -92,9 +92,8 @@ abstract class BaseListView extends Widget
public
function
run
()
{
if
(
$this
->
dataProvider
->
getCount
()
>
0
||
$this
->
empty
===
false
)
{
$widget
=
$this
;
$content
=
preg_replace_callback
(
"/
{
\\w+
}
/"
,
function
(
$matches
)
use
(
$widget
)
{
$content
=
$widget
->
renderSection
(
$matches
[
0
]);
$content
=
preg_replace_callback
(
"/
{
\\w+
}
/"
,
function
(
$matches
)
use
(
$this
)
{
$content
=
$this
->
renderSection
(
$matches
[
0
]);
return
$content
===
false
?
$matches
[
0
]
:
$content
;
},
$this
->
layout
);
}
else
{
...
...
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