frontier_get_regex

The Pods - Custom Content Types and Fields frontier get regex function.

Description

frontier_get_regex( $codes ); 

Parameters (1)

0. $codes
The codes.

Usage

  1. if ( !function_exists( 'frontier_get_regex' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/components/Templates/includes/functions-view_template.php'; 
  3.  
  4. // The codes. 
  5. $codes = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = frontier_get_regex($codes); 
  9.  

Defined (1)

The function is defined in the following location(s).

/components/Templates/includes/functions-view_template.php  
  1. function frontier_get_regex( $codes ) { 
  2.  
  3. // A custom version of the shortcode regex as to only use podsfrontier codes. 
  4. // this makes it easier to cycle through and get the used codes for inclusion 
  5. $validcodes = join( '|', array_map( 'preg_quote', $codes ) ); 
  6.  
  7. return '\\[' // Opening bracket 
  8. . '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]] 
  9. . "($validcodes)" // 2: selected codes only 
  10. . '\\b' // Word boundary 
  11. . '(' // 3: Unroll the loop: Inside the opening shortcode tag 
  12. . '[^\\]\\/]*' // Not a closing bracket or forward slash 
  13. . '(?:' . '\\/(?!\\])' // A forward slash not followed by a closing bracket 
  14. . '[^\\]\\/]*' // Not a closing bracket or forward slash 
  15. . ')*?' . ')' . '(?:' . '(\\/)' // 4: Self closing tag ... 
  16. . '\\]' // ... and closing bracket 
  17. . '|' . '\\]' // Closing bracket 
  18. . '(?:' . '(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags 
  19. . '[^\\[]*+' // Not an opening bracket 
  20. . '(?:' . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag 
  21. . '[^\\[]*+' // Not an opening bracket 
  22. . ')*+' . ')' . '\\[\\/\\2\\]' // Closing shortcode tag 
  23. . ')?' . ')' . '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]] 
  24.