/**
  * render current pagenavi skin
  * @param $html
  */
 public static function render_pagination_skin($html = '')
 {
     //get hoangweb scb options
     $options = HWPageNavi_Core::getOptions()->get();
     //$options = PageNavi_Core::$options->get();    //other way
     if (isset($options['hw_skin']['hwskin_config']) && isset($options['hw_skin']['hash_skin'])) {
         #$skin = HW_SKIN::resume_skin($options['hw_skin']['hwskin_config']);
         $skin = HW_SKIN::resume_hwskin_instance($options['hw_skin']);
         if (!empty($skin)) {
             $file = $skin->instance->get_skin_file($options['hw_skin']['hash_skin']);
             if (file_exists($file)) {
                 $theme_setting = $skin->instance->get_file_skin_setting();
                 //extract theme setting from skin
                 //load theme setting
                 if (file_exists($theme_setting)) {
                     include $theme_setting;
                 }
                 //custom wp_pagenavi output by skin
                 $html = hw_paginav_output($file, $html);
                 //valid theme setting
                 /*if(!isset($theme['styles']) || !is_array($theme['styles'])) $theme['styles'] = array();
                                     if(!isset($theme['scripts']) || !is_array($theme['scripts'])) $theme['scripts'] = array();
                 
                                     if(count($theme['styles']) || count($theme['scripts'])) {
                                         //put css within head tag
                                         $skin->instance->enqueue_files_from_skin($theme['styles'], $theme['scripts']);
                                     }*/
                 $skin_assets = array('skin_file' => $file);
                 if (isset($theme)) {
                     $skin_assets['theme_settings'] = $theme;
                 }
                 HW_SKIN::enqueue_skin_assets(array_merge($skin_assets, (array) $skin));
                 return isset($theme) && is_array($theme) ? $theme : array();
             }
         }
     }
 }
/**
 * get skins setting
 * @param array $where
 * @return array
 */
function hwskin_get_skins_enqueues($where = array('status' => 1))
{
    global $wpdb;
    $data = array();
    $where_mark = '';
    $where_value = array();
    foreach ($where as $field => $val) {
        $where_mark .= "{$field} = %s and ";
        $where_value[] = $val;
    }
    //valid
    $where_mark = trim($where_mark, 'and ');
    $query = "SELECT * FROM " . HW_SKIN::SKINS_SETTINGS_DB . " " . ($where_mark ? 'WHERE ' . $where_mark : '');
    $result = $wpdb->get_results($wpdb->prepare($query, $where_value));
    //loop all skins
    foreach ($result as $skin) {
        $key = $skin->blog_id . '_' . $skin->object;
        if (isset($data[$key])) {
            continue;
        }
        $data[$key] = array();
        $skin_config = unserialize($skin->skin);
        /*if($skin['type'] == 'resume_skin') {
        
                    //parse hw_skin instance
                    if(isset($skin_config['hw_skin_config']) && isset($skin_config['hw_skin'])) {   //for old version
                        $skin_obj = HW_SKIN::resume_skin($skin_config['hw_skin_config']);
        
                    }
                }
                elseif($skin['type'] == 'APF_field' || $skin['type'] == 'NHP_field') {
        
                }*/
        if (isset($skin_config['hash_skin']) && isset($skin_config['hwskin_config'])) {
            $skin_obj = HW_SKIN::resume_hwskin_instance($skin_config);
            //
            $data[$key] = $skin_obj;
        }
        #if(isset($skin_obj)) $data[$key]['instance'] = $skin_obj;
    }
    return $data;
}
 /**
  * output breadcrumb navxt
  */
 public function display()
 {
     //get bcn settings
     $setting = $this->get_settings();
     $display = 'normal';
     $linked = isset($setting['hw_allow_trail_link']) && $setting['hw_allow_trail_link'] ? true : false;
     $reverse = isset($setting['hw_bcn_reverse']) && $setting['hw_bcn_reverse'] ? true : false;
     if (isset($setting['hw_active_skin']) && $setting['hw_active_skin'] && class_exists('HW_SKIN') && isset($setting['hw_skin']) && isset($setting['hw_skin']['hwskin_config'])) {
         #$skin = HW_SKIN::resume_skin($setting['hw_skin']['hwskin_config']);
         $skin = HW_SKIN::resume_hwskin_instance($setting['hw_skin']);
         if (!empty($skin)) {
             $file = $skin->instance->get_skin_file($setting['hw_skin']['hash_skin']);
             $content = $skin->instance->render_skin_template(0, false);
             if ($content !== false) {
                 echo $content;
             }
             //if(file_exists($file)) {
             //get theme setting from setting file or skin file
             $setting = $skin->instance->get_file_skin_setting();
             if (file_exists($setting)) {
                 include $setting;
             } else {
                 include $file;
             }
             if (isset($theme['display']) && $theme['display'] == 'list') {
                 $display = 'list';
             }
             //how to output breadcrumb
             $opt = array('hseparator' => '>>');
             breadcrumb_navxt::setup_options($opt);
             //valid setting
             if (empty($theme['styles'])) {
                 $theme['styles'] = array();
             }
             if (empty($theme['scripts'])) {
                 $theme['scripts'] = array();
             }
             if (!empty($theme['filters'])) {
                 //do filters & actions that defined in skin
                 $skin->instance->do_filters($theme['filters'], $theme);
             }
             /*if(count($theme['styles']) || count($theme['scripts'])) {   //enqueue stuff from theme
                   $skin->enqueue_files_from_skin($theme['styles'], $theme['scripts']);
               }*/
             //enqueue stuff from skin using new way
             HW_SKIN::enqueue_skin_assets(array_merge(array('skin_file' => $file, 'theme_settings' => $theme), (array) $skin));
             //}
         }
     }
     //how to ouput breadcrumb function
     if ($display == 'list') {
         $output = bcn_display_list(true, $linked, $reverse);
     } else {
         $output = bcn_display(true, $linked, $reverse);
     }
     echo '<div class="hw-breadcrumb">';
     echo apply_filters('hw_breadcrumb_output', $output, $this);
     echo '</div>';
 }
 /**
  * resume hw_skin instance from this field type value
  * @param $apf_hwskin_aValue
  */
 public static function resume_hwskin_instance($apf_hwskin_aValue = array())
 {
     return HW_SKIN::resume_hwskin_instance($apf_hwskin_aValue);
 }