Compare commits

...

10 Commits

14 changed files with 381 additions and 119 deletions

View File

@ -1,3 +1,14 @@
2.2 - 2023.07.30
* require Dotclear 2.27
* require PHP 7.4+
* use new svg icon
* update to Dotclear 2.27-dev
2.1 - 2023.05.13
* require Dotclear 2.26
* fix nullsafe warnings
* add plugin Uninstaller features
2.0 - 2023.04.11
* require Dotclear 2.26
* use namespace

View File

@ -3,7 +3,7 @@
[![Release](https://img.shields.io/github/v/release/JcDenis/arlequin)](https://github.com/JcDenis/arlequin/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/arlequin)](https://github.com/JcDenis/arlequin/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/arlequin)](https://github.com/JcDenis/arlequin/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/arlequin)
[![License](https://img.shields.io/github/license/JcDenis/arlequin)](https://github.com/JcDenis/arlequin/blob/master/LICENSE)
@ -19,7 +19,8 @@ It allows visitors to select a theme on your blog.
_arlequin_ requires:
* content admin permissions to manage theme and public menu
* Dotclear 2.26
* Dotclear 2.27
* PHP 7.4+
## USAGE

View File

@ -18,11 +18,11 @@ $this->registerModule(
'Arlequin',
'Allows visitors choose a theme',
'Oleksandr Syenchuk, Pierre Van Glabeke and contributors',
'2.0',
'2.2',
[
'requires' => [['core', '2.26']],
'requires' => [['core', '2.27']],
'permissions' => dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_CONTENT_ADMIN,
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]),
'type' => 'plugin',
'support' => 'http://forum.dotclear.org/viewtopic.php?id=48345',

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="arlequin">
<name>Arlequin</name>
<version>2.0</version>
<version>2.2</version>
<author>Oleksandr Syenchuk, Pierre Van Glabeke and contributors</author>
<desc>Allows visitors choose a theme</desc>
<file>https://github.com/JcDenis/arlequin/releases/download/v2.0/plugin-arlequin.zip</file>
<da:dcmin>2.26</da:dcmin>
<file>https://github.com/JcDenis/arlequin/releases/download/v2.2/plugin-arlequin.zip</file>
<da:dcmin>2.27</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/arlequin</da:details>
<da:support>http://forum.dotclear.org/viewtopic.php?id=48345</da:support>
</module>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

111
icon-dark.svg 100644
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg
height="251px"
width="251px"
version="1.1"
id="_x32_"
viewBox="0 0 512 512"
xml:space="preserve"
fill="#000000"
stroke="#000000"
sodipodi:docname="icon-dark.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs26"> <style
type="text/css"
id="style4"> .st0{fill:#000000;} </style> </defs><sodipodi:namedview
id="namedview24"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="2.2310757"
inkscape:cx="125.94821"
inkscape:cy="125.5"
inkscape:window-width="1920"
inkscape:window-height="1012"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="_x32_" />
<g
id="SVGRepo_bgCarrier"
stroke-width="0" />
<g
id="SVGRepo_tracerCarrier"
stroke-linecap="round"
stroke-linejoin="round" />
<g
id="g20"
style="fill:#b3b3b3;fill-opacity:1;stroke:none"> <path
class="st0"
d="M 468.277,116.662 C 440.675,75.816 401.617,43.377 355.661,23.934 325.023,10.979 291.311,3.812 256.007,3.812 c -35.303,0 -68.914,7.166 -99.421,20.135 C 126.079,36.917 98.675,55.667 75.642,78.823 29.582,125.11 0.966,189.104 0.014,259.601 v 0.013 C 0.007,260.484 0,261.354 0,262.21 c 0,18.834 2.796,34.96 7.865,48.553 5.056,13.585 12.442,24.608 21.286,32.857 5.892,5.508 12.407,9.77 19.176,12.812 9.037,4.056 18.491,5.946 27.658,5.946 8.187,0 16.147,-1.493 23.485,-4.384 7.331,-2.898 14.065,-7.2 19.587,-12.921 14.641,-15.181 35.708,-24.334 59.042,-24.341 17.401,0.007 33.44,5.262 46.826,14.298 13.373,9.03 24.019,21.854 30.363,36.865 4.234,10.016 6.577,20.998 6.577,32.603 0.007,4.679 -0.753,9.551 -1.966,14.894 -1.192,5.33 -2.843,11.071 -4.281,17.415 -1.35,5.988 -2.014,11.722 -2.014,17.196 -0.028,10.125 2.37,19.388 6.694,27.061 4.302,7.694 10.406,13.654 17.072,17.867 4.446,2.822 9.153,4.905 13.914,6.385 6.351,1.96 12.798,2.864 19.053,2.871 5.857,-0.007 11.564,-0.788 16.976,-2.46 52.951,-16.387 99.058,-48.594 132.012,-91.364 32.946,-42.75 52.69,-96.215 52.677,-154.558 0.011,-52.964 -16.13,-102.298 -43.725,-143.143 z M 435.803,396.25 c -29.157,37.872 -70.167,66.564 -117.261,81.129 -2.165,0.671 -5.076,1.137 -8.207,1.124 -3.775,0.013 -7.852,-0.644 -11.483,-1.946 -3.652,-1.294 -6.816,-3.192 -9.235,-5.549 -1.616,-1.576 -2.932,-3.357 -3.98,-5.508 -1.384,-2.878 -2.343,-6.482 -2.357,-11.496 0,-3.042 0.37,-6.584 1.295,-10.674 1.164,-5.214 2.822,-10.975 4.281,-17.408 1.446,-6.427 2.686,-13.565 2.686,-21.424 0.006,-23.443 -7.153,-45.353 -19.382,-63.439 -12.229,-18.1 -29.52,-32.467 -49.902,-41.086 -13.579,-5.748 -28.541,-8.926 -44.161,-8.926 -31.124,0 -60.014,12.277 -80.403,33.418 -2.274,2.357 -5.378,4.44 -9.118,5.92 -3.727,1.466 -8.057,2.316 -12.592,2.316 -5.714,0 -11.715,-1.329 -17.402,-4.268 -5.686,-2.953 -11.133,-7.475 -15.867,-14.312 -3.151,-4.563 -5.981,-10.167 -8.2,-17.073 -2.967,-9.194 -4.837,-20.703 -4.837,-34.837 0,-0.733 0.007,-1.472 0.014,-2.213 v 0.007 c 0.637,-47.012 15.072,-90.563 39.44,-126.73 24.382,-36.159 58.699,-64.858 99.065,-82.012 26.917,-11.442 56.521,-17.771 87.809,-17.771 46.922,0.007 90.385,14.236 126.524,38.639 36.132,24.403 64.844,58.994 82.013,99.585 11.448,27.068 17.778,56.802 17.778,88.09 -0.013,51.622 -17.36,98.558 -46.518,136.444 z"
id="path6"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 392.273,296.061 c -6.221,-2.631 -13.086,-4.09 -20.225,-4.09 -10.708,-0.007 -20.772,3.282 -29.048,8.886 -8.282,5.59 -14.846,13.496 -18.799,22.834 -2.637,6.22 -4.09,13.085 -4.09,20.217 -0.007,10.715 3.282,20.779 8.879,29.048 5.597,8.29 13.503,14.852 22.841,18.806 6.22,2.638 13.085,4.09 20.217,4.09 10.716,0 20.78,-3.281 29.055,-8.879 8.276,-5.604 14.846,-13.503 18.799,-22.841 2.638,-6.221 4.09,-13.085 4.09,-20.224 0.007,-10.708 -3.281,-20.772 -8.878,-29.048 -5.598,-8.276 -13.504,-14.853 -22.841,-18.799 z m 1.321,62.357 c -2.802,4.152 -6.796,7.467 -11.44,9.427 -3.097,1.302 -6.482,2.028 -10.106,2.035 -5.418,-0.007 -10.345,-1.624 -14.503,-4.433 -4.152,-2.795 -7.468,-6.789 -9.427,-11.434 -1.308,-3.096 -2.034,-6.482 -2.034,-10.106 0.006,-5.419 1.623,-10.345 4.425,-14.51 2.802,-4.152 6.796,-7.454 11.441,-9.42 3.097,-1.308 6.481,-2.034 10.098,-2.034 5.426,0.006 10.352,1.63 14.518,4.426 4.145,2.809 7.461,6.796 9.42,11.441 1.309,3.097 2.035,6.481 2.035,10.098 -0.007,5.426 -1.625,10.352 -4.427,14.51 z"
id="path8"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 126.462,175.094 c -20.998,0 -38.022,17.024 -38.022,38.03 0,20.991 17.024,38.023 38.022,38.023 21.005,0 38.03,-17.032 38.03,-38.023 0,-21.006 -17.025,-38.03 -38.03,-38.03 z"
id="path10"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 193.245,100.274 c -18.265,0 -33.076,14.812 -33.076,33.077 0,18.271 14.812,33.083 33.076,33.083 18.271,0 33.084,-14.812 33.084,-33.083 0,-18.265 -14.813,-33.077 -33.084,-33.077 z"
id="path12"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 288.782,90.382 c -16.387,0 -29.679,13.29 -29.679,29.678 0,16.388 13.292,29.679 29.679,29.679 16.387,0 29.678,-13.291 29.678,-29.679 0,-16.388 -13.291,-29.678 -29.678,-29.678 z"
id="path14"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 361.745,190.392 c 14.599,0 26.431,-11.838 26.431,-26.431 0,-14.599 -11.832,-26.431 -26.431,-26.431 -14.6,0 -26.431,11.832 -26.431,26.431 0,14.592 11.831,26.431 26.431,26.431 z"
id="path16"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 376.933,233.834 c 0,11.42 9.262,20.669 20.676,20.669 11.42,0 20.676,-9.249 20.676,-20.669 0,-11.42 -9.256,-20.67 -20.676,-20.67 -11.414,0 -20.676,9.25 -20.676,20.67 z"
id="path18"
style="fill:#b3b3b3;fill-opacity:1;stroke:none" /> </g>
<ellipse
style="fill:#c44d58;fill-opacity:1;stroke:none;stroke-width:24.5003;stroke-linejoin:round;paint-order:stroke fill markers"
id="path912"
cx="194.98715"
cy="133.4313"
rx="34.984379"
ry="35.986645" /><ellipse
style="fill:#167bba;fill-opacity:1;stroke:none;stroke-width:15.7843;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1132"
cx="131.52965"
cy="214.50272"
rx="45.028"
ry="45.502174" /><ellipse
style="fill:#88c200;fill-opacity:1;stroke:none;stroke-width:17.9477;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1254"
cx="289.29623"
cy="120.40321"
rx="30.856529"
ry="30.494711" /><ellipse
style="fill:#8fcceb;fill-opacity:1;stroke:none;stroke-width:15.7843;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1376"
cx="361.8573"
cy="164.93533"
rx="29.181025"
ry="28.901239" /><ellipse
style="fill:#b3b3b3;fill-opacity:1;stroke:none;stroke-width:14.3749;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1498"
cx="399.90668"
cy="234.50626"
rx="23.863689"
ry="24.29674" /></svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

111
icon.svg 100644
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg
height="251px"
width="251px"
version="1.1"
id="_x32_"
viewBox="0 0 512 512"
xml:space="preserve"
fill="#000000"
stroke="#000000"
sodipodi:docname="icon.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs26"> <style
type="text/css"
id="style4"> .st0{fill:#000000;} </style> </defs><sodipodi:namedview
id="namedview24"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="2.2310757"
inkscape:cx="125.94821"
inkscape:cy="125.5"
inkscape:window-width="1920"
inkscape:window-height="1012"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="_x32_" />
<g
id="SVGRepo_bgCarrier"
stroke-width="0" />
<g
id="SVGRepo_tracerCarrier"
stroke-linecap="round"
stroke-linejoin="round" />
<g
id="g20"
style="fill:#676e78;fill-opacity:1;stroke:none"> <path
class="st0"
d="M 468.277,116.662 C 440.675,75.816 401.617,43.377 355.661,23.934 325.023,10.979 291.311,3.812 256.007,3.812 c -35.303,0 -68.914,7.166 -99.421,20.135 C 126.079,36.917 98.675,55.667 75.642,78.823 29.582,125.11 0.966,189.104 0.014,259.601 v 0.013 C 0.007,260.484 0,261.354 0,262.21 c 0,18.834 2.796,34.96 7.865,48.553 5.056,13.585 12.442,24.608 21.286,32.857 5.892,5.508 12.407,9.77 19.176,12.812 9.037,4.056 18.491,5.946 27.658,5.946 8.187,0 16.147,-1.493 23.485,-4.384 7.331,-2.898 14.065,-7.2 19.587,-12.921 14.641,-15.181 35.708,-24.334 59.042,-24.341 17.401,0.007 33.44,5.262 46.826,14.298 13.373,9.03 24.019,21.854 30.363,36.865 4.234,10.016 6.577,20.998 6.577,32.603 0.007,4.679 -0.753,9.551 -1.966,14.894 -1.192,5.33 -2.843,11.071 -4.281,17.415 -1.35,5.988 -2.014,11.722 -2.014,17.196 -0.028,10.125 2.37,19.388 6.694,27.061 4.302,7.694 10.406,13.654 17.072,17.867 4.446,2.822 9.153,4.905 13.914,6.385 6.351,1.96 12.798,2.864 19.053,2.871 5.857,-0.007 11.564,-0.788 16.976,-2.46 52.951,-16.387 99.058,-48.594 132.012,-91.364 32.946,-42.75 52.69,-96.215 52.677,-154.558 0.011,-52.964 -16.13,-102.298 -43.725,-143.143 z M 435.803,396.25 c -29.157,37.872 -70.167,66.564 -117.261,81.129 -2.165,0.671 -5.076,1.137 -8.207,1.124 -3.775,0.013 -7.852,-0.644 -11.483,-1.946 -3.652,-1.294 -6.816,-3.192 -9.235,-5.549 -1.616,-1.576 -2.932,-3.357 -3.98,-5.508 -1.384,-2.878 -2.343,-6.482 -2.357,-11.496 0,-3.042 0.37,-6.584 1.295,-10.674 1.164,-5.214 2.822,-10.975 4.281,-17.408 1.446,-6.427 2.686,-13.565 2.686,-21.424 0.006,-23.443 -7.153,-45.353 -19.382,-63.439 -12.229,-18.1 -29.52,-32.467 -49.902,-41.086 -13.579,-5.748 -28.541,-8.926 -44.161,-8.926 -31.124,0 -60.014,12.277 -80.403,33.418 -2.274,2.357 -5.378,4.44 -9.118,5.92 -3.727,1.466 -8.057,2.316 -12.592,2.316 -5.714,0 -11.715,-1.329 -17.402,-4.268 -5.686,-2.953 -11.133,-7.475 -15.867,-14.312 -3.151,-4.563 -5.981,-10.167 -8.2,-17.073 -2.967,-9.194 -4.837,-20.703 -4.837,-34.837 0,-0.733 0.007,-1.472 0.014,-2.213 v 0.007 c 0.637,-47.012 15.072,-90.563 39.44,-126.73 24.382,-36.159 58.699,-64.858 99.065,-82.012 26.917,-11.442 56.521,-17.771 87.809,-17.771 46.922,0.007 90.385,14.236 126.524,38.639 36.132,24.403 64.844,58.994 82.013,99.585 11.448,27.068 17.778,56.802 17.778,88.09 -0.013,51.622 -17.36,98.558 -46.518,136.444 z"
id="path6"
style="fill:#676e78;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 392.273,296.061 c -6.221,-2.631 -13.086,-4.09 -20.225,-4.09 -10.708,-0.007 -20.772,3.282 -29.048,8.886 -8.282,5.59 -14.846,13.496 -18.799,22.834 -2.637,6.22 -4.09,13.085 -4.09,20.217 -0.007,10.715 3.282,20.779 8.879,29.048 5.597,8.29 13.503,14.852 22.841,18.806 6.22,2.638 13.085,4.09 20.217,4.09 10.716,0 20.78,-3.281 29.055,-8.879 8.276,-5.604 14.846,-13.503 18.799,-22.841 2.638,-6.221 4.09,-13.085 4.09,-20.224 0.007,-10.708 -3.281,-20.772 -8.878,-29.048 -5.598,-8.276 -13.504,-14.853 -22.841,-18.799 z m 1.321,62.357 c -2.802,4.152 -6.796,7.467 -11.44,9.427 -3.097,1.302 -6.482,2.028 -10.106,2.035 -5.418,-0.007 -10.345,-1.624 -14.503,-4.433 -4.152,-2.795 -7.468,-6.789 -9.427,-11.434 -1.308,-3.096 -2.034,-6.482 -2.034,-10.106 0.006,-5.419 1.623,-10.345 4.425,-14.51 2.802,-4.152 6.796,-7.454 11.441,-9.42 3.097,-1.308 6.481,-2.034 10.098,-2.034 5.426,0.006 10.352,1.63 14.518,4.426 4.145,2.809 7.461,6.796 9.42,11.441 1.309,3.097 2.035,6.481 2.035,10.098 -0.007,5.426 -1.625,10.352 -4.427,14.51 z"
id="path8"
style="fill:#676e78;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 126.462,175.094 c -20.998,0 -38.022,17.024 -38.022,38.03 0,20.991 17.024,38.023 38.022,38.023 21.005,0 38.03,-17.032 38.03,-38.023 0,-21.006 -17.025,-38.03 -38.03,-38.03 z"
id="path10"
style="fill:#676e78;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 193.245,100.274 c -18.265,0 -33.076,14.812 -33.076,33.077 0,18.271 14.812,33.083 33.076,33.083 18.271,0 33.084,-14.812 33.084,-33.083 0,-18.265 -14.813,-33.077 -33.084,-33.077 z"
id="path12"
style="fill:#676e78;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 288.782,90.382 c -16.387,0 -29.679,13.29 -29.679,29.678 0,16.388 13.292,29.679 29.679,29.679 16.387,0 29.678,-13.291 29.678,-29.679 0,-16.388 -13.291,-29.678 -29.678,-29.678 z"
id="path14"
style="fill:#676e78;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 361.745,190.392 c 14.599,0 26.431,-11.838 26.431,-26.431 0,-14.599 -11.832,-26.431 -26.431,-26.431 -14.6,0 -26.431,11.832 -26.431,26.431 0,14.592 11.831,26.431 26.431,26.431 z"
id="path16"
style="fill:#676e78;fill-opacity:1;stroke:none" /> <path
class="st0"
d="m 376.933,233.834 c 0,11.42 9.262,20.669 20.676,20.669 11.42,0 20.676,-9.249 20.676,-20.669 0,-11.42 -9.256,-20.67 -20.676,-20.67 -11.414,0 -20.676,9.25 -20.676,20.67 z"
id="path18"
style="fill:#676e78;fill-opacity:1;stroke:none" /> </g>
<ellipse
style="fill:#c44d58;fill-opacity:1;stroke:none;stroke-width:24.5003;stroke-linejoin:round;paint-order:stroke fill markers"
id="path912"
cx="194.98715"
cy="133.4313"
rx="34.984379"
ry="35.986645" /><ellipse
style="fill:#167bba;fill-opacity:1;stroke:none;stroke-width:15.7843;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1132"
cx="131.52965"
cy="214.50272"
rx="45.028"
ry="45.502174" /><ellipse
style="fill:#88c200;fill-opacity:1;stroke:none;stroke-width:17.9477;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1254"
cx="289.29623"
cy="120.40321"
rx="30.856529"
ry="30.494711" /><ellipse
style="fill:#8fcceb;fill-opacity:1;stroke:none;stroke-width:15.7843;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1376"
cx="361.8573"
cy="164.93533"
rx="29.181025"
ry="28.901239" /><ellipse
style="fill:#b3b3b3;fill-opacity:1;stroke:none;stroke-width:14.3749;stroke-linejoin:round;paint-order:stroke fill markers"
id="path1498"
cx="399.90668"
cy="234.50626"
rx="23.863689"
ry="24.29674" /></svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -14,51 +14,35 @@ declare(strict_types=1);
namespace Dotclear\Plugin\arlequin;
use dcAdmin;
use dcCore;
use dcFavorites;
use dcNsProcess;
use dcPage;
use Dotclear\Core\Process;
use Dotclear\Core\Backend\{
Favorites,
Menus
};
class Backend extends dcNsProcess
class Backend extends Process
{
public static function init(): bool
{
static::$init = defined('DC_CONTEXT_ADMIN')
&& My::phpCompliant()
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id);
return static::$init;
return self::status(My::checkContext(My::BACKEND));
}
public static function process(): bool
{
if (!static::$init) {
if (!self::status()) {
return false;
}
dcCore::app()->menu[dcAdmin::MENU_BLOG]->addItem(
My::name(),
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
dcPage::getPF(My::id() . '/icon.png'),
preg_match(
'/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/',
$_SERVER['REQUEST_URI']
),
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id)
);
My::addBackendMenuItem(Menus::MENU_BLOG);
dcCore::app()->addBehaviors([
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
$favs->register(My::id(), [
'title' => My::name(),
'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
'small-icon' => dcPage::getPF(My::id() . '/icon.png'),
'large-icon' => dcPage::getPF(My::id() . '/icon-big.png'),
'url' => My::manageUrl(),
'small-icon' => My::icons(),
'large-icon' => My::icons(),
'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]),

View File

@ -15,24 +15,22 @@ declare(strict_types=1);
namespace Dotclear\Plugin\arlequin;
use dcCore;
use dcNsProcess;
use Dotclear\Core\Process;
use Dotclear\Helper\Network\Http;
class Frontend extends dcNsProcess
class Frontend extends Process
{
public const COOKIE_THEME_PREFIX = 'dc_theme_';
public const COOKIE_UPDDT_PREFIX = 'dc_user_upddt_';
public static function init(): bool
{
static::$init = true;
return static::$init;
return self::status(My::checkContext(My::FRONTEND));
}
public static function process(): bool
{
if (!static::$init) {
if (!self::status()) {
return false;
}
@ -43,8 +41,7 @@ class Frontend extends dcNsProcess
# Redirect if needed
if (isset($_GET['theme'])) {
$p = '/(\?|&)theme(=.*)?$/';
Http::redirect(preg_replace($p, '', Http::getSelfURI()));
Http::redirect((string) preg_replace('/(\?|&)theme(=.*)?$/', '', Http::getSelfURI()));
}
# Switch theme
@ -75,8 +72,8 @@ class Frontend extends dcNsProcess
public static function switchTheme(string $theme): void
{
if (dcCore::app()->blog->settings->get(My::id())->get('mt_exclude')) {
if (in_array($theme, explode('/', dcCore::app()->blog->settings->get(My::id())->get('mt_exclude')))) {
if (My::settings()->get('mt_exclude')) {
if (in_array($theme, explode('/', My::settings()->get('mt_exclude')))) {
return;
}
}

View File

@ -16,8 +16,11 @@ namespace Dotclear\Plugin\arlequin;
use ArrayObject;
use dcCore;
use dcNsProcess;
use dcPage;
use Dotclear\Core\Process;
use Dotclear\Core\Backend\{
Notices,
Page
};
use Dotclear\Helper\Html\Form\{
Div,
Form,
@ -32,27 +35,21 @@ use Dotclear\Helper\Html\Form\{
use Dotclear\Helper\Html\Html;
use Exception;
class Manage extends dcNsProcess
class Manage extends Process
{
public static function init(): bool
{
static::$init = defined('DC_CONTEXT_ADMIN')
&& My::phpCompliant()
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id);
return static::$init;
return self::status(My::checkContext(My::MANAGE));
}
public static function process(): bool
{
if (!static::$init) {
if (!self::status()) {
return false;
}
try {
$s = dcCore::app()->blog->settings->get(My::id());
$s = My::settings();
$model = json_decode((string) $s->get('model'), true);
$exclude = $s->get('exclude');
@ -64,7 +61,7 @@ class Manage extends dcNsProcess
$s->put('model', json_encode($model), 'string', 'Arlequin configuration');
$s->put('exclude', 'customCSS', 'string', 'Excluded themes');
dcPage::AddSuccessNotice(__('Settings have been reinitialized.'));
Notices::AddSuccessNotice(__('Settings have been reinitialized.'));
dcCore::app()->blog->triggerBlog();
}
@ -81,9 +78,9 @@ class Manage extends dcNsProcess
$s->put('model', json_encode($model));
$s->put('exclude', $exclude);
dcPage::AddSuccessNotice(__('System settings have been updated.'));
Notices::AddSuccessNotice(__('System settings have been updated.'));
dcCore::app()->blog->triggerBlog();
dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), ['config' => 1]);
My::redirect(['config' => 1]);
}
// restore settings
@ -91,9 +88,9 @@ class Manage extends dcNsProcess
$s->drop('model');
$s->drop('exclude');
dcPage::AddSuccessNotice(__('Settings have been reinitialized.'));
Notices::AddSuccessNotice(__('Settings have been reinitialized.'));
dcCore::app()->blog->triggerBlog();
dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), ['restore' => 1]);
My::redirect(['restore' => 1]);
}
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
@ -104,7 +101,7 @@ class Manage extends dcNsProcess
public static function render(): void
{
if (!static::$init) {
if (!self::status()) {
return;
}
@ -113,11 +110,13 @@ class Manage extends dcNsProcess
dcCore::app()->callBehavior('arlequinAddModels', $models);
$models = iterator_to_array($models);
$s = dcCore::app()->blog->settings->get(My::id());
$s = My::settings();
$model = json_decode((string) $s->get('model'), true);
$model = array_merge(My::defaultModel(), is_array($model) ? $model : []);
$header = '';
foreach ($models as $m) {
$m = array_merge(My::defaultModel(), $m);
$header .= "\t" .
'arlequin.addModel(' .
'"' . Html::escapeJS($m['name']) . '",' .
@ -127,9 +126,9 @@ class Manage extends dcNsProcess
");\n";
}
dcPage::openModule(
Page::openModule(
My::name(),
dcPage::jsModuleLoad(My::id() . '/js/models.js') . '
Page::jsLoad('models') . '
<script type="text/javascript">
//<![CDATA[
arlequin.msg.predefined_models = "' . Html::escapeJS(__('Predefined models')) . '";
@ -144,13 +143,13 @@ class Manage extends dcNsProcess
);
echo
dcPage::breadcrumb([
Page::breadcrumb([
Html::escapeHTML(dcCore::app()->blog->name) => '',
My::name() => '',
]) .
dcPage::notices() .
Notices::getNotices() .
(new Form(My::id() . 'form'))->method('post')->action(dcCore::app()->adminurl->get('admin.plugin.' . My::id()))->fields([
(new Form(My::id() . 'form'))->method('post')->action(dcCore::app()->admin->getPageURL())->fields([
(new Text('h4', __('Switcher display format'))),
(new Div())->id('models'),
(new Div())->class('two-boxes odd')->items([
@ -177,13 +176,13 @@ class Manage extends dcNsProcess
(new Note())->class('form-note')->text('Semicolon separated list of themes IDs (theme folder name). Ex: ductile;berlin'),
]),
(new Para())->separator(' ')->items([
dcCore::app()->formNonce(false),
(new Submit(['mt_action_config']))->value(__('Save')),
(new Submit(['mt_action_restore']))->value(__('Restore defaults')),
... My::hiddenFields(),
]),
])->render();
dcPage::helpBlock('arlequin');
dcPage::closeModule();
Page::helpBlock('arlequin');
Page::closeModule();
}
}

View File

@ -15,37 +15,20 @@ declare(strict_types=1);
namespace Dotclear\Plugin\arlequin;
use dcCore;
use Dotclear\Module\MyPlugin;
/**
* Plugin definitions.
* This module definitions.
*/
class My
class My extends MyPlugin
{
/** @var string Required php version */
public const PHP_MIN = '7.4';
/**
* This module id.
*/
public static function id(): string
public static function checkCustomContext(int $context): ?bool
{
return basename(dirname(__DIR__));
}
/**
* This module name.
*/
public static function name(): string
{
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
}
/**
* Check php version.
*/
public static function phpCompliant(): bool
{
return version_compare(phpversion(), self::PHP_MIN, '>=');
return !in_array($context, [My::BACKEND, My::MANAGE, My::MENU]) ? null :
defined('DC_CONTEXT_ADMIN')
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id);
}
/**
@ -85,6 +68,7 @@ class My
public static function defaultModel(): array
{
return [
'name' => __('Default'),
'e_html' => '<li><a href="%1$s%2$s%3$s">%4$s</a></li>',
'a_html' => '<li><strong>%4$s</strong></li>',
's_html' => '<ul>%2$s</ul>',

70
src/Uninstall.php 100644
View File

@ -0,0 +1,70 @@
<?php
/**
* @brief arlequin, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Oleksandr Syenchuk, Pierre Van Glabeke and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\arlequin;
use dcCore;
use Dotclear\Core\Process;
use Dotclear\Plugin\Uninstaller\Uninstaller;
class Uninstall extends Process
{
public static function init(): bool
{
return self::status(My::checkContext(My::UNINSTALL));
}
public static function process(): bool
{
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
return false;
}
Uninstaller::instance()
->addUserAction(
'settings',
'delete_all',
My::id()
)
->addUserAction(
'plugins',
'delete',
My::id()
)
->addUserAction(
'versions',
'delete',
My::id()
)
->addDirectAction(
'settings',
'delete_all',
My::id()
)
->addDirectAction(
'plugins',
'delete',
My::id()
)
->addDirectAction(
'versions',
'delete',
My::id()
)
;
// no custom action
return false;
}
}

View File

@ -45,9 +45,10 @@ class Widgets
return '';
}
$model = json_decode((string) dcCore::app()->blog->settings->get(My::id())->get('model'), true);
$names = self::getNames();
if (!is_array($model) || empty($names)) {
$model = json_decode((string) My::settings()->get('model'), true);
$exclude = explode(';', (string) My::settings()->get('exclude'));
$modules = array_diff_key(dcCore::app()->themes->getDefines(['state' => dcModuleDefine::STATE_ENABLED], true), array_flip($exclude));
if (!is_array($model) || empty($modules)) {
return '';
}
@ -68,8 +69,8 @@ class Widgets
}
$res = '';
foreach ($names as $k => $v) {
if ($k == dcCore::app()->public->theme) {
foreach ($modules as $id => $module) {
if ($id == dcCore::app()->public->theme) {
$format = $model['a_html'];
} else {
$format = $model['e_html'];
@ -78,21 +79,21 @@ class Widgets
if ($replace) {
$e_url = preg_replace(
'/(\\?|&)(theme\\=)([^&]*)/',
'$1${2}' . addcslashes($k, '$\\'),
$e_url
'$1${2}' . addcslashes($id, '$\\'),
(string) $e_url
);
$val = '';
} else {
$val = Html::escapeHTML(rawurlencode($k));
$val = Html::escapeHTML(rawurlencode($id));
}
$res .= sprintf(
$format,
$e_url,
$ext,
$val,
Html::escapeHTML($v['name']),
Html::escapeHTML($v['desc']),
Html::escapeHTML($k)
Html::escapeHTML($module['name']),
Html::escapeHTML($module['desc']),
Html::escapeHTML($id)
);
}
@ -108,11 +109,4 @@ class Widgets
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') . sprintf($model['s_html'], $s_url, $res)
);
}
public static function getNames(): array
{
$exclude = explode(';', (string) dcCore::app()->blog->settings->get(My::id())->get('exclude'));
return array_diff_key(dcCore::app()->themes->getDefines(['state' => dcModuleDefine::STATE_ENABLED], true), array_flip($exclude));
}
}