[wp-trac] [WordPress Trac] #18753: Add data to stylesheets
WordPress Trac
noreply at wordpress.org
Mon Oct 22 04:38:32 UTC 2012
#18753: Add data to stylesheets
-----------------------------------+------------------------------
Reporter: kobenland | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Template | Version:
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion |
-----------------------------------+------------------------------
Comment (by ryanve):
@kobenland I like the goal of this idea. I also feel that the script/style
system is more complex that it needs to be and it needs to be simplified.
I think it would be better to implement a more general data method that
could be used for many purposes rather than adding a function that only
gets used a few times. A function like the example below would be capable
of storing data related to scripts/styles and practically anything else.
Also (loosely related) see #22249
{{{
// Get or set data via key/value pair.
function wp_data ($k = null, $v = null) {
static $hash;
isset($hash) or $hash = array(); // only initiates once
if ( func_num_args() > 1 )
return $hash[$k] = $v; // set
if ( is_scalar($k) )
return $hash[$k]; // get
if ( is_null($k) )
return $hash; // get all
return $hash = array_merge($hash, (array) $k); // set multi
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18753#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list