protected function process_form_data(array $form) {

        $count = count($form); // number of form field values

        if ($count % 2) {
            // we must get five fields per expression
            return false;
        }

        $regexes = array();
        for ($i = 0; $i < $count / 2; $i++) {
            $expressionname  = "expression".$i;
            $valuename       = "value".$i;

            $expression = trim($form['expression'.$i]);
            $value      = trim($form['value'.$i]);

            if (empty($expression)){
                continue;
            }

            $regexes[$value] = $expression;
        }

        $regexes = json_encode($regexes);

        return $regexes;
    }
protected function process_form_data(array $form) {

        $count = count($form); // number of form field values

        if ($count % 2) {
            // we must get five fields per expression
            return false;
        }

        $regexes = array();
        for ($i = 0; $i < $count / 2; $i++) {
            $expressionname  = "expression".$i;
            $valuename       = "value".$i;

            $expression = trim($form['expression'.$i]);
            $value      = trim($form['value'.$i]);

            if (empty($expression)){
                continue;
            }

            $regexes[$value] = $expression;
        }

        $regexes = json_encode($regexes);

        return $regexes;
    }
protected function process_form_data ( array $ form ) { $ count = count ( $ form ) ; // number of form field values if ( $ count % 2 ) { // we must get five fields per expression return false ; } $ regexes = array ( ) ; for ( $ i = 0 ; $ i < $ count / 2 ; $ i ++ ) { $ expressionname = "expression" . $ i ; $ valuename = "value" . $ i ; $ expression = trim ( $ form [ 'expression' . $ i ] ) ; $ value = trim ( $ form [ 'value' . $ i ] ) ; if ( empty ( $ expression ) ) { continue ; } $ regexes [ $ value ] = $ expression ; } $ regexes = json_encode ( $ regexes ) ; return $ regexes ; }
Converts the data from admin settings form into a string of regexes

@see self::prepare_form_data()
@param array $data array of admin form fields and values
@return false|string of regexes
Converts the data from admin settings form into a string of regexes