/home/fdhrevqn/public_html/wp-content/plugins.disabled/fox-framework/theme-functions.php
<?php

// Shortcodes
require_once FOX_FRAMEWORK_PATH . 'inc/shortcodes.php';

if ( !class_exists ( 'Fox_Framework ' )  ) :
/*
 * Main class
 * @since 1.0
 */
class Fox_Framework 
{
    /**
	 * construct
	 */
	public function __construct() {
	}
    
    /**
	 * The one instance of class
	 *
	 * @since 1.0
	 */
	private static $instance;

	/**
	 * Instantiate or return the one class instance
	 *
	 * @since 1.0
	 * @return $instance
	 */
	public static function instance() {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
		}

		return self::$instance;
	}
    
    /**
     * Initiate the class
     * contains action & filters
     *
     * @since 1.0
     */
    public function init() {
        
        // Register lately so that everything has been registered
        add_action( 'init', array( $this, 'plugin_init' ), 100 );
        
    }
    
    /**
     * Plugin Init
     *
     * @since 1.0
     */
    function plugin_init() {
        
        load_plugin_textdomain( 'wi', false, dirname( plugin_basename(__FILE__) ) . '/languages' );
        add_filter( 'upload_mimes', array( $this, 'add_custom_upload_mimes' ) );
        
    }
    
    function add_custom_upload_mimes($existing_mimes) {
        
        $existing_mimes['otf'] = 'application/x-font-otf';
        $existing_mimes['woff'] = 'application/x-font-woff';
        $existing_mimes['woff2'] = 'application/x-font-woff2';
        $existing_mimes['ttf'] = 'application/x-font-ttf';
        $existing_mimes['svg'] = 'image/svg+xml';
        $existing_mimes['eot'] = 'application/vnd.ms-fontobject';
        return $existing_mimes;
        
    }
    
}	// class

Fox_Framework::instance()->init();

endif;

/* ---------------------            BLOG GROUP 1           --------------------- */
if ( ! function_exists( 'fox_blog_group1' ) ) :
/**
 * $query is a WP_Query instance
 * @since 4.0
 */
