add_filter('render_block', 'wrapBlock', 10, 2);
function wrapBlock($block_content, $block)
{
$name = $block['blockName'];
if ($name)
{
return sprintf('<div class="e-block e-block-%s">%s</div>', str_replace('/', '-', $name), $block_content);
}
return $block_content;
}
const fs = require('fs');
const { resolve } = require('path');
const { promisify } = require('util');
const writeFile = promisify(fs.writeFile);
const got = require('got');
async function getImage(url)
{
try
{
const { body, statusCode, statusMessage } = await got(url, { encoding: null });
if (statusCode === 200)
{
await writeFile(resolve('.', 'newCaptchaAnchor.gif'), body);
}
else
{
throw new Error(statusMessage);
}
}
catch(err)
{
throw new Error(err);
}
}
getImage('https://developers.google.com/recaptcha/images/newCaptchaAnchor.gif')
.then(() => console.log('Complete....'));