Пример #1
0
 /**
  * If there are images in the step, replace them with placeholders and
  * return the modified text.
  */
 public static function cutImages($stepText)
 {
     $tokens = array();
     $output = preg_replace_callback('@\\[\\[Image:[^\\]]*\\]\\]@i', function ($m) use(&$tokens) {
         $token = 'IMG_' . Wikitext::genRandomString();
         $tokens[] = array('token' => $token, 'tag' => $m[0]);
         return $token;
     }, $stepText);
     return array($output, $tokens);
 }