public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function wpua_storage_notices()
 {
     global $avatar_storage_option;
     $error = '';
     if (empty($avatar_storage_option)) {
         $error = __('Avatar directory is required', 'wp-user-avatar-pro');
     } else {
         $storage = new Wpua_Avatar_Storage();
         $resp = $storage->Factory($avatar_storage_option, true);
         if (is_wp_error($resp)) {
             $error = $resp->get_error_message();
         }
     }
     if (!empty($error)) {
         echo '<div class="messages error"><p>' . $error . '</p></div>';
     }
 }
Beispiel #3
0
function wpua_avatar_upload($file_name, $filepath, $user_id = 0)
{
    $avatar_storage = new Wpua_Avatar_Storage();
    $storage_load = $avatar_storage->Factory();
    if ($user_id == 0 || $user_id == false) {
        $user_id = get_current_user_id();
    }
    if (!is_wp_error($storage_load)) {
        $storage_load->user_id = $user_id;
        $file = array('name' => $file_name, 'path' => $filepath);
        return $avatar_storage->wpua_avatar_upload((object) $file);
    }
    $avatar_storage->delete_temp_file($filepath);
}