Compare commits

...

8 commits
v0.3 ... master

Author SHA1 Message Date
JcDenis
9a3ae92f84 Update dcstore.xml 2025-01-11 12:18:29 +00:00
621c94b456
release 0.5 2025-01-11 13:17:41 +01:00
c254545abf
move subscriber stuff to another plugin 2025-01-11 13:17:20 +01:00
JcDenis
e3715cbf2a Update dcstore.xml 2025-01-11 09:45:23 +00:00
bfa4de7b59
release 0.4 2025-01-11 10:44:37 +01:00
793f7e3ae3
change levels 2025-01-11 10:42:18 +01:00
2ce94d046b
code doc 2025-01-11 10:41:36 +01:00
96ca889265
fix typo 2025-01-11 09:18:17 +01:00
5 changed files with 24 additions and 44 deletions

View file

@ -15,3 +15,15 @@ Proofreading 0.3 - 2025.01.09
* Require Dotclear 2.33
* Require PHP 8.1
* Add 1 post status and 1 user permission
Proofreading 0.4 - 2025.01.11
===========================================================
* Require Dotclear 2.33
* Require PHP 8.1
* Change status levels
Proofreading 0.5 - 2025.01.11
===========================================================
* Require Dotclear 2.33
* Require PHP 8.1
* Remove subscriber stuff (now to plugin RestrictedReading)

View file

@ -17,7 +17,7 @@ $this->registerModule(
'Proofreading',
'Add proofreading statuses for your posts',
'Jean-Christian Denis and Contributors',
'0.3',
'0.5',
[
'requires' => [['core', '2.33']],
'permissions' => 'My',

View file

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="Proofreading">
<name>Proofreading</name>
<version>0.3</version>
<version>0.5</version>
<author>Jean-Christian Paul Denis and contributors</author>
<desc>Add proofreading statuses for your posts.</desc>
<file>https://github.com/JcDenis/Proofreading/releases/download/v0.3/plugin-Proofreading.zip</file>
<file>https://github.com/JcDenis/Proofreading/releases/download/v0.5/plugin-Proofreading.zip</file>
<da:dcmin>2.33</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/Proofreading/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/Proofreading/issues</da:support>

View file

@ -21,9 +21,7 @@ use Dotclear\Module\MyPlugin;
*/
class My extends MyPlugin
{
public const PERMISSION_SUBSCRIBER = 'subscriber';
public const POST_SUBSCRIBED = -200;
public const POST_READY = -100;
public const POST_PROOFREAD = -110;
public const POST_DRAFT = -120;
public const POST_READY = -111;
public const POST_PROOFREAD = -112;
public const POST_DRAFT = -113;
}

View file

@ -29,49 +29,19 @@ class Prepend extends Process
return false;
}
// subscirber permission
App::auth()->setPermissionType(My::PERMISSION_SUBSCRIBER, __('Posts subscriber'));
// posts status
$status =
// Add post status
return
// Add "Draft" post status, used on backend only.
App::status()->post()->set(
(new Status(My::POST_DRAFT , My::id() . 'draft', 'Draft', 'Draft (>1)', My::fileURL('img/draft.svg'))),
)
// Add "To proofread" post status, used on backend only.
&& App::status()->post()->set(
(new Status(My::POST_PROOFREAD , My::id() . 'proofread', 'To proofread', 'To proofread (>1)', My::fileURL('img/proofread.svg'))),
)
// Add "Fulfilled" post status, used on backend only.
&& App::status()->post()->set(
(new Status(My::POST_READY , My::id() . 'ready', 'Fulfilled', 'Fulfilled (>1)', My::fileURL('img/ready.svg'))),
)
&& App::status()->post()->set(
(new Status(My::POST_SUBSCRIBED , My::id() . 'subscriber', 'Subscription', 'Subscription (>1)', My::fileURL('img/subscriber.svg'))),
);
// tweak frontend
if ($status) {
App::behavior()->addBehaviors([
'coreBlogBeforeGetPostsAddingParameters' => self::getPosts(...),
]);
}
return $status;
}
/**
* @param array<string, mixed>|ArrayObject<string, mixed> $params Parameters
*/
public static function getPosts(ArrayObject $params, string|null $arg = null): void
{
if (App::task()->checkContext('FRONTEND') && App::auth()->check(My::PERMISSION_SUBSCRIBER, App::blog()->id()) === true) {
if (!isset($params['psot_status'])) {
$params['post_status'] = [];
}
if (!is_array($params['post_status'])) {
$params['post_status'] = [$params['post_status']];
}
//$params['post_status'][] = App::status()->post()::PUBLISHED;
$params['post_status'][] = My::POST_SUBSCRIBED;
}
}
}