[wp-trac] [WordPress Trac] #24954: Enhance wp_enqueue_style to allow the rel attribute to be set
WordPress Trac
noreply at wordpress.org
Sun Dec 7 19:24:53 UTC 2014
#24954: Enhance wp_enqueue_style to allow the rel attribute to be set
---------------------------+------------------------------
Reporter: hypedtext | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: 3.6
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Comment (by dcondrey):
{{{
/**
* Validate explicit rel value if set
* Set to appropriate value based on URI suffix if not explicit
*/
if ($this->$rel && !is_bool($this->$rel) && preg_match('/^[\p{L}\p{N}
.-]+$/', $this->$rel)) {
$rel = $this->$rel;
} else {
if (preg_match('/.css$/', $src)) $rel = '';
elseif (preg_match('/.less$/', $src)) $rel = '/less';
elseif (preg_match('/.sass/', $src)) $rel = '/sass';
elseif (preg_match('/.scss/', $src)) $rel = '/scss';
$rel = 'stylesheet' . $rel;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24954#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list