Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121687386
PhragmentController.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
Sun, Jul 13, 04:18
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jul 15, 04:18 (2 d)
Engine
blob
Format
Raw Data
Handle
27374386
Attached To
rPH Phabricator
PhragmentController.php
View Options
<?php
abstract
class
PhragmentController
extends
PhabricatorController
{
protected
function
loadParentFragments
(
$path
)
{
$components
=
explode
(
'/'
,
$path
);
$combinations
=
array
();
$current
=
''
;
foreach
(
$components
as
$component
)
{
$current
.=
'/'
.
$component
;
$current
=
trim
(
$current
,
'/'
);
if
(
trim
(
$current
)
===
''
)
{
continue
;
}
$combinations
[]
=
$current
;
}
$fragments
=
array
();
$results
=
id
(
new
PhragmentFragmentQuery
())
->
setViewer
(
$this
->
getRequest
()->
getUser
())
->
withPaths
(
$combinations
)
->
execute
();
foreach
(
$combinations
as
$combination
)
{
$found
=
false
;
foreach
(
$results
as
$fragment
)
{
if
(
$fragment
->
getPath
()
===
$combination
)
{
$fragments
[]
=
$fragment
;
$found
=
true
;
break
;
}
}
if
(!
$found
)
{
return
null
;
}
}
return
$fragments
;
}
protected
function
buildApplicationCrumbsWithPath
(
array
$fragments
)
{
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addCrumb
(
id
(
new
PhabricatorCrumbView
())
->
setName
(
'/'
)
->
setHref
(
'/phragment/'
));
foreach
(
$fragments
as
$parent
)
{
$crumbs
->
addCrumb
(
id
(
new
PhabricatorCrumbView
())
->
setName
(
$parent
->
getName
())
->
setHref
(
'/phragment/browse/'
.
$parent
->
getPath
()));
}
return
$crumbs
;
}
}
Event Timeline
Log In to Comment