本文整理汇总了PHP中red函数的典型用法代码示例。如果您正苦于以下问题:PHP red函数的具体用法?PHP red怎么用?PHP red使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了red函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: interpolate
/**
* @param int $color1
* @param int $color2
* @param float $factor
* @return int
*/
function interpolate($color1, $color2, $factor)
{
$r = (red($color2) - red($color1)) * $factor + red($color1);
$g = (green($color2) - green($color1)) * $factor + green($color1);
$b = (blue($color2) - blue($color1)) * $factor + blue($color1);
return color($r, $g, $b);
}
示例2: __construct
function __construct()
{
parent::__construct();
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
if (!$this->ion_auth->logged_in()) {
red('user/login');
}
}
示例3: cek_login
function cek_login()
{
$CI =& get_instance();
if (is_login() && $CI->agent->is_referral()) {
} else {
red(base_url());
die;
}
}
示例4: __construct
function __construct()
{
parent::__construct();
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->load->model('model_outbox');
if (!$this->ion_auth->logged_in()) {
red('user/login');
}
$this->per_preview = 5;
$this->per_page = 10;
$this->start_rows = $this->uri->segment('4') == '' ? 0 : $this->uri->segment('4');
$config['per_page'] = $this->per_page;
$this->pagination_config = $config;
}
示例5: renderHeader
/**
* @param \Calcinai\PHPi\Board $board
* @param string $header_name
* @param Calcinai\PHPi\Board\Feature\Header\PhysicalPin[] $physical_pins
*/
function renderHeader($board, $header_name, $physical_pins)
{
$table_format = "| %10s | %5s | %3s | %3s | %s %s | %-3s | %-3s | %-5s | %-10s |\n";
$high_char = red('●');
$low_char = grey('●');
//Ha ha...
$header = sprintf($table_format, 'func', 'type', 'BCM', 'PHY', $header_name, '', 'PHY', 'BCM', 'type', 'func');
$hr = preg_replace('/[\\w ]/i', '-', str_replace('|', '+', $header));
echo $hr;
echo $header;
echo $hr;
reset($physical_pins);
do {
$odd_pin = current($physical_pins);
$even_pin = next($physical_pins);
$odd_pin_attr = getPinAttributes($board, $odd_pin->gpio_number);
$even_pin_attr = getPinAttributes($board, $even_pin->gpio_number);
printf($table_format, $odd_pin_attr->function, $odd_pin->type, $odd_pin->gpio_number, $odd_pin->physical_number, $odd_pin_attr->level ? $high_char : $low_char, $even_pin_attr->level ? $high_char : $low_char, $even_pin->physical_number, $even_pin->gpio_number, $even_pin->type, $even_pin_attr->function);
} while (next($physical_pins));
echo $hr;
printf("%s pin high, %s pin low\n", $high_char, $low_char);
}
示例6: StaffWidgets
StaffWidgets('fsa_barcode');
StaffWidgets('fsa_exists_Y');
$extra['SELECT'] .= ",(SELECT coalesce(STATUS,'Active') FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS STATUS";
$extra['SELECT'] .= ",(SELECT BALANCE FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS BALANCE";
$extra['functions'] += array('BALANCE' => 'red');
$extra['columns_after'] = array('BALANCE' => _('Balance'), 'STATUS' => _('Status'));
Search('staff_id', $extra);
if (UserStaffID()) {
$staff = DBGet(DBQuery("SELECT s.STAFF_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME,(SELECT STAFF_ID FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS ACCOUNT_ID,(SELECT BALANCE FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS BALANCE FROM STAFF s WHERE s.STAFF_ID='" . UserStaffID() . "'"));
$staff = $staff[1];
echo '<FORM action="' . PreparePHP_SELF() . '" method="POST">';
DrawHeader(_('Timeframe') . ':' . PrepareDate($start_date, '_start') . ' ' . _('to') . ' ' . PrepareDate($end_date, '_end') . ' : ' . $type_select . ' : <INPUT type="submit" value="' . _('Go') . '">');
echo '</FORM>';
//modif Francois: fix bug no balance
// DrawHeader(NoInput($staff['FULL_NAME'],' '.$staff['STAFF_ID']),'', NoInput(red($student['BALANCE']),_('Balance')));
DrawHeader(NoInput($staff['FULL_NAME'], ' ' . $staff['STAFF_ID']), '', NoInput(red($staff['BALANCE']), _('Balance')));
if ($_REQUEST['detailed_view'] != 'true') {
DrawHeader("<A HREF=" . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'true')) . ">" . _('Detailed View') . "</A>");
} else {
DrawHeader("<A HREF=" . PreparePHP_SELF($_REQUEST, array(), array('detailed_view' => 'false')) . ">" . _('Original View') . "</A>");
}
if ($staff['ACCOUNT_ID'] && $staff['BALANCE'] != '') {
if ($_REQUEST['type_select']) {
$where = " AND fst.SHORT_NAME='" . $_REQUEST['type_select'] . "'";
}
if ($_REQUEST['detailed_view'] == 'true') {
$RET = DBGet(DBQuery("SELECT fst.TRANSACTION_ID AS TRANS_ID,fst.TRANSACTION_ID,(SELECT sum(AMOUNT) FROM FOOD_SERVICE_STAFF_TRANSACTION_ITEMS WHERE TRANSACTION_ID=fst.TRANSACTION_ID) AS AMOUNT,fst.STAFF_ID,fst.BALANCE,to_char(fst.TIMESTAMP,'YYYY-MM-DD') AS DATE,to_char(fst.TIMESTAMP,'HH:MI:SS AM') AS TIME,fst.DESCRIPTION," . db_case(array('fst.SELLER_ID', "''", 'NULL', "(SELECT FIRST_NAME||' '||LAST_NAME FROM STAFF WHERE STAFF_ID=fst.SELLER_ID)")) . " AS SELLER FROM FOOD_SERVICE_STAFF_TRANSACTIONS fst WHERE fst.STAFF_ID='" . UserStaffID() . "' AND fst.SYEAR='" . UserSyear() . "' AND fst.TIMESTAMP BETWEEN '" . $start_date . "' AND date '" . $end_date . "' +1" . $where . " ORDER BY fst.TRANSACTION_ID DESC"), array('DATE' => 'ProperDate', 'BALANCE' => 'red'));
//modif Francois: add translation
foreach ($RET as $RET_key => $RET_val) {
$RET[$RET_key] = array_map('types_locale', $RET_val);
}
示例7: deactivate
function deactivate($id = NULL)
{
if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin() || !$this->input->is_ajax_request()) {
if ($this->input->post()) {
return show_error('You must be an administrator to view this page.');
} else {
red('');
}
} else {
$deactivation = $this->ion_auth->deactivate($id);
if ($deactivation) {
echo 'success';
} else {
echo 'failed';
}
}
}
示例8: Evaluation
function Evaluation($id, $value, $input, $exercise_id, $operatorData, $answer)
{
$m = new EvalMath();
$xml = simplexml_load_file($exercise_id) or die("Error: Cannot create object");
// $ops = array("==", "!=", "GE", "LE", "GT", "LT");
$count_options = $xml->input[$id]->count();
for ($i = 0; $i < $count_options; $i++) {
$operator = $xml->input[$id]->option[$i]->operator;
$equation = trim($xml->input[$id]->option[$i]->equation);
$data = explode(" ", $equation);
$operatorDT = "";
if ($operator == 'IF') {
if (strstr($equation, "and")) {
$content = explode("and", $equation);
$data1 = explode(" ", $content[0]);
$data2 = explode(" ", $content[1]);
if (evalStatement($data1, $input, $answer) and evalStatement($data2, $input, $answer)) {
return $xml->input[$id]->option[$i]->result;
}
} elseif (strstr($equation, "or")) {
$content = explode("or", $equation);
$data1 = explode(" ", $content[0]);
$data2 = explode(" ", $content[1]);
if (evalStatement($data1, $input, $answer) or evalStatement($data2, $input, $answer)) {
return $xml->input[$id]->option[$i]->result;
}
} else {
if (evalStatement($data, $input, $answer)) {
return $xml->input[$id]->option[$i]->result;
}
}
} else {
$equation = "";
foreach ($data as $element) {
if (is_numeric($element)) {
$equation .= $element;
} else {
if ($element[0] == 'o') {
$operatorDT = ltrim($element, "o");
} elseif ($element[0] == 'v') {
$trimmed = intval(ltrim($element, "v"));
$equation .= $input[$trimmed];
} elseif ($element[0] == 'a') {
$trimmed = intval(ltrim($element, "a"));
$equation .= $answer[$trimmed - 1];
} else {
$equation .= $element;
}
}
}
if (strstr($equation, "mcm")) {
$valor = explode(",", substr($equation, 3));
$equation_result = mcm(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "smn")) {
$valor = explode(",", substr($equation, 3));
$equation_result = smn(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "smd")) {
$valor = explode(",", substr($equation, 3));
$equation_result = smd(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "cod")) {
$valor = explode(",", substr($equation, 3));
$equation_result = cod(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "red")) {
$valor = explode(",", substr($equation, 3));
$equation_result = red(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "txt")) {
$valor = explode(",", substr($equation, 3));
$equation_result = txt($valor[0], $valor[1]);
} else {
$equation_result = $m->evaluate($equation);
}
if ($operatorDT == "") {
$operatorData = "";
}
// return strval($equation_result);
switch ($operator) {
case "==":
if ($equation_result == $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "!=":
if ($equation_result != $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "GT":
if ($equation_result > $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "GE":
if ($equation_result >= $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
//.........这里部分代码省略.........
示例9: red
<?php
global $data;
echo '
<form method="post" action="?act=upload" enctype="multipart/form-data">
上传:
<input type="file" name="up" id="up" />
<input type="submit" name="submit" value="submit" />
</form>
';
echo "<h1>文件列表</h1>";
red("点击文件名复制路径");
echo '<ul>';
foreach ($data["files"] as $file) {
echo '<li><a href="' . $file . '">' . $file . '</a>';
}
echo '</ul>';
示例10: pleac_Redefining_a_Function
function pleac_Redefining_a_Function()
{
// In PHP once a function has been defined it remains defined. In other words,
// it cannot be undefined / deleted, nor can that particular function name be
// reused to reference another function body. Even the lambda-like functions
// created via the 'create_function' built-in, cannot be undefined [they exist
// until script termination, thus creating too many of these can actually
// exhaust memory !]. However, since the latter can be assigned to variables,
// the same variable name can be used to reference difference functions [and
// when this is done the reference to the previous function is lost (unless
// deliberately saved), though the function itself continues to exist].
//
// If, however, all that is needed is a simple function aliasing facility,
// then just assign the function name to a variable, and execute using the
// variable name
// Original function
function expand()
{
echo "expand\n";
}
// Prove that function exists
echo (function_exists('expand') ? 'yes' : 'no') . "\n";
// Use a variable to alias it
$grow = 'expand';
// Call function via original name, and variable, respectively
expand();
$grow();
// Remove alias variable
unset($grow);
// ----------------------------
function fred()
{
echo "fred\n";
}
$barney = 'fred';
$barney();
unset($barney);
fred();
// ------------
$fred = create_function('', 'echo "fred\\n";');
$barney = $fred;
$barney();
unset($barney);
$fred();
// ----------------------------
function red($text)
{
return "<FONT COLOR='red'>{$text}</FONT>";
}
echo red('careful here') . "\n";
// ------------
$colour = 'red';
${$colour} = create_function('$text', 'global $colour;
return "<FONT COLOR=\'$colour\'>$text</FONT>";');
echo ${$colour}('careful here') . "\n";
unset(${$colour});
// ----
$colours = split(' ', 'red blue green yellow orange purple violet');
foreach ($colours as $colour) {
${$colour} = create_function('$text', 'global $colour;
return "<FONT COLOR=\'$colour\'>$text</FONT>";');
}
foreach ($colours as $colour) {
echo ${$colour}("Careful with this {$colour}, James") . "\n";
}
foreach ($colours as $colour) {
unset(${$colour});
}
}
示例11: unset
$string .= "</script>\n";
echo "<div id='content' valign='top' ></div>\n";
echo "<div id='pagesplit' valign='top' ></div><br>\n";
echo $string;
unset($string);
/****************************************user management ******************************************/
/****************************************user UPDATE form******************************************/
if (isset($_GET['op']) && $_GET['op'] == 'user_edit') {
if (isset($_GET['user_id'])) {
$user_id = mysql_escape_string($_GET['user_id']);
} else {
die(red(INVALID_USER_ID));
}
$_user_ = $sess_user->user_exists('', $user_id);
if (!$_user_) {
die(red(INVALID_USER_ID));
} else {
@extract($_user_);
print_r($_user_);
}
?>
<script language='javascript'>
function check_update_input(form){
if((form.password.value || form.password1.value) && form.password.value != form.password1.value){
alert('您输入的两次密码不一致');
return false;
}
return true;
}
</script>
<TABLE cellspacing=1 bgcolor='#000000' width=100% align=center class='form'>
示例12: red
编辑页面<?php
echo red($data["id"]);
?>
<form method="POST" action="?act=save">
<input name="id" type="hidden" value="<?php
echo h($data["id"]);
?>
"/>
<h3>内容:</h3>
<table >
<tr >
<td>
<textarea name="content" rows="20" cols="65" style="height:400px;"><?php
if (!empty($data["content"])) {
echo h($data["content"]);
}
?>
</textarea>
</td>
<td>
<iframe src="?act=files" height="400" width="300" frameborder="0"></iframe>
</td>
</tr>
</table>
<p>
<button type="submit">提交</button>
</form>
<?php
js("jquery");
?>
示例13: Evaluation
//.........这里部分代码省略.........
} else {
foreach ($data as $element) {
if (is_numeric($element)) {
$equation .= $element;
} else {
if ($element[0] == 'o') {
$operatorDT = ltrim($element, "o");
} elseif ($element[0] == 'v') {
$trimmed = intval(ltrim($element, "v"));
$equation .= $input[$trimmed];
} elseif ($element[0] == 'a') {
$trimmed = intval(ltrim($element, "a"));
$equation .= $answer[$trimmed - 1];
} else {
$equation .= $element;
}
/*
elseif (strpos($element,'v') === False)
{
$equation .= $element;
}
else
{
$trimmed = intval(ltrim($element, "v"));
$equation .= $input[$trimmed];
}
*/
}
}
// return $equation[3];
// $equation = "mcm(2,4)";
if (strstr($equation, "mcm")) {
$valor = explode(",", substr($equation, 3));
$equation_result = mcm(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "smn")) {
$valor = explode(",", substr($equation, 3));
$equation_result = smn(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "smd")) {
$valor = explode(",", substr($equation, 3));
$equation_result = smd(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "cod")) {
$valor = explode(",", substr($equation, 3));
$equation_result = cod(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "red")) {
$valor = explode(",", substr($equation, 3));
$equation_result = red(intval($valor[0]), intval($valor[1]));
} elseif (strstr($equation, "txt")) {
$valor = explode(",", substr($equation, 3));
$equation_result = txt($valor[0], $valor[1]);
} else {
$equation_result = $m->evaluate($equation);
}
if ($operatorDT == "") {
$operatorData = "";
}
// return strval($equation_result);
switch ($operator) {
case "==":
if ($equation_result == $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "!=":
if ($equation_result != $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "GT":
if ($equation_result > $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "GE":
if ($equation_result >= $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "LT":
if ($equation_result < $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
case "LE":
if ($equation_result <= $value && $operatorDT == $operatorData) {
return $xml->input[$id]->option[$i]->result;
$i = $count_options;
}
break;
}
// SWITCH
}
// else IF
}
// option's LOOP
}
示例14: learn
function learn(&$user, $filter)
{
$card = next_card($user, $filter);
if ($card == NULL) {
return false;
}
$user_card = sql_single_query("select * from user_cards where user_id = {$user['id']} and card_id = {$card['id']}");
$mylang = $user['language'];
// pick out the second language from a (for example: /en-ro/) tag (which should be the first tag)
// note this only works for language cards, this needs work WORK !!!
$learning = substr($card['tags'], 4, 2);
$language = get_translated_language($mylang, $learning);
$prompt = array("en" => "What is the {$language} for ", "nl" => "Wat is het {$language} voor", "de" => "Wie sagt man auf {$language}", "ro" => "Cum se zice in {$language}")[$mylang];
$goodanswer = array("en" => "the right answer was", "nl" => "het goede antwoord was", "de" => "die richtige antword war", "ro" => "bun resuns e");
$front = json_decode($card['front'], 1);
$back = json_decode($card['back'], 1);
$exposure_start = microtime(true);
// prompt the user and wait for the answer
if (abs($user_card['first'] - time(0)) < 5) {
$fresh = red("*");
} else {
$fresh = " ";
}
$answer = termline("{$fresh} {$prompt}: " . color_string($front['sp'], "yellow") . " ");
$exposure_took = intval(1000 * (microtime(true) - $exposure_start));
if ($answer === NULL) {
return false;
}
if (process_answer($user, $card, $answer, $exposure_took)) {
echo correct($mylang);
$user['ngood']++;
} else {
$user['nfalse']++;
echo $goodanswer[$mylang] . ": " . color_string($back['sp'], "yellow") . "\n";
echo wrong($mylang);
}
$ratio = intval(100 * ($user['ngood'] / ($user['ngood'] + $user['nfalse'])));
$interval = sql_simple_query("select `interval` from user_cards where id={$user_card['id']}");
echo "! took {$exposure_took} ms, right this session: {$ratio}% total score {$user['score']} next in {$interval} seconds\n";
echo "\n";
echo "\n";
return true;
}
示例15: red
} else {
$result_string .= "<TR align='center'>\n";
$result_string .= "<TD bgcolor='#ffffff' align=left width=200 ><b>" . $k . "</b></TD>\n";
$result_string .= "<TD bgcolor='#ffffff' align=left>" . $url_data_array[$v] . "</TD>\n";
$result_string .= "</TR>\n";
}
}
$result_string .= "<TR align='center'>\n";
$result_string .= "<TD bgcolor='#ffffff' align=left width=200 ></TD>\n";
$result_string .= "<TD bgcolor='#ffffff' align=left>\n";
$result_string .= "<input type=button name='opsubmit' value='重新抓取' ";
$result_string .= " onclick='javascript:ActionUrlinfoForm(this.form, \"redownload\");'>\n";
$result_string .= "</TD></TR>\n";
$result_string .= "</FORM></TABLE>\n";
} else {
$result_string = red("没有找到[{$url}]相关记录");
}
echo $result_string;
}
if (isset($_GET['op']) && $_GET['op'] == 'view_info') {
$objdata = new cDatadb($dbdata);
$objstore = new cStoredb($dbstore);
$url = mysql_escape_string($_GET['url']);
$pri = $objdata->find_url($url);
$result_string = "<TABLE cellspacing=1 bgcolor='#000000' width='100%' align=center>\n";
$result_string .= "<FORM action='query.php' method='post' name='info_list' >\n";
$result_string .= "<input type=hidden name='op' value='pchange' >\n";
$result_string .= "<input type=hidden name='url' value='{$url}'>\n";
$result_string .= "<TR align='center'>\n";
$result_string .= "<TH bgcolor='#C0C0C0' align=left >名称</TH>\n";
$result_string .= "<TH bgcolor='#C0C0C0' align=left >结果</TH>\n";