Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F548937
PhutilWordPressAuthAdapter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilWordPressAuthAdapter.php
View Options
<?php
/**
* Authentication adapter for WordPress.com OAuth2.
*/
final
class
PhutilWordPressAuthAdapter
extends
PhutilOAuthAuthAdapter
{
public
function
getAdapterType
()
{
return
'wordpress'
;
}
public
function
getAdapterDomain
()
{
return
'wordpress.com'
;
}
public
function
getAccountID
()
{
return
$this
->
getOAuthAccountData
(
'ID'
);
}
public
function
getAccountEmail
()
{
return
$this
->
getOAuthAccountData
(
'email'
);
}
public
function
getAccountName
()
{
return
$this
->
getOAuthAccountData
(
'username'
);
}
public
function
getAccountImageURI
()
{
return
$this
->
getOAuthAccountData
(
'avatar_URL'
);
}
public
function
getAccountURI
()
{
return
$this
->
getOAuthAccountData
(
'profile_URL'
);
}
public
function
getAccountRealName
()
{
return
$this
->
getOAuthAccountData
(
'display_name'
);
}
protected
function
getAuthenticateBaseURI
()
{
return
'https://public-api.wordpress.com/oauth2/authorize'
;
}
protected
function
getTokenBaseURI
()
{
return
'https://public-api.wordpress.com/oauth2/token'
;
}
public
function
getScope
()
{
return
'user_read'
;
}
public
function
getExtraAuthenticateParameters
()
{
return
array
(
'response_type'
=>
'code'
,
'blog_id'
=>
0
,
);
}
public
function
getExtraTokenParameters
()
{
return
array
(
'grant_type'
=>
'authorization_code'
,
);
}
protected
function
loadOAuthAccountData
()
{
return
id
(
new
PhutilWordPressFuture
())
->
setClientID
(
$this
->
getClientID
())
->
setAccessToken
(
$this
->
getAccessToken
())
->
setRawWordPressQuery
(
'/me/'
)
->
resolve
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:57 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
111549
Default Alt Text
PhutilWordPressAuthAdapter.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment