Example #1
0
 /**
  * alias() のテストです. 以下を確認します.
  * 
  * - 引数を省略した場合は array("tag" => "tag") と同様の結果になること
  * - 引数に指定した内容でエイリアスを定義できること
  * 
  * @covers Peach\Markup\Html::alias
  * @covers Peach\Markup\Html::handleAlias
  */
 public function testAlias()
 {
     $this->assertFalse(function_exists("tag"));
     Html::alias(array());
     Html::alias();
     $this->assertTrue(function_exists("tag"));
     $this->assertSame("<p>Hello World!</p>", tag("p")->append("Hello World!")->write());
     $aliasList = array("t", "c", "cond", "s");
     foreach ($aliasList as $name) {
         $this->assertFalse(function_exists($name));
     }
     Html::alias(array("tag" => "t", "comment" => "c", "conditionalComment" => "cond", "select" => "s"));
     foreach ($aliasList as $name) {
         $this->assertTrue(function_exists($name));
     }
     $ex1 = implode("\r\n", array('<div>', '    <!--TEST-->', '    <p>Hello World!</p>', '    <!--[if lt IE 9]>', '    <script src="ieonly.js"></script>', '    <![endif]-->', '    <select name="foo">', '        <option value="1">A</option>', '        <option value="2" selected>B</option>', '        <option value="3">C</option>', '    </select>', '</div>'));
     $t = t("div")->append(c("TEST"))->append(t("p")->append("Hello World!"))->append(cond("lt IE 9", t("script")->attr("src", "ieonly.js")))->append(s(2, array("A" => 1, "B" => 2, "C" => 3), array("name" => "foo")));
     $this->assertSame($ex1, $t->write());
 }
Example #2
0
 /**
  * video file exists
  * 
  * @param file_name
  * @param Queue_id
  * @param ext 
  */
 function video_file_exists($filename, $queueid = NULL, $profile_id = NULL, $ext = NULL)
 {
     global $db;
     $var = " ";
     if ($filename) {
         $var = cond("file_name='{$filename}'", "AND", $var);
     }
     if ($queueid) {
         $var = cond("queue_id='{$queueid}'", "AND", $var);
     }
     if ($ext) {
         $var = cond("file_ext='{$ext}'", "AND", $var);
     }
     if ($profile_id) {
         $var = cond("profile_id='{$profile_id}'", "AND", $var);
     }
     $results = $db->select(tbl('video_files'), "*", $var);
     if ($db->num_rows > 0) {
         return $results[0];
     } else {
         return false;
     }
 }
Example #3
0
# Title building helper for string variables (which might be NULL):
function cond($name, &$var)
{
    return $name . ": " . (isset($var) ? $var : '(default)') . "\n";
}
# Title building helper for bool variables:
function bcond($name, $var)
{
    return $name . ": " . ($var ? "True" : "False") . "\n";
}
$data = array(array('A', 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), array('B', 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), array('C', 10, 20, 30, 40, 50, 60, 70, 80, 90, 100));
$n_cols = count($data[0]) - 1;
for ($i = 0; $i < $n_cols; $i++) {
    $legend[$i] = "== Row {$i} ==";
}
$title = "Legend Colorbox Borders Control\n" . cond("Color box borders: ", $tp['colorboxborders']) . cond("Color box width factor: ", $tp['colorboxwidth']) . bcond("Set Data Border Colors", $tp['setdbcolors']) . bcond("Set Text Color", $tp['settextcolor']);
$p = new PHPlot(800, 600);
$p->SetTitle($title);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetShading(0);
// Unshaded so borders can be seen
$p->SetLegend($legend);
$p->SetLegendPosition(0, 0, 'plot', 0, 0, 5, 5);
if (isset($tp['colorboxborders'])) {
    $p->SetLegendColorboxBorders($tp['colorboxborders']);
}
if (isset($tp['colorboxwidth'])) {
    $p->legend_colorbox_width = $tp['colorboxwidth'];
}
Example #4
0
<?php 
include "config.php";
if (!isset($_COOKIE['login'])) {
    die('<Script>window.location.href="../"</Script>');
}
$id = @$_GET['var'];
if ($id == "store") {
    $store = "";
    $nuggets = @$_COOKIE['nuggets'];
    cond($nuggets, 100, $store, 1);
    cond($nuggets, 1000, $store, 2);
    cond($nuggets, 5000, $store, 3);
    cond($nuggets, 7050, $store, 4);
    $login = @$_COOKIE['login'];
    $query = mysql_query("UPDATE stats SET store = '{$store}' WHERE login = '******'");
    echo "/[store={$store}]/";
}