Ejemplo n.º 1
0
function showDate($date)
{
    $stf = 0;
    $current_time = time();
    $diff = $current_time - $date;
    $seconds = array('секунду', 'секунды', 'секунд');
    $minutes = array('минуту', 'минуты', 'минут');
    $hours = array('час', 'часа', 'часов');
    $days = array('день', 'дня', 'дней');
    $weeks = array('неделю', 'недели', 'недель');
    $months = array('месяц', 'месяца', 'месяцев');
    $years = array('год', 'года', 'лет');
    $phrase = array($seconds, $minutes, $hours, $days, $weeks, $months, $years);
    $length = array(1, 60, 3600, 86400, 604800, 2630880, 31570560);
    for ($i = sizeof($length) - 1; $i >= 0 && ($no = $diff / $length[$i]) <= 1; $i--) {
    }
    if ($i < 0) {
        $i = 0;
    }
    $_time = $current_time - $diff % $length[$i];
    $no = floor($no);
    $value = sprintf("%d %s ", $no, getPhrase($no, $phrase[$i]));
    if ($stf == 1 && $i >= 1 && $current_time - $_time > 0) {
        $value .= time_ago($_time);
    }
    if (strCaseCmp($value, '1 день ') == 0) {
        return 'вчера';
    } else {
        return $value . ' назад';
    }
}
Ejemplo n.º 2
0
function getCompletePhrase($phraseID, $table, $splitText, $color)
{
    $phrase = getPhrase($phraseID, $table);
    $choppedPhrase = explode("(split)", $phrase);
    $completePhrase = getSpliced($choppedPhrase, $splitText, $color);
    return $completePhrase;
}
Ejemplo n.º 3
0
<?php

//$phraseInfo = getPhrase(10);
$phraseInfo = getPhrase();
$uiColors = array('black', 'hotpink', 'burntorange', 'red', 'mustard', 'yellow', 'orange', 'green', 'blue', 'white');
?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

	<title>How Fast Do You Type?</title>
	<meta name="description" content="How fast do you type is a fun typing game to test your words per minute (wpm). Find out how your typing skills compare.">
	<meta name="author" content="Ryan Pastorelle">

	<meta name="viewport" content="width=device-width,initial-scale=1">
	
	<meta property="og:type" content="website">
    <meta property="og:title" content="How Fast Do You Type?" /> 
    <meta property="og:image" content="http://howfastdoyoutype.com/images/og-screenshot.jpg" /> 
    <meta property="og:description" content="How fast do you type is a fun typing game to test your words per minute (wpm). Find out how your typing skills compare." /> 
    <meta property="og:url" content="http://howfastdoyoutype.com/">

	<link rel="stylesheet" href="css/style.css?v=1">
	
    <script src="js/libs/prefixfree-1.0.4.min.js"></script>
	<script src="js/libs/modernizr-2.0.6.min.js"></script>
Ejemplo n.º 4
0
<?php

require_once 'config.php';
require_once 'class.Phrase.php';
require_once 'class.PhrasePNGBuilder.php';
require_once 'loadPhrases.php';
$phrase = getPhrase();
$imageFile = $imagesFolder . '/' . $phrase->md5() . '.png';
// Dont create the image if it already exists.
if (!file_exists($imageFile)) {
    $pngBuilder = new PhrasePNGBuilder($textFont, $authorFont, $textSize, $authorSize);
    $pngBuilder->phrase($phrase, $charactersPerLine);
    $image = $pngBuilder->build();
    // Save the image
    imagepng($image, $imageFile);
    // Unload resources.
    imagedestroy($image);
}
copy($imageFile, 'phrase.png');
echo $phrase;