本文整理汇总了PHP中X2Html::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP X2Html::encode方法的具体用法?PHP X2Html::encode怎么用?PHP X2Html::encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X2Html
的用法示例。
在下文中一共展示了X2Html::encode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrlLink
/**
* Generates a link to the view of the object.
*
* @return string a link to the model
*/
public function getUrlLink($htmlOptions = array())
{
$name = $this->owner->hasAttribute('name') || $this->owner->canGetProperty('name') || property_exists($this->owner, 'name') ? $this->owner->name : '';
if (trim($name) == '') {
if ($this->owner->hasAttribute('fileName')) {
// for media models
$name = $this->owner->fileName;
}
if (trim($name) == '') {
$name = $this->owner->hasAttribute('id') ? '#' . $this->owner->id : '';
}
}
$url = $this->url;
if ($this->owner instanceof Contacts) {
return CHtml::link('<span>' . X2Html::encode($name) . '</span>', $url, array_merge(array('class' => 'contact-name'), $htmlOptions));
} else {
return CHtml::link('<span>' . X2Html::encode($name) . '</span>', $url, $htmlOptions);
}
}
示例2: getUrlLink
/**
* Generates a link to the view of the object.
*
* @return string a link to the model
*/
public function getUrlLink($htmlOptions = array())
{
if (Yii::app()->params->isMobileApp && !self::isMobileLinkableRecordType(get_class($this->owner))) {
return $this->owner->renderAttribute('name');
}
$name = $this->owner->hasAttribute('name') || $this->owner->canGetProperty('name') || property_exists($this->owner, 'name') ? $this->owner->name : '';
if (trim($name) == '') {
if ($this->owner->hasAttribute('fileName')) {
// for media models
$name = $this->owner->fileName;
}
if (trim($name) == '') {
$name = $this->owner->hasAttribute('id') ? '#' . $this->owner->id : '';
}
}
$url = $this->url;
if ($this->owner instanceof Contacts) {
return CHtml::link('<span>' . X2Html::encode($name) . '</span>', $url, array_merge(array('class' => 'contact-name'), $htmlOptions));
} else {
return CHtml::link('<span>' . X2Html::encode($name) . '</span>', $url, $htmlOptions);
}
}