本文整理汇总了PHP中get_stats函数的典型用法代码示例。如果您正苦于以下问题:PHP get_stats函数的具体用法?PHP get_stats怎么用?PHP get_stats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_stats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_image
function generate_image($lang, $idx)
{
global $LANGUAGES;
$up_to_date = get_stats($idx, $lang, 'uptodate');
$up_to_date = $up_to_date[0];
//
$outdated = @get_stats($idx, $lang, 'outdated');
$outdated = $outdated[0];
//
$missing = get_stats($idx, $lang, 'notrans');
$missing = $missing[0];
//
$no_tag = @get_stats($idx, $lang, 'norev');
$no_tag = $no_tag[0];
$data = array($up_to_date, $outdated, $missing, $no_tag);
$percent = array();
$total = array_sum($data);
// Total ammount in EN manual (to calculate percentage values)
$total_files_lang = $total - $missing;
// Total ammount of files in translation
foreach ($data as $value) {
$percent[] = round($value * 100 / $total);
}
$legend = array($percent[0] . '%% up to date (' . $up_to_date . ')', $percent[1] . '%% outdated (' . $outdated . ')', $percent[2] . '%% missing (' . $missing . ')', $percent[3] . '%% without EN-Revision (' . $no_tag . ')');
$title = 'Details for ' . $LANGUAGES[$lang] . ' PHP Manual';
$graph = new PieGraph(530, 300);
$graph->SetShadow();
$graph->title->Set($title);
$graph->title->Align('left');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->legend->Pos(0.02, 0.18, "right", "center");
$graph->subtitle->Set('(Total: ' . $total_files_lang . ' files)');
$graph->subtitle->Align('left');
$graph->subtitle->SetColor('darkred');
$t1 = new Text(date('m/d/Y'));
$t1->SetPos(522, 294);
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->Align("right", 'bottom');
$t1->SetColor("black");
$graph->AddText($t1);
$p1 = new PiePlot3D($data);
$p1->SetSliceColors(array("#68d888", "#ff6347", "#dcdcdc", "#f4a460"));
if ($total_files_lang != $up_to_date) {
$p1->ExplodeAll();
}
$p1->SetCenter(0.35, 0.55);
$p1->value->Show(false);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->Stroke("../www/images/revcheck/info_revcheck_php_{$lang}.png");
}
示例2: site_stats
function site_stats($site_name)
{
global $lang, $config;
if ($config['generate_statistics']) {
$ga = new gapi($config['ga_email'], $config['ga_password']);
//get profile ids
$ga->requestAccountData();
foreach ($ga->getResults() as $result) {
$config[filename((string) $result)]['profile_id'] = $result->getProfileId();
}
if (isset($config[$site_name]['profile_id'])) {
$profile_id = $config[$site_name]['profile_id'];
//current week visits
$arr['visits'] = get_visits($ga, $profile_id, $config['from'], $config['to']);
$arr['prior_visits'] = get_visits($ga, $profile_id, $config['prior_from'], $config['prior_to']);
$arr['st'] = get_stats($arr['visits'], $arr['prior_visits']);
$arr['image_path'] = generate_image($lang[$site_name], $arr['visits']);
$arr['image_name'] = basename($arr['image_path']);
return $arr;
}
}
}
示例3: DAMAGES
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
// HTTP/1.0
require_once "guiconfig.inc";
require_once "system.inc";
include_once "includes/functions.inc.php";
echo get_stats();
示例4: get_xhr
function get_xhr()
{
echo json_encode(get_stats());
}
示例5: error_reporting
<?php
error_reporting(E_ALL);
require_once 'fuu.php';
if (isset($_GET['play'])) {
$id = (int) $_GET['play'];
increase_nb_play($id);
play_insult($id);
}
$insult = get_random_insult();
$stats = get_stats();
increase_nb_view($insult['id']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Fuu</title>
<style type="text/css">
body {
background-color: #303030;
font-family: 'Lucida Grande',sans-serif;
line-height: 1.5;
font-size: 0.75em;
color: #C0C0C0;
text-align: center;
}
#wrapper {
示例6: get_stats
?>
<form action="index.php">
<input type="submit" value="back to home" class="btn btn-primary">
</form>
</div>
</div>
<div class="col-md-3">
<div class="exercises">
<h2>Exercises</h2>
<ul>
<li><a href="llquiz.php">Drug identification</a></li>
<li><a href="laskuquiz.php">Drug calculations</a></li>
<li><a href="conversionquiz.php">Unit conversions</a></li>
<li><a href="examquiz.php">Exam</a></li>
</ul>
</div>
<h2>Statistics</h2>
<?php
get_stats($_SESSION['login_user'], 0);
?>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
</body>
</html>
示例7: get
function get()
{
$stats = get_stats();
include "views/dashboard.php";
}
示例8: iterkeys
function iterkeys($fp, $dumpmode = DUMPMODE_ONLYKEYS)
{
$slabs = slabs_stats($fp);
$stats = get_stats($fp, 'stats');
ksort($slabs);
printf(" %-40s %20s %10s %8s" . PHP_EOL, 'Key', 'Expire status', 'Size', 'Waste');
foreach ($slabs as $num => $slab) {
if ($num == 'total') {
continue;
}
if ($slab['number']) {
$lines = send_and_receive($fp, "stats cachedump {$num} {$slab['number']}");
foreach ($lines as $line) {
$m = array();
if (preg_match('/^ITEM ([^\\s]+) \\[(\\d+) b; (\\d+) s\\]/', $line, $m)) {
$key = $m[1];
$size = $m[2];
$now = time();
$waste = (1.0 - (double) $size / $slab['chunk_size']) * 100;
$expiration_time = $m[3];
if ($expiration_time == $stats['time'] - $stats['uptime']) {
$status = '[never expire]';
} elseif ($now > $expiration_time) {
$status = '[expired]';
} else {
$status = $expiration_time - $now . 's left';
}
printf("ITEM %-40s %20s %10s %7.0f%%" . PHP_EOL, $key, $status, $size, $waste);
// Get value
if ($dumpmode == DUMPMODE_KEYVALUES && $status != '[expired]') {
$lines = send_and_receive($fp, "get {$key}");
if (count($lines)) {
$info = $lines[0];
$data = $lines[1];
preg_match('/^VALUE ([^\\s]+) (\\d+) (\\d+)/', $info, $m);
$flags = $m[2];
printf("VALUE %-40s flags=%X" . PHP_EOL, $key, $flags);
printf("%s" . PHP_EOL, $data);
}
}
// Get value
if ($dumpmode == REMOVEMODE_EXPIRED && $status == '[expired]') {
$lines = send_and_receive($fp, "get {$key}");
}
}
}
}
}
}
示例9: get_input
<?php
namespace hypeJunction\Interactions;
$comment_guid = get_input('guid');
$comment = get_entity($comment_guid);
/* @var Comment $comment */
if ($comment instanceof Comment && $comment->canEdit()) {
$entity = $comment->getContainerEntity();
if ($comment->delete()) {
if (elgg_is_xhr()) {
$output = array('guid' => $comment_guid, 'stats' => get_stats($entity));
echo json_encode($output);
}
system_message(elgg_echo('generic_comment:deleted'));
} else {
register_error(elgg_echo('generic_comment:notdeleted'));
}
} else {
register_error(elgg_echo('generic_comment:notfound'));
}
forward(REFERER);
示例10: str_replace
echo "Profile Url: {$profileUrl}\n";
$portraitName = str_replace("http://cdn.dota2.com/apps/dota2/images/heroes/", "", $portraitUrl);
$portraitArray[$hero] = $portraitName;
echo "\n";
foreach ($abilities as $ability) {
$abilityNameNode = $xPath->evaluate($xpath_query['abilityName'], $ability);
$abilityNameString = $abilityNameNode->item(0)->nodeValue;
$abilityDescriptionNode = $xPath->evaluate($xpath_query['abilityDescription'], $ability);
$abilityDescriptionString = $abilityDescriptionNode->item(0)->nodeValue;
$abilityArray[$abilityNameString]['Description'] = array($abilityDescriptionString);
// We can use this array shit to add other things like Mana Cost and numbers
}
$heroBio = $xPath->query($xpath_query['heroBio']);
$heroBioString = trim($heroBio->item(0)->nodeValue);
$stats = array();
$stats = get_stats($xPath);
$outputArray[$hero]['abilities'] = $abilityArray;
$outputArray[$hero]['bio'] = $heroBioString;
$outputArray[$hero]['stats'] = $stats;
}
$outputJson = json_encode($outputArray);
$portraitJson = json_encode($portraitArray);
$fp = fopen(DOCUMENT_ROOT . "resources/heroes.json", "w");
$retVal = fwrite($fp, $outputJson);
fclose($fp);
$portFp = fopen(DOCUMENT_ROOT . "resources/portrait.json", "w");
$retVal = fwrite($portFp, $portraitJson);
function get_stats($xPath)
{
global $xpath_query;
$attributeArray = array("str", "int", "agi");
示例11: create_summary
function create_summary(&$project_table)
{
global $xml_array_g, $current_session_g;
# Present executive summary of all issues. Project table is passed by reference
print "\n<br /><br /><div id='pageTitle'>Quality Assurance Executive Summary: <strong>" . $current_session_g['project'] . "</strong> Activity for past 30 days</div><center><br />" . "<table border=0 width=300 cellpadding=3 cellspacing=2>\n";
parse_xml_file(CT_XML_BUGS_FILE, CT_DROP_HISTORY, "PROJECT", CT_ASCENDING);
$bug_table =& $xml_array_g;
# Copy by reference, so don't call parse_xml_file again
$bug_severity = explode(",", CT_BUG_SEVERITIES);
$bug_status = explode(",", CT_BUG_STATUSES);
$stats["change_requests_created"] = 0;
$stats["change_requests_closed"] = 0;
$stats["change_requests_deferred"] = 0;
$stats["defect_reports_created"] = 0;
$stats["defect_reports_closed"] = 0;
$stats["defects_deferred"] = 0;
$stats["average_lifespan_of_change_requests"] = 0;
$mean_cnt["average_lifespan_of_defects"] = 0;
$stats["average_lifespan_of_defects"] = 0;
$mean_cnt["average_lifespan_of_change_requests"] = 0;
foreach ($bug_table as $bug) {
if ($bug["Project"] != $current_session_g["project"]) {
continue;
}
if (isset($bug["Delete_Bug"])) {
continue;
}
if (strtotime($bug["Submit_Time"]) >= strtotime("-30 days") and strtotime($bug["Submit_Time"]) <= strtotime("now")) {
if (strstr($bug["Severity"], "Change Req")) {
$stats["change_requests_created"]++;
} else {
$stats["defect_reports_created"]++;
}
}
if (strtotime($bug["Last_Updated"]) >= strtotime("-30 days") and strtotime($bug["Last_Updated"]) <= strtotime("now")) {
if (strstr($bug["Status"], "Closed")) {
if (strstr($bug["Severity"], "Change Req")) {
$stats["change_requests_closed"]++;
$stats["average_lifespan_of_change_requests"] += strtotime($bug["Last_Updated"]) - strtotime($bug["Submit_Time"]);
$mean_cnt["average_lifespan_of_change_requests"]++;
} else {
$stats["defect_reports_closed"]++;
$stats["average_lifespan_of_defects"] += strtotime($bug["Last_Updated"]) - strtotime($bug["Submit_Time"]);
$mean_cnt["average_lifespan_of_defects"]++;
}
} elseif (strstr($bug["Status"], "Deferred")) {
if (strstr($bug["Severity"], "Change Req")) {
$stats["change_requests_deferred"]++;
} else {
$stats["defects_deferred"]++;
}
}
}
}
print "<tr><td colspan=2 align=left class='rowEven2'><b>" . $current_session_g['project'] . "</b></td></tr>\n";
$rows = 0;
foreach ($stats as $stat => $value) {
if ($mean_cnt[$stat] != 0) {
print "<tr><td align=right class='" . ($rows % 2 ? "rowOdd" : "rowEven") . "'>" . ucwords(strtr($stat, "_", " ")) . "</td><td class='" . ($rows++ % 2 ? "rowOdd" : "rowEven") . "'>" . (strstr($stat, "lifespan") ? get_stats($value / $mean_cnt[$stat]) : $value) . "</td></tr>\n";
}
}
print "</table>\n</center><br /><br />";
}
示例12: forward
forward(REFERER);
}
if (elgg_is_active_plugin('hypeAttachments')) {
hypeapps_attach_uploaded_files($comment, 'uploads', ['origin' => 'comment', 'container_guid' => $comment->guid, 'access_id' => $comment->access_id]);
}
if ($new_comment) {
if ($entity->owner_guid != $poster->guid) {
// Send a notification to the content owner
$recipient = $entity->getOwnerEntity();
$language = $recipient->language;
$messages = (new NotificationFormatter($comment, $recipient, $language))->prepare();
notify_user($recipient->guid, $poster->guid, $messages->subject, $messages->body, array('object' => $comment, 'action' => 'create', 'summary' => $messages->summary));
}
// Add to river
elgg_create_river_item(array('view' => 'river/object/comment/create', 'action_type' => 'create', 'subject_guid' => $poster->guid, 'object_guid' => $comment->guid, 'target_guid' => $entity->guid));
}
if (elgg_is_xhr()) {
elgg_push_context('comments');
if ($comment_guid) {
// editing a comment
$view = elgg_view_entity($comment, ['full_view' => true]);
} else {
// new comment
$view = elgg_view('framework/interactions/comments', array('entity' => $entity, 'comment' => $comment));
}
$output = array('guid' => $entity->guid, 'view' => $view, 'stats' => get_stats($entity));
echo json_encode($output);
elgg_pop_context();
}
system_message(elgg_echo('generic_comment:posted'));
forward($comment->getURL());
示例13: array
$stats = array('*sum' => $first);
foreach (file($file) as $line) {
//r5887 | buildmob | 2011-08-23 13:08:25 -0700 (Tue, 23 Aug 2011) | 4 lines
if (count(list($r, $u, $d, $n) = explode(' | ', $line)) < 4) {
continue;
}
if ($stats[$u]) {
$stats[$u]['commits']++;
$stats[$u]['lines'] += (int) $n;
$stats['*sum']['commits']++;
$stats['*sum']['lines'] += (int) $n;
} else {
$stats[$u] = $first;
}
}
return $stats;
}
function print_stats(array $stats, $sortby)
{
print "users commits commit% lines line% (sorted by {$sortby})\n";
print "------- ------- ------- ----- -------\n";
uasort($stats, function ($a, $b) use($sortby) {
return $b[$sortby] - $a[$sortby];
});
foreach ($stats as $user => $stat) {
printf("% -10s% 6d% 8.1f%%% 7d% 8.1f%%\n", $user, $stat['commits'], $stat['commits'] / $stats['*sum']['commits'] * 100, $stat['lines'], $stat['lines'] / $stats['*sum']['lines'] * 100);
}
print "\n";
}
print_stats(get_stats('php://stdin'), $argc > 1 ? 'lines' : 'commits');
示例14: write_header
echo VERSION;
?>
</i><br>
<i><a href="http://www.amule-project.net/">http://www.amule-project.net/</a></i><br>
<i><uberpenguin at hotpop dot com></i>
</body>
</html>
<?php
}
/**
* Write out the stats to the browser. I will probably change this later on
* to be themable, but for now I lack the motivation...
*/
write_header();
$ret = get_stats();
if (!$ret) {
echo $text["sigfileerr"];
} else {
// html strings that are used over and over
$nastring = "\t\t\t\t\t<td class=\"organize\">" . $text["na"] . "</td>\n\t\t\t\t</tr>\n";
$titlecolstart = "\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"organize\">";
$titlecolend = "</td>\n";
$datacolstart = "\t\t\t\t\t<td class=\"organize\">";
$datacolend = "</td>\n\t\t\t\t</tr>\n";
$sectiontablestart = "\t<table class=\"sec\">\n\t\t" . "<tr class=\"secheader\">\n\t\t\t<td class=\"secheader\">";
$sectiontablenext = "</td>\n\t\t</tr>\n";
$sectionend = "\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t</table>" . "\n\t<p>\n";
$innertable = "\t\t<tr class=\"secbody\">\n\t\t\t" . "<td class=\"secbody\">\n";
$organizetable = "\t\t\t<table class=\"organize\">\n";
// title
示例15: get_lang
</style>
<div id="cev_results_header" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<div id="cev_results" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"><?php
echo get_lang('Statistics');
?>
</div><br />
<div id="cev_cont_stats">
<?php
if ($result_to_print != "") {
$rst = get_stats($user_id, $course_code);
$foo_stats = '<strong>' . get_lang('Total') . ': </strong>' . $rst['total'] . '<br />';
$foo_stats .= '<strong>' . get_lang('Average') . ': </strong>' . $rst['avg'] . '<br />';
$foo_stats .= '<strong>' . get_lang('Quantity') . ' : </strong>' . $rst['times'] . '<br />';
echo $foo_stats;
} else {
echo Display::display_warning_message(get_lang('NoDataAvailable'));
}
echo '<p> Estadisticas de usuario no.: ' . $user_id . ' curso`: ' . $course_code . '</p>';
//// Conexi�n a la BD e inserci�n de datos //////////////////////
$enlace = mysql_connect('localhost', 'siec', 'siec2013');
if (!$enlace) {
die('No pudo conectarse: ' . mysql_error());
}
mysql_select_db(siec) or die("Cannot select database!<br>" . mysql_error());
$fecha1 = $_GET['fecha1'];