Пример #1
0
     preg_match($pattern_name, $match, $matches_name);
     if (!in_array($matches_name[2], $skippedarray)) {
         $pattern_textarea2 = '/(<textarea(.*?)>)(.*?)(<\\/textarea>)/is';
         $newtextarea_match = preg_replace($pattern_textarea2, '${1}<?php echo $post[\'' . $matches_name[2] . '\']; ?>${4}', $match);
         $MyForm->formrow->html = str_replace($match, $newtextarea_match, $MyForm->formrow->html);
     }
 }
 //select boxes
 $pattern_select = '/<select(.*?)select>/is';
 $matches = array();
 preg_match_all($pattern_select, $MyForm->formrow->html, $matches);
 foreach ($matches[0] as $match) {
     $selectmatch = $match;
     $pattern_select2 = '/<select([^>]*?)>/is';
     preg_match_all($pattern_select2, $match, $matches2);
     $options = preg_replace(array('/' . CFChronoForm::cfskipregex($matches2[0][0]) . '/is', '/<\\/select>/i'), array('', ''), $match);
     $pattern_name = '/name=("|\')(.*?)("|\')/i';
     preg_match($pattern_name, $matches2[0][0], $matches_name);
     if (!in_array(str_replace('[]', '', $matches_name[2]), $skippedarray)) {
         //multi select
         if (strpos($matches_name[2], '[]')) {
             $pattern_options = '/<option(.*?)<\\/option>/is';
             preg_match_all($pattern_options, $options, $matches_options);
             foreach ($matches_options[0] as $matches_option) {
                 $pattern_value = '/value=("|\')(.*?)("|\')/i';
                 preg_match($pattern_value, $matches_option, $matches_value);
                 $optionmatch = preg_replace('/<option/i', '<option <?php if(in_array("' . $matches_value[2] . '", explode(", ", $post["' . str_replace('[]', '', $matches_name[2]) . '"])))echo \'selected="selected"\'; ?>', $matches_option);
                 $selectmatch = str_replace($matches_option, $optionmatch, $selectmatch);
             }
             //single select
         } else {