roundcubemail/plugins/managesieve/lib/Roundcube/rcube_sieve.php
private function _parse($txt)
    {
        // parse
        $script = new rcube_sieve_script($txt, $this->exts);

        // fix/convert to Roundcube format
        if (!empty($script->content)) {
            // replace all elsif with if+stop, we support only ifs
            foreach ($script->content as $idx => $rule) {
                if (empty($rule['type']) || !preg_match('/^(if|elsif|else)$/', $rule['type'])) {
                    continue;
                }

                $script->content[$idx]['type'] = 'if';

                // 'stop' not found?
                foreach ($rule['actions'] as $action) {
                    if (preg_match('/^(stop|vacation)$/', $action['type'])) {
                        continue 2;
                    }
                }
                if (!empty($script->content[$idx+1]) && $script->content[$idx+1]['type'] != 'if') {
                    $script->content[$idx]['actions'][] = array('type' => 'stop');
                }
            }
        }

        return $script;
    }
private function _parse($txt)
    {
        // parse
        $script = new rcube_sieve_script($txt, $this->exts);

        // fix/convert to Roundcube format
        if (!empty($script->content)) {
            // replace all elsif with if+stop, we support only ifs
            foreach ($script->content as $idx => $rule) {
                if (empty($rule['type']) || !preg_match('/^(if|elsif|else)$/', $rule['type'])) {
                    continue;
                }

                $script->content[$idx]['type'] = 'if';

                // 'stop' not found?
                foreach ($rule['actions'] as $action) {
                    if (preg_match('/^(stop|vacation)$/', $action['type'])) {
                        continue 2;
                    }
                }
                if (!empty($script->content[$idx+1]) && $script->content[$idx+1]['type'] != 'if') {
                    $script->content[$idx]['actions'][] = array('type' => 'stop');
                }
            }
        }

        return $script;
    }
private function _parse ( $ txt ) { // parse $ script = new rcube_sieve_script ( $ txt , $ this -> exts ) ; // fix/convert to Roundcube format if ( ! empty ( $ script -> content ) ) { // replace all elsif with if+stop, we support only ifs foreach ( $ script -> content as $ idx => $ rule ) { if ( empty ( $ rule [ 'type' ] ) || ! preg_match ( '/^(if|elsif|else)$/' , $ rule [ 'type' ] ) ) { continue ; } $ script -> content [ $ idx ] [ 'type' ] = 'if' ; // 'stop' not found? foreach ( $ rule [ 'actions' ] as $ action ) { if ( preg_match ( '/^(stop|vacation)$/' , $ action [ 'type' ] ) ) { continue 2 ; } } if ( ! empty ( $ script -> content [ $ idx + 1 ] ) && $ script -> content [ $ idx + 1 ] [ 'type' ] != 'if' ) { $ script -> content [ $ idx ] [ 'actions' ] [ ] = array ( 'type' => 'stop' ) ; } } } return $ script ; }
Creates rcube_sieve_script object from text script
Creates rcube_sieve_script object from text script