Advertisement
arsh999cg

Condition Oxygen URL Parameter Elijah

Jan 25th, 2023
754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1. <?php
  2. add_action('plugins_loaded', 'condition_url_param_exist_elijah', 99);
  3.  
  4. function condition_url_param_exist_elijah(){
  5.     if( function_exists('oxygen_vsb_register_condition') ) {
  6.  
  7.         global $oxy_condition_operators;
  8.  
  9.         // Condition to check if a URL parameter is present.
  10.         oxygen_vsb_register_condition('URL Param Exists', array('options'=>array(), 'custom'=>true), array('--'), 'oxy_url_param_exists_callback', 'Other');
  11.  
  12.         function oxy_url_param_exists_callback($value, $operator) {
  13.             if( isset($_GET[$value]) && $_GET[$value] ) {
  14.                 return true;
  15.             } else {
  16.                 return false;
  17.             }
  18.         }
  19.  
  20.         // Condition to check if a URL parameter is NOT present.
  21.         oxygen_vsb_register_condition('URL Param Does Not Exist', array('options'=>array(), 'custom'=>true), array('--'), 'oxy_url_param_not_exists_callback', 'Other');
  22.  
  23.         function oxy_url_param_not_exists_callback($value, $operator) {
  24.         if( isset($_GET[$value]) && $_GET[$value] ) {
  25.                 return false;
  26.             } else {
  27.                 return true;
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement