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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
1c414caa
Commit
1c414caa
authored
Jul 30, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved checks where substr_compare is used, replaced more substr + comapre…
Improved checks where substr_compare is used, replaced more substr + comapre cases with substr_compare
parent
ca9d4867
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
49 additions
and
37 deletions
+49
-37
PhpDocController.php
build/controllers/PhpDocController.php
+22
-14
TypeDoc.php
extensions/apidoc/models/TypeDoc.php
+1
-1
BaseRenderer.php
extensions/apidoc/renderers/BaseRenderer.php
+1
-1
seeAlso.php
extensions/apidoc/templates/html/views/seeAlso.php
+5
-3
Generator.php
extensions/gii/generators/crud/Generator.php
+1
-1
Generator.php
extensions/gii/generators/model/Generator.php
+4
-4
Generator.php
extensions/gii/generators/module/Generator.php
+1
-1
Generator.php
extensions/mongodb/gii/model/Generator.php
+1
-1
Generator.php
extensions/sphinx/gii/model/Generator.php
+3
-3
HelpController.php
framework/console/controllers/HelpController.php
+1
-1
MessageController.php
framework/console/controllers/MessageController.php
+2
-2
BaseHtml.php
framework/helpers/BaseHtml.php
+2
-2
GettextMoFile.php
framework/i18n/GettextMoFile.php
+2
-1
MessageFormatter.php
framework/i18n/MessageFormatter.php
+2
-1
Target.php
framework/log/Target.php
+1
-1
No files found.
build/controllers/PhpDocController.php
View file @
1c414caa
...
@@ -170,12 +170,15 @@ class PhpDocController extends Controller
...
@@ -170,12 +170,15 @@ class PhpDocController extends Controller
$namespaceLine
=
''
;
$namespaceLine
=
''
;
$contentAfterNamespace
=
false
;
$contentAfterNamespace
=
false
;
foreach
(
$lines
as
$i
=>
$line
)
{
foreach
(
$lines
as
$i
=>
$line
)
{
if
(
substr
(
trim
(
$line
),
0
,
9
)
===
'namespace'
)
{
$line
=
trim
(
$line
);
$namespace
=
$i
;
if
(
!
empty
(
$line
))
{
$namespaceLine
=
trim
(
$line
);
if
(
substr_compare
(
$line
,
'namespace'
,
0
,
9
)
===
0
)
{
}
elseif
(
$namespace
!==
false
&&
trim
(
$line
)
!==
''
)
{
$namespace
=
$i
;
$contentAfterNamespace
=
$i
;
$namespaceLine
=
$line
;
break
;
}
elseif
(
$namespace
!==
false
)
{
$contentAfterNamespace
=
$i
;
break
;
}
}
}
}
}
...
@@ -275,14 +278,18 @@ class PhpDocController extends Controller
...
@@ -275,14 +278,18 @@ class PhpDocController extends Controller
// TODO move these checks to different action
// TODO move these checks to different action
$lines
=
explode
(
"
\n
"
,
$newDoc
);
$lines
=
explode
(
"
\n
"
,
$newDoc
);
if
(
trim
(
$lines
[
1
])
==
'*'
||
substr
(
trim
(
$lines
[
1
]),
0
,
3
)
==
'* @'
)
{
$firstLine
=
trim
(
$lines
[
1
]);
if
(
$firstLine
===
'*'
||
(
!
empty
(
$firstLine
)
&&
substr_compare
(
$firstLine
,
'* @'
,
0
,
3
)
===
0
))
{
$this
->
stderr
(
"[WARN] Class
$className
has no short description.
\n
"
,
Console
::
FG_YELLOW
,
Console
::
BOLD
);
$this
->
stderr
(
"[WARN] Class
$className
has no short description.
\n
"
,
Console
::
FG_YELLOW
,
Console
::
BOLD
);
}
}
foreach
(
$lines
as
$line
)
{
foreach
(
$lines
as
$line
)
{
if
(
substr
(
trim
(
$line
),
0
,
9
)
==
'* @since '
)
{
$line
=
trim
(
$line
);
$seenSince
=
true
;
if
(
!
empty
(
$line
))
{
}
elseif
(
substr
(
trim
(
$line
),
0
,
10
)
==
'* @author '
)
{
if
(
substr_compare
(
$line
,
'* @since '
,
0
,
9
)
===
0
)
{
$seenAuthor
=
true
;
$seenSince
=
true
;
}
elseif
(
substr_compare
(
$line
,
'* @author '
,
0
,
10
)
===
0
)
{
$seenAuthor
=
true
;
}
}
}
}
}
...
@@ -350,13 +357,14 @@ class PhpDocController extends Controller
...
@@ -350,13 +357,14 @@ class PhpDocController extends Controller
$propertyPart
=
false
;
$propertyPart
=
false
;
$propertyPosition
=
false
;
$propertyPosition
=
false
;
foreach
(
$lines
as
$i
=>
$line
)
{
foreach
(
$lines
as
$i
=>
$line
)
{
if
(
substr
(
trim
(
$line
),
0
,
12
)
==
'* @property '
)
{
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
)
&&
substr_compare
(
$line
,
'* @property '
,
0
,
12
)
===
0
)
{
$propertyPart
=
true
;
$propertyPart
=
true
;
}
elseif
(
$propertyPart
&&
trim
(
$line
)
==
'*'
)
{
}
elseif
(
$propertyPart
&&
$line
==
'*'
)
{
$propertyPosition
=
$i
;
$propertyPosition
=
$i
;
$propertyPart
=
false
;
$propertyPart
=
false
;
}
}
if
(
substr
(
trim
(
$line
),
0
,
10
)
==
'* @author '
&&
$propertyPosition
===
false
)
{
if
(
!
empty
(
$line
)
&&
substr_compare
(
$line
,
'* @author '
,
0
,
10
)
===
0
&&
$propertyPosition
===
false
)
{
$propertyPosition
=
$i
-
1
;
$propertyPosition
=
$i
-
1
;
$propertyPart
=
false
;
$propertyPart
=
false
;
}
}
...
...
extensions/apidoc/models/TypeDoc.php
View file @
1c414caa
...
@@ -46,7 +46,7 @@ class TypeDoc extends BaseDoc
...
@@ -46,7 +46,7 @@ class TypeDoc extends BaseDoc
}
}
}
}
}
}
if
(
substr_compare
(
$subjectName
,
'()'
,
-
2
,
2
)
===
0
)
{
if
(
!
empty
(
$subjectName
)
&&
substr_compare
(
$subjectName
,
'()'
,
-
2
,
2
)
===
0
)
{
return
null
;
return
null
;
}
}
if
(
$this
->
properties
===
null
)
{
if
(
$this
->
properties
===
null
)
{
...
...
extensions/apidoc/renderers/BaseRenderer.php
View file @
1c414caa
...
@@ -72,7 +72,7 @@ abstract class BaseRenderer extends Component
...
@@ -72,7 +72,7 @@ abstract class BaseRenderer extends Component
foreach
(
$types
as
$type
)
{
foreach
(
$types
as
$type
)
{
$postfix
=
''
;
$postfix
=
''
;
if
(
is_string
(
$type
))
{
if
(
is_string
(
$type
))
{
if
(
substr_compare
(
$type
,
'[]'
,
-
2
,
2
)
===
0
)
{
if
(
!
empty
(
$type
)
&&
substr_compare
(
$type
,
'[]'
,
-
2
,
2
)
===
0
)
{
$postfix
=
'[]'
;
$postfix
=
'[]'
;
$type
=
substr
(
$type
,
0
,
-
2
);
$type
=
substr
(
$type
,
0
,
-
2
);
}
}
...
...
extensions/apidoc/templates/html/views/seeAlso.php
View file @
1c414caa
...
@@ -23,10 +23,12 @@ if (empty($see)) {
...
@@ -23,10 +23,12 @@ if (empty($see)) {
}
else
{
}
else
{
echo
'<p>See also:</p><ul>'
;
echo
'<p>See also:</p><ul>'
;
foreach
(
$see
as
$ref
)
{
foreach
(
$see
as
$ref
)
{
if
(
substr_compare
(
$ref
,
'>'
,
-
1
,
1
))
{
if
(
!
empty
(
$ref
))
{
$ref
.=
'.'
;
if
(
substr_compare
(
$ref
,
'>'
,
-
1
,
1
))
{
$ref
.=
'.'
;
}
echo
"<li>
$ref
</li>"
;
}
}
echo
"<li>
$ref
</li>"
;
}
}
echo
'</ul>'
;
echo
'</ul>'
;
}
}
extensions/gii/generators/crud/Generator.php
View file @
1c414caa
...
@@ -373,7 +373,7 @@ class Generator extends \yii\gii\Generator
...
@@ -373,7 +373,7 @@ class Generator extends \yii\gii\Generator
$labels
[
$name
]
=
'ID'
;
$labels
[
$name
]
=
'ID'
;
}
else
{
}
else
{
$label
=
Inflector
::
camel2words
(
$name
);
$label
=
Inflector
::
camel2words
(
$name
);
if
(
strcasecmp
(
substr
(
$label
,
-
3
),
' id'
)
===
0
)
{
if
(
!
empty
(
$label
)
&&
substr_compare
(
$label
,
' id'
,
-
3
,
null
,
true
)
===
0
)
{
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
}
}
$labels
[
$name
]
=
$label
;
$labels
[
$name
]
=
$label
;
...
...
extensions/gii/generators/model/Generator.php
View file @
1c414caa
...
@@ -196,7 +196,7 @@ class Generator extends \yii\gii\Generator
...
@@ -196,7 +196,7 @@ class Generator extends \yii\gii\Generator
$labels
[
$column
->
name
]
=
'ID'
;
$labels
[
$column
->
name
]
=
'ID'
;
}
else
{
}
else
{
$label
=
Inflector
::
camel2words
(
$column
->
name
);
$label
=
Inflector
::
camel2words
(
$column
->
name
);
if
(
strcasecmp
(
substr
(
$label
,
-
3
),
' id'
)
===
0
)
{
if
(
!
empty
(
$label
)
&&
substr_compare
(
$label
,
' id'
,
-
3
,
null
,
true
)
)
{
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
}
}
$labels
[
$column
->
name
]
=
$label
;
$labels
[
$column
->
name
]
=
$label
;
...
@@ -428,7 +428,7 @@ class Generator extends \yii\gii\Generator
...
@@ -428,7 +428,7 @@ class Generator extends \yii\gii\Generator
*/
*/
protected
function
generateRelationName
(
$relations
,
$className
,
$table
,
$key
,
$multiple
)
protected
function
generateRelationName
(
$relations
,
$className
,
$table
,
$key
,
$multiple
)
{
{
if
(
strcasecmp
(
substr
(
$key
,
-
2
),
'id'
)
===
0
&&
strcasecmp
(
$key
,
'id'
))
{
if
(
!
empty
(
$key
)
&&
substr_compare
(
$key
,
'id'
,
-
2
,
null
,
true
)
===
0
&&
strcasecmp
(
$key
,
'id'
))
{
$key
=
rtrim
(
substr
(
$key
,
0
,
-
2
),
'_'
);
$key
=
rtrim
(
substr
(
$key
,
0
,
-
2
),
'_'
);
}
}
if
(
$multiple
)
{
if
(
$multiple
)
{
...
@@ -478,7 +478,7 @@ class Generator extends \yii\gii\Generator
...
@@ -478,7 +478,7 @@ class Generator extends \yii\gii\Generator
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
}
}
if
(
substr_compare
(
$this
->
tableName
,
'*'
,
-
1
)
&&
$this
->
modelClass
==
''
)
{
if
(
(
empty
(
$this
->
tableName
)
||
substr_compare
(
$this
->
tableName
,
'*'
,
-
1
)
)
&&
$this
->
modelClass
==
''
)
{
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
}
}
}
}
...
@@ -488,7 +488,7 @@ class Generator extends \yii\gii\Generator
...
@@ -488,7 +488,7 @@ class Generator extends \yii\gii\Generator
*/
*/
public
function
validateTableName
()
public
function
validateTableName
()
{
{
if
(
strpos
(
$this
->
tableName
,
'*'
)
!==
false
&&
substr
(
$this
->
tableName
,
-
1
)
!==
'*'
)
{
if
(
strpos
(
$this
->
tableName
,
'*'
)
!==
false
&&
substr
_compare
(
$this
->
tableName
,
'*'
,
-
1
)
)
{
$this
->
addError
(
'tableName'
,
'Asterisk is only allowed as the last character.'
);
$this
->
addError
(
'tableName'
,
'Asterisk is only allowed as the last character.'
);
return
;
return
;
...
...
extensions/gii/generators/module/Generator.php
View file @
1c414caa
...
@@ -146,7 +146,7 @@ EOD;
...
@@ -146,7 +146,7 @@ EOD;
if
(
strpos
(
$this
->
moduleClass
,
'\\'
)
===
false
||
Yii
::
getAlias
(
'@'
.
str_replace
(
'\\'
,
'/'
,
$this
->
moduleClass
),
false
)
===
false
)
{
if
(
strpos
(
$this
->
moduleClass
,
'\\'
)
===
false
||
Yii
::
getAlias
(
'@'
.
str_replace
(
'\\'
,
'/'
,
$this
->
moduleClass
),
false
)
===
false
)
{
$this
->
addError
(
'moduleClass'
,
'Module class must be properly namespaced.'
);
$this
->
addError
(
'moduleClass'
,
'Module class must be properly namespaced.'
);
}
}
if
(
substr_compare
(
$this
->
moduleClass
,
'\\'
,
-
1
,
1
)
===
0
)
{
if
(
empty
(
$this
->
moduleClass
)
||
substr_compare
(
$this
->
moduleClass
,
'\\'
,
-
1
,
1
)
===
0
)
{
$this
->
addError
(
'moduleClass'
,
'Module class name must not be empty. Please enter a fully qualified class name. e.g. "app\\modules\\admin\\Module".'
);
$this
->
addError
(
'moduleClass'
,
'Module class name must not be empty. Please enter a fully qualified class name. e.g. "app\\modules\\admin\\Module".'
);
}
}
}
}
...
...
extensions/mongodb/gii/model/Generator.php
View file @
1c414caa
...
@@ -182,7 +182,7 @@ class Generator extends \yii\gii\Generator
...
@@ -182,7 +182,7 @@ class Generator extends \yii\gii\Generator
$label
=
'ID'
;
$label
=
'ID'
;
}
else
{
}
else
{
$label
=
Inflector
::
camel2words
(
$attribute
);
$label
=
Inflector
::
camel2words
(
$attribute
);
if
(
s
trcasecmp
(
substr
(
$label
,
-
3
),
' id'
)
===
0
)
{
if
(
s
ubstr_compare
(
$label
,
' id'
,
-
3
,
null
,
true
)
===
0
)
{
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
}
}
}
}
...
...
extensions/sphinx/gii/model/Generator.php
View file @
1c414caa
...
@@ -180,7 +180,7 @@ class Generator extends \yii\gii\Generator
...
@@ -180,7 +180,7 @@ class Generator extends \yii\gii\Generator
$labels
[
$column
->
name
]
=
'ID'
;
$labels
[
$column
->
name
]
=
'ID'
;
}
else
{
}
else
{
$label
=
Inflector
::
camel2words
(
$column
->
name
);
$label
=
Inflector
::
camel2words
(
$column
->
name
);
if
(
s
trcasecmp
(
substr
(
$label
,
-
3
),
' id'
)
===
0
)
{
if
(
s
ubstr_compare
(
$label
,
' id'
,
-
3
,
null
,
true
)
===
0
)
{
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
$label
=
substr
(
$label
,
0
,
-
3
)
.
' ID'
;
}
}
$labels
[
$column
->
name
]
=
$label
;
$labels
[
$column
->
name
]
=
$label
;
...
@@ -266,7 +266,7 @@ class Generator extends \yii\gii\Generator
...
@@ -266,7 +266,7 @@ class Generator extends \yii\gii\Generator
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
}
}
if
(
substr_compare
(
$this
->
indexName
,
'*'
,
-
1
)
&&
$this
->
modelClass
==
''
)
{
if
(
(
empty
(
$this
->
indexName
)
||
substr_compare
(
$this
->
indexName
,
'*'
,
-
1
)
)
&&
$this
->
modelClass
==
''
)
{
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
}
}
}
}
...
@@ -276,7 +276,7 @@ class Generator extends \yii\gii\Generator
...
@@ -276,7 +276,7 @@ class Generator extends \yii\gii\Generator
*/
*/
public
function
validateIndexName
()
public
function
validateIndexName
()
{
{
if
(
strpos
(
$this
->
indexName
,
'*'
)
!==
false
&&
substr
(
$this
->
indexName
,
-
1
)
!==
'*'
)
{
if
(
strpos
(
$this
->
indexName
,
'*'
)
!==
false
&&
substr
_compare
(
$this
->
indexName
,
'*'
,
-
1
)
)
{
$this
->
addError
(
'indexName'
,
'Asterisk is only allowed as the last character.'
);
$this
->
addError
(
'indexName'
,
'Asterisk is only allowed as the last character.'
);
return
;
return
;
...
...
framework/console/controllers/HelpController.php
View file @
1c414caa
...
@@ -156,7 +156,7 @@ class HelpController extends Controller
...
@@ -156,7 +156,7 @@ class HelpController extends Controller
if
(
is_dir
(
$controllerPath
))
{
if
(
is_dir
(
$controllerPath
))
{
$files
=
scandir
(
$controllerPath
);
$files
=
scandir
(
$controllerPath
);
foreach
(
$files
as
$file
)
{
foreach
(
$files
as
$file
)
{
if
(
strcmp
(
substr
(
$file
,
-
14
),
'Controller.php'
)
===
0
)
{
if
(
!
empty
(
$file
)
&&
substr_compare
(
$file
,
'Controller.php'
,
-
14
)
===
0
)
{
$controllerClass
=
$module
->
controllerNamespace
.
'\\'
.
substr
(
basename
(
$file
),
0
,
-
4
);
$controllerClass
=
$module
->
controllerNamespace
.
'\\'
.
substr
(
basename
(
$file
),
0
,
-
4
);
if
(
$this
->
validateControllerClass
(
$controllerClass
))
{
if
(
$this
->
validateControllerClass
(
$controllerClass
))
{
$commands
[]
=
$prefix
.
Inflector
::
camel2id
(
substr
(
basename
(
$file
),
0
,
-
14
));
$commands
[]
=
$prefix
.
Inflector
::
camel2id
(
substr
(
basename
(
$file
),
0
,
-
14
));
...
...
framework/console/controllers/MessageController.php
View file @
1c414caa
...
@@ -331,7 +331,7 @@ class MessageController extends Controller
...
@@ -331,7 +331,7 @@ class MessageController extends Controller
ksort
(
$existingMessages
);
ksort
(
$existingMessages
);
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
mb_strlen
(
$translation
,
Yii
::
$app
->
charset
)
>=
2
&&
substr_compare
(
$translation
,
'@@'
,
0
,
2
)
===
0
&&
substr_compare
(
$translation
,
'@@'
,
-
2
)
===
0
)
{
if
(
!
empty
(
$translation
)
&&
substr_compare
(
$translation
,
'@@'
,
0
,
2
)
===
0
&&
substr_compare
(
$translation
,
'@@'
,
-
2
)
===
0
)
{
$todo
[
$message
]
=
$translation
;
$todo
[
$message
]
=
$translation
;
}
else
{
}
else
{
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
...
@@ -445,7 +445,7 @@ EOD;
...
@@ -445,7 +445,7 @@ EOD;
// add obsolete unused messages
// add obsolete unused messages
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$category
.
chr
(
4
)
.
$message
])
&&
!
isset
(
$todos
[
$category
.
chr
(
4
)
.
$message
])
&&
!
$removeUnused
)
{
if
(
!
isset
(
$merged
[
$category
.
chr
(
4
)
.
$message
])
&&
!
isset
(
$todos
[
$category
.
chr
(
4
)
.
$message
])
&&
!
$removeUnused
)
{
if
(
mb_strlen
(
$translation
,
Yii
::
$app
->
charset
)
>=
2
&&
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
if
(
!
empty
(
$translation
)
&&
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
$todos
[
$category
.
chr
(
4
)
.
$message
]
=
$translation
;
$todos
[
$category
.
chr
(
4
)
.
$message
]
=
$translation
;
}
else
{
}
else
{
$todos
[
$category
.
chr
(
4
)
.
$message
]
=
'@@'
.
$translation
.
'@@'
;
$todos
[
$category
.
chr
(
4
)
.
$message
]
=
'@@'
.
$translation
.
'@@'
;
...
...
framework/helpers/BaseHtml.php
View file @
1c414caa
...
@@ -797,13 +797,13 @@ class BaseHtml
...
@@ -797,13 +797,13 @@ class BaseHtml
if
(
!
array_key_exists
(
'size'
,
$options
))
{
if
(
!
array_key_exists
(
'size'
,
$options
))
{
$options
[
'size'
]
=
4
;
$options
[
'size'
]
=
4
;
}
}
if
(
!
empty
(
$options
[
'multiple'
])
&&
substr
(
$name
,
-
2
)
!==
'[]'
)
{
if
(
!
empty
(
$options
[
'multiple'
])
&&
!
empty
(
$name
)
&&
substr_compare
(
$name
,
'[]'
,
-
2
)
)
{
$name
.=
'[]'
;
$name
.=
'[]'
;
}
}
$options
[
'name'
]
=
$name
;
$options
[
'name'
]
=
$name
;
if
(
isset
(
$options
[
'unselect'
]))
{
if
(
isset
(
$options
[
'unselect'
]))
{
// add a hidden field so that if the list box has no option being selected, it still submits a value
// add a hidden field so that if the list box has no option being selected, it still submits a value
if
(
substr_compare
(
$name
,
'[]'
,
-
2
)
===
0
)
{
if
(
!
empty
(
$name
)
&&
substr_compare
(
$name
,
'[]'
,
-
2
)
===
0
)
{
$name
=
substr
(
$name
,
0
,
-
2
);
$name
=
substr
(
$name
,
0
,
-
2
);
}
}
$hidden
=
static
::
hiddenInput
(
$name
,
$options
[
'unselect'
]);
$hidden
=
static
::
hiddenInput
(
$name
,
$options
[
'unselect'
]);
...
...
framework/i18n/GettextMoFile.php
View file @
1c414caa
...
@@ -107,7 +107,8 @@ class GettextMoFile extends GettextFile
...
@@ -107,7 +107,8 @@ class GettextMoFile extends GettextFile
$id
=
$this
->
readString
(
$fileHandle
,
$sourceLengths
[
$i
],
$sourceOffsets
[
$i
]);
$id
=
$this
->
readString
(
$fileHandle
,
$sourceLengths
[
$i
],
$sourceOffsets
[
$i
]);
$separatorPosition
=
strpos
(
$id
,
chr
(
4
));
$separatorPosition
=
strpos
(
$id
,
chr
(
4
));
if
((
$context
&&
$separatorPosition
!==
false
&&
substr
(
$id
,
0
,
$separatorPosition
)
===
$context
)
||
if
((
$context
&&
$separatorPosition
!==
false
&&
!
empty
(
$id
)
&&
substr_compare
(
$id
,
$context
,
0
,
$separatorPosition
)
===
0
)
||
(
!
$context
&&
$separatorPosition
===
false
))
{
(
!
$context
&&
$separatorPosition
===
false
))
{
if
(
$separatorPosition
!==
false
)
{
if
(
$separatorPosition
!==
false
)
{
$id
=
substr
(
$id
,
$separatorPosition
+
1
);
$id
=
substr
(
$id
,
$separatorPosition
+
1
);
...
...
framework/i18n/MessageFormatter.php
View file @
1c414caa
...
@@ -390,7 +390,8 @@ class MessageFormatter extends Component
...
@@ -390,7 +390,8 @@ class MessageFormatter extends Component
return
false
;
return
false
;
}
}
$selector
=
trim
(
$plural
[
$i
++
]);
$selector
=
trim
(
$plural
[
$i
++
]);
if
(
$i
==
1
&&
substr
(
$selector
,
0
,
7
)
==
'offset:'
)
{
if
(
$i
==
1
&&
!
empty
(
$selector
)
&&
substr_compare
(
$selector
,
'offset:'
,
0
,
7
)
===
0
)
{
$offset
=
(
int
)
trim
(
mb_substr
(
$selector
,
7
,
(
$pos
=
mb_strpos
(
str_replace
([
"
\n
"
,
"
\r
"
,
"
\t
"
],
' '
,
$selector
),
' '
,
7
))
-
7
));
$offset
=
(
int
)
trim
(
mb_substr
(
$selector
,
7
,
(
$pos
=
mb_strpos
(
str_replace
([
"
\n
"
,
"
\r
"
,
"
\t
"
],
' '
,
$selector
),
' '
,
7
))
-
7
));
$selector
=
trim
(
mb_substr
(
$selector
,
$pos
+
1
));
$selector
=
trim
(
mb_substr
(
$selector
,
$pos
+
1
));
}
}
...
...
framework/log/Target.php
View file @
1c414caa
...
@@ -204,7 +204,7 @@ abstract class Target extends Component
...
@@ -204,7 +204,7 @@ abstract class Target extends Component
$matched
=
empty
(
$categories
);
$matched
=
empty
(
$categories
);
foreach
(
$categories
as
$category
)
{
foreach
(
$categories
as
$category
)
{
if
(
$message
[
2
]
===
$category
||
substr
(
$category
,
-
1
)
===
'*'
&&
strpos
(
$message
[
2
],
rtrim
(
$category
,
'*'
))
===
0
)
{
if
(
$message
[
2
]
===
$category
||
!
empty
(
$category
)
&&
substr_compare
(
$category
,
'*'
,
-
1
)
===
0
&&
strpos
(
$message
[
2
],
rtrim
(
$category
,
'*'
))
===
0
)
{
$matched
=
true
;
$matched
=
true
;
break
;
break
;
}
}
...
...
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