function fox_blog_group1( $query = null, $options = [] ) {
    
    $container_class = [
        'blog-container',
        'blog-container-group',
        'blog-container-group-1'
    ];
    
    $class = [
        'wi-blog',
        'fox-blog',
        'blog-group',
        'blog-group-1',
        'post-group-row',
        
        // legacy
        'wi-newsblock',
        'newsblock-1',
    ];
    
    if ( ! $query ) {
        global $wp_query;
        $query = $wp_query;
    }
    
    if ( ! $query->have_posts() ) return;
    
    $default_options = fox_default_blog_options( 'group-1' );
    $options = wp_parse_args( $options, $default_options );
    
    // turn all true, yes, no, false things into boolean for easing working process
    foreach ( $options as $k => $v ) {

        if ( 'yes' == $v || 'true' == $v ) $options[ $k ] = true;
        if ( 'no' == $v || 'false' == $v ) $options[ $k ] = false;

    }
    
    // clone it for future use
    $options_backup = $options;
    
    extract( $options );
    
    // big post position
    if ( 'right' != $bigpost_position ) {
        $bigpost_position = 'left';
    }
    $class[] = 'big-post-' . $bigpost_position;
    
    // bigpost_ratio
    if ( '3/4' != $bigpost_ratio ) $bigpost_ratio = '2/3';
    $class[] = 'big-post-ratio-' . str_replace( '/', '-', $bigpost_ratio );
    
    // sep border
    $sep_border_css = [];
    if ( $sep_border ) {
        $class[] = 'has-border';
    }
    if ( $sep_border_color ) {
        $sep_border_css[] = 'color:' . $sep_border_color;
    }
    $sep_border_css = join( ';', $sep_border_css );
    if ( ! empty( $sep_border_css ) ) {
        $sep_border_css = ' style="' . esc_attr( $sep_border_css ) . '"';
    }
    
    // vertical spacing
    if ( ! isset( $small_posts_list_spacing ) ) $small_posts_list_spacing = 'normal';
    if ( ! in_array( $small_posts_list_spacing, [ 'none', 'tiny', 'small', 'normal', 'medium', 'large' ] ) ) {
        $small_posts_list_spacing = 'normal';
    }

    $class[] = 'v-spacing-' . $small_posts_list_spacing;
    
    $count = 0; 
?>

<div class="<?php echo esc_attr( join( ' ', $container_class ) ); ?>">
    
    <div class="<?php echo esc_attr( join( ' ', $class ) ); ?>">

    <?php while ( $query->have_posts() ) : $query->the_post(); $count++; $bigpost = ( 1 == $count ); ?>
        
        <?php 
            /* BIG POST
            -------------------- */
            if ( $bigpost ) :
    
            foreach ( $options as $k => $v ) {
                if ( 'bigpost_' == substr( $k, 0, 8 ) ) {
                    $options[ substr( $k, 8 ) ] = $v;
                }
            }
            $options[ 'thumbnail_placeholder' ] = false;
            extract( $options );
    
        // legacy
        $extra_post_class = 'article-big';
    
        ?>
        
        <div class="post-group-col post-group-col-big article-big-wrapper">
            
            <?php include get_parent_theme_file_path( 'parts/content-grid.php' ); ?>
            
            <?php do_action( 'foxele_after_render_post' ); ?>
            
        </div><!-- .post-group-col -->
        
        <div class="post-group-col post-group-col-small article-small-wrapper">
        
        <?php
    
        /* SMALL POST
        -------------------- */
        else : // small posts

        // restore options
        $options = $options_backup;
    
        foreach ( $options as $k => $v ) {
            
            if ( 0 === strpos( $k, 'small_posts_' ) ) {
                $options[ str_replace( 'small_posts_', '', $k ) ] = $v;
            }
            
        }
    
        extract( $options );
    
        $thumbnail_type = 'simple';
    
        // legacy
        $extra_post_class = 'article-small-list';

        ?>
            
            <?php include get_parent_theme_file_path( 'parts/content-list.php' ); ?>
            
            <?php do_action( 'foxele_after_render_post' ); ?>
        
            <?php endif; // big or small post ?>
            
            <?php endwhile; ?>
            
        </div><!-- .article-small-wrapper -->
        
        <?php if ( $sep_border ) { ?>
        <div class="sep-border"<?php echo $sep_border_css; ?>></div>
        <?php } ?>

    </div><!-- .wi-newsblock -->
    
</div><!-- .blog-container-group -->

<?php

}
endif;

/* ---------------------            BLOG GROUP 2           --------------------- */
if ( ! function_exists( 'fox_blog_group2' ) ) :
/**
 * $query is a WP_Query instance
 * @since 4.0
 */
