1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-06-01 21:32:18 +02:00
gdk/modules/base/lib/phpQuery/phpQuery/plugins/Scripts/fix_webroot.php
2020-01-25 14:52:35 +08:00

16 lines
475 B
PHP

<?php
$selector = 'img[src], link[href], script[src]';
$filter = ':not([href^=<?php])'
.':not([src^=<?php])'
.':not([href^=http://])'
.':not([src^=http://])'
.':not([src^=/])';
foreach($self[$selector]->filter($filter) as $el) {
$el = pq($el, $self->getDocumentID());
// imgs and scripts
if ( $el->is('img') || $el->is('script') )
$el->attr('src', $params[0].$el->attr('src'));
// css
if ( $el->is('link') )
$el->attr('href', $params[0].$el->attr('href'));
}