'; $s .= ' '; return $s; } function tpl_form_field_link($name, $value = '', $options = array()) { global $_GPC, $_W; if (!empty($options)) { foreach ($options as $key => $val) { $options .= $key . ':' . $val . ','; } } $s = ''; if (!defined('TPL_INIT_LINK')) { $s .= ' '; define('TPL_INIT_LINK', true); } $s .= '
'; return $s; } function tpl_form_module_link($name) { $s = ''; if (!defined('TPL_INIT_module')) { $s = ' '; define('TPL_INIT_module', true); } $s .= '
选择链接
'; return $s; } function tpl_form_field_emoji($name, $value = '') { $s = ''; if (!defined('TPL_INIT_EMOJI')) { $s = ' '; define('TPL_INIT_EMOJI', true); } $s .= '
'; return $s; } function tpl_form_field_color($name, $value = '') { $s = ''; if (!defined('TPL_INIT_COLOR')) { $s = ' '; define('TPL_INIT_COLOR', true); } $s .= '
'; return $s; } function tpl_form_field_icon($name, $value = '') { if (empty($value)) { $value = 'fa fa-external-link'; } $s = ''; if (!defined('TPL_INIT_ICON')) { $s = ' '; define('TPL_INIT_ICON', true); } $s .= '
'; return $s; } function tpl_form_field_image($name, $value = '', $default = '', $options = array()) { global $_W; if (empty($default)) { $default = './resource/images/nopic.jpg'; } $val = $default; if (!empty($value)) { $val = tomedia($value); } if (defined('SYSTEM_WELCOME_MODULE')) { $options['uniacid'] = 0; } if (!empty($options['global'])) { $options['global'] = true; $val = to_global_media(empty($value) ? $default : $value); } else { $options['global'] = false; } if (empty($options['class_extra'])) { $options['class_extra'] = ''; } if (isset($options['dest_dir']) && !empty($options['dest_dir'])) { if (!preg_match('/^\w+([\/]\w+)?$/i', $options['dest_dir'])) { exit('图片上传目录错误,只能指定最多两级目录,如: "we7_store","we7_store/d1"'); } } $options['direct'] = true; $options['multiple'] = false; if (isset($options['thumb'])) { $options['thumb'] = !empty($options['thumb']); } $options['fileSizeLimit'] = intval($GLOBALS['_W']['setting']['upload']['image']['limit']) * 1024; $s = ''; if (!defined('TPL_INIT_IMAGE')) { $s = ' '; define('TPL_INIT_IMAGE', true); } $s .= '
×
'; return $s; } function tpl_form_field_multi_image($name, $value = array(), $options = array()) { global $_W; $options['multiple'] = true; $options['direct'] = false; $options['fileSizeLimit'] = intval($GLOBALS['_W']['setting']['upload']['image']['limit']) * 1024; if (isset($options['dest_dir']) && !empty($options['dest_dir'])) { if (!preg_match('/^\w+([\/]\w+)?$/i', $options['dest_dir'])) { exit('图片上传目录错误,只能指定最多两级目录,如: "we7_store","we7_store/d1"'); } } $s = ''; if (!defined('TPL_INIT_MULTI_IMAGE')) { $s = ' '; define('TPL_INIT_MULTI_IMAGE', true); } $s .= <<
EOF; if (is_array($value) && count($value) > 0) { foreach ($value as $row) { $s .= '
×
'; } } $s .= '
'; return $s; } function tpl_form_field_audio($name, $value = '', $options = array()) { if (!is_array($options)) { $options = array(); } $options['direct'] = true; $options['multiple'] = false; $options['fileSizeLimit'] = intval($GLOBALS['_W']['setting']['upload']['audio']['limit']) * 1024; $s = ''; if (!defined('TPL_INIT_AUDIO')) { $s = ' '; echo $s; define('TPL_INIT_AUDIO', true); } $s .= '
'; return $s; } function tpl_form_field_multi_audio($name, $value = array(), $options = array()) { $s = ''; $options['direct'] = false; $options['multiple'] = true; $options['fileSizeLimit'] = intval($GLOBALS['_W']['setting']['upload']['audio']['limit']) * 1024; if (!defined('TPL_INIT_MULTI_AUDIO')) { $s .= ' '; define('TPL_INIT_MULTI_AUDIO', true); } $s .= '
'; if (!empty($value) && !is_array($value)) { $value = array($value); } if (is_array($value) && count($value) > 0) { $n = 0; foreach ($value as $row) { $m = random(8); $s .= '
'; ++$n; } } $s .= '
'; return $s; } function tpl_form_field_video($name, $value = '', $options = array()) { if (!is_array($options)) { $options = array(); } if (!is_array($options)) { $options = array(); } $options['direct'] = true; $options['multi'] = false; $options['type'] = 'video'; $options['fileSizeLimit'] = intval($GLOBALS['_W']['setting']['upload']['audio']['limit']) * 1024; $s = ''; if (!defined('TPL_INIT_VIDEO')) { $s = ' '; echo $s; define('TPL_INIT_VIDEO', true); } $s .= '
'; return $s; } function tpl_form_field_wechat_image($name, $value = '', $default = '', $options = array()) { global $_W; if (!$_W['acid'] || $_W['account']['level'] < 3) { $options['account_error'] = 1; } else { $options['acid'] = $_W['acid']; } if (empty($default)) { $default = './resource/images/nopic.jpg'; } $val = $default; if (!empty($value)) { $media_data = (array) media2local($value, true); $val = $media_data['attachment']; } if (empty($options['class_extra'])) { $options['class_extra'] = ''; } $options['direct'] = true; $options['multiple'] = false; $options['type'] = empty($options['type']) ? 'image' : $options['type']; $s = ''; if (!defined('TPL_INIT_WECHAT_IMAGE')) { $s = ' '; define('TPL_INIT_WECHAT_IMAGE', true); } $s .= '
'; $s .= '
×
'; if (!empty($media_data) && 'temp' == $media_data['model'] && (time() - $media_data['createtime'] > 259200)) { $s .= '该素材已过期 [有效期为3天],请及时更新素材'; } return $s; } function tpl_form_field_wechat_multi_image($name, $value = '', $default = '', $options = array()) { global $_W; if (!$_W['acid'] || $_W['account']['level'] < 3) { $options['account_error'] = 1; } else { $options['acid'] = $_W['acid']; } if (empty($default)) { $default = './resource/images/nopic.jpg'; } if (empty($options['class_extra'])) { $options['class_extra'] = ''; } $options['direct'] = false; $options['multiple'] = true; $options['type'] = empty($options['type']) ? 'image' : $options['type']; $s = ''; if (!defined('TPL_INIT_WECHAT_MULTI_IMAGE')) { $s = ' '; define('TPL_INIT_WECHAT_MULTI_IMAGE', true); } $s .= <<
EOF; if (is_array($value) && count($value) > 0) { foreach ($value as $row) { $s .= '
×
'; } } $s .= '
'; return $s; } function tpl_form_field_wechat_voice($name, $value = '', $options = array()) { global $_W; if (!$_W['acid'] || $_W['account']['level'] < 3) { $options['account_error'] = 1; } else { $options['acid'] = $_W['acid']; } if (!empty($value)) { $media_data = (array) media2local($value, true); $val = $media_data['attachment']; } if (!is_array($options)) { $options = array(); } $options['direct'] = true; $options['multiple'] = false; $options['type'] = 'voice'; $s = ''; if (!defined('TPL_INIT_WECHAT_VOICE')) { $s = ' '; echo $s; define('TPL_INIT_WECHAT_VOICE', true); } $s .= '
'; if (!empty($media_data) && 'temp' == $media_data['model'] && (time() - $media_data['createtime'] > 259200)) { $s .= '该素材已过期 [有效期为3天],请及时更新素材'; } return $s; } function tpl_form_field_wechat_video($name, $value = '', $options = array()) { global $_W; if (!$_W['acid'] || $_W['account']['level'] < 3) { $options['account_error'] = 1; } else { $options['acid'] = $_W['acid']; } if (!empty($value)) { $media_data = (array) media2local($value, true); $val = $media_data['attachment']; } if (!is_array($options)) { $options = array(); } if (empty($options['tabs'])) { $options['tabs'] = array('video' => 'active', 'browser' => ''); } $options = array_elements(array('tabs', 'global', 'dest_dir', 'acid', 'error'), $options); $options['direct'] = true; $options['multi'] = false; $options['type'] = 'video'; $s = ''; if (!defined('TPL_INIT_WECHAT_VIDEO')) { $s = ' '; echo $s; define('TPL_INIT_WECHAT_VIDEO', true); } $s .= '
'; if (!empty($media_data) && 'temp' == $media_data['model'] && (time() - $media_data['createtime'] > 259200)) { $s .= '该素材已过期 [有效期为3天],请及时更新素材'; } return $s; } function tpl_form_field_location_category($name, $values = array(), $del = false) { $html = ''; if (!defined('TPL_INIT_LOCATION_CATEGORY')) { $html .= ' '; define('TPL_INIT_LOCATION_CATEGORY', true); } if (empty($values) || !is_array($values)) { $values = array('cate' => '', 'sub' => '', 'clas' => ''); } if (empty($values['cate'])) { $values['cate'] = ''; } if (empty($values['sub'])) { $values['sub'] = ''; } if (empty($values['clas'])) { $values['clas'] = ''; } $html .= '
'; if ($del) { $html .= '
'; } else { $html .= ''; } return $html; } function tpl_ueditor($id, $value = '', $options = array()) { global $_W; $options['uniacid'] = isset($options['uniacid']) ? intval($options['uniacid']) : $_W['uniacid']; $options['global'] = empty($options['global']) ? '' : $options['global']; $options['height'] = empty($options['height']) ? 200 : $options['height']; $options['allow_upload_video'] = isset($options['allow_upload_video']) ? $options['allow_upload_video'] : true; $s = ''; $s .= !empty($id) ? "" : ''; $s .= " "; return $s; } function tpl_coupon_colors($name, $value = 'Color082') { load()->model('activity'); $options = activity_coupon_colors(); empty($name) && ($name = 'coupon_color'); if (!defined('TPL_INIT_COUPON_COLOR')) { $html = ' '; define('TPL_INIT_COUPON_COLOR', true); } $html .= '
'; return $html; }