本文整理汇总了PHP中field::set方法的典型用法代码示例。如果您正苦于以下问题:PHP field::set方法的具体用法?PHP field::set怎么用?PHP field::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类field
的用法示例。
在下文中一共展示了field::set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exists
/**
* 判断控件类型是否存在
*
* @param $type string 控件类型
* @return bool 返回控件真假
*/
public static function exists($type)
{
if (field::set($type)) {
return true;
}
if (method_exists('field', $type)) {
return true;
}
return false;
}
示例2: system_field_template
function system_field_template()
{
field::set('template', 'field_template');
function field_template($attrs)
{
$html[] = field::text($attrs);
$html[] = '<a class="dialog" href="' . zotop::url('system/template/select/' . $attrs['name']) . '" title="选择模板"><span class="zotop-icon zotop-icon-template"></span></a>';
return implode("\n", $html);
}
}
示例3: get
/**
* 生成一个控件的Html数据
*
*
* @param $name string 控件名称
* @param $attrs array 控件参数
* @return string 返回控件的代码
*/
public static function get($name, $attrs = array())
{
$callback = field::set($name);
if ($callback) {
return call_user_func_array($callback, array($attrs));
}
if (method_exists('field', $name)) {
return field::$name($attrs);
}
return 'Unkown FieldController : <b>' . $name . '</b>';
}
示例4: field_keywords
function field_keywords()
{
field::set('keyword', 'site_keywords');
function site_keywords($attrs)
{
//$html[] = html::script('$common/js/zotop.keywords.js');
$html[] = '<div class="field-wrapper clearfix">';
$html[] = ' ' . field::text($attrs);
$html[] = ' <span class="field-handle">';
$html[] = ' <a class="setkeywords" style="display:inline-block;" valueto="' . $attrs['name'] . '" title="' . zotop::t('常用关键词') . '"><span class="zotop-icon zotop-icon-keywords"></span></a>';
$html[] = ' </span>';
$html[] = '</div>';
return implode("\n", $html);
}
}
示例5: field_codemirror
function field_codemirror()
{
field::set('code', 'codemirror');
function codemirror($attrs)
{
$url = zotop::module('codemirror', 'url');
$options = new stdClass();
$options->path = $url . '/codemirror/js/';
$options->parserfile = array('parsexml.js');
$options->stylesheet = array($url . '/codemirror/css/xmlcolors.css');
$options->height = is_numeric($attrs['height']) ? $attrs['height'] . 'px' : $attrs['height'];
$options->width = is_numeric($attrs['width']) ? $width . 'px' : $attrs['width'];
$options->continuousScanning = 500;
$options->autoMatchParens = true;
if ($attrs['linenumbers'] !== false) {
$options->lineNumbers = true;
$options->textWrapping = false;
}
if ($attrs['tabmode'] == '') {
$options->tabMode = 'shift';
}
$html = array();
$html[] = html::script($url . '/codemirror/js/codemirror.js');
$html[] = html::stylesheet($url . '/codemirror/css/codemirror.css');
$html[] = ' ' . field::textarea($attrs);
$html[] = '<script type="text/javascript">';
$html[] = ' var editor = CodeMirror.fromTextArea("' . $attrs['name'] . '", ' . json_encode($options) . ');';
$html[] = '$(function(){';
$html[] = ' $("form").submit(function(){';
$html[] = ' $("textarea[name=+' . $attrs['name'] . '+]").val(editor.getCode());';
$html[] = ' });';
$html[] = '})';
$html[] = '</script>';
return implode("\n", $html);
}
field::set('templateeditor', templateeditor);
function templateeditor($attrs)
{
return codemirror($attrs);
}
}
示例6: field_xheditor
function field_xheditor()
{
field::set('editor', 'xheditor_rc1');
function xheditor_rc1($attrs)
{
$attrs['class'] = isset($attrs['class']) ? 'editor ' . $attrs['class'] : 'editor';
$tools = array('image' => '<a href="' . zotop::url('system/image/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-imageuploader button-icon"></span><span class="button-text">插入图片</span></a>', 'file' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-fileuploader button-icon"></span><span class="button-text">插入文件</span></a>', 'template' => '<a href="' . zotop::url('system/file/upload') . '" class="button editor-insert" name="' . $attrs['name'] . '"><span class="zotop-icon zotop-icon-template button-icon"></span><span class="button-text">插入模板</span></a>');
$tools = zotop::filter('editor.tools', $tools);
$tools = arr::take('tools', $attrs) === false ? array() : $tools;
$url = zotop::module('xheditor', 'url');
$html[] = html::script($url . '/editor/xheditor-zh-cn.min.js');
$html[] = html::script($url . '/common/global.js');
if (is_array($tools) && !empty($tools)) {
$html[] = '<div class="field-toolbar">';
foreach ($tools as $tool) {
$html[] = ' ' . $tool;
}
$html[] = '</div>';
}
$html[] = ' ' . field::textarea($attrs);
return implode("\n", $html);
}
}
示例7: __init
public function __init()
{
field::set('source', array($this, 'source'));
}