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


PHP pts_strings::trim_search_query方法代码示例

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


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

示例1: auto_generate_results_identifier

 public function auto_generate_results_identifier()
 {
     // If the save result identifier is empty, try to come up with something based upon the tests being run.
     $results_identifier = null;
     $subsystem_r = array();
     $subsystems_to_test = $this->subsystems_under_test();
     if (!$this->is_new_result_file) {
         $result_file_intent = pts_result_file_analyzer::analyze_result_file_intent($this->result_file);
         if (is_array($result_file_intent) && $result_file_intent[0] != 'Unknown') {
             array_unshift($subsystems_to_test, $result_file_intent[0]);
         }
     }
     foreach ($subsystems_to_test as $subsystem) {
         $components = pts_result_file_analyzer::system_component_string_to_array(phodevi::system_hardware(true) . ', ' . phodevi::system_software(true));
         if ($subsystem != null && isset($components[$subsystem])) {
             $subsystem_name = pts_strings::trim_search_query($components[$subsystem]);
             if (phodevi::is_vendor_string($subsystem_name) && !in_array($subsystem_name, $subsystem_r)) {
                 array_push($subsystem_r, $subsystem_name);
             }
             if (isset($subsystem_r[2]) || isset($subsystem_name[19])) {
                 break;
             }
         }
     }
     if (isset($subsystem_r[0])) {
         $results_identifier = implode(' - ', $subsystem_r);
     }
     if (empty($results_identifier) && !$this->batch_mode) {
         $results_identifier = phodevi::read_property('cpu', 'model') . ' - ' . phodevi::read_property('gpu', 'model') . ' - ' . phodevi::read_property('motherboard', 'identifier');
     }
     if (strlen($results_identifier) > 55) {
         $results_identifier = substr($results_identifier, 0, 54);
         $results_identifier = substr($results_identifier, 0, strrpos($results_identifier, ' '));
     }
     if (empty($results_identifier)) {
         $results_identifier = date('Y-m-d H:i');
     }
     $this->results_identifier = $results_identifier;
     return $results_identifier;
 }
开发者ID:Jeni4,项目名称:phoronix-test-suite,代码行数:40,代码来源:pts_test_run_manager.php

示例2: system_component_to_format

 protected static function system_component_to_format(&$system_info, &$to_array, $component_types, $allow_trim_extra = false)
 {
     foreach ($component_types as $component_type) {
         if (isset($system_info[$component_type])) {
             $value = pts_strings::trim_search_query($system_info[$component_type]);
             if ($value != null) {
                 if ($allow_trim_extra && !isset($to_array[2])) {
                     $value_r = explode(' ', str_replace('-', ' ', $value));
                     array_pop($value_r);
                     array_push($to_array, $component_type . ':' . implode(' ', $value_r));
                 }
                 array_push($to_array, $component_type . ':' . $value);
             }
         }
     }
 }
开发者ID:pchiruma,项目名称:phoronix-test-suite,代码行数:16,代码来源:auto_compare.php

示例3: pci_devices

 public static function pci_devices()
 {
     $pci_devices = array();
     if (phodevi::is_linux() && isset(phodevi::$vfs->lspci)) {
         $lspci = phodevi::$vfs->lspci;
         $lspci = explode("\n\n", $lspci);
         foreach ($lspci as $o => &$lspci_section) {
             $lspci_section = explode("\n", $lspci_section);
             $formatted_section = array();
             foreach ($lspci_section as $i => &$line) {
                 $line = explode(':', $line);
                 if (count($line) == 2 && in_array($line[0], array('Class', 'Vendor', 'Device', 'Driver', 'Rev', 'Module'))) {
                     $line[1] = trim($line[1]);
                     if (($c = strrpos($line[1], ' [')) !== false) {
                         $id = substr($line[1], $c + 2);
                         $id = '0x' . substr($id, 0, strpos($id, ']'));
                         switch ($line[0]) {
                             case 'Vendor':
                                 $formatted_section['VendorID'] = $id;
                                 break;
                             case 'Device':
                                 $formatted_section['DeviceID'] = $id;
                                 break;
                         }
                         $line[1] = substr($line[1], 0, $c);
                     }
                     if ($line[0] == 'Class') {
                         switch ($line[1]) {
                             case 'Ethernet controller':
                             case 'Network controller':
                                 $line[1] = 'Network';
                                 break;
                             case 'VGA compatible controller':
                                 $line[1] = 'GPU';
                                 break;
                             case 'Audio device':
                             case 'Multimedia audio controller':
                                 $line[1] = 'Audio';
                                 break;
                                 //	case 'RAM memory':
                                 //	case 'Host bridge':
                                 //		$line[1] = 'Chipset';
                                 //		break;
                             //	case 'RAM memory':
                             //	case 'Host bridge':
                             //		$line[1] = 'Chipset';
                             //		break;
                             default:
                                 $line[1] = null;
                                 break;
                         }
                     } else {
                         if ($line[0] == 'Device' || $line[0] == 'Vendor') {
                             $line[1] = pts_strings::trim_search_query(pts_strings::strip_string($line[1]));
                             $line[1] = pts_strings::keep_in_string($line[1], pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE | pts_strings::CHAR_COLON | pts_strings::CHAR_COMMA);
                         }
                     }
                     $formatted_section[$line[0]] = $line[1];
                 }
             }
             if (count($formatted_section) > 0 && $formatted_section['Class'] != null) {
                 array_push($pci_devices, $formatted_section);
             }
         }
     }
     return $pci_devices;
 }
开发者ID:rkingsbury,项目名称:phoronix-test-suite,代码行数:67,代码来源:phodevi_motherboard.php


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