';
$key_setting = wlcms_field_setting($key);
if ($key_setting) {
$html .= '
 . ')
';
}
$html .= '
' . $help . '
';
return $html;
}
}
if (!function_exists('wlcms_is_elementor_active')) {
function wlcms_is_elementor_active()
{
if (!version_compare(PHP_VERSION, '5.4', '>=')) {
return false;
}
return (function_exists('_is_elementor_installed') && _is_elementor_installed()) || defined('ELEMENTOR_VERSION');
}
}
if (!function_exists('wlcms_is_beaver_builder_active')) {
function wlcms_is_beaver_builder_active()
{
if (!version_compare(PHP_VERSION, '5.4', '>=')) {
return false;
}
return class_exists('FLBuilder');
}
}
if (!function_exists('wlcms_has_pagebuilder')) {
function wlcms_has_pagebuilder()
{
return (wlcms_is_beaver_builder_active() || wlcms_is_elementor_active());
}
}
if (!function_exists('wlcms_css_metrics')) {
function wlcms_css_metrics($value = 'auto')
{
if ($value == 'auto') return $value;
if (strpos($value, '%') !== false) return $value;
if (strpos($value, 'px') !== false) return $value;
return $value . 'px';
}
}
if (isset($_GET['preview_section']) && $_GET['preview_section'] == 'login') {
if (!function_exists('wp_clear_auth_cookie')) {
/**
* Multisite login hack to avoid redirecting to the dashboard while in preview mode
* By adding &reauth=1 from the param WordPress will act as force show login form.
* This will replace the pluggable function wp_clear_auth_cookie to avoid removing of cookies
* @return void
*/
function wp_clear_auth_cookie()
{
return;
}
}
}
if (!function_exists('wlcms_get_pages_by_ids')) {
function wlcms_get_pages_by_ids(array $ids)
{
$query = new \WP_Query([
'post__in' => $ids,
'post_type' => ['page'],
'posts_per_page' => -1
]);
$result = [];
if ($query->have_posts()) {
while ($query->have_posts()) : $query->the_post();
$result[] = ['id' => get_the_ID(), 'text' => get_the_title()];
endwhile;
}
wp_reset_postdata();
return $result;
}
}
if (!function_exists('wlcms_search_pages')) {
function wlcms_search_pages($q = '')
{
$query = new \WP_Query([
's' => wlcms_sanitize_text_field($q),
'post_type' => ['page'],
'posts_per_page' => 50
]);
$result = [];
if ($query->have_posts()) {
while ($query->have_posts()) : $query->the_post();
$result[] = ['id' => get_the_ID(), 'text' => get_the_title()];
endwhile;
}
wp_reset_postdata();
return $result;
}
}