Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F972927
PhameBlogSite.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
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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Jun 18, 6:29 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
225094
Default Alt Text
PhameBlogSite.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment