private function _fw_check_conditional_tags($priority)
 {
     $conditional_tags = $this->config->get_conditional_tags($priority);
     foreach ($conditional_tags as $key => $cond_tag) {
         $function = null;
         if (isset($cond_tag['conditional_tag'])) {
             $function = isset($cond_tag['conditional_tag']['callback']) ? $cond_tag['conditional_tag']['callback'] : '';
             if (is_callable($function)) {
                 $params = array();
                 if (isset($cond_tag['conditional_tag']['params']) and is_array($cond_tag['conditional_tag']['params'])) {
                     $params = $cond_tag['conditional_tag']['params'];
                 }
                 if (call_user_func_array($function, $params)) {
                     $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::CONDITIONAL_TAGS_PREFIX);
                     $data['sub_type'] = $key;
                     $result = $this->get_preset_sidebars($data);
                     if ($result) {
                         return $result;
                     }
                 }
             }
         } else {
             $function = $key;
             if (is_callable($function)) {
                 if (call_user_func($function)) {
                     $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::CONDITIONAL_TAGS_PREFIX);
                     $data['sub_type'] = $key;
                     $result = $this->get_preset_sidebars($data);
                     if ($result) {
                         return $result;
                     }
                 }
             }
         }
     }
 }
 /**
  * Generate current page requirements and return array with avaible sidebars for current page
  */
 public function get_current_page_preset()
 {
     //check if current_page_preset doesn't get before
     if ($this->current_page_preset !== null) {
         return $this->current_page_preset;
     }
     if (is_singular()) {
         $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::POST_TYPES_PREFIX);
         $data['sub_type'] = get_post_type();
         $data['id'] = get_the_id();
         $result = $this->get_preset_sidebars($data);
         if ($result) {
             return $result;
         }
     }
     if (is_category()) {
         $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::TAXONOMIES_PREFIX);
         $data['sub_type'] = 'category';
         $data['id'] = get_query_var('cat');
         $result = $this->get_preset_sidebars($data);
         if ($result) {
             return $result;
         }
     }
     if (is_tag()) {
         $term_obj = get_term_by('slug', get_query_var('tag'), 'post_tag');
         $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::TAXONOMIES_PREFIX);
         $data['sub_type'] = $term_obj->taxonomy;
         $data['id'] = $term_obj->term_id;
         $result = $this->get_preset_sidebars($data);
         if ($result) {
             return $result;
         }
     }
     if (is_tax()) {
         $term_obj = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
         $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::TAXONOMIES_PREFIX);
         $data['sub_type'] = $term_obj->taxonomy;
         $data['id'] = $term_obj->term_id;
         $result = $this->get_preset_sidebars($data);
         if ($result) {
             return $result;
         }
     }
     $conditional_tags = $this->config->get_conditional_tags();
     foreach ($conditional_tags as $key => $cond_tag) {
         $function = null;
         if (isset($cond_tag['conditional_tag'])) {
             $function = isset($cond_tag['conditional_tag']['callback']) ? $cond_tag['conditional_tag']['callback'] : '';
             if (is_callable($function)) {
                 $params = array();
                 if (isset($cond_tag['conditional_tag']['params']) and is_array($cond_tag['conditional_tag']['params'])) {
                     $params = $cond_tag['conditional_tag']['params'];
                 }
                 if (call_user_func_array($function, $params)) {
                     $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::CONDITIONAL_TAGS_PREFIX);
                     $data['sub_type'] = $key;
                     $result = $this->get_preset_sidebars($data);
                     if ($result) {
                         return $result;
                     }
                 }
             }
         } else {
             $function = $key;
             if (is_callable($function)) {
                 if ($function()) {
                     $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::CONDITIONAL_TAGS_PREFIX);
                     $data['sub_type'] = $key;
                     $result = $this->get_preset_sidebars($data);
                     if ($result) {
                         return $result;
                     }
                 }
             }
         }
     }
     $data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::DEFAULT_PREFIX);
     $data['sub_type'] = _FW_Extension_Sidebars_Config::DEFAULT_SUB_TYPE;
     $result = $this->get_preset_sidebars($data);
     //return preset default for all pages
     return $result;
 }