<?php

/* ------------------------------------------------------------------------------
* Author: web-zone.org
* @package Airin Blog
* Description: Functions
* ------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------
* Attention!
* Do not edit this file, after updating all changes will be lost
* To add your own functions, use a special free plugin
* The plugin can be downloaded from web-zone.org
* ------------------------------------------------------------------------------ */
// SDK
if ( file_exists( get_template_directory() . '/vendor/freemius/start.php' ) ) {
    if ( !function_exists( 'airinblog_fs' ) ) {
        // Create a helper function for easy SDK access.
        function airinblog_fs() {
            global $airinblog_fs;
            if ( !isset( $airinblog_fs ) ) {
                // Include Freemius SDK.
                require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
                $airinblog_fs = fs_dynamic_init( array(
                    'id'               => '13172',
                    'slug'             => 'airin-blog',
                    'type'             => 'theme',
                    'public_key'       => 'pk_3426f8c7139fd4fc2d7cdf303ed51',
                    'is_premium'       => false,
                    'has_addons'       => true,
                    'has_paid_plans'   => true,
                    'has_affiliation'  => 'all',
                    'menu'             => array(
                        'slug'    => 'dmcwzmulti_page_settings',
                        'support' => false,
                        'parent'  => array(
                            'slug' => 'themes.php',
                        ),
                    ),
                    'navigation'       => 'tabs',
                    'is_live'          => true,
                    'is_org_compliant' => true,
                ) );
            }
            return $airinblog_fs;
        }

        // Init Freemius.
        airinblog_fs();
        // Signal that SDK was initiated.
        do_action( 'airinblog_fs_loaded' );
    }
}
// If SDK code change, add - 'navigation' => 'tabs'
// Remove monthly plans
airinblog_fs()->add_filter( 'pricing/show_annual_in_monthly', '__return_false' );
// Translation the theme
function airinblog_fun_language_theme() {
    load_theme_textdomain( 'airin-blog', false, get_template_directory() . '/languages' );
    // Language TABs Freemius
    fs_override_i18n( array(
        'contact-us'  => esc_html__( 'Contact', 'airin-blog' ),
        'account'     => esc_html__( 'Account', 'airin-blog' ),
        'pricing'     => esc_html__( 'Pricing', 'airin-blog' ),
        'upgrade'     => esc_html__( 'Upgrade', 'airin-blog' ),
        'add-ons'     => esc_html__( 'Add-Ons', 'airin-blog' ),
        'affiliation' => esc_html__( 'Affiliate program', 'airin-blog' ),
    ), 'airin-blog' );
    // Theme description (for translations - style.css)
    esc_html__( 'Airin Blog - is a Multipurpose, responsive, fast, minimal magazine theme for blogs and article sites, news and media, with many settings for all occasions. Modern minimalism combined with versatility and adaptability. Lots of customization options that will provide endless options for creating a unique site. Flexible functionality - different sidebar orientation, flexible header with logo, 4 menu locations, main menu (mega menu), three pagination options, breadcrumbs, author block and related posts. Powerful Typography - Change font size and line height, choose fonts, add color typography for posts and pages. Clean code, no frameworks, full support for the WordPress visual customizer. Speed, adaptability and modularity. A minimum of scripts for modules to work. Decide for yourself which modules will work. SEO optimization with correct titles and markup. Adaptation for WooCommerce, Elementor, bbPress, Events Calendar, Jetpack, WPML. Watch full demos here - web-zone.org/airin-blog', 'airin-blog' );
}

add_action( 'init', 'airinblog_fun_language_theme' );
// Files connection
require get_template_directory() . '/inc/general.php';
/* ------------------------------------------------------------------------------
* Attention!
* Do not edit this file, after updating all changes will be lost
* To add your own functions, use a special free plugin
* The plugin can be downloaded from web-zone.org
* ------------------------------------------------------------------------------ */
// Fix WordPress 6.7 +
if ( version_compare( get_bloginfo( 'version' ), '6.7', '>=' ) ) {
    // Urgent fix for images after the release of WordPress 6.7 +
    add_filter( 'wp_content_img_tag', static function ( $image ) {
        return str_replace( ' sizes="auto, ', ' sizes="', $image );
    } );
    add_filter( 'wp_get_attachment_image_attributes', static function ( $attr ) {
        if ( isset( $attr['sizes'] ) ) {
            $attr['sizes'] = preg_replace( '/^auto, /', '', $attr['sizes'] );
        }
        return $attr;
    } );
}