本文整理汇总了PHP中func_htmlspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP func_htmlspecialchars函数的具体用法?PHP func_htmlspecialchars怎么用?PHP func_htmlspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了func_htmlspecialchars函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getLabelValue
/**
* Get label value
*
* @return string
*/
protected function getLabelValue()
{
$value = strval($this->getValue());
if (!$this->getParam(static::PARAM_UNESCAPE)) {
$value = func_htmlspecialchars($value);
}
return $value;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:ALabel.php
示例2: getTooltip
/**
* Get tooltip
*
* @return string
*/
protected function getTooltip()
{
if ($this->getAttributeGroup()) {
$result = '';
} elseif ($this->getProductClass()) {
$result = static::t('These attributes can be applied to the "{{name}}" product class.', array('name' => func_htmlspecialchars($this->getProductClass()->getName())));
} elseif ($this->getPersonalOnly()) {
$result = static::t('These attributes can only be applied to this particular product.');
} else {
$result = static::t('These attributes can be applied to all the products in the store.');
}
return $result;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:AAttributes.php
示例3: doActionCheckCoupon
/**
* Check coupon
*
* @return void
*/
protected function doActionCheckCoupon()
{
$code = strval(\XLite\Core\Request::getInstance()->code);
$coupon = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Coupons\\Model\\Coupon')->findOneByCode($code);
$codes = $coupon ? $coupon->getErrorCodes($this->getOrder()) : array();
$error = null;
$this->valid = false;
if (!$coupon || $codes) {
if ($coupon && in_array(\XLite\Module\CDev\Coupons\Model\Coupon::ERROR_TOTAL, $codes)) {
$currency = $this->getOrder()->getCurrency();
if (0 < $coupon->getTotalRangeBegin() && 0 < $coupon->getTotalRangeEnd()) {
$error = static::t('To use the coupon, your order subtotal must be between X and Y', array('min' => $currency->formatValue($coupon->getTotalRangeBegin()), 'max' => $currency->formatValue($coupon->getTotalRangeEnd())));
} elseif (0 < $coupon->getTotalRangeBegin()) {
$error = static::t('To use the coupon, your order subtotal must be at least X', array('min' => $currency->formatValue($coupon->getTotalRangeBegin())));
} else {
$error = static::t('To use the coupon, your order subtotal must not exceed Y', array('max' => $currency->formatValue($coupon->getTotalRangeEnd())));
}
} else {
$error = static::t('There is no such a coupon, please check the spelling: X', array('code' => func_htmlspecialchars($code)));
}
} else {
$found = false;
foreach ($this->getOrder()->getUsedCoupons() as $usedCoupon) {
if ($usedCoupon->getCoupon() && $usedCoupon->getCoupon()->getId() == $coupon->getId()) {
$found = true;
break;
}
}
if ($found) {
// Duplicate
$error = static::t('You have already used the coupon');
} else {
$this->valid = true;
}
}
$data = array('error' => null);
if ($error) {
$data['error'] = $error;
} else {
$data['amount'] = $coupon->getAmount($this->getOrder());
}
$this->setPureAction();
$this->suppressOutput = true;
$this->silent = true;
print json_encode($data);
}
开发者ID:kewaunited,项目名称:xcart,代码行数:51,代码来源:Order.php
示例4: getAttributesCode
/**
* Return HTML representation for widget attributes
*
* @return string
*/
protected function getAttributesCode()
{
$result = '';
foreach ($this->getAttributes() as $name => $value) {
$result .= ' ' . $name . '="' . func_htmlspecialchars($value) . '"';
}
return $result;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:AFormField.php
示例5: getProfileName
/**
* Get profile name
*
* @return string
*/
protected function getProfileName()
{
$profile = $this->getOrder()->getProfile();
$address = $profile->getBillingAddress() ?: $profile->getShippingAddress();
if (!$address) {
$profile->getAddresses()->first();
}
return $address ? func_htmlspecialchars($address->getName()) : $profile->getLogin();
}
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:Info.php
示例6: getReviewShortContent
/**
* Return shortened review content
*
* @param \XLite\Module\XC\Reviews\Model\Review $entity Review
*
* @return string
*/
protected function getReviewShortContent(\XLite\Module\XC\Reviews\Model\Review $entity)
{
$review = $entity->getReview();
$review = trim($review);
if (function_exists('mb_substr')) {
$value = mb_substr($review, 0, 30, 'utf-8');
$result = $value . (mb_strlen($value, 'utf-8') != mb_strlen($review, 'utf-8') ? '...' : '');
} else {
$value = substr($review, 0, 30);
$result = $value . (strlen($value) != strlen($review) ? '...' : '');
}
return func_htmlspecialchars($result);
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:20,代码来源:Review.php
示例7: getFormattedPath
/**
* Get formatted path of current category
*
* @return string
*/
protected function getFormattedPath()
{
$list = array();
foreach ($this->getCategory()->getPath() as $category) {
$list[] = '<a href="' . static::buildURL('categories', '', array('id' => $category->getCategoryId())) . '">' . func_htmlspecialchars($category->getName()) . '</a>';
}
return implode(' :: ', $list);
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Category.php
示例8: getDataCode
/**
* Return HTML representation for widget attributes
*
* @return string
*/
protected function getDataCode()
{
$result = '';
foreach ($this->getAttributes() as $name => $value) {
if ('class' != $name) {
$result .= ' data-' . $name . '="' . func_htmlspecialchars($value) . '"';
}
}
return $result;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:AFileUploader.php
示例9: getOptionAttributes
/**
* Get option attributes
*
* @param mixed $value Value
*
* @return array
*/
protected function getOptionAttributes($value)
{
$attributes = array('value' => func_htmlspecialchars($value));
if ($this->isOptionSelected($value)) {
$attributes['selected'] = 'selected';
}
if ($this->isOptionDisabled($value)) {
$attributes['disabled'] = 'disabled';
}
return $attributes;
}
开发者ID:kingsj,项目名称:core,代码行数:18,代码来源:ASelect.php
示例10: func_htmlspecialchars
/**
* htmlspecialchars умеющая обрабатывать массивы
*
* @param unknown_type $data
*/
function func_htmlspecialchars(&$data)
{
if (is_array($data)) {
foreach ($data as $sKey => $value) {
if (is_array($value)) {
func_htmlspecialchars($data[$sKey]);
} else {
$data[$sKey] = htmlspecialchars($value);
}
}
} else {
$data = htmlspecialchars($data);
}
}
开发者ID:lifecom,项目名称:test,代码行数:19,代码来源:function.php
示例11: VarAssign
/**
* Выполняет загрузку необходимых (возможно даже системных :)) переменных в шаблон
*
*/
public function VarAssign()
{
/**
* Загружаем весь $_REQUEST, предварительно обработав его функцией func_htmlspecialchars()
*/
$aRequest = $_REQUEST;
func_htmlspecialchars($aRequest);
$this->Assign("_aRequest", $aRequest);
/**
* Параметры стандартной сессии
*/
$this->Assign("_sPhpSessionName", session_name());
$this->Assign("_sPhpSessionId", session_id());
/**
* Short Engine aliases
*/
$this->Assign("LS", LS::getInstance());
/**
* Загружаем объект доступа к конфигурации
*/
$this->Assign("oConfig", Config::getInstance());
/**
* Загружаем роутинг с учетом правил rewrite
*/
$aRouter = array();
if ($aPages = Config::Get('router.page')) {
foreach ($aPages as $sPage => $aAction) {
$aRouter[$sPage] = Router::GetPath($sPage);
}
}
$this->Assign("aRouter", $aRouter);
/**
* Загружаем в шаблон блоки
*/
$this->Assign("aBlocks", $this->aBlocks);
/**
* Загружаем в шаблон JS переменные
*/
$this->Assign("aVarsJs", $this->aVarsJs);
/**
* Загружаем HTML заголовки
*/
$this->Assign("sHtmlTitle", htmlspecialchars($this->GetHtmlTitle(Config::Get('view.title_sort_reverse'))));
$this->Assign("sHtmlKeywords", htmlspecialchars($this->sHtmlKeywords));
$this->Assign("sHtmlDescription", htmlspecialchars($this->sHtmlDescription));
$this->Assign("aHtmlHeadFiles", $this->aHtmlHeadFiles);
$this->Assign("aHtmlRssAlternate", $this->aHtmlRssAlternate);
$this->Assign("sHtmlCanonical", func_urlspecialchars($this->sHtmlCanonical));
$this->Assign("sHtmlRobots", $this->sHtmlRobots);
/**
* Загружаем список активных плагинов
*/
$aPlugins = Engine::getInstance()->GetPlugins();
$this->Assign("aPluginActive", array_fill_keys(array_keys($aPlugins), true));
/**
* Загружаем пути до шаблонов плагинов
*/
$aTemplateWebPathPlugin = array();
$aTemplatePathPlugin = array();
foreach ($aPlugins as $k => $oPlugin) {
$aTemplateWebPathPlugin[$k] = Plugin::GetTemplateWebPath(get_class($oPlugin));
$aTemplatePathPlugin[$k] = Plugin::GetTemplatePath(get_class($oPlugin));
}
$this->Assign("aTemplateWebPathPlugin", $aTemplateWebPathPlugin);
$this->Assign("aTemplatePathPlugin", $aTemplatePathPlugin);
/**
* Загружаем security-ключ
*/
$this->Assign("LIVESTREET_SECURITY_KEY", $this->Security_GetSecurityKey());
}
开发者ID:vgrish,项目名称:livestreet-framework,代码行数:74,代码来源:Viewer.class.php
示例12: getOptionAttributesCode
/**
* Get option attributes as HTML code
*
* @param mixed $value Value
* @param mixed $text Text
*
* @return string
*/
protected function getOptionAttributesCode($value, $text)
{
$list = array();
foreach ($this->getOptionAttributes($value, $text) as $name => $value) {
$list[] = $name . '="' . func_htmlspecialchars($value) . '"';
}
return implode(' ', $list);
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:ASelect.php
示例13: formatPriceHTML
/**
* Format price as HTML block
*
* @param float $value Value
* @param \XLite\Model\Currency $currency Currency OPTIONAL
*
* @return string
*/
public function formatPriceHTML($value, \XLite\Model\Currency $currency = null)
{
if (!isset($currency)) {
$currency = \XLite::getInstance()->getCurrency();
}
$parts = $currency->formatParts($value);
if (isset($parts['sign']) && '-' == $parts['sign']) {
$parts['sign'] = '− ';
}
foreach ($parts as $name => $value) {
$class = 'part-' . $name;
$parts[$name] = '<span class="' . $class . '">' . func_htmlspecialchars($value) . '</span>';
}
return implode('', $parts);
}
开发者ID:kingsj,项目名称:core,代码行数:23,代码来源:AView.php
示例14: getParamsEscape
/**
* Возвращает экранированный список параметров
*
* @return array
*/
public function getParamsEscape()
{
$aParams = $this->getParams();
func_htmlspecialchars($aParams);
return $aParams;
}
开发者ID:pinguo-liguo,项目名称:livestreet,代码行数:11,代码来源:Property.entity.class.php
示例15: getQuoted
/**
* Validate string for using in XML node
*
* @param mixed $arg Arguments string/array
*
* @return mixed
*/
protected function getQuoted($arg)
{
if (is_array($arg)) {
foreach ($arg as $k => $v) {
if ($k == 'phone') {
$arg[$k] = preg_replace('/[^0-9]/', "", $v);
} elseif (is_string($v)) {
$arg[$k] = func_htmlspecialchars($v);
}
}
} elseif (is_string($arg)) {
$arg = func_htmlspecialchars($arg);
}
return $arg;
}
开发者ID:kewaunited,项目名称:xcart,代码行数:22,代码来源:UPS.php
示例16: getEscapedParam
/**
* Get escaped widget parameter
*
* @param string $name Parameters name
*
* @return string
*/
protected function getEscapedParam($name)
{
$value = $this->getParam($name);
return func_htmlspecialchars($value);
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:AView.php
示例17: VarAssign
/**
* Выполняет загрузку необходимый(возможно даже системный :)) переменных в шалон
*
*/
public function VarAssign()
{
/**
* Загружаем весь $_REQUEST, предварительно обработав его функцией func_htmlspecialchars()
*/
$aRequest = $_REQUEST;
func_htmlspecialchars($aRequest);
$this->Assign("_aRequest", $aRequest);
/**
* Параметры стандартной сессии
*/
$this->Assign("_sPhpSessionName", session_name());
$this->Assign("_sPhpSessionId", session_id());
/**
* Short Engine aliases
*/
$this->Assign("LS", LS::getInstance());
/**
* Загружаем объект доступа к конфигурации
*/
$this->Assign("oConfig", Config::getInstance());
/**
* Загружаем роутинг с учетом правил rewrite
*/
$aRouter = array();
$aPages = Config::Get('router.page');
if (!$aPages or !is_array($aPages)) {
throw new Exception('Router rules is underfined.');
}
foreach ($aPages as $sPage => $aAction) {
$aRouter[$sPage] = Router::GetPath($sPage);
}
$this->Assign("aRouter", $aRouter);
/**
* Загружаем в шаблон блоки
*/
$this->Assign("aBlocks", $this->aBlocks);
/**
* Загружаем HTML заголовки
*/
$this->Assign("sHtmlTitle", htmlspecialchars($this->sHtmlTitle));
$this->Assign("sHtmlKeywords", htmlspecialchars($this->sHtmlKeywords));
$this->Assign("sHtmlDescription", htmlspecialchars($this->sHtmlDescription));
$this->Assign("aHtmlHeadFiles", $this->aHtmlHeadFiles);
$this->Assign("aHtmlRssAlternate", $this->aHtmlRssAlternate);
/**
* Загружаем список активных плагинов
*/
$aPlugins = $this->oEngine->GetPlugins();
$this->Assign("aPluginActive", array_fill_keys(array_keys($aPlugins), true));
/**
* Загружаем пути до шаблонов плагинов
*/
$aTemplateWebPathPlugin = array();
$aTemplatePathPlugin = array();
foreach ($aPlugins as $k => $oPlugin) {
$aTemplateWebPathPlugin[$k] = Plugin::GetTemplateWebPath(get_class($oPlugin));
$aTemplatePathPlugin[$k] = Plugin::GetTemplatePath(get_class($oPlugin));
}
$this->Assign("aTemplateWebPathPlugin", $aTemplateWebPathPlugin);
$this->Assign("aTemplatePathPlugin", $aTemplatePathPlugin);
}
开发者ID:randomtoy,项目名称:livestreet,代码行数:66,代码来源:Viewer.class.php
示例18: preprocessCategory
/**
* Preprocess category
*
* @param integer $date Date
* @param array $column Column data
* @param \XLite\Model\Product $entity Product
*
* @return string
*/
protected function preprocessCategory($date, array $column, \XLite\Model\Product $entity)
{
return $date ? func_htmlspecialchars($date->getName()) : '';
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:Search.php
示例19: printAJAXOutput
/**
* Print AJAX request output
*
* @param mixed $viewer Viewer to display in AJAX
*
* @return void
*/
protected function printAJAXOutput($viewer)
{
$content = $viewer->getContent();
$class = 'ajax-container-loadable' . ' ctrl-' . implode('-', \XLite\Core\Operator::getInstance()->getClassNameAsKeys(get_called_class())) . ' widget-' . implode('-', \XLite\Core\Operator::getInstance()->getClassNameAsKeys($viewer));
echo '<div' . ' class="' . $class . '"' . ' title="' . func_htmlspecialchars(static::t($this->getTitle())) . '">' . $content . '</div>';
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:AController.php
示例20: getContainerAttributesAsString
/**
* Get container attributes as string
*
* @return string
*/
protected function getContainerAttributesAsString()
{
$list = array();
foreach ($this->getContainerAttributes() as $name => $value) {
$list[] = $name . '="' . func_htmlspecialchars($value) . '"';
}
return implode(' ', $list);
}
开发者ID:kewaunited,项目名称:xcart,代码行数:13,代码来源:AModel.php
注:本文中的func_htmlspecialchars函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论