當前位置: 首頁>>代碼示例>>PHP>>正文


PHP setdefault函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。