├── .babelrc ├── .eslintrc.js ├── .github └── workflows │ ├── eslint.yml │ ├── releaseNotice.yml │ ├── reviewNotice.yml │ └── tests.yml ├── .gitignore ├── README.md ├── changelog.txt ├── cleantalk.php ├── composer.json ├── css ├── cleantalk-admin-settings-page.min.css ├── cleantalk-admin.min.css ├── cleantalk-dashboard-widget.min.css ├── cleantalk-email-decoder.min.css ├── cleantalk-icons.min.css ├── cleantalk-public-admin.min.css ├── cleantalk-public.min.css ├── cleantalk-spam-check.min.css ├── cleantalk-trp.min.css ├── fonts │ ├── icons │ │ ├── icons.eot │ │ ├── icons.svg │ │ ├── icons.ttf │ │ ├── icons.woff │ │ ├── icons.woff2 │ │ └── index.php │ └── index.php ├── images │ ├── bad_email.svg │ ├── cancel.svg │ ├── checking_email.gif │ ├── flag-left.svg │ ├── flag-right.svg │ ├── good_email.svg │ ├── holiday_bg.svg │ ├── index.php │ ├── menu.svg │ ├── real_user.svg │ ├── shield.svg │ ├── ui-icons_444444_256x240.png │ ├── ui-icons_555555_256x240.png │ ├── ui-icons_777620_256x240.png │ ├── ui-icons_777777_256x240.png │ ├── ui-icons_cc0000_256x240.png │ └── ui-icons_ffffff_256x240.png ├── index.php ├── jquery-ui.min.css ├── jquery-ui.theme.min.css └── src │ ├── cleantalk-admin-settings-page.css │ ├── cleantalk-admin.css │ ├── cleantalk-dashboard-widget.css │ ├── cleantalk-email-decoder.css │ ├── cleantalk-icons.css │ ├── cleantalk-public-admin.css │ ├── cleantalk-public.css │ ├── cleantalk-spam-check.css │ └── cleantalk-trp.css ├── gulpfile.js ├── i18n ├── cleantalk-spam-protect.pot └── index.php ├── inc ├── cleantalk-admin.php ├── cleantalk-ajax.php ├── cleantalk-common.php ├── cleantalk-find-spam.php ├── cleantalk-integrations-by-class.php ├── cleantalk-integrations-by-hook.php ├── cleantalk-pluggable.php ├── cleantalk-public-integrations.php ├── cleantalk-public-validate-skip-functions.php ├── cleantalk-public-validate.php ├── cleantalk-public.php ├── cleantalk-settings.php ├── cleantalk-updater.php ├── cleantalk-wpcli.php ├── images │ ├── flags │ │ ├── countries_collection.svg │ │ └── index.php │ ├── index.php │ ├── logo.png │ ├── logo_color.png │ ├── logo_small.png │ ├── logo_small1.png │ ├── new_window.gif │ ├── no.png │ ├── no_gray.png │ ├── placeholder.png │ ├── preloader.gif │ ├── preloader2.gif │ ├── yes.png │ ├── yes2.png │ └── yes_gray.png └── index.php ├── index.php ├── js ├── apbct-disable-comments.min.js ├── apbct-disable-comments.min.js.map ├── apbct-public--3--cleantalk-modal.min.js ├── apbct-public--3--cleantalk-modal.min.js.map ├── apbct-public--7--trp.min.js ├── apbct-public--7--trp.min.js.map ├── apbct-public-bundle.min.js ├── apbct-public-bundle_comm-func.min.js ├── apbct-public-bundle_comm-func.min.js.map ├── apbct-public-bundle_ext-protection.min.js ├── apbct-public-bundle_ext-protection.min.js.map ├── apbct-public-bundle_ext-protection_comm-func.min.js ├── apbct-public-bundle_ext-protection_comm-func.min.js.map ├── apbct-public-bundle_full-protection.min.js ├── apbct-public-bundle_full-protection.min.js.map ├── apbct-public-bundle_full-protection_comm-func.min.js ├── apbct-public-bundle_full-protection_comm-func.min.js.map ├── apbct-public-bundle_int-protection.min.js ├── apbct-public-bundle_int-protection.min.js.map ├── apbct-public-bundle_int-protection_comm-func.min.js ├── apbct-public-bundle_int-protection_comm-func.min.js.map ├── cleantalk-admin-settings-page.min.js ├── cleantalk-admin-settings-page.min.js.map ├── cleantalk-admin.min.js ├── cleantalk-admin.min.js.map ├── cleantalk-comments-checkspam.min.js ├── cleantalk-comments-checkspam.min.js.map ├── cleantalk-comments-editscreen.min.js ├── cleantalk-comments-editscreen.min.js.map ├── cleantalk-dashboard-widget--chartjs.min.js ├── cleantalk-dashboard-widget.min.js ├── cleantalk-dashboard-widget.min.js.map ├── cleantalk-public-admin.min.js ├── cleantalk-public-admin.min.js.map ├── cleantalk-users-checkspam.min.js ├── cleantalk-users-checkspam.min.js.map ├── cleantalk-users-editscreen.min.js ├── cleantalk-users-editscreen.min.js.map ├── index.php └── src │ ├── apbct-common-functions.js │ ├── apbct-disable-comments.js │ ├── apbct-public--0--LibBundle.js │ ├── apbct-public--0--polyfill.js │ ├── apbct-public--1--collecting-user-activity.js │ ├── apbct-public--1--functions.js │ ├── apbct-public--1-force-protection.js │ ├── apbct-public--1-typodata.js │ ├── apbct-public--2--public.js │ ├── apbct-public--3--cleantalk-modal.js │ ├── apbct-public--5--external-forms.js │ ├── apbct-public--6--internal-forms.js │ ├── apbct-public--7--trp.js │ ├── apbct-public-bundle.js │ ├── apbct-public-bundle_comm-func.js │ ├── apbct-public-bundle_ext-protection.js │ ├── apbct-public-bundle_ext-protection_comm-func.js │ ├── apbct-public-bundle_full-protection.js │ ├── apbct-public-bundle_full-protection_comm-func.js │ ├── apbct-public-bundle_int-protection.js │ ├── apbct-public-bundle_int-protection_comm-func.js │ ├── cleantalk-admin-settings-page.js │ ├── cleantalk-admin.js │ ├── cleantalk-comments-checkspam.js │ ├── cleantalk-comments-editscreen.js │ ├── cleantalk-dashboard-widget.js │ ├── cleantalk-public-admin.js │ ├── cleantalk-users-checkspam.js │ └── cleantalk-users-editscreen.js ├── lib ├── Cleantalk │ ├── Antispam │ │ ├── Cleantalk.php │ │ ├── CleantalkRequest.php │ │ ├── CleantalkResponse.php │ │ ├── DisableComments.php │ │ ├── EmailEncoder │ │ │ ├── EmailEncoder.php │ │ │ ├── EmailEncoderHelper.php │ │ │ ├── Encoder.php │ │ │ ├── ExclusionsService.php │ │ │ ├── Obfuscator.php │ │ │ ├── ObfuscatorEmailData.php │ │ │ └── Shortcodes │ │ │ │ ├── EmailEncoderShortCode.php │ │ │ │ ├── EncodeContentSC.php │ │ │ │ ├── ShortCodesService.php │ │ │ │ └── SkipContentFromEncodeSC.php │ │ ├── Integrations.php │ │ ├── Integrations │ │ │ ├── AvadaBuilderFusionForm.php │ │ │ ├── AwesomeSupportRegistration.php │ │ │ ├── AwesomeSupportTickets.php │ │ │ ├── BackInStockNotifier.php │ │ │ ├── BloomForms.php │ │ │ ├── BookingPress.php │ │ │ ├── BravePopUpPro.php │ │ │ ├── CSCF.php │ │ │ ├── CalculatedFieldsForm.php │ │ │ ├── ChatyContactForm.php │ │ │ ├── ClassifiedListingRegister.php │ │ │ ├── CleantalkExternalForms.php │ │ │ ├── CleantalkExternalFormsForceAjax.php │ │ │ ├── CleantalkInternalForms.php │ │ │ ├── CleantalkPreprocessComment.php │ │ │ ├── CleantalkRegisterWidget.php │ │ │ ├── CleantalkWpDieOnComment.php │ │ │ ├── CoBlocks.php │ │ │ ├── ContactBank.php │ │ │ ├── ContactFormPlugin.php │ │ │ ├── EaelLoginRegister.php │ │ │ ├── EasyDigitalDownloads.php │ │ │ ├── ElementorPro.php │ │ │ ├── ElementorUltimateAddonsRegister.php │ │ │ ├── ElfsightContactForm.php │ │ │ ├── EstimationForm.php │ │ │ ├── EventsManager.php │ │ │ ├── FluentBookingPro.php │ │ │ ├── FluentForm.php │ │ │ ├── Forminator.php │ │ │ ├── GiveWP.php │ │ │ ├── Hustle.php │ │ │ ├── IndeedUltimateMembershipPro.php │ │ │ ├── IntegrationBase.php │ │ │ ├── JobstackThemeRegistration.php │ │ │ ├── KadenceBlocks.php │ │ │ ├── KadenceBlocksAdvanced.php │ │ │ ├── KaliForms.php │ │ │ ├── LandingPageBuilder.php │ │ │ ├── LatePoint.php │ │ │ ├── LeadFormBuilder.php │ │ │ ├── LearnPress.php │ │ │ ├── Listeo.php │ │ │ ├── LoginSignupPopup.php │ │ │ ├── MailChimp.php │ │ │ ├── MailPoet.php │ │ │ ├── MailPoet2.php │ │ │ ├── MemberPress.php │ │ │ ├── ModernEventsCalendar.php │ │ │ ├── NewUserApprove.php │ │ │ ├── Newsletter.php │ │ │ ├── NextendSocialLogin.php │ │ │ ├── OtterBlocksForm.php │ │ │ ├── OvaLogin.php │ │ │ ├── PaidMemberSubscription.php │ │ │ ├── PaidMembershipPro.php │ │ │ ├── PiotnetAddonsForElementorPro.php │ │ │ ├── PlansoFormBuilder.php │ │ │ ├── ProductEnquiryPro.php │ │ │ ├── Rafflepress.php │ │ │ ├── SendyWidgetPro.php │ │ │ ├── SimpleMembership.php │ │ │ ├── SmartForms.php │ │ │ ├── SmartQuizBuilder.php │ │ │ ├── StrongTestimonials.php │ │ │ ├── Supsystic.php │ │ │ ├── Tevolution.php │ │ │ ├── ThriveLeads.php │ │ │ ├── TourMasterOrder.php │ │ │ ├── TourMasterRegister.php │ │ │ ├── UlitmateFormBuilder.php │ │ │ ├── UserRegistrationPro.php │ │ │ ├── VisualFormBuilder.php │ │ │ ├── WPUserMeta.php │ │ │ ├── WPZOOMForms.php │ │ │ ├── WordpressFileUpload.php │ │ │ ├── WpBookingSystem.php │ │ │ ├── WpForo.php │ │ │ ├── WpGeoDirectory.php │ │ │ ├── WpMembers.php │ │ │ ├── Wpdiscuz.php │ │ │ └── index.php │ │ ├── IntegrationsByClass.php │ │ ├── IntegrationsByClass │ │ │ ├── BuddyPress.php │ │ │ ├── IntegrationByClassBase.php │ │ │ ├── WPForms.php │ │ │ ├── WPSearchForm.php │ │ │ └── Woocommerce.php │ │ ├── ProtectByShortcode.php │ │ └── index.php │ ├── ApbctWP │ │ ├── AJAXService.php │ │ ├── API.php │ │ ├── Activator.php │ │ ├── AdjustToEnvironmentModule │ │ │ ├── AdjustToEnv │ │ │ │ ├── AdjustToEnvAbstract.php │ │ │ │ └── AdjustToEnvW3TotalCache.php │ │ │ ├── AdjustToEnvironmentHandler.php │ │ │ ├── AdjustToEnvironmentSettings.php │ │ │ └── Exceptions │ │ │ │ ├── ExceptionReverseAdjustClassNotExists.php │ │ │ │ └── ExceptionReverseAdjustNotIntervention.php │ │ ├── AdminNotices.php │ │ ├── Antispam │ │ │ ├── EmailEncoder.php │ │ │ ├── ForceProtection.php │ │ │ └── index.php │ │ ├── ApbctEnqueue.php │ │ ├── ApbctJsBundleResolver.php │ │ ├── ApbctUniversalBanner.php │ │ ├── CleantalkListTable.php │ │ ├── CleantalkRealPerson.php │ │ ├── CleantalkSettingsTemplates.php │ │ ├── CleantalkUpgrader.php │ │ ├── CleantalkUpgraderSkin.php │ │ ├── CleantalkUpgraderSkinDeprecated.php │ │ ├── ConnectionReports.php │ │ ├── Cron.php │ │ ├── DB.php │ │ ├── DTO │ │ │ └── GetFieldsAnyDTO.php │ │ ├── Deactivator.php │ │ ├── Escape.php │ │ ├── FindSpam │ │ │ ├── Checker.php │ │ │ ├── CommentsChecker.php │ │ │ ├── CommentsScanParameters.php │ │ │ ├── CommentsScanResponse.php │ │ │ ├── ListTable │ │ │ │ ├── BadUsers.php │ │ │ │ ├── Comments.php │ │ │ │ ├── CommentsLogs.php │ │ │ │ ├── CommentsScan.php │ │ │ │ ├── Users.php │ │ │ │ ├── UsersLogs.php │ │ │ │ ├── UsersScan.php │ │ │ │ └── index.php │ │ │ ├── LoginIPKeeper.php │ │ │ ├── Page.php │ │ │ ├── UsersChecker.php │ │ │ ├── UsersScanParameters.php │ │ │ ├── UsersScanResponse.php │ │ │ └── index.php │ │ ├── Firewall │ │ │ ├── AntiCrawler.php │ │ │ ├── AntiFlood.php │ │ │ ├── SFW.php │ │ │ ├── SFWUpdateHelper.php │ │ │ ├── SFWUpdateSentinel.php │ │ │ ├── die_page_anticrawler.html │ │ │ ├── die_page_antiflood.html │ │ │ ├── die_page_sfw.html │ │ │ └── index.php │ │ ├── GetFieldsAny.php │ │ ├── HTTP │ │ │ ├── Request.php │ │ │ └── index.php │ │ ├── Helper.php │ │ ├── Honeypot.php │ │ ├── JsErrorsReport.php │ │ ├── LinkConstructor.php │ │ ├── Localize │ │ │ ├── CtPublicFunctionsLocalize.php │ │ │ ├── CtPublicLocalize.php │ │ │ ├── LocalizeHandler.php │ │ │ └── index.php │ │ ├── PluginSettingsPage │ │ │ └── SettingsField.php │ │ ├── Queue.php │ │ ├── RemoteCalls.php │ │ ├── RemoteCallsCounter.php │ │ ├── RemoteCallsLogger.php │ │ ├── RequestParameters │ │ │ ├── RequestParameters.php │ │ │ └── index.php │ │ ├── RestController.php │ │ ├── Sanitize.php │ │ ├── ServerRequirementsChecker │ │ │ └── ServerRequirementsChecker.php │ │ ├── ShortCode.php │ │ ├── State.php │ │ ├── Transaction.php │ │ ├── UpdatePlugin │ │ │ ├── DbAnalyzer.php │ │ │ ├── DbColumnCreator.php │ │ │ ├── DbTablesCreator.php │ │ │ └── index.php │ │ ├── Validate.php │ │ ├── Variables │ │ │ ├── AltSessions.php │ │ │ ├── Cookie.php │ │ │ ├── Get.php │ │ │ ├── NoCookie.php │ │ │ ├── Post.php │ │ │ ├── Request.php │ │ │ ├── Server.php │ │ │ └── index.php │ │ ├── WcSpamOrdersFunctions.php │ │ ├── WcSpamOrdersListTable.php │ │ └── index.php │ ├── Common │ │ ├── API.php │ │ ├── Arr.php │ │ ├── Compatibility.php │ │ ├── Cron.php │ │ ├── DB.php │ │ ├── DNS.php │ │ ├── Enqueue │ │ │ ├── Enqueue.php │ │ │ └── EnqueueDataDTO.php │ │ ├── Escape.php │ │ ├── Firewall.php │ │ ├── Firewall │ │ │ ├── FirewallModule.php │ │ │ ├── FirewallModuleAbstract.php │ │ │ └── index.php │ │ ├── HTTP │ │ │ ├── Request.php │ │ │ ├── Response.php │ │ │ └── index.php │ │ ├── Helper.php │ │ ├── LinkConstructor.php │ │ ├── Queue.php │ │ ├── Sanitize.php │ │ ├── Schema.php │ │ ├── State.php │ │ ├── TT.php │ │ ├── Transaction.php │ │ ├── UniversalBanner │ │ │ ├── BannerDataDto.php │ │ │ ├── UniversalBanner.php │ │ │ ├── index.php │ │ │ ├── universal_banner_template.html │ │ │ └── universal_banner_without_btn_template.html │ │ ├── Validate.php │ │ └── index.php │ ├── Templates │ │ ├── DTO.php │ │ ├── Multiton.php │ │ ├── Singleton.php │ │ └── index.php │ ├── Variables │ │ ├── Cookie.php │ │ ├── Get.php │ │ ├── Post.php │ │ ├── Request.php │ │ ├── Server.php │ │ ├── ServerVariables.php │ │ └── index.php │ └── index.php ├── autoloader.php ├── cleantalk-php-patch.php └── index.php ├── package.json ├── psalm.xml ├── readme.txt ├── templates ├── apbct_settings__footer.php ├── empty_comments.php ├── index.php ├── lock-pages │ ├── index.php │ └── lock-page-ct-die.html ├── settings │ ├── settings_key_wrapper.html │ └── settings_top_info.php └── translate_banner.php └── tests ├── .phpcs.xml ├── Antispam ├── CleantalkTest.php ├── IntegrationsByHook │ └── testWPZOOMForms.php ├── IntegrationsTest.php ├── TestEmailEncoder.php ├── testEmailEncoderShortCodeEncode.php └── testEmailEnocderShortcodeSkip.php ├── ApbctWP ├── APITest.php ├── AjaxNonceCheckExistTest.php ├── CronTest.php ├── DbTest.php ├── LoginIPKeeperTest.php ├── TestApbctCron.php ├── TestCleanTalkLinks.php ├── TestCleantalkSettingsTemplates.php ├── TestConnectionReports.php ├── TestGetFieldsAny.php ├── TestGetFieldsAnyNested.php ├── TestSFWUpdateSentinel.php ├── TestState.php ├── TransactionTest.php └── ValidateTest.php ├── Common ├── HelperTest.php ├── QueueTest.php ├── SchemaTest.php └── Variables │ └── PostTest.php ├── StandaloneFunctions ├── PublicIntegrationsTest.php ├── SettingsTest.php ├── TestBotDetectorLogGathering.php ├── TestFormSignsExclusion.php ├── TestGetServerUrl.php ├── TestRCServiceTemplateGet.php ├── TestSFWPrivateRecordsHandler.php └── TestWPAdminBarTitleNodes.php ├── Templates └── SingletonTest.php ├── bootstrap.php ├── phpunit.xml └── wp-test-setup.sh /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": ["@babel/plugin-transform-class-properties"] 4 | } -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | }, 6 | extends: 'google', 7 | ignorePatterns: [ 8 | 'js/src/cleantalk-comments-editscreen.js', 9 | 'js/src/cleantalk-dashboard-widget.js', 10 | 'js/src/cleantalk-public-admin.js', 11 | 'js/src/cleantalk-users-checkspam.js', 12 | 'js/src/cleantalk-users-editscreen.js', 13 | ], 14 | overrides: [], 15 | parserOptions: { 16 | ecmaVersion: 'latest', 17 | }, 18 | rules: { 19 | 'indent': ['error', 4], 20 | 'max-len': ['error', {'code': 120}], 21 | 'prefer-const': 'off', 22 | }, 23 | globals: { 24 | 'ctSetCookie': 'readonly', 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /.github/workflows/eslint.yml: -------------------------------------------------------------------------------- 1 | # .github/workflows/eslint.yml 2 | 3 | name: ESLint # name of the action (displayed in the github interface) 4 | 5 | on: # event list 6 | push: # on push to each of these branches 7 | branches: 8 | - dev 9 | - fix 10 | - master 11 | pull_request: 12 | branches: 13 | - dev 14 | - master 15 | 16 | env: # environment variables (available in any part of the action) 17 | NODE_VERSION: 16 18 | 19 | jobs: # list of things to do 20 | linting: 21 | name: ESLint # job name (unique id) 22 | runs-on: ubuntu-latest # on which machine to run 23 | steps: # list of steps 24 | - name: Install NodeJS 25 | uses: actions/setup-node@v2 26 | with: 27 | node-version: ${{ env.NODE_VERSION }} 28 | 29 | - name: Code Checkout 30 | uses: actions/checkout@v2 31 | 32 | - name: Install Dependencies 33 | run: npm i 34 | 35 | - name: Code Linting 36 | run: npm run eslint 37 | 38 | - name: Matrix notify 39 | if: failure() 40 | uses: Glomberg/matrix-messenger-action@master 41 | with: 42 | server: ${{ secrets.MATRIX_SERVER }} 43 | to: ${{ secrets.MATRIX_EXTERNSION_ROOM }} 44 | token: ${{ secrets.MATRIX_USER_TOKEN }} 45 | message: | 46 | Hi, ${{ github.actor }}! Your commit for ${{ github.repository }} 47 | contains 💯 the best solution but it have to be fixed! 48 | Auto-Tests ESLint build failed ⛔! 49 | -------------------------------------------------------------------------------- /.github/workflows/releaseNotice.yml: -------------------------------------------------------------------------------- 1 | name: Notice about releases via Matrix 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Send Matrix message on release 13 | uses: Glomberg/matrix-messenger-action@master 14 | with: 15 | server: ${{ secrets.MATRIX_SERVER }} 16 | to: ${{ secrets.MATRIX_NEWS_ROOM }} 17 | token: ${{ secrets.MATRIX_USER_TOKEN }} 18 | message: | 19 | ${{ github.event.repository.description }} v${{github.event.release.name}} released 20 |
${{github.event.release.html_url}} 21 |
22 |
${{ github.event.release.body }}
23 | -------------------------------------------------------------------------------- /.github/workflows/reviewNotice.yml: -------------------------------------------------------------------------------- 1 | name: Notice about review approved via Matrix 2 | 3 | on: 4 | pull_request_review: 5 | types: [ submitted ] 6 | 7 | jobs: 8 | 9 | build: 10 | if: github.event.review.state == 'approved' && toJSON(github.event.pull_request.requested_reviewers) == '[]' 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Convert date format 14 | id: date 15 | run: echo "::set-output name=date::$(date -d "${{ github.event.pull_request.created_at }}" +"%Y-%m-%d")" 16 | - name: Send Matrix message on review approved 17 | uses: Glomberg/matrix-messenger-action@master 18 | with: 19 | server: ${{ secrets.MATRIX_SERVER }} 20 | to: ${{ secrets.MATRIX_EXTERNSION_ROOM }} 21 | token: ${{ secrets.MATRIX_USER_TOKEN }} 22 | message: | 23 | 💥🎉🎉🎉💥 Pull-request ${{ github.event.pull_request.title }} 24 | submitted by ${{ github.event.pull_request.user.login }} at ${{ steps.date.outputs.date }} 25 | 26 | was approved and is ready to merge ➡️ !!! 27 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: PHPUnit, PHPCS, Psalm 2 | 3 | on: # event list 4 | push: # on push to each of these branches 5 | branches: 6 | - dev 7 | - fix 8 | - master 9 | pull_request: 10 | branches: 11 | - dev 12 | - master 13 | 14 | env: # environment variables (available in any part of the action) 15 | PHP_VERSION: 7.4 16 | 17 | jobs: 18 | build: 19 | name: PHPUnit, PHPCS, Psalm 20 | runs-on: ubuntu-22.04 21 | env: 22 | DB_CONNECTION: mysql 23 | DB_HOST: localhost 24 | DB_PORT: 3306 25 | DB_DATABASE: wordpress_test 26 | DB_USERNAME: root 27 | DB_PASSWORD: root 28 | 29 | steps: 30 | - name: Set up PHP 31 | uses: shivammathur/setup-php@v2 32 | with: 33 | php-version: ${{ env.PHP_VERSION }} 34 | 35 | - name: Run MySQL server 36 | run: sudo systemctl start mysql 37 | 38 | - name: Code Checkout 39 | uses: actions/checkout@v4 40 | 41 | - name: Make the script files executable 42 | run: chmod +x ./tests/wp-test-setup.sh 43 | 44 | - name: Install WP develop 45 | run: ./tests/wp-test-setup.sh wordpress_test root root localhost latest 46 | 47 | - name: Install Dependencies 48 | run: composer i 49 | 50 | - name: Running tests 51 | env: 52 | CLEANTALK_TEST_API_KEY: ${{ secrets.CLEANTALK_TEST_API_KEY }} 53 | run: composer test 54 | 55 | - name: Matrix notify 56 | if: failure() 57 | uses: Glomberg/matrix-messenger-action@master 58 | with: 59 | server: ${{ secrets.MATRIX_SERVER }} 60 | to: ${{ secrets.MATRIX_EXTERNSION_ROOM }} 61 | token: ${{ secrets.MATRIX_USER_TOKEN }} 62 | message: | 63 | Hi, ${{ github.actor }}! Your commit for ${{ github.repository }} 64 | contains 💯 the best solution but it have to be fixed! 65 | Auto-Tests (PHPUnit, PHPCS, Psalm) build failed ⛔! 66 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | sync.ffs_db 2 | upload_new_asset* 3 | .7zignore 4 | node_modules 5 | .idea 6 | /vendor/ 7 | composer.lock 8 | package-lock.json 9 | checkstyle.xml 10 | /fw_files* 11 | /cleantalk-spam-protect.bat 12 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cleantalk/cleantalk-spam-protect", 3 | "description": "Spam protection, anti-spam, firewall, premium plugin. No spam comments & users, no spam contact form & WooCommerce anti-spam.", 4 | "license": "GPL-3.0-or-later", 5 | "authors": [ 6 | { 7 | "name": "Cleantalk Team", 8 | "email": "plugins@cleantalk.org" 9 | } 10 | ], 11 | "require-dev": { 12 | "vimeo/psalm": "^4.8", 13 | "phpunit/phpunit": "^7.5", 14 | "squizlabs/php_codesniffer": "3.*", 15 | "phpcompatibility/php-compatibility": "@dev", 16 | "yoast/phpunit-polyfills": "^1.0", 17 | "ext-dom": "*", 18 | "wp-cli/wp-cli-bundle": "*" 19 | }, 20 | "scripts": { 21 | "test": [ 22 | "vendor/bin/phpunit --configuration tests/phpunit.xml", 23 | "vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility", 24 | "vendor/bin/phpcs --standard=tests/.phpcs.xml", 25 | "vendor/bin/psalm --no-cache --config=psalm.xml", 26 | "vendor/bin/psalm --no-cache --config=psalm.xml --taint-analysis" 27 | ], 28 | "psalm_l1": [ 29 | "vendor/bin/psalm --no-cache --config=psalm.xml" 30 | ], 31 | "psalm_l1_taint": [ 32 | "vendor/bin/psalm --no-cache --config=psalm.xml --taint-analysis" 33 | ], 34 | "just_phpunit": [ 35 | "vendor/bin/phpunit --configuration tests/phpunit.xml --debug" 36 | ] 37 | }, 38 | "config": { 39 | "allow-plugins": { 40 | "dealerdirect/phpcodesniffer-composer-installer": true 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /css/cleantalk-dashboard-widget.min.css: -------------------------------------------------------------------------------- 1 | #ct_widget_wrapper{position:relative;width:100%;height:100%}.ct_widget_top_links{text-align:right;padding:0 12px;height:32px}.ct_widget_settings_link{margin:0 0 0 10px}.ct_preloader{display:none;float:left;width:20px;height:20px;margin:0 10px}.ct_widget_hr{width:100%}.ct_widget_block_header{font-size:18px!important;margin-left:12px!important}.ct_widget_block{display:block;position:relative;padding:12px}.ct_widget_chart_wrapper{margin-right:10px;height:300px}.ct_widget_block table{width:100%;text-align:left}.ct_widget_block table tr{margin-bottom:10px}.ct_widget_activate_button,.ct_widget_button{display:block;margin:10px auto}.ct_widget_block table th{text-align:left;padding:10px 0 5px 10px;border-bottom:2px solid gray}.ct_widget_block table td{text-align:left;padding:10px 0 5px 10px;border-bottom:1px solid gray}#ct_widget_wrapper .ct_widget_block table td.ct_widget_block__country_cell img{width:16px!important;height:auto}.ct_widget_activate_button{padding:7px 15px;font-weight:600;border-radius:3px;border:2px solid #aaa;background:rgba(250,50,50,.9)}.ct_widget_resolve_button{background:rgba(50,250,50,.9)}.ct_widget_activate_header{display:inline-block;width:100%;text-align:center;font-size:18px!important}.ct_widget_wprapper_total_blocked{padding:10px 0 10px 10px;background:#f1f1f1}.ct_widget_wprapper_total_blocked span{position:relative;top:2px}.ct_widget_small_logo{margin-right:1em;vertical-align:middle}#ct_widget_wrapper .ct_widget_wprapper_total_blocked img.ct_widget_small_logo{width:24px!important;height:24px!important}#ct_widget_button_view_all{cursor:pointer;border:1px solid #0074a2;-webkit-appearance:none;-webkit-border-radius:2px;border-radius:2px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;background:#0085ba;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff}#ct_widget_button_view_all:hover{color:#000!important} -------------------------------------------------------------------------------- /css/cleantalk-email-decoder.min.css: -------------------------------------------------------------------------------- 1 | .apbct_dog_one,.apbct_dog_three,.apbct_dog_two{animation-duration:1.5s;animation-iteration-count:infinite;animation-name:apbct_dog}.apbct-email-encoder,.apbct-email-encoder--settings_example_encoded{position:relative}.apbct-email-encoder-popup{width:30vw;min-width:400px;font-size:16px}.apbct-email-encoder--popup-header{font-size:16px;color:#333}.apbct-email-encoder-elements_center{display:flex;flex-direction:column;justify-content:center;align-items:center;font-size:16px!important;color:#000!important}.top-margin-long{margin-top:5px}.apbct-tooltip{display:none}.apbct-blur{filter:blur(5px);transition:filter 2s}.apbct-email-encoder.no-blur .apbct-blur{filter:none}.apbct-email-encoder-select-whole-email{-webkit-user-select:all;user-select:all}.apbct-email-encoder-got-it-button{all:unset;margin-top:10px;padding:5px 10px;border-radius:5px;background-color:#333;color:#fff;cursor:pointer;transition:background-color .3s}.apbct-ee-animation-wrapper{display:flex;height:60px;justify-content:center;font-size:16px;align-items:center}.apbct_dog{margin:0 5px;color:transparent;text-shadow:0 0 2px #aaa}.apbct_dog_one{animation-delay:0s}.apbct_dog_two{animation-delay:.5s}.apbct_dog_three{animation-delay:1s}@keyframes apbct_dog{0%,100%,75%{scale:100%;color:transparent;text-shadow:0 0 2px #aaa}25%{scale:200%;color:unset;text-shadow:unset}}@media screen and (max-width:782px){.apbct-email-encoder--settings_example_encoded{position:relative;display:block}.apbct-email-encoder-popup{width:20vw;min-width:200px;font-size:16px;top:20%;left:75%}.apbct-email-encoder-elements_center{flex-direction:column!important;text-align:center}} -------------------------------------------------------------------------------- /css/cleantalk-public-admin.min.css: -------------------------------------------------------------------------------- 1 | .ct_hidden{display:none}.ct_comment_info a,.ct_comment_info img,p.ct_comment_info_title,p.ct_comment_logo_title{display:inline-block}.ct_comment_info{position:relative;font-size:11px;line-height:12px;margin-bottom:15px}.ct_comment_titles{border-bottom:1px solid gray!important;background:inherit;margin-bottom:15px}p.ct_comment_logo_title{float:right}.ct_comment_logo_img{height:12px;vertical-align:text-top;box-shadow:transparent 0 0 0!important}.ct_this_is{padding:2px 3px;cursor:pointer;white-space:nowrap;color:#000!important;background:rgba(230,230,230,1);border:1px solid #777;border-radius:4px}p.ct_feedback_wrap{display:none;position:absolute;top:37px;left:0;width:100%;height:27px;margin:0;padding:6px;border-radius:3px;background:#fff}.ct_feedback_result{display:none;text-decoration:underline}.ct_feedback_result_spam{color:red}.ct_feedback_result_not_spam{color:green}.ct_feedback_msg a{color:green!important;text-decoration:underline}.ct_feedback_success{color:green}.ct_feedback_error{color:red}.ct_feedback_no_hash{color:#00f}.ct_comment_info .ct_this_is img.--hide{display:none}.ct_comment_info .ct_this_is img.apbct_preloader_button{height:15px;margin-left:5px;vertical-align:text-top;display:none} -------------------------------------------------------------------------------- /css/cleantalk-spam-check.min.css: -------------------------------------------------------------------------------- 1 | #ct_checking_count,#ct_checking_status,#ct_cooling_notice,#ct_error_message h3,#ct_error_message h4{text-align:center;width:90%}#ct_preloader{display:none;width:100%;text-align:center}#ct_preloader img{border:none!important}#ct_working_message{display:none;margin:1em auto auto;padding:3px;width:70%;border:2px dotted gray;background:#ff9}#ct_pause{display:none}.ct_check_params_elem_sub{margin:15px 0 0 25px;width:150px;display:inline-block}.ct_check_params_elem_sub_sub{margin:15px 0 0 50px}button#ct_check_spam_button{background:#2ea2cc;border-color:#0074a2;color:#fff;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15)}button#ct_check_spam_button:hover{color:#000}.ct_date{display:inline;width:150px}.ct_check_params_desc{display:inline-block;margin:5px 10px 10px 15px}#ct_check_tabs{border:1px solid #c5c5c5;border-radius:3px;padding:.2em;background:#fff}#ct_check_tabs ul{margin:0;padding:.2em .2em 0;border:1px solid #c5c5c5;border-radius:3px;background:#e9e9e9;color:#333;font-weight:700;display:flex}#ct_check_tabs ul li{list-style:none;position:relative;margin:1px .2em -1px 0;padding:0;white-space:nowrap;border:1px solid #c5c5c5;border-radius:3px 3px 0 0;background:#fff;font-weight:400}#ct_check_tabs ul li.active{border-bottom:1px solid transparent}#ct_check_tabs ul li a{display:block;padding:.5em 1em;text-decoration:none}#ct_check_tabs ul li.active a{font-weight:700}#ct_check_content{display:block;border-width:0;padding:1em 1.4em;background:0 0} -------------------------------------------------------------------------------- /css/cleantalk-trp.min.css: -------------------------------------------------------------------------------- 1 | .apbct-real-user-wrapper{display:inline-flex;color:#000!important;flex-wrap:nowrap;justify-content:center;flex-direction:row;align-items:center}.apbct-real-user-wrapper-woo{display:inline;align-items:center;color:#444!important;font-size:14px}.apbct-real-user-author-name{display:inline-flex}.apbct-real-user-badge{display:inline-flex;padding-left:6px;cursor:pointer;position:relative}.apbct-real-user-popup{position:absolute;padding:16px;font-weight:400;color:#000!important;background:#fff;border:1px solid #ccc;border-radius:4px;box-shadow:5px 5px 24px -11px #444;z-index:-1;cursor:default;opacity:0;transition-property:opacity,z-index}.apbct-real-user-popup.visible{z-index:1;opacity:1}.apbct-real-user-title{display:grid;gap:4px!important}.apbct-real-user-popup-content_row{display:flex;align-items:center;gap:1px}.apbct-real-user-popup-img{align-self:start;margin:0!important;height:max-content;vertical-align:center}.apbct-real-user-popup-header{font-weight:bolder;margin:0} -------------------------------------------------------------------------------- /css/fonts/icons/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/fonts/icons/icons.eot -------------------------------------------------------------------------------- /css/fonts/icons/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/fonts/icons/icons.woff -------------------------------------------------------------------------------- /css/fonts/icons/icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/fonts/icons/icons.woff2 -------------------------------------------------------------------------------- /css/fonts/icons/index.php: -------------------------------------------------------------------------------- 1 | 2 | Новый проект 3 | 4 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /css/images/cancel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /css/images/checking_email.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/checking_email.gif -------------------------------------------------------------------------------- /css/images/good_email.svg: -------------------------------------------------------------------------------- 1 | 2 | Новый проект 3 | 4 | 5 | 6 | 8 | 9 | -------------------------------------------------------------------------------- /css/images/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /css/images/shield.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /css/images/ui-icons_444444_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/ui-icons_444444_256x240.png -------------------------------------------------------------------------------- /css/images/ui-icons_555555_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/ui-icons_555555_256x240.png -------------------------------------------------------------------------------- /css/images/ui-icons_777620_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/ui-icons_777620_256x240.png -------------------------------------------------------------------------------- /css/images/ui-icons_777777_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/ui-icons_777777_256x240.png -------------------------------------------------------------------------------- /css/images/ui-icons_cc0000_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/ui-icons_cc0000_256x240.png -------------------------------------------------------------------------------- /css/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CleanTalk/wordpress-antispam/02d6a71a4e62deb2cab69678a98dfc26777eba0f/css/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /css/index.php: -------------------------------------------------------------------------------- 1 | array( 5 | 'plugin_path' => 'buddypress/bp-loader.php', 6 | 'plugin_class' => 'BuddyPress', 7 | ), 8 | 'Woocommerce' => array( 9 | 'plugin_path' => 'woocommerce/woocommerce.php', 10 | 'plugin_class' => 'WooCommerce', 11 | ), 12 | 'WPSearchForm' => array( 13 | 'plugin_path' => '', 14 | 'plugin_class' => '', 15 | 'wp_includes' => true, 16 | ), 17 | 'WPForms' => array( 18 | 'plugin_path' => ['wpforms-lite/wpforms.php', 'wpforms/wpforms.php'], 19 | 'plugin_class' => 'WPForms', 20 | ), 21 | ); 22 | 23 | add_action('plugins_loaded', function () use ($apbct_integrations_by_class) { 24 | new \Cleantalk\Antispam\IntegrationsByClass($apbct_integrations_by_class); 25 | }); 26 | -------------------------------------------------------------------------------- /inc/images/flags/index.php: -------------------------------------------------------------------------------- 1 | {var a={labels:[],counts:[]};for(let e=0;e')}),jQuery(".username.column-username").each(function(){var e=jQuery(this).siblings(".apbct_status").children("span"),t=e.attr("id"),e=e.text(),e=jQuery("",{text:e}),c=jQuery("",{class:"apbct-icon-ok"}),r=jQuery("",{class:"apbct-icon-cancel",css:{color:"red"}});"apbct_not_checked"===t&&jQuery(this).children(".row-actions").before(c).before(e),"apbct_checked_not_spam"===t&&(c.attr("style","color:green;"),jQuery(this).children(".row-actions").before(c).before(e)),"apbct_checked_spam"===t&&jQuery(this).children(".row-actions").before(r).before(e)}))}); 2 | //# sourceMappingURL=cleantalk-users-editscreen.min.js.map 3 | -------------------------------------------------------------------------------- /js/index.php: -------------------------------------------------------------------------------- 1 | '); 18 | } 19 | }); 20 | 21 | /* Show checked ico near avatar */ 22 | jQuery('.username.column-username').each(function(){ 23 | 24 | var apbct_checking_el = jQuery(this).siblings('.apbct_status').children('span'); 25 | var apbct_checking_status = apbct_checking_el.attr('id'); 26 | var apbct_checking_status_text = apbct_checking_el.text(); 27 | 28 | var apbct_add_text_element = jQuery('', { 29 | text : apbct_checking_status_text 30 | }); 31 | var apbct_add_ico_ok = jQuery('', { 32 | class : 'apbct-icon-ok' 33 | }); 34 | var apbct_add_ico_cancel = jQuery('', { 35 | class : 'apbct-icon-cancel', 36 | css : { 37 | color : 'red' 38 | } 39 | }); 40 | 41 | if( apbct_checking_status ==='apbct_not_checked' ) { 42 | jQuery(this).children('.row-actions').before(apbct_add_ico_ok).before(apbct_add_text_element); 43 | } 44 | if( apbct_checking_status ==='apbct_checked_not_spam' ) { 45 | apbct_add_ico_ok.attr('style', 'color:green;'); 46 | jQuery(this).children('.row-actions').before(apbct_add_ico_ok).before(apbct_add_text_element); 47 | } 48 | if( apbct_checking_status ==='apbct_checked_spam' ) { 49 | jQuery(this).children('.row-actions').before(apbct_add_ico_cancel).before(apbct_add_text_element); 50 | } 51 | 52 | }); 53 | 54 | } 55 | 56 | }); -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/EmailEncoder/ObfuscatorEmailData.php: -------------------------------------------------------------------------------- 1 | chunk_raw_left 64 | . $this->chunk_obfuscated_left 65 | . $this->chunk_raw_center 66 | . $this->chunk_obfuscated_right 67 | . $this->chunk_raw_right 68 | . $this->domain; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/EmailEncoder/Shortcodes/EmailEncoderShortCode.php: -------------------------------------------------------------------------------- 1 | public_name)) { 28 | // Process the shortcode 29 | $content = do_shortcode($content); 30 | } 31 | return $content; 32 | } 33 | 34 | /** 35 | * Modifies the content before the encoder processes it. 36 | * 37 | * @param string $content The content to modify. 38 | * @return string The modified content. 39 | * @psalm-suppress PossiblyUnusedMethod 40 | */ 41 | protected function changeContentBeforeEncoderModify($content) 42 | { 43 | return $content; 44 | } 45 | 46 | /** 47 | * Modifies the content after the encoder processes it. 48 | * 49 | * @param string $content The content to modify. 50 | * @return string The modified content. 51 | * @psalm-suppress PossiblyUnusedMethod 52 | */ 53 | protected function changeContentAfterEncoderModify($content) 54 | { 55 | return $content; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/EmailEncoder/Shortcodes/ShortCodesService.php: -------------------------------------------------------------------------------- 1 | shortcodes_registered) { 19 | $this->encode->register(); 20 | // $this->exclude->register(); 21 | $this->shortcodes_registered = true; 22 | } 23 | } 24 | 25 | public function __construct() 26 | { 27 | $this->encode = new EncodeContentSC(); 28 | // $this->exclude = new SkipContentFromEncodeSC(); 29 | } 30 | 31 | public function addActionsBeforeModify($hook, $priority = 1) 32 | { 33 | // add_filter($hook, array($this->exclude, 'changeContentBeforeEncoderModify'), $priority); 34 | add_filter($hook, array($this->encode, 'changeContentBeforeEncoderModify'), $priority); 35 | } 36 | 37 | public function addActionsAfterModify($hook, $priority = 999) 38 | { 39 | // add_filter($hook, array($this->exclude, 'changeContentAfterEncoderModify'), $priority); 40 | add_filter($hook, array($this->encode, 'changeContentAfterEncoderModify'), $priority); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/AvadaBuilderFusionForm.php: -------------------------------------------------------------------------------- 1 | stats['no_cookie_data_taken'] ) { 16 | apbct_form__get_no_cookie_data($data, false); 17 | } 18 | 19 | $username = isset($input_array['name']) ? $input_array['name'] : ''; 20 | $email = isset($input_array['email']) ? $input_array['email'] : ''; 21 | $data_to_spam_check = ct_gfa_dto($input_array, $email, $username)->getArray(); 22 | 23 | if ( isset($data['ct_bot_detector_event_token']) ) { 24 | $data_to_spam_check['event_token'] = $data['ct_bot_detector_event_token']; 25 | } 26 | 27 | // It is a service field. Need to be deleted before the processing. 28 | if ( isset($input_array['apbct_visible_fields']) ) { 29 | unset($input_array['apbct_visible_fields']); 30 | } 31 | 32 | $_POST['formData'] = http_build_query($input_array); 33 | 34 | return $data_to_spam_check; 35 | } 36 | 37 | return null; 38 | } 39 | 40 | public function doBlock($message) 41 | { 42 | wp_send_json( 43 | array( 44 | 'status' => 'error', 45 | 'info' => array($message), 46 | ) 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/AwesomeSupportRegistration.php: -------------------------------------------------------------------------------- 1 | getArray(); 10 | $data['register'] = true; 11 | return $data; 12 | } 13 | 14 | public function doBlock($message) 15 | { 16 | global $ct_comment; 17 | $ct_comment = $message; 18 | ct_die(null, null); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/AwesomeSupportTickets.php: -------------------------------------------------------------------------------- 1 | settings['data__protect_logged_in'] == 1) { 12 | $email = wp_get_current_user() ? wp_get_current_user()->user_email : ''; 13 | return ct_gfa_dto(apply_filters('apbct__filter_post', $_POST), $email)->getArray(); 14 | } 15 | } 16 | 17 | public function doBlock($message) 18 | { 19 | global $ct_comment; 20 | $ct_comment = $message; 21 | ct_die(null, null); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/BackInStockNotifier.php: -------------------------------------------------------------------------------- 1 | "
" . $message . " $message, 20 | ]; 21 | 22 | wp_send_json($data); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/BookingPress.php: -------------------------------------------------------------------------------- 1 | 'error', 19 | 'title' => 'Error', 20 | 'msg' => $message 21 | ], 403); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/BravePopUpPro.php: -------------------------------------------------------------------------------- 1 | getArray(); 17 | } 18 | return false; 19 | } 20 | 21 | /** 22 | * @inheritDoc 23 | */ 24 | public function doBlock($message) 25 | { 26 | print_r(wp_json_encode(array('sent' => false, 'error' => $message))); 27 | wp_die(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/CalculatedFieldsForm.php: -------------------------------------------------------------------------------- 1 | getArray(); 22 | 23 | $base_call_data['event_token'] = $event_token; 24 | 25 | if (isset($base_call_data['message']['message'])) { 26 | $base_call_data['message'] = $base_call_data['message']['message']; 27 | } 28 | 29 | return $base_call_data; 30 | } 31 | 32 | return null; 33 | } 34 | 35 | public function doBlock($message) 36 | { 37 | $response = [ 38 | 'status' => 0, 39 | 'error' => '', 40 | 'errors' => [], 41 | 'message' => $message, 42 | ]; 43 | wp_send_json($response); 44 | exit; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/ClassifiedListingRegister.php: -------------------------------------------------------------------------------- 1 | array( 18 | 'blocked' => true, 19 | 'comment' => $message, 20 | 'stop_script' => apbct__stop_script_after_ajax_checking() 21 | ) 22 | ) 23 | ) 24 | ); 25 | } 26 | 27 | public function allow() 28 | { 29 | die( 30 | json_encode( 31 | array( 32 | 'apbct' => array( 33 | 'blocked' => false, 34 | 'allow' => true, 35 | ) 36 | ) 37 | ) 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/CleantalkInternalForms.php: -------------------------------------------------------------------------------- 1 | array( 28 | 'href' => true, 29 | 'title' => true, 30 | ), 31 | 'br' => array(), 32 | 'p' => array() 33 | ) 34 | ) 35 | ); 36 | } 37 | 38 | public function allow() 39 | { 40 | wp_send_json_success(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/CleantalkRegisterWidget.php: -------------------------------------------------------------------------------- 1 | Post::get('email'), 13 | 'sender_url' => Post::get('current_url'), 14 | ]; 15 | } 16 | 17 | public function doBlock($message) 18 | { 19 | wp_send_json_error($message); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/CoBlocks.php: -------------------------------------------------------------------------------- 1 | array('blocked' => true, 'comment' => $message,)), 32 | JSON_HEX_QUOT | JSON_HEX_TAG 33 | ) 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/ContactFormPlugin.php: -------------------------------------------------------------------------------- 1 | user_data = $argument; 14 | 15 | if ( 16 | Post::get('edd_action') === "user_register" || 17 | !empty($argument['user_email']) 18 | ) { 19 | /** 20 | * Filter for POST 21 | */ 22 | $input_array = apply_filters('apbct__filter_post', $_POST); 23 | $data = ct_get_fields_any($input_array); 24 | $data['register'] = true; 25 | return $data; 26 | } 27 | return null; 28 | } 29 | 30 | /** 31 | * @param $message 32 | * 33 | * @psalm-suppress UnusedVariable 34 | */ 35 | public function doBlock($message) 36 | { 37 | global $ct_comment; 38 | $ct_comment = $message; 39 | ct_die(null, null); 40 | } 41 | 42 | public function allow() 43 | { 44 | return $this->user_data; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/ElementorUltimateAddonsRegister.php: -------------------------------------------------------------------------------- 1 | false, 26 | 'error' => array( 27 | 'email' => $message 28 | ) 29 | ) 30 | ); 31 | return false; 32 | } 33 | 34 | public function allow() 35 | { 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/ElfsightContactForm.php: -------------------------------------------------------------------------------- 1 | array( 29 | 'blocked' => true, 30 | 'comment' => $message, 31 | 'stop_script' => 1 32 | ) 33 | ) 34 | ) 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/EventsManager.php: -------------------------------------------------------------------------------- 1 | getArray(); 19 | } 20 | 21 | public function doBlock($message) 22 | { 23 | if ( Post::hasString('action', 'em_booking_validate_after') ) { 24 | if ( Get::get('callback') ) { 25 | $callback = htmlspecialchars(TT::toString(Get::get('callback')), ENT_QUOTES); 26 | $output = array( 27 | 'result' => false, 28 | 'message' => '', 29 | 'errors' => $message, 30 | ); 31 | die($callback . '(' . json_encode($output) . ')'); 32 | } 33 | return false; 34 | } 35 | 36 | // Events Manager Booking Form Integration 37 | if ( 38 | Post::hasString('action', 'booking_add') || 39 | Post::hasString('action', 'em_booking_add') 40 | ) { 41 | die( 42 | json_encode( 43 | array( 44 | 'success' => false, 45 | 'result' => false, 46 | 'message' => $message, 47 | ) 48 | ) 49 | ); 50 | } 51 | } 52 | 53 | public function allow() 54 | { 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/FluentBookingPro.php: -------------------------------------------------------------------------------- 1 | 'failed', 29 | 'message' => $message 30 | ], 422); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/Forminator.php: -------------------------------------------------------------------------------- 1 | $value) { 16 | if (is_string($key) && strpos($key, 'name-') === 0) { 17 | $username = $value; 18 | continue; 19 | } 20 | if (is_string($key) && strpos($key, 'email-') === 0) { 21 | $email = trim(str_replace(' ', '', TT::toString($value))); 22 | } 23 | } 24 | 25 | $tmp_data = ct_gfa(apply_filters('apbct__filter_post', $data)); 26 | 27 | if ($username !== '') { 28 | $tmp_data['nickname'] = $username; 29 | } 30 | 31 | if ($email !== '') { 32 | $tmp_data['email'] = $email; 33 | } 34 | 35 | return $tmp_data; 36 | } 37 | 38 | public function doBlock($message) 39 | { 40 | wp_send_json_error( 41 | array( 42 | 'message' => $message, 43 | 'success' => false, 44 | 'errors' => array(), 45 | 'behav' => 'behaviour-thankyou', 46 | ) 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/GiveWP.php: -------------------------------------------------------------------------------- 1 | false, 44 | 'data' => [ 45 | 'success' => false, 46 | 'message' => '', 47 | 'errors' => [ 48 | $message 49 | ] 50 | ] 51 | ]; 52 | 53 | wp_send_json($data); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/IndeedUltimateMembershipPro.php: -------------------------------------------------------------------------------- 1 | return_argument = $argument; 15 | 16 | $input_array = apply_filters('apbct__filter_post', $_POST); 17 | 18 | $user_email = TT::toString(Post::get('user_email')); 19 | 20 | $data = ct_gfa($input_array, $user_email); 21 | 22 | $data['register'] = true; 23 | 24 | return $data; 25 | } 26 | 27 | public function doBlock($message) 28 | { 29 | global $ct_comment; 30 | $ct_comment = $message; 31 | ct_die(null, null); 32 | } 33 | 34 | public function allow() 35 | { 36 | return $this->return_argument; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/IntegrationBase.php: -------------------------------------------------------------------------------- 1 | false, 16 | 'html' => '
' . $message . '
', 17 | 'headers_sent' => false, 18 | 'success' => true, 19 | 'show_message' => true 20 | ]; 21 | wp_send_json($data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/KadenceBlocksAdvanced.php: -------------------------------------------------------------------------------- 1 | false, 16 | 'html' => '
' . $message . '
', 17 | 'headers_sent' => false, 18 | 'success' => false, 19 | 'show_message' => true 20 | ]; 21 | wp_send_json_error($data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/KaliForms.php: -------------------------------------------------------------------------------- 1 | 'ok', 36 | 'thank_you_message' => $message 37 | )) 38 | ); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/LandingPageBuilder.php: -------------------------------------------------------------------------------- 1 | getArray(); 13 | $data['register'] = true; 14 | return $data; 15 | } 16 | 17 | public function doBlock($message) 18 | { 19 | die( 20 | json_encode( 21 | array( 22 | 'registered' => false, 23 | 'message' => $message, 24 | ) 25 | ) 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/LoginSignupPopup.php: -------------------------------------------------------------------------------- 1 | getArray(); 21 | $data['register'] = true; 22 | 23 | return $data; 24 | } 25 | } 26 | 27 | /** 28 | * @inheritDoc 29 | */ 30 | public function doBlock($message) 31 | { 32 | header('Content-Type: application/json; charset=utf-8'); 33 | $result = array( 34 | 'error' => 1, 35 | 'error_code' => 'registration-error', 36 | 'notice' => "
$message
", 37 | ); 38 | die(json_encode($result)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/MailPoet.php: -------------------------------------------------------------------------------- 1 | [ 53 | [ 54 | 'error' => 'bad_request', 55 | 'message' => $message 56 | ] 57 | ], 58 | ), 59 | 403 60 | ); 61 | die(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/MailPoet2.php: -------------------------------------------------------------------------------- 1 | stats['no_cookie_data_taken'] ) { 27 | apbct_form__get_no_cookie_data(['ct_no_cookie_hidden_field' => $value['value']]); 28 | continue; 29 | } 30 | $prepared_data[$value['name']] = $value['value']; 31 | } 32 | } 33 | /** 34 | * Filter for POST 35 | */ 36 | $input_array = apply_filters('apbct__filter_post', $prepared_data); 37 | $request_parameters = ct_get_fields_any($input_array); 38 | $request_parameters['event_token'] = $event_token; 39 | return $request_parameters; 40 | } 41 | } 42 | 43 | public function doBlock($message) 44 | { 45 | $result = array('result' => false, 'msgs' => array('updated' => array($message))); 46 | print htmlspecialchars(TT::toString(Get::get('callback')), ENT_QUOTES) . '(' . json_encode($result) . ');'; 47 | die(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/MemberPress.php: -------------------------------------------------------------------------------- 1 | return_argument = $argument; 23 | if ( 24 | apbct_is_plugin_active('memberpress/memberpress.php') 25 | && ! empty($_POST) 26 | && Post::get('user_email') 27 | && Post::get('user_login') 28 | ) { 29 | /** 30 | * Filter for POST 31 | */ 32 | $input_array = apply_filters('apbct__filter_post', $_POST); 33 | $data = ct_get_fields_any($input_array); 34 | $data['register'] = true; 35 | 36 | return $data; 37 | } 38 | 39 | return null; 40 | } 41 | 42 | /** 43 | * @param $message 44 | * 45 | * @return array 46 | * @psalm-suppress UnusedVariable 47 | */ 48 | public function doBlock($message) 49 | { 50 | global $ct_comment; 51 | $ct_comment = ! empty($ct_comment) ?: 'Forbidden. Spam registration detected.'; 52 | 53 | return array('user_email' => $ct_comment); 54 | } 55 | 56 | public function allow() 57 | { 58 | return $this->return_argument; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/ModernEventsCalendar.php: -------------------------------------------------------------------------------- 1 | settings['data__protect_logged_in'] == 0 && is_user_logged_in() ) { 14 | do_action('apbct_skipped_request', __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__, $_POST); 15 | return null; 16 | } 17 | 18 | if ( Request::get('book') && Request::get('step') == 2 ) { 19 | /** 20 | * Filter for POST 21 | */ 22 | $input_array = apply_filters('apbct__filter_post', Request::get('book')); 23 | 24 | return ct_gfa($input_array); 25 | } 26 | 27 | return null; 28 | } 29 | 30 | public function doBlock($message) 31 | { 32 | $output = array('success' => 0, 'message' => $message); 33 | wp_send_json($output); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/NewUserApprove.php: -------------------------------------------------------------------------------- 1 | return_argument = $argument; 14 | 15 | if ( 16 | ( 17 | apbct_is_plugin_active('new-user-approve/new-user-approve.php') 18 | || 19 | apbct_is_plugin_active('new-user-approve-premium/new-user-approve.php') 20 | ) 21 | && !empty($_POST) 22 | && Post::get('user_email') 23 | && Post::get('user_login') 24 | ) { 25 | $input_array = apply_filters('apbct__filter_post', $_POST); 26 | $data = ct_get_fields_any($input_array); 27 | $data['register'] = true; 28 | 29 | return $data; 30 | } 31 | 32 | return null; 33 | } 34 | 35 | /** 36 | * @param $message 37 | * 38 | * @return void 39 | */ 40 | public function doBlock($message) 41 | { 42 | wp_die($message); 43 | } 44 | 45 | public function allow() 46 | { 47 | return $this->return_argument; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/Newsletter.php: -------------------------------------------------------------------------------- 1 | getArray(); 38 | if ( Post::getString('ct_bot_detector_event_token') ) { 39 | $data['event_token'] = Post::get('ct_bot_detector_event_token'); 40 | } 41 | return $data; 42 | } 43 | return null; 44 | } 45 | 46 | /** 47 | * @inheritDoc 48 | */ 49 | public function doBlock($message) 50 | { 51 | global $ct_comment; 52 | $ct_comment = $message; 53 | ct_die($message, 403); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/NextendSocialLogin.php: -------------------------------------------------------------------------------- 1 | $argument->getAuthUserData('email') ?: '', 16 | 'nickname' => $argument->getAuthUserData('name') ?: '', 17 | ) 18 | ); 19 | } 20 | } 21 | 22 | public function doBlock($message) 23 | { 24 | global $ct_comment; 25 | $ct_comment = $message; 26 | ct_die(null, null); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/OtterBlocksForm.php: -------------------------------------------------------------------------------- 1 | form_data_request = $argument; 17 | Cookie::$force_alt_cookies_global = true; 18 | 19 | /** 20 | * @psalm-suppress UndefinedClass 21 | */ 22 | if ( 23 | class_exists('\ThemeIsle\GutenbergBlocks\Integration\Form_Data_Request') && 24 | $argument instanceof \ThemeIsle\GutenbergBlocks\Integration\Form_Data_Request && 25 | method_exists($this->form_data_request, 'get_fields') 26 | ) { 27 | $fields = $this->form_data_request->get_fields(); 28 | if ( 29 | isset($fields) && 30 | is_array($fields) 31 | ) { 32 | $form_data = []; 33 | foreach ( $fields as $input_info ) { 34 | if ( isset($input_info['id'], $input_info['value']) ) { 35 | $form_data[] = [ 36 | $input_info['id'] => $input_info['value'] 37 | ]; 38 | } 39 | } 40 | if ( count($form_data) ) { 41 | $gfa_result = ct_gfa($form_data); 42 | $event_token = Cookie::get('ct_bot_detector_event_token'); 43 | if ( $event_token ) { 44 | $gfa_result['event_token'] = $event_token; 45 | } 46 | return $gfa_result; 47 | } 48 | } 49 | } 50 | return $argument; 51 | } 52 | 53 | /** 54 | * @inheritDoc 55 | * @throws \Exception 56 | */ 57 | public function doBlock($message) 58 | { 59 | if ( method_exists($this->form_data_request, 'set_error') ) { 60 | $this->form_data_request->set_error('110', $message); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/OvaLogin.php: -------------------------------------------------------------------------------- 1 | is_spammer = $argument; 17 | 18 | /** 19 | * Filter for POST 20 | */ 21 | $input_array = apply_filters('apbct__filter_post', $_POST); 22 | 23 | $output = ct_gfa($input_array); 24 | $output['register'] = true; 25 | 26 | if ( Post::get('ct_bot_detector_event_token') ) { 27 | $output['event_token'] = Post::get('ct_bot_detector_event_token'); 28 | } 29 | 30 | return $output; 31 | } 32 | 33 | /** 34 | * @inheritDoc 35 | */ 36 | public function doBlock($message) 37 | { 38 | return $message; 39 | } 40 | 41 | public function allow() 42 | { 43 | return $this->is_spammer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/PiotnetAddonsForElementorPro.php: -------------------------------------------------------------------------------- 1 | array( 50 | 'blocked' => true, 51 | 'comment' => $message, 52 | 'stop_script' => apbct__stop_script_after_ajax_checking() 53 | ) 54 | ) 55 | ) 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/PlansoFormBuilder.php: -------------------------------------------------------------------------------- 1 | receiver_email = $argument; 12 | 13 | $input_array = apply_filters('apbct__filter_post', $_POST); 14 | return ct_gfa($input_array); 15 | } 16 | 17 | public function doBlock($message) 18 | { 19 | global $ct_comment; 20 | $ct_comment = $message; 21 | ct_die(null, null); 22 | } 23 | 24 | public function allow() 25 | { 26 | return $this->receiver_email; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/Rafflepress.php: -------------------------------------------------------------------------------- 1 | false, 22 | 'errors' => $message, 23 | 'contestant' => array(), 24 | ) 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/SendyWidgetPro.php: -------------------------------------------------------------------------------- 1 | return_argument = []; 16 | 17 | $input_array = apply_filters('apbct__filter_post', $_POST); 18 | 19 | if (!empty($_POST['formdata'])) { 20 | $this->return_argument = $_POST['formdata']; 21 | } 22 | 23 | return ct_gfa($input_array); 24 | } 25 | 26 | public function doBlock($message) 27 | { 28 | die($message); 29 | } 30 | 31 | public function allow() 32 | { 33 | $_POST['formdata'] = $this->return_argument; 34 | 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/SimpleMembership.php: -------------------------------------------------------------------------------- 1 | member_info = $member_info; 12 | 13 | return ( 14 | array( 15 | 'email' => $member_info['email'], 16 | 'nickname' => $member_info['user_name'], 17 | ) 18 | ); 19 | } 20 | 21 | /** 22 | * @param $message 23 | * 24 | * @psalm-suppress UnusedVariable 25 | * @psalm-suppress UndefinedClass 26 | */ 27 | public function doBlock($message) 28 | { 29 | global $ct_comment; 30 | $ct_comment = $message; 31 | 32 | if (class_exists('SwpmMembers') ) { 33 | $member = \SwpmMemberUtils::get_user_by_email($this->member_info['email']); 34 | $member_id = $member->member_id; 35 | \SwpmMembers::delete_user_by_id($member_id); 36 | } 37 | 38 | ct_die(null, null); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/SmartForms.php: -------------------------------------------------------------------------------- 1 | $message, 34 | 'refreshCaptcha' => 'n', 35 | 'success' => 'n' 36 | ); 37 | print json_encode($result); 38 | die(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/SmartQuizBuilder.php: -------------------------------------------------------------------------------- 1 | getArray(); 16 | $data['message'] = ''; 17 | return $data; 18 | } 19 | 20 | public function doBlock($message) 21 | { 22 | echo json_encode( 23 | array( 24 | 'apbct' => array( 25 | 'blocked' => true, 26 | 'comment' => $message, 27 | 'stop_script' => apbct__stop_script_after_ajax_checking() 28 | ) 29 | ) 30 | ); 31 | die(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/StrongTestimonials.php: -------------------------------------------------------------------------------- 1 | false, 36 | 'errors' => array( 37 | 'email' => $message) 38 | ); 39 | echo json_encode($return); 40 | wp_die(); 41 | } else { 42 | wp_die($message); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/Supsystic.php: -------------------------------------------------------------------------------- 1 | true, 37 | 'errors' => [ 38 | $message 39 | ] 40 | ]; 41 | die(json_encode($out, JSON_FORCE_OBJECT)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/Tevolution.php: -------------------------------------------------------------------------------- 1 | array( 42 | 'blocked' => true, 43 | 'comment' => $message, 44 | 'stop_script' => apbct__stop_script_after_ajax_checking() 45 | ) 46 | ) 47 | ) 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/TourMasterRegister.php: -------------------------------------------------------------------------------- 1 | $message 35 | ) 36 | ); 37 | die(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/VisualFormBuilder.php: -------------------------------------------------------------------------------- 1 | return_argument = $argument; 15 | if ( 16 | ( 17 | apbct_is_plugin_active('user-meta/user-meta.php') 18 | || 19 | apbct_is_plugin_active('user-meta-pro/user-meta.php') 20 | ) 21 | && !empty($_POST) 22 | && Post::get('user_email') 23 | && Post::get('user_login') 24 | ) { 25 | /** 26 | * Filter for POST 27 | */ 28 | $input_array = apply_filters('apbct__filter_post', $_POST); 29 | $data = ct_get_fields_any($input_array); 30 | $data['register'] = true; 31 | 32 | return $data; 33 | } 34 | 35 | return null; 36 | } 37 | 38 | /** 39 | * @param $message 40 | * 41 | * @return WP_Error 42 | * @psalm-suppress UnusedVariable 43 | */ 44 | public function doBlock($message) 45 | { 46 | return new WP_Error('invalid_email', $message); 47 | } 48 | 49 | public function allow() 50 | { 51 | return $this->return_argument; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/WPZOOMForms.php: -------------------------------------------------------------------------------- 1 | getArray(); 29 | $data['message'] = $message; 30 | return $data; 31 | } 32 | 33 | /** 34 | * How to handle CleanTalk forbidden result. 35 | * @param $message 36 | * @return void 37 | */ 38 | public function doBlock($message) 39 | { 40 | ct_die_extended($message); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/WordpressFileUpload.php: -------------------------------------------------------------------------------- 1 | return_argument = $argument; 15 | if ( Request::get('userdata') && function_exists('wfu_plugin_decode_string') ) { 16 | $userdata = explode(";", TT::toString(Request::get('userdata'))); 17 | $parsed_userdata = []; 18 | foreach ($userdata as $_user) { 19 | $parsed_userdata[] = strip_tags(wfu_plugin_decode_string(trim(substr($_user, 1)))); 20 | } 21 | 22 | $input_array = apply_filters('apbct__filter_post', $parsed_userdata); 23 | 24 | $data = ct_gfa($input_array); 25 | 26 | if ( isset($_REQUEST['data']['ct_bot_detector_event_token']) ) { 27 | $data['event_token'] = $_REQUEST['data']['ct_bot_detector_event_token']; 28 | } 29 | if ( isset($_REQUEST['data']['ct_no_cookie_hidden_field']) ) { 30 | $data['ct_no_cookie_hidden_field'] = $_REQUEST['data']['ct_no_cookie_hidden_field']; 31 | } 32 | 33 | unset($_REQUEST['data']); 34 | 35 | return $data; 36 | } 37 | } 38 | 39 | public function doBlock($message) 40 | { 41 | return ["error_message" => wp_strip_all_tags($message)]; 42 | } 43 | 44 | public function allow() 45 | { 46 | return $this->return_argument; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/WpBookingSystem.php: -------------------------------------------------------------------------------- 1 | stats['no_cookie_data_taken'] ) { 21 | apbct_form__get_no_cookie_data($data); 22 | } 23 | 24 | return ct_get_fields_any($input_array); 25 | } 26 | 27 | public function doBlock($message) 28 | { 29 | $out = array( 30 | 'success' => false, 31 | 'html' => $message 32 | ); 33 | die(json_encode($out, JSON_FORCE_OBJECT)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/WpForo.php: -------------------------------------------------------------------------------- 1 | data->user_email)) { 13 | /** 14 | * Filter for POST 15 | */ 16 | $input_array = apply_filters('apbct__filter_post', $_POST); 17 | 18 | return ct_get_fields_any($input_array, $user->data->user_email); 19 | } 20 | } 21 | 22 | return array(); 23 | } 24 | 25 | public function doBlock($message) 26 | { 27 | wp_die($message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/WpGeoDirectory.php: -------------------------------------------------------------------------------- 1 | return_argument = $argument; 15 | 16 | if ( 17 | ( 18 | apbct_is_plugin_active('geodirectory/geodirectory.php') && 19 | Post::get('action') === 'geodir_save_post' 20 | ) 21 | ) { 22 | apbct_form__get_no_cookie_data($_POST); 23 | $email = TT::toString(Post::get('email')); 24 | $input_array = apply_filters('apbct__filter_post', $_POST); 25 | $gfa_checked_data = ct_gfa($input_array, $email); 26 | if ( Post::get('ct_bot_detector_event_token') ) { 27 | $gfa_checked_data['event_token'] = Post::get('ct_bot_detector_event_token'); 28 | } 29 | 30 | $gfa_checked_data['message'] = isset($gfa_checked_data['message']) ? apbct__filter_form_data($gfa_checked_data['message']) : ''; 31 | if ( isset($gfa_checked_data['message']['apbct_visible_fields']) ) { 32 | unset($gfa_checked_data['message']['apbct_visible_fields']); 33 | } 34 | 35 | return $gfa_checked_data; 36 | } 37 | 38 | return null; 39 | } 40 | 41 | /** 42 | * @param $message 43 | * 44 | * @return void 45 | */ 46 | public function doBlock($message) 47 | { 48 | wp_send_json_error($message); 49 | } 50 | 51 | public function allow() 52 | { 53 | return $this->return_argument; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Cleantalk/Antispam/Integrations/WpMembers.php: -------------------------------------------------------------------------------- 1 | info = $info; 19 | } 20 | 21 | /** 22 | * Run 23 | * @return void 24 | */ 25 | public function run() 26 | { 27 | if (!$this->isEnvReversedOnce()) { 28 | $this->doAdjust(); 29 | } 30 | } 31 | 32 | /** 33 | * Run one 34 | * @return void 35 | * @psalm-suppress PossiblyUnusedMethod 36 | */ 37 | public function runOne() 38 | { 39 | if (!$this->hasEnvBeenAdjustedByModule()) { 40 | $this->doAdjust(); 41 | } 42 | } 43 | 44 | public function getUpdatedInfo() 45 | { 46 | return $this->info; 47 | } 48 | 49 | /** 50 | * Check if need to adjust 51 | * @return bool 52 | */ 53 | abstract protected function isEnvReversedOnce(); 54 | 55 | /** 56 | * Check if need to adjust 57 | * @return bool 58 | */ 59 | abstract protected function isEnvComplyToAdjustRequires(); 60 | 61 | /** 62 | * Check if need to adjust 63 | * @return bool 64 | */ 65 | abstract protected function hasEnvBeenAdjustedByModule(); 66 | 67 | /** 68 | * Adjust 69 | * @return void 70 | */ 71 | abstract protected function doAdjust(); 72 | 73 | /** 74 | * Reverse the adjustments made by the adjust() method 75 | * @return void 76 | * @psalm-suppress PossiblyUnusedMethod 77 | */ 78 | abstract protected function doReverseAdjust(); 79 | 80 | /** 81 | * Keep info what we changed 82 | * @return void 83 | * @psalm-suppress PossiblyUnusedMethod 84 | */ 85 | abstract protected function keepEnvChangesByModule(); 86 | 87 | /** 88 | * This method is prepared to get current state of env. It will be required to handle this in realtime. 89 | * @return mixed 90 | * @psalm-suppress PossiblyUnusedMethod 91 | */ 92 | abstract public function isEnvInRequiredStateNow(); 93 | } 94 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/AdjustToEnvironmentModule/Exceptions/ExceptionReverseAdjustClassNotExists.php: -------------------------------------------------------------------------------- 1 | getArrayCopy(); 17 | } 18 | 19 | $external = !empty($settings['forms__check_external']) && $settings['forms__check_external'] === '1'; 20 | $internal = !empty($settings['forms__check_internal']) && $settings['forms__check_internal'] === '1'; 21 | 22 | if ($external && $internal) { 23 | return 'apbct-public-bundle_full-protection_comm-func.js'; 24 | } elseif ($external) { 25 | return 'apbct-public-bundle_ext-protection_comm-func.js'; 26 | } elseif ($internal) { 27 | return 'apbct-public-bundle_int-protection_comm-func.js'; 28 | } else { 29 | return 'apbct-public-bundle_comm-func.js'; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/ApbctUniversalBanner.php: -------------------------------------------------------------------------------- 1 | type)) { 14 | $this->banner_type = $banner_data->type; 15 | } 16 | parent::__construct($banner_data); 17 | } 18 | 19 | protected function sanitizeBodyOnEcho($body) 20 | { 21 | if ($this->banner_type === 'server_requirements') { 22 | return $body; 23 | } 24 | 25 | return Escape::escKsesPreset($body, 'apbct_settings__display__banner_template'); 26 | } 27 | 28 | protected function showBannerButton() 29 | { 30 | if (apbct_is_in_uri('options-general.php?page=cleantalk')) { 31 | return false; 32 | } 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/CleantalkRealPerson.php: -------------------------------------------------------------------------------- 1 | [ 12 | 'trpHeading' => esc_html__('The Real Person Badge!', 'cleantalk-spam-protect'), 13 | 'trpContent1' => esc_html__('The commenter acts as a real person and verified as not a bot.', 'cleantalk-spam-protect'), 14 | 'trpContent2' => esc_html__('Passed all tests against spam bots. Anti-Spam by CleanTalk.', 'cleantalk-spam-protect'), 15 | 'trpContentLearnMore' => esc_html__('Learn more', 'cleantalk-spam-protect'), 16 | ], 17 | 'trpContentLink' => esc_attr(LinkConstructor::buildCleanTalkLink('trp_learn_more_link', 'the-real-person')), 18 | 'imgPersonUrl' => esc_attr(APBCT_URL_PATH . '/css/images/real_user.svg'), 19 | 'imgShieldUrl' => esc_attr(APBCT_URL_PATH . '/css/images/shield.svg'), 20 | ]; 21 | return $localize_array; 22 | } 23 | 24 | public function __construct() 25 | { 26 | // Check comment meta 'ct_real_user_badge_hash' and add comment class 'apbct-trp' during 'comment_class' hook 27 | add_filter('comment_class', [$this, 'publicCommentAddTrpClass'], 10, 5); 28 | } 29 | 30 | public function publicCommentAddTrpClass($classes, $_css_class, $comment_id, $comment, $_post) 31 | { 32 | $ct_hash = get_comment_meta((int)$comment_id, 'ct_real_user_badge_hash', true); 33 | if ( $ct_hash && $comment->comment_author ) { 34 | $classes[] = 'apbct-trp'; 35 | return $classes; 36 | } 37 | return $classes; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/CleantalkUpgraderSkin.php: -------------------------------------------------------------------------------- 1 | upgrader->apbct_result = $errors->get_error_code(); 46 | } else { 47 | $this->upgrader->apbct_result = $this->upgrader->strings[$errors]; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/CleantalkUpgraderSkinDeprecated.php: -------------------------------------------------------------------------------- 1 | upgrader->apbct_result = $errors->get_error_code(); 49 | } else { 50 | $this->upgrader->apbct_result = $this->upgrader->strings[$errors]; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/Cron.php: -------------------------------------------------------------------------------- 1 | cron_option_name, $tasks); 47 | } 48 | 49 | /** 50 | * Getting all tasks 51 | * 52 | * @return array 53 | */ 54 | public function getTasks() 55 | { 56 | global $wpdb; 57 | 58 | $result = $wpdb->get_var( 59 | $wpdb->prepare( 60 | "SELECT option_value FROM {$wpdb->options} WHERE option_name = %s AND " . rand(1, 100000) . " > 0", 61 | $this->cron_option_name 62 | ) 63 | ); 64 | 65 | if (!$result) { 66 | return array(); 67 | } 68 | 69 | // First unserialize the outer string 70 | $unserialized = unserialize($result); 71 | 72 | // If the unserialized data is still a string, it needs to be unserialized again 73 | if (is_string($unserialized)) { 74 | $unserialized = unserialize($unserialized); 75 | } 76 | 77 | return is_array($unserialized) ? $unserialized : array(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/DTO/GetFieldsAnyDTO.php: -------------------------------------------------------------------------------- 1 | 13 | *
  • email(string)
  • 14 | *
  • emails_array(string[])
  • 15 | *
  • nickname(string)
  • 16 | *
  • subject(string)
  • 17 | *
  • contact(bool)
  • 18 | *
  • message(string[])
  • 19 | * 20 | * 21 | * To get assoc array of all properties use getArray() method. 22 | * @since 6.48 23 | * @version 1.0.0 24 | * @package Cleantalk\ApbctWP\DTO 25 | * @psalm-suppress InvalidClass 26 | */ 27 | class GetFieldsAnyDTO extends DTO 28 | { 29 | /** 30 | * Sender email. 31 | * @var string 32 | */ 33 | public $email = ''; 34 | /** 35 | * Array of emails. 36 | * @var array 37 | */ 38 | public $emails_array = array(); 39 | /** 40 | * Nickname. 41 | * Will be concatenated from nickname_first, nickname_last and nickname_nick if not provided during processing. 42 | * @var string 43 | */ 44 | public $nickname = ''; 45 | /** 46 | * Nickname first part. 47 | * @var string 48 | */ 49 | public $nickname_first = ''; 50 | /** 51 | * Nickname last part. 52 | * @var string 53 | */ 54 | public $nickname_last = ''; 55 | /** 56 | * Nickname nick part. 57 | * @var string 58 | */ 59 | public $nickname_nick = ''; 60 | /** 61 | * Subject. 62 | * @var string 63 | */ 64 | public $subject = ''; 65 | /** 66 | * Is contact form? 67 | * @var bool 68 | * @psalm-suppress PossiblyUnusedProperty 69 | */ 70 | public $contact = true; 71 | /** 72 | * Message array. 73 | * @var array 74 | */ 75 | public $message = array(); 76 | 77 | /** 78 | * Is registration form? 79 | * @var bool 80 | * @psalm-suppress PossiblyUnusedProperty 81 | */ 82 | public $register = false; 83 | 84 | protected $obligatory_properties = array( 85 | 'email', 86 | 'emails_array', 87 | 'nickname', 88 | 'subject', 89 | 'contact', 90 | 'message', 91 | ); 92 | 93 | public function __construct($params) 94 | { 95 | parent::__construct($params); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/FindSpam/ListTable/UsersLogs.php: -------------------------------------------------------------------------------- 1 | '', 15 | 'ct_start' => esc_html__('Start time', 'cleantalk-spam-protect'), 16 | 'ct_checked' => esc_html__('Checked', 'cleantalk-spam-protect'), 17 | 'ct_spam' => esc_html__('Found spam', 'cleantalk-spam-protect'), 18 | 'ct_bad' => esc_html__('Found bad', 'cleantalk-spam-protect'), 19 | ); 20 | } 21 | 22 | public function prepare_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps 23 | { 24 | $logs = $this->getScansLogs(); 25 | 26 | foreach ( $logs as $log ) { 27 | $this->items[] = array( 28 | 'ct_id' => $log['id'], 29 | 'ct_start' => $log['start_time'], 30 | 'ct_checked' => $log['count_to_scan'], 31 | 'ct_spam' => $log['found_spam'], 32 | 'ct_bad' => $log['found_bad'], 33 | ); 34 | } 35 | } 36 | 37 | public function get_bulk_actions() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps 38 | { 39 | return array( 40 | 'delete' => 'Delete log' 41 | ); 42 | } 43 | 44 | public function bulk_actions_handler() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps 45 | { 46 | if ( empty(Post::get('spamids')) || empty(Post::get('_wpnonce')) ) { 47 | return; 48 | } 49 | 50 | if ( ! $this->current_action() ) { 51 | return; 52 | } 53 | 54 | $awaited_action = 'bulk-' . TT::getArrayValueAsString($this->_args, 'plural'); 55 | if ( ! wp_verify_nonce(TT::toString(Post::get('_wpnonce')), $awaited_action)) { 56 | wp_die('nonce error'); 57 | } 58 | 59 | $this->removeLogs(TT::toArray(Post::get('spamids'))); 60 | } 61 | 62 | public function no_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps 63 | { 64 | esc_html_e('No logs found.', 'cleantalk-spam-protect'); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/FindSpam/ListTable/index.php: -------------------------------------------------------------------------------- 1 | ID) { 32 | $session_tokens = get_user_meta($wp_user->ID, 'session_tokens', true); 33 | $data = reset($session_tokens); 34 | if ($data) { 35 | $ip = TT::getArrayValueAsString($data, 'ip'); 36 | if ( Helper::ipValidate($ip) ) { 37 | update_user_meta($wp_user->ID, self::$wp_meta_name, $ip); 38 | } 39 | } 40 | } 41 | } 42 | 43 | /** 44 | * Retrieves data from user meta of a user by his user ID. 45 | * 46 | * @param int|string $user_id User ID to search for. 47 | * 48 | * @return string|null The selected record property value of user meta data. 49 | * @psalm-suppress PossiblyUnusedMethod 50 | */ 51 | public function getIP($user_id) 52 | { 53 | $user_id = TT::toInt($user_id); 54 | $ip = get_user_meta($user_id, self::$wp_meta_name, true); 55 | return Helper::ipValidate($ip) ? $ip : null; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/FindSpam/index.php: -------------------------------------------------------------------------------- 1 | $apbct->ajax_service->getPublicNonce(), 20 | '_rest_nonce' => wp_create_nonce('wp_rest'), 21 | '_ajax_url' => admin_url('admin-ajax.php', 'relative'), 22 | '_rest_url' => Escape::escUrl(apbct_get_rest_url()), 23 | 'data__cookies_type' => $apbct->data['cookies_type'], 24 | 'data__ajax_type' => $apbct->data['ajax_type'], 25 | 'data__bot_detector_enabled' => $apbct->settings['data__bot_detector_enabled'], 26 | 'data__frontend_data_log_enabled' => defined('APBCT_DO_NOT_COLLECT_FRONTEND_DATA_LOGS') ? 0 : 1, 27 | 'cookiePrefix' => apbct__get_cookie_prefix(), 28 | 'wprocket_detected' => apbct_is_plugin_active('wp-rocket/wp-rocket.php'), 29 | 'host_url' => Server::get('HTTP_HOST'), 30 | ); 31 | $data = array_merge($data, EmailEncoder::getLocalizationText()); 32 | 33 | return $data; 34 | } 35 | 36 | public static function getCode() 37 | { 38 | return ' 39 | 42 | '; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/Localize/LocalizeHandler.php: -------------------------------------------------------------------------------- 1 | logging_data = $logging_data; 25 | $this->message = $this->createMessage(); 26 | } 27 | 28 | /** 29 | * Write log 30 | * 31 | * @return void 32 | */ 33 | public function writeLog() 34 | { 35 | error_log( 36 | $this->message 37 | ); 38 | } 39 | 40 | /** 41 | * Create message 42 | * 43 | * @return string 44 | */ 45 | private function createMessage() 46 | { 47 | $substring = ''; 48 | 49 | // logging_data - string 50 | if (is_string($this->logging_data)) { 51 | return $this->logging_data; 52 | } 53 | 54 | // logging_data - array 55 | foreach ($this->logging_data as $key => $data) { 56 | // if data is array 57 | if (is_array($data)) { 58 | $substring2 = ''; 59 | 60 | foreach ($data as $param => $value) { 61 | $substring2 .= "$param: $value; "; 62 | } 63 | 64 | $substring .= "[$key]: $substring2; "; 65 | } else { 66 | $substring .= "$key: $data; "; 67 | } 68 | } 69 | 70 | return $substring; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/RequestParameters/index.php: -------------------------------------------------------------------------------- 1 | public_name, [$this, 'callback']); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/Cleantalk/ApbctWP/Transaction.php: -------------------------------------------------------------------------------- 1 | args = isset($params['args']) ? $params['args'] : false; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/Cleantalk/Common/Escape.php: -------------------------------------------------------------------------------- 1 | raw = $raw; 22 | $this->processed = $raw; 23 | $this->info = $info; 24 | $this->error = ! empty($raw['error']) 25 | ? $raw 26 | : null; 27 | if ( isset($this->info['http_code']) ) { 28 | $this->response_code = (int)$this->info['http_code']; 29 | } 30 | } 31 | 32 | /** 33 | * @return mixed 34 | */ 35 | public function getError() 36 | { 37 | return $this->error; 38 | } 39 | 40 | /** 41 | * @return mixed 42 | */ 43 | public function getResponseCode() 44 | { 45 | return $this->response_code; 46 | } 47 | 48 | /** 49 | * @return mixed 50 | */ 51 | public function getContentRaw() 52 | { 53 | return $this->raw; 54 | } 55 | 56 | /** 57 | * @return mixed 58 | */ 59 | public function getContentProcessed() 60 | { 61 | return $this->processed; 62 | } 63 | 64 | /** 65 | * @param mixed $processed 66 | */ 67 | public function setProcessed($processed) 68 | { 69 | $this->processed = $processed; 70 | } 71 | 72 | /** 73 | * @return mixed 74 | */ 75 | public function getInfo() 76 | { 77 | return $this->info; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/Cleantalk/Common/HTTP/index.php: -------------------------------------------------------------------------------- 1 | option_prefix = $option_prefix; 33 | $this->options = $options; 34 | $this->setOptions(); 35 | $this->setDefinitions(); 36 | $this->init(); 37 | } 38 | 39 | /** 40 | * Define necessary constants 41 | */ 42 | abstract protected function setDefinitions(); 43 | 44 | /** 45 | * Get options from the database 46 | * Set it to object 47 | */ 48 | abstract protected function setOptions(); 49 | 50 | /** 51 | * Adding some dynamic properties 52 | */ 53 | abstract protected function init(); 54 | 55 | 56 | abstract protected function getOption($option_name); 57 | 58 | abstract public function save($option_name, $use_prefix = true, $autoload = true); 59 | 60 | /** 61 | * @param $option_name 62 | * @param false $use_prefix 63 | * 64 | * @return void 65 | * @psalm-suppress PossiblyUnusedMethod 66 | */ 67 | abstract public function deleteOption($option_name, $use_prefix = false); 68 | } 69 | -------------------------------------------------------------------------------- /lib/Cleantalk/Common/UniversalBanner/BannerDataDto.php: -------------------------------------------------------------------------------- 1 | 2 |

    {{BANNER_TEXT}}

    3 |

    {{BANNER_SECONDARY_TEXT}}

    4 | {{BUTTON_TEXT}} 5 |

    {{BANNER_ADDITIONAL_TEXT}}

    6 |
    7 | -------------------------------------------------------------------------------- /lib/Cleantalk/Common/UniversalBanner/universal_banner_without_btn_template.html: -------------------------------------------------------------------------------- 1 |
    2 |

    {{BANNER_TEXT}}

    3 |

    {{BANNER_SECONDARY_TEXT}}

    4 |

    {{BANNER_ADDITIONAL_TEXT}}

    5 |
    6 | -------------------------------------------------------------------------------- /lib/Cleantalk/Common/index.php: -------------------------------------------------------------------------------- 1 | isObligatoryParamsPresented($params) ) { 22 | throw new \Exception('No go!'); 23 | } 24 | 25 | foreach ( $params as $param_name => $param ) { 26 | if ( property_exists(static::class, $param_name) ) { 27 | $type = gettype($this->$param_name); 28 | $this->$param_name = $param; 29 | settype($this->$param_name, $type); 30 | } 31 | } 32 | } 33 | 34 | /** 35 | * @param $params 36 | * 37 | * @return bool 38 | * @since 1.1.0 39 | * 40 | */ 41 | private function isObligatoryParamsPresented($params) 42 | { 43 | return empty($this->obligatory_properties) || 44 | count(array_intersect($this->obligatory_properties, array_keys($params))) === count( 45 | $this->obligatory_properties 46 | ); 47 | } 48 | 49 | /** 50 | * Get array of all DTO properties as key-value, except obligatory_properties. 51 | * @return array 52 | */ 53 | public function getArray() 54 | { 55 | $array = array(); 56 | foreach (get_object_vars($this) as $key => $value) { 57 | $array[$key] = $value; 58 | } 59 | unset($array['obligatory_properties']); 60 | return $array; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/Cleantalk/Templates/Multiton.php: -------------------------------------------------------------------------------- 1 | init($params); 24 | } 25 | 26 | return static::$instances[$instance]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Cleantalk/Templates/Singleton.php: -------------------------------------------------------------------------------- 1 | init(...$params); 32 | } 33 | 34 | return static::$instance[static::class]; 35 | } 36 | 37 | /** 38 | * Alternative constructor 39 | * @param array $_params Parameters to initialize the instance 40 | */ 41 | protected function init(...$_params) 42 | { 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/Cleantalk/Templates/index.php: -------------------------------------------------------------------------------- 1 | variables 25 | if (! isset(static::getInstance()->variables[$name])) { 26 | if ( isset($_GET[$name]) ) { 27 | $value = $this->getAndSanitize($_GET[$name]); 28 | } else { 29 | $value = ''; 30 | } 31 | 32 | // Remember for further calls 33 | static::getInstance()->rememberVariable($name, $value); 34 | 35 | return $value; 36 | } 37 | 38 | return static::getInstance()->variables[$name]; 39 | } 40 | 41 | protected function sanitizeDefault($value) 42 | { 43 | return sanitize_textarea_field($value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/Cleantalk/Variables/Post.php: -------------------------------------------------------------------------------- 1 | variables 25 | if (! isset(static::getInstance()->variables[$name])) { 26 | if ( isset($_POST[$name]) ) { 27 | $value = $this->getAndSanitize($_POST[$name]); 28 | } else { 29 | $value = ''; 30 | } 31 | 32 | // Remember for further calls 33 | static::getInstance()->rememberVariable($name, $value); 34 | 35 | return $value; 36 | } 37 | 38 | return static::getInstance()->variables[$name]; 39 | } 40 | 41 | protected function sanitizeDefault($value) 42 | { 43 | return sanitize_textarea_field($value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/Cleantalk/Variables/Request.php: -------------------------------------------------------------------------------- 1 | variables 26 | if (isset(static::getInstance()->variables[$name])) { 27 | return static::getInstance()->variables[$name]; 28 | } 29 | 30 | $value = ''; 31 | 32 | $class_name = get_class(self::getInstance()); 33 | $reflection_class = new \ReflectionClass($class_name); 34 | $namespace = $reflection_class->getNamespaceName(); 35 | 36 | $post_class = $namespace . '\\Post'; 37 | $get_class = $namespace . '\\Get'; 38 | 39 | if ( $post_class::get($name) ) { 40 | $value = $post_class::get($name); 41 | } elseif ( $get_class::get($name) ) { 42 | $value = $get_class::get($name); 43 | } 44 | 45 | // Remember for further calls 46 | static::getInstance()->rememberVariable($name, $value); 47 | 48 | return $value; 49 | } 50 | 51 | protected function sanitizeDefault($value) 52 | { 53 | return sanitize_textarea_field($value); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Cleantalk/Variables/index.php: -------------------------------------------------------------------------------- 1 | 5 |

    %SUPPORT_BRAND% %SUPPORT_URL_TEXT%

    6 |

    %PLUGIN_HOMEPAGE_TEXT% %PLUGIN_HOMEPAGE_URL_TEXT%

    7 |

    %TEST_EMAIL_CHUNK%

    8 |

    %TRADEMARK%

    9 |

    %FEEDBACK_REQUEST%

    10 |

    %GET_PREMIUM_REQUEST%

    11 | 12 | '; 13 | -------------------------------------------------------------------------------- /templates/translate_banner.php: -------------------------------------------------------------------------------- 1 | 5 |
    ' 6 | . '

    ' 7 | . __('Help others use the plugin in your language.', 'cleantalk-spam-protect') 8 | . __( 9 | 'We ask you to help with the translation of the plugin in your language. 10 | Please take a few minutes to make the plugin more comfortable.', 11 | 'cleantalk-spam-protect' 12 | ) 13 | . '

    14 | 20 |
    21 | '; 22 | -------------------------------------------------------------------------------- /tests/.phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sniff code to check different PHP compatibility 4 | 5 | 6 | ../ 7 | /vendor/ 8 | /node_modules/ 9 | /lib/Cleantalk/ApbctWP/CleantalkListTable.php 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | tests/* 18 | vendor/* 19 | fw_files/* 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/Antispam/CleantalkTest.php: -------------------------------------------------------------------------------- 1 | ct = new Cleantalk(); 19 | $this->ct->server_url = 'https://moderate.cleantalk.org'; 20 | $this->ct_request = new CleantalkRequest(); 21 | $this->ct_request->auth_key = getenv("CLEANTALK_TEST_API_KEY"); 22 | } 23 | 24 | public function testIsAllowMessage() 25 | { 26 | $this->ct_request->sender_email = 's@cleantalk.org'; 27 | $this->ct_request->message = 'stop_word bad message'; 28 | $result = $this->ct->isAllowMessage($this->ct_request); 29 | $this->assertEquals(0, $result->allow); 30 | 31 | $this->ct_request->message = ''; 32 | $this->ct_request->sender_email = ''; 33 | } 34 | 35 | public function testIsAllowUser() 36 | { 37 | $this->ct_request->sender_email = 's@cleantalk.org'; 38 | $result = $this->ct->isAllowUser($this->ct_request); 39 | $this->assertEquals(0, $result->allow); 40 | 41 | $this->ct_request->sender_email = ''; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/Antispam/IntegrationsByHook/testWPZOOMForms.php: -------------------------------------------------------------------------------- 1 | wpzoomForms = new WPZOOMForms(); 18 | $this->post_global = $_POST; 19 | } 20 | 21 | protected function tearDown(): void 22 | { 23 | // Clean up the $_POST global variable 24 | $this->resetPostState(); 25 | } 26 | 27 | private function prepareDefaultPostData() 28 | { 29 | return array ( 30 | 'action' => 'wpzf_submit', 31 | 'form_id' => '163', 32 | '_wpnonce' => '0d142c2c7e', 33 | '_wp_http_referer' => '/wpzomm/?success=1', 34 | 'wpzf_input_name' => 'Test Name', 35 | 'wpzf_input_email' => 'test@example.com', 36 | 'wpzf_input_message' => 'Test message', 37 | 'wpzf_replyto' => 'wpzf_input_email', 38 | 'wpzf_subject' => 'wpzf_input_subject', 39 | 'apbct_visible_fields' => 'test_vfields', 40 | 'event_token' => 'test_token', 41 | ); 42 | } 43 | 44 | private function prepareExpectedDataBeforeBaseCall() 45 | { 46 | return array( 47 | 'email' => 'test@example.com', 48 | 'message' => 'Test message', 49 | 'emails_array' => Array (), 50 | 'nickname' => 'Test Name', 51 | 'nickname_first' => '', 52 | 'nickname_last' => '', 53 | 'nickname_nick' => '', 54 | 'subject' => 'wpzf_input_subject', 55 | 'contact' => true, 56 | 'register' => false 57 | ); 58 | } 59 | 60 | private function resetPostState() 61 | { 62 | $_POST = $this->post_global; 63 | } 64 | 65 | public function testGetDataForChecking() 66 | { 67 | $this->resetPostState(); //use this everytime if new test is added 68 | // Mock $_POST data 69 | $_POST = $this->prepareDefaultPostData(); 70 | 71 | // Assert the result 72 | $this->assertEquals( 73 | $this->prepareExpectedDataBeforeBaseCall(), 74 | $this->wpzoomForms->getDataForChecking(null) 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tests/Antispam/IntegrationsTest.php: -------------------------------------------------------------------------------- 1 | array( 'hook' => 'contact_bank_frontend_ajax_call', 'ajax' => true ), 21 | 'FluentForm' => array( 'hook' => 'fluentform/before_insert_submission', 'ajax' => false ), 22 | 'ElfsightContactForm' => array( 'hook' => 'elfsight_contact_form_mail', 'ajax' => true ), 23 | 'SimpleMembership' => array( 'hook' => 'swpm_front_end_registration_complete_user_data', 'ajax' => false ), 24 | 'EstimationForm' => array( 'hook' => 'send_email', 'ajax' => true ), 25 | 'LandingPageBuilder' => array( 'hook' => 'ulpb_formBuilderEmail_ajax', 'ajax' => true ), 26 | 'WpMembers' => array( 'hook' => 'wpmem_pre_register_data', 'ajax' => false ), 27 | 'Rafflepress' => array( 'hook' => 'rafflepress_lite_giveaway_api', 'ajax' => true ), 28 | 'Wpdiscuz' => array( 'hook' => array( 'wpdAddComment', 'wpdAddInlineComment' ), 'ajax' => true ), 29 | ); 30 | $class = new \ReflectionClass( '\Cleantalk\Antispam\Integrations' ); 31 | $this->method = $class->getMethod('getCurrentIntegrationTriggered'); 32 | $this->method->setAccessible(true); 33 | $this->integrations = $class->newInstanceWithoutConstructor(); 34 | $property = $class->getProperty('integrations'); 35 | $property->setAccessible(true); 36 | $property->setValue( $this->integrations , $available_integrations ); 37 | } 38 | 39 | public function testGet_current_integration_triggered_empty() { 40 | // empty parameter 41 | $this->assertFalse( $this->method->invoke( $this->integrations, '' ) ); 42 | } 43 | 44 | public function testGet_current_integration_triggered_string() { 45 | // parameter is string 46 | $this->assertEquals('Rafflepress', $this->method->invoke( $this->integrations, 'rafflepress_lite_giveaway_api' ) ); 47 | } 48 | 49 | public function testGet_current_integration_triggered_array() { 50 | // parameter is array 51 | $this->assertEquals( 'Wpdiscuz', $this->method->invoke( $this->integrations, 'wpdAddComment' ) ); 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /tests/ApbctWP/APITest.php: -------------------------------------------------------------------------------- 1 | assertFalse(isset($result['error'])); 16 | 17 | if ( empty($result['error']) ) { 18 | $directions = array( 19 | 'file_url' => isset($result['file_url']) ? $result['file_url'] : null, 20 | 'file_ua_url' => isset($result['file_ua_url']) ? $result['file_ua_url'] : null, 21 | 'file_ck_url' => isset($result['file_ck_url']) ? $result['file_ck_url'] : null, 22 | ); 23 | } 24 | 25 | $this->assertTrue(!empty($directions['file_url'])); 26 | $this->assertTrue(!empty($directions['file_ua_url'])); 27 | $this->assertTrue(!empty($directions['file_ck_url'])); 28 | 29 | $this->assertIsString($directions['file_url']); 30 | $this->assertIsString($directions['file_ua_url']); 31 | $this->assertIsString($directions['file_ck_url']); 32 | 33 | return $directions; 34 | } 35 | 36 | public function testGetDefaultFWDb() { 37 | 38 | $directions = $this->commonAction(null); 39 | $file_ck = Helper::httpGetDataFromRemoteGzAndParseCsv($directions['file_ck_url']); 40 | $this->assertFalse(isset($file_ck[2])); 41 | 42 | } 43 | 44 | public function testGetCommonSFWDb() { 45 | $directions = $this->commonAction(1); 46 | $file_ck = Helper::httpGetDataFromRemoteGzAndParseCsv($directions['file_ck_url']); 47 | $common_sign = $file_ck[2]; 48 | $this->assertEquals('common_lists', $common_sign[0]); 49 | $this->assertEquals('1', $common_sign[1]); 50 | } 51 | 52 | public function testGetPersonalSFWDb() { 53 | $directions = $this->commonAction(0); 54 | $file_ck = Helper::httpGetDataFromRemoteGzAndParseCsv($directions['file_ck_url']); 55 | $common_sign = $file_ck[2]; 56 | $this->assertEquals('common_lists', $common_sign[0]); 57 | $this->assertEquals('0', $common_sign[1]); 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /tests/ApbctWP/LoginIPKeeperTest.php: -------------------------------------------------------------------------------- 1 | loginIPKeeper = new LoginIPKeeper(); 16 | } 17 | 18 | public function testAddRecord() 19 | { 20 | // Create a WordPress user 21 | $user_id = wp_create_user('testuser', 'password', 'testuser@example.com'); 22 | $wp_user = get_user_by('id', $user_id); 23 | 24 | // Set session tokens 25 | $session_tokens = [ 26 | 'token1' => [ 27 | 'ip' => '192.168.1.1', 28 | ], 29 | ]; 30 | update_user_meta($wp_user->ID, 'session_tokens', $session_tokens); 31 | 32 | // Call the method 33 | $this->loginIPKeeper->addUserIP($wp_user); 34 | 35 | // Assert that the meta record was updated 36 | $ip = get_user_meta($wp_user->ID, '_cleantalk_ip_keeper_data', true); 37 | 38 | $this->assertEquals('192.168.1.1', $ip); 39 | } 40 | 41 | public function testGetMetaRecordValue() 42 | { 43 | // Create a WordPress user 44 | $user_id = wp_create_user('testuser2', 'password', 'testuser2@example.com'); 45 | 46 | // Set meta data 47 | update_user_meta($user_id, '_cleantalk_ip_keeper_data', '192.168.1.1'); 48 | 49 | // Call the method 50 | $result = $this->loginIPKeeper->getIP($user_id); 51 | 52 | // Assert the result 53 | $this->assertEquals('192.168.1.1', $result); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/ApbctWP/TestCleantalkSettingsTemplates.php: -------------------------------------------------------------------------------- 1 | assertIsArray( CleantalkSettingsTemplates::getOptionsTemplate( getenv("CLEANTALK_TEST_API_KEY") ) ); 9 | } 10 | public function testGet_options_template_not_ok() { 11 | $this->assertIsArray( CleantalkSettingsTemplates::getOptionsTemplate( 'wrong_key' ) ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/ApbctWP/TransactionTest.php: -------------------------------------------------------------------------------- 1 | transaction_instance = Transaction::get('updater'); 15 | } 16 | 17 | public function testIsRightInstance() 18 | { 19 | self::assertInstanceOf('\Cleantalk\ApbctWP\Transaction', $this->transaction_instance); 20 | } 21 | 22 | public function testPerform() 23 | { 24 | $perform = $this->transaction_instance->perform(); 25 | self::assertIsInt($perform); 26 | 27 | $perform_again = $this->transaction_instance->perform(); 28 | self::assertFalse($perform_again); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/ApbctWP/ValidateTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org')); 12 | $this->assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org')); 13 | $this->assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/')); 14 | $this->assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/some-path')); 15 | $this->assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/some-path/')); 16 | $this->assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/some-path?with_parameter=1')); 17 | $this->assertTrue(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/some-path/?with_parameter=1')); 18 | $this->assertFalse(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/ some-path/ with_parameter=1')); 19 | $this->assertFalse(\Cleantalk\ApbctWP\Validate::isUrl('https://cleantalk.org/some-path/with_parameter=😭')); 20 | $this->assertFalse(\Cleantalk\ApbctWP\Validate::isUrl('ftp://cleantalk.org')); 21 | $this->assertFalse(\Cleantalk\ApbctWP\Validate::isUrl('cleantalk.org')); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/Common/HelperTest.php: -------------------------------------------------------------------------------- 1 | assertArrayHasKey( 'error', Helper::httpMultiRequest( 'string' ) ); 10 | $this->assertArrayHasKey( 'error', Helper::httpMultiRequest( '' ) ); 11 | $this->assertArrayHasKey( 'error', Helper::httpMultiRequest( array() ) ); 12 | $this->assertArrayHasKey( 'error', Helper::httpMultiRequest( array(array('https://google.com')) ) ); 13 | } 14 | 15 | public function test_http__multi_request_success() { 16 | $res = Helper::httpMultiRequest( array('https://google.com', 'https://apple.com') ); 17 | $this->assertIsArray( $res ); 18 | $this->assertContainsOnly( 'string', $res ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tests/Common/QueueTest.php: -------------------------------------------------------------------------------- 1 | assertIsBool($queue->isQueueInProgress()); 16 | } 17 | 18 | public function testIsQueueInProgress_false() { 19 | $queue = new \Cleantalk\ApbctWP\Queue(); 20 | $queue->queue['stages'] = array(); 21 | $this->assertFalse($queue->isQueueInProgress()); 22 | } 23 | 24 | public function testIsQueueInProgress_true() { 25 | $queue = new \Cleantalk\ApbctWP\Queue(); 26 | $queue->queue['stages'][] = array( 27 | 'status' => 'NULL' 28 | ); 29 | $queue->queue['stages'][] = array( 30 | 'status' => 'IN_PROGRESS' 31 | ); 32 | $queue->queue['stages'][] = array( 33 | 'status' => 'FINISHED' 34 | ); 35 | $this->assertTrue($queue->isQueueInProgress()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tests/Common/SchemaTest.php: -------------------------------------------------------------------------------- 1 | assertIsArray( 11 | Schema::getStructureSchemas() 12 | ); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /tests/Common/Variables/PostTest.php: -------------------------------------------------------------------------------- 1 | getAndSanitize($input); 11 | $this->assertEquals($input, 'string'); 12 | } 13 | 14 | public function test_getAndSanitize_array(){ 15 | $input = ['value' => 'string']; 16 | Post::getInstance()->getAndSanitize($input); 17 | $this->assertEquals($input, ['value' => 'string']); 18 | } 19 | 20 | public function test_getAndSanitize_nestedArray() 21 | { 22 | $input = ['value' => ['nested_value' => 'string']]; 23 | Post::getInstance()->getAndSanitize($input); 24 | $this->assertEquals($input, ['value' => ['nested_value' => 'string']]); 25 | } 26 | 27 | public function test_getAndSanitize_nestedHugeArray() 28 | { 29 | $input = [ 30 | 'value' => [ 31 | 'nested_value_1' => [ 32 | 'nested_value_2' => [ 33 | 'nested_value_3' => [ 34 | 'nested_value_4' => [ 35 | 'nested_value_5' => [ 36 | 'nested_value_6' => [ 37 | 'nested_value7' => [ 38 | 'nested_value_8' => [ 39 | 'nested_value_9' => [ 40 | 'nested_value_10' => [ 41 | 'nested_value_11' => 'string' 42 | ] 43 | ] 44 | ] 45 | ] 46 | ] 47 | ] 48 | ] 49 | ] 50 | ] 51 | ] 52 | ] 53 | ]; 54 | $check = $input; 55 | Post::getInstance()->getAndSanitize($input); 56 | $this->assertEquals($input, $check); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /tests/StandaloneFunctions/TestGetServerUrl.php: -------------------------------------------------------------------------------- 1 | correct_urls = array( 15 | 'moderate.cleantalk.org', 16 | 'api.cleantalk.org', 17 | 'api.cleantalk.org/?', 18 | 'api.cleantalk.org?', 19 | 'moderate.cleantalk.org/api2.0', 20 | 'api4.cleantalk.org/api2.0', 21 | ); 22 | 23 | $this->incorrect_urls = array( 24 | 'google.com', 25 | 'cleantalk.org', 26 | 'moderate.cleantalk.org.scum.com', 27 | ); 28 | } 29 | 30 | public function testCorrectUrls() 31 | { 32 | delete_option('cleantalk_server'); 33 | foreach ($this->correct_urls as $url) { 34 | update_option( 35 | 'cleantalk_server', 36 | array( 37 | 'ct_work_url' => $url, 38 | 'ct_server_ttl' => 100, 39 | 'ct_server_changed' => time(), 40 | ) 41 | ); 42 | $server_details = ct_get_server(); 43 | $this->assertIsArray($server_details); 44 | $this->assertArrayHasKey('ct_work_url', $server_details); 45 | $this->assertNotNull($server_details['ct_work_url']); 46 | $this->assertTrue(in_array($server_details['ct_work_url'], $this->correct_urls)); 47 | } 48 | delete_option('cleantalk_server'); 49 | } 50 | 51 | public function testIncorrectUrls() 52 | { 53 | delete_option('cleantalk_server'); 54 | foreach ($this->incorrect_urls as $url) { 55 | update_option( 56 | 'cleantalk_server', 57 | array( 58 | 'ct_work_url' => $url, 59 | 'ct_server_ttl' => 100, 60 | 'ct_server_changed' => time(), 61 | ) 62 | ); 63 | $server_details = ct_get_server(); 64 | $this->assertIsArray($server_details); 65 | $this->assertArrayHasKey('ct_work_url', $server_details); 66 | $this->assertIsNotString($server_details['ct_work_url']); 67 | } 68 | delete_option('cleantalk_server'); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /tests/Templates/SingletonTest.php: -------------------------------------------------------------------------------- 1 | getMockForAbstractClass(ServerVariables::class); 12 | $trait_object = $this->getObjectForTrait(Singleton::class); 13 | 14 | self::assertInstanceOf(get_class($trait_mock), $trait_mock::getInstance()); 15 | self::assertInstanceOf(get_class($trait_object), $trait_object::getInstance()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./ 14 | ./bootstrap.php 15 | 16 | 17 | 18 | --------------------------------------------------------------------------------