From a38b553fea5b95d2ae69a46fdb1f16daa59551ba Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:25:30 +0100 Subject: [PATCH 1/9] Add support for downloadable and removable attribute --- src/Parameters/CreateMeetingParameters.php | 40 ++++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index 8e00d7ae..6f656b3d 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -248,7 +248,7 @@ class CreateMeetingParameters extends MetaParameters protected ?string $clientSettingsOverride = null; /** - * @var array + * @var array> */ private array $presentations = []; @@ -351,13 +351,14 @@ public function setGuestPolicyAlwaysAccept(): self return $this; } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null): self + public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null): self { - if (!$filename) { - $this->presentations[$nameOrUrl] = !$content ?: base64_encode($content); - } else { - $this->presentations[$nameOrUrl] = $filename; - } + $this->presentations[$nameOrUrl] = [ + 'filename' => $filename, + 'content' => !$content ?: base64_encode($content), + 'downloadable' => $downloadable, + 'removable' => $removable, + ]; return $this; } @@ -423,18 +424,27 @@ public function addPresentationsModule(SimpleXMLElementExtended $xml): void $module = $xml->addChild('module'); $module->addAttribute('name', 'presentation'); - foreach ($this->presentations as $nameOrUrl => $content) { + foreach ($this->presentations as $nameOrUrl => $data) { + $document = $module->addChild('document'); + if (str_starts_with($nameOrUrl, 'http')) { - $presentation = $module->addChild('document'); - $presentation->addAttribute('url', $nameOrUrl); - if (\is_string($content)) { - $presentation->addAttribute('filename', $content); - } + $document->addAttribute('url', $nameOrUrl); } else { - $document = $module->addChild('document'); $document->addAttribute('name', $nameOrUrl); /* @phpstan-ignore-next-line */ - $document[0] = $content; + $document[0] = $data['content']; + } + + if (isset($data['filename'])) { + $document->addAttribute('filename', $data['filename']); + } + + if (\is_bool($data['downloadable'])) { + $document->addAttribute('downloadable', $data['downloadable'] ? 'true' : 'false'); + } + + if (\is_bool($data['removable'])) { + $document->addAttribute('removable', $data['removable'] ? 'true' : 'false'); } } } From f38162c173bae61174583a8b5fd1b8c8f00c3d19 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:27:19 +0100 Subject: [PATCH 2/9] Add support for embedded slides --- src/Parameters/InsertDocumentParameters.php | 31 ++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index 538266e6..710635e2 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -34,10 +34,11 @@ public function __construct(protected string $meetingID) { } - public function addPresentation(string $url, string $filename, ?bool $downloadable = null, ?bool $removable = null): self + public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null): self { - $this->presentations[$url] = [ + $this->presentations[$nameOrUrl] = [ 'filename' => $filename, + 'content' => !$content ?: base64_encode($content), 'downloadable' => $downloadable, 'removable' => $removable, ]; @@ -61,17 +62,27 @@ public function getPresentationsAsXML(): string|false $module = $xml->addChild('module'); $module->addAttribute('name', 'presentation'); - foreach ($this->presentations as $url => $content) { - $presentation = $module->addChild('document'); - $presentation->addAttribute('url', $url); - $presentation->addAttribute('filename', $content['filename']); + foreach ($this->presentations as $nameOrUrl => $data) { + $document = $module->addChild('document'); - if (\is_bool($content['downloadable'])) { - $presentation->addAttribute('downloadable', $content['downloadable'] ? 'true' : 'false'); + if (str_starts_with($nameOrUrl, 'http')) { + $document->addAttribute('url', $nameOrUrl); + } else { + $document->addAttribute('name', $nameOrUrl); + /* @phpstan-ignore-next-line */ + $document[0] = $data['content']; } - if (\is_bool($content['removable'])) { - $presentation->addAttribute('removable', $content['removable'] ? 'true' : 'false'); + if (isset($data['filename'])) { + $document->addAttribute('filename', $data['filename']); + } + + if (\is_bool($data['downloadable'])) { + $document->addAttribute('downloadable', $data['downloadable'] ? 'true' : 'false'); + } + + if (\is_bool($data['removable'])) { + $document->addAttribute('removable', $data['removable'] ? 'true' : 'false'); } } $result = $xml->asXML(); From 475ba3ed51ff6d5550e5a0317a9f851365a09ef6 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:36:13 +0200 Subject: [PATCH 3/9] Add current parameter --- src/Parameters/CreateMeetingParameters.php | 7 ++++++- src/Parameters/InsertDocumentParameters.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index 6f656b3d..fc092002 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -351,13 +351,14 @@ public function setGuestPolicyAlwaysAccept(): self return $this; } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null): self + public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null, ?bool $current = null): self { $this->presentations[$nameOrUrl] = [ 'filename' => $filename, 'content' => !$content ?: base64_encode($content), 'downloadable' => $downloadable, 'removable' => $removable, + 'current' => $current, ]; return $this; @@ -446,6 +447,10 @@ public function addPresentationsModule(SimpleXMLElementExtended $xml): void if (\is_bool($data['removable'])) { $document->addAttribute('removable', $data['removable'] ? 'true' : 'false'); } + + if (\is_bool($data['current'])) { + $document->addAttribute('current', $data['current'] ? 'true' : 'false'); + } } } } diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index 710635e2..feb4db9a 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -34,13 +34,14 @@ public function __construct(protected string $meetingID) { } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null): self + public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null, ?bool $current = null): self { $this->presentations[$nameOrUrl] = [ 'filename' => $filename, 'content' => !$content ?: base64_encode($content), 'downloadable' => $downloadable, 'removable' => $removable, + 'current' => $current, ]; return $this; @@ -84,6 +85,10 @@ public function getPresentationsAsXML(): string|false if (\is_bool($data['removable'])) { $document->addAttribute('removable', $data['removable'] ? 'true' : 'false'); } + + if (\is_bool($data['current'])) { + $document->addAttribute('current', $data['current'] ? 'true' : 'false'); + } } $result = $xml->asXML(); } From 8d0d32c5c6502bf8b106c1d46b970fce6faf54c3 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:39:17 +0200 Subject: [PATCH 4/9] Refactor: Use Object to manage presentation attributes --- src/Core/InlinePresentation.php | 49 ++++++++++ src/Core/Presentation.php | 101 ++++++++++++++++++++ src/Core/UrlPresentation.php | 47 +++++++++ src/Parameters/CreateMeetingParameters.php | 24 ++++- src/Parameters/InsertDocumentParameters.php | 47 +++++---- 5 files changed, 239 insertions(+), 29 deletions(-) create mode 100644 src/Core/InlinePresentation.php create mode 100644 src/Core/Presentation.php create mode 100644 src/Core/UrlPresentation.php diff --git a/src/Core/InlinePresentation.php b/src/Core/InlinePresentation.php new file mode 100644 index 00000000..4a4b2486 --- /dev/null +++ b/src/Core/InlinePresentation.php @@ -0,0 +1,49 @@ +. + */ + +namespace BigBlueButton\Core; + +class InlinePresentation extends Presentation +{ + public function __construct(private readonly string $content, string $filename) + { + $this->filename = $filename; + } + + public function getArrayKey() + { + return $this->filename; + } + + public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement + { + $document = parent::addDocumentToXML($module); + + $document[0] = base64_encode($this->content); + + if (isset($this->filename)) { + $document->addAttribute('name', $this->filename); + } + + return $document; + } +} diff --git a/src/Core/Presentation.php b/src/Core/Presentation.php new file mode 100644 index 00000000..30c9796a --- /dev/null +++ b/src/Core/Presentation.php @@ -0,0 +1,101 @@ +. + */ + +namespace BigBlueButton\Core; + +abstract class Presentation +{ + protected ?string $filename = null; + + protected ?bool $current = null; + + protected ?bool $downloadable = null; + + protected ?bool $removable = null; + + public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement + { + $document = $module->addChild('document'); + + if (\is_bool($this->downloadable)) { + $document->addAttribute('downloadable', $this->downloadable ? 'true' : 'false'); + } + + if (\is_bool($this->removable)) { + $document->addAttribute('removable', $this->removable ? 'true' : 'false'); + } + + if (\is_bool($this->current)) { + $document->addAttribute('current', $this->current ? 'true' : 'false'); + } + + return $document; + } + + public function getFilename(): ?string + { + return $this->filename; + } + + public function setFilename(string $filename): self + { + $this->filename = $filename; + + return $this; + } + + public function getCurrent(): ?bool + { + return $this->current; + } + + public function setCurrent(bool $current): self + { + $this->current = $current; + + return $this; + } + + public function getDownloadable(): ?bool + { + return $this->downloadable; + } + + public function setDownloadable(bool $downloadable): self + { + $this->downloadable = $downloadable; + + return $this; + } + + public function getRemovable(): ?bool + { + return $this->removable; + } + + public function setRemovable(bool $removable): self + { + $this->removable = $removable; + + return $this; + } +} diff --git a/src/Core/UrlPresentation.php b/src/Core/UrlPresentation.php new file mode 100644 index 00000000..d21ee993 --- /dev/null +++ b/src/Core/UrlPresentation.php @@ -0,0 +1,47 @@ +. + */ + +namespace BigBlueButton\Core; + +class UrlPresentation extends Presentation +{ + public function __construct(private readonly string $url) + { + } + + public function getArrayKey() + { + return $this->url; + } + + public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement + { + $document = parent::addDocumentToXML($module); + $document->addAttribute('url', $this->url); + + if (isset($this->filename)) { + $document->addAttribute('filename', $this->filename); + } + + return $document; + } +} diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index fc092002..ad34db33 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -22,6 +22,7 @@ namespace BigBlueButton\Parameters; +use BigBlueButton\Core\Presentation; use BigBlueButton\Enum\Feature; use BigBlueButton\Enum\GuestPolicy; use BigBlueButton\Enum\MeetingLayout; @@ -351,14 +352,22 @@ public function setGuestPolicyAlwaysAccept(): self return $this; } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null, ?bool $current = null): self + /** + * @return $this + */ + public function addPresentation(string|Presentation $nameOrUrlOrPresentation, ?string $content = null, ?string $filename = null): self { - $this->presentations[$nameOrUrl] = [ + if ($nameOrUrlOrPresentation instanceof Presentation) { + $this->presentations[$nameOrUrlOrPresentation->getArrayKey()] = $nameOrUrlOrPresentation; + + return $this; + } + + @trigger_error(\sprintf('Calling addPresentation without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); + + $this->presentations[$nameOrUrlOrPresentation] = [ 'filename' => $filename, 'content' => !$content ?: base64_encode($content), - 'downloadable' => $downloadable, - 'removable' => $removable, - 'current' => $current, ]; return $this; @@ -426,6 +435,11 @@ public function addPresentationsModule(SimpleXMLElementExtended $xml): void $module->addAttribute('name', 'presentation'); foreach ($this->presentations as $nameOrUrl => $data) { + if ($data instanceof Presentation) { + $data->addDocumentToXML($module); + continue; + } + $document = $module->addChild('document'); if (str_starts_with($nameOrUrl, 'http')) { diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index feb4db9a..2876de75 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -21,6 +21,8 @@ namespace BigBlueButton\Parameters; +use BigBlueButton\Core\Presentation; + /** * @method string getMeetingID() * @method $this setMeetingID(string $id) @@ -34,14 +36,20 @@ public function __construct(protected string $meetingID) { } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null, ?bool $current = null): self + public function addPresentation(string|Presentation $urlOrPresentation, ?string $filename = null, ?bool $downloadable = null, ?bool $removable = null): self { - $this->presentations[$nameOrUrl] = [ + if ($urlOrPresentation instanceof Presentation) { + $this->presentations[$urlOrPresentation->getArrayKey()] = $urlOrPresentation; + + return $this; + } + + @trigger_error(\sprintf('Calling addPresentation without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); + + $this->presentations[$urlOrPresentation] = [ 'filename' => $filename, - 'content' => !$content ?: base64_encode($content), 'downloadable' => $downloadable, 'removable' => $removable, - 'current' => $current, ]; return $this; @@ -63,31 +71,22 @@ public function getPresentationsAsXML(): string|false $module = $xml->addChild('module'); $module->addAttribute('name', 'presentation'); - foreach ($this->presentations as $nameOrUrl => $data) { - $document = $module->addChild('document'); - - if (str_starts_with($nameOrUrl, 'http')) { - $document->addAttribute('url', $nameOrUrl); - } else { - $document->addAttribute('name', $nameOrUrl); - /* @phpstan-ignore-next-line */ - $document[0] = $data['content']; - } - - if (isset($data['filename'])) { - $document->addAttribute('filename', $data['filename']); + foreach ($this->presentations as $url => $content) { + if ($content instanceof Presentation) { + $content->addDocumentToXML($module); + continue; } - if (\is_bool($data['downloadable'])) { - $document->addAttribute('downloadable', $data['downloadable'] ? 'true' : 'false'); - } + $presentation = $module->addChild('document'); + $presentation->addAttribute('url', $url); + $presentation->addAttribute('filename', $content['filename']); - if (\is_bool($data['removable'])) { - $document->addAttribute('removable', $data['removable'] ? 'true' : 'false'); + if (\is_bool($content['downloadable'])) { + $presentation->addAttribute('downloadable', $content['downloadable'] ? 'true' : 'false'); } - if (\is_bool($data['current'])) { - $document->addAttribute('current', $data['current'] ? 'true' : 'false'); + if (\is_bool($content['removable'])) { + $presentation->addAttribute('removable', $content['removable'] ? 'true' : 'false'); } } $result = $xml->asXML(); From c3c79b5a5b28881d406ded09e3c98ae1ede74e2b Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:48:27 +0200 Subject: [PATCH 5/9] Remove wrong doctype --- src/Parameters/CreateMeetingParameters.php | 3 --- src/Parameters/InsertDocumentParameters.php | 1 - 2 files changed, 4 deletions(-) diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index ad34db33..d114eee5 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -248,9 +248,6 @@ class CreateMeetingParameters extends MetaParameters protected ?bool $allowOverrideClientSettingsOnCreateCall = null; protected ?string $clientSettingsOverride = null; - /** - * @var array> - */ private array $presentations = []; public function __construct(protected string $meetingID, protected string $name) diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index 2876de75..fa16e36d 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -29,7 +29,6 @@ */ final class InsertDocumentParameters extends MetaParameters { - /** @var array */ private array $presentations = []; public function __construct(protected string $meetingID) From 54bdd9b2bb99605e308809ab6fbfc9bdf5b9e567 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 14 Jul 2026 18:04:18 +0200 Subject: [PATCH 6/9] Code cleanup --- src/Core/InlinePresentation.php | 7 ++- src/Core/Presentation.php | 6 ++- src/Core/UrlPresentation.php | 6 ++- src/Parameters/CreateMeetingParameters.php | 52 +++++++-------------- src/Parameters/InsertDocumentParameters.php | 38 +++++++-------- 5 files changed, 49 insertions(+), 60 deletions(-) diff --git a/src/Core/InlinePresentation.php b/src/Core/InlinePresentation.php index 4a4b2486..13ce502d 100644 --- a/src/Core/InlinePresentation.php +++ b/src/Core/InlinePresentation.php @@ -22,6 +22,8 @@ namespace BigBlueButton\Core; +use BigBlueButton\Util\SimpleXMLElementExtended; + class InlinePresentation extends Presentation { public function __construct(private readonly string $content, string $filename) @@ -29,15 +31,16 @@ public function __construct(private readonly string $content, string $filename) $this->filename = $filename; } - public function getArrayKey() + public function getArrayKey(): string { return $this->filename; } - public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement + public function addDocumentToXML(SimpleXMLElementExtended $module): ?SimpleXMLElementExtended { $document = parent::addDocumentToXML($module); + /* @phpstan-ignore-next-line */ $document[0] = base64_encode($this->content); if (isset($this->filename)) { diff --git a/src/Core/Presentation.php b/src/Core/Presentation.php index 30c9796a..06b074a2 100644 --- a/src/Core/Presentation.php +++ b/src/Core/Presentation.php @@ -22,6 +22,8 @@ namespace BigBlueButton\Core; +use BigBlueButton\Util\SimpleXMLElementExtended; + abstract class Presentation { protected ?string $filename = null; @@ -32,7 +34,7 @@ abstract class Presentation protected ?bool $removable = null; - public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement + public function addDocumentToXML(SimpleXMLElementExtended $module): ?SimpleXMLElementExtended { $document = $module->addChild('document'); @@ -51,6 +53,8 @@ public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement return $document; } + abstract public function getArrayKey(): string; + public function getFilename(): ?string { return $this->filename; diff --git a/src/Core/UrlPresentation.php b/src/Core/UrlPresentation.php index d21ee993..896fec4c 100644 --- a/src/Core/UrlPresentation.php +++ b/src/Core/UrlPresentation.php @@ -22,18 +22,20 @@ namespace BigBlueButton\Core; +use BigBlueButton\Util\SimpleXMLElementExtended; + class UrlPresentation extends Presentation { public function __construct(private readonly string $url) { } - public function getArrayKey() + public function getArrayKey(): string { return $this->url; } - public function addDocumentToXML(\SimpleXMLElement $module): ?\SimpleXMLElement + public function addDocumentToXML(SimpleXMLElementExtended $module): ?SimpleXMLElementExtended { $document = parent::addDocumentToXML($module); $document->addAttribute('url', $this->url); diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index d114eee5..4c2c5ec1 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -22,7 +22,9 @@ namespace BigBlueButton\Parameters; +use BigBlueButton\Core\InlinePresentation; use BigBlueButton\Core\Presentation; +use BigBlueButton\Core\UrlPresentation; use BigBlueButton\Enum\Feature; use BigBlueButton\Enum\GuestPolicy; use BigBlueButton\Enum\MeetingLayout; @@ -248,6 +250,7 @@ class CreateMeetingParameters extends MetaParameters protected ?bool $allowOverrideClientSettingsOnCreateCall = null; protected ?string $clientSettingsOverride = null; + /** @var array */ private array $presentations = []; public function __construct(protected string $meetingID, protected string $name) @@ -360,12 +363,20 @@ public function addPresentation(string|Presentation $nameOrUrlOrPresentation, ?s return $this; } - @trigger_error(\sprintf('Calling addPresentation without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Calling addPresentation in "%s" without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); - $this->presentations[$nameOrUrlOrPresentation] = [ - 'filename' => $filename, - 'content' => !$content ?: base64_encode($content), - ]; + if ($content) { + $presentation = new InlinePresentation($content, $nameOrUrlOrPresentation); + $this->presentations[$presentation->getArrayKey()] = $presentation; + } else { + $presentation = new UrlPresentation($nameOrUrlOrPresentation); + + if ($filename != null) { + $presentation->setFilename($filename); + } + + $this->presentations[$presentation->getArrayKey()] = $presentation; + } return $this; } @@ -390,7 +401,7 @@ public function addBreakoutRoomsGroup(string $id, ?string $name, array $roster): return $this; } - /** @return array */ + /** @return array */ public function getPresentations(): array { return $this->presentations; @@ -431,36 +442,9 @@ public function addPresentationsModule(SimpleXMLElementExtended $xml): void $module = $xml->addChild('module'); $module->addAttribute('name', 'presentation'); - foreach ($this->presentations as $nameOrUrl => $data) { + foreach ($this->presentations as $data) { if ($data instanceof Presentation) { $data->addDocumentToXML($module); - continue; - } - - $document = $module->addChild('document'); - - if (str_starts_with($nameOrUrl, 'http')) { - $document->addAttribute('url', $nameOrUrl); - } else { - $document->addAttribute('name', $nameOrUrl); - /* @phpstan-ignore-next-line */ - $document[0] = $data['content']; - } - - if (isset($data['filename'])) { - $document->addAttribute('filename', $data['filename']); - } - - if (\is_bool($data['downloadable'])) { - $document->addAttribute('downloadable', $data['downloadable'] ? 'true' : 'false'); - } - - if (\is_bool($data['removable'])) { - $document->addAttribute('removable', $data['removable'] ? 'true' : 'false'); - } - - if (\is_bool($data['current'])) { - $document->addAttribute('current', $data['current'] ? 'true' : 'false'); } } } diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index fa16e36d..4985ca29 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -22,6 +22,8 @@ namespace BigBlueButton\Parameters; use BigBlueButton\Core\Presentation; +use BigBlueButton\Core\UrlPresentation; +use BigBlueButton\Util\SimpleXMLElementExtended; /** * @method string getMeetingID() @@ -29,6 +31,7 @@ */ final class InsertDocumentParameters extends MetaParameters { + /** @var array */ private array $presentations = []; public function __construct(protected string $meetingID) @@ -43,13 +46,19 @@ public function addPresentation(string|Presentation $urlOrPresentation, ?string return $this; } - @trigger_error(\sprintf('Calling addPresentation without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Calling addPresentation in "%s" without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); - $this->presentations[$urlOrPresentation] = [ - 'filename' => $filename, - 'downloadable' => $downloadable, - 'removable' => $removable, - ]; + $presentation = new UrlPresentation($urlOrPresentation); + + if ($filename !== null) { + $presentation->setFilename($filename); + } + if ($downloadable !== null) { + $presentation->setDownloadable($downloadable); + } + if ($removable !== null) { + $presentation->setRemovable($removable); + } return $this; } @@ -66,26 +75,13 @@ public function getPresentationsAsXML(): string|false $result = ''; if (!empty($this->presentations)) { - $xml = new \SimpleXMLElement(''); + $xml = new SimpleXMLElementExtended(''); $module = $xml->addChild('module'); $module->addAttribute('name', 'presentation'); - foreach ($this->presentations as $url => $content) { + foreach ($this->presentations as $content) { if ($content instanceof Presentation) { $content->addDocumentToXML($module); - continue; - } - - $presentation = $module->addChild('document'); - $presentation->addAttribute('url', $url); - $presentation->addAttribute('filename', $content['filename']); - - if (\is_bool($content['downloadable'])) { - $presentation->addAttribute('downloadable', $content['downloadable'] ? 'true' : 'false'); - } - - if (\is_bool($content['removable'])) { - $presentation->addAttribute('removable', $content['removable'] ? 'true' : 'false'); } } $result = $xml->asXML(); From bee9f1ff5f4ad81898e26d17404259a627a47c8b Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 14 Jul 2026 18:06:44 +0200 Subject: [PATCH 7/9] Adjust deprecation message --- src/Parameters/CreateMeetingParameters.php | 2 +- src/Parameters/InsertDocumentParameters.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index 4c2c5ec1..3fff5d7a 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -363,7 +363,7 @@ public function addPresentation(string|Presentation $nameOrUrlOrPresentation, ?s return $this; } - @trigger_error(\sprintf('Calling addPresentation in "%s" without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Calling addPresentation in "%s" with any parameters other than a single Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); if ($content) { $presentation = new InlinePresentation($content, $nameOrUrlOrPresentation); diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index 4985ca29..7197d2c9 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -46,7 +46,7 @@ public function addPresentation(string|Presentation $urlOrPresentation, ?string return $this; } - @trigger_error(\sprintf('Calling addPresentation in "%s" without a Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); + @trigger_error(\sprintf('Calling addPresentation in "%s" with any parameters other than a single Presentation object is deprecated and will throw an exception in 7.0.', self::class), \E_USER_DEPRECATED); $presentation = new UrlPresentation($urlOrPresentation); From 807a026b5d1ffeef778cfd1b83aa6464c2b0c819 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 14 Jul 2026 18:09:09 +0200 Subject: [PATCH 8/9] Bugfix --- src/Parameters/InsertDocumentParameters.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index 7197d2c9..1d799895 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -60,6 +60,8 @@ public function addPresentation(string|Presentation $urlOrPresentation, ?string $presentation->setRemovable($removable); } + $this->presentations[$presentation->getArrayKey()] = $presentation; + return $this; } From a62a2f0ae980d92c8acd2843b7a6184395620e78 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+samuelwei@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:39:33 +0200 Subject: [PATCH 9/9] Make classes final Co-authored-by: Felix Jacobi --- src/Core/InlinePresentation.php | 2 +- src/Core/UrlPresentation.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/InlinePresentation.php b/src/Core/InlinePresentation.php index 13ce502d..6b1f839c 100644 --- a/src/Core/InlinePresentation.php +++ b/src/Core/InlinePresentation.php @@ -24,7 +24,7 @@ use BigBlueButton\Util\SimpleXMLElementExtended; -class InlinePresentation extends Presentation +final class InlinePresentation extends Presentation { public function __construct(private readonly string $content, string $filename) { diff --git a/src/Core/UrlPresentation.php b/src/Core/UrlPresentation.php index 896fec4c..db416bd9 100644 --- a/src/Core/UrlPresentation.php +++ b/src/Core/UrlPresentation.php @@ -24,7 +24,7 @@ use BigBlueButton\Util\SimpleXMLElementExtended; -class UrlPresentation extends Presentation +final class UrlPresentation extends Presentation { public function __construct(private readonly string $url) {