*
* @return \LDAP\Result|array|false
*/
- public function search($ldapConnection, string $baseDn, string $filter, array $attributes = null)
+ public function search($ldapConnection, string $baseDn, string $filter, array $attributes = [])
{
return ldap_search($ldapConnection, $baseDn, $filter, $attributes);
}
*
* @return \LDAP\Result|array|false
*/
- public function read($ldapConnection, string $baseDn, string $filter, array $attributes = null)
+ public function read($ldapConnection, string $baseDn, string $filter, array $attributes = [])
{
return ldap_read($ldapConnection, $baseDn, $filter, $attributes);
}
*
* @param resource|\LDAP\Connection $ldapConnection
*/
- public function searchAndGetEntries($ldapConnection, string $baseDn, string $filter, array $attributes = null): array|false
+ public function searchAndGetEntries($ldapConnection, string $baseDn, string $filter, array $attributes = []): array|false
{
$search = $this->search($ldapConnection, $baseDn, $filter, $attributes);
*
* @param resource|\LDAP\Connection $ldapConnection
*/
- public function bind($ldapConnection, string $bindRdn = null, string $bindPassword = null): bool
+ public function bind($ldapConnection, ?string $bindRdn = null, ?string $bindPassword = null): bool
{
return ldap_bind($ldapConnection, $bindRdn, $bindPassword);
}
string $driverName,
array $config,
string $socialiteHandler,
- callable $configureForRedirect = null
+ ?callable $configureForRedirect = null
) {
$this->validDrivers[] = $driverName;
config()->set('services.' . $driverName, $config);
* Check if the current user has a permission. If an ownable element
* is passed in the jointPermissions are checked against that particular item.
*/
-function userCan(string $permission, Model $ownable = null): bool
+function userCan(string $permission, ?Model $ownable = null): bool
{
- if ($ownable === null) {
+ if (is_null($ownable)) {
return user()->can($permission);
}
*
* @return mixed|SettingService
*/
-function setting(string $key = null, $default = null)
+function setting(?string $key = null, mixed $default = null): mixed
{
$settingService = app()->make(SettingService::class);
* @var array
*/
'allowed_protocols' => [
+ "data://" => ["rules" => []],
'file://' => ['rules' => []],
'http://' => ['rules' => []],
'https://' => ['rules' => []],
/**
* Show the form for creating a new book.
*/
- public function create(string $shelfSlug = null)
+ public function create(?string $shelfSlug = null)
{
$this->checkPermission('book-create-all');
* @throws ImageUploadException
* @throws ValidationException
*/
- public function store(Request $request, string $shelfSlug = null)
+ public function store(Request $request, ?string $shelfSlug = null)
{
$this->checkPermission('book-create-all');
$validated = $this->validate($request, [
*
* @throws Throwable
*/
- public function create(string $bookSlug, string $chapterSlug = null)
+ public function create(string $bookSlug, ?string $chapterSlug = null)
{
if ($chapterSlug) {
$parent = $this->entityQueries->chapters->findVisibleBySlugsOrFail($bookSlug, $chapterSlug);
*
* @throws ValidationException
*/
- public function createAsGuest(Request $request, string $bookSlug, string $chapterSlug = null)
+ public function createAsGuest(Request $request, string $bookSlug, ?string $chapterSlug = null)
{
$this->validate($request, [
'name' => ['required', 'string', 'max:255'],
) {
}
- public function run(int $count, int $page, array $filterModels = null): Collection
+ public function run(int $count, int $page, array $filterModels): Collection
{
$query = $this->permissions
->restrictEntityRelationQuery(View::query(), 'views', 'viewable_id', 'viewable_type')
->groupBy('viewable_id', 'viewable_type')
->orderBy('view_count', 'desc');
- if ($filterModels) {
+ if (!empty($filterModels)) {
$query->whereIn('viewable_type', $this->entityProvider->getMorphClasses($filterModels));
}
/**
* Store a new revision in the system for the given page.
*/
- public function storeNewForPage(Page $page, string $summary = null): PageRevision
+ public function storeNewForPage(Page $page, ?string $summary = null): PageRevision
{
$revision = new PageRevision();
/**
* @see SocialDriverManager::addSocialDriver
*/
- public function addSocialDriver(string $driverName, array $config, string $socialiteHandler, callable $configureForRedirect = null): void
+ public function addSocialDriver(string $driverName, array $config, string $socialiteHandler, ?callable $configureForRedirect = null): void
{
$driverManager = app()->make(SocialDriverManager::class);
$driverManager->addSocialDriver($driverName, $config, $socialiteHandler, $configureForRedirect);
string $type,
int $page = 0,
int $pageSize = 24,
- int $uploadedTo = null,
- string $search = null,
- callable $whereClause = null
+ ?int $uploadedTo = null,
+ ?string $search = null,
+ ?callable $whereClause = null
): array {
$imageQuery = Image::query()->where('type', '=', strtolower($type));
$parentFilter = function (Builder $query) use ($filterType, $contextPage) {
if ($filterType === 'page') {
$query->where('uploaded_to', '=', $contextPage->id);
- } elseif ($filterType === 'book') {
+ } else if ($filterType === 'book') {
$validPageIds = $contextPage->book->pages()
->scopes('visible')
->pluck('id')
*
* @throws ImageUploadException
*/
- public function saveNew(UploadedFile $uploadFile, string $type, int $uploadedTo = 0, int $resizeWidth = null, int $resizeHeight = null, bool $keepRatio = true): Image
- {
+ public function saveNew(
+ UploadedFile $uploadFile,
+ string $type,
+ int $uploadedTo = 0,
+ ?int $resizeWidth = null,
+ ?int $resizeHeight = null,
+ bool $keepRatio = true
+ ): Image {
$image = $this->imageService->saveNewFromUpload($uploadFile, $type, $uploadedTo, $resizeWidth, $resizeHeight, $keepRatio);
if ($type !== 'system') {
*
* @throws Exception
*/
- public function destroyImage(Image $image = null): void
+ public function destroyImage(?Image $image = null): void
{
if ($image) {
$this->imageService->destroy($image);
UploadedFile $uploadedFile,
string $type,
int $uploadedTo = 0,
- int $resizeWidth = null,
- int $resizeHeight = null,
+ ?int $resizeWidth = null,
+ ?int $resizeHeight = null,
bool $keepRatio = true,
string $imageName = '',
): Image {
});
}
- protected function rules(int $userId = null): array
+ protected function rules(?int $userId = null): array
{
return [
'create' => [
'string',
'email',
'min:2',
- (new Unique('users', 'email'))->ignore($userId ?? null),
+ (new Unique('users', 'email'))->ignore($userId),
],
'external_auth_id' => ['string'],
'language' => ['string', 'max:15', 'alpha_dash'],
use BookStack\Exceptions\HttpFetchException;
+/**
+ * Validate the host we're connecting to when making a server-side-request.
+ * Will use the given hosts config if given during construction otherwise
+ * will look to the app configured config.
+ */
class SsrUrlValidator
{
protected string $config;
- public function __construct(string $config = null)
+ public function __construct(?string $config = null)
{
$this->config = $config ?? config('app.ssr_hosts') ?? '';
}
"ext-xml": "*",
"ext-zip": "*",
"bacon/bacon-qr-code": "^3.0",
- "dompdf/dompdf": "^3.0",
+ "dompdf/dompdf": "^3.1",
"guzzlehttp/guzzle": "^7.4",
"intervention/image": "^3.5",
"knplabs/knp-snappy": "^1.5",
},
{
"name": "dompdf/dompdf",
- "version": "v3.0.2",
+ "version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
- "reference": "baf4084b27c7f4b5b7a221b19a94d11327664eb8"
+ "reference": "a51bd7a063a65499446919286fb18b518177155a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/dompdf/dompdf/zipball/baf4084b27c7f4b5b7a221b19a94d11327664eb8",
- "reference": "baf4084b27c7f4b5b7a221b19a94d11327664eb8",
+ "url": "https://api.github.com/repos/dompdf/dompdf/zipball/a51bd7a063a65499446919286fb18b518177155a",
+ "reference": "a51bd7a063a65499446919286fb18b518177155a",
"shasum": ""
},
"require": {
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
- "source": "https://github.com/dompdf/dompdf/tree/v3.0.2"
+ "source": "https://github.com/dompdf/dompdf/tree/v3.1.0"
},
- "time": "2024-12-27T20:27:37+00:00"
+ "time": "2025-01-15T14:09:04+00:00"
},
{
"name": "dompdf/php-font-lib",
- string $driverName
- array $config
- string $socialiteHandler
+- callable|null $configureForRedirect = null
**Example**
{
$resp = $this->asAdmin()->get($this->page->getUrl('/edit'));
$editLink = $this->page->getUrl('/edit') . '?editor=';
- $this->withHtml($resp)->assertElementContains("a[href=\"${editLink}markdown-clean\"]", '(Clean Content)');
- $this->withHtml($resp)->assertElementContains("a[href=\"${editLink}markdown-stable\"]", '(Stable Content)');
- $this->withHtml($resp)->assertElementContains("a[href=\"${editLink}wysiwyg2024\"]", '(In Alpha Testing)');
+ $this->withHtml($resp)->assertElementContains("a[href=\"{$editLink}markdown-clean\"]", '(Clean Content)');
+ $this->withHtml($resp)->assertElementContains("a[href=\"{$editLink}markdown-stable\"]", '(Stable Content)');
+ $this->withHtml($resp)->assertElementContains("a[href=\"{$editLink}wysiwyg2024\"]", '(In Alpha Testing)');
$resp = $this->asAdmin()->get($this->page->getUrl('/edit?editor=markdown-stable'));
$editLink = $this->page->getUrl('/edit') . '?editor=';
- $this->withHtml($resp)->assertElementContains("a[href=\"${editLink}wysiwyg\"]", 'Switch to WYSIWYG Editor');
+ $this->withHtml($resp)->assertElementContains("a[href=\"{$editLink}wysiwyg\"]", 'Switch to WYSIWYG Editor');
}
public function test_editor_type_switch_options_dont_show_if_without_change_editor_permissions()
{
$resp = $this->asEditor()->get($this->page->getUrl('/edit'));
$editLink = $this->page->getUrl('/edit') . '?editor=';
- $this->withHtml($resp)->assertElementNotExists("a[href*=\"${editLink}\"]");
+ $this->withHtml($resp)->assertElementNotExists("a[href*=\"{$editLink}\"]");
}
public function test_page_editor_type_switch_does_not_work_without_change_editor_permissions()