| @@ 247-268 (lines=22) @@ | ||
| 244 | * |
|
| 245 | * @return bool|string |
|
| 246 | */ |
|
| 247 | public function getEmbedLink() { |
|
| 248 | if (! empty($this->URL) && $this->Type != 'File') { |
|
| 249 | try { |
|
| 250 | $videoId = BlocksUtility::parse_video_id($this->URL, $this->Type); |
|
| 251 | } catch (ProviderNotFound $ex) { |
|
| 252 | return false; |
|
| 253 | } |
|
| 254 | ||
| 255 | if ($videoId && array_key_exists($this->Type, ($options = static::config()->embed_links))) { |
|
| 256 | $options = $options[$this->Type]; |
|
| 257 | $autoPlay = array_key_exists("AutoPlay", $options) && ! empty($options["AutoPlay"]) ? $options["AutoPlay"] : ''; |
|
| 258 | ||
| 259 | return str_replace( |
|
| 260 | ['{VideoId}', '{AutoPlay}'], |
|
| 261 | [$videoId, $autoPlay], |
|
| 262 | $options["Link"] |
|
| 263 | ); |
|
| 264 | } |
|
| 265 | } |
|
| 266 | ||
| 267 | return false; |
|
| 268 | } |
|
| 269 | ||
| 270 | /** |
|
| 271 | * @return \ValidationResult |
|
| @@ 198-219 (lines=22) @@ | ||
| 195 | * |
|
| 196 | * @return bool|string |
|
| 197 | */ |
|
| 198 | public function getEmbedLink() { |
|
| 199 | if (! empty($this->URL) && $this->Type != 'File') { |
|
| 200 | try { |
|
| 201 | $videoId = BlocksUtility::parse_video_id($this->URL, $this->Type); |
|
| 202 | } catch (ProviderNotFound $ex) { |
|
| 203 | return false; |
|
| 204 | } |
|
| 205 | ||
| 206 | if ($videoId && array_key_exists($this->Type, ($options = VideoSliderItem::config()->embed_links))) { |
|
| 207 | $options = $options[$this->Type]; |
|
| 208 | $autoPlay = array_key_exists("AutoPlay", $options) && ! empty($options["AutoPlay"]) ? $options["AutoPlay"] : ''; |
|
| 209 | ||
| 210 | return str_replace( |
|
| 211 | ['{VideoId}', '{AutoPlay}'], |
|
| 212 | [$videoId, $autoPlay], |
|
| 213 | $options["Link"] |
|
| 214 | ); |
|
| 215 | } |
|
| 216 | } |
|
| 217 | ||
| 218 | return false; |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * @return \ValidationResult |
|