<commit_before><?php
/**
 * Wizin framework utility class
 *
 * PHP Versions 4
 *
 * @package  Wizin
 * @author  <NAME> a.k.a. gusagi<<EMAIL>>
 * @copyright 2008 <NAME>
 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
 *
 */

if ( ! class_exists('Wizin_Util') ) {
    require dirname( __FILE__ ) . '/Wizin.class.php';

    /**
     * Wizin framework utility class
     *
     * @access public
     *
     */
    class Wizin_Util
    {
        /**
         * return string for something prefix
         *
         * @param string $salt
         * @return string $prefix
         */
        function getPrefix( $salt = '' )
        {
            static $prefix;
            if ( ! isset($prefix) ) {
                if ( empty($salt) ) {
                    $salt = getenv( 'SERVER_NAME' );
                }
                $hostSalt = getenv( 'SERVER_NAME' );
                $replaceArray = array( '/' => '%', '.' => '%%' );
                $prefix = strtr( $hostSalt, $replaceArray ) . '_' . Wizin_Util::cipher( $salt );
            }
            return $prefix;
        }

        /**
         * call user function with reference args
         *
         * @param string $function
         * @param array $args
         */
        function callUserFuncArrayReference( $function, $args = array() )
        {
            $result = null;
            $process = null;
            $param = array();
            if ( is_array($args) ) {
                for ( $index = 0; $index < count($args); $index ++ ) {
                    $param[] =& $args[$index];
                }
            }
            call_user_func_array( $function, $param );
        }

        /**
         * define constant
         *<commit_msg>Changed function name from 'getPrefix' to 'salt'.<commit_after><?php
/**
 * Wizin framework utility class
 *
 * PHP Versions 4
 *
 * @package  Wizin
 * @author  <NAME> a.k.a. gusagi<<EMAIL>>
 * @copyright 2008 <NAME>
 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
 *
 */

if ( ! class_exists('Wizin_Util') ) {
    require dirname( __FILE__ ) . '/Wizin.class.php';

    /**
     * Wizin framework utility class
     *
     * @access public
     *
     */
    class Wizin_Util
    {
        /**
         * return string for something salt
         *
         * @param string $salt
         * @return string $prefix
         */
        function salt( $seed = '' )
        {
            static $salt;
            if ( ! isset($salt) ) {
                if ( empty($seed) ) {
                    $salt = getenv( 'SERVER_NAME' );
                }
                $hostSeed = getenv( 'SERVER_NAME' );
                $replaceArray = array( '/' => '%', '.' => '%%' );
                $salt = strtr( $hostSeed, $replaceArray ) . '_' . Wizin_Util::cipher( $seed );
            }
            return $salt;
        }

        /**
         * call user function with reference args
         *
         * @param string $function
         * @param array $args
         */
        function callUserFuncArrayReference( $function, $args = array() )
        {
            $result = null;
            $process = null;
            $param = array();
            if ( is_array($args) ) {
                for ( $index = 0; $index < count($args); $index ++ ) {
                    $param[] =& $args[$index];
                }
            }
            call_user_func_array( $function, $param );
        }

        /**
         * define constant
         *
{'fraction_non_alphanumeric': 0.14016557236654295, 'fraction_numerical': 0.0034256351698544107, 'mean_word_length': 1.3643724696356276, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1760015', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1002, 'n_words': 226}