Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

making OR default logical operator, but allow users to filter it

  • Loading branch information...
commit 1d4983ec47138d4a27663231eb612eab6a600e25 1 parent c982fb7
Rinat Khaziev authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 ad-code-manager.php
View
9 ad-code-manager.php
@@ -42,6 +42,7 @@ class Ad_Code_Manager
var $post_type = 'acm-code';
var $plugin_slug = 'ad-code-manager';
var $post_type_labels ;
+ var $logical_operator;
/**
* Instantiate the plugin
*
@@ -100,7 +101,7 @@ function action_init() {
);
$this->whitelisted_conditionals = apply_filters( 'acm_whitelisted_conditionals', $this->whitelisted_conditionals );
$this->whitelisted_conditionals_titles = apply_filters( 'acm_whitelisted_conditionals_titles', $this->whitelisted_conditionals_titles );
-
+ $this->logical_operator = apply_filters( 'acm_logical_operator', 'OR'); //allow users to filter default logical operator
// Set our default output HTML
// This can be filtered in action_acm_tag()
@@ -520,9 +521,9 @@ function action_acm_tag( $tag_id ) {
if ( $cond_result !== $result )
$include = false;
- // Mimic OR
- // If we have matching conditional just break from the loop and do not try to evaluate others
- if ( $include )
+ //
+ // If we have matching conditional and $this->logical_operator equals OR just break from the loop and do not try to evaluate others
+ if ( $include && $this->logical_operator == 'OR' )
break;
}

2 comments on commit 1d4983e

@danielbachhuber

Does this work with an "AND" too? I don't see code around this...

@rinatkhaziev
Collaborator

Well, every other $this->logical_operator besides "OR" would work as "AND". I guess we'll fix that later

Please sign in to comment.
Something went wrong with that request. Please try again.