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


PHP BigTree::touchFile方法代码示例

本文整理汇总了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;
    }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:57,代码来源:admin.php


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