Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions inc/cleantalk-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Cleantalk\ApbctWP\CleantalkSettingsTemplates;
use Cleantalk\ApbctWP\ContactsEncoder\ContactsEncoder;
use Cleantalk\ApbctWP\Escape;
use Cleantalk\ApbctWP\UpdateChangelogNotice;
use Cleantalk\ApbctWP\Variables\Get;
use Cleantalk\ApbctWP\Variables\Post;
use Cleantalk\ApbctWP\Variables\Server;
Expand Down Expand Up @@ -35,6 +36,7 @@
add_action('comment_spam_to_unapproved', 'apbct_comment__remove_meta_approved', 10, 1);
add_action('comment_trash_to_unapproved', 'apbct_comment__remove_meta_approved', 10, 1);

UpdateChangelogNotice::register();
/**
* Crunch for Anti-Bot
* Hooked by 'admin_head'
Expand Down
24 changes: 23 additions & 1 deletion lib/Cleantalk/ApbctWP/Escape.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public static function escKses($string, $allowed_html, $allowed_protocols = arra
{
add_filter('safe_style_css', function ($styles) {
$styles[] = 'display';
$styles[] = 'list-style';
$styles[] = 'list-style-type';
Comment thread
alexandergull marked this conversation as resolved.
return $styles;
});

Expand Down Expand Up @@ -236,7 +238,27 @@ public static function escKsesPreset($string, $preset = null, $_allowed_protocol
'b' => array(
'style' => true,
),
)
),
'apbct_update_changelog_notice' => array(
'details' => array(
'open' => true,
),
'summary' => array(),
'ul' => array(
'style' => true,
),
'ol' => array(
'style' => true,
),
'li' => array(),
//'p' => array(),
'br' => array(),
'strong' => array(),
'b' => array(),
'em' => array(),
'i' => array(),
'code' => array(),
),
);

if ( !empty($kses_presets[$preset]) ) {
Expand Down
64 changes: 64 additions & 0 deletions lib/Cleantalk/ApbctWP/UpdateChangelogNotice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace Cleantalk\ApbctWP;

use Cleantalk\Common\AbstractUpdateChangelogNotice;

/**
* Shows the changelog of the pending Security by CleanTalk update
* on the plugins list page. Uses native WordPress admin markup only.
*/
class UpdateChangelogNotice extends AbstractUpdateChangelogNotice
{
/**
* @inheritDoc
*/
protected function getPluginFile()
{
return APBCT_PLUGIN_BASE_NAME;
}

/**
* @inheritDoc
*/
protected function getSlug()
{
return 'cleantalk-spam-protect';
}

/**
* @inheritDoc
*/
protected function getGithubRepo()
{
return 'CleanTalk/wordpress-antispam';
}

/**
* @inheritDoc
*/
protected function escapeChangelogHtml($html)
{
return Escape::escKsesPreset($html, 'apbct_update_changelog_notice');
}

/**
* @inheritDoc
*
* The markup is placed outside the message paragraph, so the native notice
* icon is not duplicated.
*/
protected function getNoticeHtml($version, $changelog_html)
{
return sprintf(
'<details open>'
. '<summary><strong>%s</strong></summary>'
. '%s'
. '</details>',
esc_html(
__('A few useful tweaks in the new version', 'cleantalk-spam-protect')
),
$changelog_html
);
}
}
Loading
Loading