本文整理汇总了PHP中setdefault函数的典型用法代码示例。如果您正苦于以下问题:PHP setdefault函数的具体用法?PHP setdefault怎么用?PHP setdefault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setdefault函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setdefault
function setdefault($var, $default) {
foreach ($default as $k => $v) {
if(!isset($var[$k])) {
$var[$k] = $default[$k];
} elseif(is_array($v)) {
$var[$k] = setdefault($var[$k], $default[$k]);
}
}
return $var;
}
开发者ID:nicevoice,项目名称:bbs,代码行数:10,代码来源:tools.func.php
示例2: content_setdefault
function content_setdefault($contentid)
{
$objResponse = new xajaxResponse();
setdefault($contentid);
$objResponse->assign("contentlist", "innerHTML", display_content_list());
$objResponse->script("\$('#tr_{$contentid}').effect('highlight', [], 3000);");
return $objResponse;
}
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:8,代码来源:listcontent.php
示例3: insert
insert($t, $c = cell());
insert($c, text(my_("Min. TTL")));
insert($t, $c = cell());
insert($c, textbr(my_("Last modified")));
insert($c, text(my_("Last exported")));
insert($t, $c = cell());
insert($c, text(my_("Changed by")));
insert($t, $ck = cell());
insert($ck, text(my_("Action")));
// capture data for the export view functionality
$export = new exportForm();
$export->addRow(array("domain", "primary_DNS", "secondary_DNS", "serial_date", "ttl", "refresh", "retry", "expire", "minimum_ttl", "last_modified", "last_exported", "changed_by"));
$export->saveRow();
$cnt = 0;
while ($row = $result->FetchRow()) {
setdefault("cell", array("class" => color_flip_flop()));
$export->addRow(NULL);
insert($t, $c = cell());
// have zone records been modified
if ($row["error_message"] == "E") {
insert($c, textb($row["domain"]));
insert($c, block(" ‡"));
} else {
insert($c, text($row["domain"]));
}
if ($row["slaveonly"] == "Y") {
insert($c, span(my_("Slave zone"), array("class" => "textSmall")));
$export->addCell($row["domain"] . my_(" (Slave zone)"));
} else {
$export->addCell($row["domain"]);
}
开发者ID:hetznerZA,项目名称:ipplan,代码行数:31,代码来源:modifydns.php
示例4: content_setdefault
function content_setdefault($contentid)
{
$objResponse = new xajaxResponse();
setdefault($contentid);
$objResponse->assign("contentlist", "innerHTML", display_content_list());
$objResponse->script("new Effect.Highlight('tr_{$contentid}', { duration: 2.0 });");
return $objResponse;
}
开发者ID:rasomu,项目名称:chuza,代码行数:8,代码来源:listcontent.php
示例5: setdefault
<?php
/*
* $Source: /home/xubuntu/berlios_backup/github/tmp-cvs/otmp/Repository/Release1/docs/userdocuments.php,v $
* $Revision: 1.4 $
* $Id: userdocuments.php,v 1.4 2001/12/10 22:08:46 darkpact Exp $
*
* To Do:
* - Localisation
*/
/******************************************************************************
* MAIN
*****************************************************************************/
include "../application.php";
$DOC_TITLE = "All User Documents";
setdefault($usrid, "1");
include "{$CFG->templatedir}/header.php";
include "templates/userdocuments.inc";
include "{$CFG->templatedir}/footer.php";
/******************************************************************************
* FUNCTIONS
*****************************************************************************/
function show_docs($usrid)
{
/* ... */
return sql_getUserDocuments($usrid);
}
function show_name($id)
{
/* ... */
return sql_getUserFromText($id);
开发者ID:BackupTheBerlios,项目名称:otmp,代码行数:31,代码来源:userdocuments.php
示例6: searchOverlap
function searchOverlap($ds, &$w, $cust1, $cust2)
{
global $block;
// dont trust variables
$cust1 = floor($cust1);
$cust2 = floor($cust2);
$custdescrip1 = $ds->GetCustomerDescrip($cust1);
$custdescrip2 = $ds->GetCustomerDescrip($cust2);
// this query is not quick as indexes cannot be used!!!
// must have first baseaddr called baseaddr else block pager
// will not work - may break databases other than mysql
$result =& $ds->ds->Execute("SELECT t1.baseaddr AS baseaddr,\n t1.baseindex AS baseindex1,\n t1.subnetsize AS subnetsize1,\n t1.descrip AS descrip1,\n t2.baseaddr AS baseaddr2,\n t2.baseindex AS baseindex2,\n t2.subnetsize AS subnetsize2,\n t2.descrip AS descrip2\n FROM base t1, base t2\n WHERE ((t1.baseaddr BETWEEN t2.baseaddr AND\n t2.baseaddr+t2.subnetsize-1) OR\n (t1.baseaddr+t1.subnetsize-1\n BETWEEN t2.baseaddr AND\n t2.baseaddr+t2.subnetsize-1) OR\n (t1.baseaddr < t2.baseaddr AND\n t1.baseaddr+t1.subnetsize >\n t2.baseaddr+t2.subnetsize)) AND\n t1.customer={$cust1} AND\n t2.customer={$cust2}\n ORDER BY t1.baseaddr");
$totcnt = 0;
$vars = "";
// fastforward till first record if not first block of data
while ($block and $totcnt < $block * MAXTABLESIZE and $row = $result->FetchRow()) {
$vars = DisplayBlock($w, $row, $totcnt, "&cust1[]=" . $cust1 . "&cust2[]=" . $cust2);
$totcnt++;
}
insert($w, block("<p>"));
$cnt = 0;
while ($row = $result->FetchRow()) {
// draw heading only if there are records to display
if ($cnt == 0) {
// create a table
insert($w, $t = table(array("cols" => "8", "class" => "outputtable")));
// draw heading
setdefault("cell", array("class" => "heading"));
insert($t, $c = cell(array("colspan" => "4")));
insert($c, block("<center>"));
insert($c, text($custdescrip1));
insert($c, block("</center>"));
insert($t, $c = cell(array("colspan" => "4")));
insert($c, block("<center>"));
insert($c, text($custdescrip2));
insert($c, block("</center>"));
insert($t, $c = cell());
if (!empty($vars)) {
insert($c, anchor($vars, "<<"));
}
insert($c, text(my_("Base address")));
insert($t, $c = cell());
insert($c, text(my_("Subnet size")));
insert($t, $c = cell());
insert($c, text(my_("Subnet mask")));
insert($t, $c = cell());
insert($c, text(my_("Description")));
insert($t, $c = cell());
insert($c, text(my_("Base address")));
insert($t, $c = cell());
insert($c, text(my_("Subnet size")));
insert($t, $c = cell());
insert($c, text(my_("Subnet mask")));
insert($t, $ck = cell());
insert($ck, text(my_("Description")));
setdefault("cell", array("class" => color_flip_flop()));
}
// customer 1
if ($row["subnetsize1"] == 1) {
insert($t, $c = cell());
insert($c, text(inet_ntoa($row["baseaddr"])));
} else {
insert($t, $c = cell());
insert($c, anchor("displaysubnet.php?baseindex=" . $row["baseindex1"], inet_ntoa($row["baseaddr"])));
}
if ($row["subnetsize1"] == 1) {
insert($t, $c = cell());
insert($c, text("Host"));
} else {
insert($t, $c = cell());
insert($c, text($row["subnetsize1"]));
}
insert($t, $c = cell());
insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize1"]) . "/" . inet_bits($row["subnetsize1"])));
insert($t, $c = cell());
insert($c, text($row["descrip1"]));
// customer 2
if ($row["subnetsize2"] == 1) {
insert($t, $c = cell());
insert($c, text(inet_ntoa($row["baseaddr2"])));
} else {
insert($t, $c = cell());
insert($c, anchor("displaysubnet.php?baseindex=" . $row["baseindex2"], inet_ntoa($row["baseaddr2"])));
}
if ($row["subnetsize2"] == 1) {
insert($t, $c = cell());
insert($c, text(my_("Host")));
} else {
insert($t, $c = cell());
insert($c, text($row["subnetsize2"]));
}
insert($t, $c = cell());
insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize2"]) . "/" . inet_bits($row["subnetsize2"])));
insert($t, $c = cell());
insert($c, text($row["descrip2"]));
if ($totcnt % MAXTABLESIZE == MAXTABLESIZE - 1) {
break;
}
$cnt++;
$totcnt++;
//.........这里部分代码省略.........
开发者ID:hetznerZA,项目名称:ipplan,代码行数:101,代码来源:displayoverlap.php
示例7: isset
/******************************************************************************
* MAIN
*****************************************************************************/
include "../application.php";
/* form has been submitted */
if (isset($HTTP_POST_VARS)) {
$frm = $HTTP_POST_VARS;
//mydebug($frm);
if (isset($frm['download'])) {
/* if Packer not choosen, then check if user has an default packer */
if (nvl($frm['packerID'], 0) == 0) {
$packerID = isset($session['usepackerID']) ? $session['usepackerID'] : 0;
} else {
/* Packer choosen, so set default-packer for user if not set */
$packerID = $frm['packerID'];
setdefault($session['usepackerID'], $packerID);
}
// get the downloadURL for the File
$goto = get_downloadURL(nvl($frm['textID']), $packerID);
//$goto = empty($session["wantsurl"]) ? "$CFG->wwwroot/main.php" : $session["wantsurl"];
header("Location: {$goto}");
die;
}
}
$DOC_TITLE = "Download";
include "{$CFG->templatedir}/header.php";
include "templates/download.inc";
include "{$CFG->templatedir}/footer.php";
/******************************************************************************
* FUNCTIONS
*****************************************************************************/
开发者ID:BackupTheBerlios,项目名称:otmp,代码行数:31,代码来源:download.php
示例8: db_tables
db_tables();
break;
case 'show_stats':
show_stats();
break;
case 'generate_xml':
generate_xml();
break;
case 'generate_csv':
generate_csv();
break;
case 'paypal_info':
paypal_info();
break;
case 'default':
setdefault();
break;
case 'product_option':
product_option();
break;
case 'preview':
preview_formmaker();
break;
case 'edit_css':
edit_css();
break;
case 'themes':
show_themes();
break;
case 'add_themes':
add_themes();
开发者ID:ankaau,项目名称:GathBandhan,代码行数:31,代码来源:formmaker.php
示例9: me
/*
* $Source: /home/xubuntu/berlios_backup/github/tmp-cvs/otmp/Repository/Release1/docs/tasklist.php,v $
* $Revision: 1.2 $
* $Id: tasklist.php,v 1.2 2001/12/18 23:29:22 hifix Exp $
*
* To Do:
* - Localisation
*/
/******************************************************************************
* MAIN
*****************************************************************************/
include "../application.php";
$session['wantsurl'] = me();
// Rücksprung (ggf)
$DOC_TITLE = "Tasks Info";
setdefault($list, "open");
include "{$CFG->templatedir}/header.php";
include "templates/tasklist.inc";
include "{$CFG->templatedir}/footer.php";
/******************************************************************************
* FUNCTIONS
*****************************************************************************/
function show_tasks($status)
{
/* ... */
return sql_getAuftrag($status);
}
function show_name($id)
{
/* ... */
return sql_getUserFromText($id);
开发者ID:BackupTheBerlios,项目名称:otmp,代码行数:31,代码来源:tasklist.php
示例10: validate_form
}
if (isset($frm['addTask'])) {
$errormsg = validate_form($frm, $errors);
if (empty($errormsg)) {
$status = makeTask($frm);
$DOC_TITLE = "Task Successful";
include "{$CFG->templatedir}/header.php";
include "templates/task_success.inc";
include "{$CFG->templatedir}/footer.php";
die;
} else {
$session['notice'] = $errormsg;
}
}
}
setdefault($id, nvl($frm['textID']));
$DOC_TITLE = "Task management";
include "{$CFG->templatedir}/header.php";
include "templates/maketask_form.inc";
include "{$CFG->templatedir}/footer.php";
/******************************************************************************
* FUNCTIONS
*****************************************************************************/
function validate_form(&$frm, &$errors)
{
/* validate the upload form, and return the error messages in a string. if
* the string is empty, then there are no errors */
$errors = new Object();
$msg = "";
if (empty($frm["textID"])) {
$errors->lang = true;
开发者ID:BackupTheBerlios,项目名称:otmp,代码行数:31,代码来源:task.php
示例11: insert
insert($t, $c = cell());
insert($c, text(my_("Base address")));
insert($t, $c = cell());
insert($c, text(my_("Subnet description")));
insert($t, $c = cell());
insert($c, text(my_("Customer")));
do {
setdefault("cell", array("class" => color_flip_flop()));
insert($t, $c = cell());
insert($c, text(inet_ntoa($row["baseaddr"])));
insert($t, $c = cell());
insert($c, text($row["descrip"]));
insert($t, $c = cell());
insert($c, text($row["custdescrip"]));
} while ($row = $result->FetchRow());
setdefault("cell", "");
insert($w, block("<p>"));
}
// check if user belongs to customer admin group
$result = $ds->GetCustomerGrp($cust);
// can only be one row - does not matter if nothing is
// found as array search will return false
$row = $result->FetchRow();
if (!in_array($row["admingrp"], $grps)) {
myError($w, $p, my_("You may not create a subnet for this customer as you are not a member of the customers admin group"));
}
$ds->DbfTransactionStart();
// use the first group user belongs to create subnet
if ($id = $ds->CreateSubnet($base, $size, $descrip, $cust, $dhcp, $admingrp)) {
$ds->AuditLog(array("event" => 170, "action" => "create subnet", "descrip" => $descrip, "user" => getAuthUsername(), "baseaddr" => inet_ntoa($base), "size" => $size, "cust" => $cust));
insert($w, text(sprintf(my_("Subnet %s created"), inet_ntoa($base))));
开发者ID:hetznerZA,项目名称:ipplan,代码行数:31,代码来源:createsubnet.php
示例12: me
/*
* $Source: /home/xubuntu/berlios_backup/github/tmp-cvs/otmp/Repository/Release1/docs/document.php,v $
* $Revision: 1.8 $
* $Id: document.php,v 1.8 2001/12/18 23:29:22 hifix Exp $
*
* To Do:
* - Localisation
*/
/******************************************************************************
* MAIN
*****************************************************************************/
include "../application.php";
$session['wantsurl'] = me();
// Rücksprung (ggf)
$DOC_TITLE = "Document List";
setdefault($otid, "1");
include "{$CFG->templatedir}/header.php";
// testing
$id = $otid;
echo "\n<!-- ID: {$id} -->\n";
include "templates/document_details.inc";
//include("templates/document_langdetails.inc");
//echo "<hr>";
include "templates/document.inc";
include "{$CFG->templatedir}/footer.php";
/******************************************************************************
* FUNCTIONS
*****************************************************************************/
function show_docs($otid)
{
/* ... */
开发者ID:BackupTheBerlios,项目名称:otmp,代码行数:31,代码来源:document.php
注:本文中的setdefault函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论