本文整理汇总了PHP中ElggUser::toObject方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggUser::toObject方法的具体用法?PHP ElggUser::toObject怎么用?PHP ElggUser::toObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggUser
的用法示例。
在下文中一共展示了ElggUser::toObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: csv_exporter_get_exportable_values
/**
* Get a list of all the exportable values for the given type/subtype
*
* @param string $type the entity type
* @param string $subtype the entity subtype
* @param bool $readable readable values or just for processing (default: false)
*
* @return array
*/
function csv_exporter_get_exportable_values($type, $subtype = '', $readable = false)
{
$result = [];
if (empty($type)) {
return $result;
}
if ($type == 'object' && empty($subtype)) {
return $result;
}
$class = get_subtype_class($type, $subtype);
if (!empty($class)) {
$dummy = new $class();
} else {
switch ($type) {
case 'object':
$dummy = new ElggObject();
break;
case 'group':
$dummy = new ElggGroup();
break;
case 'site':
$dummy = new ElggSite();
break;
case 'user':
$dummy = new ElggUser();
break;
}
}
$exports = (array) $dummy->toObject();
$defaults = array_keys($exports);
if ($readable) {
$new_defaults = [];
foreach ($defaults as $name) {
if (elgg_language_key_exists($name)) {
$lan = elgg_echo($name);
} elseif (elgg_language_key_exists("csv_exporter:exportable_value:{$name}")) {
$lan = elgg_echo("csv_exporter:exportable_value:{$name}");
} else {
$lan = $name;
}
$new_defaults[$lan] = $name;
}
$defaults = $new_defaults;
}
$params = ['type' => $type, 'subtype' => $subtype, 'readable' => $readable, 'defaults' => $defaults];
$result = elgg_trigger_plugin_hook('get_exportable_values', 'csv_exporter', $params, $defaults);
if (is_array($result)) {
// prevent duplications
$result = array_unique($result);
}
return $result;
}