Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894255
PhameBlogSite.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
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
(
)
{
$full_uri
=
$this
->
getBlog
(
)
->
getDomainFullURI
(
)
;
$full_uri
=
new
PhutilURI
(
$full_uri
)
;
return
(
$full_uri
->
getProtocol
(
)
==
'https'
)
;
}
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
)
->
needProfileImage
(
true
)
->
needHeaderImage
(
true
)
->
withStatuses
(
array
(
PhameBlog
::
STATUS_ACTIVE
,
)
)
->
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
new404Controller
(
AphrontRequest
$request
)
{
return
new
PhameBlog404Controller
(
)
;
}
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
Sun, Jan 19, 19:38 (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128052
Default Alt Text
PhameBlogSite.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment