/**
  * modify apf hwskin params
  * @param $setting
  * @param $value
  * @return mixed|null|void
  * @hook apf_hwskin
  */
 public function _apf_hwskin($value, $setting)
 {
     if ($setting == 'group') {
         if (self::is_current_screen()) {
             $chat_service = hw_livechat_option('chat_service');
             if ($chat_service) {
                 return $chat_service;
             }
         }
     }
     return $value;
 }
예제 #2
0
 /**
  *
  */
 public function _hw_wp_footer()
 {
     if (hw_livechat_option('enable_livechat')) {
         //load mobile detector library
         if (function_exists('hwlib_load_library')) {
             $mobile_detect = hwlib_load_library('HW_Mobile_Detect');
             if ($mobile_detect->object->isMobile() && !hw_livechat_option('active_on_mobile')) {
                 return;
                 //do not show chatbox on mobile device
             }
         }
         /*if(class_exists('HW_Mobile_Detect')) {
               HW_PHP_Libraries::get('HW_Mobile_Detect');
           }*/
         //get embed live chat code
         $embed = hw_livechat_option('chat_embed_code');
         if ($embed) {
             echo $embed;
         }
         /**
          * apply skin
          */
         $skin_data = hw_livechat_option('chat_skin');
         $skin = APF_hw_skin_Selector_hwskin::resume_hwskin_instance($skin_data);
         if ($skin && !empty($skin->instance)) {
             $file = $skin->instance->get_skin_file($skin->hash_skin);
             if (file_exists($file)) {
                 $theme = array();
                 //valid
                 include $file;
                 //depricated
                 /*if(!isset($theme['styles'])) $theme['styles'] = array();
                                     if(!isset($theme['scripts'])) $theme['scripts'] = array();
                 
                                     if(count($theme['styles']) || count($theme['scripts'])) {
                                         $skin->instance->enqueue_files_from_skin(null//$theme['styles']//, $theme['scripts']);  //enqueued css before
                                     }*/
                 HW_SKIN::enqueue_skin_assets(array_merge(array('skin_file' => $file), (array) $skin));
             }
         }
     }
 }