PluginProbe
FakerPress / 0.7.2
FakerPress v0.7.2
0.9.2 trunk 0.1.0 0.1.1 0.1.2 0.1.3 0.5.2 0.5.3 0.6.1 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.7.0 0.7.1 0.7.2 0.8.0 0.9.0 0.9.1
fakerpress / src / functions / assets.php

assets.php in FakerPress 0.7.2, at src/functions/assets.php

49 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace FakerPress;
3
4 /**
5 * Shortcut for FakerPress\Utils\Assets::register(), include a single asset
6 *
7 * @since 0.5.1
8 *
9 * @param string $slug Slug to save the asset - passes through `sanitize_title_with_dashes()`.
10 * @param string $file The asset file to load (CSS or JS), including non-minified file extension.
11 * @param array $deps The list of dependencies.
12 * @param string|array|null $action The WordPress action(s) to enqueue on, such as `wp_enqueue_scripts`,
13 * `admin_enqueue_scripts`, or `login_enqueue_scripts`.
14 * @param array $arguments See `FakerPress\Assets::register()` for more info.
15 *
16 * @return object|false The asset that got registered or false on error.
17 */
18 function register_asset( $slug, $file, $deps = [], $action = null, $arguments = [] ) {
19 $origin = make( Plugin::class );
20 $assets = make( Utils\Assets::class );
21
22 return $assets->register( $origin, $slug, $file, $deps, $action, $arguments );
23 }
24
25 /**
26 * Shortcut for FakerPress\Assets::enqueue() to include assets.
27 *
28 * @since 0.5.1
29 *
30 * @param string|array $slug Slug to enqueue
31 */
32 function enqueue_asset( $slug ) {
33 $assets = make( Utils\Assets::class );
34
35 $assets->enqueue( $slug );
36 }
37
38 /**
39 * Shortcut for FakerPress\Assets::enqueue_group() include assets by groups.
40 *
41 * @since 0.5.1
42 *
43 * @param string|array $group Which group(s) should be enqueued.
44 */
45 function enqueue_asset_group( $group ) {
46 $assets = make( Utils\Assets::class );
47 $assets->enqueue_group( $group );
48 }
49