/** * Enqueue a CSS style file. * * Registers the style if src provided (does NOT overwrite) and enqueues. * * @since r79 * @see nxt_Styles::add(), nxt_Styles::enqueue() * @global object $nxt_styles The nxt_Styles object for printing styles. * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. * * @param string $handle Name of the stylesheet. * @param string|bool $src Path to the stylesheet from the root directory of NXTClass. Example: '/css/mystyle.css'. * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on. * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter * is used to ensure that the correct version is sent to the client regardless of caching, and so should be included * if a version number is available and makes sense for the stylesheet. * @param string $media The media for which this stylesheet has been defined. */ function nxt_enqueue_style($handle, $src = false, $deps = array(), $ver = false, $media = false) { global $nxt_styles; if (!is_a($nxt_styles, 'nxt_Styles')) { $nxt_styles = new nxt_Styles(); } if ($src) { $_handle = explode('?', $handle); $nxt_styles->add($_handle[0], $src, $deps, $ver, $media); } $nxt_styles->enqueue($handle); }
/** * Enqueue a CSS style file. * * Registers the style if src provided (does NOT overwrite) and enqueues. * * @since r79 * @see nxt_Styles::add(), nxt_Styles::enqueue() * @global object $nxt_styles The nxt_Styles object for printing styles. * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types. * * @param string $handle Name of the stylesheet. * @param string|bool $src Path to the stylesheet from the root directory of NXTClass. Example: '/css/mystyle.css'. * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on. * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies. * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter * is used to ensure that the correct version is sent to the client regardless of caching, and so should be included * if a version number is available and makes sense for the stylesheet. * @param string $media The media for which this stylesheet has been defined. */ function nxt_enqueue_style($handle, $src = false, $deps = array(), $ver = false, $media = 'all') { global $nxt_styles; if (!is_a($nxt_styles, 'nxt_Styles')) { if (!did_action('init')) { _doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>nxt_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>'), '3.3'); } $nxt_styles = new nxt_Styles(); } if ($src) { $_handle = explode('?', $handle); $nxt_styles->add($_handle[0], $src, $deps, $ver, $media); } $nxt_styles->enqueue($handle); }