Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97409339
PhameBlogSite.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 4, 09:16
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 6, 09:16 (2 d)
Engine
blob
Format
Raw Data
Handle
23404373
Attached To
rPH Phabricator
PhameBlogSite.php
View Options
<?php
final
class
PhameBlogSite
extends
PhameSite
{
private
$blog
;
public
function
setBlog
(
PhameBlog
$blog
)
{
$this
->
blog
=
$blog
;
return
$this
;
}
public
function
getBlog
()
{
return
$this
->
blog
;
}
public
function
getDescription
()
{
return
pht
(
'Serves blogs with custom domains.'
);
}
public
function
shouldRequireHTTPS
()
{
// TODO: We should probably provide options here eventually, but for now
// just never require HTTPS for external-domain blogs.
return
false
;
}
public
function
getPriority
()
{
return
3000
;
}
public
function
newSiteForRequest
(
AphrontRequest
$request
)
{
if
(!
$this
->
isPhameActive
())
{
return
null
;
}
$host
=
$request
->
getHost
();
try
{
$blog
=
id
(
new
PhameBlogQuery
())
->
setViewer
(
new
PhabricatorUser
())
->
withDomain
(
$host
)
->
executeOne
();
}
catch
(
PhabricatorPolicyException
$ex
)
{
throw
new
Exception
(
pht
(
'This blog is not visible to logged out users, so it can not be '
.
'visited from a custom domain.'
));
}
if
(!
$blog
)
{
return
null
;
}
return
id
(
new
PhameBlogSite
())->
setBlog
(
$blog
);
}
public
function
getRoutingMaps
()
{
$app
=
PhabricatorApplication
::
getByClass
(
'PhabricatorPhameApplication'
);
$maps
=
array
();
$maps
[]
=
$this
->
newRoutingMap
()
->
setApplication
(
$app
)
->
setRoutes
(
$app
->
getBlogRoutes
());
return
$maps
;
}
}
Event Timeline
Log In to Comment