示例#1
0
function search()
{
    $query = $_REQUEST['query'];
    $data = query_content($query);
    #Check and see if there are any results
    if ($data->count > 0) {
        $return_data['status'] = "ok";
        $return_data['count'] = $data->count;
        $return_data['content'] = parse_results($data);
    } else {
        $return_data['status'] = "no_results";
    }
    return $return_data;
}
示例#2
0
function searchSubCategories($value)
{
    $query = sprintf("SELECT p.* \n\t\t\tFROM products p, subcategories s\n\t\t\tWHERE s.subcategory_name =  '%s'\n\t\t\tAND p.subcategory_id = s.subcategory_id", mysqli_real_escape_string(db_connect(), $value));
    $results = do_query($query);
    if ($results) {
        $rows = parse_results($results);
        return array("status" => 1, "title" => "Success", "msg" => "Succesfully search subcategories.", "results" => $rows);
    } else {
        return array("status" => 0, "title" => "Failure", "msg" => "Failed to connect to server.");
    }
}
<?php

require __DIR__ . '/../libs/parse_results.php';
require __DIR__ . '/../libs/build_table.php';
require __DIR__ . '/../libs/recalc_relative.php';
$list = ['cake-3.0', 'symfony-2.6', 'zf-2.4'];
system('git checkout master');
$results_master = parse_results(__DIR__ . '/../output/results.hello_world.log');
system('git checkout optimize');
$results_optimize = parse_results(__DIR__ . '/../output/results.hello_world.log');
//var_dump($results_master, $results_optimize);
$is_fisrt = true;
foreach ($list as $fw) {
    $results = [];
    $results[$fw] = $results_master[$fw];
    $results[$fw . ' (*)'] = $results_optimize[$fw];
    $results = recalc_relative($results);
    echo build_table($results, $is_fisrt);
    $is_fisrt = false;
}
/*HEADER INFORMATION*/
function parse_results($res)
{
    /*Variables*/
    $lines = explode("\n", $res);
    /*Print All*/
    echo '<pre>' . print_r($lines, TRUE) . '</pre>';
    /*Location*/
    $url = $lines[8];
}
/*Variables*/
$API_KEY = '';
$API_SECRET = '';
$archiveId = '';
$stitchUrl = "https://api.opentok.com/hl/archive/{$archiveId}/stitch";
/*CURL*/
/*Start CURL*/
$ch = curl_init();
/*CURL Variables*/
curl_setopt($ch, CURLOPT_URL, $stitchUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded', "X-TB-PARTNER-AUTH: {$API_KEY}:{$API_SECRET}", 'Content-length:0'));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
/*CURL Result*/
$res = curl_exec($ch);
/*Process Response*/
parse_results($res);
/*Close CURL*/
curl_close($ch);
<?php

require __DIR__ . '/../libs/parse_results.php';
require __DIR__ . '/../libs/build_table.php';
$module = $_SERVER['argv'][1];
if (in_array($module, array_keys($modules))) {
    $results = parse_results(__DIR__ . '/../output/' . $module . '/results.hello_world.log');
    //var_dump($results);
    echo $modules[$module];
    echo "\n";
    echo build_table($results);
    echo "\n";
}
<?php

Parse_Results:
require __DIR__ . '/libs/parse_results.php';
$results = parse_results(__DIR__ . '/output/results.hello_world.log');
Load_Theme:
$theme = isset($_GET['theme']) ? $_GET['theme'] : 'default';
if (!ctype_alnum($theme)) {
    exit('Invalid theme');
}
if ($theme === 'default') {
    require __DIR__ . '/libs/make_graph.php';
} else {
    $file = __DIR__ . '/libs/' . $theme . '/make_graph.php';
    if (is_readable($file)) {
        require $file;
    } else {
        require __DIR__ . '/libs/make_graph.php';
    }
}
// RPS Benchmark
list($chart_rpm, $div_rpm) = make_graph('rps', 'Throughput', 'requests per second');
// Memory Benchmark
list($chart_mem, $div_mem) = make_graph('memory', 'Memory', 'peak memory (MB)');
// Exec Time Benchmark
list($chart_time, $div_time) = make_graph('time', 'Exec Time', 'ms');
// Included Files
list($chart_file, $div_file) = make_graph('file', 'Included Files', 'count');
?>
<!DOCTYPE html>
<html lang="en">
示例#7
0
                // If the name has no _ left, continue with the next file, display an
                // error.
                if (strpos($name, '_') === FALSE) {
                    print "ERROR: Failed to move simpletest to the correct project: " . $simpletest_file_info->getFilename() . "\n";
                }
            } while ($name = substr($name, 0, strrpos($name, '_')));
        }
    }
    rmdir('www/simpletest');
}
$projects = parse_results('www');
$total_counter = count($projects);
$failed_counter = 0;
$changed_counter = 0;
if (is_dir('www-old')) {
    $projects_old = parse_results('www-old');
}
foreach ($projects as $name => &$project) {
    $has_changed = FALSE;
    if (!isset($projects_old[$name])) {
        $project['new'] = TRUE;
        continue;
    }
    $project['url'] = get_project_url($name, $config['projects']);
    foreach (['phpunit', 'simpletest'] as $framework) {
        if (!isset($project[$framework])) {
            continue;
        }
        foreach ($project[$framework] as $type => $count) {
            if (isset($projects_old[$name][$framework][$type])) {
                $project[$framework][$type . '_diff'] = $count - $projects_old[$name][$framework][$type];