abstracts
9 months ago
admin
10 months ago
ads
9 months ago
compatibility
9 months ago
crons
1 year ago
frontend
11 months ago
groups
1 year ago
importers
1 year ago
installation
1 year ago
interfaces
1 year ago
placements
1 year ago
rest
1 year ago
traits
1 year ago
utilities
11 months ago
array_ad_conditions.php
1 year ago
cap_map.php
3 years ago
class-assets-registry.php
1 year ago
class-autoloader.php
1 year ago
class-constants.php
1 year ago
class-entities.php
1 year ago
class-modal.php
1 year ago
class-modules.php
1 year ago
class-options.php
1 year ago
class-plugin.php
1 year ago
class-post-data.php
10 months ago
class-shortcodes.php
1 year ago
class-upgrades.php
1 year ago
class-widget.php
11 months ago
default-hooks.php
1 year ago
functions-ad.php
1 year ago
functions-conditional.php
1 year ago
functions-core.php
1 year ago
functions-group.php
1 year ago
functions-placement.php
1 year ago
functions.php
1 year ago
index.php
2 years ago
load_modules.php
2 years ago
functions-core.php
45 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Core functions |
| 4 | * |
| 5 | * @since 2.0.0 |
| 6 | * @package AdvancedAds |
| 7 | * @author Advanced Ads <info@wpadvancedads.com> |
| 8 | */ |
| 9 | |
| 10 | use AdvancedAds\Framework\JSON; |
| 11 | |
| 12 | /** |
| 13 | * Add to JSON object. |
| 14 | * |
| 15 | * @since 1.0.0 |
| 16 | * |
| 17 | * @param mixed ...$args Arguments. |
| 18 | * |
| 19 | * Parameters can be |
| 20 | * 1. array|string Unique identifier or array<key, value>. |
| 21 | * 2. array|string The data itself can be either a scalar or an array. |
| 22 | * In Case of first param an array this can be object_name. |
| 23 | * 3. string Name for the JavaScript object. |
| 24 | * Passed directly, so it should be qualified JS variable. |
| 25 | * |
| 26 | * @return JSON |
| 27 | */ |
| 28 | function wp_advads_json_add( ...$args ): JSON { |
| 29 | return wp_advads()->json->add( ...$args ); |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Remove from JSON object. |
| 34 | * |
| 35 | * @since 1.0.0 |
| 36 | * |
| 37 | * @param string $key Unique identifier. |
| 38 | * @param string $object_name Name for the JavaScript object. |
| 39 | * Passed directly, so it should be qualified JS variable. |
| 40 | * @return JSON |
| 41 | */ |
| 42 | function wp_advads_json_remove( $key, $object_name = false ): JSON { |
| 43 | return wp_advads()->json->remove( $key, $object_name ); |
| 44 | } |
| 45 |