--- /dev/null
+<?php
+
+namespace App\Fluidbook\Compiler;
+
+use App\Fluidbook\Link\Link;
+use App\Models\FluidbookHealthIssues;
+use Cubist\Util\ArrayUtil;
+use Cubist\Util\Files\Files;
+use Fluidbook\Tools\SVG\SVGTools;
+
+trait Tabs
+{
+ protected function initTabsConfig()
+ {
+ $hideOnPages = ArrayUtil::parseRange($this->config->tabsHideOnPages);
+ $this->config->tabsDisabledOnPages = ArrayUtil::parseRange($this->config->tabsDisabledOnPages);
+
+ if ($this->config->tabsHideOnCover) {
+ $hideOnPages[] = 0;
+ $hideOnPages[] = 1;
+ }
+ if ($this->config->tabsHideOnLastPage) {
+ $hideOnPages[] = count($this->pages);
+ }
+ $this->config->tabsHideOnPages = $hideOnPages;
+ }
+
+ protected function writeTabs()
+ {
+ if (!$this->fluidbookSettings->tabsHTML5 || !file_exists($this->wdir . '/' . $this->fluidbookSettings->tabsHTML5)) {
+ return;
+ }
+
+ $ext = Files::getExtension($this->fluidbookSettings->tabsHTML5);
+ if ($ext === 'zip') {
+ $links['tabs'] = [
+ 'page' => 'background',
+ 'top' => 0,
+ 'left' => 0,
+ 'width' => 100,
+ 'height' => 100,
+ 'type' => Link::MULTIMEDIA,
+ 'to' => $this->fluidbookSettings->tabsHTML5,
+ 'image' => '',
+ 'inline' => 1,
+ 'interactive' => 1,
+ 'class' => 'tabslink',
+ 'uid' => 'tabs',
+ ];
+ return;
+ }
+
+
+ $svg = $this->wdir . '/' . $this->fluidbookSettings->tabsHTML5;
+ $opt = SVGTools::optimizeSVG($svg, null, '--trim-ids no --remove-unreferenced-ids no --ungroup-groups no --group-by-style no', true);
+
+ $svgContent = file_get_contents($opt);
+ $svgContent = str_replace('_1_', '', $svgContent, $count);
+ if ($count) {
+ file_put_contents($opt, $svgContent);
+ }
+
+
+ $this->vdir->copy($opt, 'data/tabs.svg');
+ $this->config->svgTabs = true;
+ $pagesLists = ['tabsPages', 'tabsSections'];
+
+ foreach ($pagesLists as $pagesList) {
+ $e = explode(',', $this->fluidbookSettings->$pagesList);
+ $list = [];
+ foreach ($e as $k => $v) {
+ $v = trim($v);
+ if ($v === '') {
+ continue;
+ }
+ if ($v !== '-') {
+ if ($this->fluidbookSettings->tabsPagesNumbers === 'virtual') {
+ $v = $this->virtualToPhysical($v);
+ }
+ }
+ $list[] = $v;
+ }
+ $this->config->$pagesList = $list;
+ }
+
+ $this->checkTabsSVG($opt);
+ }
+
+ protected function checkTabsSVG($svg)
+ {
+ $xmlsvg = simplexml_load_string(file_get_contents($svg));
+ $xmlsvg->registerXPathNamespace('svg', 'http://www.w3.org/2000/svg');
+ $missing = [];
+ for ($i = 1; $i <= count($this->config->tabsPages); $i++) {
+ if (!$xmlsvg->xpath('//svg:g[@id="o' . $i . '"]')) {
+ $missing[] = 'o' . $i;
+ }
+ }
+
+ if (count($missing)) {
+ $this->addIssue(FluidbookHealthIssues::TYPE_TABS_MISSING_TAB_ID, ['missing_tabs' => implode(', ', $missing)]);
+ }
+
+ }
+}
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "a2c4e7e7e43bf89fa3a5c783830cb261",
+ "content-hash": "8c149e34e8566615c51e387244172414",
"packages": [
{
"name": "archtechx/enums",
},
{
"name": "cubedesigners/userdatabase",
- "version": "dev-backpack5",
+ "version": "dev-master",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubedesigners_userdatabase.git",
- "reference": "4373255749acbad60ac7957943406d3d0ddc851d"
+ "reference": "104abada3256ab6df09320052854c665792f8f58"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubedesigners/userdatabase/cubedesigners-userdatabase-dev-backpack5-eb743b.tar",
- "reference": "4373255749acbad60ac7957943406d3d0ddc851d",
- "shasum": "e456325d86dd8dd4e607201a49197d128c5d0e5e"
+ "url": "https://composer.cubedesigners.com/dist/cubedesigners/userdatabase/cubedesigners-userdatabase-dev-master-f99793.tar",
+ "reference": "104abada3256ab6df09320052854c665792f8f58",
+ "shasum": "a13fb014f7a9b17949437e19f27a1421645d3017"
},
"require": {
"cubist/cms-back": "dev-backpack5",
"php": ">=8.2"
},
+ "default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
}
],
"description": "Cubedesigners common users database",
- "time": "2023-10-18T07:47:08+00:00"
+ "time": "2024-02-23T11:33:37+00:00"
},
{
"name": "cubist/azuretts",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_net.git",
- "reference": "2ce0039849af4c8a877c81e57f5fb7568541bf8e"
+ "reference": "5679d21834ca61f6ca55f94fa9a7ffdf933f6cd4"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-6477e3.tar",
- "reference": "2ce0039849af4c8a877c81e57f5fb7568541bf8e",
- "shasum": "cb8e5f0cf2782715f29152b4704767f9ab943b8e"
+ "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-5cf72a.tar",
+ "reference": "5679d21834ca61f6ca55f94fa9a7ffdf933f6cd4",
+ "shasum": "e492c3876a059b659cbf106aa2c174d04112ee01"
},
"require": {
"cubist/util": "dev-master",
}
],
"description": "net cubist composer package",
- "time": "2024-02-01T15:16:16+00:00"
+ "time": "2024-02-22T15:26:55+00:00"
},
{
"name": "cubist/pdf",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/fluidbook_tools.git",
- "reference": "0a53a4c867caab1fb9a4cc7d72fb29a824bd00ca"
+ "reference": "97d54a44641d98b15ebaa798fc3c053092f47756"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-6971c7.tar",
- "reference": "0a53a4c867caab1fb9a4cc7d72fb29a824bd00ca",
- "shasum": "04f779c4390d723229ba3f2bc0b7c6182c371637"
+ "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-f8e490.tar",
+ "reference": "97d54a44641d98b15ebaa798fc3c053092f47756",
+ "shasum": "1cedc9849713364a0d3cb35ea9a9f62494308b97"
},
"require": {
"barryvdh/laravel-debugbar": "*",
}
],
"description": "Fluidbook Tools",
- "time": "2024-02-21T16:08:21+00:00"
+ "time": "2024-02-23T16:44:02+00:00"
},
{
"name": "fruitcake/php-cors",
},
{
"name": "spatie/laravel-translatable",
- "version": "6.5.5",
+ "version": "6.6.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-translatable.git",
- "reference": "d6dc7c9fe3c678ce50b2d6a4a7434fcbcfc3df4c"
+ "reference": "11f0b548dd43b846a5bdca1431de173ac77ed349"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/d6dc7c9fe3c678ce50b2d6a4a7434fcbcfc3df4c",
- "reference": "d6dc7c9fe3c678ce50b2d6a4a7434fcbcfc3df4c",
+ "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/11f0b548dd43b846a5bdca1431de173ac77ed349",
+ "reference": "11f0b548dd43b846a5bdca1431de173ac77ed349",
"shasum": ""
},
"require": {
- "illuminate/database": "^9.0|^10.0",
- "illuminate/support": "^9.0|^10.0",
+ "illuminate/database": "^9.0|^10.0|^11.0",
+ "illuminate/support": "^9.0|^10.0|^11.0",
"php": "^8.0",
"spatie/laravel-package-tools": "^1.11"
},
"require-dev": {
"mockery/mockery": "^1.4",
- "orchestra/testbench": "^7.0|^8.0",
- "pestphp/pest": "^1.20"
+ "orchestra/testbench": "^7.0|^8.0|^9.0",
+ "pestphp/pest": "^1.20|^2.0"
},
"type": "library",
"extra": {
],
"support": {
"issues": "https://github.com/spatie/laravel-translatable/issues",
- "source": "https://github.com/spatie/laravel-translatable/tree/6.5.5"
+ "source": "https://github.com/spatie/laravel-translatable/tree/6.6.0"
},
"funding": [
{
"type": "github"
}
],
- "time": "2023-12-06T10:56:22+00:00"
+ "time": "2024-02-23T13:52:34+00:00"
},
{
"name": "spatie/pdf-to-image",
},
{
"name": "phpdocumentor/type-resolver",
- "version": "1.8.1",
+ "version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
- "reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353"
+ "reference": "153ae662783729388a584b4361f2545e4d841e3c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353",
- "reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c",
+ "reference": "153ae662783729388a584b4361f2545e4d841e3c",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^1.0",
- "php": "^7.4 || ^8.0",
+ "php": "^7.3 || ^8.0",
"phpdocumentor/reflection-common": "^2.0",
"phpstan/phpdoc-parser": "^1.13"
},
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
- "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.1"
+ "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2"
},
- "time": "2024-01-18T19:15:27+00:00"
+ "time": "2024-02-23T11:10:43+00:00"
},
{
"name": "phpstan/phpdoc-parser",
- "version": "1.25.0",
+ "version": "1.26.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
- "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240"
+ "reference": "231e3186624c03d7e7c890ec662b81e6b0405227"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240",
- "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240",
+ "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227",
+ "reference": "231e3186624c03d7e7c890ec662b81e6b0405227",
"shasum": ""
},
"require": {
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
- "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0"
+ "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0"
},
- "time": "2024-01-04T17:06:16+00:00"
+ "time": "2024-02-23T16:05:55+00:00"
},
{
"name": "phpunit/php-code-coverage",
},
{
"name": "phpunit/phpunit",
- "version": "9.6.16",
+ "version": "9.6.17",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f"
+ "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f",
- "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd",
+ "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd",
"shasum": ""
},
"require": {
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17"
},
"funding": [
{
"type": "tidelift"
}
],
- "time": "2024-01-19T07:03:14+00:00"
+ "time": "2024-02-23T13:14:51+00:00"
},
{
"name": "psy/psysh",
"ext-zlib": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.6.0"
+ "plugin-api-version": "2.1.0"
}