Pressbooks\Catalog::saveProfile PHP Метод

saveProfile() публичный Метод

Save catalog profile
public saveProfile ( array $item )
$item array
    function saveProfile(array $item)
    {
        // Sanitize
        $item = array_intersect_key($item, $this->profileMetaKeys);
        foreach ($item as $key => $val) {
            if ('pb_catalog_logo' == $key) {
                continue;
                // Skip, dev should use uploadLogo() instead
            }
            if ('pb_catalog_url' == $key && $val) {
                $val = \Pressbooks\Sanitize\canonicalize_url($val);
            }
            if ('%d' == $this->profileMetaKeys[$key]) {
                $val = (int) $val;
            } elseif ('%f' == $this->profileMetaKeys[$key]) {
                $val = (double) $val;
            } else {
                $val = (string) $val;
            }
            update_user_meta($this->userId, $key, $val);
        }
    }