Skip to content

Commit d2609cf

Browse files
Merge pull request #704 from CleanTalk/beta
6.70. Final merge.
2 parents 7afc533 + cbdfcde commit d2609cf

File tree

46 files changed

+2295
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2295
-246
lines changed

.7zignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
node_modules/
2+
vendor/
3+
js/prebuild/
4+
js/src/
5+
css/src/
6+
tests/
7+
package.json
8+
package-lock.json
9+
gulpfile.js
10+
README.md
11+
LICENSE
12+
psalm.xml
13+
composer.json
14+
composer.lock
15+
.*
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Check for library changes on PR Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches:
7+
- dev
8+
- master
9+
10+
env: # environment variables (available in any part of the action)
11+
PHP_VERSION: 7.4
12+
13+
jobs:
14+
notify:
15+
if: github.event.pull_request.merged == true
16+
runs-on: ubuntu-22.04
17+
18+
steps:
19+
- name: Set up PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ env.PHP_VERSION }}
23+
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install Dependencies
30+
run: composer i
31+
32+
- name: Check for library changes
33+
id: check-libraries
34+
run: |
35+
CHANGED_FILES=$(git status --porcelain | grep -v '^??' | awk '{print $2}' | grep -v '^composer\.lock$' || true)
36+
37+
if [ -z "$CHANGED_FILES" ]; then
38+
echo "No library changes detected in vendor/"
39+
echo "has_changes=false" >> $GITHUB_OUTPUT
40+
else
41+
echo "Library changes detected in vendor/ after merge!"
42+
43+
HTML_LIST=$(echo "$CHANGED_FILES" | sed 's/^/<li>/;s/$/<\/li>/')
44+
echo "html_list<<EOF" >> $GITHUB_OUTPUT
45+
echo "<ul>$HTML_LIST</ul>" >> $GITHUB_OUTPUT
46+
echo "EOF" >> $GITHUB_OUTPUT
47+
48+
echo "has_changes=true" >> $GITHUB_OUTPUT
49+
fi
50+
51+
- name: Send notification to Matrix
52+
if: steps.check-libraries.outputs.has_changes == 'true'
53+
uses: Glomberg/matrix-messenger-action@master
54+
with:
55+
server: ${{ secrets.MATRIX_SERVER }}
56+
to: ${{ secrets.MATRIX_EXTERNSION_ROOM }}
57+
token: ${{ secrets.MATRIX_USER_TOKEN }}
58+
message: |
59+
📦 <strong>Library Changes Detected After PR Merge!</strong>
60+
61+
Repository: <strong>${{ github.repository }}</strong>
62+
PR #${{ github.event.pull_request.number }} merged by: <strong>${{ github.event.pull_request.merged_by.login }}</strong>
63+
<br>Title: ${{ github.event.pull_request.title }}
64+
65+
<br>⚠️ Libraries may not be up-to-date.
66+
67+
<br><strong>Changed files in vendor/:</strong>
68+
${{ steps.check-libraries.outputs.html_list }}
69+
70+
<a href="${{ github.event.pull_request.html_url }}">View Pull Request</a>

.github/workflows/dev-fix-zip.yml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,37 @@ jobs:
2323
- name: Set plugin name
2424
run: echo "PLUGIN_NAME=cleantalk-spam-protect" >> $GITHUB_ENV
2525

26-
- name: Create .7zignore
26+
- name: Check if .7zignore exists
27+
id: check_ignore
2728
run: |
28-
echo "node_modules" > .7zignore
29-
echo "package.json" >> .7zignore
30-
echo "package-lock.json" >> .7zignore
31-
echo "gulpfile.js" >> .7zignore
32-
echo "tests" >> .7zignore
33-
echo "README.md" >> .7zignore
34-
echo "LICENSE" >> .7zignore
35-
echo "psalm.xml" >> .7zignore
36-
echo "composer.json" >> .7zignore
37-
echo "composer.lock" >> .7zignore
38-
echo "vendor" >> .7zignore
39-
echo "js/prebuild" >> .7zignore
40-
echo "js/src" >> .7zignore
41-
echo "css/src" >> .7zignore
42-
echo ".*" >> .7zignore
29+
if [ -f ".7zignore" ]; then
30+
echo "Using existing .7zignore file"
31+
echo "ignore_exists=true" >> $GITHUB_OUTPUT
32+
else
33+
echo "::warning::.7zignore file not found, creating default one"
34+
echo "ignore_exists=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Create default .7zignore if missing
38+
if: steps.check_ignore.outputs.ignore_exists == 'false'
39+
run: |
40+
cat > .7zignore << EOF
41+
node_modules/
42+
vendor/
43+
js/prebuild/
44+
js/src/
45+
css/src/
46+
tests/
47+
package.json
48+
package-lock.json
49+
gulpfile.js
50+
README.md
51+
LICENSE
52+
psalm.xml
53+
composer.json
54+
composer.lock
55+
.*
56+
EOF
4357
4458
- name: Create ZIP archive with 7z
4559
run: 7z a -tzip "${PLUGIN_NAME}.zip" . -xr@.7zignore
@@ -49,7 +63,7 @@ jobs:
4963
with:
5064
tag_name: ${{ github.ref_name }}-version
5165
name: ${{ github.ref_name }} version
52-
body: "Prebuil version from ${{ github.ref_name }} branch"
66+
body: "Prebuilt version from ${{ github.ref_name }} branch"
5367
draft: false
5468
prerelease: true
5569
files: |
@@ -59,4 +73,8 @@ jobs:
5973
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6074

