forked from bigbluebutton/bigbluebutton-api-php
-
Notifications
You must be signed in to change notification settings - Fork 14
Refactor presentation files #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samuelwei
wants to merge
9
commits into
master
Choose a base branch
from
refactor-presentation-files
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a38b553
Add support for downloadable and removable attribute
samuelwei f38162c
Add support for embedded slides
samuelwei 475ba3e
Add current parameter
samuelwei 8d0d32c
Refactor: Use Object to manage presentation attributes
samuelwei c3c79b5
Remove wrong doctype
samuelwei 54bdd9b
Code cleanup
samuelwei bee9f1f
Adjust deprecation message
samuelwei 807a026
Bugfix
samuelwei a62a2f0
Make classes final
samuelwei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/. | ||
| * | ||
| * Copyright (c) 2016-2018 BigBlueButton Inc. and by respective authors (see below). | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it under the | ||
| * terms of the GNU Lesser General Public License as published by the Free Software | ||
| * Foundation; either version 3.0 of the License, or (at your option) any later | ||
| * version. | ||
| * | ||
| * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
| * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public License along | ||
| * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| namespace BigBlueButton\Core; | ||
|
|
||
| use BigBlueButton\Util\SimpleXMLElementExtended; | ||
|
|
||
| final class InlinePresentation extends Presentation | ||
| { | ||
| public function __construct(private readonly string $content, string $filename) | ||
| { | ||
| $this->filename = $filename; | ||
| } | ||
|
|
||
| public function getArrayKey(): string | ||
| { | ||
| return $this->filename; | ||
| } | ||
|
|
||
| public function addDocumentToXML(SimpleXMLElementExtended $module): ?SimpleXMLElementExtended | ||
| { | ||
| $document = parent::addDocumentToXML($module); | ||
|
|
||
| /* @phpstan-ignore-next-line */ | ||
| $document[0] = base64_encode($this->content); | ||
|
|
||
| if (isset($this->filename)) { | ||
| $document->addAttribute('name', $this->filename); | ||
| } | ||
|
|
||
| return $document; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/. | ||
| * | ||
| * Copyright (c) 2016-2018 BigBlueButton Inc. and by respective authors (see below). | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it under the | ||
| * terms of the GNU Lesser General Public License as published by the Free Software | ||
| * Foundation; either version 3.0 of the License, or (at your option) any later | ||
| * version. | ||
| * | ||
| * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
| * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public License along | ||
| * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| namespace BigBlueButton\Core; | ||
|
|
||
| use BigBlueButton\Util\SimpleXMLElementExtended; | ||
|
|
||
| abstract class Presentation | ||
| { | ||
| protected ?string $filename = null; | ||
|
|
||
| protected ?bool $current = null; | ||
|
|
||
| protected ?bool $downloadable = null; | ||
|
|
||
| protected ?bool $removable = null; | ||
|
|
||
| public function addDocumentToXML(SimpleXMLElementExtended $module): ?SimpleXMLElementExtended | ||
| { | ||
| $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; | ||
| } | ||
|
|
||
| abstract public function getArrayKey(): string; | ||
|
|
||
| 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; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * BigBlueButton open source conferencing system - https://www.bigbluebutton.org/. | ||
| * | ||
| * Copyright (c) 2016-2018 BigBlueButton Inc. and by respective authors (see below). | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it under the | ||
| * terms of the GNU Lesser General Public License as published by the Free Software | ||
| * Foundation; either version 3.0 of the License, or (at your option) any later | ||
| * version. | ||
| * | ||
| * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
| * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public License along | ||
| * with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| namespace BigBlueButton\Core; | ||
|
|
||
| use BigBlueButton\Util\SimpleXMLElementExtended; | ||
|
|
||
| final class UrlPresentation extends Presentation | ||
| { | ||
| public function __construct(private readonly string $url) | ||
| { | ||
| } | ||
|
|
||
| public function getArrayKey(): string | ||
| { | ||
| return $this->url; | ||
| } | ||
|
|
||
| public function addDocumentToXML(SimpleXMLElementExtended $module): ?SimpleXMLElementExtended | ||
| { | ||
| $document = parent::addDocumentToXML($module); | ||
| $document->addAttribute('url', $this->url); | ||
|
|
||
| if (isset($this->filename)) { | ||
| $document->addAttribute('filename', $this->filename); | ||
| } | ||
|
|
||
| return $document; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly: Breaking change :/ . I need to think about a solution. Maybe we must move this to a new major version or add a new method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need a major version for #243, as the parameter and return type changed