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
1982efbd
Commit
1982efbd
authored
Mar 05, 2014
by
AlexGx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
many phpcs fixes
parent
a94b2778
Hide whitespace changes
Inline
Side-by-side
Showing
117 changed files
with
282 additions
and
299 deletions
+282
-299
apidoc
extensions/apidoc/apidoc
+2
-2
RenderController.php
extensions/apidoc/commands/RenderController.php
+4
-4
ApiMarkdown.php
extensions/apidoc/helpers/ApiMarkdown.php
+1
-1
PrettyPrinter.php
extensions/apidoc/helpers/PrettyPrinter.php
+1
-2
BaseDoc.php
extensions/apidoc/models/BaseDoc.php
+5
-4
ClassDoc.php
extensions/apidoc/models/ClassDoc.php
+7
-8
ConstDoc.php
extensions/apidoc/models/ConstDoc.php
+1
-2
Context.php
extensions/apidoc/models/Context.php
+18
-19
EventDoc.php
extensions/apidoc/models/EventDoc.php
+2
-3
FunctionDoc.php
extensions/apidoc/models/FunctionDoc.php
+3
-3
InterfaceDoc.php
extensions/apidoc/models/InterfaceDoc.php
+3
-4
ParamDoc.php
extensions/apidoc/models/ParamDoc.php
+1
-2
PropertyDoc.php
extensions/apidoc/models/PropertyDoc.php
+2
-3
TraitDoc.php
extensions/apidoc/models/TraitDoc.php
+2
-3
TypeDoc.php
extensions/apidoc/models/TypeDoc.php
+8
-9
BaseRenderer.php
extensions/apidoc/templates/BaseRenderer.php
+1
-2
Renderer.php
extensions/apidoc/templates/bootstrap/Renderer.php
+9
-9
SideNavWidget.php
extensions/apidoc/templates/bootstrap/SideNavWidget.php
+1
-1
AssetBundle.php
extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
+1
-0
api.php
extensions/apidoc/templates/bootstrap/layouts/api.php
+1
-1
guide.php
extensions/apidoc/templates/bootstrap/layouts/guide.php
+1
-1
main.php
extensions/apidoc/templates/bootstrap/layouts/main.php
+1
-1
index.php
extensions/apidoc/templates/bootstrap/views/index.php
+2
-1
Renderer.php
extensions/apidoc/templates/html/Renderer.php
+10
-10
seeAlso.php
extensions/apidoc/templates/html/views/seeAlso.php
+1
-1
type.php
extensions/apidoc/templates/html/views/type.php
+3
-2
Renderer.php
extensions/apidoc/templates/offline/Renderer.php
+2
-2
AssetBundle.php
extensions/apidoc/templates/offline/assets/AssetBundle.php
+1
-0
index.php
extensions/apidoc/templates/offline/views/index.php
+2
-1
Renderer.php
extensions/apidoc/templates/online/Renderer.php
+4
-4
index.php
extensions/apidoc/templates/online/views/index.php
+2
-1
AuthAction.php
extensions/authclient/AuthAction.php
+1
-2
BaseClient.php
extensions/authclient/BaseClient.php
+1
-2
ClientInterface.php
extensions/authclient/ClientInterface.php
+1
-2
Collection.php
extensions/authclient/Collection.php
+1
-2
OAuth1.php
extensions/authclient/OAuth1.php
+2
-3
OAuth2.php
extensions/authclient/OAuth2.php
+1
-2
OAuthToken.php
extensions/authclient/OAuthToken.php
+31
-17
OpenId.php
extensions/authclient/OpenId.php
+3
-4
Facebook.php
extensions/authclient/clients/Facebook.php
+1
-2
GitHub.php
extensions/authclient/clients/GitHub.php
+1
-2
GoogleOAuth.php
extensions/authclient/clients/GoogleOAuth.php
+1
-2
GoogleOpenId.php
extensions/authclient/clients/GoogleOpenId.php
+1
-2
LinkedIn.php
extensions/authclient/clients/LinkedIn.php
+3
-3
Twitter.php
extensions/authclient/clients/Twitter.php
+1
-2
YandexOAuth.php
extensions/authclient/clients/YandexOAuth.php
+1
-2
YandexOpenId.php
extensions/authclient/clients/YandexOpenId.php
+1
-2
BaseMethod.php
extensions/authclient/signature/BaseMethod.php
+1
-2
HmacSha1.php
extensions/authclient/signature/HmacSha1.php
+1
-2
PlainText.php
extensions/authclient/signature/PlainText.php
+1
-2
RsaSha1.php
extensions/authclient/signature/RsaSha1.php
+1
-2
ChoiceAsset.php
extensions/authclient/widgets/ChoiceAsset.php
+1
-2
Installer.php
extensions/composer/Installer.php
+2
-2
LogTarget.php
extensions/debug/LogTarget.php
+0
-1
Base.php
extensions/debug/components/search/matchers/Base.php
+0
-1
DbPanel.php
extensions/debug/panels/DbPanel.php
+0
-1
MailPanel.php
extensions/debug/panels/MailPanel.php
+0
-1
detail.php
extensions/debug/views/default/panels/config/detail.php
+0
-2
detail.php
extensions/debug/views/default/panels/db/detail.php
+0
-1
detail.php
extensions/debug/views/default/panels/log/detail.php
+0
-1
detail.php
extensions/debug/views/default/panels/profile/detail.php
+1
-1
ActiveQuery.php
extensions/elasticsearch/ActiveQuery.php
+4
-4
ActiveRecord.php
extensions/elasticsearch/ActiveRecord.php
+9
-9
Command.php
extensions/elasticsearch/Command.php
+1
-2
Connection.php
extensions/elasticsearch/Connection.php
+6
-7
Exception.php
extensions/elasticsearch/Exception.php
+1
-2
Query.php
extensions/elasticsearch/Query.php
+1
-2
QueryBuilder.php
extensions/elasticsearch/QueryBuilder.php
+1
-1
Generator.php
extensions/gii/Generator.php
+0
-1
DiffRendererHtmlInline.php
extensions/gii/components/DiffRendererHtmlInline.php
+4
-5
Generator.php
extensions/gii/generators/crud/Generator.php
+0
-1
AutoCompleteAsset.php
extensions/jui/AutoCompleteAsset.php
+1
-0
ButtonAsset.php
extensions/jui/ButtonAsset.php
+1
-0
CoreAsset.php
extensions/jui/CoreAsset.php
+1
-0
DatePickerAsset.php
extensions/jui/DatePickerAsset.php
+1
-0
DatePickerRegionalAsset.php
extensions/jui/DatePickerRegionalAsset.php
+1
-0
DialogAsset.php
extensions/jui/DialogAsset.php
+1
-0
DraggableAsset.php
extensions/jui/DraggableAsset.php
+1
-0
DroppableAsset.php
extensions/jui/DroppableAsset.php
+1
-0
EffectAsset.php
extensions/jui/EffectAsset.php
+1
-0
MenuAsset.php
extensions/jui/MenuAsset.php
+1
-0
ProgressBarAsset.php
extensions/jui/ProgressBarAsset.php
+1
-0
ResizableAsset.php
extensions/jui/ResizableAsset.php
+1
-0
SelectableAsset.php
extensions/jui/SelectableAsset.php
+1
-0
SliderAsset.php
extensions/jui/SliderAsset.php
+1
-0
SortableAsset.php
extensions/jui/SortableAsset.php
+1
-0
SpinnerAsset.php
extensions/jui/SpinnerAsset.php
+1
-0
TabsAsset.php
extensions/jui/TabsAsset.php
+1
-0
ThemeAsset.php
extensions/jui/ThemeAsset.php
+1
-0
TooltipAsset.php
extensions/jui/TooltipAsset.php
+1
-0
ActiveQuery.php
extensions/mongodb/ActiveQuery.php
+2
-3
ActiveRecord.php
extensions/mongodb/ActiveRecord.php
+1
-2
Cache.php
extensions/mongodb/Cache.php
+1
-2
Collection.php
extensions/mongodb/Collection.php
+3
-3
Connection.php
extensions/mongodb/Connection.php
+1
-2
Database.php
extensions/mongodb/Database.php
+1
-2
Exception.php
extensions/mongodb/Exception.php
+1
-2
Query.php
extensions/mongodb/Query.php
+1
-2
Session.php
extensions/mongodb/Session.php
+1
-2
ActiveQuery.php
extensions/mongodb/file/ActiveQuery.php
+2
-3
Collection.php
extensions/mongodb/file/Collection.php
+1
-2
Query.php
extensions/mongodb/file/Query.php
+1
-2
ActiveQuery.php
extensions/redis/ActiveQuery.php
+16
-16
ActiveRecord.php
extensions/redis/ActiveRecord.php
+9
-9
Cache.php
extensions/redis/Cache.php
+3
-3
Connection.php
extensions/redis/Connection.php
+3
-3
LuaScriptBuilder.php
extensions/redis/LuaScriptBuilder.php
+1
-1
Session.php
extensions/redis/Session.php
+1
-1
ActiveQuery.php
extensions/sphinx/ActiveQuery.php
+1
-1
ColumnSchema.php
extensions/sphinx/ColumnSchema.php
+1
-2
Connection.php
extensions/sphinx/Connection.php
+1
-0
IndexSchema.php
extensions/sphinx/IndexSchema.php
+1
-2
QueryBuilder.php
extensions/sphinx/QueryBuilder.php
+3
-2
Schema.php
extensions/sphinx/Schema.php
+1
-2
TwigSimpleFileLoader.php
extensions/twig/TwigSimpleFileLoader.php
+3
-3
ViewRenderer.php
extensions/twig/ViewRenderer.php
+12
-12
ViewRendererStaticClassProxy.php
extensions/twig/ViewRendererStaticClassProxy.php
+3
-3
No files found.
extensions/apidoc/apidoc
View file @
1982efbd
...
@@ -15,7 +15,7 @@ $composerAutoload = [
...
@@ -15,7 +15,7 @@ $composerAutoload = [
__DIR__
.
'/../../autoload.php'
,
// script is installed as a composer binary
__DIR__
.
'/../../autoload.php'
,
// script is installed as a composer binary
];
];
$vendorPath
=
null
;
$vendorPath
=
null
;
foreach
(
$composerAutoload
as
$autoload
)
{
foreach
(
$composerAutoload
as
$autoload
)
{
if
(
file_exists
(
$autoload
))
{
if
(
file_exists
(
$autoload
))
{
require
(
$autoload
);
require
(
$autoload
);
$vendorPath
=
dirname
(
$autoload
);
$vendorPath
=
dirname
(
$autoload
);
...
@@ -27,7 +27,7 @@ $yiiDirs = [
...
@@ -27,7 +27,7 @@ $yiiDirs = [
__DIR__
.
'/vendor/yiisoft/yii2'
,
// standalone with "composer install" run
__DIR__
.
'/vendor/yiisoft/yii2'
,
// standalone with "composer install" run
__DIR__
.
'/../../yiisoft/yii2'
,
// script is installed as a composer binary
__DIR__
.
'/../../yiisoft/yii2'
,
// script is installed as a composer binary
];
];
foreach
(
$yiiDirs
as
$dir
)
{
foreach
(
$yiiDirs
as
$dir
)
{
if
(
file_exists
(
$dir
.
'/Yii.php'
))
{
if
(
file_exists
(
$dir
.
'/Yii.php'
))
{
require
(
$dir
.
'/Yii.php'
);
require
(
$dir
.
'/Yii.php'
);
break
;
break
;
...
...
extensions/apidoc/commands/RenderController.php
View file @
1982efbd
...
@@ -58,8 +58,8 @@ class RenderController extends Controller
...
@@ -58,8 +58,8 @@ class RenderController extends Controller
$this
->
stdout
(
'Searching files to process... '
);
$this
->
stdout
(
'Searching files to process... '
);
$files
=
[];
$files
=
[];
foreach
(
$sourceDirs
as
$source
)
{
foreach
(
$sourceDirs
as
$source
)
{
foreach
(
$this
->
findFiles
(
$source
)
as
$fileName
)
{
foreach
(
$this
->
findFiles
(
$source
)
as
$fileName
)
{
$files
[
$fileName
]
=
$fileName
;
$files
[
$fileName
]
=
$fileName
;
}
}
}
}
...
@@ -80,7 +80,7 @@ class RenderController extends Controller
...
@@ -80,7 +80,7 @@ class RenderController extends Controller
$this
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
$this
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
$this
->
stdout
(
'Checking for updated files... '
);
$this
->
stdout
(
'Checking for updated files... '
);
foreach
(
$context
->
files
as
$file
=>
$sha
)
{
foreach
(
$context
->
files
as
$file
=>
$sha
)
{
if
(
sha1_file
(
$file
)
===
$sha
)
{
if
(
sha1_file
(
$file
)
===
$sha
)
{
unset
(
$files
[
$file
]);
unset
(
$files
[
$file
]);
}
}
...
@@ -92,7 +92,7 @@ class RenderController extends Controller
...
@@ -92,7 +92,7 @@ class RenderController extends Controller
$this
->
stdout
(
$fileCount
.
' file'
.
(
$fileCount
==
1
?
''
:
's'
)
.
' to update.'
.
PHP_EOL
);
$this
->
stdout
(
$fileCount
.
' file'
.
(
$fileCount
==
1
?
''
:
's'
)
.
' to update.'
.
PHP_EOL
);
Console
::
startProgress
(
0
,
$fileCount
,
'Processing files... '
,
false
);
Console
::
startProgress
(
0
,
$fileCount
,
'Processing files... '
,
false
);
$done
=
0
;
$done
=
0
;
foreach
(
$files
as
$file
)
{
foreach
(
$files
as
$file
)
{
$context
->
addFile
(
$file
);
$context
->
addFile
(
$file
);
Console
::
updateProgress
(
++
$done
,
$fileCount
);
Console
::
updateProgress
(
++
$done
,
$fileCount
);
}
}
...
...
extensions/apidoc/helpers/ApiMarkdown.php
View file @
1982efbd
...
@@ -70,7 +70,7 @@ class ApiMarkdown extends GithubMarkdown
...
@@ -70,7 +70,7 @@ class ApiMarkdown extends GithubMarkdown
if
(
!
empty
(
$language
))
{
if
(
!
empty
(
$language
))
{
$block
[
'language'
]
=
$language
;
$block
[
'language'
]
=
$language
;
}
}
for
(
$i
=
$current
+
1
,
$count
=
count
(
$lines
);
$i
<
$count
;
$i
++
)
{
for
(
$i
=
$current
+
1
,
$count
=
count
(
$lines
);
$i
<
$count
;
$i
++
)
{
if
(
rtrim
(
$line
=
$lines
[
$i
])
!==
$fence
)
{
if
(
rtrim
(
$line
=
$lines
[
$i
])
!==
$fence
)
{
$block
[
'content'
][]
=
$line
;
$block
[
'content'
][]
=
$line
;
}
else
{
}
else
{
...
...
extensions/apidoc/helpers/PrettyPrinter.php
View file @
1982efbd
...
@@ -38,4 +38,4 @@ class PrettyPrinter extends \phpDocumentor\Reflection\PrettyPrinter
...
@@ -38,4 +38,4 @@ class PrettyPrinter extends \phpDocumentor\Reflection\PrettyPrinter
$printer
=
new
static
();
$printer
=
new
static
();
return
$printer
->
prettyPrintExpr
(
$value
);
return
$printer
->
prettyPrintExpr
(
$value
);
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/BaseDoc.php
View file @
1982efbd
...
@@ -76,7 +76,7 @@ class BaseDoc extends Object
...
@@ -76,7 +76,7 @@ class BaseDoc extends Object
$this
->
phpDocContext
=
$docblock
->
getContext
();
$this
->
phpDocContext
=
$docblock
->
getContext
();
$this
->
tags
=
$docblock
->
getTags
();
$this
->
tags
=
$docblock
->
getTags
();
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
if
(
$tag
instanceof
SinceTag
)
{
if
(
$tag
instanceof
SinceTag
)
{
$this
->
since
=
$tag
->
getVersion
();
$this
->
since
=
$tag
->
getVersion
();
unset
(
$this
->
tags
[
$i
]);
unset
(
$this
->
tags
[
$i
]);
...
@@ -104,12 +104,13 @@ class BaseDoc extends Object
...
@@ -104,12 +104,13 @@ class BaseDoc extends Object
$this
->
endLine
=
$reflection
->
getEndLine
();
$this
->
endLine
=
$reflection
->
getEndLine
();
}
}
public
function
getSourceUrl
(
$baseUrl
,
$line
=
null
)
public
function
getSourceUrl
(
$baseUrl
,
$line
=
null
)
{
{
if
(
$line
===
null
)
if
(
$line
===
null
)
{
return
$baseUrl
.
$this
->
sourcePath
;
return
$baseUrl
.
$this
->
sourcePath
;
else
}
else
{
return
$baseUrl
.
$this
->
sourcePath
.
'#'
.
$line
;
return
$baseUrl
.
$this
->
sourcePath
.
'#'
.
$line
;
}
}
}
public
function
getSourceCode
()
public
function
getSourceCode
()
...
...
extensions/apidoc/models/ClassDoc.php
View file @
1982efbd
...
@@ -45,12 +45,12 @@ class ClassDoc extends TypeDoc
...
@@ -45,12 +45,12 @@ class ClassDoc extends TypeDoc
if
((
$subject
=
parent
::
findSubject
(
$subjectName
))
!==
null
)
{
if
((
$subject
=
parent
::
findSubject
(
$subjectName
))
!==
null
)
{
return
$subject
;
return
$subject
;
}
}
foreach
(
$this
->
events
as
$name
=>
$event
)
{
foreach
(
$this
->
events
as
$name
=>
$event
)
{
if
(
$subjectName
==
$name
)
{
if
(
$subjectName
==
$name
)
{
return
$event
;
return
$event
;
}
}
}
}
foreach
(
$this
->
constants
as
$name
=>
$constant
)
{
foreach
(
$this
->
constants
as
$name
=>
$constant
)
{
if
(
$subjectName
==
$name
)
{
if
(
$subjectName
==
$name
)
{
return
$constant
;
return
$constant
;
}
}
...
@@ -64,7 +64,7 @@ class ClassDoc extends TypeDoc
...
@@ -64,7 +64,7 @@ class ClassDoc extends TypeDoc
public
function
getNativeEvents
()
public
function
getNativeEvents
()
{
{
$events
=
[];
$events
=
[];
foreach
(
$this
->
events
as
$name
=>
$event
)
{
foreach
(
$this
->
events
as
$name
=>
$event
)
{
if
(
$event
->
definedBy
!=
$this
->
name
)
{
if
(
$event
->
definedBy
!=
$this
->
name
)
{
continue
;
continue
;
}
}
...
@@ -93,13 +93,13 @@ class ClassDoc extends TypeDoc
...
@@ -93,13 +93,13 @@ class ClassDoc extends TypeDoc
$this
->
isAbstract
=
$reflector
->
isAbstract
();
$this
->
isAbstract
=
$reflector
->
isAbstract
();
$this
->
isFinal
=
$reflector
->
isFinal
();
$this
->
isFinal
=
$reflector
->
isFinal
();
foreach
(
$reflector
->
getInterfaces
()
as
$interface
)
{
foreach
(
$reflector
->
getInterfaces
()
as
$interface
)
{
$this
->
interfaces
[]
=
ltrim
(
$interface
,
'\\'
);
$this
->
interfaces
[]
=
ltrim
(
$interface
,
'\\'
);
}
}
foreach
(
$reflector
->
getTraits
()
as
$trait
)
{
foreach
(
$reflector
->
getTraits
()
as
$trait
)
{
$this
->
traits
[]
=
ltrim
(
$trait
,
'\\'
);
$this
->
traits
[]
=
ltrim
(
$trait
,
'\\'
);
}
}
foreach
(
$reflector
->
getConstants
()
as
$constantReflector
)
{
foreach
(
$reflector
->
getConstants
()
as
$constantReflector
)
{
$docblock
=
$constantReflector
->
getDocBlock
();
$docblock
=
$constantReflector
->
getDocBlock
();
if
(
$docblock
!==
null
&&
count
(
$docblock
->
getTagsByName
(
'event'
))
>
0
)
{
if
(
$docblock
!==
null
&&
count
(
$docblock
->
getTagsByName
(
'event'
))
>
0
)
{
$event
=
new
EventDoc
(
$constantReflector
);
$event
=
new
EventDoc
(
$constantReflector
);
...
@@ -112,4 +112,4 @@ class ClassDoc extends TypeDoc
...
@@ -112,4 +112,4 @@ class ClassDoc extends TypeDoc
}
}
}
}
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/ConstDoc.php
View file @
1982efbd
...
@@ -33,4 +33,4 @@ class ConstDoc extends BaseDoc
...
@@ -33,4 +33,4 @@ class ConstDoc extends BaseDoc
$this
->
value
=
$reflector
->
getValue
();
$this
->
value
=
$reflector
->
getValue
();
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/Context.php
View file @
1982efbd
...
@@ -57,15 +57,15 @@ class Context extends Component
...
@@ -57,15 +57,15 @@ class Context extends Component
$reflection
=
new
FileReflector
(
$fileName
,
true
);
$reflection
=
new
FileReflector
(
$fileName
,
true
);
$reflection
->
process
();
$reflection
->
process
();
foreach
(
$reflection
->
getClasses
()
as
$class
)
{
foreach
(
$reflection
->
getClasses
()
as
$class
)
{
$class
=
new
ClassDoc
(
$class
,
$this
,
[
'sourceFile'
=>
$fileName
]);
$class
=
new
ClassDoc
(
$class
,
$this
,
[
'sourceFile'
=>
$fileName
]);
$this
->
classes
[
$class
->
name
]
=
$class
;
$this
->
classes
[
$class
->
name
]
=
$class
;
}
}
foreach
(
$reflection
->
getInterfaces
()
as
$interface
)
{
foreach
(
$reflection
->
getInterfaces
()
as
$interface
)
{
$interface
=
new
InterfaceDoc
(
$interface
,
$this
,
[
'sourceFile'
=>
$fileName
]);
$interface
=
new
InterfaceDoc
(
$interface
,
$this
,
[
'sourceFile'
=>
$fileName
]);
$this
->
interfaces
[
$interface
->
name
]
=
$interface
;
$this
->
interfaces
[
$interface
->
name
]
=
$interface
;
}
}
foreach
(
$reflection
->
getTraits
()
as
$trait
)
{
foreach
(
$reflection
->
getTraits
()
as
$trait
)
{
$trait
=
new
TraitDoc
(
$trait
,
$this
,
[
'sourceFile'
=>
$fileName
]);
$trait
=
new
TraitDoc
(
$trait
,
$this
,
[
'sourceFile'
=>
$fileName
]);
$this
->
traits
[
$trait
->
name
]
=
$trait
;
$this
->
traits
[
$trait
->
name
]
=
$trait
;
}
}
...
@@ -74,7 +74,7 @@ class Context extends Component
...
@@ -74,7 +74,7 @@ class Context extends Component
public
function
updateReferences
()
public
function
updateReferences
()
{
{
// update all subclass references
// update all subclass references
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
$className
=
$class
->
name
;
$className
=
$class
->
name
;
while
(
isset
(
$this
->
classes
[
$class
->
parentClass
]))
{
while
(
isset
(
$this
->
classes
[
$class
->
parentClass
]))
{
$class
=
$this
->
classes
[
$class
->
parentClass
];
$class
=
$this
->
classes
[
$class
->
parentClass
];
...
@@ -82,12 +82,12 @@ class Context extends Component
...
@@ -82,12 +82,12 @@ class Context extends Component
}
}
}
}
// update interfaces of subclasses
// update interfaces of subclasses
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
$this
->
updateSubclassInferfacesTraits
(
$class
);
$this
->
updateSubclassInferfacesTraits
(
$class
);
}
}
// update implementedBy and usedBy for interfaces and traits
// update implementedBy and usedBy for interfaces and traits
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$class
->
traits
as
$trait
)
{
foreach
(
$class
->
traits
as
$trait
)
{
if
(
isset
(
$this
->
traits
[
$trait
]))
{
if
(
isset
(
$this
->
traits
[
$trait
]))
{
$trait
=
$this
->
traits
[
$trait
];
$trait
=
$this
->
traits
[
$trait
];
$trait
->
usedBy
[]
=
$class
->
name
;
$trait
->
usedBy
[]
=
$class
->
name
;
...
@@ -95,12 +95,12 @@ class Context extends Component
...
@@ -95,12 +95,12 @@ class Context extends Component
$class
->
methods
=
array_merge
(
$trait
->
methods
,
$class
->
methods
);
$class
->
methods
=
array_merge
(
$trait
->
methods
,
$class
->
methods
);
}
}
}
}
foreach
(
$class
->
interfaces
as
$interface
)
{
foreach
(
$class
->
interfaces
as
$interface
)
{
if
(
isset
(
$this
->
interfaces
[
$interface
]))
{
if
(
isset
(
$this
->
interfaces
[
$interface
]))
{
$this
->
interfaces
[
$interface
]
->
implementedBy
[]
=
$class
->
name
;
$this
->
interfaces
[
$interface
]
->
implementedBy
[]
=
$class
->
name
;
if
(
$class
->
isAbstract
)
{
if
(
$class
->
isAbstract
)
{
// add not implemented interface methods
// add not implemented interface methods
foreach
(
$this
->
interfaces
[
$interface
]
->
methods
as
$method
)
{
foreach
(
$this
->
interfaces
[
$interface
]
->
methods
as
$method
)
{
if
(
!
isset
(
$class
->
methods
[
$method
->
name
]))
{
if
(
!
isset
(
$class
->
methods
[
$method
->
name
]))
{
$class
->
methods
[
$method
->
name
]
=
$method
;
$class
->
methods
[
$method
->
name
]
=
$method
;
}
}
...
@@ -110,11 +110,11 @@ class Context extends Component
...
@@ -110,11 +110,11 @@ class Context extends Component
}
}
}
}
// inherit properties, methods, contants and events to subclasses
// inherit properties, methods, contants and events to subclasses
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
$this
->
updateSubclassInheritance
(
$class
);
$this
->
updateSubclassInheritance
(
$class
);
}
}
// add properties from getters and setters
// add properties from getters and setters
foreach
(
$this
->
classes
as
$class
)
{
foreach
(
$this
->
classes
as
$class
)
{
$this
->
handlePropertyFeature
(
$class
);
$this
->
handlePropertyFeature
(
$class
);
}
}
...
@@ -127,7 +127,7 @@ class Context extends Component
...
@@ -127,7 +127,7 @@ class Context extends Component
*/
*/
protected
function
updateSubclassInferfacesTraits
(
$class
)
protected
function
updateSubclassInferfacesTraits
(
$class
)
{
{
foreach
(
$class
->
subclasses
as
$subclass
)
{
foreach
(
$class
->
subclasses
as
$subclass
)
{
$subclass
=
$this
->
classes
[
$subclass
];
$subclass
=
$this
->
classes
[
$subclass
];
$subclass
->
interfaces
=
array_unique
(
array_merge
(
$subclass
->
interfaces
,
$class
->
interfaces
));
$subclass
->
interfaces
=
array_unique
(
array_merge
(
$subclass
->
interfaces
,
$class
->
interfaces
));
$subclass
->
traits
=
array_unique
(
array_merge
(
$subclass
->
traits
,
$class
->
traits
));
$subclass
->
traits
=
array_unique
(
array_merge
(
$subclass
->
traits
,
$class
->
traits
));
...
@@ -141,7 +141,7 @@ class Context extends Component
...
@@ -141,7 +141,7 @@ class Context extends Component
*/
*/
protected
function
updateSubclassInheritance
(
$class
)
protected
function
updateSubclassInheritance
(
$class
)
{
{
foreach
(
$class
->
subclasses
as
$subclass
)
{
foreach
(
$class
->
subclasses
as
$subclass
)
{
$subclass
=
$this
->
classes
[
$subclass
];
$subclass
=
$this
->
classes
[
$subclass
];
$subclass
->
events
=
array_merge
(
$class
->
events
,
$subclass
->
events
);
$subclass
->
events
=
array_merge
(
$class
->
events
,
$subclass
->
events
);
$subclass
->
constants
=
array_merge
(
$class
->
constants
,
$subclass
->
constants
);
$subclass
->
constants
=
array_merge
(
$class
->
constants
,
$subclass
->
constants
);
...
@@ -160,7 +160,7 @@ class Context extends Component
...
@@ -160,7 +160,7 @@ class Context extends Component
if
(
!
$this
->
isSubclassOf
(
$class
,
'yii\base\Object'
))
{
if
(
!
$this
->
isSubclassOf
(
$class
,
'yii\base\Object'
))
{
return
;
return
;
}
}
foreach
(
$class
->
getPublicMethods
()
as
$name
=>
$method
)
{
foreach
(
$class
->
getPublicMethods
()
as
$name
=>
$method
)
{
if
(
$method
->
isStatic
)
{
if
(
$method
->
isStatic
)
{
continue
;
continue
;
}
}
...
@@ -232,7 +232,7 @@ class Context extends Component
...
@@ -232,7 +232,7 @@ class Context extends Component
*/
*/
private
function
paramsOptional
(
$method
,
$number
=
0
)
private
function
paramsOptional
(
$method
,
$number
=
0
)
{
{
foreach
(
$method
->
params
as
$param
)
{
foreach
(
$method
->
params
as
$param
)
{
if
(
!
$param
->
isOptional
&&
$number
--
<=
0
)
{
if
(
!
$param
->
isOptional
&&
$number
--
<=
0
)
{
return
false
;
return
false
;
}
}
...
@@ -246,7 +246,7 @@ class Context extends Component
...
@@ -246,7 +246,7 @@ class Context extends Component
*/
*/
private
function
getFirstNotOptionalParameter
(
$method
)
private
function
getFirstNotOptionalParameter
(
$method
)
{
{
foreach
(
$method
->
params
as
$param
)
{
foreach
(
$method
->
params
as
$param
)
{
if
(
!
$param
->
isOptional
)
{
if
(
!
$param
->
isOptional
)
{
return
$param
;
return
$param
;
}
}
...
@@ -266,7 +266,7 @@ class Context extends Component
...
@@ -266,7 +266,7 @@ class Context extends Component
if
(
$classA
->
name
==
$classB
)
{
if
(
$classA
->
name
==
$classB
)
{
return
true
;
return
true
;
}
}
while
(
$classA
->
parentClass
!==
null
&&
isset
(
$this
->
classes
[
$classA
->
parentClass
]))
{
while
(
$classA
->
parentClass
!==
null
&&
isset
(
$this
->
classes
[
$classA
->
parentClass
]))
{
$classA
=
$this
->
classes
[
$classA
->
parentClass
];
$classA
=
$this
->
classes
[
$classA
->
parentClass
];
if
(
$classA
->
name
==
$classB
)
{
if
(
$classA
->
name
==
$classB
)
{
return
true
;
return
true
;
...
@@ -274,4 +274,4 @@ class Context extends Component
...
@@ -274,4 +274,4 @@ class Context extends Component
}
}
return
false
;
return
false
;
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/EventDoc.php
View file @
1982efbd
...
@@ -34,7 +34,7 @@ class EventDoc extends ConstDoc
...
@@ -34,7 +34,7 @@ class EventDoc extends ConstDoc
return
;
return
;
}
}
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
if
(
$tag
->
getName
()
==
'event'
)
{
if
(
$tag
->
getName
()
==
'event'
)
{
$eventTag
=
new
ReturnTag
(
'event'
,
$tag
->
getContent
(),
$tag
->
getDocBlock
(),
$tag
->
getLocation
());
$eventTag
=
new
ReturnTag
(
'event'
,
$tag
->
getContent
(),
$tag
->
getDocBlock
(),
$tag
->
getLocation
());
$this
->
type
=
$eventTag
->
getType
();
$this
->
type
=
$eventTag
->
getType
();
...
@@ -49,4 +49,4 @@ class EventDoc extends ConstDoc
...
@@ -49,4 +49,4 @@ class EventDoc extends ConstDoc
}
}
}
}
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/FunctionDoc.php
View file @
1982efbd
...
@@ -45,17 +45,17 @@ class FunctionDoc extends BaseDoc
...
@@ -45,17 +45,17 @@ class FunctionDoc extends BaseDoc
$this
->
isReturnByReference
=
$reflector
->
isByRef
();
$this
->
isReturnByReference
=
$reflector
->
isByRef
();
foreach
(
$reflector
->
getArguments
()
as
$arg
)
{
foreach
(
$reflector
->
getArguments
()
as
$arg
)
{
$arg
=
new
ParamDoc
(
$arg
,
$context
,
[
'sourceFile'
=>
$this
->
sourceFile
]);
$arg
=
new
ParamDoc
(
$arg
,
$context
,
[
'sourceFile'
=>
$this
->
sourceFile
]);
$this
->
params
[
$arg
->
name
]
=
$arg
;
$this
->
params
[
$arg
->
name
]
=
$arg
;
}
}
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
if
(
$tag
instanceof
ThrowsTag
)
{
if
(
$tag
instanceof
ThrowsTag
)
{
$this
->
exceptions
[
$tag
->
getType
()]
=
$tag
->
getDescription
();
$this
->
exceptions
[
$tag
->
getType
()]
=
$tag
->
getDescription
();
unset
(
$this
->
tags
[
$i
]);
unset
(
$this
->
tags
[
$i
]);
}
elseif
(
$tag
instanceof
PropertyTag
)
{
}
elseif
(
$tag
instanceof
PropertyTag
)
{
// ignore property tag
// ignore property tag
}
elseif
(
$tag
instanceof
ParamTag
)
{
}
elseif
(
$tag
instanceof
ParamTag
)
{
$paramName
=
$tag
->
getVariableName
();
$paramName
=
$tag
->
getVariableName
();
if
(
!
isset
(
$this
->
params
[
$paramName
])
&&
$context
!==
null
)
{
if
(
!
isset
(
$this
->
params
[
$paramName
])
&&
$context
!==
null
)
{
...
...
extensions/apidoc/models/InterfaceDoc.php
View file @
1982efbd
...
@@ -33,15 +33,15 @@ class InterfaceDoc extends TypeDoc
...
@@ -33,15 +33,15 @@ class InterfaceDoc extends TypeDoc
return
;
return
;
}
}
foreach
(
$reflector
->
getParentInterfaces
()
as
$interface
)
{
foreach
(
$reflector
->
getParentInterfaces
()
as
$interface
)
{
$this
->
parentInterfaces
[]
=
ltrim
(
$interface
,
'\\'
);
$this
->
parentInterfaces
[]
=
ltrim
(
$interface
,
'\\'
);
}
}
foreach
(
$this
->
methods
as
$method
)
{
foreach
(
$this
->
methods
as
$method
)
{
$method
->
isAbstract
=
true
;
$method
->
isAbstract
=
true
;
}
}
// interface can not have properties
// interface can not have properties
$this
->
properties
=
null
;
$this
->
properties
=
null
;
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/ParamDoc.php
View file @
1982efbd
...
@@ -53,4 +53,4 @@ class ParamDoc extends Object
...
@@ -53,4 +53,4 @@ class ParamDoc extends Object
}
}
$this
->
isPassedByReference
=
$reflector
->
isByRef
();
$this
->
isPassedByReference
=
$reflector
->
isByRef
();
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/PropertyDoc.php
View file @
1982efbd
...
@@ -63,7 +63,7 @@ class PropertyDoc extends BaseDoc
...
@@ -63,7 +63,7 @@ class PropertyDoc extends BaseDoc
$this
->
defaultValue
=
PrettyPrinter
::
getRepresentationOfValue
(
$reflector
->
getNode
()
->
default
);
$this
->
defaultValue
=
PrettyPrinter
::
getRepresentationOfValue
(
$reflector
->
getNode
()
->
default
);
}
}
foreach
(
$this
->
tags
as
$tag
)
{
foreach
(
$this
->
tags
as
$tag
)
{
if
(
$tag
instanceof
VarTag
)
{
if
(
$tag
instanceof
VarTag
)
{
$this
->
type
=
$tag
->
getType
();
$this
->
type
=
$tag
->
getType
();
$this
->
types
=
$tag
->
getTypes
();
$this
->
types
=
$tag
->
getTypes
();
...
@@ -83,4 +83,4 @@ class PropertyDoc extends BaseDoc
...
@@ -83,4 +83,4 @@ class PropertyDoc extends BaseDoc
];
];
}
}
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/TraitDoc.php
View file @
1982efbd
...
@@ -34,8 +34,8 @@ class TraitDoc extends TypeDoc
...
@@ -34,8 +34,8 @@ class TraitDoc extends TypeDoc
return
;
return
;
}
}
foreach
(
$reflector
->
getTraits
()
as
$trait
)
{
foreach
(
$reflector
->
getTraits
()
as
$trait
)
{
$this
->
traits
[]
=
ltrim
(
$trait
,
'\\'
);
$this
->
traits
[]
=
ltrim
(
$trait
,
'\\'
);
}
}
}
}
}
}
\ No newline at end of file
extensions/apidoc/models/TypeDoc.php
View file @
1982efbd
...
@@ -41,7 +41,7 @@ class TypeDoc extends BaseDoc
...
@@ -41,7 +41,7 @@ class TypeDoc extends BaseDoc
public
function
findSubject
(
$subjectName
)
public
function
findSubject
(
$subjectName
)
{
{
if
(
$subjectName
[
0
]
!=
'$'
)
{
if
(
$subjectName
[
0
]
!=
'$'
)
{
foreach
(
$this
->
methods
as
$name
=>
$method
)
{
foreach
(
$this
->
methods
as
$name
=>
$method
)
{
if
(
rtrim
(
$subjectName
,
'()'
)
==
$name
)
{
if
(
rtrim
(
$subjectName
,
'()'
)
==
$name
)
{
return
$method
;
return
$method
;
}
}
...
@@ -53,7 +53,7 @@ class TypeDoc extends BaseDoc
...
@@ -53,7 +53,7 @@ class TypeDoc extends BaseDoc
if
(
$this
->
properties
===
null
)
{
if
(
$this
->
properties
===
null
)
{
return
null
;
return
null
;
}
}
foreach
(
$this
->
properties
as
$name
=>
$property
)
{
foreach
(
$this
->
properties
as
$name
=>
$property
)
{
if
(
ltrim
(
$subjectName
,
'$'
)
==
ltrim
(
$name
,
'$'
))
{
if
(
ltrim
(
$subjectName
,
'$'
)
==
ltrim
(
$name
,
'$'
))
{
return
$property
;
return
$property
;
}
}
...
@@ -93,7 +93,7 @@ class TypeDoc extends BaseDoc
...
@@ -93,7 +93,7 @@ class TypeDoc extends BaseDoc
private
function
getFilteredMethods
(
$visibility
=
null
,
$definedBy
=
null
)
private
function
getFilteredMethods
(
$visibility
=
null
,
$definedBy
=
null
)
{
{
$methods
=
[];
$methods
=
[];
foreach
(
$this
->
methods
as
$name
=>
$method
)
{
foreach
(
$this
->
methods
as
$name
=>
$method
)
{
if
(
$visibility
!==
null
&&
$method
->
visibility
!=
$visibility
)
{
if
(
$visibility
!==
null
&&
$method
->
visibility
!=
$visibility
)
{
continue
;
continue
;
}
}
...
@@ -140,7 +140,7 @@ class TypeDoc extends BaseDoc
...
@@ -140,7 +140,7 @@ class TypeDoc extends BaseDoc
return
[];
return
[];
}
}
$properties
=
[];
$properties
=
[];
foreach
(
$this
->
properties
as
$name
=>
$property
)
{
foreach
(
$this
->
properties
as
$name
=>
$property
)
{
if
(
$visibility
!==
null
&&
$property
->
visibility
!=
$visibility
)
{
if
(
$visibility
!==
null
&&
$property
->
visibility
!=
$visibility
)
{
continue
;
continue
;
}
}
...
@@ -167,14 +167,14 @@ class TypeDoc extends BaseDoc
...
@@ -167,14 +167,14 @@ class TypeDoc extends BaseDoc
return
;
return
;
}
}
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
foreach
(
$this
->
tags
as
$i
=>
$tag
)
{
if
(
$tag
instanceof
AuthorTag
)
{
if
(
$tag
instanceof
AuthorTag
)
{
$this
->
authors
[
$tag
->
getAuthorName
()]
=
$tag
->
getAuthorEmail
();
$this
->
authors
[
$tag
->
getAuthorName
()]
=
$tag
->
getAuthorEmail
();
unset
(
$this
->
tags
[
$i
]);
unset
(
$this
->
tags
[
$i
]);
}
}
}
}
foreach
(
$reflector
->
getProperties
()
as
$propertyReflector
)
{
foreach
(
$reflector
->
getProperties
()
as
$propertyReflector
)
{
if
(
$propertyReflector
->
getVisibility
()
!=
'private'
)
{
if
(
$propertyReflector
->
getVisibility
()
!=
'private'
)
{
$property
=
new
PropertyDoc
(
$propertyReflector
,
$context
,
[
'sourceFile'
=>
$this
->
sourceFile
]);
$property
=
new
PropertyDoc
(
$propertyReflector
,
$context
,
[
'sourceFile'
=>
$this
->
sourceFile
]);
$property
->
definedBy
=
$this
->
name
;
$property
->
definedBy
=
$this
->
name
;
...
@@ -182,7 +182,7 @@ class TypeDoc extends BaseDoc
...
@@ -182,7 +182,7 @@ class TypeDoc extends BaseDoc
}
}
}
}
foreach
(
$reflector
->
getMethods
()
as
$methodReflector
)
{
foreach
(
$reflector
->
getMethods
()
as
$methodReflector
)
{
if
(
$methodReflector
->
getVisibility
()
!=
'private'
)
{
if
(
$methodReflector
->
getVisibility
()
!=
'private'
)
{
$method
=
new
MethodDoc
(
$methodReflector
,
$context
,
[
'sourceFile'
=>
$this
->
sourceFile
]);
$method
=
new
MethodDoc
(
$methodReflector
,
$context
,
[
'sourceFile'
=>
$this
->
sourceFile
]);
$method
->
definedBy
=
$this
->
name
;
$method
->
definedBy
=
$this
->
name
;
...
@@ -190,4 +190,4 @@ class TypeDoc extends BaseDoc
...
@@ -190,4 +190,4 @@ class TypeDoc extends BaseDoc
}
}
}
}
}
}
}
}
\ No newline at end of file
extensions/apidoc/templates/BaseRenderer.php
View file @
1982efbd
...
@@ -68,4 +68,4 @@ abstract class BaseRenderer extends Component
...
@@ -68,4 +68,4 @@ abstract class BaseRenderer extends Component
* @return string
* @return string
*/
*/
public
abstract
function
subjectLink
(
$subject
,
$title
=
null
);
public
abstract
function
subjectLink
(
$subject
,
$title
=
null
);
}
}
\ No newline at end of file
extensions/apidoc/templates/bootstrap/Renderer.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\apidoc\templates\bootstrap
;
namespace
yii\apidoc\templates\bootstrap
;
use
yii\apidoc\helpers\ApiMarkdown
;
use
yii\apidoc\helpers\ApiMarkdown
;
use
yii\apidoc\models\Context
;
use
yii\apidoc\models\Context
;
use
yii\console\Controller
;
use
yii\console\Controller
;
...
@@ -60,7 +61,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -60,7 +61,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
$types
=
array_merge
(
$context
->
classes
,
$context
->
interfaces
,
$context
->
traits
);
$types
=
array_merge
(
$context
->
classes
,
$context
->
interfaces
,
$context
->
traits
);
$controller
->
stdout
(
'generating extension index files...'
);
$controller
->
stdout
(
'generating extension index files...'
);
foreach
(
$this
->
extensions
as
$ext
)
{
foreach
(
$this
->
extensions
as
$ext
)
{
$readme
=
@
file_get_contents
(
"https://raw.github.com/yiisoft/yii2-
$ext
/master/README.md"
);
$readme
=
@
file_get_contents
(
"https://raw.github.com/yiisoft/yii2-
$ext
/master/README.md"
);
$indexFileContent
=
$this
->
renderWithLayout
(
$this
->
indexView
,
[
$indexFileContent
=
$this
->
renderWithLayout
(
$this
->
indexView
,
[
'docContext'
=>
$context
,
'docContext'
=>
$context
,
...
@@ -109,13 +110,13 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -109,13 +110,13 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
switch
(
$navClasses
)
switch
(
$navClasses
)
{
{
case
'app'
:
case
'app'
:
$types
=
array_filter
(
$types
,
function
(
$val
)
{
$types
=
array_filter
(
$types
,
function
(
$val
)
{
return
strncmp
(
$val
->
name
,
'yii\\'
,
4
)
!==
0
;
return
strncmp
(
$val
->
name
,
'yii\\'
,
4
)
!==
0
;
});
});
break
;
break
;
case
'yii'
:
case
'yii'
:
$self
=
$this
;
$self
=
$this
;
$types
=
array_filter
(
$types
,
function
(
$val
)
use
(
$self
)
{
$types
=
array_filter
(
$types
,
function
(
$val
)
use
(
$self
)
{
if
(
strlen
(
$val
->
name
)
<
5
)
{
if
(
strlen
(
$val
->
name
)
<
5
)
{
return
false
;
return
false
;
}
}
...
@@ -124,7 +125,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -124,7 +125,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
});
});
break
;
break
;
default
:
default
:
$types
=
array_filter
(
$types
,
function
(
$val
)
use
(
$navClasses
)
{
$types
=
array_filter
(
$types
,
function
(
$val
)
use
(
$navClasses
)
{
return
strncmp
(
$val
->
name
,
"yii
\\
$navClasses
\\
"
,
strlen
(
"yii
\\
$navClasses
\\
"
))
===
0
;
return
strncmp
(
$val
->
name
,
"yii
\\
$navClasses
\\
"
,
strlen
(
"yii
\\
$navClasses
\\
"
))
===
0
;
});
});
}
}
...
@@ -151,7 +152,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -151,7 +152,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
$done
=
0
;
$done
=
0
;
$fileData
=
[];
$fileData
=
[];
$headlines
=
[];
$headlines
=
[];
foreach
(
$files
as
$file
)
{
foreach
(
$files
as
$file
)
{
$fileData
[
$file
]
=
file_get_contents
(
$file
);
$fileData
[
$file
]
=
file_get_contents
(
$file
);
if
(
basename
(
$file
)
==
'index.md'
)
{
if
(
basename
(
$file
)
==
'index.md'
)
{
continue
;
// to not add index file to nav
continue
;
// to not add index file to nav
...
@@ -163,7 +164,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -163,7 +164,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
}
}
}
}
foreach
(
$fileData
as
$file
=>
$content
)
{
foreach
(
$fileData
as
$file
=>
$content
)
{
$output
=
ApiMarkdown
::
process
(
$content
);
// TODO generate links to yiiframework.com by default
$output
=
ApiMarkdown
::
process
(
$content
);
// TODO generate links to yiiframework.com by default
$output
=
$this
->
fixMarkdownLinks
(
$output
);
$output
=
$this
->
fixMarkdownLinks
(
$output
);
if
(
$this
->
guideLayout
!==
false
)
{
if
(
$this
->
guideLayout
!==
false
)
{
...
@@ -191,7 +192,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -191,7 +192,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
public
function
getGuideReferences
()
public
function
getGuideReferences
()
{
{
$refs
=
[];
$refs
=
[];
foreach
(
$this
->
markDownFiles
as
$file
)
{
foreach
(
$this
->
markDownFiles
as
$file
)
{
$refName
=
'guide-'
.
basename
(
$file
,
'.md'
);
$refName
=
'guide-'
.
basename
(
$file
,
'.md'
);
$refs
[
$refName
]
=
[
'url'
=>
$this
->
generateGuideFileName
(
$file
)];
$refs
[
$refName
]
=
[
'url'
=>
$this
->
generateGuideFileName
(
$file
)];
}
}
...
@@ -203,4 +204,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -203,4 +204,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
$content
=
preg_replace
(
'/href\s*=\s*"([^"\/]+)\.md(#.*)?"/i'
,
'href="guide_\1.html\2"'
,
$content
);
$content
=
preg_replace
(
'/href\s*=\s*"([^"\/]+)\.md(#.*)?"/i'
,
'href="guide_\1.html\2"'
,
$content
);
return
$content
;
return
$content
;
}
}
}
}
\ No newline at end of file
extensions/apidoc/templates/bootstrap/SideNavWidget.php
View file @
1982efbd
...
@@ -151,7 +151,7 @@ class SideNavWidget extends \yii\bootstrap\Widget
...
@@ -151,7 +151,7 @@ class SideNavWidget extends \yii\bootstrap\Widget
$label
.=
' '
.
Html
::
tag
(
'b'
,
''
,
[
'class'
=>
'caret'
]);
$label
.=
' '
.
Html
::
tag
(
'b'
,
''
,
[
'class'
=>
'caret'
]);
if
(
is_array
(
$items
))
{
if
(
is_array
(
$items
))
{
if
(
$active
===
false
)
{
if
(
$active
===
false
)
{
foreach
(
$items
as
$subItem
)
{
foreach
(
$items
as
$subItem
)
{
if
(
isset
(
$subItem
[
'active'
])
&&
$subItem
[
'active'
])
{
if
(
isset
(
$subItem
[
'active'
])
&&
$subItem
[
'active'
])
{
$active
=
true
;
$active
=
true
;
}
}
...
...
extensions/apidoc/templates/bootstrap/assets/AssetBundle.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\apidoc\templates\bootstrap\assets
;
namespace
yii\apidoc\templates\bootstrap\assets
;
use
yii\web\View
;
use
yii\web\View
;
/**
/**
...
...
extensions/apidoc/templates/bootstrap/layouts/api.php
View file @
1982efbd
...
@@ -14,7 +14,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
...
@@ -14,7 +14,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
$types
=
$this
->
context
->
getNavTypes
(
isset
(
$type
)
?
$type
:
null
,
$types
);
$types
=
$this
->
context
->
getNavTypes
(
isset
(
$type
)
?
$type
:
null
,
$types
);
ksort
(
$types
);
ksort
(
$types
);
$nav
=
[];
$nav
=
[];
foreach
(
$types
as
$i
=>
$class
)
{
foreach
(
$types
as
$i
=>
$class
)
{
$namespace
=
$class
->
namespace
;
$namespace
=
$class
->
namespace
;
if
(
empty
(
$namespace
))
{
if
(
empty
(
$namespace
))
{
$namespace
=
'Not namespaced classes'
;
$namespace
=
'Not namespaced classes'
;
...
...
extensions/apidoc/templates/bootstrap/layouts/guide.php
View file @
1982efbd
...
@@ -17,7 +17,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
...
@@ -17,7 +17,7 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
'url'
=>
'./guide_index.html'
,
'url'
=>
'./guide_index.html'
,
'active'
=>
isset
(
$currentFile
)
&&
(
basename
(
$currentFile
)
==
'index.md'
),
'active'
=>
isset
(
$currentFile
)
&&
(
basename
(
$currentFile
)
==
'index.md'
),
];
];
foreach
(
$headlines
as
$file
=>
$headline
)
{
foreach
(
$headlines
as
$file
=>
$headline
)
{
// if (!isset($nav[$namespace])) {
// if (!isset($nav[$namespace])) {
// $nav[$namespace] = [
// $nav[$namespace] = [
// 'label' => $namespace,
// 'label' => $namespace,
...
...
extensions/apidoc/templates/bootstrap/layouts/main.php
View file @
1982efbd
...
@@ -46,7 +46,7 @@ $this->beginPage();
...
@@ -46,7 +46,7 @@ $this->beginPage();
'view'
=>
$this
,
'view'
=>
$this
,
]);
]);
$extItems
=
[];
$extItems
=
[];
foreach
(
$this
->
context
->
extensions
as
$ext
)
{
foreach
(
$this
->
context
->
extensions
as
$ext
)
{
$extItems
[]
=
[
$extItems
[]
=
[
'label'
=>
$ext
,
'label'
=>
$ext
,
'url'
=>
"./ext_
{
$ext
}
_index.html"
,
'url'
=>
"./ext_
{
$ext
}
_index.html"
,
...
...
extensions/apidoc/templates/bootstrap/views/index.php
View file @
1982efbd
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
/**
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var yii\web\View $this
* @var yii\web\View $this
...
@@ -26,7 +27,7 @@ if (isset($readme)) {
...
@@ -26,7 +27,7 @@ if (isset($readme)) {
</tr>
</tr>
<?php
<?php
ksort
(
$types
);
ksort
(
$types
);
foreach
(
$types
as
$i
=>
$class
)
:
foreach
(
$types
as
$i
=>
$class
)
:
?>
?>
<tr>
<tr>
<td>
<?=
$this
->
context
->
typeLink
(
$class
,
$class
->
name
)
?>
</td>
<td>
<?=
$this
->
context
->
typeLink
(
$class
,
$class
->
name
)
?>
</td>
...
...
extensions/apidoc/templates/html/Renderer.php
View file @
1982efbd
...
@@ -105,7 +105,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -105,7 +105,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$typeCount
=
count
(
$types
)
+
1
;
$typeCount
=
count
(
$types
)
+
1
;
Console
::
startProgress
(
0
,
$typeCount
,
'Rendering files: '
,
false
);
Console
::
startProgress
(
0
,
$typeCount
,
'Rendering files: '
,
false
);
$done
=
0
;
$done
=
0
;
foreach
(
$types
as
$type
)
{
foreach
(
$types
as
$type
)
{
$fileContent
=
$this
->
renderWithLayout
(
$this
->
typeView
,
[
$fileContent
=
$this
->
renderWithLayout
(
$this
->
typeView
,
[
'type'
=>
$type
,
'type'
=>
$type
,
'docContext'
=>
$context
,
'docContext'
=>
$context
,
...
@@ -147,7 +147,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -147,7 +147,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$types
=
[
$types
];
$types
=
[
$types
];
}
}
$links
=
[];
$links
=
[];
foreach
(
$types
as
$type
)
{
foreach
(
$types
as
$type
)
{
$postfix
=
''
;
$postfix
=
''
;
if
(
!
is_object
(
$type
))
{
if
(
!
is_object
(
$type
))
{
if
(
substr
(
$type
,
-
2
,
2
)
==
'[]'
)
{
if
(
substr
(
$type
,
-
2
,
2
)
==
'[]'
)
{
...
@@ -235,7 +235,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -235,7 +235,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
$parents
=
[];
$parents
=
[];
$parents
[]
=
$this
->
typeLink
(
$class
);
$parents
[]
=
$this
->
typeLink
(
$class
);
while
(
$class
->
parentClass
!==
null
)
{
while
(
$class
->
parentClass
!==
null
)
{
if
(
isset
(
$this
->
context
->
classes
[
$class
->
parentClass
]))
{
if
(
isset
(
$this
->
context
->
classes
[
$class
->
parentClass
]))
{
$class
=
$this
->
context
->
classes
[
$class
->
parentClass
];
$class
=
$this
->
context
->
classes
[
$class
->
parentClass
];
$parents
[]
=
$this
->
typeLink
(
$class
);
$parents
[]
=
$this
->
typeLink
(
$class
);
}
else
{
}
else
{
...
@@ -254,8 +254,8 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -254,8 +254,8 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
{
{
$interfaces
=
[];
$interfaces
=
[];
sort
(
$names
,
SORT_STRING
);
sort
(
$names
,
SORT_STRING
);
foreach
(
$names
as
$interface
)
{
foreach
(
$names
as
$interface
)
{
if
(
isset
(
$this
->
context
->
interfaces
[
$interface
]))
{
if
(
isset
(
$this
->
context
->
interfaces
[
$interface
]))
{
$interfaces
[]
=
$this
->
typeLink
(
$this
->
context
->
interfaces
[
$interface
]);
$interfaces
[]
=
$this
->
typeLink
(
$this
->
context
->
interfaces
[
$interface
]);
}
else
{
}
else
{
$interfaces
[]
=
$interface
;
// TODO link to php.net
$interfaces
[]
=
$interface
;
// TODO link to php.net
...
@@ -272,8 +272,8 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -272,8 +272,8 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
{
{
$traits
=
[];
$traits
=
[];
sort
(
$names
,
SORT_STRING
);
sort
(
$names
,
SORT_STRING
);
foreach
(
$names
as
$trait
)
{
foreach
(
$names
as
$trait
)
{
if
(
isset
(
$this
->
context
->
traits
[
$trait
]))
{
if
(
isset
(
$this
->
context
->
traits
[
$trait
]))
{
$traits
[]
=
$this
->
typeLink
(
$this
->
context
->
traits
[
$trait
]);
$traits
[]
=
$this
->
typeLink
(
$this
->
context
->
traits
[
$trait
]);
}
else
{
}
else
{
$traits
[]
=
$trait
;
// TODO link to php.net
$traits
[]
=
$trait
;
// TODO link to php.net
...
@@ -290,8 +290,8 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -290,8 +290,8 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
{
{
$classes
=
[];
$classes
=
[];
sort
(
$names
,
SORT_STRING
);
sort
(
$names
,
SORT_STRING
);
foreach
(
$names
as
$class
)
{
foreach
(
$names
as
$class
)
{
if
(
isset
(
$this
->
context
->
classes
[
$class
]))
{
if
(
isset
(
$this
->
context
->
classes
[
$class
]))
{
$classes
[]
=
$this
->
typeLink
(
$this
->
context
->
classes
[
$class
]);
$classes
[]
=
$this
->
typeLink
(
$this
->
context
->
classes
[
$class
]);
}
else
{
}
else
{
$classes
[]
=
$class
;
// TODO link to php.net
$classes
[]
=
$class
;
// TODO link to php.net
...
@@ -326,7 +326,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
...
@@ -326,7 +326,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
public
function
renderMethodSignature
(
$method
)
public
function
renderMethodSignature
(
$method
)
{
{
$params
=
[];
$params
=
[];
foreach
(
$method
->
params
as
$param
)
{
foreach
(
$method
->
params
as
$param
)
{
$params
[]
=
(
empty
(
$param
->
typeHint
)
?
''
:
$param
->
typeHint
.
' '
)
$params
[]
=
(
empty
(
$param
->
typeHint
)
?
''
:
$param
->
typeHint
.
' '
)
.
(
$param
->
isPassedByReference
?
'<b>&</b>'
:
''
)
.
(
$param
->
isPassedByReference
?
'<b>&</b>'
:
''
)
.
$param
->
name
.
$param
->
name
...
...
extensions/apidoc/templates/html/views/seeAlso.php
View file @
1982efbd
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
$see
=
[];
$see
=
[];
foreach
(
$object
->
tags
as
$tag
)
{
foreach
(
$object
->
tags
as
$tag
)
{
/** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
/** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
if
(
get_class
(
$tag
)
==
'phpDocumentor\Reflection\DocBlock\Tag\SeeTag'
)
{
if
(
get_class
(
$tag
)
==
'phpDocumentor\Reflection\DocBlock\Tag\SeeTag'
)
{
$ref
=
$tag
->
getReference
();
$ref
=
$tag
->
getReference
();
...
...
extensions/apidoc/templates/html/views/type.php
View file @
1982efbd
...
@@ -4,6 +4,7 @@ use yii\apidoc\helpers\ApiMarkdown;
...
@@ -4,6 +4,7 @@ use yii\apidoc\helpers\ApiMarkdown;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $type
* @var ClassDoc|InterfaceDoc|TraitDoc $type
* @var yii\web\View $this
* @var yii\web\View $this
...
@@ -82,8 +83,8 @@ $renderer = $this->context;
...
@@ -82,8 +83,8 @@ $renderer = $this->context;
</div>
</div>
<a
name=
"properties"
></a>
<a
name=
"properties"
></a>
<?=
$this
->
render
(
'@yii/apidoc/templates/html/views/propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'@yii/apidoc/templates/html/views/propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'@yii/apidoc/templates/html/views/propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<?=
$this
->
render
(
'@yii/apidoc/templates/html/views/propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<a
name=
"methods"
></a>
<a
name=
"methods"
></a>
<?=
$this
->
render
(
'@yii/apidoc/templates/html/views/methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'@yii/apidoc/templates/html/views/methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
...
...
extensions/apidoc/templates/offline/Renderer.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\apidoc\templates\offline
;
namespace
yii\apidoc\templates\offline
;
use
Yii
;
use
Yii
;
/**
/**
...
@@ -19,4 +20,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -19,4 +20,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
public
$indexView
=
'@yii/apidoc/templates/offline/views/index.php'
;
public
$indexView
=
'@yii/apidoc/templates/offline/views/index.php'
;
public
$pageTitle
=
'Yii Framework 2.0 API Documentation'
;
public
$pageTitle
=
'Yii Framework 2.0 API Documentation'
;
}
}
\ No newline at end of file
extensions/apidoc/templates/offline/assets/AssetBundle.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\apidoc\templates\offline\assets
;
namespace
yii\apidoc\templates\offline\assets
;
use
yii\web\View
;
use
yii\web\View
;
/**
/**
...
...
extensions/apidoc/templates/offline/views/index.php
View file @
1982efbd
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
/**
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var yii\web\View $this
* @var yii\web\View $this
...
@@ -22,7 +23,7 @@ use yii\apidoc\models\TraitDoc;
...
@@ -22,7 +23,7 @@ use yii\apidoc\models\TraitDoc;
</tr>
</tr>
<?php
<?php
ksort
(
$types
);
ksort
(
$types
);
foreach
(
$types
as
$i
=>
$class
)
:
foreach
(
$types
as
$i
=>
$class
)
:
?>
?>
<tr>
<tr>
<td>
<?=
$this
->
context
->
typeLink
(
$class
,
$class
->
name
)
?>
</td>
<td>
<?=
$this
->
context
->
typeLink
(
$class
,
$class
->
name
)
?>
</td>
...
...
extensions/apidoc/templates/online/Renderer.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\apidoc\templates\online
;
namespace
yii\apidoc\templates\online
;
use
yii\apidoc\models\Context
;
use
yii\apidoc\models\Context
;
use
yii\apidoc\models\TypeDoc
;
use
yii\apidoc\models\TypeDoc
;
use
yii\console\Controller
;
use
yii\console\Controller
;
...
@@ -37,7 +38,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -37,7 +38,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
$controller
->
stdout
(
"writing packages file..."
);
$controller
->
stdout
(
"writing packages file..."
);
$packages
=
[];
$packages
=
[];
$notNamespaced
=
[];
$notNamespaced
=
[];
foreach
(
array_merge
(
$context
->
classes
,
$context
->
interfaces
,
$context
->
traits
)
as
$type
)
{
foreach
(
array_merge
(
$context
->
classes
,
$context
->
interfaces
,
$context
->
traits
)
as
$type
)
{
/** @var TypeDoc $type */
/** @var TypeDoc $type */
if
(
empty
(
$type
->
namespace
))
{
if
(
empty
(
$type
->
namespace
))
{
$notNamespaced
[]
=
str_replace
(
'\\'
,
'-'
,
$type
->
name
);
$notNamespaced
[]
=
str_replace
(
'\\'
,
'-'
,
$type
->
name
);
...
@@ -47,7 +48,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -47,7 +48,7 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
}
}
ksort
(
$packages
);
ksort
(
$packages
);
$packages
=
array_merge
([
'Not namespaced'
=>
$notNamespaced
],
$packages
);
$packages
=
array_merge
([
'Not namespaced'
=>
$notNamespaced
],
$packages
);
foreach
(
$packages
as
$name
=>
$classes
)
{
foreach
(
$packages
as
$name
=>
$classes
)
{
sort
(
$packages
[
$name
]);
sort
(
$packages
[
$name
]);
}
}
file_put_contents
(
$dir
.
'/packages.txt'
,
serialize
(
$packages
));
file_put_contents
(
$dir
.
'/packages.txt'
,
serialize
(
$packages
));
...
@@ -63,4 +64,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
...
@@ -63,4 +64,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
{
{
return
$this
->
generateUrl
(
$typeName
)
.
'.html'
;
return
$this
->
generateUrl
(
$typeName
)
.
'.html'
;
}
}
}
}
\ No newline at end of file
extensions/apidoc/templates/online/views/index.php
View file @
1982efbd
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
/**
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $types
* @var yii\web\View $this
* @var yii\web\View $this
...
@@ -22,7 +23,7 @@ use yii\apidoc\models\TraitDoc;
...
@@ -22,7 +23,7 @@ use yii\apidoc\models\TraitDoc;
</tr>
</tr>
<?php
<?php
ksort
(
$types
);
ksort
(
$types
);
foreach
(
$types
as
$i
=>
$class
)
:
foreach
(
$types
as
$i
=>
$class
)
:
?>
?>
<tr>
<tr>
<td>
<?=
$this
->
context
->
typeLink
(
$class
,
$class
->
name
)
?>
</td>
<td>
<?=
$this
->
context
->
typeLink
(
$class
,
$class
->
name
)
?>
</td>
...
...
extensions/authclient/AuthAction.php
View file @
1982efbd
...
@@ -359,4 +359,4 @@ class AuthAction extends Action
...
@@ -359,4 +359,4 @@ class AuthAction extends Action
return
Yii
::
$app
->
getResponse
()
->
redirect
(
$url
);
return
Yii
::
$app
->
getResponse
()
->
redirect
(
$url
);
}
}
}
}
}
}
\ No newline at end of file
extensions/authclient/BaseClient.php
View file @
1982efbd
...
@@ -233,4 +233,4 @@ abstract class BaseClient extends Component implements ClientInterface
...
@@ -233,4 +233,4 @@ abstract class BaseClient extends Component implements ClientInterface
}
}
return
$attributes
;
return
$attributes
;
}
}
}
}
\ No newline at end of file
extensions/authclient/ClientInterface.php
View file @
1982efbd
...
@@ -54,4 +54,4 @@ interface ClientInterface
...
@@ -54,4 +54,4 @@ interface ClientInterface
* @return array view options in format: optionName => optionValue
* @return array view options in format: optionName => optionValue
*/
*/
public
function
getViewOptions
();
public
function
getViewOptions
();
}
}
\ No newline at end of file
extensions/authclient/Collection.php
View file @
1982efbd
...
@@ -104,4 +104,4 @@ class Collection extends Component
...
@@ -104,4 +104,4 @@ class Collection extends Component
$config
[
'id'
]
=
$id
;
$config
[
'id'
]
=
$id
;
return
Yii
::
createObject
(
$config
);
return
Yii
::
createObject
(
$config
);
}
}
}
}
\ No newline at end of file
extensions/authclient/OAuth1.php
View file @
1982efbd
...
@@ -175,7 +175,7 @@ class OAuth1 extends BaseOAuth
...
@@ -175,7 +175,7 @@ class OAuth1 extends BaseOAuth
}
}
case
'POST'
:
{
case
'POST'
:
{
$curlOptions
[
CURLOPT_POST
]
=
true
;
$curlOptions
[
CURLOPT_POST
]
=
true
;
if
(
!
empty
(
$params
)){
if
(
!
empty
(
$params
))
{
$curlOptions
[
CURLOPT_POSTFIELDS
]
=
$params
;
$curlOptions
[
CURLOPT_POSTFIELDS
]
=
$params
;
}
}
$authorizationHeader
=
$this
->
composeAuthorizationHeader
(
$params
);
$authorizationHeader
=
$this
->
composeAuthorizationHeader
(
$params
);
...
@@ -352,4 +352,4 @@ class OAuth1 extends BaseOAuth
...
@@ -352,4 +352,4 @@ class OAuth1 extends BaseOAuth
}
}
return
$header
;
return
$header
;
}
}
}
}
\ No newline at end of file
extensions/authclient/OAuth2.php
View file @
1982efbd
...
@@ -182,4 +182,4 @@ class OAuth2 extends BaseOAuth
...
@@ -182,4 +182,4 @@ class OAuth2 extends BaseOAuth
$tokenConfig
[
'tokenParamKey'
]
=
'access_token'
;
$tokenConfig
[
'tokenParamKey'
]
=
'access_token'
;
return
parent
::
createToken
(
$tokenConfig
);
return
parent
::
createToken
(
$tokenConfig
);
}
}
}
}
\ No newline at end of file
extensions/authclient/OAuthToken.php
View file @
1982efbd
...
@@ -58,14 +58,16 @@ class OAuthToken extends Object
...
@@ -58,14 +58,16 @@ class OAuthToken extends Object
/**
/**
* @param string $expireDurationParamKey expire duration param key.
* @param string $expireDurationParamKey expire duration param key.
*/
*/
public
function
setExpireDurationParamKey
(
$expireDurationParamKey
)
{
public
function
setExpireDurationParamKey
(
$expireDurationParamKey
)
{
$this
->
_expireDurationParamKey
=
$expireDurationParamKey
;
$this
->
_expireDurationParamKey
=
$expireDurationParamKey
;
}
}
/**
/**
* @return string expire duration param key.
* @return string expire duration param key.
*/
*/
public
function
getExpireDurationParamKey
()
{
public
function
getExpireDurationParamKey
()
{
if
(
$this
->
_expireDurationParamKey
===
null
)
{
if
(
$this
->
_expireDurationParamKey
===
null
)
{
$this
->
_expireDurationParamKey
=
$this
->
defaultExpireDurationParamKey
();
$this
->
_expireDurationParamKey
=
$this
->
defaultExpireDurationParamKey
();
}
}
...
@@ -75,14 +77,16 @@ class OAuthToken extends Object
...
@@ -75,14 +77,16 @@ class OAuthToken extends Object
/**
/**
* @return array
* @return array
*/
*/
public
function
getParams
()
{
public
function
getParams
()
{
return
$this
->
_params
;
return
$this
->
_params
;
}
}
/**
/**
* @param array $params
* @param array $params
*/
*/
public
function
setParams
(
array
$params
)
{
public
function
setParams
(
array
$params
)
{
$this
->
_params
=
$params
;
$this
->
_params
=
$params
;
}
}
...
@@ -91,7 +95,8 @@ class OAuthToken extends Object
...
@@ -91,7 +95,8 @@ class OAuthToken extends Object
* @param string $name param name.
* @param string $name param name.
* @param mixed $value param value,
* @param mixed $value param value,
*/
*/
public
function
setParam
(
$name
,
$value
)
{
public
function
setParam
(
$name
,
$value
)
{
$this
->
_params
[
$name
]
=
$value
;
$this
->
_params
[
$name
]
=
$value
;
}
}
...
@@ -100,7 +105,8 @@ class OAuthToken extends Object
...
@@ -100,7 +105,8 @@ class OAuthToken extends Object
* @param string $name param name.
* @param string $name param name.
* @return mixed param value.
* @return mixed param value.
*/
*/
public
function
getParam
(
$name
)
{
public
function
getParam
(
$name
)
{
return
isset
(
$this
->
_params
[
$name
])
?
$this
->
_params
[
$name
]
:
null
;
return
isset
(
$this
->
_params
[
$name
])
?
$this
->
_params
[
$name
]
:
null
;
}
}
...
@@ -109,7 +115,8 @@ class OAuthToken extends Object
...
@@ -109,7 +115,8 @@ class OAuthToken extends Object
* @param string $token token value.
* @param string $token token value.
* @return static self reference.
* @return static self reference.
*/
*/
public
function
setToken
(
$token
)
{
public
function
setToken
(
$token
)
{
$this
->
setParam
(
$this
->
tokenParamKey
,
$token
);
$this
->
setParam
(
$this
->
tokenParamKey
,
$token
);
}
}
...
@@ -117,7 +124,8 @@ class OAuthToken extends Object
...
@@ -117,7 +124,8 @@ class OAuthToken extends Object
* Returns token value.
* Returns token value.
* @return string token value.
* @return string token value.
*/
*/
public
function
getToken
()
{
public
function
getToken
()
{
return
$this
->
getParam
(
$this
->
tokenParamKey
);
return
$this
->
getParam
(
$this
->
tokenParamKey
);
}
}
...
@@ -125,7 +133,8 @@ class OAuthToken extends Object
...
@@ -125,7 +133,8 @@ class OAuthToken extends Object
* Sets the token secret value.
* Sets the token secret value.
* @param string $tokenSecret token secret.
* @param string $tokenSecret token secret.
*/
*/
public
function
setTokenSecret
(
$tokenSecret
)
{
public
function
setTokenSecret
(
$tokenSecret
)
{
$this
->
setParam
(
$this
->
tokenSecretParamKey
,
$tokenSecret
);
$this
->
setParam
(
$this
->
tokenSecretParamKey
,
$tokenSecret
);
}
}
...
@@ -133,7 +142,8 @@ class OAuthToken extends Object
...
@@ -133,7 +142,8 @@ class OAuthToken extends Object
* Returns the token secret value.
* Returns the token secret value.
* @return string token secret value.
* @return string token secret value.
*/
*/
public
function
getTokenSecret
()
{
public
function
getTokenSecret
()
{
return
$this
->
getParam
(
$this
->
tokenSecretParamKey
);
return
$this
->
getParam
(
$this
->
tokenSecretParamKey
);
}
}
...
@@ -141,7 +151,8 @@ class OAuthToken extends Object
...
@@ -141,7 +151,8 @@ class OAuthToken extends Object
* Sets token expire duration.
* Sets token expire duration.
* @param string $expireDuration token expiration duration.
* @param string $expireDuration token expiration duration.
*/
*/
public
function
setExpireDuration
(
$expireDuration
)
{
public
function
setExpireDuration
(
$expireDuration
)
{
$this
->
setParam
(
$this
->
getExpireDurationParamKey
(),
$expireDuration
);
$this
->
setParam
(
$this
->
getExpireDurationParamKey
(),
$expireDuration
);
}
}
...
@@ -149,7 +160,8 @@ class OAuthToken extends Object
...
@@ -149,7 +160,8 @@ class OAuthToken extends Object
* Returns the token expiration duration.
* Returns the token expiration duration.
* @return integer token expiration duration.
* @return integer token expiration duration.
*/
*/
public
function
getExpireDuration
()
{
public
function
getExpireDuration
()
{
return
$this
->
getParam
(
$this
->
getExpireDurationParamKey
());
return
$this
->
getParam
(
$this
->
getExpireDurationParamKey
());
}
}
...
@@ -157,7 +169,8 @@ class OAuthToken extends Object
...
@@ -157,7 +169,8 @@ class OAuthToken extends Object
* Fetches default expire duration param key.
* Fetches default expire duration param key.
* @return string expire duration param key.
* @return string expire duration param key.
*/
*/
protected
function
defaultExpireDurationParamKey
()
{
protected
function
defaultExpireDurationParamKey
()
{
$expireDurationParamKey
=
'expires_in'
;
$expireDurationParamKey
=
'expires_in'
;
foreach
(
$this
->
getParams
()
as
$name
=>
$value
)
{
foreach
(
$this
->
getParams
()
as
$name
=>
$value
)
{
if
(
strpos
(
$name
,
'expir'
)
!==
false
)
{
if
(
strpos
(
$name
,
'expir'
)
!==
false
)
{
...
@@ -172,7 +185,8 @@ class OAuthToken extends Object
...
@@ -172,7 +185,8 @@ class OAuthToken extends Object
* Checks if token has expired.
* Checks if token has expired.
* @return boolean is token expired.
* @return boolean is token expired.
*/
*/
public
function
getIsExpired
()
{
public
function
getIsExpired
()
{
$expirationDuration
=
$this
->
getExpireDuration
();
$expirationDuration
=
$this
->
getExpireDuration
();
if
(
empty
(
$expirationDuration
))
{
if
(
empty
(
$expirationDuration
))
{
return
false
;
return
false
;
...
@@ -184,8 +198,9 @@ class OAuthToken extends Object
...
@@ -184,8 +198,9 @@ class OAuthToken extends Object
* Checks if token is valid.
* Checks if token is valid.
* @return boolean is token valid.
* @return boolean is token valid.
*/
*/
public
function
getIsValid
()
{
public
function
getIsValid
()
{
$token
=
$this
->
getToken
();
$token
=
$this
->
getToken
();
return
(
!
empty
(
$token
)
&&
!
$this
->
getIsExpired
());
return
(
!
empty
(
$token
)
&&
!
$this
->
getIsExpired
());
}
}
}
}
\ No newline at end of file
extensions/authclient/OpenId.php
View file @
1982efbd
...
@@ -243,10 +243,10 @@ class OpenId extends BaseClient implements ClientInterface
...
@@ -243,10 +243,10 @@ class OpenId extends BaseClient implements ClientInterface
if
(
$this
->
verifyPeer
!==
null
)
{
if
(
$this
->
verifyPeer
!==
null
)
{
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
$this
->
verifyPeer
);
curl_setopt
(
$curl
,
CURLOPT_SSL_VERIFYPEER
,
$this
->
verifyPeer
);
if
(
$this
->
capath
)
{
if
(
$this
->
capath
)
{
curl_setopt
(
$curl
,
CURLOPT_CAPATH
,
$this
->
capath
);
curl_setopt
(
$curl
,
CURLOPT_CAPATH
,
$this
->
capath
);
}
}
if
(
$this
->
cainfo
)
{
if
(
$this
->
cainfo
)
{
curl_setopt
(
$curl
,
CURLOPT_CAINFO
,
$this
->
cainfo
);
curl_setopt
(
$curl
,
CURLOPT_CAINFO
,
$this
->
cainfo
);
}
}
}
}
...
@@ -926,4 +926,4 @@ class OpenId extends BaseClient implements ClientInterface
...
@@ -926,4 +926,4 @@ class OpenId extends BaseClient implements ClientInterface
{
{
return
array_merge
([
'id'
=>
$this
->
getClaimedId
()],
$this
->
fetchAttributes
());
return
array_merge
([
'id'
=>
$this
->
getClaimedId
()],
$this
->
fetchAttributes
());
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/Facebook.php
View file @
1982efbd
...
@@ -80,4 +80,4 @@ class Facebook extends OAuth2
...
@@ -80,4 +80,4 @@ class Facebook extends OAuth2
{
{
return
'Facebook'
;
return
'Facebook'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/GitHub.php
View file @
1982efbd
...
@@ -90,4 +90,4 @@ class GitHub extends OAuth2
...
@@ -90,4 +90,4 @@ class GitHub extends OAuth2
{
{
return
'GitHub'
;
return
'GitHub'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/GoogleOAuth.php
View file @
1982efbd
...
@@ -90,4 +90,4 @@ class GoogleOAuth extends OAuth2
...
@@ -90,4 +90,4 @@ class GoogleOAuth extends OAuth2
{
{
return
'Google'
;
return
'Google'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/GoogleOpenId.php
View file @
1982efbd
...
@@ -87,4 +87,4 @@ class GoogleOpenId extends OpenId
...
@@ -87,4 +87,4 @@ class GoogleOpenId extends OpenId
{
{
return
'Google'
;
return
'Google'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/LinkedIn.php
View file @
1982efbd
...
@@ -147,7 +147,8 @@ class LinkedIn extends OAuth2
...
@@ -147,7 +147,8 @@ class LinkedIn extends OAuth2
* Generates the auth state value.
* Generates the auth state value.
* @return string auth state value.
* @return string auth state value.
*/
*/
protected
function
generateAuthState
()
{
protected
function
generateAuthState
()
{
return
sha1
(
uniqid
(
get_class
(
$this
),
true
));
return
sha1
(
uniqid
(
get_class
(
$this
),
true
));
}
}
...
@@ -166,4 +167,4 @@ class LinkedIn extends OAuth2
...
@@ -166,4 +167,4 @@ class LinkedIn extends OAuth2
{
{
return
'LinkedIn'
;
return
'LinkedIn'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/Twitter.php
View file @
1982efbd
...
@@ -88,4 +88,4 @@ class Twitter extends OAuth1
...
@@ -88,4 +88,4 @@ class Twitter extends OAuth1
{
{
return
'Twitter'
;
return
'Twitter'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/YandexOAuth.php
View file @
1982efbd
...
@@ -88,4 +88,4 @@ class YandexOAuth extends OAuth2
...
@@ -88,4 +88,4 @@ class YandexOAuth extends OAuth2
{
{
return
'Yandex'
;
return
'Yandex'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/clients/YandexOpenId.php
View file @
1982efbd
...
@@ -83,4 +83,4 @@ class YandexOpenId extends OpenId
...
@@ -83,4 +83,4 @@ class YandexOpenId extends OpenId
{
{
return
'Yandex'
;
return
'Yandex'
;
}
}
}
}
\ No newline at end of file
extensions/authclient/signature/BaseMethod.php
View file @
1982efbd
...
@@ -46,4 +46,4 @@ abstract class BaseMethod extends Object
...
@@ -46,4 +46,4 @@ abstract class BaseMethod extends Object
}
}
return
(
strcmp
(
$expectedSignature
,
$signature
)
===
0
);
return
(
strcmp
(
$expectedSignature
,
$signature
)
===
0
);
}
}
}
}
\ No newline at end of file
extensions/authclient/signature/HmacSha1.php
View file @
1982efbd
...
@@ -44,4 +44,4 @@ class HmacSha1 extends BaseMethod
...
@@ -44,4 +44,4 @@ class HmacSha1 extends BaseMethod
{
{
return
base64_encode
(
hash_hmac
(
'sha1'
,
$baseString
,
$key
,
true
));
return
base64_encode
(
hash_hmac
(
'sha1'
,
$baseString
,
$key
,
true
));
}
}
}
}
\ No newline at end of file
extensions/authclient/signature/PlainText.php
View file @
1982efbd
...
@@ -30,4 +30,4 @@ class PlainText extends BaseMethod
...
@@ -30,4 +30,4 @@ class PlainText extends BaseMethod
{
{
return
$key
;
return
$key
;
}
}
}
}
\ No newline at end of file
extensions/authclient/signature/RsaSha1.php
View file @
1982efbd
...
@@ -165,4 +165,4 @@ class RsaSha1 extends BaseMethod
...
@@ -165,4 +165,4 @@ class RsaSha1 extends BaseMethod
openssl_free_key
(
$publicKeyId
);
openssl_free_key
(
$publicKeyId
);
return
(
$verificationResult
==
1
);
return
(
$verificationResult
==
1
);
}
}
}
}
\ No newline at end of file
extensions/authclient/widgets/ChoiceAsset.php
View file @
1982efbd
...
@@ -27,4 +27,4 @@ class ChoiceAsset extends AssetBundle
...
@@ -27,4 +27,4 @@ class ChoiceAsset extends AssetBundle
public
$depends
=
[
public
$depends
=
[
'yii\web\YiiAsset'
,
'yii\web\YiiAsset'
,
];
];
}
}
\ No newline at end of file
extensions/composer/Installer.php
View file @
1982efbd
...
@@ -192,7 +192,7 @@ class Installer extends LibraryInstaller
...
@@ -192,7 +192,7 @@ class Installer extends LibraryInstaller
if
(
!
file_exists
(
$yiiDir
))
{
if
(
!
file_exists
(
$yiiDir
))
{
mkdir
(
$yiiDir
,
0777
,
true
);
mkdir
(
$yiiDir
,
0777
,
true
);
}
}
foreach
([
'Yii.php'
,
'BaseYii.php'
,
'classes.php'
]
as
$file
)
{
foreach
([
'Yii.php'
,
'BaseYii.php'
,
'classes.php'
]
as
$file
)
{
file_put_contents
(
$yiiDir
.
'/'
.
$file
,
<<<EOF
file_put_contents
(
$yiiDir
.
'/'
.
$file
,
<<<EOF
<?php
<?php
/**
/**
...
@@ -213,7 +213,7 @@ EOF
...
@@ -213,7 +213,7 @@ EOF
protected
function
removeBaseYiiFiles
()
protected
function
removeBaseYiiFiles
()
{
{
$yiiDir
=
$this
->
vendorDir
.
'/yiisoft/yii2'
;
$yiiDir
=
$this
->
vendorDir
.
'/yiisoft/yii2'
;
foreach
([
'Yii.php'
,
'BaseYii.php'
,
'classes.php'
]
as
$file
)
{
foreach
([
'Yii.php'
,
'BaseYii.php'
,
'classes.php'
]
as
$file
)
{
if
(
file_exists
(
$yiiDir
.
'/'
.
$file
))
{
if
(
file_exists
(
$yiiDir
.
'/'
.
$file
))
{
unlink
(
$yiiDir
.
'/'
.
$file
);
unlink
(
$yiiDir
.
'/'
.
$file
);
}
}
...
...
extensions/debug/LogTarget.php
View file @
1982efbd
...
@@ -168,5 +168,4 @@ class LogTarget extends Target
...
@@ -168,5 +168,4 @@ class LogTarget extends Target
# / 2 because messages are in couple (begin/end)
# / 2 because messages are in couple (begin/end)
return
count
(
$profileLogs
)
/
2
;
return
count
(
$profileLogs
)
/
2
;
}
}
}
}
extensions/debug/components/search/matchers/Base.php
View file @
1982efbd
...
@@ -37,5 +37,4 @@ abstract class Base extends Component implements MatcherInterface
...
@@ -37,5 +37,4 @@ abstract class Base extends Component implements MatcherInterface
{
{
return
!
empty
(
$this
->
baseValue
)
||
(
$this
->
baseValue
===
'0'
);
return
!
empty
(
$this
->
baseValue
)
||
(
$this
->
baseValue
===
'0'
);
}
}
}
}
extensions/debug/panels/DbPanel.php
View file @
1982efbd
...
@@ -175,5 +175,4 @@ class DbPanel extends Panel
...
@@ -175,5 +175,4 @@ class DbPanel extends Panel
{
{
return
((
$this
->
criticalQueryThreshold
!==
null
)
&&
(
$count
>
$this
->
criticalQueryThreshold
));
return
((
$this
->
criticalQueryThreshold
!==
null
)
&&
(
$count
>
$this
->
criticalQueryThreshold
));
}
}
}
}
extensions/debug/panels/MailPanel.php
View file @
1982efbd
...
@@ -102,5 +102,4 @@ class MailPanel extends Panel
...
@@ -102,5 +102,4 @@ class MailPanel extends Panel
}
}
return
$attr
;
return
$attr
;
}
}
}
}
extensions/debug/views/default/panels/config/detail.php
View file @
1982efbd
...
@@ -35,4 +35,3 @@ echo $this->render('panels/config/table', [
...
@@ -35,4 +35,3 @@ echo $this->render('panels/config/table', [
]);
]);
echo
$panel
->
getPhpInfo
();
echo
$panel
->
getPhpInfo
();
?>
\ No newline at end of file
extensions/debug/views/default/panels/db/detail.php
View file @
1982efbd
...
@@ -67,4 +67,3 @@ echo GridView::widget([
...
@@ -67,4 +67,3 @@ echo GridView::widget([
]
]
],
],
]);
]);
?>
extensions/debug/views/default/panels/log/detail.php
View file @
1982efbd
...
@@ -70,4 +70,3 @@ echo GridView::widget([
...
@@ -70,4 +70,3 @@ echo GridView::widget([
],
],
],
],
]);
]);
?>
extensions/debug/views/default/panels/profile/detail.php
View file @
1982efbd
<?php
<?php
use
yii\grid\GridView
;
use
yii\grid\GridView
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
?>
?>
<h1>
Performance Profiling
</h1>
<h1>
Performance Profiling
</h1>
<p>
Total processing time:
<b>
<?=
$time
?>
</b>
; Peak memory:
<b>
<?=
$memory
?>
</b>
.
</p>
<p>
Total processing time:
<b>
<?=
$time
?>
</b>
; Peak memory:
<b>
<?=
$memory
?>
</b>
.
</p>
...
@@ -50,4 +51,3 @@ echo GridView::widget([
...
@@ -50,4 +51,3 @@ echo GridView::widget([
],
],
],
],
]);
]);
?>
extensions/elasticsearch/ActiveQuery.php
View file @
1982efbd
...
@@ -156,7 +156,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -156,7 +156,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
}
$models
=
$this
->
createModels
(
$result
[
'hits'
][
'hits'
]);
$models
=
$this
->
createModels
(
$result
[
'hits'
][
'hits'
]);
if
(
$this
->
asArray
&&
!
$this
->
indexBy
)
{
if
(
$this
->
asArray
&&
!
$this
->
indexBy
)
{
foreach
(
$models
as
$key
=>
$model
)
{
foreach
(
$models
as
$key
=>
$model
)
{
if
(
$pk
===
'_id'
)
{
if
(
$pk
===
'_id'
)
{
$model
[
'_source'
][
'_id'
]
=
$model
[
'_id'
];
$model
[
'_source'
][
'_id'
]
=
$model
[
'_id'
];
}
}
...
@@ -168,7 +168,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -168,7 +168,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
$this
->
findWith
(
$this
->
with
,
$models
);
$this
->
findWith
(
$this
->
with
,
$models
);
}
}
if
(
!
$this
->
asArray
)
{
if
(
!
$this
->
asArray
)
{
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$model
->
afterFind
();
$model
->
afterFind
();
}
}
}
}
...
@@ -226,7 +226,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -226,7 +226,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
/** @var ActiveRecord $modelClass */
/** @var ActiveRecord $modelClass */
$modelClass
=
$this
->
modelClass
;
$modelClass
=
$this
->
modelClass
;
$pk
=
$modelClass
::
primaryKey
()[
0
];
$pk
=
$modelClass
::
primaryKey
()[
0
];
foreach
(
$models
as
$key
=>
$model
)
{
foreach
(
$models
as
$key
=>
$model
)
{
if
(
$pk
===
'_id'
)
{
if
(
$pk
===
'_id'
)
{
$model
[
'_source'
][
'_id'
]
=
$model
[
'_id'
];
$model
[
'_source'
][
'_id'
]
=
$model
[
'_id'
];
}
}
...
@@ -238,7 +238,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -238,7 +238,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
$this
->
findWith
(
$this
->
with
,
$models
);
$this
->
findWith
(
$this
->
with
,
$models
);
}
}
if
(
!
$this
->
asArray
)
{
if
(
!
$this
->
asArray
)
{
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$model
->
afterFind
();
$model
->
afterFind
();
}
}
}
}
...
...
extensions/elasticsearch/ActiveRecord.php
View file @
1982efbd
...
@@ -122,7 +122,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -122,7 +122,7 @@ class ActiveRecord extends BaseActiveRecord
$command
=
static
::
getDb
()
->
createCommand
();
$command
=
static
::
getDb
()
->
createCommand
();
$result
=
$command
->
mget
(
static
::
index
(),
static
::
type
(),
$primaryKeys
,
$options
);
$result
=
$command
->
mget
(
static
::
index
(),
static
::
type
(),
$primaryKeys
,
$options
);
$models
=
[];
$models
=
[];
foreach
(
$result
[
'docs'
]
as
$doc
)
{
foreach
(
$result
[
'docs'
]
as
$doc
)
{
if
(
$doc
[
'exists'
])
{
if
(
$doc
[
'exists'
])
{
$model
=
static
::
instantiate
(
$doc
);
$model
=
static
::
instantiate
(
$doc
);
static
::
populateRecord
(
$model
,
$doc
);
static
::
populateRecord
(
$model
,
$doc
);
...
@@ -422,7 +422,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -422,7 +422,7 @@ class ActiveRecord extends BaseActiveRecord
return
0
;
return
0
;
}
}
$bulk
=
''
;
$bulk
=
''
;
foreach
(
$primaryKeys
as
$pk
)
{
foreach
(
$primaryKeys
as
$pk
)
{
$action
=
Json
::
encode
([
$action
=
Json
::
encode
([
"update"
=>
[
"update"
=>
[
"_id"
=>
$pk
,
"_id"
=>
$pk
,
...
@@ -441,7 +441,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -441,7 +441,7 @@ class ActiveRecord extends BaseActiveRecord
$response
=
static
::
getDb
()
->
post
(
$url
,
[],
$bulk
);
$response
=
static
::
getDb
()
->
post
(
$url
,
[],
$bulk
);
$n
=
0
;
$n
=
0
;
$errors
=
[];
$errors
=
[];
foreach
(
$response
[
'items'
]
as
$item
)
{
foreach
(
$response
[
'items'
]
as
$item
)
{
if
(
isset
(
$item
[
'update'
][
'error'
]))
{
if
(
isset
(
$item
[
'update'
][
'error'
]))
{
$errors
[]
=
$item
[
'update'
];
$errors
[]
=
$item
[
'update'
];
}
elseif
(
$item
[
'update'
][
'ok'
])
{
}
elseif
(
$item
[
'update'
][
'ok'
])
{
...
@@ -480,7 +480,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -480,7 +480,7 @@ class ActiveRecord extends BaseActiveRecord
return
0
;
return
0
;
}
}
$bulk
=
''
;
$bulk
=
''
;
foreach
(
$primaryKeys
as
$pk
)
{
foreach
(
$primaryKeys
as
$pk
)
{
$action
=
Json
::
encode
([
$action
=
Json
::
encode
([
"update"
=>
[
"update"
=>
[
"_id"
=>
$pk
,
"_id"
=>
$pk
,
...
@@ -489,12 +489,12 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -489,12 +489,12 @@ class ActiveRecord extends BaseActiveRecord
],
],
]);
]);
$script
=
''
;
$script
=
''
;
foreach
(
$counters
as
$counter
=>
$value
)
{
foreach
(
$counters
as
$counter
=>
$value
)
{
$script
.=
"ctx._source.
$counter
+=
$counter
;
\n
"
;
$script
.=
"ctx._source.
$counter
+=
$counter
;
\n
"
;
}
}
$data
=
Json
::
encode
([
$data
=
Json
::
encode
([
"script"
=>
$script
,
"script"
=>
$script
,
"params"
=>
$counters
"params"
=>
$counters
]);
]);
$bulk
.=
$action
.
"
\n
"
.
$data
.
"
\n
"
;
$bulk
.=
$action
.
"
\n
"
.
$data
.
"
\n
"
;
}
}
...
@@ -504,7 +504,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -504,7 +504,7 @@ class ActiveRecord extends BaseActiveRecord
$response
=
static
::
getDb
()
->
post
(
$url
,
[],
$bulk
);
$response
=
static
::
getDb
()
->
post
(
$url
,
[],
$bulk
);
$n
=
0
;
$n
=
0
;
$errors
=
[];
$errors
=
[];
foreach
(
$response
[
'items'
]
as
$item
)
{
foreach
(
$response
[
'items'
]
as
$item
)
{
if
(
isset
(
$item
[
'update'
][
'error'
]))
{
if
(
isset
(
$item
[
'update'
][
'error'
]))
{
$errors
[]
=
$item
[
'update'
];
$errors
[]
=
$item
[
'update'
];
}
elseif
(
$item
[
'update'
][
'ok'
])
{
}
elseif
(
$item
[
'update'
][
'ok'
])
{
...
@@ -543,7 +543,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -543,7 +543,7 @@ class ActiveRecord extends BaseActiveRecord
return
0
;
return
0
;
}
}
$bulk
=
''
;
$bulk
=
''
;
foreach
(
$primaryKeys
as
$pk
)
{
foreach
(
$primaryKeys
as
$pk
)
{
$bulk
.=
Json
::
encode
([
$bulk
.=
Json
::
encode
([
"delete"
=>
[
"delete"
=>
[
"_id"
=>
$pk
,
"_id"
=>
$pk
,
...
@@ -558,7 +558,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -558,7 +558,7 @@ class ActiveRecord extends BaseActiveRecord
$response
=
static
::
getDb
()
->
post
(
$url
,
[],
$bulk
);
$response
=
static
::
getDb
()
->
post
(
$url
,
[],
$bulk
);
$n
=
0
;
$n
=
0
;
$errors
=
[];
$errors
=
[];
foreach
(
$response
[
'items'
]
as
$item
)
{
foreach
(
$response
[
'items'
]
as
$item
)
{
if
(
isset
(
$item
[
'delete'
][
'error'
]))
{
if
(
isset
(
$item
[
'delete'
][
'error'
]))
{
$errors
[]
=
$item
[
'delete'
];
$errors
[]
=
$item
[
'delete'
];
}
elseif
(
$item
[
'delete'
][
'found'
]
&&
$item
[
'delete'
][
'ok'
])
{
}
elseif
(
$item
[
'delete'
][
'found'
]
&&
$item
[
'delete'
][
'ok'
])
{
...
...
extensions/elasticsearch/Command.php
View file @
1982efbd
...
@@ -400,4 +400,4 @@ class Command extends Component
...
@@ -400,4 +400,4 @@ class Command extends Component
{
{
return
$this
->
db
->
get
([
'_template'
,
$name
]);
return
$this
->
db
->
get
([
'_template'
,
$name
]);
}
}
}
}
\ No newline at end of file
extensions/elasticsearch/Connection.php
View file @
1982efbd
...
@@ -63,7 +63,7 @@ class Connection extends Component
...
@@ -63,7 +63,7 @@ class Connection extends Component
public
function
init
()
public
function
init
()
{
{
foreach
(
$this
->
nodes
as
$node
)
{
foreach
(
$this
->
nodes
as
$node
)
{
if
(
!
isset
(
$node
[
'http_address'
]))
{
if
(
!
isset
(
$node
[
'http_address'
]))
{
throw
new
InvalidConfigException
(
'Elasticsearch node needs at least a http_address configured.'
);
throw
new
InvalidConfigException
(
'Elasticsearch node needs at least a http_address configured.'
);
}
}
...
@@ -210,7 +210,7 @@ class Connection extends Component
...
@@ -210,7 +210,7 @@ class Connection extends Component
private
function
createUrl
(
$path
,
$options
=
[])
private
function
createUrl
(
$path
,
$options
=
[])
{
{
if
(
!
is_string
(
$path
))
{
if
(
!
is_string
(
$path
))
{
$url
=
implode
(
'/'
,
array_map
(
function
(
$a
)
{
$url
=
implode
(
'/'
,
array_map
(
function
(
$a
)
{
return
urlencode
(
is_array
(
$a
)
?
implode
(
','
,
$a
)
:
$a
);
return
urlencode
(
is_array
(
$a
)
?
implode
(
','
,
$a
)
:
$a
);
},
$path
));
},
$path
));
if
(
!
empty
(
$options
))
{
if
(
!
empty
(
$options
))
{
...
@@ -240,12 +240,12 @@ class Connection extends Component
...
@@ -240,12 +240,12 @@ class Connection extends Component
// http://www.php.net/manual/en/function.curl-setopt.php#82418
// http://www.php.net/manual/en/function.curl-setopt.php#82418
CURLOPT_HTTPHEADER
=>
[
'Expect:'
],
CURLOPT_HTTPHEADER
=>
[
'Expect:'
],
CURLOPT_WRITEFUNCTION
=>
function
(
$curl
,
$data
)
use
(
&
$body
)
{
CURLOPT_WRITEFUNCTION
=>
function
(
$curl
,
$data
)
use
(
&
$body
)
{
$body
.=
$data
;
$body
.=
$data
;
return
mb_strlen
(
$data
,
'8bit'
);
return
mb_strlen
(
$data
,
'8bit'
);
},
},
CURLOPT_HEADERFUNCTION
=>
function
(
$curl
,
$data
)
use
(
&
$headers
)
{
CURLOPT_HEADERFUNCTION
=>
function
(
$curl
,
$data
)
use
(
&
$headers
)
{
foreach
(
explode
(
"
\r\n
"
,
$data
)
as
$row
)
{
foreach
(
explode
(
"
\r\n
"
,
$data
)
as
$row
)
{
if
((
$pos
=
strpos
(
$row
,
':'
))
!==
false
)
{
if
((
$pos
=
strpos
(
$row
,
':'
))
!==
false
)
{
$headers
[
strtolower
(
substr
(
$row
,
0
,
$pos
))]
=
trim
(
substr
(
$row
,
$pos
+
1
));
$headers
[
strtolower
(
substr
(
$row
,
0
,
$pos
))]
=
trim
(
substr
(
$row
,
$pos
+
1
));
}
}
...
@@ -355,4 +355,4 @@ class Connection extends Component
...
@@ -355,4 +355,4 @@ class Connection extends Component
{
{
return
$this
->
get
([
'_cluster'
,
'state'
]);
return
$this
->
get
([
'_cluster'
,
'state'
]);
}
}
}
}
\ No newline at end of file
extensions/elasticsearch/Exception.php
View file @
1982efbd
...
@@ -22,4 +22,4 @@ class Exception extends \yii\db\Exception
...
@@ -22,4 +22,4 @@ class Exception extends \yii\db\Exception
{
{
return
'Elasticsearch Database Exception'
;
return
'Elasticsearch Database Exception'
;
}
}
}
}
\ No newline at end of file
extensions/elasticsearch/Query.php
View file @
1982efbd
...
@@ -501,4 +501,4 @@ class Query extends Component implements QueryInterface
...
@@ -501,4 +501,4 @@ class Query extends Component implements QueryInterface
$this
->
timeout
=
$timeout
;
$this
->
timeout
=
$timeout
;
return
$this
;
return
$this
;
}
}
}
}
\ No newline at end of file
extensions/elasticsearch/QueryBuilder.php
View file @
1982efbd
...
@@ -177,7 +177,7 @@ class QueryBuilder extends \yii\base\Object
...
@@ -177,7 +177,7 @@ class QueryBuilder extends \yii\base\Object
private
function
buildHashCondition
(
$condition
)
private
function
buildHashCondition
(
$condition
)
{
{
$parts
=
[];
$parts
=
[];
foreach
(
$condition
as
$attribute
=>
$value
)
{
foreach
(
$condition
as
$attribute
=>
$value
)
{
if
(
$attribute
==
'_id'
)
{
if
(
$attribute
==
'_id'
)
{
if
(
$value
==
null
)
{
// there is no null pk
if
(
$value
==
null
)
{
// there is no null pk
$parts
[]
=
[
'script'
=>
[
'script'
=>
'0==1'
]];
$parts
[]
=
[
'script'
=>
[
'script'
=>
'0==1'
]];
...
...
extensions/gii/Generator.php
View file @
1982efbd
...
@@ -13,7 +13,6 @@ use yii\base\InvalidConfigException;
...
@@ -13,7 +13,6 @@ use yii\base\InvalidConfigException;
use
yii\base\Model
;
use
yii\base\Model
;
use
yii\web\View
;
use
yii\web\View
;
/**
/**
* This is the base class for all generator classes.
* This is the base class for all generator classes.
*
*
...
...
extensions/gii/components/DiffRendererHtmlInline.php
View file @
1982efbd
...
@@ -73,7 +73,7 @@ HTML;
...
@@ -73,7 +73,7 @@ HTML;
}
}
}
}
// Added lines only on the right side
// Added lines only on the right side
else
if
(
$change
[
'tag'
]
===
'insert'
)
{
elseif
(
$change
[
'tag'
]
===
'insert'
)
{
foreach
(
$change
[
'changed'
][
'lines'
]
as
$no
=>
$line
)
{
foreach
(
$change
[
'changed'
][
'lines'
]
as
$no
=>
$line
)
{
$toLine
=
$change
[
'changed'
][
'offset'
]
+
$no
+
1
;
$toLine
=
$change
[
'changed'
][
'offset'
]
+
$no
+
1
;
$html
.=
<<<HTML
$html
.=
<<<HTML
...
@@ -86,7 +86,7 @@ HTML;
...
@@ -86,7 +86,7 @@ HTML;
}
}
}
}
// Show deleted lines only on the left side
// Show deleted lines only on the left side
else
if
(
$change
[
'tag'
]
===
'delete'
)
{
elseif
(
$change
[
'tag'
]
===
'delete'
)
{
foreach
(
$change
[
'base'
][
'lines'
]
as
$no
=>
$line
)
{
foreach
(
$change
[
'base'
][
'lines'
]
as
$no
=>
$line
)
{
$fromLine
=
$change
[
'base'
][
'offset'
]
+
$no
+
1
;
$fromLine
=
$change
[
'base'
][
'offset'
]
+
$no
+
1
;
$html
.=
<<<HTML
$html
.=
<<<HTML
...
@@ -99,7 +99,7 @@ HTML;
...
@@ -99,7 +99,7 @@ HTML;
}
}
}
}
// Show modified lines on both sides
// Show modified lines on both sides
else
if
(
$change
[
'tag'
]
===
'replace'
)
{
elseif
(
$change
[
'tag'
]
===
'replace'
)
{
foreach
(
$change
[
'base'
][
'lines'
]
as
$no
=>
$line
)
{
foreach
(
$change
[
'base'
][
'lines'
]
as
$no
=>
$line
)
{
$fromLine
=
$change
[
'base'
][
'offset'
]
+
$no
+
1
;
$fromLine
=
$change
[
'base'
][
'offset'
]
+
$no
+
1
;
$html
.=
<<<HTML
$html
.=
<<<HTML
...
@@ -132,4 +132,4 @@ HTML;
...
@@ -132,4 +132,4 @@ HTML;
HTML;
HTML;
return
$html
;
return
$html
;
}
}
}
}
\ No newline at end of file
extensions/gii/generators/crud/Generator.php
View file @
1982efbd
...
@@ -499,5 +499,4 @@ class Generator extends \yii\gii\Generator
...
@@ -499,5 +499,4 @@ class Generator extends \yii\gii\Generator
return
$model
->
attributes
();
return
$model
->
attributes
();
}
}
}
}
}
}
extensions/jui/AutoCompleteAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/ButtonAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/CoreAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/DatePickerAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/DatePickerRegionalAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/DialogAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/DraggableAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/DroppableAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/EffectAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/MenuAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/ProgressBarAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/ResizableAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/SelectableAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/SliderAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/SortableAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/SpinnerAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/TabsAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/ThemeAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/jui/TooltipAsset.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\jui
;
namespace
yii\jui
;
use
yii\web\AssetBundle
;
use
yii\web\AssetBundle
;
/**
/**
...
...
extensions/mongodb/ActiveQuery.php
View file @
1982efbd
...
@@ -111,7 +111,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -111,7 +111,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
$this
->
findWith
(
$this
->
with
,
$models
);
$this
->
findWith
(
$this
->
with
,
$models
);
}
}
if
(
!
$this
->
asArray
)
{
if
(
!
$this
->
asArray
)
{
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$model
->
afterFind
();
$model
->
afterFind
();
}
}
}
}
...
@@ -172,4 +172,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -172,4 +172,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
}
return
$db
->
getCollection
(
$this
->
from
);
return
$db
->
getCollection
(
$this
->
from
);
}
}
}
}
\ No newline at end of file
extensions/mongodb/ActiveRecord.php
View file @
1982efbd
...
@@ -348,4 +348,4 @@ abstract class ActiveRecord extends BaseActiveRecord
...
@@ -348,4 +348,4 @@ abstract class ActiveRecord extends BaseActiveRecord
}
}
return
$this
->
collectionName
()
===
$record
->
collectionName
()
&&
(
string
)
$this
->
getPrimaryKey
()
===
(
string
)
$record
->
getPrimaryKey
();
return
$this
->
collectionName
()
===
$record
->
collectionName
()
&&
(
string
)
$this
->
getPrimaryKey
()
===
(
string
)
$record
->
getPrimaryKey
();
}
}
}
}
\ No newline at end of file
extensions/mongodb/Cache.php
View file @
1982efbd
...
@@ -199,4 +199,4 @@ class Cache extends \yii\caching\Cache
...
@@ -199,4 +199,4 @@ class Cache extends \yii\caching\Cache
]);
]);
}
}
}
}
}
}
\ No newline at end of file
extensions/mongodb/Collection.php
View file @
1982efbd
...
@@ -626,7 +626,8 @@ class Collection extends Object
...
@@ -626,7 +626,8 @@ class Collection extends Object
* @return array the highest scoring documents, in descending order by score.
* @return array the highest scoring documents, in descending order by score.
* @throws Exception on failure.
* @throws Exception on failure.
*/
*/
public
function
fullTextSearch
(
$search
,
$condition
=
[],
$fields
=
[],
$options
=
[])
{
public
function
fullTextSearch
(
$search
,
$condition
=
[],
$fields
=
[],
$options
=
[])
{
$command
=
[
$command
=
[
'search'
=>
$search
'search'
=>
$search
];
];
...
@@ -931,4 +932,4 @@ class Collection extends Object
...
@@ -931,4 +932,4 @@ class Collection extends Object
}
}
return
[
$column
=>
$value
];
return
[
$column
=>
$value
];
}
}
}
}
\ No newline at end of file
extensions/mongodb/Connection.php
View file @
1982efbd
...
@@ -269,4 +269,4 @@ class Connection extends Component
...
@@ -269,4 +269,4 @@ class Connection extends Component
{
{
$this
->
trigger
(
self
::
EVENT_AFTER_OPEN
);
$this
->
trigger
(
self
::
EVENT_AFTER_OPEN
);
}
}
}
}
\ No newline at end of file
extensions/mongodb/Database.php
View file @
1982efbd
...
@@ -170,4 +170,4 @@ class Database extends Object
...
@@ -170,4 +170,4 @@ class Database extends Object
throw
new
Exception
(
'Unknown error, use "w=1" option to enable error tracking'
);
throw
new
Exception
(
'Unknown error, use "w=1" option to enable error tracking'
);
}
}
}
}
}
}
\ No newline at end of file
extensions/mongodb/Exception.php
View file @
1982efbd
...
@@ -22,4 +22,4 @@ class Exception extends \yii\base\Exception
...
@@ -22,4 +22,4 @@ class Exception extends \yii\base\Exception
{
{
return
'MongoDB Exception'
;
return
'MongoDB Exception'
;
}
}
}
}
\ No newline at end of file
extensions/mongodb/Query.php
View file @
1982efbd
...
@@ -343,4 +343,4 @@ class Query extends Component implements QueryInterface
...
@@ -343,4 +343,4 @@ class Query extends Component implements QueryInterface
return
$result
;
return
$result
;
}
}
}
}
}
}
\ No newline at end of file
extensions/mongodb/Session.php
View file @
1982efbd
...
@@ -187,4 +187,4 @@ class Session extends \yii\web\Session
...
@@ -187,4 +187,4 @@ class Session extends \yii\web\Session
->
remove
([
'expire'
=>
[
'$lt'
=>
time
()]]);
->
remove
([
'expire'
=>
[
'$lt'
=>
time
()]]);
return
true
;
return
true
;
}
}
}
}
\ No newline at end of file
extensions/mongodb/file/ActiveQuery.php
View file @
1982efbd
...
@@ -56,7 +56,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -56,7 +56,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
$this
->
findWith
(
$this
->
with
,
$models
);
$this
->
findWith
(
$this
->
with
,
$models
);
}
}
if
(
!
$this
->
asArray
)
{
if
(
!
$this
->
asArray
)
{
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$model
->
afterFind
();
$model
->
afterFind
();
}
}
}
}
...
@@ -117,4 +117,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -117,4 +117,4 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
}
return
$db
->
getFileCollection
(
$this
->
from
);
return
$db
->
getFileCollection
(
$this
->
from
);
}
}
}
}
\ No newline at end of file
extensions/mongodb/file/Collection.php
View file @
1982efbd
...
@@ -182,4 +182,4 @@ class Collection extends \yii\mongodb\Collection
...
@@ -182,4 +182,4 @@ class Collection extends \yii\mongodb\Collection
throw
new
Exception
(
$e
->
getMessage
(),
(
int
)
$e
->
getCode
(),
$e
);
throw
new
Exception
(
$e
->
getMessage
(),
(
int
)
$e
->
getCode
(),
$e
);
}
}
}
}
}
}
\ No newline at end of file
extensions/mongodb/file/Query.php
View file @
1982efbd
...
@@ -72,4 +72,4 @@ class Query extends \yii\mongodb\Query
...
@@ -72,4 +72,4 @@ class Query extends \yii\mongodb\Query
}
}
return
$result
;
return
$result
;
}
}
}
}
\ No newline at end of file
extensions/redis/ActiveQuery.php
View file @
1982efbd
...
@@ -87,10 +87,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -87,10 +87,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
// TODO add support for orderBy
// TODO add support for orderBy
$data
=
$this
->
executeScript
(
$db
,
'All'
);
$data
=
$this
->
executeScript
(
$db
,
'All'
);
$rows
=
[];
$rows
=
[];
foreach
(
$data
as
$dataRow
)
{
foreach
(
$data
as
$dataRow
)
{
$row
=
[];
$row
=
[];
$c
=
count
(
$dataRow
);
$c
=
count
(
$dataRow
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
$row
[
$dataRow
[
$i
++
]]
=
$dataRow
[
$i
++
];
$row
[
$dataRow
[
$i
++
]]
=
$dataRow
[
$i
++
];
}
}
$rows
[]
=
$row
;
$rows
[]
=
$row
;
...
@@ -101,7 +101,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -101,7 +101,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
$this
->
findWith
(
$this
->
with
,
$models
);
$this
->
findWith
(
$this
->
with
,
$models
);
}
}
if
(
!
$this
->
asArray
)
{
if
(
!
$this
->
asArray
)
{
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$model
->
afterFind
();
$model
->
afterFind
();
}
}
}
}
...
@@ -128,7 +128,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -128,7 +128,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
}
}
$row
=
[];
$row
=
[];
$c
=
count
(
$data
);
$c
=
count
(
$data
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
$row
[
$data
[
$i
++
]]
=
$data
[
$i
++
];
$row
[
$data
[
$i
++
]]
=
$data
[
$i
++
];
}
}
if
(
$this
->
asArray
)
{
if
(
$this
->
asArray
)
{
...
@@ -336,7 +336,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -336,7 +336,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
if
(
count
(
$this
->
where
)
==
1
)
{
if
(
count
(
$this
->
where
)
==
1
)
{
$pks
=
(
array
)
reset
(
$this
->
where
);
$pks
=
(
array
)
reset
(
$this
->
where
);
}
else
{
}
else
{
foreach
(
$this
->
where
as
$values
)
{
foreach
(
$this
->
where
as
$values
)
{
if
(
is_array
(
$values
))
{
if
(
is_array
(
$values
))
{
// TODO support composite IN for composite PK
// TODO support composite IN for composite PK
throw
new
NotSupportedException
(
'Find by composite PK is not supported by redis ActiveRecord.'
);
throw
new
NotSupportedException
(
'Find by composite PK is not supported by redis ActiveRecord.'
);
...
@@ -357,7 +357,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -357,7 +357,7 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
}
}
$i
=
0
;
$i
=
0
;
$data
=
[];
$data
=
[];
foreach
(
$pks
as
$pk
)
{
foreach
(
$pks
as
$pk
)
{
if
(
++
$i
>
$start
&&
(
$limit
===
null
||
$i
<=
$start
+
$limit
))
{
if
(
++
$i
>
$start
&&
(
$limit
===
null
||
$i
<=
$start
+
$limit
))
{
$key
=
$modelClass
::
keyPrefix
()
.
':a:'
.
$modelClass
::
buildKey
(
$pk
);
$key
=
$modelClass
::
keyPrefix
()
.
':a:'
.
$modelClass
::
buildKey
(
$pk
);
$result
=
$db
->
executeCommand
(
'HGETALL'
,
[
$key
]);
$result
=
$db
->
executeCommand
(
'HGETALL'
,
[
$key
]);
...
@@ -380,10 +380,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -380,10 +380,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
return
count
(
$data
);
return
count
(
$data
);
case
'Column'
:
case
'Column'
:
$column
=
[];
$column
=
[];
foreach
(
$data
as
$dataRow
)
{
foreach
(
$data
as
$dataRow
)
{
$row
=
[];
$row
=
[];
$c
=
count
(
$dataRow
);
$c
=
count
(
$dataRow
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
$row
[
$dataRow
[
$i
++
]]
=
$dataRow
[
$i
++
];
$row
[
$dataRow
[
$i
++
]]
=
$dataRow
[
$i
++
];
}
}
$column
[]
=
$row
[
$columnName
];
$column
[]
=
$row
[
$columnName
];
...
@@ -391,9 +391,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -391,9 +391,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
return
$column
;
return
$column
;
case
'Sum'
:
case
'Sum'
:
$sum
=
0
;
$sum
=
0
;
foreach
(
$data
as
$dataRow
)
{
foreach
(
$data
as
$dataRow
)
{
$c
=
count
(
$dataRow
);
$c
=
count
(
$dataRow
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
if
(
$dataRow
[
$i
++
]
==
$columnName
)
{
if
(
$dataRow
[
$i
++
]
==
$columnName
)
{
$sum
+=
$dataRow
[
$i
];
$sum
+=
$dataRow
[
$i
];
break
;
break
;
...
@@ -404,10 +404,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -404,10 +404,10 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
case
'Average'
:
case
'Average'
:
$sum
=
0
;
$sum
=
0
;
$count
=
0
;
$count
=
0
;
foreach
(
$data
as
$dataRow
)
{
foreach
(
$data
as
$dataRow
)
{
$count
++
;
$count
++
;
$c
=
count
(
$dataRow
);
$c
=
count
(
$dataRow
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
if
(
$dataRow
[
$i
++
]
==
$columnName
)
{
if
(
$dataRow
[
$i
++
]
==
$columnName
)
{
$sum
+=
$dataRow
[
$i
];
$sum
+=
$dataRow
[
$i
];
break
;
break
;
...
@@ -417,9 +417,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -417,9 +417,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
return
$sum
/
$count
;
return
$sum
/
$count
;
case
'Min'
:
case
'Min'
:
$min
=
null
;
$min
=
null
;
foreach
(
$data
as
$dataRow
)
{
foreach
(
$data
as
$dataRow
)
{
$c
=
count
(
$dataRow
);
$c
=
count
(
$dataRow
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
if
(
$dataRow
[
$i
++
]
==
$columnName
&&
(
$min
==
null
||
$dataRow
[
$i
]
<
$min
))
{
if
(
$dataRow
[
$i
++
]
==
$columnName
&&
(
$min
==
null
||
$dataRow
[
$i
]
<
$min
))
{
$min
=
$dataRow
[
$i
];
$min
=
$dataRow
[
$i
];
break
;
break
;
...
@@ -429,9 +429,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
...
@@ -429,9 +429,9 @@ class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
return
$min
;
return
$min
;
case
'Max'
:
case
'Max'
:
$max
=
null
;
$max
=
null
;
foreach
(
$data
as
$dataRow
)
{
foreach
(
$data
as
$dataRow
)
{
$c
=
count
(
$dataRow
);
$c
=
count
(
$dataRow
);
for
(
$i
=
0
;
$i
<
$c
;
)
{
for
(
$i
=
0
;
$i
<
$c
;
)
{
if
(
$dataRow
[
$i
++
]
==
$columnName
&&
(
$max
==
null
||
$dataRow
[
$i
]
>
$max
))
{
if
(
$dataRow
[
$i
++
]
==
$columnName
&&
(
$max
==
null
||
$dataRow
[
$i
]
>
$max
))
{
$max
=
$dataRow
[
$i
];
$max
=
$dataRow
[
$i
];
break
;
break
;
...
...
extensions/redis/ActiveRecord.php
View file @
1982efbd
...
@@ -139,7 +139,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -139,7 +139,7 @@ class ActiveRecord extends BaseActiveRecord
$key
=
static
::
keyPrefix
()
.
':a:'
.
static
::
buildKey
(
$pk
);
$key
=
static
::
keyPrefix
()
.
':a:'
.
static
::
buildKey
(
$pk
);
// save attributes
// save attributes
$args
=
[
$key
];
$args
=
[
$key
];
foreach
(
$values
as
$attribute
=>
$value
)
{
foreach
(
$values
as
$attribute
=>
$value
)
{
$args
[]
=
$attribute
;
$args
[]
=
$attribute
;
$args
[]
=
$value
;
$args
[]
=
$value
;
}
}
...
@@ -172,13 +172,13 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -172,13 +172,13 @@ class ActiveRecord extends BaseActiveRecord
}
}
$db
=
static
::
getDb
();
$db
=
static
::
getDb
();
$n
=
0
;
$n
=
0
;
foreach
(
static
::
fetchPks
(
$condition
)
as
$pk
)
{
foreach
(
static
::
fetchPks
(
$condition
)
as
$pk
)
{
$newPk
=
$pk
;
$newPk
=
$pk
;
$pk
=
static
::
buildKey
(
$pk
);
$pk
=
static
::
buildKey
(
$pk
);
$key
=
static
::
keyPrefix
()
.
':a:'
.
$pk
;
$key
=
static
::
keyPrefix
()
.
':a:'
.
$pk
;
// save attributes
// save attributes
$args
=
[
$key
];
$args
=
[
$key
];
foreach
(
$attributes
as
$attribute
=>
$value
)
{
foreach
(
$attributes
as
$attribute
=>
$value
)
{
if
(
isset
(
$newPk
[
$attribute
]))
{
if
(
isset
(
$newPk
[
$attribute
]))
{
$newPk
[
$attribute
]
=
$value
;
$newPk
[
$attribute
]
=
$value
;
}
}
...
@@ -224,9 +224,9 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -224,9 +224,9 @@ class ActiveRecord extends BaseActiveRecord
}
}
$db
=
static
::
getDb
();
$db
=
static
::
getDb
();
$n
=
0
;
$n
=
0
;
foreach
(
static
::
fetchPks
(
$condition
)
as
$pk
)
{
foreach
(
static
::
fetchPks
(
$condition
)
as
$pk
)
{
$key
=
static
::
keyPrefix
()
.
':a:'
.
static
::
buildKey
(
$pk
);
$key
=
static
::
keyPrefix
()
.
':a:'
.
static
::
buildKey
(
$pk
);
foreach
(
$counters
as
$attribute
=>
$value
)
{
foreach
(
$counters
as
$attribute
=>
$value
)
{
$db
->
executeCommand
(
'HINCRBY'
,
[
$key
,
$attribute
,
$value
]);
$db
->
executeCommand
(
'HINCRBY'
,
[
$key
,
$attribute
,
$value
]);
}
}
$n
++
;
$n
++
;
...
@@ -254,7 +254,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -254,7 +254,7 @@ class ActiveRecord extends BaseActiveRecord
$attributeKeys
=
[];
$attributeKeys
=
[];
$pks
=
static
::
fetchPks
(
$condition
);
$pks
=
static
::
fetchPks
(
$condition
);
$db
->
executeCommand
(
'MULTI'
);
$db
->
executeCommand
(
'MULTI'
);
foreach
(
$pks
as
$pk
)
{
foreach
(
$pks
as
$pk
)
{
$pk
=
static
::
buildKey
(
$pk
);
$pk
=
static
::
buildKey
(
$pk
);
$db
->
executeCommand
(
'LREM'
,
[
static
::
keyPrefix
(),
0
,
$pk
]);
$db
->
executeCommand
(
'LREM'
,
[
static
::
keyPrefix
(),
0
,
$pk
]);
$attributeKeys
[]
=
static
::
keyPrefix
()
.
':a:'
.
$pk
;
$attributeKeys
[]
=
static
::
keyPrefix
()
.
':a:'
.
$pk
;
...
@@ -276,9 +276,9 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -276,9 +276,9 @@ class ActiveRecord extends BaseActiveRecord
$primaryKey
=
static
::
primaryKey
();
$primaryKey
=
static
::
primaryKey
();
$pks
=
[];
$pks
=
[];
foreach
(
$records
as
$record
)
{
foreach
(
$records
as
$record
)
{
$pk
=
[];
$pk
=
[];
foreach
(
$primaryKey
as
$key
)
{
foreach
(
$primaryKey
as
$key
)
{
$pk
[
$key
]
=
$record
[
$key
];
$pk
[
$key
]
=
$record
[
$key
];
}
}
$pks
[]
=
$pk
;
$pks
[]
=
$pk
;
...
@@ -304,7 +304,7 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -304,7 +304,7 @@ class ActiveRecord extends BaseActiveRecord
}
}
ksort
(
$key
);
// ensure order is always the same
ksort
(
$key
);
// ensure order is always the same
$isNumeric
=
true
;
$isNumeric
=
true
;
foreach
(
$key
as
$value
)
{
foreach
(
$key
as
$value
)
{
if
(
!
is_numeric
(
$value
))
{
if
(
!
is_numeric
(
$value
))
{
$isNumeric
=
false
;
$isNumeric
=
false
;
}
}
...
...
extensions/redis/Cache.php
View file @
1982efbd
...
@@ -78,7 +78,7 @@ class Cache extends \yii\caching\Cache
...
@@ -78,7 +78,7 @@ class Cache extends \yii\caching\Cache
parent
::
init
();
parent
::
init
();
if
(
is_string
(
$this
->
redis
))
{
if
(
is_string
(
$this
->
redis
))
{
$this
->
redis
=
Yii
::
$app
->
getComponent
(
$this
->
redis
);
$this
->
redis
=
Yii
::
$app
->
getComponent
(
$this
->
redis
);
}
else
if
(
is_array
(
$this
->
redis
))
{
}
elseif
(
is_array
(
$this
->
redis
))
{
if
(
!
isset
(
$this
->
redis
[
'class'
]))
{
if
(
!
isset
(
$this
->
redis
[
'class'
]))
{
$this
->
redis
[
'class'
]
=
Connection
::
className
();
$this
->
redis
[
'class'
]
=
Connection
::
className
();
}
}
...
@@ -145,7 +145,7 @@ class Cache extends \yii\caching\Cache
...
@@ -145,7 +145,7 @@ class Cache extends \yii\caching\Cache
protected
function
setValues
(
$data
,
$expire
)
protected
function
setValues
(
$data
,
$expire
)
{
{
$args
=
[];
$args
=
[];
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
$args
[]
=
$key
;
$args
[]
=
$key
;
$args
[]
=
$value
;
$args
[]
=
$value
;
}
}
...
@@ -164,7 +164,7 @@ class Cache extends \yii\caching\Cache
...
@@ -164,7 +164,7 @@ class Cache extends \yii\caching\Cache
}
}
$result
=
$this
->
redis
->
executeCommand
(
'EXEC'
);
$result
=
$this
->
redis
->
executeCommand
(
'EXEC'
);
array_shift
(
$result
);
array_shift
(
$result
);
foreach
(
$result
as
$i
=>
$r
)
{
foreach
(
$result
as
$i
=>
$r
)
{
if
(
$r
!=
1
)
{
if
(
$r
!=
1
)
{
$failedKeys
[]
=
$index
[
$i
];
$failedKeys
[]
=
$index
[
$i
];
}
}
...
...
extensions/redis/Connection.php
View file @
1982efbd
...
@@ -254,7 +254,7 @@ class Connection extends Component
...
@@ -254,7 +254,7 @@ class Connection extends Component
);
);
if
(
$this
->
_socket
)
{
if
(
$this
->
_socket
)
{
if
(
$this
->
dataTimeout
!==
null
)
{
if
(
$this
->
dataTimeout
!==
null
)
{
stream_set_timeout
(
$this
->
_socket
,
$timeout
=
(
int
)
$this
->
dataTimeout
,
(
int
)
((
$this
->
dataTimeout
-
$timeout
)
*
1000000
));
stream_set_timeout
(
$this
->
_socket
,
$timeout
=
(
int
)
$this
->
dataTimeout
,
(
int
)
((
$this
->
dataTimeout
-
$timeout
)
*
1000000
));
}
}
if
(
$this
->
password
!==
null
)
{
if
(
$this
->
password
!==
null
)
{
$this
->
executeCommand
(
'AUTH'
,
[
$this
->
password
]);
$this
->
executeCommand
(
'AUTH'
,
[
$this
->
password
]);
...
@@ -345,13 +345,13 @@ class Connection extends Component
...
@@ -345,13 +345,13 @@ class Connection extends Component
* for details on the mentioned reply types.
* for details on the mentioned reply types.
* @trows Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply).
* @trows Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply).
*/
*/
public
function
executeCommand
(
$name
,
$params
=
[])
public
function
executeCommand
(
$name
,
$params
=
[])
{
{
$this
->
open
();
$this
->
open
();
array_unshift
(
$params
,
$name
);
array_unshift
(
$params
,
$name
);
$command
=
'*'
.
count
(
$params
)
.
"
\r\n
"
;
$command
=
'*'
.
count
(
$params
)
.
"
\r\n
"
;
foreach
(
$params
as
$arg
)
{
foreach
(
$params
as
$arg
)
{
$command
.=
'$'
.
mb_strlen
(
$arg
,
'8bit'
)
.
"
\r\n
"
.
$arg
.
"
\r\n
"
;
$command
.=
'$'
.
mb_strlen
(
$arg
,
'8bit'
)
.
"
\r\n
"
.
$arg
.
"
\r\n
"
;
}
}
...
...
extensions/redis/LuaScriptBuilder.php
View file @
1982efbd
...
@@ -156,7 +156,7 @@ class LuaScriptBuilder extends \yii\base\Object
...
@@ -156,7 +156,7 @@ class LuaScriptBuilder extends \yii\base\Object
$modelClass
=
$query
->
modelClass
;
$modelClass
=
$query
->
modelClass
;
$key
=
$this
->
quoteValue
(
$modelClass
::
keyPrefix
());
$key
=
$this
->
quoteValue
(
$modelClass
::
keyPrefix
());
$loadColumnValues
=
''
;
$loadColumnValues
=
''
;
foreach
(
$columns
as
$column
=>
$alias
)
{
foreach
(
$columns
as
$column
=>
$alias
)
{
$loadColumnValues
.=
"local
$alias
=redis.call('HGET',
$key
.. ':a:' .. pk, '
$column
')
\n
"
;
$loadColumnValues
.=
"local
$alias
=redis.call('HGET',
$key
.. ':a:' .. pk, '
$column
')
\n
"
;
}
}
...
...
extensions/redis/Session.php
View file @
1982efbd
...
@@ -81,7 +81,7 @@ class Session extends \yii\web\Session
...
@@ -81,7 +81,7 @@ class Session extends \yii\web\Session
{
{
if
(
is_string
(
$this
->
redis
))
{
if
(
is_string
(
$this
->
redis
))
{
$this
->
redis
=
Yii
::
$app
->
getComponent
(
$this
->
redis
);
$this
->
redis
=
Yii
::
$app
->
getComponent
(
$this
->
redis
);
}
else
if
(
is_array
(
$this
->
redis
))
{
}
elseif
(
is_array
(
$this
->
redis
))
{
if
(
!
isset
(
$this
->
redis
[
'class'
]))
{
if
(
!
isset
(
$this
->
redis
[
'class'
]))
{
$this
->
redis
[
'class'
]
=
Connection
::
className
();
$this
->
redis
[
'class'
]
=
Connection
::
className
();
}
}
...
...
extensions/sphinx/ActiveQuery.php
View file @
1982efbd
...
@@ -135,7 +135,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
...
@@ -135,7 +135,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
}
}
$models
=
$this
->
fillUpSnippets
(
$models
);
$models
=
$this
->
fillUpSnippets
(
$models
);
if
(
!
$this
->
asArray
)
{
if
(
!
$this
->
asArray
)
{
foreach
(
$models
as
$model
)
{
foreach
(
$models
as
$model
)
{
$model
->
afterFind
();
$model
->
afterFind
();
}
}
}
}
...
...
extensions/sphinx/ColumnSchema.php
View file @
1982efbd
...
@@ -78,4 +78,4 @@ class ColumnSchema extends Object
...
@@ -78,4 +78,4 @@ class ColumnSchema extends Object
}
}
return
$value
;
return
$value
;
}
}
}
}
\ No newline at end of file
extensions/sphinx/Connection.php
View file @
1982efbd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\sphinx
;
namespace
yii\sphinx
;
use
yii\base\NotSupportedException
;
use
yii\base\NotSupportedException
;
/**
/**
...
...
extensions/sphinx/IndexSchema.php
View file @
1982efbd
...
@@ -59,4 +59,4 @@ class IndexSchema extends Object
...
@@ -59,4 +59,4 @@ class IndexSchema extends Object
{
{
return
array_keys
(
$this
->
columns
);
return
array_keys
(
$this
->
columns
);
}
}
}
}
\ No newline at end of file
extensions/sphinx/QueryBuilder.php
View file @
1982efbd
...
@@ -422,7 +422,7 @@ class QueryBuilder extends Object
...
@@ -422,7 +422,7 @@ class QueryBuilder extends Object
if
(
strpos
(
$column
,
'('
)
===
false
)
{
if
(
strpos
(
$column
,
'('
)
===
false
)
{
$column
=
$this
->
db
->
quoteColumnName
(
$column
);
$column
=
$this
->
db
->
quoteColumnName
(
$column
);
}
}
$columns
[
$i
]
=
"
$column
AS "
.
$this
->
db
->
quoteColumnName
(
$i
);
;
$columns
[
$i
]
=
"
$column
AS "
.
$this
->
db
->
quoteColumnName
(
$i
);
}
elseif
(
strpos
(
$column
,
'('
)
===
false
)
{
}
elseif
(
strpos
(
$column
,
'('
)
===
false
)
{
if
(
preg_match
(
'/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/'
,
$column
,
$matches
))
{
if
(
preg_match
(
'/^(.*?)(?i:\s+as\s+|\s+)([\w\-_\.]+)$/'
,
$column
,
$matches
))
{
$columns
[
$i
]
=
$this
->
db
->
quoteColumnName
(
$matches
[
1
])
.
' AS '
.
$this
->
db
->
quoteColumnName
(
$matches
[
2
]);
$columns
[
$i
]
=
$this
->
db
->
quoteColumnName
(
$matches
[
1
])
.
' AS '
.
$this
->
db
->
quoteColumnName
(
$matches
[
2
]);
...
@@ -907,7 +907,8 @@ class QueryBuilder extends Object
...
@@ -907,7 +907,8 @@ class QueryBuilder extends Object
* @param array $params the binding parameters to be populated
* @param array $params the binding parameters to be populated
* @return string SQL expression, which represents column value
* @return string SQL expression, which represents column value
*/
*/
protected
function
composeColumnValue
(
$indexes
,
$columnName
,
$value
,
&
$params
)
{
protected
function
composeColumnValue
(
$indexes
,
$columnName
,
$value
,
&
$params
)
{
if
(
$value
===
null
)
{
if
(
$value
===
null
)
{
return
'NULL'
;
return
'NULL'
;
}
elseif
(
$value
instanceof
Expression
)
{
}
elseif
(
$value
instanceof
Expression
)
{
...
...
extensions/sphinx/Schema.php
View file @
1982efbd
...
@@ -486,4 +486,4 @@ class Schema extends Object
...
@@ -486,4 +486,4 @@ class Schema extends Object
return
$column
;
return
$column
;
}
}
}
}
\ No newline at end of file
extensions/twig/TwigSimpleFileLoader.php
View file @
1982efbd
...
@@ -68,7 +68,8 @@ class TwigSimpleFileLoader implements \Twig_LoaderInterface
...
@@ -68,7 +68,8 @@ class TwigSimpleFileLoader implements \Twig_LoaderInterface
* @param string $name file name
* @param string $name file name
* @return string absolute path of file
* @return string absolute path of file
*/
*/
protected
function
getFilePath
(
$name
){
protected
function
getFilePath
(
$name
)
{
return
$this
->
_dir
.
'/'
.
$name
;
return
$this
->
_dir
.
'/'
.
$name
;
}
}
}
}
\ No newline at end of file
extensions/twig/ViewRenderer.php
View file @
1982efbd
...
@@ -33,33 +33,33 @@ class ViewRenderer extends BaseViewRenderer
...
@@ -33,33 +33,33 @@ class ViewRenderer extends BaseViewRenderer
* @see http://twig.sensiolabs.org/doc/api.html#environment-options
* @see http://twig.sensiolabs.org/doc/api.html#environment-options
*/
*/
public
$options
=
[];
public
$options
=
[];
/**
/**
* @var array Objects or static classes.
* @var array Objects or static classes.
* Keys of the array are names to call in template, values are objects or names of static classes.
* Keys of the array are names to call in template, values are objects or names of static classes.
* Example: `['html' => '\yii\helpers\Html']`.
* Example: `['html' => '\yii\helpers\Html']`.
* In the template you can use it like this: `{{ html.a('Login', 'site/login') | raw }}`.
* In the template you can use it like this: `{{ html.a('Login', 'site/login') | raw }}`.
*/
*/
public
$globals
=
[];
public
$globals
=
[];
/**
/**
* @var array Custom functions.
* @var array Custom functions.
* Keys of the array are names to call in template, values are names of functions or static methods of some class.
* Keys of the array are names to call in template, values are names of functions or static methods of some class.
* Example: `['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a']`.
* Example: `['rot13' => 'str_rot13', 'a' => '\yii\helpers\Html::a']`.
* In the template you can use it like this: `{{ rot13('test') }}` or `{{ a('Login', 'site/login') | raw }}`.
* In the template you can use it like this: `{{ rot13('test') }}` or `{{ a('Login', 'site/login') | raw }}`.
*/
*/
public
$functions
=
[];
public
$functions
=
[];
/**
/**
* @var array Custom filters.
* @var array Custom filters.
* Keys of the array are names to call in template, values are names of functions or static methods of some class.
* Keys of the array are names to call in template, values are names of functions or static methods of some class.
* Example: `['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']`.
* Example: `['rot13' => 'str_rot13', 'jsonEncode' => '\yii\helpers\Json::encode']`.
* In the template you can use it like this: `{{ 'test'|rot13 }}` or `{{ model|jsonEncode }}`.
* In the template you can use it like this: `{{ 'test'|rot13 }}` or `{{ model|jsonEncode }}`.
*/
*/
public
$filters
=
[];
public
$filters
=
[];
/**
/**
* @var array Custom extensions.
* @var array Custom extensions.
* Example: `['Twig_Extension_Sandbox', 'Twig_Extension_Text']`
* Example: `['Twig_Extension_Sandbox', 'Twig_Extension_Text']`
*/
*/
public
$extensions
=
[];
public
$extensions
=
[];
/**
/**
* @var array Twig lexer options.
* @var array Twig lexer options.
* Example: Smarty-like syntax:
* Example: Smarty-like syntax:
* ```php
* ```php
...
@@ -71,8 +71,8 @@ class ViewRenderer extends BaseViewRenderer
...
@@ -71,8 +71,8 @@ class ViewRenderer extends BaseViewRenderer
* ```
* ```
* @see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
* @see http://twig.sensiolabs.org/doc/recipes.html#customizing-the-syntax
*/
*/
public
$lexerOptions
=
[];
public
$lexerOptions
=
[];
/**
/**
* @var \Twig_Environment twig environment object that do all rendering twig templates
* @var \Twig_Environment twig environment object that do all rendering twig templates
*/
*/
public
$twig
;
public
$twig
;
...
@@ -118,7 +118,7 @@ class ViewRenderer extends BaseViewRenderer
...
@@ -118,7 +118,7 @@ class ViewRenderer extends BaseViewRenderer
}
}
// Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}})
// Adding global 'void' function (usage: {{void(App.clientScript.registerScriptFile(...))}})
$this
->
twig
->
addFunction
(
'void'
,
new
\Twig_Function_Function
(
function
(
$argument
)
{
$this
->
twig
->
addFunction
(
'void'
,
new
\Twig_Function_Function
(
function
(
$argument
)
{
}));
}));
$this
->
twig
->
addFunction
(
'path'
,
new
\Twig_Function_Function
(
function
(
$path
,
$args
=
[])
{
$this
->
twig
->
addFunction
(
'path'
,
new
\Twig_Function_Function
(
function
(
$path
,
$args
=
[])
{
...
...
extensions/twig/ViewRendererStaticClassProxy.php
View file @
1982efbd
...
@@ -19,7 +19,8 @@ class ViewRendererStaticClassProxy
...
@@ -19,7 +19,8 @@ class ViewRendererStaticClassProxy
{
{
private
$_staticClassName
;
private
$_staticClassName
;
public
function
__construct
(
$staticClassName
)
{
public
function
__construct
(
$staticClassName
)
{
$this
->
_staticClassName
=
$staticClassName
;
$this
->
_staticClassName
=
$staticClassName
;
}
}
...
@@ -40,4 +41,4 @@ class ViewRendererStaticClassProxy
...
@@ -40,4 +41,4 @@ class ViewRendererStaticClassProxy
{
{
return
call_user_func_array
(
array
(
$this
->
_staticClassName
,
$method
),
$arguments
);
return
call_user_func_array
(
array
(
$this
->
_staticClassName
,
$method
),
$arguments
);
}
}
}
}
\ 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