New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceManager relative url check fails #61

Closed
eliottrobson opened this Issue Mar 11, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@eliottrobson

eliottrobson commented Mar 11, 2017

The ResourceManager getResourceUrl regex fails:
preg_match('#^(?:/|[a-z]:/).*$#i', $filename) === 0

when given an absolute URL (custom theme).

What is this supposed to do? Maybe a replacement such as:

preg_match('/^(https?)?:///', $filename)

could work?

@AndiDittrich

This comment has been minimized.

Show comment
Hide comment
@AndiDittrich

AndiDittrich Mar 11, 2017

Member

Dear Eliott,

thanks for your report!
I can confirm that external themes (enlighter/ subdirectory in your theme) are not correctly loaded.

The ResourceManager is responsible for the invalid URL but it is not the issue :)
In ResourceLoader.php, the external Themes are enqueued the wrong way - i am sorry for that - i've forgott to update the code!

// load user themes ?
if ($this->_config['embedExternalThemes']) {
    // embed available external themes
    foreach ($this->_themeManager->getUserThemes() as $theme => $sources) {
        $this->enqueueStyle('enlighter-external-' . strtolower($theme), $sources[1]);
    }
}

I will fix it asap!

best regards, Andi

Member

AndiDittrich commented Mar 11, 2017

Dear Eliott,

thanks for your report!
I can confirm that external themes (enlighter/ subdirectory in your theme) are not correctly loaded.

The ResourceManager is responsible for the invalid URL but it is not the issue :)
In ResourceLoader.php, the external Themes are enqueued the wrong way - i am sorry for that - i've forgott to update the code!

// load user themes ?
if ($this->_config['embedExternalThemes']) {
    // embed available external themes
    foreach ($this->_themeManager->getUserThemes() as $theme => $sources) {
        $this->enqueueStyle('enlighter-external-' . strtolower($theme), $sources[1]);
    }
}

I will fix it asap!

best regards, Andi

@AndiDittrich AndiDittrich added this to the 3.4 milestone Mar 11, 2017

@AndiDittrich

This comment has been minimized.

Show comment
Hide comment
@AndiDittrich

AndiDittrich Mar 11, 2017

Member

And of course..the regex seems to be weak...sry!

Member

AndiDittrich commented Mar 11, 2017

And of course..the regex seems to be weak...sry!

@AndiDittrich

This comment has been minimized.

Show comment
Hide comment
@AndiDittrich

AndiDittrich Mar 11, 2017

Member

Fixed in v3.4-BETA5 - available within the current master branch

Well .. .a simple + (plus) sign was missing in the regex. I've chosen these "strange" version to match external URLs with protocols like http:// as well as without protocols //fonts.google.com

Member

AndiDittrich commented Mar 11, 2017

Fixed in v3.4-BETA5 - available within the current master branch

Well .. .a simple + (plus) sign was missing in the regex. I've chosen these "strange" version to match external URLs with protocols like http:// as well as without protocols //fonts.google.com

@eliottrobson

This comment has been minimized.

Show comment
Hide comment
@eliottrobson

eliottrobson Mar 11, 2017

Excellent, I'll update to the beta version and look forwards to the wp repository update.

eliottrobson commented Mar 11, 2017

Excellent, I'll update to the beta version and look forwards to the wp repository update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment