<commit_before><?php

class Settings extends \Singleton
{
    protected function __construct()
    {
        if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC']))
        {
            require $GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php';
            return;
        }
        if(is_readable('/var/www/secure_settings/class.FlipsideSettings.php'))
        {
            require '/var/www/secure_settings/class.FlipsideSettings.php';
            return;
        }
    }

    public function getClassesByPropName($propName)
    {
        $ret = array();
        if(isset(FlipsideSettings::$$propName))
        {
            $prop = FlipsideSettings::$$propName;
            $keys = array_keys($prop);
            $count = count($keys);
            for($i = 0; $i < $count; $i++)
            {
                $class = $keys[$i];
                array_push($ret, new $class($prop[$keys[$i]]));
            }
        }
        return $ret;
    }

    public function getDataSetData($dataSetName)
    {
        if(!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$dataSetName]))
        {
            return false;
        }
        return FlipsideSettings::$dataset[$dataSetName];
    }

    public function getGlobalSetting($propName, $default = false)
    {
        if(isset(FlipsideSettings::$global) && FlipsideSettings::$global[$propName])
        {
            return FlipsideSettings::$global[$propName];
        }
        return $default;
    }

    public function getSiteLinks()
    {
        if(isset(FlipsideSettings::$sites))
        {
            return FlipsideSettings::$sites;
        }
        return array();
    }

    private function getLDAPHost($default)
    {
        if(!isset(FlipsideSettings::$ldap) || !isset(FlipsideSettings::$ldap['host']))
        {
            return $default;
        }<commit_msg>allow setting globals to false<commit_after><?php

class Settings extends \Singleton
{
    protected function __construct()
    {
        if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC']))
        {
            require $GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php';
            return;
        }
        if(is_readable('/var/www/secure_settings/class.FlipsideSettings.php'))
        {
            require '/var/www/secure_settings/class.FlipsideSettings.php';
            return;
        }
    }

    public function getClassesByPropName($propName)
    {
        $ret = array();
        if(isset(FlipsideSettings::$$propName))
        {
            $prop = FlipsideSettings::$$propName;
            $keys = array_keys($prop);
            $count = count($keys);
            for($i = 0; $i < $count; $i++)
            {
                $class = $keys[$i];
                array_push($ret, new $class($prop[$keys[$i]]));
            }
        }
        return $ret;
    }

    public function getDataSetData($dataSetName)
    {
        if(!isset(FlipsideSettings::$dataset) || !isset(FlipsideSettings::$dataset[$dataSetName]))
        {
            return false;
        }
        return FlipsideSettings::$dataset[$dataSetName];
    }

    public function getGlobalSetting($propName, $default = false)
    {
        if(isset(FlipsideSettings::$global) && isset(FlipsideSettings::$global[$propName]))
        {
            return FlipsideSettings::$global[$propName];
        }
        return $default;
    }

    public function getSiteLinks()
    {
        if(isset(FlipsideSettings::$sites))
        {
            return FlipsideSettings::$sites;
        }
        return array();
    }

    private function getLDAPHost($default)
    {
        if(!isset(FlipsideSettings::$ldap) || !isset(FlipsideSettings::$ldap['host']))
        {
            return $default;
        }
{'fraction_non_alphanumeric': 0.13514957264957264, 'fraction_numerical': 0.0005341880341880342, 'mean_word_length': 2.047192839707079, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5479071', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1085, 'n_words': 154}