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
fbc8e265
Commit
fbc8e265
authored
May 26, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Method "AssetController::adjustCssUrl()" has been implemented in basic.
parent
ce6b73c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
AssetController.php
framework/yii/console/controllers/AssetController.php
+24
-3
No files found.
framework/yii/console/controllers/AssetController.php
View file @
fbc8e265
...
@@ -536,10 +536,31 @@ EOD
...
@@ -536,10 +536,31 @@ EOD
*/
*/
protected
function
adjustCssUrl
(
$cssContent
,
$inputFilePath
,
$outputFilePath
)
protected
function
adjustCssUrl
(
$cssContent
,
$inputFilePath
,
$outputFilePath
)
{
{
$callback
=
function
(
$matches
)
use
(
$inputFilePath
,
$outputFilePath
)
{
$sharedPath
=
''
;
return
$matches
[
0
];
for
(
$i
=
0
;
$i
<
strlen
(
$inputFilePath
);
$i
++
)
{
if
(
!
isset
(
$outputFilePath
[
$i
]))
{
break
;
}
if
(
$inputFilePath
[
$i
]
==
$outputFilePath
[
$i
])
{
$sharedPath
.=
$inputFilePath
[
$i
];
}
}
$inputFileRelativePath
=
trim
(
str_replace
(
$sharedPath
,
''
,
$inputFilePath
),
'/'
);
$outputFileRelativePath
=
trim
(
str_replace
(
$sharedPath
,
''
,
$outputFilePath
),
'/'
);
$inputFileRelativePathParts
=
explode
(
'/'
,
$inputFileRelativePath
);
$outputFileRelativePathParts
=
explode
(
'/'
,
$outputFileRelativePath
);
$callback
=
function
(
$matches
)
use
(
$inputFileRelativePathParts
,
$outputFileRelativePathParts
)
{
$fullMatch
=
$matches
[
0
];
$inputUrl
=
$matches
[
1
];
$urlPrefix
=
str_repeat
(
'../'
,
count
(
$outputFileRelativePathParts
));
$urlPrefix
.=
implode
(
'/'
,
$inputFileRelativePathParts
);
$outputUrl
=
$urlPrefix
.
'/'
.
$inputUrl
;
return
str_replace
(
$inputUrl
,
$outputUrl
,
$fullMatch
);
};
};
$cssContent
=
preg_replace_callback
(
'/[\w\-]:\s*url\("(
.
*)"\)+/is'
,
$callback
,
$cssContent
);
$cssContent
=
preg_replace_callback
(
'/[\w\-]:\s*url\("(
[^"]
*)"\)+/is'
,
$callback
,
$cssContent
);
return
$cssContent
;
return
$cssContent
;
}
}
...
...
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