<?php
if(!defined('ClassCms')) {exit();}
class admin_input {
function text($action,$config=array()) {
switch($action) {
case 'name':
Return '文本框';
case 'hash':
Return 'text';
case 'group':
Return '';
case 'sql':
Return 'varchar(255)';
case 'form':
$config['value']=str_replace(array('"','<','>'),array('"','<','>'),$config['value']);
echo('<input type="text" name="'.$config['name'].'" lay-filter="'.$config['name'].'" value="'.($config['value']).'" placeholder="'.$config['placeholder'].'"');
if($config['disabled']) {
echo(' disabled');
}
if(($config['width'])) {
echo(' style="width:'.$config['width'].'"');
}
echo(' class="layui-input">');
Return '';
case 'view':
if(isset($config['titlelink']) && isset($config['article']['link']) && !empty($config['article']['link']) && $config['article']['link']!='#') {
Return '<a class="cmscolor" target="_blank" href="'.$config['article']['link'].'">'.htmlspecialchars($config['value']).'</a>';
}else {
Return false;
}
case 'post':
if(isset($config['regular']) && !empty($config['regular']) && isset($_POST[$config['name']]) && !empty($_POST[$config['name']])) {
if(is_hash($config['regular'])) {
if(!C('cms:common:verify',@$_POST[$config['name']],$config['regular'])) {
if(!empty($config['regulartips'])) {Return array('error'=>htmlspecialchars($config['regulartips']));}
Return false;
}
}elseif(!preg_match($config['regular'],@$_POST[$config['name']])) {
if(!empty($config['regulartips'])) {Return array('error'=>htmlspecialchars($config['regulartips']));}
Return false;
}
}
if(isset($config['nonull']) && $config['nonull']) {
if(!isset($_POST[$config['name']]) || empty($_POST[$config['name']])) {
Return array('error'=>'不能为空');
}
}
if(isset($config['max']) && $config['max'] && isset($_POST[$config['name']])) {
if(C('cms:common:text',$_POST[$config['name']],$config['max'])<>C('cms:common:text',$_POST[$config['name']])) {
Return array('error'=>'不能超过'.$config['max'].'个字符');
}
}
if(!isset($config['auth']['html']) || !$config['auth']['html']) {
Return htmlspecialchars(@$_POST[$config['name']]);
}
Return @$_POST[$config['name']];
case 'auth':
Return array('html'=>'允许HTML代码');
case 'config':
Return array(
array('configname'=>'数据效验','hash'=>'regular','inputhash'=>'text','tips'=>'常见类型:id,email,phone,hash,username,ip.也可输入正则表达式:纯字母:/^[a-z]+$/i 字母+数字:/^[0-9a-z]+$/i'),
array('configname'=>'效验提示','hash'=>'regulartips','inputhash'=>'text','tips'=>'如提交数据不能通过数据校验,则提示此信息'),
array('configname'=>'字数限制','hash'=>'max','inputhash'=>'number','tips'=>'允许的最大字符数,0则不限制','defaultvalue'=>'0'),
array('configname'=>'输入框提示','hash'=>'placeholder','inputhash'=>'text','tips'=>'输入框的placeholder'),
array('configname'=>'输入框宽度','hash'=>'width','inputhash'=>'text','tips'=>'使用百分比,如:40% 或者 固定宽度如:200px')
);
}
Return false;
}
function textarea($action,$config=array()) {
switch($action) {
case 'name':
Return '文本区域';
case 'hash':
Return 'textarea';
case 'group':
Return '';
case 'sql':
Return 'longtext';
case 'form':
echo('<textarea class="layui-textarea" name="'.$config['name'].'" lay-filter="'.$config['name'].'" placeholder="'.$config['placeholder'].'" ');
if($config['disabled']) {
echo(' disabled');
}
if($config['style']) {
echo(' style="'.$config['style'].'"');
}
echo('>');
echo(htmlspecialchars($config['value']));
echo('</textarea>');
Return '';
case 'post':
if(!isset($config['auth']['html']) || !$config['auth']['html']) {
Return htmlspecialchars(@$_POST[$config['name']]);
}
if(isset($config['nonull']) && $config['nonull']) {
if(!isset($_POST[$config['name']]) || empty($_POST[$config['name']])) {
Return array('error'=>'不能为空');
}
}
Return @$_POST[$config['name']];
case 'auth':
Return array('html'=>'允许HTML代码');
case 'config':
Return array(
array('configname'=>'输入框提示','hash'=>'placeholder','inputhash'=>'text','tips'=>'输入框的placeholder'),
array('configname'=>'输入框样式','hash'=>'style','inputhash'=>'text','tips'=>'如:width:50%;min-height:200px')
);
}
Return false;
}
function dateTime($action,$config=array()) {
switch($action) {
case 'name':
Return '日期时间';
case 'hash':
Return 'datetime';
case 'group':
Return '';
case 'sql':
Return 'bigint(10)';
case 'form':
if(isset($config['source']) && $config['source']=='admin_defaultvalue_setting') {
$config['nowtime']=0;
}
if(isset($config['source']) && $config['source']=='admin_article_edit') {
$config['nowtime']=0;
}
if(empty($config['value']) && $config['nowtime']) {
$config['value']=time();
}
if(!empty($config['value'])) {
if($config['time'] && is_numeric($config['value'])) {
$config['value']=date('Y-m-d H:i:s',$config['value']);
}elseif(is_numeric($config['value'])) {
$config['value']=date('Y-m-d',$config['value']);
}
}elseif($config['value']=='0') {
$config['value']='';
}
V('input/datetime',$config);
Return '';
case 'defaultvalue':
if(empty($config['defaultvalue']) && $config['nowtime']) {
$config['defaultvalue']=time();
}
Return $config['defaultvalue'];
case 'view':
if(empty($config['value'])) {
Return '';
}
if($config['time']) {
Return date('Y-m-d H:i:s',$config['value']);
}else {
Return date('Y-m-d',$config['value']);
}
case 'post':
if(!isset($_POST[$config['name']])) {
Return false;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
网站评论系统 v1.3.zip (144个子文件)
layui.config 248B
comment.config 217B
parsedown.config 212B
cms.config 194B
admin.config 168B
shop.config 150B
layui.css 73KB
admin.css 39KB
waline.css 20KB
layer.css 14KB
layui.mobile.css 10KB
laydate.css 7KB
code.css 1KB
iconfont.eot 46KB
loading-0.gif 6KB
loading-2.gif 2KB
loading-1.gif 701B
.htaccess 324B
说明.htm 4KB
favicon.ico 4KB
favicon.ico 4KB
layui.all.js 272KB
waline.js 244KB
sortable.js 116KB
jquery.js 95KB
mobile.js 52KB
table.js 31KB
laydate.js 27KB
layer.js 22KB
layedit.js 12KB
colorpicker.js 11KB
tree.js 11KB
admin.js 10KB
form.js 9KB
layui.js 7KB
upload.js 7KB
element.js 7KB
slider.js 7KB
transfer.js 6KB
view.js 5KB
laypage.js 4KB
carousel.js 4KB
util.js 4KB
rate.js 3KB
flow.js 2KB
laytpl.js 2KB
index.js 1KB
code.js 1KB
config.js 589B
input.php 201KB
cms.php 96KB
parsedown.php 51KB
comment.php 35KB
admin.php 31KB
class.php 28KB
common.php 24KB
install.php 24KB
article.php 22KB
user.php 19KB
column.php 19KB
install.php 17KB
article.php 17KB
module.php 17KB
info_index.php 17KB
column_index.php 17KB
shop.php 16KB
channel.php 16KB
api.php 16KB
var_index.php 16KB
class.php 16KB
var.php 16KB
info_edit.php 16KB
info.php 15KB
column_edit.php 15KB
form.php 15KB
var_edit.php 14KB
channel.php 13KB
article.php 12KB
layui.php 12KB
user.php 11KB
index.php 11KB
input.php 10KB
class_config.php 9KB
module_config.php 9KB
database.php 9KB
module.php 7KB
route_edit.php 7KB
route.php 7KB
class_permission.php 7KB
user_role_permission.php 7KB
channel_edit.php 6KB
module_permission.php 6KB
article_index.php 6KB
user_edit.php 6KB
my.php 6KB
detail.php 6KB
route.php 5KB
article_edit.php 5KB
module_add.php 5KB
route_index.php 5KB
共 144 条
- 1
- 2
资源评论
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 本地镜像源配置脚本本地镜像源配置脚本
- 与spoon配套使用的jdk
- 基于单片机的便携式粮食水分测试仪的研究
- 测绘基坑支护工程变形监测报告1.pdf
- 基于PHP+swoole实现的微信机器人,依赖vbot和微信网页版的功能,帮助管理微信群/聊天/踢人等+源码+开发文档+运行教程
- com.xunmeng.pinduoduo_Release_cd290ca9_ARM64.apk
- 2788727d-25a0-41b2-b6b4-265d193edb95.doc
- 基于AVR单片机的伺服电机系统研究
- Lab-Electronic Craft Practicum-2-Simulation of a Single Tube Com
- 贪吃蛇基于TypeScript
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功