/** * Load and merge all of the configuration files in this group. * * $config->load($name); * * @param string configuration group name * @param array configuration array * @return $this clone of the current object * @uses Kohana::load */ public function load($group, array $config = NULL) { if ($files = \A_y::find_file($this->_directory, $group, NULL, TRUE)) { // Initialize the config array $config = array(); foreach ($files as $file) { // Merge each ay_config_file to the configuration array $config = \A_y::merge($config, \A_y::load($file)); } } return parent::load($group, $config); }
/** * Convert engine * The input string must encoding with UTF-8 currently * * @param string $str * @param integer $minLen * @param integer $maxLen * @param boolean $upCase * @param array $dreg * @return string */ static function conv($str, $minLen = 0, $maxLen = 0, $upCase = 0, $dreg = 0) { // Check if the string can be converted if (!$str || !mb_check_encoding($str, 'UTF-8')) { \A_y::debug('The input string can not be empty and it must be encoded in UTF-8.'); return ''; } // Md5 encode it $md5 = md5($str); // Remove invalid characters / dregs $str = is_array($dreg) ? preg_replace('/' . implode('|', $dreg) . '/', '', $str) : $str; // Do rawConvByUtf8, then catch only Roman characters and numbers $str = preg_replace('/^[^0-9A-Za-z]|[^0-9A-Za-z-]*|[^0-9A-Za-z]$/x', '', self::rawConvByUtf8($str, $upCase)); // Get result string length $len = strlen($str); // Fix length and return Result return $minLen && $len < $minLen ? $str . substr($md5, 0, $minLen - $len) : ($maxLen && $len > $maxLen ? substr($str, 0, $maxLen) : $str); }