File "acf-user-functions.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/advanced-custom-fields/includes/acf-user-functions.php
File size: 1.18 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

function acf_get_users($args = array())
{
    $users = get_users($args);
    if ($users && $args['include']) {
        $order = array();
        foreach ($users as $i => $user) {
            $order[$i] = array_search($user->ID, $args['include']);
        }
        array_multisort($order, $users);
    }
    return $users;
}
function acf_get_user_result($user)
{
    $id = $user->ID;
    $text = $user->user_login;
    if ($user->first_name && $user->last_name) {
        $text .= " ({$user->first_name} {$user->last_name})";
    } elseif ($user->first_name) {
        $text .= " ({$user->first_name})";
    }
    return compact('id', 'text');
}
function acf_get_user_role_labels($roles = array())
{
    $all_roles = wp_roles()->get_names();
    if (empty($roles)) {
        $roles = array_keys($all_roles);
    }
    $lables = array();
    foreach ($roles as $role) {
        if (isset($all_roles[$role])) {
            $lables[$role] = translate_user_role($all_roles[$role]);
        }
    }
    return $lables;
}
function acf_allow_unfiltered_html()
{
    $allow_unfiltered_html = current_user_can('unfiltered_html');
    return apply_filters('acf/allow_unfiltered_html', $allow_unfiltered_html);
}