Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 1d4983ec47138d4a27663231eb612eab6a600e25 1 parent c982fb7
Rinat Khaziev authored

Showing 1 changed file with 5 additions and 4 deletions. Show diff stats Hide diff stats

  1. +5 4 ad-code-manager.php
9 ad-code-manager.php
@@ -42,6 +42,7 @@ class Ad_Code_Manager
42 42 var $post_type = 'acm-code';
43 43 var $plugin_slug = 'ad-code-manager';
44 44 var $post_type_labels ;
  45 + var $logical_operator;
45 46 /**
46 47 * Instantiate the plugin
47 48 *
@@ -100,7 +101,7 @@ function action_init() {
100 101 );
101 102 $this->whitelisted_conditionals = apply_filters( 'acm_whitelisted_conditionals', $this->whitelisted_conditionals );
102 103 $this->whitelisted_conditionals_titles = apply_filters( 'acm_whitelisted_conditionals_titles', $this->whitelisted_conditionals_titles );
103   -
  104 + $this->logical_operator = apply_filters( 'acm_logical_operator', 'OR'); //allow users to filter default logical operator
104 105
105 106 // Set our default output HTML
106 107 // This can be filtered in action_acm_tag()
@@ -520,9 +521,9 @@ function action_acm_tag( $tag_id ) {
520 521 if ( $cond_result !== $result )
521 522 $include = false;
522 523
523   - // Mimic OR
524   - // If we have matching conditional just break from the loop and do not try to evaluate others
525   - if ( $include )
  524 + //
  525 + // If we have matching conditional and $this->logical_operator equals OR just break from the loop and do not try to evaluate others
  526 + if ( $include && $this->logical_operator == 'OR' )
526 527 break;
527 528
528 529 }

2 comments on commit 1d4983e

Daniel Bachhuber
Collaborator

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

Rinat K
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.