Empty Block

Method lintercept

hngts.com :: Funcdown :: Funcdown Manual :: Encapsulators :: Method lintercept


Info
  public function lintercept (string $suspect, string $chars = "T"): string; 

Character interceptor. Escapes desired characters by a single char denotation.
If necessary, not just one letter is accepted. You can combine/join more if needed, eg. 'TA' instead of 'M', etc.

Arguments
  • @suspect - Requires funcdown formatted string.
  • @chars - Optional. Accepts the following characters:

    'T' - Main text. In funcdown, text nodes are wrapped within { and }. In a situations where one is dealing with a lot of preformatted source code of some sort, right curly brace is 'dangerous', therefore it need to be escaped, like this: \}

    'A' - Attributes. Funcdown wraps attributes within parenthesis ( and ) and just like with main text, there are few characters that one must pay attention to. Those are ) and { respectfully, hence this method will take ( and } into account as well.

    'M' - For Microdown strings only (NOT attributes). Escapes | and + respectfully.
    Learn more about Microdown Syntax

    'B' - Just Backticks. Used in microdown mode.
    Good example when there are attributes with nasty values on 2nd tag and not on 1st one.

    'C' - Just commas. Used in combination with char 'A' over attribute values.

Return Value

Returns escaped funcdown string.

Examples
  
  // Handle attribute value with comma .. 
    $keywords = $funcdown-> lintercept ('a,lots,of,keywords,for,some,page,...', 'C');
    $keywords = "M (N keywords,@ {$keywords})|";
      
  // Safe Funcdown string now looks something like this: 
    M (N keywords,@ a\,lots\,of\,keywords\,for\,some\,page\,...)|
    
  // .. and if `parse > release` comes after .. 
    echo $funcdown-> parse ($keywords)-> release(); 

  // .. it will render the following html:
    <meta name="keywords" content="a,lots,of,keywords,for,some,page,...">  
   
  /* 
    Below is literal working piece of production code chopped out from 
    particular foreach loop employing lintercept method, for all the 
    meta tags currently in play on this very whole website, 
    where chars: 'AC' equals to "Attributes" with "Commas",
    and "$suffix" equals to ' !' (force XML decimal encoding).
  */ 
    if (!\is_null ($MetaContent))
      $metaSeo[(":M@N {$name},@ " 
      . $funcdown-> lintercept (
        $MetaContent, 'AC'
      ) . $suffix)] = null;
  
Empty Block
Empty Block
Empty Block
Empty Block