本文整理汇总了PHP中func_htmlspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP func_htmlspecialchars函数的具体用法?PHP func_htmlspecialchars怎么用?PHP func_htmlspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了func_htmlspecialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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());
}
示例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);
}
示例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);
}
示例14: getParamsEscape
/**
* Возвращает экранированный список параметров
*
* @return array
*/
public function getParamsEscape()
{
$aParams = $this->getParams();
func_htmlspecialchars($aParams);
return $aParams;
}
示例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;
}