选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
*/ class opToolkit { /** * Returns the list of mobile e-mail address domains. * * @return array */ public static function getMobileMailAddressDomains() { return (array)include(sfContext::getInstance()->getConfigCache()->checkConfig('config/mobile_mail_domain.yml')); } /** * Checks if a string is a mobile e-mail address. * * @param string * * @return bool true if $string is valid mobile e-mail address and false otherwise. */ public static function isMobileEmailAddress($string) { $pieces = explode('@', $string, 2); $domain = array_pop($pieces); return in_array($domain, self::getMobileMailAddressDomains()); } /** * Takes a text that matched pattern and replaces it to a marker. * * Replaces text that matched $pattern to a marker. * This method returns replaced text and a correspondence table of marker and pre-convert text * * @param string $subject * @param array $patterns * * @return array */ public static function replacePatternsToMarker($subject, $patterns = array()) { $i = 0; $list = array(); if (empty($patterns)) { $patterns = array( '/]+>/is', '//is', '//is', '/]+>/is', '//is', ); } foreach ($patterns as $pattern) { if (preg_match_all($pattern, $subject, $matches)) { foreach ($matches[0] as $match) { $replacement = '<<>>'; $list[$replacement] = $match; $i++; } } } $subject = str_replace(array_values($list), array_keys($list), $subject); return array($list, $subject); } public static function isEnabledRegistration($mode = '') { $registration = opConfig::get('enable_registration'); if ($registration == 3) { return true; } if (!$mode && $registration) { return true; } if ($mode == 'mobile' && $registration == 1) { return true; } if ($mode == 'pc' && $registration == 2) { return true; } return false; } /** * Unifys EOL characters in the string. * * @param string $string * @param string $eol * * @return string */ public static function unifyEOLCharacter($string, $eol = "\n") { $eols = array("\r\n", "\r", "\n"); if (!in_array($eol, $eols)) { return $string; } // first, unifys to LF $string = str_replace("\r\n", "\n", $string); $string = str_replace("\r", "\n", $string); // second, unifys to specify EOL character if ($eol !== "\n") { $string = str_replace("\n", $eol, $string); } return $string; } function extractEnclosedStrings($string, $enclosure = '"') { $result = array('base' => $string, 'enclosed' => array()); $enclosureCount = substr_count($string, $enclosure); for ($i = 0; $i < $enclosureCount; $i++) { $begin = strpos($string, $enclosure); $finish = strpos($string, $enclosure, $begin + 1); if ($begin !== false && $finish !== false) { $head = substr($string, 0, $begin - 1); $body = substr($string, $begin + 1, $finish - $begin - 1); $foot = substr($string, $finish + 1); $string = $head.$foot; $result['enclosed'][] = $body; $i++; } } $result['base'] = $string; return $result; } public static function stripNullByteDeep($value) { return is_array($value) ? array_map(array('opToolkit', 'stripNullByteDeep'), $value) : (is_string($value) ? preg_replace("/[\x{0}-\x{08}\x{0b}-\x{1f}\x{7f}-\x{9f}\x{ad}]/u", '', $value) : $value); } }