function fox_blog_group2( $query = null, $options = [] ) {
    
    $container_class = [
        'blog-container',
        'blog-container-group',
        'blog-container-group-2'
    ];
    
    $class = [
        'wi-blog',
        'fox-blog',
        'blog-group',
        'blog-group-2',
        'post-group-row',
        
        // legacy
        'newsblock-2',
    ];
    
    if ( ! $query ) {
        global $wp_query;
        $query = $wp_query;
    }
    
    if ( ! $query->have_posts() ) return;
    
    $default_options = fox_default_blog_options( 'group-2' );
    $options = wp_parse_args( $options, $default_options );
    
    // turn all true, yes, no, false things into boolean for easing working process
    foreach ( $options as $k => $v ) {

        if ( 'yes' == $v || 'true' == $v ) $options[ $k ] = true;
        if ( 'no' == $v || 'false' == $v ) $options[ $k ] = false;

    }
    
    $options_backup = $options;
    
    extract( $options );
    
    // big post position
    $class[] = 'post-group-row-' . $columns_order;
    
    $explode = explode( '-', $columns_order );
    $big_order = 1 + array_search( '1a', $explode );
    $small_order = 1 + array_search( '3', $explode );
    $tall_order = 1 + array_search( '1b', $explode );
    
    $class[] = 'big-order-' . $big_order;
    $class[] = 'small-order-' . $small_order;
    $class[] = 'tall-order-' . $tall_order;
    
    // sep border
    $sep_border_css = [];
    if ( $sep_border ) {
        $class[] = 'has-border';
    }
    if ( $sep_border_color ) {
        $sep_border_css[] = 'color:' . $sep_border_color;
    }
    $sep_border_css = join( ';', $sep_border_css );
    if ( ! empty( $sep_border_css ) ) {
        $sep_border_css = ' style="' . esc_attr( $sep_border_css ) . '"';
    }
    
    $count = 0;
    $thumbnail_inside = '';
    $thumbnail_view = '';
    $thumbnail_review_score = '';
?>

<div class="<?php echo esc_attr( join( ' ', $container_class ) ); ?>">
    
    <div class="<?php echo esc_attr( join( ' ', $class ) ); ?>">

    <?php while ( $query->have_posts() ) : $query->the_post(); $count++; ?>
    

        <?php 
            /* BIG POST
            -------------------- */
            if ( 1 == $count ) :
    
            foreach ( $options as $k => $v ) {
                if ( 0 === strpos( $k, 'bigpost_' ) ) {
                    $options[ str_replace( 'bigpost_', '', $k ) ] = $v;
                }
            }
    
            $options[ 'thumbnail_placeholder' ] = false;
            extract( $options );
    
            // legacy
            $extra_post_class = 'article-big';
    
        ?>
        
        <div class="post-group-col post-group-col-big article-col-big">
            
            <?php include get_parent_theme_file_path( 'parts/content-grid.php' ); ?>
            
            <?php do_action( 'foxele_after_render_post' ); ?>
            
        </div><!-- .post-group-col -->
        
        <?php
    
    /* TALL POST / OR WE CALL MEDIUM POST
    -------------------- */
    elseif ( 2 == $count ) :
    
    $options = $options_backup;
    
    foreach ( $options as $k => $v ) {
        if ( 'medium_post_' == substr( $k, 0, 12 ) ) {
            $options[ substr( $k, 12 ) ] = $v;
        }
    }
    
    $options[ 'thumbnail_placeholder' ] = false;
    $thumbnail_type = 'simple';
    
    extract( $options );
    
    $extra_post_class = 'article-tall article-medium';
        
        ?>
        
        <div class="post-group-col post-group-col-tall article-col-tall">
    
            <?php include get_parent_theme_file_path( 'parts/content-grid.php' ); ?>
            
            <?php do_action( 'foxele_after_render_post' ); ?>
            
        </div><!-- .post-group-col-tall -->
        
        <div class="post-group-col post-group-col-small article-col-small">
    
    <?php /* 3 POSTS
    -------------------- */
    else : // small posts 
    
    $options = $options_backup;
    
    foreach ( $options as $k => $v ) {
        if ( 'small_posts_' == substr( $k, 0, 12 ) ) {
            $options[ substr( $k, 12 ) ] = $v;
        }
    }
    
    $options[ 'thumbnail_placeholder' ] = false;
    $thumbnail_type = 'simple';
    extract( $options );
    
    $extra_post_class = 'article-small article-small-grid';
            
            ?>
            
            <?php include get_parent_theme_file_path( 'parts/content-grid.php' ); ?>
            
            <?php do_action( 'foxele_after_render_post' ); ?>
        
            <?php endif; // big or small post ?>
            
            <?php endwhile; // have_posts ?>
        
            <?php if ( $count >=2 ) { ?>
        </div><!-- .post-group-col-small -->
            <?php } ?>
        
        <?php if ( 'yes' == $sep_border ) { ?>
        
        <div class="sep-border line1"<?php echo $sep_border_css; ?>></div>
        <div class="sep-border line2"<?php echo $sep_border_css; ?>></div>
        
        <?php } ?>

    </div><!-- .wi-newsblock -->
    
</div><!-- .blog-container-group -->
<?php
}
endif;