当前位置: 首页>>代码示例>>PHP>>正文


PHP ServiceUtil::endsWith方法代码示例

本文整理汇总了PHP中ServiceUtil::endsWith方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceUtil::endsWith方法的具体用法?PHP ServiceUtil::endsWith怎么用?PHP ServiceUtil::endsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceUtil的用法示例。


在下文中一共展示了ServiceUtil::endsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fixSearchName

 public function fixSearchName($term)
 {
     require_once 'ServiceUtil.php';
     $util = new ServiceUtil();
     $newName = $term;
     $searchName = $term;
     if (strcasecmp($searchName, "cell") == 0) {
         $newName = $searchName;
     } else {
         if (strcasecmp($searchName, "neuron") == 0) {
             $newName = $searchName;
         } else {
             if ($util->endsWith($searchName, "%20cell")) {
                 $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20cell"));
                 $newName = $tempName;
             } else {
                 if ($util->endsWith($searchName, "%20neuron")) {
                     $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20neuron"));
                     $newName = $tempName;
                 }
             }
         }
     }
     return $newName;
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:25,代码来源:ViewAllData.php

示例2: handleDataSpace

 private function handleDataSpace(&$data, $searchName)
 {
     //require_once  'Globals.php';
     require_once 'ServiceUtil.php';
     $util = new ServiceUtil();
     $newName = $searchName;
     if (strcasecmp($searchName, "cell") == 0) {
         $newName = $searchName;
     } else {
         if (strcasecmp($searchName, "neuron") == 0) {
             $newName = $searchName;
         } else {
             if ($util->endsWith($searchName, "%20cell")) {
                 $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20cell"));
                 $newName = $tempName;
             } else {
                 if ($util->endsWith($searchName, "%20neuron")) {
                     $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20neuron"));
                     $newName = $tempName;
                 }
             }
         }
     }
     //echo "<p>----------------NewName:".$newName;
     $source_search_result = array();
     $sources = $data["config_array"]->sources;
     $category_to_source = $data["category_to_source"];
     $categories = $data["config_array"]->categories;
     $category_count_array = array();
     foreach ($sources as $source) {
         $source_search_result[$source->curie] = $util->searchWithinSource($newName, $source->curie, 20, 0);
     }
     foreach ($categories as $category) {
         $category_count_array[$category] = 0;
         $categorySources = $category_to_source[$category];
         foreach ($categorySources as $csource) {
             $sourceResult = $source_search_result[$csource->curie];
             if (!is_null($sourceResult)) {
                 $category_count_array[$category] = $category_count_array[$category] + $sourceResult->result->resultCount;
             }
         }
     }
     $data["source_search_result"] = $source_search_result;
     //var_dump($category_count_array);
     $data["category_count_array"] = $category_count_array;
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:46,代码来源:API.php

示例3: view

 public function view($sourceID, $term, $pageID)
 {
     //require_once  'JsonClientUtil.php';
     //require_once 'Config.php';
     require_once 'ServiceUtil.php';
     require_once 'Config.php';
     $util = new ServiceUtil();
     $myConfig = new Config();
     $myConfig->loadJsonConfig($data);
     $data['test'] = NULL;
     $term = str_replace("_", "%20", $term);
     $newName = $term;
     $searchName = $term;
     if (strcasecmp($searchName, "cell") == 0) {
         $newName = $searchName;
     } else {
         if (strcasecmp($searchName, "neuron") == 0) {
             $newName = $searchName;
         } else {
             if ($util->endsWith($searchName, "%20cell")) {
                 $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20cell"));
                 $newName = $tempName;
             } else {
                 if ($util->endsWith($searchName, "%20neuron")) {
                     $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20neuron"));
                     $newName = $tempName;
                 }
             }
         }
     }
     $offset = 0;
     //echo "\nSourceID------".$sourceID;
     //echo "\nTerm:".$term;
     if (!isset($pageID) || $pageID <= 1) {
         $offset = 0;
     } else {
         $offset = ($pageID - 1) * 20;
     }
     //echo "---------------".$newName;
     $data['resultObj'] = $util->searchWithinSource($newName, $sourceID, 20, $offset);
     // $data['resultObj'] = searchWithinSource2($term, $sourceID, 20,$offset);
     /*if(endsWith($term, "%20cell"))
       {
           
           $tempName = substr($term, 0, strlen($term)-strlen("%20cell"));
           //echo "-------------tempName:".$tempName."----".strlen($term)."--------";
           $tempResult = searchWithinSource2($tempName, $sourceID, 20,$offset);
           if($tempResult->result->resultCount > $data['resultObj']->result->resultCount)
               $data['resultObj'] = $tempResult;
       }*/
     $data['sourceID'] = $sourceID;
     $data['pageID'] = $pageID;
     $data['term'] = $term;
     $protocol = "http";
     if (isset($_SERVER['HTTPS'])) {
         $protocol = "https";
     }
     $surl = $protocol . "://" . $_SERVER['SERVER_NAME'] . "/" . Config::$localContextName . "/resources/source_description/" . $sourceID;
     //echo "\n".$surl;
     $responseCode = @get_headers($surl);
     //echo "CODE:".$file_headers[0]."---------";
     if ($responseCode[0] == 'HTTP/1.1 404 Not Found') {
         $data['description'] = "";
     } else {
         $data['description'] = file_get_contents($surl);
     }
     //var_dump($data['resultObj']);
     $data['page_title'] = "Search:" . str_replace("%20", " ", $term);
     $data['enable_config'] = true;
     $this->load->view('templates/header2', $data);
     $this->load->view('pages/resultDisplay', $data);
     $this->load->view('templates/footer2', $data);
 }
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:73,代码来源:Results.php

示例4: handleDataSpace

 private function handleDataSpace(&$data, $searchName)
 {
     //require_once  'Globals.php';
     require_once 'ServiceUtil.php';
     $util = new ServiceUtil();
     $newName = $searchName;
     if (strcasecmp($searchName, "cell") == 0) {
         $newName = $searchName;
     } else {
         if (strcasecmp($searchName, "neuron") == 0) {
             $newName = $searchName;
         } else {
             if ($util->endsWith($searchName, "%20cell")) {
                 $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20cell"));
                 $newName = $tempName;
             } else {
                 if ($util->endsWith($searchName, "%20neuron")) {
                     $tempName = substr($searchName, 0, strlen($searchName) - strlen("%20neuron"));
                     $newName = $tempName;
                 }
             }
         }
     }
     //echo "<p>----------------NewName:".$newName;
     $source_search_result = array();
     $sources = $data["config_array"]->sources;
     $category_to_source = $data["category_to_source"];
     $categories = $data["config_array"]->categories;
     $category_count_array = array();
     foreach ($sources as $source) {
         $source_search_result[$source->curie] = $util->searchWithinSource($newName, $source->curie, 20, 0);
     }
     foreach ($categories as $category) {
         $category_count_array[$category] = 0;
         $categorySources = $category_to_source[$category];
         foreach ($categorySources as $csource) {
             $sourceResult = $source_search_result[$csource->curie];
             if (!is_null($sourceResult)) {
                 $category_count_array[$category] = $category_count_array[$category] + $sourceResult->result->resultCount;
             }
         }
     }
     $data["source_search_result"] = $source_search_result;
     //var_dump($category_count_array);
     $data["category_count_array"] = $category_count_array;
     $data['cilImages'] = array();
     $data['originalCILImages'] = array();
     $data['neuroMorphoImages'] = array();
     foreach ($sources as $source) {
         if ($source->has_images) {
             $tempImages = $util->getImageArray($source_search_result[$source->curie], 20);
             if (strcmp($source->curie, "nif-0000-37639-1") == 0) {
                 $data['originalCILImages'] = $tempImages;
                 //echo "------originalCILImages source:".$source->curie;
             } else {
                 if (strcmp($source->curie, "nif-0000-00006-1") == 0) {
                     $data['neuroMorphoImages'] = $tempImages;
                     //echo "------neuroMorphoImages source:".$source->curie;
                 }
             }
             $data['cilImages'] = array_merge($tempImages, $data['cilImages']);
         }
     }
     $imageGallery = array();
     if (strcmp($data['title'], "Neocortical pyramidal cell") == 0) {
         $gimage = "   <a href=\"http://celltypes.brain-map.org/mouse/experiment/morphology/330080937\" target=\"_blank\">" . "   <img width=\"84\" height=\"100\" src=\"http://celltypes.brain-map.org/cgi-bin/imageservice?path=/external/mousecelltypes/prod210/specimen_324466858/min_xy_324466858.aff&mime=2\"/>" . "   </a>";
         array_push($imageGallery, $gimage);
     }
     if (count($data['originalCILImages']) > 0) {
         array_push($imageGallery, $data['originalCILImages'][0]);
     }
     if (count($data['originalCILImages']) > 1) {
         array_push($imageGallery, $data['originalCILImages'][1]);
     }
     if (count($data['neuroMorphoImages']) > 0) {
         foreach ($data['neuroMorphoImages'] as $gimage) {
             array_push($imageGallery, $gimage);
             if (count($imageGallery) == 3) {
                 break;
             }
         }
     }
     if (count($data['originalCILImages']) > 2) {
         $cindex = 0;
         foreach ($data['originalCILImages'] as $gimage) {
             if (count($imageGallery) == 3) {
                 break;
             }
             if ($cindex > 1) {
                 array_push($imageGallery, $gimage);
             }
             $cindex++;
         }
     }
     $data['imageGallery'] = $imageGallery;
     /*
                 $data['neuroElectroResult'] = searchWithinSource($newName, $neuroElectro, 20);
                 $data['neuroMorphoResult'] = searchWithinSource($newName, $neuroMorpho, 20);
                 $data['genSatResult'] = searchWithinSource($newName, $genSat, 20);
                 $data['neuronDBResult'] = searchWithinSource($newName, $neuronDB, 20);
//.........这里部分代码省略.........
开发者ID:NeuroscienceKnowledgeSpace,项目名称:KnowledgeSpace,代码行数:101,代码来源:Pages_1.php


注:本文中的ServiceUtil::endsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。