本文整理汇总了PHP中um_is_temp_upload函数的典型用法代码示例。如果您正苦于以下问题:PHP um_is_temp_upload函数的具体用法?PHP um_is_temp_upload怎么用?PHP um_is_temp_upload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了um_is_temp_upload函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: um_user_edit_profile
function um_user_edit_profile($args)
{
global $ultimatemember;
$to_update = null;
$files = null;
if (isset($args['user_id'])) {
if (um_current_user_can('edit', $args['user_id'])) {
$ultimatemember->user->set($args['user_id']);
} else {
wp_die(__('You are not allowed to edit this user.', 'ultimatemember'));
}
} else {
if (isset($args['_user_id'])) {
$ultimatemember->user->set($args['_user_id']);
}
}
$userinfo = $ultimatemember->user->profile;
$fields = unserialize($args['custom_fields']);
do_action('um_user_before_updating_profile', $userinfo);
// loop through fields
foreach ($fields as $key => $array) {
if ($fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key])) {
delete_user_meta(um_user('ID'), $key);
}
if (isset($args['submitted'][$key])) {
if (isset($fields[$key]['type']) && in_array($fields[$key]['type'], array('image', 'file')) && um_is_temp_upload($args['submitted'][$key])) {
$files[$key] = $args['submitted'][$key];
} else {
if (isset($userinfo[$key]) && $args['submitted'][$key] != $userinfo[$key]) {
$to_update[$key] = $args['submitted'][$key];
} else {
if ($args['submitted'][$key]) {
$to_update[$key] = $args['submitted'][$key];
}
}
}
}
}
if (isset($args['submitted']['description'])) {
$to_update['description'] = $args['submitted']['description'];
}
if (isset($args['submitted']['role']) && !empty($args['submitted']['role'])) {
$to_update['role'] = $args['submitted']['role'];
}
do_action('um_user_pre_updating_profile', $to_update);
$to_update = apply_filters('um_user_pre_updating_profile_array', $to_update);
if (is_array($to_update)) {
$ultimatemember->user->update_profile($to_update);
}
if (is_array($files)) {
$ultimatemember->user->update_files($files);
}
do_action('um_after_user_updated', um_user('ID'));
do_action('um_after_user_upload', um_user('ID'));
do_action('um_user_after_updating_profile', $to_update);
if (!isset($args['is_signup'])) {
exit(wp_redirect(um_edit_my_profile_cancel_uri()));
}
}
示例2: delete_file
function delete_file($src)
{
if (strstr($src, '?')) {
$splitted = explode('?', $src);
$src = $splitted[0];
}
$is_temp = um_is_temp_upload($src);
if ($is_temp) {
unlink($is_temp);
rmdir(dirname($is_temp));
} else {
die('Not a valid temp file');
}
}
示例3: update_files
function update_files($changes)
{
global $ultimatemember;
foreach ($changes as $key => $uri) {
$src = um_is_temp_upload($uri);
$ultimatemember->files->new_user_upload($this->id, $src, $key);
}
}
示例4: delete_file
function delete_file($src)
{
if (strstr($src, '?')) {
$splitted = explode('?', $src);
$src = $splitted[0];
}
$is_temp = um_is_temp_upload($src);
if ($is_temp) {
unlink($is_temp);
rmdir(dirname($is_temp));
} else {
wp_die(__('Ultimate Member: Not a valid temp file', 'ultimatemember'));
}
}