Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,9 @@ In [example file](https://github.com/CleanTalk/php-antispam/blob/dev/examples/fo
- [example with form handler](https://github.com/CleanTalk/php-antispam/blob/dev/examples/form_with_handler/form_with_handler.php)


## Versioning

The library version is defined by the `APBCT_VERSION` constant in [`cleantalk-antispam.php`](cleantalk-antispam.php). Bump it manually in every release commit — it is not updated automatically.

## Don't want to deal with all this?
Universal solution for any CMS or custom website: https://github.com/CleanTalk/php-uni
2 changes: 2 additions & 0 deletions cleantalk-antispam.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

const APBCT_VERSION = '4.4';

require_once 'lib/HTTP/Helper.php';
require_once 'lib/HTTP/Request.php';
require_once 'lib/HTTP/Response.php';
Expand Down
4 changes: 3 additions & 1 deletion lib/CleantalkAntispam.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ private function setEmailAutomatically()
public static function getFrontendHTMLCode($warn_if_js_disabled = false)
{
$warn = $warn_if_js_disabled ? '<noscript><div>Please, enable JavaScript in the browser to process the form</div></noscript>' : '';
$version = defined('APBCT_VERSION') ? \APBCT_VERSION : '1.0';
$url = static::BOT_DETECTOR_LIBRARY_URL . '?version=' . $version;
$html = '<script src="%s"></script>%s';
return sprintf($html, static::BOT_DETECTOR_LIBRARY_URL, $warn);
return sprintf($html, $url, $warn);
}

/**
Expand Down
Loading