Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F426326
PhragmentController.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
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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 2:13 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
58307
Default Alt Text
PhragmentController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment