本文整理汇总了PHP中h函数的典型用法代码示例。如果您正苦于以下问题:PHP h函数的具体用法?PHP h怎么用?PHP h使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了h函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @author Gaetan SENELLE
* @return Response
*/
public function render()
{
$response = new Response();
$exception = $this->error;
$code = $this->_code($exception);
$message = $this->_message($exception, $code);
$url = $this->controller->request->here();
$isDebug = Configure::read('debug');
$response->statusCode($code);
if (method_exists($exception, 'responseHeader')) {
$this->controller->response->header($exception->responseHeader());
}
$classname = get_class($exception);
if (preg_match('@\\\\([\\w]+)$@', $classname, $matches)) {
$classname = $matches[1];
} else {
$classname = null;
}
if (!$isDebug && !$exception instanceof ApiException && !$exception instanceof HttpException) {
$classname = null;
}
$data = ['exception' => ['type' => $classname, 'message' => $message, 'url' => h($url), 'code' => $code], 'success' => false];
$response->body(json_encode($data));
$response->type('json');
return $response;
}
开发者ID:pulse14,项目名称:cakephp-api,代码行数:30,代码来源:ApiExceptionRenderer.php
示例2: ElemInit
function ElemInit()
{
$id = (int) get('id', 0);
$root_id = domainRootID();
if ($id) {
// если нет своего value, то вывести value из языка по умолчанию
# получаем данные по id
$row = sql_getRow('SELECT id,module,name,def,value FROM strings WHERE id=' . $id);
if (!$row['value'] || !$row['def']) {
# получаем данные для такого module, name
$temp_row = sql_getRow('SELECT * FROM strings WHERE module="' . $row['module'] . '" AND name="' . $row['name'] . '" AND lang="' . LANG_DEFAULT . '" AND root_id=' . getMainRootID());
if ($temp_row) {
if ($temp_row['value']) {
$row['value'] = $temp_row['value'];
}
if ($temp_row['def']) {
$row['def'] = $temp_row['def'];
}
}
}
$this->elem_fields['columns']['value']['value'] = h($row['value']);
$this->elem_fields['columns']['def'] = array('type' => 'hidden', 'value' => h($row['def']));
}
$this->elem_fields['columns']['root_id'] = array('type' => 'select', 'func' => 'getRoots');
if (!$id && $root_id) {
$this->elem_fields['columns']['root_id']['value'] = $root_id;
}
$this->elem_fields['columns']['lang'] = array('type' => 'hidden');
if (!$id) {
$this->elem_fields['columns']['lang']['value'] = '';
}
return parent::ElemInit();
}
开发者ID:romlg,项目名称:cms36,代码行数:33,代码来源:elem_main.php
示例3: __construct
public function __construct()
{
Language::read("common");
Language::read("microshop");
if (c("microshop_isuse") != "1") {
header("location: " . SiteUrl);
exit;
}
Tpl::setdir("default");
self::cp();
Tpl::setlayout("microshop_layout");
if ($_GET['column'] && strtoupper(CHARSET) == "GBK") {
$GLOBALS['_GET'] = Language::getgbk($_GET);
}
Tpl::output("nav_list", ($nav = f("nav")) ? $nav : h("nav", TRUE, "file"));
$search_type = array();
$search_type['goods'] = Language::get("nc_microshop_goods");
$search_type['personal'] = Language::get("nc_microshop_personal");
$search_type['store'] = Language::get("nc_microshop_store");
Tpl::output("search_type", $search_type);
if (!empty($_SESSION['member_id']) || 0 < intval($_SESSION['member_id'])) {
self::get_member_avatar($_SESSION['member_id']);
}
if (!c("site_status")) {
halt(c("closed_reason"));
}
Tpl::output("html_title", Language::get("nc_microshop") . "-" . c("site_name"));
Tpl::output("seo_keywords", c("microshop_seo_keywords"));
Tpl::output("seo_description", c("microshop_seo_description"));
$this->queryCart();
}
开发者ID:noikiy,项目名称:ecmall,代码行数:31,代码来源:control.php
示例4: weibo
public function weibo()
{
// 解析参数
$_REQUEST['param'] = unserialize(urldecode($_REQUEST['param']));
$active_field = $_REQUEST['param']['active_field'] == 'title' ? 'title' : 'body';
$this->assign('has_status', $_REQUEST['param']['has_status']);
$this->assign('is_success_status', $_REQUEST['param']['is_success_status']);
$this->assign('status_title', t($_REQUEST['param']['status_title']));
// 解析模板(统一使用模板的body字段)
$_REQUEST['data'] = unserialize(urldecode($_REQUEST['data']));
$content = model('Template')->parseTemplate(t($_REQUEST['tpl_name']), array($active_field => $_REQUEST['data']));
// 设置微博发布框的权限
$type = array('at', 'image', 'video', 'file', 'contribute');
$actions = array();
foreach ($type as $value) {
$actions[$value] = false;
}
$this->assign('actions', $actions);
$this->assign('title', $content['title']);
$this->assign('initHtml', $content['body']);
$this->assign('content', h($content[$active_field]));
$this->assign('source', $_REQUEST['data']['source']);
$this->assign('sourceUrl', $_REQUEST['data']['url']);
$this->assign('type', $_REQUEST['data']['type']);
$this->assign('type_data', $_REQUEST['data']['type_data']);
$this->assign('button_title', t(urldecode($_REQUEST['button_title'])));
$this->assign('addon_info', urldecode($_REQUEST['addon_info']));
$this->display();
}
开发者ID:yang7hua,项目名称:hunshe,代码行数:29,代码来源:WidgetAction.class.php
示例5: render
/**
* 实现接口
*
*/
function render()
{
//得到子菜单的标题
$menu_title = $this->_extract('menu');
//的到子菜单的属性
$sub_menu = Q::ini('appini/admin_sub_menus/' . $menu_title);
//是否存在
if (!is_array($sub_menu)) {
$sub_menu = array();
}
//得到当前的属性
$currentmenu = $this->_extract('current');
//输出子菜单 如果是当前的加上css
$out = "<ul>\n";
foreach ($sub_menu as $menu) {
//是否是当前菜单
if ($menu['title'] == $currentmenu) {
$out .= "<li class=\"current\">";
} else {
$out .= "<li>";
}
$out .= '<a href="' . url($menu['udi']) . '"> <span>';
$out .= h($menu['title']) . '</span>';
$out .= "</a></li>\n";
}
$out .= "</ul>\n";
return $out;
}
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:32,代码来源:smalltabs.php
示例6: _initialize
function _initialize()
{
if (!is_numeric($_GET['uid']) && is_string($_GET['uid'])) {
$domainuser = D('User')->getUserByIdentifier(h($_GET['uid']), 'domain');
if ($domainuser) {
$this->uid = $domainuser['uid'];
$this->assign('uid', $this->uid);
} else {
$this->error(L('user_not_exist'));
}
} else {
$this->assign('uid', intval($_GET['uid']));
}
if ('detail' != ACTION_NAME) {
$user_info = D('User')->getUserByIdentifier($this->uid);
if ($user_info) {
$userinfo = array('Địa chỉ mblog' => U('home/Space/index', array('uid' => $user_info['domain'] ? $user_info['domain'] : $this->uid)), 'Giới tính' => getSex($user_info['sex']), 'Nơi sống' => $user_info['location']);
// 基本信息-钩子
Addons::hook('home_space_profile_base', array('uid' => $this->uid, 'user_info' => &$userinfo));
$this->assign('userinfo', $userinfo);
} else {
$this->error(L('user_not_exist'));
}
$this->__getSpaceCount($this->uid);
}
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:26,代码来源:SpaceAction.class.php
示例7: render
function render()
{
//路径
$baseDir = $this->_context->get('base_dir', $this->_context->baseDir() . 'js/fckeditor/');
$baseDir = h(rtrim($baseDir, '/\\') . '/');
$width = $this->get('width', "100%");
$height = $this->get('height', "250px");
$value = $this->get('value', '');
$class = $this->get('class', '');
//控件的id
$id = $this->id();
$config = $this->get('config');
if (!is_array($config)) {
$config = array();
}
$out = Q::control('memo', $id, array('value' => $value, 'class' => $class))->render();
$out .= <<<EOT
\t<script type="text/javascript" src="{$baseDir}fckeditor.js"></script>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('{$id}');
oFCKeditor.BasePath = "{$baseDir}";
oFCKeditor.Height="{$height}";
oFCKeditor.Width="{$width}";
oFCKeditor.ReplaceTextarea();
</script>\t
EOT;
return $out;
}
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:28,代码来源:fckeditor.php
示例8: output
/**
* Creates form fields and JavaScript includes to add a color picker widget.
* <code>
* $dh->output('background-color', '#f00');
* </code>
* @param string $inputName
* @param value $string
* @param array $options
*/
public function output($inputName, $value = null, $options = array())
{
$view = View::getInstance();
$view->requireAsset('core/colorpicker');
$form = Loader::helper('form');
$r = Request::getInstance();
if ($r->request->has($inputName)) {
$value = h($r->request->get($inputName));
}
$strOptions = '';
$i = 0;
$defaults = array();
$defaults['value'] = $value;
$defaults['className'] = 'ccm-widget-colorpicker';
$defaults['showInitial'] = true;
$defaults['showInput'] = true;
$defaults['allowEmpty'] = true;
$defaults['cancelText'] = t('Cancel');
$defaults['chooseText'] = t('Choose');
$defaults['preferredFormat'] = 'rgb';
$defaults['showAlpha'] = false;
$defaults['clearText'] = t('Clear Color Selection');
$defaults['appendTo'] = '.ui-dialog';
$strOptions = json_encode(array_merge($defaults, $options));
$identifier = new \Concrete\Core\Utility\Service\Identifier();
$identifier = $identifier->getString(32);
print "<input type=\"text\" data-color-picker=\"{$identifier}\" name=\"{$inputName}\" value=\"{$value}\" id=\"ccm-colorpicker-{$inputName}\" />";
print "<script type=\"text/javascript\">";
print "\$(function () { \$('[data-color-picker={$identifier}]').spectrum({$strOptions}); })";
print "</script>";
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:40,代码来源:Color.php
示例9: link
/**
* Create link containing a Font Awesome icon.
*
* @param string $icon Font Awesome icon (excluding the fa- prefix)
* @param string $title Link text
* @param string|array $url Cake-relative URL or array of URL parameters, or external URL (starts with http://)
* @param array $options Array of options and HTML attributes.
* @param string $confirmMessage JavaScript confirmation message.
* @return string An `<a />` element.
*/
public function link($icon, $title, $url = null, $options = array(), $confirmMessage = false)
{
$escapeTitle = true;
if (isset($options['escapeTitle'])) {
$escapeTitle = $options['escapeTitle'];
unset($options['escapeTitle']);
} elseif (isset($options['escape'])) {
$escapeTitle = $options['escape'];
}
if ($escapeTitle === true) {
$title = h($title);
} elseif (is_string($escapeTitle)) {
$title = htmlentities($title, ENT_QUOTES, $escapeTitle);
}
// Determine whether to include a space between the icon and title.
$space = isset($options['space']) && $options['space'] === false ? '' : ' ';
// Append/Prepend the Font Awesome icon.
if (empty($title)) {
$title = '<i class="fa fa-' . $icon . '"></i>';
} elseif (empty($options['before'])) {
$title .= $space . '<i class="fa fa-' . $icon . '"></i>';
} else {
$title = '<i class="fa fa-' . $icon . '"></i>' . $space . $title;
}
unset($options['before']);
$options['escape'] = false;
return $this->Html->link($title, $url, $options, $confirmMessage);
}
开发者ID:drmonkeyninja,项目名称:cakephp-font-awesome,代码行数:38,代码来源:FaHelper.php
示例10: saveArticle
/**
* 保存公告数据
* @param array $data 公告相关数据
* @return boolean|integer 若成功返回公告ID,失败返回false
*/
public function saveArticle($data)
{
// 处理数据
$add['uid'] = $save['uid'] = $GLOBALS['ts']['mid'];
$add['title'] = $save['title'] = t($data['title']);
$add['content'] = $save['content'] = h($data['content']);
$add['attach'] = $save['attach'] = trim(t($data['attach_ids']), '|');
// 附件ID
$add['mtime'] = $save['mtime'] = time();
$add['type'] = $save['type'] = intval($data['type']);
if (empty($add['title'])) {
$this->error = L('PUBLIC_COMMENT_MAIL_TITLE');
// 标题不可为空
return false;
}
if (empty($add['content'])) {
$this->error = L('PUBLIC_COMMENT_MAIL_REQUIRED');
// 内容不可为空
return false;
}
if (!empty($data['id'])) {
// 编辑操作
$map['id'] = $data['id'];
return $this->where($map)->save($save);
} else {
// 添加操作
if ($id = $this->add($add)) {
$edit['sort'] = $id;
return $this->where('id=' . $id)->save($edit);
}
}
}
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:37,代码来源:XarticleModel.class.php
示例11: pagesList
function pagesList($type)
{
global $self, $PG_DIR;
$list = array();
$dir = opendir($PG_DIR);
while ($file = readdir($dir)) {
if (preg_match("/\\.txt\$/", $file)) {
$files[] = substr($file, 0, strlen($file) - 4);
}
}
if (is_array($files)) {
sort($files);
foreach ($files as $file) {
$list[] = "<a href=\"{$self}?page=" . u($file) . "\">" . h($file) . "</a>";
}
}
if ($type == "comma") {
$ret = implode(", ", $list);
} else {
if ($type == "list") {
$ret = "<ul><li>" . implode("</li><li>", $list) . "</li></ul>";
}
}
return $ret;
}
开发者ID:pavlinov,项目名称:1b.school59.eu,代码行数:25,代码来源:wkp_Index.php
示例12: view
public function view($page = 0) {
$list = new LogList();
$this->requireAsset('select2');
$levels = array();
foreach(Log::getLevels() as $level) {
$levels[$level] = Log::getLevelDisplayName($level);
}
$this->set('levels', $levels);
$channels = array('' => t('All Channels'));
foreach(Log::getChannels() as $channel) {
$channels[$channel] = Log::getChannelDisplayName($channel);
}
$r = Request::getInstance();
if ($r->query->has('channel') && $r->query->get('channel') != '') {
$list->filterByChannel($r->query->get('channel'));
$this->set('selectedChannel', h($r->query->get('channel')));
}
if ($r->query->has('level')) {
$selectedlevels = $r->get('level');
if (is_array($selectedlevels) && count($selectedlevels) != 8) {
$list->filterByLevels($selectedlevels);
}
}
if ($r->query->has('keywords') && $r->query->get('keywords') != '') {
$list->filterByKeywords($r->query->get('keywords'));
}
$entries = $list->getPage();
$this->set('list', $list);
$this->set('entries', $entries);
$this->set('levels', $levels);
$this->set('channels', $channels);
}
开发者ID:JeRoNZ,项目名称:concrete5-1,代码行数:35,代码来源:logs.php
示例13: url
public function url($url, $full = false)
{
if (is_string($url) && preg_match(sprintf('/^%s.+/', preg_quote('//', '/')), $url)) {
return h($url);
}
return parent::url($url, $full);
}
开发者ID:hiromi2424,项目名称:cake_app_base,代码行数:7,代码来源:app_helper.php
示例14: auth_error
function auth_error($exception = null)
{
global $connection, $adminer, $token;
$session_name = session_name();
$error = "";
if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) {
$error = lang('Session support must be enabled.');
} elseif (isset($_GET["username"])) {
if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) {
$error = lang('Session expired, please login again.');
} else {
$password =& get_session("pwds");
if (isset($password)) {
$error = h($exception ? $exception->getMessage() : (is_string($connection) ? $connection : lang('Invalid credentials.')));
$password = null;
}
}
}
page_header(lang('Login'), $error, null);
echo "<form action='' method='post' onclick='eventStop(event);'>\n";
$adminer->loginForm();
echo "<div>";
hidden_fields($_POST, array("driver", "server", "username", "password", "permanent"));
// expired session
echo "</div>\n";
echo "</form>\n";
page_footer("auth");
}
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:28,代码来源:auth.inc.php
示例15: getBody
public static function getBody()
{
$result = '';
foreach (self::$data as $title => $data) {
$result .= '<table border="1" style="width:90%; background:#eee; font-size:12px; color:#222; text-align:left; border-collapse:collapse;">';
// head line
if (is_array($data['meta']) && count($data['meta'])) {
$result .= '<tr>';
foreach ($data['meta'] as $cell) {
$result .= '<th style="background:#bdb; padding:7px;">' . h($cell) . '</th>';
}
$result .= '</tr>';
}
// information lines
if (is_array($data['data']) && count($data['data'])) {
foreach ($data['data'] as $row) {
$result .= '<tr>';
foreach ($row as $cell) {
$result .= '<td style="padding:7px;">' . h($cell) . '</td>';
}
$result .= '</tr>';
}
}
$result .= '</table>';
}
return '<div style="clear:both;"></div>' . $result;
}
开发者ID:VictorSproot,项目名称:AtomXCMS-2,代码行数:27,代码来源:AtmDebug.class.php
示例16: parse_conf
private static function parse_conf(&$setting_config)
{
$nc_config = $GLOBALS['config'];
if (is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])) {
$dbslave = $nc_config['db']['slave'];
$sid = array_rand($dbslave);
$nc_config['db']['read'] = $dbslave[$sid];
} else {
$nc_config['db']['read'] = $nc_config['db'][1];
}
$nc_config['db']['write'] = $nc_config['db'][1];
$setting_config = $nc_config;
$setting = ($setting = f("setting")) ? $setting : h("setting", TRUE, "file");
if ($nc_config['thumb']['save_type'] == 1) {
$nc_config['thumb_url'] = SiteUrl;
} else {
if ($nc_config['thumb']['save_type'] == 2 && preg_match("/^http:\\/\\/[\\.\\-\\w]+/", $nc_config['thumb']['url'])) {
$nc_config['thumb_url'] = $nc_config['thumb']['url'];
} else {
if ($nc_config['thumb']['save_type'] == 3 && $setting['ftp_open']) {
$nc_config['thumb_url'] = $setting['ftp_access_url'];
} else {
$nc_config['thumb_url'] = SiteUrl;
}
}
}
$setting_config = array_merge_recursive($setting, $nc_config);
}
开发者ID:dw250100785,项目名称:shopnc,代码行数:28,代码来源:base.php
示例17: getFlagIcon
/**
* Returns a flag for a passed country/region
*/
public function getFlagIcon($region, $filePathOnly = false)
{
$val = \Core::make('helper/validation/strings');
if ($val->alphanum($region, false, true)) {
$region = h(strtolower($region));
} else {
$region = false;
}
if ($region) {
$v = \View::getInstance();
if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
$icon = $v->getThemePath() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
} elseif (file_exists(DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png')) {
$icon = REL_DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
} else {
$icon = ASSETS_URL . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
}
if (isset($icon)) {
if ($filePathOnly) {
return $icon;
} else {
return '<img class="ccm-region-flag img-responsive" id="ccm-region-flag-' . $region . '" src="' . $icon . '" alt="' . $region . '" />';
}
}
}
}
开发者ID:krsreenatha,项目名称:concrete5-1,代码行数:29,代码来源:Flag.php
示例18: checklogin
function checklogin()
{
$strVerify = h($_POST['verify']);
if (md5($strVerify) != $_SESSION['verify']) {
$this->error('验证码错误');
exit;
}
if ($this->uid) {
$map['id'] = $this->uid;
} else {
$map['email'] = h($_POST['account']);
}
$map['passwd'] = md5($_POST['password']);
$pUser = D('User');
$user = $pUser->where($map)->field("id,name,active,admin_level")->find();
if ($user) {
//登陆成功
$_SESSION["userInfo"] = serialize($user);
Session::set('ThinkSnSAdmin', $user['id']);
$this->assign('jumpUrl', U('Index/index'));
$this->success('登陆成功');
} else {
$this->error('登陆失败');
}
}
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:25,代码来源:PublicAction.class.php
示例19: doshorturl
public function doshorturl()
{
$data['shorturl_type'] = $_POST['shorturl_type'];
$data['customize_url'] = h($_POST['customize_url']);
model('Xdata')->lput('shorturl', $data);
$this->redirect('admin/Plugin/shorturl');
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:7,代码来源:PluginAction.class.php
示例20: toHTML
public function toHTML()
{
// change to facilitate lists
$id = 'search_' . $this->fieldname;
$name = 'Search[' . $this->fieldname . ']';
if (count($this->options) > get_config('AUTOCOMPLETE_SELECT_LIMIT')) {
$html = '';
$selected = $this->value;
if (empty($selected)) {
$selected = $this->default;
}
$html .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . $selected . '" />';
$text_value = isset($this->options[$selected]) ? $this->options[$selected] : '';
$html .= '<input alt="Autocomplete enabled" type="text" id="' . $id . '_text" value="' . $text_value . '" class="uz-autocomplete ui-autocomplete-input icon slim" data-id="' . $id . '" data-action="array" />';
$html .= '<script type="text/javascript">' . 'var ' . $id . '=' . json_encode(dataObject::toJSONArray($this->options)) . '</script>';
} else {
$html = '<select id="' . $id . '" name="' . $name . '">';
foreach ($this->options as $val => $opt) {
$selected = '';
if ($this->value === "{$val}" || is_null($this->value) && $this->default === "{$val}") {
$selected = 'selected="selected"';
}
$html .= '<option value="' . $val . '" ' . $selected . '>' . h(prettify($opt)) . '</option>';
}
$html .= '</select></li>';
}
return $this->labelHTML() . $html;
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:28,代码来源:SelectSearchField.php
注:本文中的h函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论