本文整理汇总了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);
}
}
示例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}'");
}
示例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)
示例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");
}
}
示例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");
}