Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_wptexturize_pushpop_element [ WordPress Function ]

_wptexturize_pushpop_element ( $text, $stack, $disabled_elements, $opening = '<', $closing = '>' )
Access:
  • private
Parameters:
  • (string) $text Text to check. First character is assumed to be $opening
  • (array) $stack Array used as stack of opened tag elements
  • (string) $disabled_elements Tags to match against formatted as regexp sub-expression
  • (string) $opening Tag opening character, assumed to be 1 character long
  • (string) $opening Tag closing character
Returns:
  • (object)
Defined at:



Search for disabled element tags. Push element to stack on tag open and pop on tag close. Assumes first character of $text is tag opening.

Source


<?php
function _wptexturize_pushpop_element($text, &$stack$disabled_elements$opening '<'$closing '>') {
    
// Check if it is a closing tag -- otherwise assume opening tag
    
if (strncmp($opening '/'$text2)) {
        
// Opening? Check $text+1 against disabled elements
        
if (preg_match('/^' $disabled_elements '\b/'substr($text1), $matches)) {
            
/*
             * This disables texturize until we find a closing tag of our type
             * (e.g. <pre>) even if there was invalid nesting before that
             *
             * Example: in the case <pre>sadsadasd</code>"baba"</pre>
             *          "baba" won't be texturize
             */

            
array_push($stack$matches[1]);
        }
    } else {
        
// Closing? Check $text+2 against disabled elements
        
$c preg_quote($closing'/');
        if (
preg_match('/^' $disabled_elements $c '/'substr($text2), $matches)) {
            
$last array_pop($stack);

            
// Make sure it matches the opening tag
            
if ($last != $matches[1])
                
array_push($stack$last);
        }
    }
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics