本文整理汇总了PHP中BigTree::touchFile方法的典型用法代码示例。如果您正苦于以下问题:PHP BigTree::touchFile方法的具体用法?PHP BigTree::touchFile怎么用?PHP BigTree::touchFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigTree
的用法示例。
在下文中一共展示了BigTree::touchFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFieldType
function createFieldType($id, $name, $use_cases, $self_draw)
{
// Check to see if it's a valid ID
if (!ctype_alnum(str_replace(array("-", "_"), "", $id)) || strlen($id) > 127) {
return false;
}
$id = sqlescape($id);
$name = sqlescape(BigTree::safeEncode($name));
$use_cases = sqlescape(json_encode($use_cases));
$self_draw = $self_draw ? "'on'" : "NULL";
$file = "{$id}.php";
sqlquery("INSERT INTO bigtree_field_types (`id`,`name`,`use_cases`,`self_draw`) VALUES ('{$id}','{$name}','{$use_cases}',{$self_draw})");
// Make the files for draw and process and options if they don't exist.
if (!file_exists(SERVER_ROOT . "custom/admin/form-field-types/draw/{$file}")) {
BigTree::putFile(SERVER_ROOT . "custom/admin/form-field-types/draw/{$file}", '<?
/*
When drawing a field type you are provided with the $field array with the following keys:
"title" — The title given by the developer to draw as the label (drawn automatically)
"subtitle" — The subtitle given by the developer to draw as the smaller part of the label (drawn automatically)
"key" — The value you should use for the "name" attribute of your form field
"value" — The existing value for this form field
"id" — A unique ID you can assign to your form field for use in JavaScript
"tabindex" — The current tab index you can use for the "tabindex" attribute of your form field
"options" — An array of options provided by the developer
"required" — A boolean value of whether this form field is required or not
*/
include BigTree::path("admin/form-field-types/draw/text.php");
?>');
BigTree::setPermissions(SERVER_ROOT . "custom/admin/form-field-types/draw/{$file}");
}
if (!file_exists(SERVER_ROOT . "custom/admin/form-field-types/process/{$file}")) {
BigTree::putFile(SERVER_ROOT . "custom/admin/form-field-types/process/{$file}", '<?
/*
When processing a field type you are provided with the $field array with the following keys:
"key" — The key of the field (this could be the database column for a module or the ID of the template or callout resource)
"options" — An array of options provided by the developer
"input" — The end user\'s $_POST data input for this field
"file_input" — The end user\'s uploaded files for this field in a normalized entry from the $_FILES array in the same formatting you\'d expect from "input"
BigTree expects you to set $field["output"] to the value you wish to store. If you want to ignore this field, set $field["ignore"] to true.
Almost all text that is meant for drawing on the front end is expected to be run through PHP\'s htmlspecialchars function as seen in the example below.
If you intend to allow HTML tags you will want to run htmlspecialchars in your drawing file on your value and leave it off in the process file.
*/
$field["output"] = htmlspecialchars($field["input"]);
?>');
BigTree::setPermissions(SERVER_ROOT . "custom/admin/form-field-types/process/{$file}");
}
if (!file_exists(SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$file}")) {
BigTree::touchFile(SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$file}");
BigTree::setPermissions(SERVER_ROOT . "custom/admin/ajax/developer/field-options/{$file}");
}
unlink(SERVER_ROOT . "cache/bigtree-form-field-types.json");
$this->track("bigtree_field_types", $id, "created");
return $id;
}