예제 #1
0
 public static function maybe_strip_md_indents($string)
 {
     if (!ezphp::$strip_md_indents) {
         return $string;
     }
     // Not applicable.
     if (!($string = (string) $string)) {
         return $string;
     }
     // Empty.
     if (strpos($string, '    ') === FALSE && strpos($string, "\t") === FALSE) {
         return $string;
     }
     // Nothing to strip.
     $spcsm = ezphp::spcsm_tokens($string, array('shortcodes', 'pre', 'md_fences'), __FUNCTION__);
     $spcsm['string'] = preg_replace('/^(?: {4,}|' . "\t" . '+)/m', '', $spcsm['string']);
     $string = ezphp::spcsm_restore($spcsm);
     return $string;
     // All done.
 }