balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-appside-hook-customize.php (5935B)


      1 <?php
      2 /**
      3  * @package Appside
      4  * @author Ir Tech
      5  */
      6 if (!defined("ABSPATH")) {
      7 	exit(); //exit if access directly
      8 }
      9 
     10 if (!class_exists('Appside_Customize')) {
     11 
     12 	class Appside_Customize
     13 	{
     14 		/*
     15 		* $instance
     16 		* @since 1.0.0
     17 		* */
     18 		protected static $instance;
     19 
     20 		public function __construct()
     21 		{
     22 			//excerpt more
     23 			add_action('excerpt_more',array($this,'excerpt_more'));
     24 			//back top
     25 			add_action('appside_after_body',array($this,'back_top'));
     26 			//preloader
     27 			add_action('appside_after_body',array($this,'preloader'));
     28 			//breadcrumb
     29 			add_action('appside_before_page_content',array($this,'breadcrumb'));
     30 			//order comment form
     31             add_filter('comment_form_fields',array($this,'appside_comment_fileds_reorder'));
     32 		}
     33 
     34 		/**
     35 		 * getInstance()
     36 		 * */
     37 		public static function getInstance()
     38 		{
     39 			if (null == self::$instance) {
     40 				self::$instance = new self();
     41 			}
     42 			return self::$instance;
     43 		}
     44 
     45 		/**
     46 		 * Excerpt More
     47 		 * @since 1.0.0
     48 		 * */
     49 		public function excerpt_more($more){
     50 			$more = ' ';
     51 			return $more;
     52 		}
     53 		/**
     54 		 * Breadcrumb
     55 		 * @since 1.0.0
     56 		 * */
     57 		public function breadcrumb(){
     58 			$page_id = Appside()->page_id();
     59 			$check_page = (!is_home() && !is_front_page() && is_singular()) || is_search() || is_author() || is_404() || is_archive() ? true : false ;
     60 			$check_home_page = Appside('Frontend')->is_home_page();
     61 			$page_header_meta = Appside_Group_Fields_Value::page_container('appside','header_options');
     62 			$page_breadcrumb_enable = isset($page_header_meta['page_breadcrumb_enable']) && $page_header_meta['page_breadcrumb_enable'] && !is_search() ? $page_header_meta['page_breadcrumb_enable'] : false;
     63 			$breadcrumb_enable = false;
     64 			$header_variant = !empty($page_container_meta['navbar_type']) ? $page_container_meta['navbar_type'] : 'default';
     65 			$header_variant = ($page_header_meta['navbar_build_type'] == 'header_builder' && !empty($page_header_meta['header_builder_style']) ) ? 'builder' : $header_variant;
     66 			
     67 			if ($header_variant == 'default' && cs_get_option('global_navbar_build_type') == 'default'){
     68 				$header_variant = cs_get_option('global_header_style');
     69 			}elseif($header_variant == 'default' && cs_get_option('global_navbar_build_type') == 'header_builder'){
     70 				$header_variant = 'builder';
     71 			}
     72 			
     73 			if ( !$check_home_page && !$check_page){
     74 				$breadcrumb_enable = true;
     75 			}elseif (!$page_breadcrumb_enable && $check_page){
     76 				$breadcrumb_enable = true;
     77 			}
     78 			
     79 			$breadcrumb_enable =  !cs_get_switcher_option('breadcrumb_enable') ? false : $breadcrumb_enable;
     80 			
     81 			if ( !$breadcrumb_enable ){
     82 				return;
     83 			}
     84 			?>
     85 			<div class="breadcrumb-area <?php echo esc_attr($header_variant);?>">
     86 				<div class="container">
     87 					<div class="row">
     88 						<div class="col-lg-12">
     89 							<div class="breadcrumb-inner">
     90 								<?php
     91 								if ( is_archive() ){
     92 									the_archive_title( '<h2 class="page-title">', '</h1>' );
     93 								}elseif ( is_404() ){
     94 									printf('<h2 class="page-title">%1$s</h2>',esc_html__('Error 404','aapside'));
     95 								}elseif ( is_search() ){
     96 									printf('<h2 class="page-title">%1$s %2$s</h2>',esc_html__('Search Results for:','aapside'),get_search_query());
     97 								}elseif ( is_singular('post') ){
     98 									printf('<h2 class="page-title">%1$s </h2>',get_the_title());
     99 								}elseif ( is_singular('page') ){
    100 									if ( $page_header_meta['page_title']) {
    101 										printf('<h2 class="page-title">%1$s </h2>',get_the_title());
    102 									}
    103 								}else{
    104 									printf('<h2 class="page-title">%1$s </h2>',get_the_title($page_id));
    105 								}
    106 								if ( $page_header_meta['page_breadcrumb'] ){
    107 									Appside_Breadcrumb();
    108 								}
    109 								?>
    110 							</div>
    111 						</div>
    112 					</div>
    113 				</div>
    114 			</div>
    115 			<?php
    116 		}
    117 
    118 		/**
    119 		 * back top
    120 		 * @since 1.0.0
    121 		 * */
    122 		public function back_top(){
    123 			$back_top_enable = cs_get_switcher_option('back_top_enable');
    124 			$back_top_icon = cs_get_option('back_top_icon') ? cs_get_option('back_top_icon') : 'fa fa-angle-up';
    125 			if (!$back_top_enable){
    126 				return;
    127 			}
    128 			?>
    129 			<div class="back-to-top">
    130 				<span class="back-top"><i class="<?php echo esc_attr($back_top_icon);?>"></i></span>
    131 			</div>
    132 			<?php
    133 		}
    134 		/**
    135 		 * Preloader
    136 		 * @since 1.0.0
    137 		 * */
    138 		public function preloader(){
    139 			$preloader_enable = cs_get_switcher_option('preloader_enable');
    140 			if (!$preloader_enable){
    141 				return;
    142 			}
    143 			?>
    144 			<div class="preloader-wrapper" id="preloader">
    145                 <div class="preloader">
    146                     <div class="sk-circle">
    147                         <div class="sk-circle1 sk-child"></div>
    148                         <div class="sk-circle2 sk-child"></div>
    149                         <div class="sk-circle3 sk-child"></div>
    150                         <div class="sk-circle4 sk-child"></div>
    151                         <div class="sk-circle5 sk-child"></div>
    152                         <div class="sk-circle6 sk-child"></div>
    153                         <div class="sk-circle7 sk-child"></div>
    154                         <div class="sk-circle8 sk-child"></div>
    155                         <div class="sk-circle9 sk-child"></div>
    156                         <div class="sk-circle10 sk-child"></div>
    157                         <div class="sk-circle11 sk-child"></div>
    158                         <div class="sk-circle12 sk-child"></div>
    159                     </div>
    160                 </div>
    161 			</div>
    162 			<?php
    163 		}
    164 
    165 		/**
    166 		 * @since 1.0.0
    167          * reorder comments form
    168 		 * */
    169 		public function appside_comment_fileds_reorder($fileds){
    170 
    171 		    $comment_filed = $fileds['comment'];
    172 
    173 		    if (isset($fileds['cookies'])){
    174                 $comment_cookies = $fileds['cookies'];
    175                 unset($fileds['cookies']);
    176                 $fileds['cookies'] = $comment_cookies;
    177             }
    178 
    179 		    unset($fileds['comment']);
    180 		    $fileds['comment'] = $comment_filed;
    181 
    182 		    return $fileds;
    183         }
    184 
    185 
    186 	}//end class
    187 	if (class_exists('Appside_Customize')){
    188 		Appside_Customize::getInstance();
    189 	}
    190 }