src/xPDO/Om/xPDOObject.php
public function encode($source, $type= 'md5') {
        if (!is_string($source) || empty ($source)) {
            $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'xPDOObject::encode() -- Attempt to encode source data that is not a string (or is empty); encoding skipped.');
            return $source;
        }
        switch ($type) {
            case 'password':
            case 'md5':
                $encoded= md5($source);
                break;
            default :
                $encoded= $source;
                $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOObject::encode() -- Attempt to encode source data using an unsupported encoding algorithm ({$type}).");
                break;
        }
        return $encoded;
    }
public function encode($source, $type= 'md5') {
        if (!is_string($source) || empty ($source)) {
            $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'xPDOObject::encode() -- Attempt to encode source data that is not a string (or is empty); encoding skipped.');
            return $source;
        }
        switch ($type) {
            case 'password':
            case 'md5':
                $encoded= md5($source);
                break;
            default :
                $encoded= $source;
                $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "xPDOObject::encode() -- Attempt to encode source data using an unsupported encoding algorithm ({$type}).");
                break;
        }
        return $encoded;
    }
public function encode ( $ source , $ type = 'md5' ) { if ( ! is_string ( $ source ) || empty ( $ source ) ) { $ this -> xpdo -> log ( xPDO :: LOG_LEVEL_ERROR , 'xPDOObject::encode() -- Attempt to encode source data that is not a string (or is empty); encoding skipped.' ) ; return $ source ; } switch ( $ type ) { case 'password' : case 'md5' : $ encoded = md5 ( $ source ) ; break ; default : $ encoded = $ source ; $ this -> xpdo -> log ( xPDO :: LOG_LEVEL_ERROR , "xPDOObject::encode() -- Attempt to encode source data using an unsupported encoding algorithm ({$type})." ) ; break ; } return $ encoded ; }
Encodes a string using the specified algorithm.

NOTE: This implementation currently only implements md5.  To implement additional
algorithms, override this function in your xPDOObject derivative classes.

@param string $source The string source to encode.
@param string $type The type of encoding algorithm to apply, md5 by default.
@return string The encoded string.
Encodes a string using the specified algorithm .