Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
b0bce37c
Commit
b0bce37c
authored
Dec 03, 2014
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor navigation selected items code
parent
802f6879
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
qa-page.php
qa-include/qa-page.php
+21
-11
No files found.
qa-include/qa-page.php
View file @
b0bce37c
...
...
@@ -236,22 +236,32 @@
global
$qa_template
;
$requestlower
=
strtolower
(
qa_request
());
$requestlower
=
strtolower
(
qa_request
());
// Set appropriate selected flags for navigation (not done in qa_content_prepare() since it also applies to sub-navigation)
foreach
(
$qa_content
[
'navigation'
]
as
$navtype
=>
$navigation
)
if
(
is_array
(
$navigation
)
&&
(
$navtype
!=
'cat'
))
foreach
(
$navigation
as
$navprefix
=>
$navlink
)
{
if
(
isset
(
$navlink
[
'selectpaths'
]))
{
foreach
(
$navlink
[
'selectpaths'
]
as
$path
)
{
if
(
strpos
(
$requestlower
.
'$'
,
$path
)
===
0
)
$qa_content
[
'navigation'
][
$navtype
][
$navprefix
][
'selected'
]
=
true
;
}
foreach
(
$qa_content
[
'navigation'
]
as
$navtype
=>
$navigation
)
{
if
(
!
is_array
(
$navigation
)
||
$navtype
==
'cat'
)
{
continue
;
}
foreach
(
$navigation
as
$navprefix
=>
$navlink
)
{
$sel
=
false
;
if
(
isset
(
$navlink
[
'selectpaths'
]))
{
// match specified paths
foreach
(
$navlink
[
'selectpaths'
]
as
$path
)
{
if
(
strpos
(
$requestlower
.
'$'
,
$path
)
===
0
)
$sel
=
true
;
}
elseif
(
$requestlower
===
$navprefix
||
$requestlower
.
'$'
===
$navprefix
)
$qa_content
[
'navigation'
][
$navtype
][
$navprefix
][
'selected'
]
=
true
;
}
elseif
(
$requestlower
===
$navprefix
||
$requestlower
.
'$'
===
$navprefix
)
{
// exact match for array key
$sel
=
true
;
}
$qa_content
[
'navigation'
][
$navtype
][
$navprefix
][
'selected'
]
=
$sel
;
}
}
// Slide down notifications
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment