瀏覽代碼

Added a case-insenstive match for content types in WS

Stephen Ficklin 6 年之前
父節點
當前提交
aae870edd9
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

+ 5 - 1
tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

@@ -68,10 +68,14 @@ class TripalContentService_v0_1 extends TripalWebService {
       $ctype_lookup = array();
       $found = FALSE;
       while ($bundle = $bundles->fetchObject()) {
-        if ($ctype == preg_replace('/[^\w]/', '_', $bundle->label)) {
+        // Check the label by replacing non alpha-numeric characters with 
+        // an underscore and is case-insensitive
+        $label = preg_replace('/[^\w]/', '_', $bundle->label);
+        if (preg_match("/$label/i", $ctype)) {
           $ctype = $bundle->label;
           $found = TRUE;
         }
+        // Check if this is an accession.
         if ($ctype == $bundle->vocabulary . ':' . $bundle->accession) {
           $ctype = $bundle->label;
           $found = TRUE;