@@ -24,298 +24,298 @@ |
||
| 24 | 24 | abstract class AssetManager implements AssetManagerInterface |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var AssetCollection $assets |
|
| 29 | - */ |
|
| 30 | - protected $assets; |
|
| 27 | + /** |
|
| 28 | + * @var AssetCollection $assets |
|
| 29 | + */ |
|
| 30 | + protected $assets; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var DomainInterface |
|
| 34 | - */ |
|
| 35 | - protected $domain; |
|
| 32 | + /** |
|
| 33 | + * @var DomainInterface |
|
| 34 | + */ |
|
| 35 | + protected $domain; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var Registry $registry |
|
| 39 | - */ |
|
| 40 | - protected $registry; |
|
| 37 | + /** |
|
| 38 | + * @var Registry $registry |
|
| 39 | + */ |
|
| 40 | + protected $registry; |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * AssetRegister constructor. |
|
| 45 | - * |
|
| 46 | - * @param DomainInterface $domain |
|
| 47 | - * @param AssetCollection $assets |
|
| 48 | - * @param Registry $registry |
|
| 49 | - */ |
|
| 50 | - public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry) |
|
| 51 | - { |
|
| 52 | - $this->domain = $domain; |
|
| 53 | - $this->assets = $assets; |
|
| 54 | - $this->registry = $registry; |
|
| 55 | - add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
| 56 | - add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
| 57 | - add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2); |
|
| 58 | - add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2); |
|
| 59 | - } |
|
| 43 | + /** |
|
| 44 | + * AssetRegister constructor. |
|
| 45 | + * |
|
| 46 | + * @param DomainInterface $domain |
|
| 47 | + * @param AssetCollection $assets |
|
| 48 | + * @param Registry $registry |
|
| 49 | + */ |
|
| 50 | + public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry) |
|
| 51 | + { |
|
| 52 | + $this->domain = $domain; |
|
| 53 | + $this->assets = $assets; |
|
| 54 | + $this->registry = $registry; |
|
| 55 | + add_action('wp_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
| 56 | + add_action('admin_enqueue_scripts', array($this, 'addManifestFile'), 0); |
|
| 57 | + add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2); |
|
| 58 | + add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @since 4.9.71.p |
|
| 64 | - * @return string |
|
| 65 | - */ |
|
| 66 | - public function assetNamespace() |
|
| 67 | - { |
|
| 68 | - return $this->domain->assetNamespace(); |
|
| 69 | - } |
|
| 62 | + /** |
|
| 63 | + * @since 4.9.71.p |
|
| 64 | + * @return string |
|
| 65 | + */ |
|
| 66 | + public function assetNamespace() |
|
| 67 | + { |
|
| 68 | + return $this->domain->assetNamespace(); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @return void |
|
| 74 | - * @throws DuplicateCollectionIdentifierException |
|
| 75 | - * @throws InvalidDataTypeException |
|
| 76 | - * @throws InvalidEntityException |
|
| 77 | - * @since 4.9.62.p |
|
| 78 | - */ |
|
| 79 | - public function addManifestFile() |
|
| 80 | - { |
|
| 81 | - // if a manifest file has already been added for this domain, then just return |
|
| 82 | - if ($this->assets->has($this->domain->assetNamespace())) { |
|
| 83 | - return; |
|
| 84 | - } |
|
| 85 | - $asset = new ManifestFile($this->domain); |
|
| 86 | - $this->assets->add($asset, $this->domain->assetNamespace()); |
|
| 87 | - } |
|
| 72 | + /** |
|
| 73 | + * @return void |
|
| 74 | + * @throws DuplicateCollectionIdentifierException |
|
| 75 | + * @throws InvalidDataTypeException |
|
| 76 | + * @throws InvalidEntityException |
|
| 77 | + * @since 4.9.62.p |
|
| 78 | + */ |
|
| 79 | + public function addManifestFile() |
|
| 80 | + { |
|
| 81 | + // if a manifest file has already been added for this domain, then just return |
|
| 82 | + if ($this->assets->has($this->domain->assetNamespace())) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 85 | + $asset = new ManifestFile($this->domain); |
|
| 86 | + $this->assets->add($asset, $this->domain->assetNamespace()); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @return ManifestFile[] |
|
| 92 | - * @since 4.9.62.p |
|
| 93 | - */ |
|
| 94 | - public function getManifestFile() |
|
| 95 | - { |
|
| 96 | - return $this->assets->getManifestFiles(); |
|
| 97 | - } |
|
| 90 | + /** |
|
| 91 | + * @return ManifestFile[] |
|
| 92 | + * @since 4.9.62.p |
|
| 93 | + */ |
|
| 94 | + public function getManifestFile() |
|
| 95 | + { |
|
| 96 | + return $this->assets->getManifestFiles(); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * @param string $handle |
|
| 102 | - * @param string $source |
|
| 103 | - * @param array $dependencies |
|
| 104 | - * @param bool $load_in_footer |
|
| 105 | - * @param string $version |
|
| 106 | - * @return JavascriptAsset |
|
| 107 | - * @throws DuplicateCollectionIdentifierException |
|
| 108 | - * @throws InvalidDataTypeException |
|
| 109 | - * @throws InvalidEntityException |
|
| 110 | - * @throws DomainException |
|
| 111 | - * @since 4.9.62.p |
|
| 112 | - */ |
|
| 113 | - public function addJavascript( |
|
| 114 | - $handle, |
|
| 115 | - $source, |
|
| 116 | - array $dependencies = array(), |
|
| 117 | - $load_in_footer = true, |
|
| 118 | - $version = '' |
|
| 119 | - ) { |
|
| 120 | - $asset = new JavascriptAsset( |
|
| 121 | - $handle, |
|
| 122 | - $source, |
|
| 123 | - array_unique($dependencies), |
|
| 124 | - $load_in_footer, |
|
| 125 | - $this->domain, |
|
| 126 | - $version |
|
| 127 | - ); |
|
| 128 | - $this->assets->add($asset, $handle); |
|
| 129 | - return $asset; |
|
| 130 | - } |
|
| 100 | + /** |
|
| 101 | + * @param string $handle |
|
| 102 | + * @param string $source |
|
| 103 | + * @param array $dependencies |
|
| 104 | + * @param bool $load_in_footer |
|
| 105 | + * @param string $version |
|
| 106 | + * @return JavascriptAsset |
|
| 107 | + * @throws DuplicateCollectionIdentifierException |
|
| 108 | + * @throws InvalidDataTypeException |
|
| 109 | + * @throws InvalidEntityException |
|
| 110 | + * @throws DomainException |
|
| 111 | + * @since 4.9.62.p |
|
| 112 | + */ |
|
| 113 | + public function addJavascript( |
|
| 114 | + $handle, |
|
| 115 | + $source, |
|
| 116 | + array $dependencies = array(), |
|
| 117 | + $load_in_footer = true, |
|
| 118 | + $version = '' |
|
| 119 | + ) { |
|
| 120 | + $asset = new JavascriptAsset( |
|
| 121 | + $handle, |
|
| 122 | + $source, |
|
| 123 | + array_unique($dependencies), |
|
| 124 | + $load_in_footer, |
|
| 125 | + $this->domain, |
|
| 126 | + $version |
|
| 127 | + ); |
|
| 128 | + $this->assets->add($asset, $handle); |
|
| 129 | + return $asset; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Used to register a javascript asset where everything is dynamically derived from the given handle. |
|
| 135 | - * |
|
| 136 | - * @param string $handle |
|
| 137 | - * @param string|array $extra_dependencies |
|
| 138 | - * @return JavascriptAsset |
|
| 139 | - * @throws DuplicateCollectionIdentifierException |
|
| 140 | - * @throws InvalidDataTypeException |
|
| 141 | - * @throws InvalidEntityException |
|
| 142 | - * @throws DomainException |
|
| 143 | - */ |
|
| 144 | - public function addJs($handle, $extra_dependencies = []) |
|
| 145 | - { |
|
| 146 | - $details = $this->getAssetDetails( |
|
| 147 | - Asset::TYPE_JS, |
|
| 148 | - $handle, |
|
| 149 | - $extra_dependencies |
|
| 150 | - ); |
|
| 151 | - return $this->addJavascript( |
|
| 152 | - $handle, |
|
| 153 | - $this->registry->getJsUrl($this->domain->assetNamespace(), $handle), |
|
| 154 | - $details['dependencies'], |
|
| 155 | - true, |
|
| 156 | - $details['version'] |
|
| 157 | - ); |
|
| 158 | - } |
|
| 133 | + /** |
|
| 134 | + * Used to register a javascript asset where everything is dynamically derived from the given handle. |
|
| 135 | + * |
|
| 136 | + * @param string $handle |
|
| 137 | + * @param string|array $extra_dependencies |
|
| 138 | + * @return JavascriptAsset |
|
| 139 | + * @throws DuplicateCollectionIdentifierException |
|
| 140 | + * @throws InvalidDataTypeException |
|
| 141 | + * @throws InvalidEntityException |
|
| 142 | + * @throws DomainException |
|
| 143 | + */ |
|
| 144 | + public function addJs($handle, $extra_dependencies = []) |
|
| 145 | + { |
|
| 146 | + $details = $this->getAssetDetails( |
|
| 147 | + Asset::TYPE_JS, |
|
| 148 | + $handle, |
|
| 149 | + $extra_dependencies |
|
| 150 | + ); |
|
| 151 | + return $this->addJavascript( |
|
| 152 | + $handle, |
|
| 153 | + $this->registry->getJsUrl($this->domain->assetNamespace(), $handle), |
|
| 154 | + $details['dependencies'], |
|
| 155 | + true, |
|
| 156 | + $details['version'] |
|
| 157 | + ); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * @param string $handle |
|
| 163 | - * @param array $dependencies |
|
| 164 | - * @param bool $load_in_footer |
|
| 165 | - * @param string $version |
|
| 166 | - * @return JavascriptAsset |
|
| 167 | - * @throws DomainException |
|
| 168 | - * @throws DuplicateCollectionIdentifierException |
|
| 169 | - * @throws InvalidDataTypeException |
|
| 170 | - * @throws InvalidEntityException |
|
| 171 | - * @since 4.9.71.p |
|
| 172 | - */ |
|
| 173 | - public function addVendorJavascript( |
|
| 174 | - $handle, |
|
| 175 | - array $dependencies = array(), |
|
| 176 | - $load_in_footer = true, |
|
| 177 | - $version = '' |
|
| 178 | - ) { |
|
| 179 | - $dev_suffix = wp_scripts_get_suffix('dev'); |
|
| 180 | - $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/'; |
|
| 181 | - return $this->addJavascript( |
|
| 182 | - $handle, |
|
| 183 | - "{$vendor_path}{$handle}{$dev_suffix}.js", |
|
| 184 | - $dependencies, |
|
| 185 | - $load_in_footer, |
|
| 186 | - $version |
|
| 187 | - ); |
|
| 188 | - } |
|
| 161 | + /** |
|
| 162 | + * @param string $handle |
|
| 163 | + * @param array $dependencies |
|
| 164 | + * @param bool $load_in_footer |
|
| 165 | + * @param string $version |
|
| 166 | + * @return JavascriptAsset |
|
| 167 | + * @throws DomainException |
|
| 168 | + * @throws DuplicateCollectionIdentifierException |
|
| 169 | + * @throws InvalidDataTypeException |
|
| 170 | + * @throws InvalidEntityException |
|
| 171 | + * @since 4.9.71.p |
|
| 172 | + */ |
|
| 173 | + public function addVendorJavascript( |
|
| 174 | + $handle, |
|
| 175 | + array $dependencies = array(), |
|
| 176 | + $load_in_footer = true, |
|
| 177 | + $version = '' |
|
| 178 | + ) { |
|
| 179 | + $dev_suffix = wp_scripts_get_suffix('dev'); |
|
| 180 | + $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/'; |
|
| 181 | + return $this->addJavascript( |
|
| 182 | + $handle, |
|
| 183 | + "{$vendor_path}{$handle}{$dev_suffix}.js", |
|
| 184 | + $dependencies, |
|
| 185 | + $load_in_footer, |
|
| 186 | + $version |
|
| 187 | + ); |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | 190 | |
| 191 | - /** |
|
| 192 | - * @param string $handle |
|
| 193 | - * @param string $source |
|
| 194 | - * @param array $dependencies |
|
| 195 | - * @param string $media |
|
| 196 | - * @param string $version |
|
| 197 | - * @return StylesheetAsset |
|
| 198 | - * @throws DomainException |
|
| 199 | - * @throws DuplicateCollectionIdentifierException |
|
| 200 | - * @throws InvalidDataTypeException |
|
| 201 | - * @throws InvalidEntityException |
|
| 202 | - * @since 4.9.62.p |
|
| 203 | - */ |
|
| 204 | - public function addStylesheet( |
|
| 205 | - $handle, |
|
| 206 | - $source, |
|
| 207 | - array $dependencies = array(), |
|
| 208 | - $media = 'all', |
|
| 209 | - $version = '' |
|
| 210 | - ) { |
|
| 211 | - $asset = new StylesheetAsset( |
|
| 212 | - $handle, |
|
| 213 | - $source, |
|
| 214 | - array_unique($dependencies), |
|
| 215 | - $this->domain, |
|
| 216 | - $media, |
|
| 217 | - $version |
|
| 218 | - ); |
|
| 219 | - $this->assets->add($asset, $handle); |
|
| 220 | - return $asset; |
|
| 221 | - } |
|
| 191 | + /** |
|
| 192 | + * @param string $handle |
|
| 193 | + * @param string $source |
|
| 194 | + * @param array $dependencies |
|
| 195 | + * @param string $media |
|
| 196 | + * @param string $version |
|
| 197 | + * @return StylesheetAsset |
|
| 198 | + * @throws DomainException |
|
| 199 | + * @throws DuplicateCollectionIdentifierException |
|
| 200 | + * @throws InvalidDataTypeException |
|
| 201 | + * @throws InvalidEntityException |
|
| 202 | + * @since 4.9.62.p |
|
| 203 | + */ |
|
| 204 | + public function addStylesheet( |
|
| 205 | + $handle, |
|
| 206 | + $source, |
|
| 207 | + array $dependencies = array(), |
|
| 208 | + $media = 'all', |
|
| 209 | + $version = '' |
|
| 210 | + ) { |
|
| 211 | + $asset = new StylesheetAsset( |
|
| 212 | + $handle, |
|
| 213 | + $source, |
|
| 214 | + array_unique($dependencies), |
|
| 215 | + $this->domain, |
|
| 216 | + $media, |
|
| 217 | + $version |
|
| 218 | + ); |
|
| 219 | + $this->assets->add($asset, $handle); |
|
| 220 | + return $asset; |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * Used to register a css asset where everything is dynamically derived from the given handle. |
|
| 226 | - * |
|
| 227 | - * @param string $handle |
|
| 228 | - * @param string|array $extra_dependencies |
|
| 229 | - * @return StylesheetAsset |
|
| 230 | - * @throws DuplicateCollectionIdentifierException |
|
| 231 | - * @throws InvalidDataTypeException |
|
| 232 | - * @throws InvalidEntityException |
|
| 233 | - * @throws DomainException |
|
| 234 | - */ |
|
| 235 | - public function addCss($handle, $extra_dependencies = []) |
|
| 236 | - { |
|
| 237 | - $details = $this->getAssetDetails( |
|
| 238 | - Asset::TYPE_CSS, |
|
| 239 | - $handle, |
|
| 240 | - $extra_dependencies |
|
| 241 | - ); |
|
| 242 | - return $this->addStylesheet( |
|
| 243 | - $handle, |
|
| 244 | - $this->registry->getCssUrl($this->domain->assetNamespace(), $handle), |
|
| 245 | - $details['dependencies'], |
|
| 246 | - 'all', |
|
| 247 | - $details['version'] |
|
| 248 | - ); |
|
| 249 | - } |
|
| 224 | + /** |
|
| 225 | + * Used to register a css asset where everything is dynamically derived from the given handle. |
|
| 226 | + * |
|
| 227 | + * @param string $handle |
|
| 228 | + * @param string|array $extra_dependencies |
|
| 229 | + * @return StylesheetAsset |
|
| 230 | + * @throws DuplicateCollectionIdentifierException |
|
| 231 | + * @throws InvalidDataTypeException |
|
| 232 | + * @throws InvalidEntityException |
|
| 233 | + * @throws DomainException |
|
| 234 | + */ |
|
| 235 | + public function addCss($handle, $extra_dependencies = []) |
|
| 236 | + { |
|
| 237 | + $details = $this->getAssetDetails( |
|
| 238 | + Asset::TYPE_CSS, |
|
| 239 | + $handle, |
|
| 240 | + $extra_dependencies |
|
| 241 | + ); |
|
| 242 | + return $this->addStylesheet( |
|
| 243 | + $handle, |
|
| 244 | + $this->registry->getCssUrl($this->domain->assetNamespace(), $handle), |
|
| 245 | + $details['dependencies'], |
|
| 246 | + 'all', |
|
| 247 | + $details['version'] |
|
| 248 | + ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * @param string $handle |
|
| 254 | - * @return bool |
|
| 255 | - * @since 4.9.62.p |
|
| 256 | - */ |
|
| 257 | - public function enqueueAsset($handle) |
|
| 258 | - { |
|
| 259 | - if ($this->assets->has($handle)) { |
|
| 260 | - $asset = $this->assets->get($handle); |
|
| 261 | - if ($asset->isRegistered()) { |
|
| 262 | - $asset->enqueueAsset(); |
|
| 263 | - return true; |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - return false; |
|
| 267 | - } |
|
| 252 | + /** |
|
| 253 | + * @param string $handle |
|
| 254 | + * @return bool |
|
| 255 | + * @since 4.9.62.p |
|
| 256 | + */ |
|
| 257 | + public function enqueueAsset($handle) |
|
| 258 | + { |
|
| 259 | + if ($this->assets->has($handle)) { |
|
| 260 | + $asset = $this->assets->get($handle); |
|
| 261 | + if ($asset->isRegistered()) { |
|
| 262 | + $asset->enqueueAsset(); |
|
| 263 | + return true; |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + return false; |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * @return void |
|
| 272 | - * @since $VID:$ |
|
| 273 | - */ |
|
| 274 | - public function enqueueBrowserAssets() |
|
| 275 | - { |
|
| 276 | - foreach ($this->assets as $asset) { |
|
| 277 | - if ($asset instanceof BrowserAsset) { |
|
| 278 | - $asset->enqueueAsset(); |
|
| 279 | - } |
|
| 280 | - } |
|
| 281 | - } |
|
| 270 | + /** |
|
| 271 | + * @return void |
|
| 272 | + * @since $VID:$ |
|
| 273 | + */ |
|
| 274 | + public function enqueueBrowserAssets() |
|
| 275 | + { |
|
| 276 | + foreach ($this->assets as $asset) { |
|
| 277 | + if ($asset instanceof BrowserAsset) { |
|
| 278 | + $asset->enqueueAsset(); |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | 283 | |
| 284 | - /** |
|
| 285 | - * @param string $asset_type |
|
| 286 | - * @param string $handle |
|
| 287 | - * @param array $extra_dependencies |
|
| 288 | - * @return array |
|
| 289 | - * @since 4.10.2.p |
|
| 290 | - */ |
|
| 291 | - private function getAssetDetails($asset_type, $handle, $extra_dependencies = []) |
|
| 292 | - { |
|
| 293 | - $getAssetDetails = ''; |
|
| 294 | - switch ($asset_type) { |
|
| 295 | - case Asset::TYPE_JS : |
|
| 296 | - $getAssetDetails = 'getJsAssetDetails'; |
|
| 297 | - break; |
|
| 298 | - case Asset::TYPE_CSS : |
|
| 299 | - $getAssetDetails = 'getCssAssetDetails'; |
|
| 300 | - break; |
|
| 301 | - } |
|
| 302 | - if ($getAssetDetails === '') { |
|
| 303 | - return ['dependencies' => [], 'version' => '']; |
|
| 304 | - } |
|
| 305 | - $details = $this->registry->$getAssetDetails( |
|
| 306 | - $this->domain->assetNamespace(), |
|
| 307 | - $handle |
|
| 308 | - ); |
|
| 309 | - $details['dependencies'] = isset($details['dependencies']) |
|
| 310 | - ? $details['dependencies'] |
|
| 311 | - : []; |
|
| 312 | - $details['version'] = isset($details['version']) |
|
| 313 | - ? $details['version'] |
|
| 314 | - : ''; |
|
| 315 | - $details['dependencies'] = ! empty($extra_dependencies) |
|
| 316 | - ? array_merge($details['dependencies'], (array) $extra_dependencies) |
|
| 317 | - : $details['dependencies']; |
|
| 318 | - return $details; |
|
| 284 | + /** |
|
| 285 | + * @param string $asset_type |
|
| 286 | + * @param string $handle |
|
| 287 | + * @param array $extra_dependencies |
|
| 288 | + * @return array |
|
| 289 | + * @since 4.10.2.p |
|
| 290 | + */ |
|
| 291 | + private function getAssetDetails($asset_type, $handle, $extra_dependencies = []) |
|
| 292 | + { |
|
| 293 | + $getAssetDetails = ''; |
|
| 294 | + switch ($asset_type) { |
|
| 295 | + case Asset::TYPE_JS : |
|
| 296 | + $getAssetDetails = 'getJsAssetDetails'; |
|
| 297 | + break; |
|
| 298 | + case Asset::TYPE_CSS : |
|
| 299 | + $getAssetDetails = 'getCssAssetDetails'; |
|
| 300 | + break; |
|
| 301 | + } |
|
| 302 | + if ($getAssetDetails === '') { |
|
| 303 | + return ['dependencies' => [], 'version' => '']; |
|
| 304 | + } |
|
| 305 | + $details = $this->registry->$getAssetDetails( |
|
| 306 | + $this->domain->assetNamespace(), |
|
| 307 | + $handle |
|
| 308 | + ); |
|
| 309 | + $details['dependencies'] = isset($details['dependencies']) |
|
| 310 | + ? $details['dependencies'] |
|
| 311 | + : []; |
|
| 312 | + $details['version'] = isset($details['version']) |
|
| 313 | + ? $details['version'] |
|
| 314 | + : ''; |
|
| 315 | + $details['dependencies'] = ! empty($extra_dependencies) |
|
| 316 | + ? array_merge($details['dependencies'], (array) $extra_dependencies) |
|
| 317 | + : $details['dependencies']; |
|
| 318 | + return $details; |
|
| 319 | 319 | |
| 320 | - } |
|
| 320 | + } |
|
| 321 | 321 | } |
@@ -17,71 +17,71 @@ |
||
| 17 | 17 | class StylesheetAsset extends BrowserAsset |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var string $media |
|
| 22 | - */ |
|
| 23 | - private $media; |
|
| 20 | + /** |
|
| 21 | + * @var string $media |
|
| 22 | + */ |
|
| 23 | + private $media; |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * CssFile constructor. |
|
| 28 | - * |
|
| 29 | - * @param $handle |
|
| 30 | - * @param string $source |
|
| 31 | - * @param array $dependencies |
|
| 32 | - * @param DomainInterface $domain |
|
| 33 | - * @param string $media |
|
| 34 | - * @param string $version |
|
| 35 | - * @throws InvalidDataTypeException |
|
| 36 | - * @throws DomainException |
|
| 37 | - */ |
|
| 38 | - public function __construct( |
|
| 39 | - $handle, |
|
| 40 | - $source, |
|
| 41 | - array $dependencies, |
|
| 42 | - DomainInterface $domain, |
|
| 43 | - $media = 'all', |
|
| 44 | - $version = '' |
|
| 45 | - ) { |
|
| 46 | - parent::__construct(Asset::TYPE_CSS, $handle, $source, $dependencies, $domain, $version); |
|
| 47 | - $this->setMedia($media); |
|
| 48 | - } |
|
| 26 | + /** |
|
| 27 | + * CssFile constructor. |
|
| 28 | + * |
|
| 29 | + * @param $handle |
|
| 30 | + * @param string $source |
|
| 31 | + * @param array $dependencies |
|
| 32 | + * @param DomainInterface $domain |
|
| 33 | + * @param string $media |
|
| 34 | + * @param string $version |
|
| 35 | + * @throws InvalidDataTypeException |
|
| 36 | + * @throws DomainException |
|
| 37 | + */ |
|
| 38 | + public function __construct( |
|
| 39 | + $handle, |
|
| 40 | + $source, |
|
| 41 | + array $dependencies, |
|
| 42 | + DomainInterface $domain, |
|
| 43 | + $media = 'all', |
|
| 44 | + $version = '' |
|
| 45 | + ) { |
|
| 46 | + parent::__construct(Asset::TYPE_CSS, $handle, $source, $dependencies, $domain, $version); |
|
| 47 | + $this->setMedia($media); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 54 | - public function media() |
|
| 55 | - { |
|
| 56 | - return $this->media; |
|
| 57 | - } |
|
| 51 | + /** |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | + public function media() |
|
| 55 | + { |
|
| 56 | + return $this->media; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @param string $media |
|
| 62 | - * @throws InvalidDataTypeException |
|
| 63 | - */ |
|
| 64 | - private function setMedia($media) |
|
| 65 | - { |
|
| 66 | - if (! is_string($media)) { |
|
| 67 | - throw new InvalidDataTypeException( |
|
| 68 | - '$media', |
|
| 69 | - $media, |
|
| 70 | - 'string' |
|
| 71 | - ); |
|
| 72 | - } |
|
| 73 | - $this->media = $media; |
|
| 74 | - } |
|
| 60 | + /** |
|
| 61 | + * @param string $media |
|
| 62 | + * @throws InvalidDataTypeException |
|
| 63 | + */ |
|
| 64 | + private function setMedia($media) |
|
| 65 | + { |
|
| 66 | + if (! is_string($media)) { |
|
| 67 | + throw new InvalidDataTypeException( |
|
| 68 | + '$media', |
|
| 69 | + $media, |
|
| 70 | + 'string' |
|
| 71 | + ); |
|
| 72 | + } |
|
| 73 | + $this->media = $media; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @since 4.9.62.p |
|
| 79 | - */ |
|
| 80 | - public function enqueueAsset() |
|
| 81 | - { |
|
| 82 | - if ($this->source() === '') { |
|
| 83 | - return; |
|
| 84 | - } |
|
| 85 | - wp_enqueue_style($this->handle()); |
|
| 86 | - } |
|
| 77 | + /** |
|
| 78 | + * @since 4.9.62.p |
|
| 79 | + */ |
|
| 80 | + public function enqueueAsset() |
|
| 81 | + { |
|
| 82 | + if ($this->source() === '') { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 85 | + wp_enqueue_style($this->handle()); |
|
| 86 | + } |
|
| 87 | 87 | } |
@@ -17,225 +17,225 @@ |
||
| 17 | 17 | abstract class BrowserAsset extends Asset |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var array $attributes |
|
| 22 | - */ |
|
| 23 | - private $attributes = []; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var array $allowed_attributes |
|
| 27 | - */ |
|
| 28 | - private static $allowed_attributes = [ |
|
| 29 | - Asset::TYPE_CSS => [ |
|
| 30 | - 'crossorigin', |
|
| 31 | - 'media', |
|
| 32 | - 'referrerpolicy', |
|
| 33 | - 'sizes', |
|
| 34 | - 'type', |
|
| 35 | - ], |
|
| 36 | - Asset::TYPE_JS => [ |
|
| 37 | - 'async', |
|
| 38 | - 'charset', |
|
| 39 | - 'crossorigin', |
|
| 40 | - 'defer', |
|
| 41 | - 'type', |
|
| 42 | - ] |
|
| 43 | - ]; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var array $dependencies |
|
| 47 | - */ |
|
| 48 | - private $dependencies; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var string $source |
|
| 52 | - */ |
|
| 53 | - private $source; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var string $version |
|
| 57 | - */ |
|
| 58 | - private $version; |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Asset constructor. |
|
| 63 | - * |
|
| 64 | - * @param string $type |
|
| 65 | - * @param string $handle |
|
| 66 | - * @param string $source |
|
| 67 | - * @param array $dependencies |
|
| 68 | - * @param DomainInterface $domain |
|
| 69 | - * @param string $version |
|
| 70 | - * @throws DomainException |
|
| 71 | - * @throws InvalidDataTypeException |
|
| 72 | - */ |
|
| 73 | - public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain, $version = '') |
|
| 74 | - { |
|
| 75 | - parent::__construct($type, $handle, $domain); |
|
| 76 | - $this->setSource($source); |
|
| 77 | - $this->setDependencies($dependencies); |
|
| 78 | - $this->setVersion($version, false); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @since 4.9.62.p |
|
| 84 | - */ |
|
| 85 | - abstract public function enqueueAsset(); |
|
| 86 | - |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @return array |
|
| 90 | - */ |
|
| 91 | - public function getAttributes() |
|
| 92 | - { |
|
| 93 | - return $this->attributes; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * @param array $attributes |
|
| 99 | - * @throws DomainException |
|
| 100 | - * @since $VID:$ |
|
| 101 | - */ |
|
| 102 | - public function addAttributes(array $attributes) |
|
| 103 | - { |
|
| 104 | - if (empty($attributes)) { |
|
| 105 | - throw new DomainException( |
|
| 106 | - esc_html__('The attributes array needs at least one value.', 'event_espresso') |
|
| 107 | - ); |
|
| 108 | - } |
|
| 109 | - foreach ($attributes as $key => $value) { |
|
| 110 | - if (is_int($key) && $this->validateAttribute($value)) { |
|
| 111 | - $this->attributes[] = $value; |
|
| 112 | - } else if ($this->validateAttribute($key)) { |
|
| 113 | - $this->attributes[ $key ] = $value; |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @param string $attribute |
|
| 121 | - * @return bool |
|
| 122 | - * @throws DomainException |
|
| 123 | - * @since $VID:$ |
|
| 124 | - */ |
|
| 125 | - private function validateAttribute($attribute) |
|
| 126 | - { |
|
| 127 | - $allowed = BrowserAsset::$allowed_attributes[ $this->type() ]; |
|
| 128 | - if (! in_array($attribute, $allowed, true)) { |
|
| 129 | - throw new DomainException( |
|
| 130 | - sprintf( |
|
| 131 | - esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'), |
|
| 132 | - implode('", "', $allowed) |
|
| 133 | - ) |
|
| 134 | - ); |
|
| 135 | - } |
|
| 136 | - return true; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * @return array |
|
| 142 | - */ |
|
| 143 | - public function dependencies() |
|
| 144 | - { |
|
| 145 | - return $this->dependencies; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * @param array $dependencies |
|
| 151 | - */ |
|
| 152 | - protected function setDependencies(array $dependencies) |
|
| 153 | - { |
|
| 154 | - $this->dependencies = $dependencies; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * @since 4.9.62.p |
|
| 160 | - * @return bool |
|
| 161 | - */ |
|
| 162 | - public function hasDependencies() |
|
| 163 | - { |
|
| 164 | - return count($this->dependencies) > 0; |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * @return string |
|
| 170 | - */ |
|
| 171 | - public function source() |
|
| 172 | - { |
|
| 173 | - return $this->source; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * @param string $source |
|
| 179 | - * @throws InvalidDataTypeException |
|
| 180 | - */ |
|
| 181 | - private function setSource($source) |
|
| 182 | - { |
|
| 183 | - if (! is_string($source)) { |
|
| 184 | - throw new InvalidDataTypeException( |
|
| 185 | - '$source', |
|
| 186 | - $source, |
|
| 187 | - 'string' |
|
| 188 | - ); |
|
| 189 | - } |
|
| 190 | - $this->source = $source; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * @return string |
|
| 196 | - * @throws InvalidDataTypeException |
|
| 197 | - * @throws DomainException |
|
| 198 | - */ |
|
| 199 | - public function version() |
|
| 200 | - { |
|
| 201 | - return $this->version; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * @param string $version |
|
| 207 | - * @param bool $fluent |
|
| 208 | - * @return BrowserAsset|null |
|
| 209 | - * @throws DomainException |
|
| 210 | - * @throws InvalidDataTypeException |
|
| 211 | - */ |
|
| 212 | - public function setVersion($version, $fluent = true) |
|
| 213 | - { |
|
| 214 | - // if version is NOT set and this asset was NOT built for distribution, |
|
| 215 | - // then set the version equal to the EE core plugin version |
|
| 216 | - if (empty($version) && ! $this->isBuiltDistributionSource()) { |
|
| 217 | - $version = $this->domain->version(); |
|
| 218 | - } |
|
| 219 | - if (! is_string($version)) { |
|
| 220 | - throw new InvalidDataTypeException( |
|
| 221 | - '$version', |
|
| 222 | - $version, |
|
| 223 | - 'string' |
|
| 224 | - ); |
|
| 225 | - } |
|
| 226 | - $this->version = $version; |
|
| 227 | - if ($fluent) { |
|
| 228 | - return $this; |
|
| 229 | - } |
|
| 230 | - return null; |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - |
|
| 234 | - /** |
|
| 235 | - * @return bool |
|
| 236 | - */ |
|
| 237 | - public function isBuiltDistributionSource() { |
|
| 238 | - return substr($this->source, -8) === Asset::FILE_EXTENSION_DISTRIBUTION_JS |
|
| 239 | - || substr($this->source, -9) === Asset::FILE_EXTENSION_DISTRIBUTION_CSS; |
|
| 240 | - } |
|
| 20 | + /** |
|
| 21 | + * @var array $attributes |
|
| 22 | + */ |
|
| 23 | + private $attributes = []; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var array $allowed_attributes |
|
| 27 | + */ |
|
| 28 | + private static $allowed_attributes = [ |
|
| 29 | + Asset::TYPE_CSS => [ |
|
| 30 | + 'crossorigin', |
|
| 31 | + 'media', |
|
| 32 | + 'referrerpolicy', |
|
| 33 | + 'sizes', |
|
| 34 | + 'type', |
|
| 35 | + ], |
|
| 36 | + Asset::TYPE_JS => [ |
|
| 37 | + 'async', |
|
| 38 | + 'charset', |
|
| 39 | + 'crossorigin', |
|
| 40 | + 'defer', |
|
| 41 | + 'type', |
|
| 42 | + ] |
|
| 43 | + ]; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var array $dependencies |
|
| 47 | + */ |
|
| 48 | + private $dependencies; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var string $source |
|
| 52 | + */ |
|
| 53 | + private $source; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var string $version |
|
| 57 | + */ |
|
| 58 | + private $version; |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Asset constructor. |
|
| 63 | + * |
|
| 64 | + * @param string $type |
|
| 65 | + * @param string $handle |
|
| 66 | + * @param string $source |
|
| 67 | + * @param array $dependencies |
|
| 68 | + * @param DomainInterface $domain |
|
| 69 | + * @param string $version |
|
| 70 | + * @throws DomainException |
|
| 71 | + * @throws InvalidDataTypeException |
|
| 72 | + */ |
|
| 73 | + public function __construct($type, $handle, $source, array $dependencies, DomainInterface $domain, $version = '') |
|
| 74 | + { |
|
| 75 | + parent::__construct($type, $handle, $domain); |
|
| 76 | + $this->setSource($source); |
|
| 77 | + $this->setDependencies($dependencies); |
|
| 78 | + $this->setVersion($version, false); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @since 4.9.62.p |
|
| 84 | + */ |
|
| 85 | + abstract public function enqueueAsset(); |
|
| 86 | + |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @return array |
|
| 90 | + */ |
|
| 91 | + public function getAttributes() |
|
| 92 | + { |
|
| 93 | + return $this->attributes; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * @param array $attributes |
|
| 99 | + * @throws DomainException |
|
| 100 | + * @since $VID:$ |
|
| 101 | + */ |
|
| 102 | + public function addAttributes(array $attributes) |
|
| 103 | + { |
|
| 104 | + if (empty($attributes)) { |
|
| 105 | + throw new DomainException( |
|
| 106 | + esc_html__('The attributes array needs at least one value.', 'event_espresso') |
|
| 107 | + ); |
|
| 108 | + } |
|
| 109 | + foreach ($attributes as $key => $value) { |
|
| 110 | + if (is_int($key) && $this->validateAttribute($value)) { |
|
| 111 | + $this->attributes[] = $value; |
|
| 112 | + } else if ($this->validateAttribute($key)) { |
|
| 113 | + $this->attributes[ $key ] = $value; |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @param string $attribute |
|
| 121 | + * @return bool |
|
| 122 | + * @throws DomainException |
|
| 123 | + * @since $VID:$ |
|
| 124 | + */ |
|
| 125 | + private function validateAttribute($attribute) |
|
| 126 | + { |
|
| 127 | + $allowed = BrowserAsset::$allowed_attributes[ $this->type() ]; |
|
| 128 | + if (! in_array($attribute, $allowed, true)) { |
|
| 129 | + throw new DomainException( |
|
| 130 | + sprintf( |
|
| 131 | + esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'), |
|
| 132 | + implode('", "', $allowed) |
|
| 133 | + ) |
|
| 134 | + ); |
|
| 135 | + } |
|
| 136 | + return true; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * @return array |
|
| 142 | + */ |
|
| 143 | + public function dependencies() |
|
| 144 | + { |
|
| 145 | + return $this->dependencies; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @param array $dependencies |
|
| 151 | + */ |
|
| 152 | + protected function setDependencies(array $dependencies) |
|
| 153 | + { |
|
| 154 | + $this->dependencies = $dependencies; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * @since 4.9.62.p |
|
| 160 | + * @return bool |
|
| 161 | + */ |
|
| 162 | + public function hasDependencies() |
|
| 163 | + { |
|
| 164 | + return count($this->dependencies) > 0; |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * @return string |
|
| 170 | + */ |
|
| 171 | + public function source() |
|
| 172 | + { |
|
| 173 | + return $this->source; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * @param string $source |
|
| 179 | + * @throws InvalidDataTypeException |
|
| 180 | + */ |
|
| 181 | + private function setSource($source) |
|
| 182 | + { |
|
| 183 | + if (! is_string($source)) { |
|
| 184 | + throw new InvalidDataTypeException( |
|
| 185 | + '$source', |
|
| 186 | + $source, |
|
| 187 | + 'string' |
|
| 188 | + ); |
|
| 189 | + } |
|
| 190 | + $this->source = $source; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * @return string |
|
| 196 | + * @throws InvalidDataTypeException |
|
| 197 | + * @throws DomainException |
|
| 198 | + */ |
|
| 199 | + public function version() |
|
| 200 | + { |
|
| 201 | + return $this->version; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * @param string $version |
|
| 207 | + * @param bool $fluent |
|
| 208 | + * @return BrowserAsset|null |
|
| 209 | + * @throws DomainException |
|
| 210 | + * @throws InvalidDataTypeException |
|
| 211 | + */ |
|
| 212 | + public function setVersion($version, $fluent = true) |
|
| 213 | + { |
|
| 214 | + // if version is NOT set and this asset was NOT built for distribution, |
|
| 215 | + // then set the version equal to the EE core plugin version |
|
| 216 | + if (empty($version) && ! $this->isBuiltDistributionSource()) { |
|
| 217 | + $version = $this->domain->version(); |
|
| 218 | + } |
|
| 219 | + if (! is_string($version)) { |
|
| 220 | + throw new InvalidDataTypeException( |
|
| 221 | + '$version', |
|
| 222 | + $version, |
|
| 223 | + 'string' |
|
| 224 | + ); |
|
| 225 | + } |
|
| 226 | + $this->version = $version; |
|
| 227 | + if ($fluent) { |
|
| 228 | + return $this; |
|
| 229 | + } |
|
| 230 | + return null; |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + |
|
| 234 | + /** |
|
| 235 | + * @return bool |
|
| 236 | + */ |
|
| 237 | + public function isBuiltDistributionSource() { |
|
| 238 | + return substr($this->source, -8) === Asset::FILE_EXTENSION_DISTRIBUTION_JS |
|
| 239 | + || substr($this->source, -9) === Asset::FILE_EXTENSION_DISTRIBUTION_CSS; |
|
| 240 | + } |
|
| 241 | 241 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | if (is_int($key) && $this->validateAttribute($value)) { |
| 111 | 111 | $this->attributes[] = $value; |
| 112 | 112 | } else if ($this->validateAttribute($key)) { |
| 113 | - $this->attributes[ $key ] = $value; |
|
| 113 | + $this->attributes[$key] = $value; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private function validateAttribute($attribute) |
| 126 | 126 | { |
| 127 | - $allowed = BrowserAsset::$allowed_attributes[ $this->type() ]; |
|
| 128 | - if (! in_array($attribute, $allowed, true)) { |
|
| 127 | + $allowed = BrowserAsset::$allowed_attributes[$this->type()]; |
|
| 128 | + if ( ! in_array($attribute, $allowed, true)) { |
|
| 129 | 129 | throw new DomainException( |
| 130 | 130 | sprintf( |
| 131 | 131 | esc_html__('Invalid attribute! The only allowed attributes are: "%1$s"', 'event_espresso'), |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | private function setSource($source) |
| 182 | 182 | { |
| 183 | - if (! is_string($source)) { |
|
| 183 | + if ( ! is_string($source)) { |
|
| 184 | 184 | throw new InvalidDataTypeException( |
| 185 | 185 | '$source', |
| 186 | 186 | $source, |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | if (empty($version) && ! $this->isBuiltDistributionSource()) { |
| 217 | 217 | $version = $this->domain->version(); |
| 218 | 218 | } |
| 219 | - if (! is_string($version)) { |
|
| 219 | + if ( ! is_string($version)) { |
|
| 220 | 220 | throw new InvalidDataTypeException( |
| 221 | 221 | '$version', |
| 222 | 222 | $version, |
@@ -18,176 +18,176 @@ |
||
| 18 | 18 | class JavascriptAsset extends BrowserAsset |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var boolean $load_in_footer |
|
| 23 | - */ |
|
| 24 | - private $load_in_footer = false; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var boolean $requires_translation |
|
| 28 | - */ |
|
| 29 | - private $requires_translation = false; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @var boolean $has_inline_data |
|
| 33 | - */ |
|
| 34 | - private $has_inline_data = false; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @var Closure $inline_data_callback |
|
| 38 | - */ |
|
| 39 | - private $inline_data_callback; |
|
| 40 | - |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Asset constructor. |
|
| 44 | - * |
|
| 45 | - * @param string $handle |
|
| 46 | - * @param string $source |
|
| 47 | - * @param array $dependencies |
|
| 48 | - * @param bool $load_in_footer |
|
| 49 | - * @param DomainInterface $domain |
|
| 50 | - * @param string $version |
|
| 51 | - * @throws InvalidDataTypeException |
|
| 52 | - * @throws DomainException |
|
| 53 | - */ |
|
| 54 | - public function __construct( |
|
| 55 | - $handle, |
|
| 56 | - $source, |
|
| 57 | - array $dependencies, |
|
| 58 | - $load_in_footer, |
|
| 59 | - DomainInterface $domain, |
|
| 60 | - $version = '' |
|
| 61 | - ) { |
|
| 62 | - parent::__construct(Asset::TYPE_JS, $handle, $source, $dependencies, $domain, $version); |
|
| 63 | - $this->setLoadInFooter($load_in_footer); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @return bool |
|
| 69 | - */ |
|
| 70 | - public function loadInFooter() |
|
| 71 | - { |
|
| 72 | - return $this->load_in_footer; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * @param bool $load_in_footer |
|
| 78 | - */ |
|
| 79 | - private function setLoadInFooter($load_in_footer = true) |
|
| 80 | - { |
|
| 81 | - $this->load_in_footer = filter_var($load_in_footer, FILTER_VALIDATE_BOOLEAN); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @return bool |
|
| 87 | - */ |
|
| 88 | - public function requiresTranslation() |
|
| 89 | - { |
|
| 90 | - return $this->requires_translation; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @param bool $requires_translation |
|
| 96 | - * @return JavascriptAsset |
|
| 97 | - */ |
|
| 98 | - public function setRequiresTranslation($requires_translation = true) |
|
| 99 | - { |
|
| 100 | - $this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN); |
|
| 101 | - $dependencies = $this->dependencies(); |
|
| 102 | - if (! in_array('wp-i18n', $dependencies, true)){ |
|
| 103 | - $dependencies[] = 'wp-i18n'; |
|
| 104 | - $this->setDependencies($dependencies); |
|
| 105 | - } |
|
| 106 | - return $this; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * @return bool |
|
| 112 | - */ |
|
| 113 | - public function hasInlineData() |
|
| 114 | - { |
|
| 115 | - return $this->has_inline_data; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * @param bool $has_inline_data |
|
| 121 | - * @return JavascriptAsset |
|
| 122 | - */ |
|
| 123 | - public function setHasInlineData($has_inline_data = true) |
|
| 124 | - { |
|
| 125 | - $this->has_inline_data = filter_var($has_inline_data, FILTER_VALIDATE_BOOLEAN); |
|
| 126 | - return $this; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * @return Closure |
|
| 132 | - */ |
|
| 133 | - public function inlineDataCallback() |
|
| 134 | - { |
|
| 135 | - return $this->inline_data_callback; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @return bool |
|
| 141 | - */ |
|
| 142 | - public function hasInlineDataCallback() |
|
| 143 | - { |
|
| 144 | - return $this->inline_data_callback instanceof Closure; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @param Closure $inline_data_callback |
|
| 150 | - * @return JavascriptAsset |
|
| 151 | - */ |
|
| 152 | - public function setInlineDataCallback(Closure $inline_data_callback) |
|
| 153 | - { |
|
| 154 | - $this->inline_data_callback = $inline_data_callback; |
|
| 155 | - $this->setHasInlineData(); |
|
| 156 | - return $this; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * @since 4.9.62.p |
|
| 162 | - */ |
|
| 163 | - public function enqueueAsset() |
|
| 164 | - { |
|
| 165 | - if ($this->source() === '') { |
|
| 166 | - return; |
|
| 167 | - } |
|
| 168 | - $attributes = $this->getAttributes(); |
|
| 169 | - if (!empty($attributes)) { |
|
| 170 | - add_filter('script_loader_tag', [$this, 'addAttributeTagsToScript'], 10, 2); |
|
| 171 | - } |
|
| 172 | - wp_enqueue_script($this->handle()); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - |
|
| 176 | - public function addAttributeTagsToScript($tag, $handle) |
|
| 177 | - { |
|
| 178 | - if ($handle === $this->handle()) { |
|
| 179 | - $attributes = $this->getAttributes(); |
|
| 180 | - $attributes_string = ''; |
|
| 181 | - foreach ($attributes as $key => $value) { |
|
| 182 | - if (is_int($key)) { |
|
| 183 | - $attributes_string .= " {$value}"; |
|
| 184 | - } else { |
|
| 185 | - $attributes_string .= " {$key}='{$value}'"; |
|
| 186 | - } |
|
| 187 | - } |
|
| 188 | - $tag = str_replace('></script>', $attributes_string . '></script>', $tag); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return $tag; |
|
| 192 | - } |
|
| 21 | + /** |
|
| 22 | + * @var boolean $load_in_footer |
|
| 23 | + */ |
|
| 24 | + private $load_in_footer = false; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var boolean $requires_translation |
|
| 28 | + */ |
|
| 29 | + private $requires_translation = false; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @var boolean $has_inline_data |
|
| 33 | + */ |
|
| 34 | + private $has_inline_data = false; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @var Closure $inline_data_callback |
|
| 38 | + */ |
|
| 39 | + private $inline_data_callback; |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Asset constructor. |
|
| 44 | + * |
|
| 45 | + * @param string $handle |
|
| 46 | + * @param string $source |
|
| 47 | + * @param array $dependencies |
|
| 48 | + * @param bool $load_in_footer |
|
| 49 | + * @param DomainInterface $domain |
|
| 50 | + * @param string $version |
|
| 51 | + * @throws InvalidDataTypeException |
|
| 52 | + * @throws DomainException |
|
| 53 | + */ |
|
| 54 | + public function __construct( |
|
| 55 | + $handle, |
|
| 56 | + $source, |
|
| 57 | + array $dependencies, |
|
| 58 | + $load_in_footer, |
|
| 59 | + DomainInterface $domain, |
|
| 60 | + $version = '' |
|
| 61 | + ) { |
|
| 62 | + parent::__construct(Asset::TYPE_JS, $handle, $source, $dependencies, $domain, $version); |
|
| 63 | + $this->setLoadInFooter($load_in_footer); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @return bool |
|
| 69 | + */ |
|
| 70 | + public function loadInFooter() |
|
| 71 | + { |
|
| 72 | + return $this->load_in_footer; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * @param bool $load_in_footer |
|
| 78 | + */ |
|
| 79 | + private function setLoadInFooter($load_in_footer = true) |
|
| 80 | + { |
|
| 81 | + $this->load_in_footer = filter_var($load_in_footer, FILTER_VALIDATE_BOOLEAN); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @return bool |
|
| 87 | + */ |
|
| 88 | + public function requiresTranslation() |
|
| 89 | + { |
|
| 90 | + return $this->requires_translation; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @param bool $requires_translation |
|
| 96 | + * @return JavascriptAsset |
|
| 97 | + */ |
|
| 98 | + public function setRequiresTranslation($requires_translation = true) |
|
| 99 | + { |
|
| 100 | + $this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN); |
|
| 101 | + $dependencies = $this->dependencies(); |
|
| 102 | + if (! in_array('wp-i18n', $dependencies, true)){ |
|
| 103 | + $dependencies[] = 'wp-i18n'; |
|
| 104 | + $this->setDependencies($dependencies); |
|
| 105 | + } |
|
| 106 | + return $this; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * @return bool |
|
| 112 | + */ |
|
| 113 | + public function hasInlineData() |
|
| 114 | + { |
|
| 115 | + return $this->has_inline_data; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * @param bool $has_inline_data |
|
| 121 | + * @return JavascriptAsset |
|
| 122 | + */ |
|
| 123 | + public function setHasInlineData($has_inline_data = true) |
|
| 124 | + { |
|
| 125 | + $this->has_inline_data = filter_var($has_inline_data, FILTER_VALIDATE_BOOLEAN); |
|
| 126 | + return $this; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * @return Closure |
|
| 132 | + */ |
|
| 133 | + public function inlineDataCallback() |
|
| 134 | + { |
|
| 135 | + return $this->inline_data_callback; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @return bool |
|
| 141 | + */ |
|
| 142 | + public function hasInlineDataCallback() |
|
| 143 | + { |
|
| 144 | + return $this->inline_data_callback instanceof Closure; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @param Closure $inline_data_callback |
|
| 150 | + * @return JavascriptAsset |
|
| 151 | + */ |
|
| 152 | + public function setInlineDataCallback(Closure $inline_data_callback) |
|
| 153 | + { |
|
| 154 | + $this->inline_data_callback = $inline_data_callback; |
|
| 155 | + $this->setHasInlineData(); |
|
| 156 | + return $this; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * @since 4.9.62.p |
|
| 162 | + */ |
|
| 163 | + public function enqueueAsset() |
|
| 164 | + { |
|
| 165 | + if ($this->source() === '') { |
|
| 166 | + return; |
|
| 167 | + } |
|
| 168 | + $attributes = $this->getAttributes(); |
|
| 169 | + if (!empty($attributes)) { |
|
| 170 | + add_filter('script_loader_tag', [$this, 'addAttributeTagsToScript'], 10, 2); |
|
| 171 | + } |
|
| 172 | + wp_enqueue_script($this->handle()); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + |
|
| 176 | + public function addAttributeTagsToScript($tag, $handle) |
|
| 177 | + { |
|
| 178 | + if ($handle === $this->handle()) { |
|
| 179 | + $attributes = $this->getAttributes(); |
|
| 180 | + $attributes_string = ''; |
|
| 181 | + foreach ($attributes as $key => $value) { |
|
| 182 | + if (is_int($key)) { |
|
| 183 | + $attributes_string .= " {$value}"; |
|
| 184 | + } else { |
|
| 185 | + $attributes_string .= " {$key}='{$value}'"; |
|
| 186 | + } |
|
| 187 | + } |
|
| 188 | + $tag = str_replace('></script>', $attributes_string . '></script>', $tag); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return $tag; |
|
| 192 | + } |
|
| 193 | 193 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $this->requires_translation = filter_var($requires_translation, FILTER_VALIDATE_BOOLEAN); |
| 101 | 101 | $dependencies = $this->dependencies(); |
| 102 | - if (! in_array('wp-i18n', $dependencies, true)){ |
|
| 102 | + if ( ! in_array('wp-i18n', $dependencies, true)) { |
|
| 103 | 103 | $dependencies[] = 'wp-i18n'; |
| 104 | 104 | $this->setDependencies($dependencies); |
| 105 | 105 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | $attributes = $this->getAttributes(); |
| 169 | - if (!empty($attributes)) { |
|
| 169 | + if ( ! empty($attributes)) { |
|
| 170 | 170 | add_filter('script_loader_tag', [$this, 'addAttributeTagsToScript'], 10, 2); |
| 171 | 171 | } |
| 172 | 172 | wp_enqueue_script($this->handle()); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $attributes_string .= " {$key}='{$value}'"; |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | - $tag = str_replace('></script>', $attributes_string . '></script>', $tag); |
|
| 188 | + $tag = str_replace('></script>', $attributes_string.'></script>', $tag); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | return $tag; |
@@ -16,45 +16,45 @@ |
||
| 16 | 16 | class RegistrationStatusEnum extends EnumBase |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * RegistrationStatusEnum constructor. |
|
| 21 | - */ |
|
| 22 | - public function __construct() |
|
| 23 | - { |
|
| 24 | - $this->setName($this->namespace . 'RegistrationStatusEnum'); |
|
| 25 | - $this->setDescription(esc_html__('Registration status', 'event_espresso')); |
|
| 26 | - parent::__construct(); |
|
| 27 | - } |
|
| 19 | + /** |
|
| 20 | + * RegistrationStatusEnum constructor. |
|
| 21 | + */ |
|
| 22 | + public function __construct() |
|
| 23 | + { |
|
| 24 | + $this->setName($this->namespace . 'RegistrationStatusEnum'); |
|
| 25 | + $this->setDescription(esc_html__('Registration status', 'event_espresso')); |
|
| 26 | + parent::__construct(); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @return array |
|
| 32 | - * @since $VID:$ |
|
| 33 | - */ |
|
| 34 | - protected function getValues() |
|
| 35 | - { |
|
| 36 | - return [ |
|
| 37 | - 'APPROVED' => [ |
|
| 38 | - 'value' => EEM_Registration::status_id_approved, |
|
| 39 | - ], |
|
| 40 | - 'CANCELLED' => [ |
|
| 41 | - 'value' => EEM_Registration::status_id_cancelled, |
|
| 42 | - ], |
|
| 43 | - 'DECLINED' => [ |
|
| 44 | - 'value' => EEM_Registration::status_id_declined, |
|
| 45 | - ], |
|
| 46 | - 'INCOMPLETE' => [ |
|
| 47 | - 'value' => EEM_Registration::status_id_incomplete, |
|
| 48 | - ], |
|
| 49 | - 'PENDING_PAYMENT' => [ |
|
| 50 | - 'value' => EEM_Registration::status_id_pending_payment, |
|
| 51 | - ], |
|
| 52 | - 'UNAPPROVED' => [ |
|
| 53 | - 'value' => EEM_Registration::status_id_not_approved, |
|
| 54 | - ], |
|
| 55 | - 'WAIT_LIST' => [ |
|
| 56 | - 'value' => EEM_Registration::status_id_wait_list, |
|
| 57 | - ], |
|
| 58 | - ]; |
|
| 59 | - } |
|
| 30 | + /** |
|
| 31 | + * @return array |
|
| 32 | + * @since $VID:$ |
|
| 33 | + */ |
|
| 34 | + protected function getValues() |
|
| 35 | + { |
|
| 36 | + return [ |
|
| 37 | + 'APPROVED' => [ |
|
| 38 | + 'value' => EEM_Registration::status_id_approved, |
|
| 39 | + ], |
|
| 40 | + 'CANCELLED' => [ |
|
| 41 | + 'value' => EEM_Registration::status_id_cancelled, |
|
| 42 | + ], |
|
| 43 | + 'DECLINED' => [ |
|
| 44 | + 'value' => EEM_Registration::status_id_declined, |
|
| 45 | + ], |
|
| 46 | + 'INCOMPLETE' => [ |
|
| 47 | + 'value' => EEM_Registration::status_id_incomplete, |
|
| 48 | + ], |
|
| 49 | + 'PENDING_PAYMENT' => [ |
|
| 50 | + 'value' => EEM_Registration::status_id_pending_payment, |
|
| 51 | + ], |
|
| 52 | + 'UNAPPROVED' => [ |
|
| 53 | + 'value' => EEM_Registration::status_id_not_approved, |
|
| 54 | + ], |
|
| 55 | + 'WAIT_LIST' => [ |
|
| 56 | + 'value' => EEM_Registration::status_id_wait_list, |
|
| 57 | + ], |
|
| 58 | + ]; |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() |
| 23 | 23 | { |
| 24 | - $this->setName($this->namespace . 'RegistrationStatusEnum'); |
|
| 24 | + $this->setName($this->namespace.'RegistrationStatusEnum'); |
|
| 25 | 25 | $this->setDescription(esc_html__('Registration status', 'event_espresso')); |
| 26 | 26 | parent::__construct(); |
| 27 | 27 | } |
@@ -15,36 +15,36 @@ |
||
| 15 | 15 | class AttendeesConnectionOrderbyEnum extends EnumBase |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * AttendeesConnectionOrderbyEnum constructor. |
|
| 20 | - */ |
|
| 21 | - public function __construct() |
|
| 22 | - { |
|
| 23 | - $this->setName($this->namespace . 'AttendeesConnectionOrderbyEnum'); |
|
| 24 | - $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
| 25 | - parent::__construct(); |
|
| 26 | - } |
|
| 18 | + /** |
|
| 19 | + * AttendeesConnectionOrderbyEnum constructor. |
|
| 20 | + */ |
|
| 21 | + public function __construct() |
|
| 22 | + { |
|
| 23 | + $this->setName($this->namespace . 'AttendeesConnectionOrderbyEnum'); |
|
| 24 | + $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
|
| 25 | + parent::__construct(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @return array |
|
| 31 | - * @since $VID:$ |
|
| 32 | - */ |
|
| 33 | - protected function getValues() |
|
| 34 | - { |
|
| 35 | - return [ |
|
| 36 | - 'ID' => [ |
|
| 37 | - 'value' => 'ATT_ID', |
|
| 38 | - 'description' => esc_html__('Order by ID', 'event_espresso'), |
|
| 39 | - ], |
|
| 40 | - 'LAST_NAME' => [ |
|
| 41 | - 'value' => 'ATT_lname', |
|
| 42 | - 'description' => esc_html__('Order by last name', 'event_espresso'), |
|
| 43 | - ], |
|
| 44 | - 'FIRST_NAME' => [ |
|
| 45 | - 'value' => 'ATT_fname', |
|
| 46 | - 'description' => esc_html__('Order by first name', 'event_espresso'), |
|
| 47 | - ], |
|
| 48 | - ]; |
|
| 49 | - } |
|
| 29 | + /** |
|
| 30 | + * @return array |
|
| 31 | + * @since $VID:$ |
|
| 32 | + */ |
|
| 33 | + protected function getValues() |
|
| 34 | + { |
|
| 35 | + return [ |
|
| 36 | + 'ID' => [ |
|
| 37 | + 'value' => 'ATT_ID', |
|
| 38 | + 'description' => esc_html__('Order by ID', 'event_espresso'), |
|
| 39 | + ], |
|
| 40 | + 'LAST_NAME' => [ |
|
| 41 | + 'value' => 'ATT_lname', |
|
| 42 | + 'description' => esc_html__('Order by last name', 'event_espresso'), |
|
| 43 | + ], |
|
| 44 | + 'FIRST_NAME' => [ |
|
| 45 | + 'value' => 'ATT_fname', |
|
| 46 | + 'description' => esc_html__('Order by first name', 'event_espresso'), |
|
| 47 | + ], |
|
| 48 | + ]; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | - $this->setName($this->namespace . 'AttendeesConnectionOrderbyEnum'); |
|
| 23 | + $this->setName($this->namespace.'AttendeesConnectionOrderbyEnum'); |
|
| 24 | 24 | $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso')); |
| 25 | 25 | parent::__construct(); |
| 26 | 26 | } |
@@ -20,84 +20,84 @@ |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * DatetimeConnection constructor. |
|
| 25 | - * |
|
| 26 | - * @param EEM_Ticket $model |
|
| 27 | - */ |
|
| 28 | - public function __construct(EEM_Ticket $model) |
|
| 29 | - { |
|
| 30 | - $this->model = $model; |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * DatetimeConnection constructor. |
|
| 25 | + * |
|
| 26 | + * @param EEM_Ticket $model |
|
| 27 | + */ |
|
| 28 | + public function __construct(EEM_Ticket $model) |
|
| 29 | + { |
|
| 30 | + $this->model = $model; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @return array |
|
| 36 | - * @since $VID:$ |
|
| 37 | - */ |
|
| 38 | - public function config() |
|
| 39 | - { |
|
| 40 | - return [ |
|
| 41 | - 'fromType' => $this->namespace . 'Datetime', |
|
| 42 | - 'toType' => $this->namespace . 'Ticket', |
|
| 43 | - 'fromFieldName' => 'tickets', |
|
| 44 | - 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
| 45 | - 'connectionArgs' => self::get_connection_args(), |
|
| 46 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | - ]; |
|
| 48 | - } |
|
| 34 | + /** |
|
| 35 | + * @return array |
|
| 36 | + * @since $VID:$ |
|
| 37 | + */ |
|
| 38 | + public function config() |
|
| 39 | + { |
|
| 40 | + return [ |
|
| 41 | + 'fromType' => $this->namespace . 'Datetime', |
|
| 42 | + 'toType' => $this->namespace . 'Ticket', |
|
| 43 | + 'fromFieldName' => 'tickets', |
|
| 44 | + 'connectionTypeName' => "{$this->namespace}DatetimeTicketsConnection", |
|
| 45 | + 'connectionArgs' => self::get_connection_args(), |
|
| 46 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 47 | + ]; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param $entity |
|
| 53 | - * @param $args |
|
| 54 | - * @param $context |
|
| 55 | - * @param $info |
|
| 56 | - * @return array |
|
| 57 | - * @throws Exception |
|
| 58 | - * @since $VID:$ |
|
| 59 | - */ |
|
| 60 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | - { |
|
| 62 | - $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 63 | - return $resolver->get_connection(); |
|
| 64 | - } |
|
| 51 | + /** |
|
| 52 | + * @param $entity |
|
| 53 | + * @param $args |
|
| 54 | + * @param $context |
|
| 55 | + * @param $info |
|
| 56 | + * @return array |
|
| 57 | + * @throws Exception |
|
| 58 | + * @since $VID:$ |
|
| 59 | + */ |
|
| 60 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 61 | + { |
|
| 62 | + $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 63 | + return $resolver->get_connection(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 68 | - * |
|
| 69 | - * @access public |
|
| 70 | - * @param array $args The args to modify the defaults |
|
| 71 | - * |
|
| 72 | - * @return array |
|
| 73 | - */ |
|
| 74 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 75 | - public static function get_connection_args($args = []) |
|
| 76 | - { |
|
| 77 | - return array_merge( |
|
| 78 | - [ |
|
| 79 | - 'orderby' => [ |
|
| 80 | - 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
|
| 81 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 82 | - ], |
|
| 83 | - 'datetime' => [ |
|
| 84 | - 'type' => 'ID', |
|
| 85 | - 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
| 86 | - ], |
|
| 87 | - 'datetimeIn' => [ |
|
| 88 | - 'type' => ['list_of' => 'ID'], |
|
| 89 | - 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 90 | - ], |
|
| 91 | - 'datetimeId' => [ |
|
| 92 | - 'type' => 'Int', |
|
| 93 | - 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
| 94 | - ], |
|
| 95 | - 'datetimeIdIn' => [ |
|
| 96 | - 'type' => ['list_of' => 'Int'], |
|
| 97 | - 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 98 | - ], |
|
| 99 | - ], |
|
| 100 | - $args |
|
| 101 | - ); |
|
| 102 | - } |
|
| 66 | + /** |
|
| 67 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 68 | + * |
|
| 69 | + * @access public |
|
| 70 | + * @param array $args The args to modify the defaults |
|
| 71 | + * |
|
| 72 | + * @return array |
|
| 73 | + */ |
|
| 74 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 75 | + public static function get_connection_args($args = []) |
|
| 76 | + { |
|
| 77 | + return array_merge( |
|
| 78 | + [ |
|
| 79 | + 'orderby' => [ |
|
| 80 | + 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
|
| 81 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 82 | + ], |
|
| 83 | + 'datetime' => [ |
|
| 84 | + 'type' => 'ID', |
|
| 85 | + 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
|
| 86 | + ], |
|
| 87 | + 'datetimeIn' => [ |
|
| 88 | + 'type' => ['list_of' => 'ID'], |
|
| 89 | + 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 90 | + ], |
|
| 91 | + 'datetimeId' => [ |
|
| 92 | + 'type' => 'Int', |
|
| 93 | + 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
|
| 94 | + ], |
|
| 95 | + 'datetimeIdIn' => [ |
|
| 96 | + 'type' => ['list_of' => 'Int'], |
|
| 97 | + 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
|
| 98 | + ], |
|
| 99 | + ], |
|
| 100 | + $args |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | 103 | } |
@@ -19,93 +19,93 @@ |
||
| 19 | 19 | { |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * AttendeeConnection constructor. |
|
| 24 | - * |
|
| 25 | - * @param EEM_Attendee $model |
|
| 26 | - */ |
|
| 27 | - public function __construct(EEM_Attendee $model) |
|
| 28 | - { |
|
| 29 | - $this->model = $model; |
|
| 30 | - } |
|
| 22 | + /** |
|
| 23 | + * AttendeeConnection constructor. |
|
| 24 | + * |
|
| 25 | + * @param EEM_Attendee $model |
|
| 26 | + */ |
|
| 27 | + public function __construct(EEM_Attendee $model) |
|
| 28 | + { |
|
| 29 | + $this->model = $model; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @return array |
|
| 35 | - * @since $VID:$ |
|
| 36 | - */ |
|
| 37 | - public function config() |
|
| 38 | - { |
|
| 39 | - return [ |
|
| 40 | - 'fromType' => 'RootQuery', |
|
| 41 | - 'toType' => $this->namespace . 'Attendee', |
|
| 42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
| 43 | - 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
|
| 44 | - 'connectionArgs' => self::get_connection_args(), |
|
| 45 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | - ]; |
|
| 47 | - } |
|
| 33 | + /** |
|
| 34 | + * @return array |
|
| 35 | + * @since $VID:$ |
|
| 36 | + */ |
|
| 37 | + public function config() |
|
| 38 | + { |
|
| 39 | + return [ |
|
| 40 | + 'fromType' => 'RootQuery', |
|
| 41 | + 'toType' => $this->namespace . 'Attendee', |
|
| 42 | + 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
| 43 | + 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
|
| 44 | + 'connectionArgs' => self::get_connection_args(), |
|
| 45 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 46 | + ]; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param $entity |
|
| 52 | - * @param $args |
|
| 53 | - * @param $context |
|
| 54 | - * @param $info |
|
| 55 | - * @return AttendeeConnectionResolver |
|
| 56 | - * @throws Exception |
|
| 57 | - * @since $VID:$ |
|
| 58 | - */ |
|
| 59 | - public function getConnectionResolver($entity, $args, $context, $info) |
|
| 60 | - { |
|
| 61 | - return new AttendeeConnectionResolver($entity, $args, $context, $info); |
|
| 62 | - } |
|
| 50 | + /** |
|
| 51 | + * @param $entity |
|
| 52 | + * @param $args |
|
| 53 | + * @param $context |
|
| 54 | + * @param $info |
|
| 55 | + * @return AttendeeConnectionResolver |
|
| 56 | + * @throws Exception |
|
| 57 | + * @since $VID:$ |
|
| 58 | + */ |
|
| 59 | + public function getConnectionResolver($entity, $args, $context, $info) |
|
| 60 | + { |
|
| 61 | + return new AttendeeConnectionResolver($entity, $args, $context, $info); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | - * |
|
| 67 | - * @access public |
|
| 68 | - * @param array $args The args to modify the defaults |
|
| 69 | - * |
|
| 70 | - * @return array |
|
| 71 | - */ |
|
| 72 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 73 | - public static function get_connection_args($args = []) |
|
| 74 | - { |
|
| 75 | - return array_merge( |
|
| 76 | - [ |
|
| 77 | - 'orderby' => [ |
|
| 78 | - 'type' => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'], |
|
| 79 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 80 | - ], |
|
| 81 | - 'regTicket' => [ |
|
| 82 | - 'type' => 'ID', |
|
| 83 | - 'description' => esc_html__( |
|
| 84 | - 'Globally unique registration ticket ID to get the attendees for.', |
|
| 85 | - 'event_espresso' |
|
| 86 | - ), |
|
| 87 | - ], |
|
| 88 | - 'regTicketIn' => [ |
|
| 89 | - 'type' => ['list_of' => 'ID'], |
|
| 90 | - 'description' => esc_html__( |
|
| 91 | - 'Globally unique registration ticket IDs to get the attendees for.', |
|
| 92 | - 'event_espresso' |
|
| 93 | - ), |
|
| 94 | - ], |
|
| 95 | - 'regTicketId' => [ |
|
| 96 | - 'type' => 'Int', |
|
| 97 | - 'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'), |
|
| 98 | - ], |
|
| 99 | - 'regTicketIdIn' => [ |
|
| 100 | - 'type' => ['list_of' => 'Int'], |
|
| 101 | - 'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'), |
|
| 102 | - ], |
|
| 103 | - 'regStatus' => [ |
|
| 104 | - 'type' => 'EspressoRegistrationStatusEnum', |
|
| 105 | - 'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'), |
|
| 106 | - ], |
|
| 107 | - ], |
|
| 108 | - $args |
|
| 109 | - ); |
|
| 110 | - } |
|
| 64 | + /** |
|
| 65 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 66 | + * |
|
| 67 | + * @access public |
|
| 68 | + * @param array $args The args to modify the defaults |
|
| 69 | + * |
|
| 70 | + * @return array |
|
| 71 | + */ |
|
| 72 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 73 | + public static function get_connection_args($args = []) |
|
| 74 | + { |
|
| 75 | + return array_merge( |
|
| 76 | + [ |
|
| 77 | + 'orderby' => [ |
|
| 78 | + 'type' => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'], |
|
| 79 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 80 | + ], |
|
| 81 | + 'regTicket' => [ |
|
| 82 | + 'type' => 'ID', |
|
| 83 | + 'description' => esc_html__( |
|
| 84 | + 'Globally unique registration ticket ID to get the attendees for.', |
|
| 85 | + 'event_espresso' |
|
| 86 | + ), |
|
| 87 | + ], |
|
| 88 | + 'regTicketIn' => [ |
|
| 89 | + 'type' => ['list_of' => 'ID'], |
|
| 90 | + 'description' => esc_html__( |
|
| 91 | + 'Globally unique registration ticket IDs to get the attendees for.', |
|
| 92 | + 'event_espresso' |
|
| 93 | + ), |
|
| 94 | + ], |
|
| 95 | + 'regTicketId' => [ |
|
| 96 | + 'type' => 'Int', |
|
| 97 | + 'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'), |
|
| 98 | + ], |
|
| 99 | + 'regTicketIdIn' => [ |
|
| 100 | + 'type' => ['list_of' => 'Int'], |
|
| 101 | + 'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'), |
|
| 102 | + ], |
|
| 103 | + 'regStatus' => [ |
|
| 104 | + 'type' => 'EspressoRegistrationStatusEnum', |
|
| 105 | + 'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'), |
|
| 106 | + ], |
|
| 107 | + ], |
|
| 108 | + $args |
|
| 109 | + ); |
|
| 110 | + } |
|
| 111 | 111 | } |
@@ -38,8 +38,8 @@ |
||
| 38 | 38 | { |
| 39 | 39 | return [ |
| 40 | 40 | 'fromType' => 'RootQuery', |
| 41 | - 'toType' => $this->namespace . 'Attendee', |
|
| 42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Attendees', |
|
| 41 | + 'toType' => $this->namespace.'Attendee', |
|
| 42 | + 'fromFieldName' => lcfirst($this->namespace).'Attendees', |
|
| 43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryAttendeesConnection", |
| 44 | 44 | 'connectionArgs' => self::get_connection_args(), |
| 45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -21,112 +21,112 @@ |
||
| 21 | 21 | { |
| 22 | 22 | |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * DatetimeConnection constructor. |
|
| 26 | - * |
|
| 27 | - * @param EEM_Datetime $model |
|
| 28 | - */ |
|
| 29 | - public function __construct(EEM_Datetime $model) |
|
| 30 | - { |
|
| 31 | - $this->model = $model; |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * DatetimeConnection constructor. |
|
| 26 | + * |
|
| 27 | + * @param EEM_Datetime $model |
|
| 28 | + */ |
|
| 29 | + public function __construct(EEM_Datetime $model) |
|
| 30 | + { |
|
| 31 | + $this->model = $model; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @return array |
|
| 37 | - * @since $VID:$ |
|
| 38 | - */ |
|
| 39 | - public function config() |
|
| 40 | - { |
|
| 41 | - return [ |
|
| 42 | - 'fromType' => $this->namespace . 'Event', |
|
| 43 | - 'toType' => $this->namespace . 'Datetime', |
|
| 44 | - 'fromFieldName' => 'datetimes', |
|
| 45 | - 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
| 46 | - 'connectionArgs' => self::get_connection_args(), |
|
| 47 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 48 | - ]; |
|
| 49 | - } |
|
| 35 | + /** |
|
| 36 | + * @return array |
|
| 37 | + * @since $VID:$ |
|
| 38 | + */ |
|
| 39 | + public function config() |
|
| 40 | + { |
|
| 41 | + return [ |
|
| 42 | + 'fromType' => $this->namespace . 'Event', |
|
| 43 | + 'toType' => $this->namespace . 'Datetime', |
|
| 44 | + 'fromFieldName' => 'datetimes', |
|
| 45 | + 'connectionTypeName' => "{$this->namespace}EventDatetimesConnection", |
|
| 46 | + 'connectionArgs' => self::get_connection_args(), |
|
| 47 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 48 | + ]; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param $entity |
|
| 54 | - * @param $args |
|
| 55 | - * @param $context |
|
| 56 | - * @param $info |
|
| 57 | - * @return array |
|
| 58 | - * @throws Exception |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 62 | - { |
|
| 63 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 64 | - return $resolver->get_connection(); |
|
| 65 | - } |
|
| 52 | + /** |
|
| 53 | + * @param $entity |
|
| 54 | + * @param $args |
|
| 55 | + * @param $context |
|
| 56 | + * @param $info |
|
| 57 | + * @return array |
|
| 58 | + * @throws Exception |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 62 | + { |
|
| 63 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 64 | + return $resolver->get_connection(); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Given an optional array of args, this returns the args to be used in the connection |
|
| 69 | - * |
|
| 70 | - * @access public |
|
| 71 | - * @param array $args The args to modify the defaults |
|
| 72 | - * |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 76 | - public static function get_connection_args($args = []) |
|
| 77 | - { |
|
| 78 | - return array_merge( |
|
| 79 | - [ |
|
| 80 | - 'orderby' => [ |
|
| 81 | - 'type' => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'], |
|
| 82 | - 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 83 | - ], |
|
| 84 | - 'event' => [ |
|
| 85 | - 'type' => 'ID', |
|
| 86 | - 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
| 87 | - ], |
|
| 88 | - 'eventIn' => [ |
|
| 89 | - 'type' => ['list_of' => 'ID'], |
|
| 90 | - 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
| 91 | - ], |
|
| 92 | - 'eventId' => [ |
|
| 93 | - 'type' => 'Int', |
|
| 94 | - 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
| 95 | - ], |
|
| 96 | - 'eventIdIn' => [ |
|
| 97 | - 'type' => ['list_of' => 'Int'], |
|
| 98 | - 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
| 99 | - ], |
|
| 100 | - 'ticket' => [ |
|
| 101 | - 'type' => 'ID', |
|
| 102 | - 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 103 | - ], |
|
| 104 | - 'ticketIn' => [ |
|
| 105 | - 'type' => ['list_of' => 'ID'], |
|
| 106 | - 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 107 | - ], |
|
| 108 | - 'ticketId' => [ |
|
| 109 | - 'type' => 'Int', |
|
| 110 | - 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 111 | - ], |
|
| 112 | - 'ticketIdIn' => [ |
|
| 113 | - 'type' => ['list_of' => 'Int'], |
|
| 114 | - 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 115 | - ], |
|
| 116 | - 'upcoming' => [ |
|
| 117 | - 'type' => 'Boolean', |
|
| 118 | - 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
| 119 | - ], |
|
| 120 | - 'active' => [ |
|
| 121 | - 'type' => 'Boolean', |
|
| 122 | - 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
| 123 | - ], |
|
| 124 | - 'expired' => [ |
|
| 125 | - 'type' => 'Boolean', |
|
| 126 | - 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
| 127 | - ], |
|
| 128 | - ], |
|
| 129 | - $args |
|
| 130 | - ); |
|
| 131 | - } |
|
| 67 | + /** |
|
| 68 | + * Given an optional array of args, this returns the args to be used in the connection |
|
| 69 | + * |
|
| 70 | + * @access public |
|
| 71 | + * @param array $args The args to modify the defaults |
|
| 72 | + * |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 76 | + public static function get_connection_args($args = []) |
|
| 77 | + { |
|
| 78 | + return array_merge( |
|
| 79 | + [ |
|
| 80 | + 'orderby' => [ |
|
| 81 | + 'type' => ['list_of' => 'EspressoDatetimesConnectionOrderbyInput'], |
|
| 82 | + 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
|
| 83 | + ], |
|
| 84 | + 'event' => [ |
|
| 85 | + 'type' => 'ID', |
|
| 86 | + 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
|
| 87 | + ], |
|
| 88 | + 'eventIn' => [ |
|
| 89 | + 'type' => ['list_of' => 'ID'], |
|
| 90 | + 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
|
| 91 | + ], |
|
| 92 | + 'eventId' => [ |
|
| 93 | + 'type' => 'Int', |
|
| 94 | + 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
|
| 95 | + ], |
|
| 96 | + 'eventIdIn' => [ |
|
| 97 | + 'type' => ['list_of' => 'Int'], |
|
| 98 | + 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
|
| 99 | + ], |
|
| 100 | + 'ticket' => [ |
|
| 101 | + 'type' => 'ID', |
|
| 102 | + 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 103 | + ], |
|
| 104 | + 'ticketIn' => [ |
|
| 105 | + 'type' => ['list_of' => 'ID'], |
|
| 106 | + 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 107 | + ], |
|
| 108 | + 'ticketId' => [ |
|
| 109 | + 'type' => 'Int', |
|
| 110 | + 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
|
| 111 | + ], |
|
| 112 | + 'ticketIdIn' => [ |
|
| 113 | + 'type' => ['list_of' => 'Int'], |
|
| 114 | + 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
|
| 115 | + ], |
|
| 116 | + 'upcoming' => [ |
|
| 117 | + 'type' => 'Boolean', |
|
| 118 | + 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
|
| 119 | + ], |
|
| 120 | + 'active' => [ |
|
| 121 | + 'type' => 'Boolean', |
|
| 122 | + 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
|
| 123 | + ], |
|
| 124 | + 'expired' => [ |
|
| 125 | + 'type' => 'Boolean', |
|
| 126 | + 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
|
| 127 | + ], |
|
| 128 | + ], |
|
| 129 | + $args |
|
| 130 | + ); |
|
| 131 | + } |
|
| 132 | 132 | } |