function get_multi_set($post_id) { $post_data = wp_gdget_post($post_id); if (is_object($post_data)) { if ($post_data->cmm_integration_mur == "N") { return 0; } else { if ($post_data->cmm_integration_mur == "A") { return $post_data->cmm_integration_set; } } } $this->init_post_categories_data($post_id); $set = $prn = 0; foreach ($this->cats_data_posts[$post_id] as $cat) { if ($cat->cmm_integration_mur == "N") { return 0; } if ($cat->parent > 0 && $prn == 0) { $prn = $cat->parent; } if ($cat->cmm_integration_set > 0 && $set == 0) { $set = $cat->cmm_integration_set; } if ($set > 0 || $set > 0 && $prn > 0) { break; } } if ($set > 0) { return $set; } if ($prn > 0) { $set = $this->get_multi_set_recursion($prn); if ($set > 0) { return $set; } $first = GDSRDBMulti::get_first_multi_set(); return $first->multi_id; } else { return 0; } }