Abstract_Repository.php
3 years ago
Ad_Repository.php
3 years ago
Group_Repository.php
2 years ago
Placement_Type.php
2 years ago
Placement_Type_Options.php
3 years ago
Placement_Type_Options.php
83 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Advanced_Ads; |
| 4 | |
| 5 | /** |
| 6 | * The placement type options are stored in an array, this wraps them so we can operate on them. |
| 7 | */ |
| 8 | class Placement_Type_Options extends \ArrayObject { |
| 9 | /** |
| 10 | * Whether to show the positioning options. |
| 11 | * |
| 12 | * @var bool |
| 13 | */ |
| 14 | private $show_position = false; |
| 15 | |
| 16 | /** |
| 17 | * Whether to show lazy loading. |
| 18 | * |
| 19 | * @var bool |
| 20 | */ |
| 21 | private $show_lazy_load = false; |
| 22 | |
| 23 | /** |
| 24 | * Whether to show content options. |
| 25 | * |
| 26 | * @var bool |
| 27 | */ |
| 28 | private $uses_the_content = false; |
| 29 | |
| 30 | /** |
| 31 | * Whether this placement is available in AMP. |
| 32 | * |
| 33 | * @var bool |
| 34 | */ |
| 35 | private $amp = false; |
| 36 | |
| 37 | /** |
| 38 | * Array of allowed ad types for this placement. Default null. |
| 39 | * |
| 40 | * @var null|string[] |
| 41 | */ |
| 42 | private $allowed_ad_types = null; |
| 43 | |
| 44 | /** |
| 45 | * Array of excluded ad types for this placement. |
| 46 | * |
| 47 | * @var string[] |
| 48 | */ |
| 49 | private $excluded_ad_types = []; |
| 50 | |
| 51 | /** |
| 52 | * Array of allowed ad group types for this placement. |
| 53 | * |
| 54 | * @var null|string[] |
| 55 | */ |
| 56 | private $allowed_group_types = null; |
| 57 | |
| 58 | /** |
| 59 | * Array of excluded ad groups for this placement. |
| 60 | * |
| 61 | * @var string[] |
| 62 | */ |
| 63 | private $excluded_group_types = []; |
| 64 | |
| 65 | /** |
| 66 | * Overload offsetGet in order to get the default value for the option. |
| 67 | * |
| 68 | * @param string $key The array offset to search for. |
| 69 | * |
| 70 | * @return false|mixed |
| 71 | */ |
| 72 | #[\ReturnTypeWillChange] |
| 73 | public function &offsetGet( $key ) { |
| 74 | if ( ! $this->offsetExists( $key ) && property_exists( $this, $key ) ) { |
| 75 | return $this->{$key}; |
| 76 | } |
| 77 | |
| 78 | $value = parent::offsetGet( $key ); |
| 79 | |
| 80 | return $value; |
| 81 | } |
| 82 | } |
| 83 |