本文整理匯總了PHP中xPDOSimpleObject::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP xPDOSimpleObject::toArray方法的具體用法?PHP xPDOSimpleObject::toArray怎麽用?PHP xPDOSimpleObject::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xPDOSimpleObject
的用法示例。
在下文中一共展示了xPDOSimpleObject::toArray方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: toArray
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
if (!empty($this->xpdo->lexicon) && $this->xpdo->lexicon instanceof modLexicon) {
if ($this->get('lexicon') != 'core:dashboards') {
$this->xpdo->lexicon->load($this->get('lexicon'));
}
$array['name_trans'] = $this->xpdo->lexicon->exists($this->get('name')) ? $this->xpdo->lexicon($this->get('name')) : $this->get('name');
$array['description_trans'] = $this->xpdo->lexicon->exists($this->get('description')) ? $this->xpdo->lexicon($this->get('description')) : $this->get('description');
}
return $array;
}
示例2: toArray
/**
* {inheritdoc}
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$arr = parent::toArray($keyPrefix, $rawValues, $excludeLazy, $includeRelated);
// figure out the icon
$icon = $this->getIcon();
if (!empty($icon) && is_array($icon)) {
switch ($icon['type']) {
case 'custom':
$arr['iconcls'] = '';
$arr['iconpath'] = $icon['value'];
break;
case 'preset':
default:
$arr['iconcls'] = $icon['value'];
$arr['iconpath'] = '';
break;
}
}
return $arr;
}
示例3: toArray
/**
* Override toArray to provide more values
*
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$values = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
if ($this->xpdo->context->key != 'mgr' && $this->xpdo->discuss) {
$values['url'] = $this->getUrl();
}
return $values;
}
示例4: toArray
/**
* Override toArray to provide more values
*
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$values = parent::toArray($keyPrefix, $rawValues, $excludeLazy, $includeRelated);
$values[$keyPrefix . 'age'] = $this->get('age');
$values[$keyPrefix . 'gender_formatted'] = $this->get('gender_formatted');
$values[$keyPrefix . 'avatarUrl'] = $this->getAvatarUrl();
$values[$keyPrefix . 'isSelf'] = $this->xpdo->user->get('id') == $this->get('user');
$values[$keyPrefix . 'canEdit'] = $values[$keyPrefix . 'isSelf'];
$values[$keyPrefix . 'canAccount'] = $values[$keyPrefix . 'isSelf'];
$values[$keyPrefix . 'canMerge'] = $values[$keyPrefix . 'isSelf'];
$values[$keyPrefix . 'name'] = $this->get('name');
$values[$keyPrefix . 'posts_formatted'] = $this->get('posts_formatted');
return $values;
}
示例5: toArray
/**
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
foreach ($array as $k => &$v) {
if ($k == 'title') {
$v = strip_tags($v, '<span>');
$v = preg_replace('@\\[\\[(.[^\\[\\[]*?)\\]\\]@si', '', $v);
$v = html_entity_decode($v, ENT_COMPAT, 'UTF-8');
}
}
reset($array);
return $array;
}
示例6: toArray
/**
* Always ensure that the title strips any HTML/MODX tags
* @param string $keyPrefix
* @param bool $rawValues
* @param bool $excludeLazy
* @param bool $includeRelated
* @return array
*/
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy);
foreach ($array as $k => &$v) {
if ($k == 'title') {
$v = $this->xpdo->discuss->stripAllTags($v);
}
}
reset($array);
return $array;
}
示例7: toArray
public function toArray($keyPrefix = '', $rawValues = false, $excludeLazy = false, $includeRelated = false)
{
$array = parent::toArray($keyPrefix, $rawValues, $excludeLazy, $includeRelated);
$array['badge'] = $this->getBadge();
return $array;
}