当前位置: 首页>>代码示例>>PHP>>正文


PHP BigTree::translateArray方法代码示例

本文整理汇总了PHP中BigTree::translateArray方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::translateArray方法的具体用法?PHP BigTree::translateArray怎么用?PHP BigTree::translateArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BigTree的用法示例。


在下文中一共展示了BigTree::translateArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 function update($id, $fields, $values = false, $ignore_cache = false)
 {
     $id = sqlescape($id);
     // Turn a key => value array into pairs
     if ($values === false && is_array($fields)) {
         $values = $fields;
         $fields = array_keys($fields);
     }
     // Multiple columns to update
     if (is_array($fields)) {
         $query_parts = array();
         foreach ($fields as $key) {
             $val = current($values);
             if (is_array($val)) {
                 $val = BigTree::json(BigTree::translateArray($val));
             } else {
                 $val = BigTreeAdmin::autoIPL($val);
             }
             $query_parts[] = "`{$key}` = '" . sqlescape($val) . "'";
             next($values);
         }
         sqlquery("UPDATE `" . $this->Table . "` SET " . implode(", ", $query_parts) . " WHERE id = '{$id}'");
         // Single column to update
     } else {
         if (is_array($values)) {
             $val = json_encode(BigTree::translateArray($values));
         } else {
             $val = BigTreeAdmin::autoIPL($values);
         }
         sqlquery("UPDATE `" . $this->Table . "` SET `{$fields}` = '" . sqlescape($val) . "' WHERE id = '{$id}'");
     }
     if (!$ignore_cache) {
         BigTreeAutoModule::recacheItem($id, $this->Table);
     }
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:35,代码来源:modules.php

示例2: updatePendingItemField

 static function updatePendingItemField($id, $field, $value)
 {
     $id = sqlescape($id);
     $item = sqlfetch(sqlquery("SELECT * FROM bigtree_pending_changes WHERE id = '{$id}'"));
     $changes = json_decode($item["changes"], true);
     if (is_array($value)) {
         $value = BigTree::translateArray($value);
     }
     $changes[$field] = $value;
     $changes = sqlescape(json_encode($changes));
     sqlquery("UPDATE bigtree_pending_changes SET changes = '{$changes}' WHERE id = '{$id}'");
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:12,代码来源:auto-modules.php

示例3: array

        } else {
            $field["output"] = BigTree::safeEncode($bigtree["post_data"][$field["key"]]);
        }
    }
    // Backwards compatibility with older custom field types
    if (!isset($field["output"]) && isset($value)) {
        $field["output"] = $value;
    }
    if (!BigTreeAutoModule::validate($field["output"], $field["options"]["validation"])) {
        $error = $field["options"]["error_message"] ? $field["options"]["error_message"] : BigTreeAutoModule::validationErrorMessage($field["output"], $field["options"]["validation"]);
        $bigtree["errors"][] = array("field" => $field["options"]["title"], "error" => $error);
    }
    if (!$field["ignore"]) {
        // Translate internal link information to relative links.
        if (is_array($field["output"])) {
            $field["output"] = BigTree::translateArray($field["output"]);
        } else {
            $field["output"] = $admin->autoIPL($field["output"]);
        }
        $bigtree["entry"][$field["key"]] = $field["output"];
    }
}
// See if we added anything in pre-processing that wasn't a field in the form.
if (is_array($bigtree["preprocessed"])) {
    foreach ($bigtree["preprocessed"] as $key => $val) {
        if (!isset($bigtree["entry"][$key])) {
            $bigtree["entry"][$key] = $val;
        }
    }
}
// Sanitize the form data so it fits properly in the database (convert dates to MySQL-friendly format and such)
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:31,代码来源:process.php

示例4: updateSettingValue

 static function updateSettingValue($id, $value)
 {
     global $bigtree, $admin;
     $item = static::getSetting($id, false);
     $id = sqlescape(BigTreeCMS::extensionSettingCheck($id));
     if (is_array($value)) {
         $value = BigTree::translateArray($value);
     } else {
         $value = static::autoIPL($value);
     }
     $value = BigTree::json($value, true);
     if ($item["encrypted"]) {
         sqlquery("UPDATE bigtree_settings SET `value` = AES_ENCRYPT('{$value}','" . sqlescape($bigtree["config"]["settings_key"]) . "') WHERE id = '{$id}'");
     } else {
         sqlquery("UPDATE bigtree_settings SET `value` = '{$value}' WHERE id = '{$id}'");
     }
     if ($admin && !$item["system"]) {
         // Audit trail.
         $admin->track("bigtree_settings", $id, "updated");
     }
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:21,代码来源:admin.php

示例5: updateSettingValue

 function updateSettingValue($id, $value)
 {
     global $bigtree;
     $item = $this->getSetting($id, false);
     $id = sqlescape($id);
     if (is_array($value)) {
         $value = BigTree::translateArray($value);
     } else {
         $value = $this->autoIPL($value);
     }
     // Prefer to keep this an object, but we need PHP 5.3
     if (strnatcmp(phpversion(), '5.3') >= 0) {
         $value = sqlescape(json_encode($value, JSON_FORCE_OBJECT));
     } else {
         $value = sqlescape(json_encode($value));
     }
     if ($item["encrypted"]) {
         sqlquery("UPDATE bigtree_settings SET `value` = AES_ENCRYPT('{$value}','" . sqlescape($bigtree["config"]["settings_key"]) . "') WHERE id = '{$id}'");
     } else {
         sqlquery("UPDATE bigtree_settings SET `value` = '{$value}' WHERE id = '{$id}'");
     }
     // Audit trail
     $this->track("bigtree_settings", $id, "updated-value");
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:24,代码来源:admin.php


注:本文中的BigTree::translateArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。