File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55class BotDetectorService
66{
77 /**
8+ * URL of the default wrapper script.
89 * @var string
910 */
10- private $ wrapper_script_url = 'https://fd.cleantalk.org/ct-bot-detector-wrapper.js ' ;
11+ private static $ default_wrapper_script_url = 'https://fd.cleantalk.org/ct-bot-detector-wrapper.js ' ;
1112
12- /**
13+ /*
14+ * URL of the alternative wrapper script.
1315 * @var string
1416 */
15- private static $ alternative_src_constant_name = 'APBCT_SERVICE__USE_ALTERNATIVE_BOT_DETECTOR_SERVER ' ;
16-
17- public function __construct ()
18- {
19- $ this ->setWrapperScriptUrl ();
20- }
17+ private static $ alternative_wrapper_script_url = 'https://fd.cleantalk.ru/ct-bot-detector-wrapper-ru.js ' ;
2118
22- private function setWrapperScriptUrl ()
23- {
24- if (defined (self ::$ alternative_src_constant_name )) {
25- $ this ->wrapper_script_url = 'https://fd.cleantalk.ru/ct-bot-detector-wrapper-ru.js ' ;
26- }
27- // place the API logic here in the future
28- }
19+ /**
20+ * Name of the constant that determines whether to use the alternative URL.
21+ * @var string
22+ */
23+ private static $ const_name__use_alt_url = 'APBCT_SERVICE__USE_ALTERNATIVE_BOT_DETECTOR_SERVER ' ;
2924
25+ /**
26+ * Retrieves the URL of the wrapper script or an alternative URL if a specific constant is defined.
27+ *
28+ * @return string The URL of the wrapper script or the alternative script URL.
29+ */
3030 public function getWrapperScriptUrl ()
3131 {
32- return $ this ->wrapper_script_url ;
32+ return defined (self ::$ const_name__use_alt_url )
33+ ? self ::$ alternative_wrapper_script_url
34+ : self ::$ default_wrapper_script_url ;
3335 }
3436}
You can’t perform that action at this time.
0 commit comments