Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-show-decision
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-show-decision
Merge requests
!1
Feature/init
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Feature/init
feature/init
into
master
Overview
0
Commits
5
Pipelines
1
Changes
17
Merged
Krzysztof Dyszczyk
requested to merge
feature/init
into
master
5 years ago
Overview
0
Commits
5
Pipelines
1
Changes
17
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
5d75f577
5 commits,
5 years ago
17 files
+
616
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
17
src/GetStrategy.php
0 → 100644
+
44
−
0
View file @ 5d75f577
Edit in single-file editor
Open in Web IDE
<?php
namespace
WPDesk\ShowDecision
;
/**
* Show when some conditions with $_GET are meet.
*/
class
GetStrategy
implements
ShouldShowStrategy
{
/**
* @var array
*/
private
$conditions
;
/**
* @param array $conditions Whether to show on the page or not. Array of arrays with condition for _GET.
*
* Inner arrays mean AND, outer arrays mean OR conditions.
*
* ie. [ [ .. and .. and ..] or [ .. and .. and ..] or .. ]
*
*/
public
function
__construct
(
array
$conditions
)
{
$this
->
conditions
=
$conditions
;
}
/**
* @return bool
*/
public
function
shouldDisplay
()
{
foreach
(
$this
->
conditions
as
$or_conditions
)
{
$display
=
true
;
foreach
(
$or_conditions
as
$parameter
=>
$value
)
{
if
(
!
isset
(
$_GET
[
$parameter
]
)
||
$_GET
[
$parameter
]
!==
$value
)
{
$display
=
false
;
}
}
if
(
$display
)
{
return
$display
;
}
}
return
false
;
}
}
Loading