6175
- name: Clean up
62-
run: rm -f "${PLUGIN_NAME}.zip" .7zignore
76+
run: |
77+
rm -f "${PLUGIN_NAME}.zip"
78+
if [ "${{ steps.check_ignore.outputs.ignore_exists }}" = "false" ]; then
79+
rm -f .7zignore
80+
fi

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
env:
5959
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6060

61-
- name: Matrix notify
61+
- name: Matrix notify on failure
6262
if: failure()
6363
uses: Glomberg/matrix-messenger-action@master
6464
with:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package-lock.json
99
checkstyle.xml
1010
/fw_files*
1111
/cleantalk-spam-protect.bat
12-
.github/
1312
/lib/Cleantalk/Common/ContactsEncoder/.github/
1413
/lib/Cleantalk/Common/ContactsEncoder/tests/
1514
/coverage.xml

cleantalk.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: Anti-Spam by CleanTalk
55
Plugin URI: https://cleantalk.org
66
Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms.
7-
Version: 6.69.2
7+
Version: 6.70
88
Author: CleanTalk - Anti-Spam Protection <welcome@cleantalk.org>
99
Author URI: https://cleantalk.org
1010
Text Domain: cleantalk-spam-protect
@@ -603,7 +603,21 @@ function apbct_write_js_errors($data)
603603

604604
// Public actions
605605
if ( ! is_admin() && ! apbct_is_ajax() && ! apbct_is_customize_preview() ) {
606-
if (apbct_is_plugin_active('fluentformpro/fluentformpro.php') && apbct_is_in_uri('ff_landing=')) {
606+
if ( ! function_exists('is_user_logged_in') ) {
607+
require_once ABSPATH . 'wp-includes/pluggable.php';
608+
}
609+
if (
610+
apbct_is_plugin_active('fluentformpro/fluentformpro.php') &&
611+
(
612+
apbct_is_in_uri('ff_landing=') ||
613+
(
614+
// Load scripts for logged in users if constant is defined
615+
is_user_logged_in() &&
616+
(defined('APBCT_FF_JS_SCRIPTS_LOAD') &&
617+
APBCT_FF_JS_SCRIPTS_LOAD == true)
618+
)
619+
)
620+
) {
607621
add_action('wp_head', function () {
608622
echo '<script data-pagespeed-no-defer="" src="'
609623
. APBCT_URL_PATH
@@ -1504,6 +1518,20 @@ function apbct_sfw_update__download_files($urls, $direct_update = false)
15041518

15051519
$results = array();
15061520
$batch_size = 10;
1521+
1522+
/**
1523+
* Reduce batch size of curl multi instanced
1524+
*/
1525+
if (defined('APBCT_SERVICE__SFW_UPDATE_CURL_MULTI_BATCH_SIZE')) {
1526+
if (
1527+
is_int(APBCT_SERVICE__SFW_UPDATE_CURL_MULTI_BATCH_SIZE) &&
1528+
APBCT_SERVICE__SFW_UPDATE_CURL_MULTI_BATCH_SIZE > 0 &&
1529+
APBCT_SERVICE__SFW_UPDATE_CURL_MULTI_BATCH_SIZE < 10
1530+
) {
1531+
$batch_size = APBCT_SERVICE__SFW_UPDATE_CURL_MULTI_BATCH_SIZE;
1532+
};
1533+
}
1534+
15071535
$total_urls = count($urls);
15081536
$batches = ceil($total_urls / $batch_size);
15091537

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
"require-dev": {
1212
"vimeo/psalm": "^4.8",
1313
"phpunit/phpunit": "^7.5",
14-
"squizlabs/php_codesniffer": "3.*",
14+
"squizlabs/php_codesniffer": "*",
1515
"phpcompatibility/php-compatibility": "@dev",
1616
"yoast/phpunit-polyfills": "^1.0",
1717
"ext-dom": "*",
1818
"wp-cli/wp-cli-bundle": "*",
1919
"mockery/mockery": "*",
20+
"cleantalk/apbct-installer": "*",
2021
"cleantalk/contacts-encoder": "*"
2122
},
2223
"scripts": {

0 commit comments

Comments
 (0)