⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
TYPO3 Core
All Projects
TYPO3 Core
Overview
Activity
Roadmap
Issues
Repository
Download (1.44 KB)
Bug #23092
» checkCssSeparation.php
Administrator Admin, 2010-07-03 21:51
<?php
$structure
=
array
(
'bottom'
,
'clear'
,
'display'
,
'float'
,
'((min|max)-)?height'
,
'min-height'
,
'max-height'
,
'left'
,
'margin(-(top|right|bottom|left))?'
,
'padding(-(top|right|bottom|left))?'
,
'position'
,
'right'
,
'top'
,
'visibility'
,
'((min|max)-)?width'
,
'z-index'
,
);
$visual
=
array
(
'background(-(.*))?'
,
'border(-(.*))?'
,
'box-shadow(-(.*))?'
,
'color'
,
'cursor'
,
'filter'
,
/* IE only */
'font(-(.*))?'
,
'line-height'
,
'list-style(-(.*))?'
,
'opacity'
,
'overflow'
,
'text(-(.*))?'
,
'vertical-align'
,
'white-space'
,
'-(.*)'
,
/*debug */
);
function
check
(
$directory
,
array
$rules
)
{
$handle
=
opendir
(
$directory
);
$warningCount
=
0
;
while
(
false
!==
(
$file
=
readdir
(
$handle
)))
{
$lineNumber
=
1
;
foreach
(
file
(
$directory
.
$file
)
as
$line
)
{
// we define an attribute
if
(
substr
(
$line
,
0
,
1
)
===
"
\t
"
)
{
$lineValid
=
FALSE
;
foreach
(
$rules
as
$attribute
)
{
if
(
preg_match
(
'/^\t'
.
$attribute
.
':\ (.*);$/'
,
$line
))
{
$lineValid
=
TRUE
;
break
;
}
}
if
(
$lineValid
===
FALSE
)
{
echo
$file
.
': '
.
$lastRule
;
echo
$file
.
':'
.
$lineNumber
.
' '
.
' '
.
$line
;
$warningCount
++
;
}
}
else
{
// selector
$lastRule
=
$line
;
}
$lineNumber
++
;
}
}
closedir
(
$handle
);
echo
"
\n
Total warnings: "
.
$warningCount
;
}
echo
"==== STRUCTURE ====
\n
"
;
check
(
'structure/'
,
$structure
);
echo
"
\n\n
"
;
echo
"==== VISUAL ====
\n
"
;
check
(
'visual/'
,
$visual
);
« Previous
1
2
Next »
(2-2/2)
Loading...