mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
b1b413cd91
commit
4d477ce4e1
1 changed files with 28 additions and 3 deletions
|
@ -4365,13 +4365,38 @@ function getCaptcha($uid = "", $forceCaptcha = false)
|
|||
$uid = "capcha_" . uniqid();
|
||||
}
|
||||
$contents = getIncludeFileContent($global['systemRootPath'] . 'objects/functiongetCaptcha.php', ['uid' => $uid, 'forceCaptcha' => $forceCaptcha]);
|
||||
$parts = explode('<script>', $contents);
|
||||
|
||||
$result = [
|
||||
'style' => '',
|
||||
'html' => '',
|
||||
'script' => ''
|
||||
];
|
||||
|
||||
// Match the style block
|
||||
preg_match('/<style>(.*?)<\/style>/s', $contents, $styleMatch);
|
||||
if (!empty($styleMatch[1])) {
|
||||
$result['style'] = trim($styleMatch[1]);
|
||||
}
|
||||
|
||||
// Match the HTML block
|
||||
preg_match('/<div.*?<\/div>/s', $contents, $htmlMatch);
|
||||
if (!empty($htmlMatch[0])) {
|
||||
$result['html'] = trim($htmlMatch[0]);
|
||||
}
|
||||
|
||||
// Match the script block
|
||||
preg_match('/<script>(.*?)<\/script>/s', $contents, $scriptMatch);
|
||||
if (!empty($scriptMatch[1])) {
|
||||
$result['script'] = trim($scriptMatch[1]);
|
||||
}
|
||||
|
||||
return [
|
||||
'content' => $contents,
|
||||
'btnReloadCapcha' => "$('#btnReload{$uid}').trigger('click');",
|
||||
'captchaText' => "$('#{$uid}Text').val()",
|
||||
'html' => $parts[0],
|
||||
'script' => str_replace('</script>', '', $parts[1])
|
||||
'html' => $result['html'],
|
||||
'script' => $result['script'],
|
||||
'style' => $result['style']
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue