Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/xhprof/xhprof_lib/display/typeahead_common.php
Go to the documentation of this file.
00001 <?php
00002 //  Copyright (c) 2009 Facebook
00003 //
00004 //  Licensed under the Apache License, Version 2.0 (the "License");
00005 //  you may not use this file except in compliance with the License.
00006 //  You may obtain a copy of the License at
00007 //
00008 //      http://www.apache.org/licenses/LICENSE-2.0
00009 //
00010 //  Unless required by applicable law or agreed to in writing, software
00011 //  distributed under the License is distributed on an "AS IS" BASIS,
00012 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 //  See the License for the specific language governing permissions and
00014 //  limitations under the License.
00015 //
00016 
00028 require_once $GLOBALS['XHPROF_LIB_ROOT'].'/utils/xhprof_lib.php';
00029 
00030 // param name, its type, and default value
00031 $params = array('q'          => array(XHPROF_STRING_PARAM, ''),
00032                 'run'        => array(XHPROF_STRING_PARAM, ''),
00033                 'run1'       => array(XHPROF_STRING_PARAM, ''),
00034                 'run2'       => array(XHPROF_STRING_PARAM, ''),
00035                 'source'     => array(XHPROF_STRING_PARAM, 'xhprof'),
00036                 );
00037 
00038 // pull values of these params, and create named globals for each param
00039 xhprof_param_init($params);
00040 
00041 if (!empty($run)) {
00042 
00043   // single run mode
00044   $raw_data = $xhprof_runs_impl->get_run($run, $source, $desc_unused);
00045   $functions = xhprof_get_matching_functions($q, $raw_data);
00046 
00047 } else if (!empty($run1) && !empty($run2)) {
00048 
00049   // diff mode
00050   $raw_data = $xhprof_runs_impl->get_run($run1, $source, $desc_unused);
00051   $functions1 = xhprof_get_matching_functions($q, $raw_data);
00052 
00053   $raw_data = $xhprof_runs_impl->get_run($run2, $source, $desc_unused);
00054   $functions2 = xhprof_get_matching_functions($q, $raw_data);
00055 
00056 
00057   $functions = array_unique(array_merge($functions1, $functions2));
00058   asort($functions);
00059 } else {
00060   xhprof_error("no valid runs specified to typeahead endpoint");
00061   $functions = array();
00062 }
00063 
00064 // If exact match is present move it to the front
00065 if (in_array($q, $functions)) {
00066   $old_functions = $functions;
00067 
00068   $functions = array($q);
00069   foreach ($old_functions as $f) {
00070     // exact match case has already been added to the front
00071     if ($f != $q) {
00072       $functions[] = $f;
00073     }
00074   }
00075 }
00076 
00077 foreach ($functions as $f) {
00078   echo $f."\n";
00079 }
00080 
 All Data Structures Namespaces Files Functions Variables Enumerations