• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utf8_romanize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中utf8_romanize函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_romanize函数的具体用法?PHP utf8_romanize怎么用?PHP utf8_romanize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了utf8_romanize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: entities_to_7bit

function entities_to_7bit($str)
{
    require_once LEPTON_PATH . '/framework/summary.utf8.php';
    // convert to UTF-8
    $str = charset_to_utf8($str);
    if (!utf8_check($str)) {
        return $str;
    }
    // replace some specials
    $str = utf8_stripspecials($str, '_');
    // translate non-ASCII characters to ASCII
    $str = utf8_romanize($str);
    // missed some? - Many UTF-8-chars can't be romanized
    // convert to HTML-entities, and replace entites by hex-numbers
    $str = utf8_fast_umlauts_to_entities($str, false);
    $str = str_replace(''', ''', $str);
    //    $str = preg_replace_callback('/&#([0-9]+);/', function($matches) {return "dechex($matches[1])";}, $str);
    //    $str = preg_replace_callback('/&#([0-9]+);/', function($matches) {return dechex($matches[1]);}, $str);
    if (version_compare(PHP_VERSION, '5.3', '<')) {
        $str = preg_replace('/&#([0-9]+);/e', "dechex('\$1')", $str);
    } else {
        $str = preg_replace_callback('/&#([0-9]+);/', create_function('$aMatches', 'return dechex($aMatches[1]);'), $str);
    }
    // maybe there are some &gt; &lt; &apos; &quot; &amp; &nbsp; left, replace them too
    $str = str_replace(array('&gt;', '&lt;', '&apos;', '\'', '&quot;', '&amp;'), '', $str);
    $str = str_replace('&amp;', '', $str);
    return $str;
}
开发者ID:pixelhulk,项目名称:LEPTON,代码行数:28,代码来源:function.entities_to_7bit.php


示例2: getCountriesByContinent

 /**
  * get Country-List
  */
 public function getCountriesByContinent()
 {
     $return = array();
     $countries = array();
     $arrAux = array();
     $arrTmp = array();
     $this->loadLanguageFile('countries');
     $this->loadLanguageFile('continents');
     include TL_ROOT . '/system/config/countries.php';
     include TL_ROOT . '/system/config/countriesByContinent.php';
     foreach ($countriesByContinent as $strConKey => $arrCountries) {
         $strConKeyTranslated = strlen($GLOBALS['TL_LANG']['CONTINENT'][$strConKey]) ? utf8_romanize($GLOBALS['TL_LANG']['CONTINENT'][$strConKey]) : $strConKey;
         $arrAux[$strConKey] = $strConKeyTranslated;
         foreach ($arrCountries as $key => $strCounntry) {
             $arrTmp[$strConKeyTranslated][$key] = strlen($GLOBALS['TL_LANG']['CNT'][$key]) ? utf8_romanize($GLOBALS['TL_LANG']['CNT'][$key]) : $countries[$key];
         }
     }
     ksort($arrTmp);
     foreach ($arrTmp as $strConKey => $arrCountries) {
         asort($arrCountries);
         //get original continent key
         $strOrgKey = array_search($strConKey, $arrAux);
         $strConKeyTranslated = strlen($GLOBALS['TL_LANG']['CONTINENT'][$strOrgKey]) ? $GLOBALS['TL_LANG']['CONTINENT'][$strOrgKey] : $strConKey;
         foreach ($arrCountries as $strKey => $strCountry) {
             $return[$strConKeyTranslated][$strKey] = strlen($GLOBALS['TL_LANG']['CNT'][$strKey]) ? $GLOBALS['TL_LANG']['CNT'][$strKey] : $countries[$strKey];
         }
     }
     $return[$GLOBALS['TL_LANG']['CONTINENT']['other']]['xx'] = strlen($GLOBALS['TL_LANG']['CNT']['xx']) ? $GLOBALS['TL_LANG']['CNT']['xx'] : 'No Country';
     return $return;
 }
开发者ID:menatwork,项目名称:geoprotection,代码行数:33,代码来源:tl_content.php


示例3: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     $objTerm = $this->Database->execute("SELECT * FROM tl_glossary_term WHERE pid IN(" . implode(',', array_map('intval', $this->glossaries)) . ")" . " ORDER BY sortTerm");
     if ($objTerm->numRows < 1) {
         $this->Template->terms = array();
         return;
     }
     global $objPage;
     $this->import('String');
     $arrTerms = array();
     while ($objTerm->next()) {
         $objTemp = new stdClass();
         $key = utf8_strtoupper(utf8_substr($objTerm->sortTerm, 0, 1));
         $objTemp->term = $objTerm->term;
         $objTemp->anchor = 'gl' . utf8_romanize($key);
         $objTemp->id = standardize($objTerm->term);
         $objTemp->isParent = false;
         $objTemp->isReference = false;
         if ($objTerm->addReference) {
             if ($objTerm->referenceType == 'parent') {
                 $objTemp->hasParent = true;
             } elseif ($objTerm->referenceType == 'reference') {
                 $objTemp->isReference = true;
                 $objTemp->referenceTerm = false;
                 $objReference = $this->Database->prepare("SELECT `id`,`term` FROM `tl_glossary_term` WHERE `id`=?")->execute($objTerm->referenceTerm);
                 if ($objReference->next()) {
                     $objTemp->referenceTerm = $objReference->term;
                     $objTemp->referenceAnchor = standardize($objReference->term);
                 }
             }
         }
         // Clean the RTE output
         if ($objPage->outputFormat == 'xhtml') {
             $objTerm->definition = $this->String->toXhtml($objTerm->definition);
         } else {
             $objTerm->definition = $this->String->toHtml5($objTerm->definition);
         }
         $objTemp->definition = $this->String->encodeEmail($objTerm->definition);
         if ($objTerm->addExample) {
             $objTemp->addExample = true;
             $objTemp->example = $objPage->outputFormat == 'xhtml' ? $this->String->toXhtml($objTerm->example) : $this->String->toHtml5($objTerm->example);
         } else {
             $objTemp->addExample = false;
         }
         $objTemp->addImage = false;
         // Add image
         if ($objTerm->addImage && is_file(TL_ROOT . '/' . $objTerm->singleSRC)) {
             $this->addImageToTemplate($objTemp, $objTerm->row());
         }
         $objTemp->enclosures = array();
         // Add enclosures
         if ($objTerm->addEnclosure) {
             $this->addEnclosuresToTemplate($objTemp, $objTerm->row());
         }
         $arrTerms[$key][] = $objTemp;
     }
     $this->Template->terms = $arrTerms;
     $this->Template->request = ampersand($this->Environment->request, true);
     $this->Template->topLink = $GLOBALS['TL_LANG']['MSC']['backToTop'];
 }
开发者ID:4t2,项目名称:glossary2,代码行数:63,代码来源:ModuleGlossaryList.php


示例4: renderXml

 public function renderXml()
 {
     $nameSuffix = str_replace(' ', '-', utf8_romanize(utf8_deaccent(ucfirst($this->_params['name']))));
     XenForo_Application::autoload('Zend_Debug');
     $this->setDownloadFileName('BBM_BbCode_' . $nameSuffix . '.xml');
     return $this->_params['xml']->saveXml();
 }
开发者ID:Sywooch,项目名称:forums,代码行数:7,代码来源:Export.php


示例5: uploadTo

 /**
  * Check the uploaded files and move them to the target directory
  * @param string
  * @param string
  * @return array
  * @throws \Exception
  */
 public function uploadTo($strTarget, $strKey)
 {
     if ($strTarget == '' || strpos($strTarget, '../') !== false) {
         throw new \Exception("Invalid target path {$strTarget}");
     }
     if ($strKey == '') {
         throw new \Exception('The key must not be empty');
     }
     $maxlength_kb = $this->getMaximumUploadSize();
     $maxlength_kb_readable = $this->getReadableSize($maxlength_kb);
     $arrUploaded = array();
     $arrFiles = $this->getFilesFromGlobal($strKey);
     foreach ($arrFiles as $file) {
         // Romanize the filename
         $file['name'] = strip_tags($file['name']);
         $file['name'] = utf8_romanize($file['name']);
         $file['name'] = str_replace('"', '', $file['name']);
         // File was not uploaded
         if (!is_uploaded_file($file['tmp_name'])) {
             if ($file['error'] == 1 || $file['error'] == 2) {
                 \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['filesize'], $maxlength_kb_readable));
                 $this->log('File "' . $file['name'] . '" exceeds the maximum file size of ' . $maxlength_kb_readable, 'Uploader uploadTo()', TL_ERROR);
                 $this->blnHasError = true;
             } elseif ($file['error'] == 3) {
                 \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['filepartial'], $file['name']));
                 $this->log('File "' . $file['name'] . '" was only partially uploaded', 'Uploader uploadTo()', TL_ERROR);
                 $this->blnHasError = true;
             }
         } elseif ($file['size'] > $maxlength_kb) {
             \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['filesize'], $maxlength_kb_readable));
             $this->log('File "' . $file['name'] . '" exceeds the maximum file size of ' . $maxlength_kb_readable, 'Uploader uploadTo()', TL_ERROR);
             $this->blnHasError = true;
         } else {
             $pathinfo = pathinfo($file['name']);
             $arrAllowedTypes = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['uploadTypes']));
             // File type not allowed
             if (!in_array(strtolower($pathinfo['extension']), $arrAllowedTypes)) {
                 \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['filetype'], $pathinfo['extension']));
                 $this->log('File type "' . $pathinfo['extension'] . '" is not allowed to be uploaded (' . $file['name'] . ')', 'Uploader uploadTo()', TL_ERROR);
                 $this->blnHasError = true;
             } else {
                 $this->import('Files');
                 $strNewFile = $strTarget . '/' . $file['name'];
                 // Set CHMOD and resize if neccessary
                 if ($this->Files->move_uploaded_file($file['tmp_name'], $strNewFile)) {
                     $this->Files->chmod($strNewFile, 0644);
                     $blnResized = $this->resizeUploadedImage($strNewFile, $file);
                     // Notify the user
                     if (!$blnResized) {
                         \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['MSC']['fileUploaded'], $file['name']));
                         $this->log('File "' . $file['name'] . '" uploaded successfully', 'Uploader uploadTo()', TL_FILES);
                     }
                     $arrUploaded[] = $strNewFile;
                 }
             }
         }
     }
     return $arrUploaded;
 }
开发者ID:rikaix,项目名称:core,代码行数:66,代码来源:FileUpload.php


示例6: saveCookieName

 public function saveCookieName($strString, $ObjDataContainer)
 {
     $arrSearch = array('/[^a-zA-Z0-9 _-]+/', '/ +/', '/\\-+/');
     $arrReplace = array('', '-', '-');
     $strString = html_entity_decode($strString, ENT_QUOTES, $GLOBALS['TL_CONFIG']['characterSet']);
     $strString = strip_insert_tags($strString);
     $strString = utf8_romanize($strString);
     $strString = preg_replace($arrSearch, $arrReplace, $strString);
     return trim($strString, '-');
 }
开发者ID:menatwork,项目名称:geolocation,代码行数:10,代码来源:tl_settings.php


示例7: exportManager

 /**
  * Export a ZAD Send News manager to XML file.
  * @param \DataContainer
  */
 public function exportManager($dc)
 {
     // get the manager data
     $manager = $this->Database->prepare("SELECT * FROM tl_zad_sendnews WHERE id=?")->execute($dc->id);
     if ($manager->numRows < 1) {
         // error, exit
         return;
     }
     // create a new XML document
     $xml = new \DOMDocument('1.0', 'UTF-8');
     $xml->formatOutput = true;
     // root element
     $tables = $xml->createElement('tables');
     $tables->setAttribute('version', '2.0');
     $tables = $xml->appendChild($tables);
     // add manager table
     $this->exportTable('tl_zad_sendnews', $xml, $tables, $manager);
     // add rules table
     $rules = $this->Database->prepare("SELECT * FROM tl_zad_sendnews_rule WHERE pid=? ORDER BY sorting")->execute($manager->id);
     $this->exportTable('tl_zad_sendnews_rule', $xml, $tables, $rules);
     // add news_archive table
     $news = $this->Database->prepare("SELECT id,title FROM tl_news_archive WHERE id=?")->execute($manager->news_archive);
     $this->exportTable('tl_news_archive', $xml, $tables, $news);
     // add user table
     $user = $this->Database->prepare("SELECT id,username,name,email FROM tl_user WHERE id=?")->execute($manager->news_author);
     $this->exportTable('tl_user', $xml, $tables, $user);
     // create a zip archive
     $tmp = md5(uniqid(mt_rand(), true));
     $zip = new \ZipWriter('system/tmp/' . $tmp);
     // add XML document
     $zip->addString($xml->saveXML(), 'sendnews.xml');
     // close archive
     $zip->close();
     // romanize the file name
     $name = utf8_romanize($manager->name);
     $name = strtolower(str_replace(' ', '_', $name));
     $name = preg_replace('/[^A-Za-z0-9\\._-]/', '', $name);
     $name = basename($name);
     // open the "save as …" dialogue
     $file = new \File('system/tmp/' . $tmp, true);
     // send file
     header('Content-Type: application/octet-stream');
     header('Content-Transfer-Encoding: binary');
     header('Content-Disposition: attachment; filename="' . $name . '.zip"');
     header('Content-Length: ' . $file->filesize);
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     header('Expires: 0');
     $fl = fopen(TL_ROOT . '/system/tmp/' . $tmp, 'rb');
     fpassthru($fl);
     fclose($fl);
     exit;
 }
开发者ID:pandroid,项目名称:contao-zad_sendnews,代码行数:57,代码来源:ZadSendnews.php


示例8: slugify

 /**
  * Slugify a value.
  *
  * @param string $value     Given value.
  * @param string $separator Separator string.
  *
  * @return string
  */
 private function slugify($value, $separator)
 {
     $arrSearch = array('/[^a-zA-Z0-9 \\.\\&\\/_-]+/', '/[ \\.\\&\\/-]+/');
     $arrReplace = array('', $separator);
     $value = html_entity_decode($value, ENT_QUOTES, $this->charset);
     $value = strip_insert_tags($value);
     $value = utf8_romanize($value);
     $value = preg_replace($arrSearch, $arrReplace, $value);
     if (!$this->preserveUppercase) {
         $value = strtolower($value);
     }
     return trim($value, $separator);
 }
开发者ID:netzmacht,项目名称:contao-toolkit,代码行数:21,代码来源:SlugifyFilter.php


示例9: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     $objTerm = $this->Database->execute("SELECT * FROM tl_glossary_term WHERE pid IN(" . implode(',', array_map('intval', $this->glossaries)) . ")" . " ORDER BY term");
     if ($objTerm->numRows < 1) {
         return;
     }
     $arrAnchor = array();
     while ($objTerm->next()) {
         $link = utf8_substr($objTerm->term, 0, 1);
         $key = 'gl' . utf8_romanize($link);
         $arrAnchor[$key] = $link;
     }
     $this->Template->request = ampersand($this->Environment->request, true);
     $this->Template->anchors = $arrAnchor;
 }
开发者ID:4t2,项目名称:glossary2,代码行数:18,代码来源:ModuleGlossaryMenu.php


示例10: standardize

/**
 * Standardize a parameter (strip special characters and convert spaces)
 *
 * @param string  $strString
 * @param boolean $blnPreserveUppercase
 *
 * @return string
 */
function standardize($strString, $blnPreserveUppercase = false)
{
    $arrSearch = array('/[^a-zA-Z0-9 \\.\\&\\/_-]+/', '/[ \\.\\&\\/-]+/');
    $arrReplace = array('', '-');
    $strString = html_entity_decode($strString, ENT_QUOTES, $GLOBALS['TL_CONFIG']['characterSet']);
    $strString = strip_insert_tags($strString);
    $strString = utf8_romanize($strString);
    $strString = preg_replace($arrSearch, $arrReplace, $strString);
    if (is_numeric(substr($strString, 0, 1))) {
        $strString = 'id-' . $strString;
    }
    if (!$blnPreserveUppercase) {
        $strString = strtolower($strString);
    }
    return trim($strString, '-');
}
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:24,代码来源:functions.php


示例11: cleanID

function cleanID($raw_id)
{
    $sepchar = "_";
    $sepcharpat = '#\\' . $sepchar . '+#';
    $id = trim((string) $raw_id);
    $id = utf8_strtolower($id);
    //alternative namespace seperator
    $id = strtr($id, ';', ':');
    $id = strtr($id, '/', $sepchar);
    $id = utf8_romanize($id);
    $id = utf8_deaccent($id, -1);
    //remove specials
    $id = utf8_stripspecials($id, $sepchar, '\\*');
    $id = utf8_strip($id);
    $id = preg_replace($sepcharpat, $sepchar, $id);
    $id = preg_replace('#:+#', ':', $id);
    $id = preg_replace('#:[:\\._\\-]+#', ':', $id);
    return $id;
}
开发者ID:ryanmuller,项目名称:folders2web,代码行数:19,代码来源:clean_id.php


示例12: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     $objTerm = $this->objResult;
     if ($objTerm->numRows < 1) {
         return '';
     }
     $arrAnchor = array();
     $arrLinks = array();
     while ($objTerm->next()) {
         $link = utf8_substr($objTerm->term, 0, 1);
         $key = 'gl' . utf8_romanize($link);
         $arrAnchor[$key] = $link;
         $arrLinks[$key] = array('link' => $link);
         if ($this->glossary_menu_filter) {
             $href .= '&amp;gl=' . $key;
             $arrLinks[$key]['href'] = $this->addToUrl($href);
         } else {
             $arrLinks[$key]['href'] = ampersand($this->Environment->request, true) . '#' . $key;
         }
     }
     $this->Template->request = ampersand($this->Environment->request, true);
     $this->Template->anchors = $arrAnchor;
     $this->Template->links = $arrLinks;
 }
开发者ID:w3scout,项目名称:glossary_revisited,代码行数:27,代码来源:ModuleGlossaryMenu.php


示例13: getCountriesList

 /**
  * Build up the list with all countries information and cache this information.
  *
  * Return all data from the cache.
  *
  * @return array|null
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public static function getCountriesList()
 {
     if (empty(self::$arrCountries)) {
         $countries = array();
         $arrTmp = array();
         // Load the language files.
         \System::loadLanguageFile('countries');
         \System::loadLanguageFile('continents');
         // Include all files with name.
         require_once TL_ROOT . '/system/config/countries.php';
         require_once TL_ROOT . '/system/config/countriesByContinent.php';
         /** @var $countriesByContinent array */
         foreach ($countriesByContinent as $strConKey => $arrCountries) {
             // Add the main value.
             $strParentName = strlen($GLOBALS['TL_LANG']['CONTINENT'][$strConKey]) ? utf8_romanize($GLOBALS['TL_LANG']['CONTINENT'][$strConKey]) : $strConKey;
             // Add all countries.
             foreach (array_keys($arrCountries) as $key) {
                 $arrTmp[$key] = array('name' => strlen($GLOBALS['TL_LANG']['CNT'][$key]) ? utf8_romanize($GLOBALS['TL_LANG']['CNT'][$key]) : $countries[$key], 'parent-name' => $strParentName, 'parent-short' => $strConKey);
             }
         }
         self::$arrCountries = $arrTmp;
     }
     return self::$arrCountries;
 }
开发者ID:metamodels,项目名称:attribute_geoprotection,代码行数:35,代码来源:Helper.php


示例14: _verifyUsername

 /**
  * Verification callback to check that a username is valid
  *
  * @param string Username
  *
  * @return bool
  */
 protected function _verifyUsername(&$username)
 {
     if ($this->isUpdate() && $username === $this->getExisting('username')) {
         return true;
         // unchanged, always pass
     }
     // standardize white space in names
     $username = preg_replace('/\\s+/u', ' ', $username);
     try {
         // if this matches, then \v isn't known (appears to be PCRE < 7.2) so don't strip
         if (!preg_match('/\\v/', 'v')) {
             $newName = preg_replace('/\\v+/u', ' ', $username);
             if (is_string($newName)) {
                 $username = $newName;
             }
         }
     } catch (Exception $e) {
     }
     $username = trim($username);
     $usernameLength = utf8_strlen($username);
     $minLength = $this->getOption(self::OPTION_USERNAME_LENGTH_MIN);
     $maxLength = $this->getOption(self::OPTION_USERNAME_LENGTH_MAX);
     if (!$this->getOption(self::OPTION_ADMIN_EDIT)) {
         if ($minLength > 0 && $usernameLength < $minLength) {
             $this->error(new XenForo_Phrase('please_enter_name_that_is_at_least_x_characters_long', array('count' => $minLength)), 'username');
             return false;
         }
         if ($maxLength > 0 && $usernameLength > $maxLength) {
             $this->error(new XenForo_Phrase('please_enter_name_that_is_at_most_x_characters_long', array('count' => $maxLength)), 'username');
             return false;
         }
         $disallowedNames = $this->getOption(self::OPTION_USERNAME_DISALLOWED_NAMES);
         if ($disallowedNames) {
             foreach ($disallowedNames as $name) {
                 $name = trim($name);
                 if ($name === '') {
                     continue;
                 }
                 if (stripos($username, $name) !== false) {
                     $this->error(new XenForo_Phrase('please_enter_another_name_disallowed_words'), 'username');
                     return false;
                 }
             }
         }
         $matchRegex = $this->getOption(self::OPTION_USERNAME_REGEX);
         if ($matchRegex) {
             $matchRegex = str_replace('#', '\\#', $matchRegex);
             // escape delim only
             if (!preg_match('#' . $matchRegex . '#i', $username)) {
                 $this->error(new XenForo_Phrase('please_enter_another_name_required_format'), 'username');
                 return false;
             }
         }
         $censoredUserName = XenForo_Helper_String::censorString($username);
         if ($censoredUserName !== $username) {
             $this->error(new XenForo_Phrase('please_enter_name_that_does_not_contain_any_censored_words'), 'username');
             return false;
         }
     }
     // ignore check if unicode properties aren't compiled
     try {
         if (@preg_match("/\\p{C}/u", $username)) {
             $this->error(new XenForo_Phrase('please_enter_name_without_using_control_characters'), 'username');
             return false;
         }
     } catch (Exception $e) {
     }
     if (strpos($username, ',') !== false) {
         $this->error(new XenForo_Phrase('please_enter_name_that_does_not_contain_comma'), 'username');
         return false;
     }
     if (XenForo_Helper_Email::isEmailValid($username)) {
         $this->error(new XenForo_Phrase('please_enter_name_that_does_not_resemble_an_email_address'), 'username');
         return false;
     }
     $existingUser = $this->_getUserModel()->getUserByName($username);
     if ($existingUser && $existingUser['user_id'] != $this->get('user_id')) {
         $this->error(new XenForo_Phrase('usernames_must_be_unique'), 'username');
         return false;
     }
     // compare against romanized name to help reduce confusable issues
     $romanized = utf8_deaccent(utf8_romanize($username));
     if ($romanized != $username) {
         $existingUser = $this->_getUserModel()->getUserByName($romanized);
         if ($existingUser && $existingUser['user_id'] != $this->get('user_id')) {
             $this->error(new XenForo_Phrase('usernames_must_be_unique'), 'username');
             return false;
         }
     }
     return true;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:98,代码来源:User.php


示例15: save

 /**
  * Save the current value
  * @param mixed
  * @throws Exception
  */
 protected function save($varValue)
 {
     if ($this->Input->post('FORM_SUBMIT') != $this->strTable || !file_exists(TL_ROOT . '/' . $this->strPath . '/' . $this->varValue . $this->strExtension) || !$this->isMounted($this->strPath . '/' . $this->varValue . $this->strExtension) || $this->varValue == $varValue) {
         return;
     }
     $this->import('Files');
     $arrData = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField];
     $varValue = utf8_romanize($varValue);
     // Call save_callback
     if (is_array($arrData['save_callback'])) {
         foreach ($arrData['save_callback'] as $callback) {
             $this->import($callback[0]);
             $varValue = $this->{$callback}[0]->{$callback}[1]($varValue, $this);
         }
     }
     $this->Files->rename($this->strPath . '/' . $this->varValue . $this->strExtension, $this->strPath . '/' . $varValue . $this->strExtension);
     // Add a log entry
     if (stristr($this->intId, '__new__') == true) {
         $this->log('Folder "' . $this->strPath . '/' . $varValue . $this->strExtension . '" has been created', 'DC_Folder save()', TL_FILES);
     } else {
         $this->log('File or folder "' . $this->strPath . '/' . $this->varValue . $this->strExtension . '" has been renamed to "' . $this->strPath . '/' . $varValue . $this->strExtension . '"', 'DC_Folder save()', TL_FILES);
     }
     // Set the new value so the input field can show it
     if ($this->Input->get('act') == 'editAll') {
         $session = $this->Session->getData();
         if (($index = array_search($this->urlEncode($this->strPath . '/' . $this->varValue) . $this->strExtension, $session['CURRENT']['IDS'])) !== false) {
             $session['CURRENT']['IDS'][$index] = $this->urlEncode($this->strPath . '/' . $varValue) . $this->strExtension;
             $this->Session->setData($session);
         }
     }
     $this->varValue = $varValue;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:37,代码来源:DC_Folder.php


示例16: test_deaccented

 /**
  * Test romanization of character that would usually be deaccented in a different
  * way FS#1117
  *
  * @author Andreas Gohr <[email protected]>
  */
 function test_deaccented()
 {
     $this->assertEqual("a A a A a o O", utf8_romanize("å Å ä Ä ä ö Ö"));
 }
开发者ID:pyfun,项目名称:dokuwiki,代码行数:10,代码来源:utf8_romanize.test.php


示例17: filterMenu


//.........这里部分代码省略.........
                            $options[$v] = date('Y', $v);
                        }
                        unset($options[$k]);
                    }
                }
                // Manual filter
                if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['multiple']) {
                    $moptions = array();
                    // TODO: find a more effective solution
                    foreach ($options as $option) {
                        // CSV lists (see #2890)
                        if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['csv'])) {
                            $doptions = trimsplit($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['csv'], $option);
                        } else {
                            $doptions = deserialize($option);
                        }
                        if (is_array($doptions)) {
                            $moptions = array_merge($moptions, $doptions);
                        }
                    }
                    $options = $moptions;
                }
                $options = array_unique($options);
                $options_callback = array();
                // Call the options_callback
                if ((is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback']) || is_callable($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'])) && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference']) {
                    if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'])) {
                        $strClass = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'][0];
                        $strMethod = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'][1];
                        $this->import($strClass);
                        $options_callback = $this->{$strClass}->{$strMethod}($this);
                    } elseif (is_callable($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'])) {
                        $options_callback = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback']($this);
                    }
                    // Sort options according to the keys of the callback array
                    $options = array_intersect(array_keys($options_callback), $options);
                }
                $options_sorter = array();
                $blnDate = in_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['flag'], array(5, 6, 7, 8, 9, 10));
                // Options
                foreach ($options as $kk => $vv) {
                    $value = $blnDate ? $kk : $vv;
                    // Options callback
                    if (!empty($options_callback) && is_array($options_callback)) {
                        $vv = $options_callback[$vv];
                    } elseif (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['foreignKey'])) {
                        $key = explode('.', $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['foreignKey'], 2);
                        $objParent = $this->Database->prepare("SELECT " . $key[1] . " AS value FROM " . $key[0] . " WHERE id=?")->limit(1)->execute($vv);
                        if ($objParent->numRows) {
                            $vv = $objParent->value;
                        }
                    } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['isBoolean'] || $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['multiple']) {
                        $vv = $vv != '' ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
                    } elseif ($field == 'pid') {
                        $this->loadDataContainer($this->ptable);
                        $showFields = $GLOBALS['TL_DCA'][$this->ptable]['list']['label']['fields'];
                        if (!$showFields[0]) {
                            $showFields[0] = 'id';
                        }
                        $objShowFields = $this->Database->prepare("SELECT " . $showFields[0] . " FROM " . $this->ptable . " WHERE id=?")->limit(1)->execute($vv);
                        if ($objShowFields->numRows) {
                            $vv = $objShowFields->{$showFields[0]};
                        }
                    }
                    $option_label = '';
                    // Use reference array
                    if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'])) {
                        $option_label = is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'][$vv]) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'][$vv][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'][$vv];
                    } elseif ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options'])) {
                        $option_label = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options'][$vv];
                    }
                    // No empty options allowed
                    if (!strlen($option_label)) {
                        $option_label = $vv ?: '-';
                    }
                    $options_sorter['  <option value="' . specialchars($value) . '"' . (isset($session['filter'][$filter][$field]) && $value == $session['filter'][$filter][$field] ? ' selected="selected"' : '') . '>' . $option_label . '</option>'] = utf8_romanize($option_label);
                }
                // Sort by option values
                if (!$blnDate) {
                    natcasesort($options_sorter);
                    if (in_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['flag'], array(2, 4, 12))) {
                        $options_sorter = array_reverse($options_sorter, true);
                    }
                }
                $fields .= "\n" . implode("\n", array_keys($options_sorter));
            }
            // End select menu
            $fields .= '
</select> ';
            // Force a line-break after six elements (see #3777)
            if (($cnt + 1) % 6 == 0) {
                $fields .= '<br>';
            }
        }
        return '

<div class="tl_filter tl_subpanel">
<strong>' . $GLOBALS['TL_LANG']['MSC']['filter'] . ':</strong> ' . $fields . '
</div>';
    }
开发者ID:bytehead,项目名称:contao-core,代码行数:101,代码来源:DC_Table.php


示例18: idx_cleanName

/**
 * Clean a name of a key for use as a file name.
 *
 * Romanizes non-latin characters, then strips away anything that's
 * not a letter, number, or underscore.
 *
 * @author Tom N Harris <[email protected]>
 */
function idx_cleanName($name)
{
    $name = utf8_romanize(trim((string) $name));
    $name = preg_replace('#[ \\./\\:-]+#', '_', $name);
    $name = preg_replace('/[^A-Za-z0-9_]/', '', $name);
    return strtolower($name);
}
开发者ID:neutrinog,项目名称:Door43,代码行数:15,代码来源:indexer.php


示例19: getLanguages

 /**
  * Return the available languages as array
  * 
  * @param boolean $blnInstalledOnly If true, return only installed languages
  * 
  * @return array An array of languages
  */
 public static function getLanguages($blnInstalledOnly = false)
 {
     $return = array();
     $languages = array();
     $arrAux = array();
     $langsNative = array();
     static::loadLanguageFile('languages');
     include TL_ROOT . '/system/config/languages.php';
     foreach ($languages as $strKey => $strName) {
         $arrAux[$strKey] = isset($GLOBALS['TL_LANG']['LNG'][$strKey]) ? utf8_romanize($GLOBALS['TL_LANG']['LNG'][$strKey]) : $strName;
     }
     asort($arrAux);
     $arrBackendLanguages = scan(TL_ROOT . '/system/modules/core/languages');
     foreach (array_keys($arrAux) as $strKey) {
         if ($blnInstalledOnly && !in_array($strKey, $arrBackendLanguages)) {
             continue;
         }
         $return[$strKey] = isset($GLOBALS['TL_LANG']['LNG'][$strKey]) ? $GLOBALS['TL_LANG']['LNG'][$strKey] : $languages[$strKey];
         if (isset($langsNative[$strKey]) && $langsNative[$strKey] != $return[$strKey]) {
             $return[$strKey] .= ' - ' . $langsNative[$strKey];
         }
     }
     return $return;
 }
开发者ID:rburch,项目名称:core,代码行数:31,代码来源:System.php


示例20: cleanID

/**
 * Remove unwanted chars from ID
 *
 * Cleans a given ID to only use allowed characters. Accented characters are
 * converted to unaccented ones
 *
 * @author Andreas Gohr <[email protected]>
 * @param  string  $raw_id    The pageid to clean
 * @param  boolean $ascii     Force ASCII
 * @return string cleaned id
 */
function cleanID($raw_id, $ascii = false)
{
    global $conf;
    static $sepcharpat = null;
    global $cache_cleanid;
    $cache =& $cache_cleanid;
    if ($conf['syslog']) {
        syslog(LOG_WARNING, '[pageutils.php] cleanID: raw_id: ' . $raw_id);
    }
    // check if it's already in the memory cache
    if (isset($cache[(string) $raw_id])) {
        return $cache[(string) $raw_id];
    }
    $sepchar = $conf['sepchar'];
    if ($sepcharpat == null) {
        // build string only once to save clock cycles
        $sepcharpat = '#\\' . $sepchar . '+#';
    }
    $id = trim((string) $raw_id);
    if ($conf['mixedcase'] == 0) {
        $id = utf8_strtolower($id);
    }
    //alternative namespace seperator
    if ($conf['useslash']) {
        $id = strtr($id, ';/', '::');
    } else {
        $id = strtr($id, ';/', ':' . $sepchar);
    }
    if ($conf['deaccent'] == 2 || $ascii) {
        $id = utf8_romanize($id);
    }
    if ($conf['deaccent'] || $ascii) {
        $id = utf8_deaccent($id, -1);
    }
    //remove specials if specialcharacters is set to 0
    if ($conf['specialcharacters'] == 0) {
        $id = utf8_stripspecials($id, $sepchar, '\\*');
    }
    if ($ascii) {
        $id = utf8_strip($id);
    }
    //clean up
    $id = preg_replace($sepcharpat, $sepchar, $id);
    $id = preg_replace('#:+#', ':', $id);
    $id = trim($id, ':._-');
    $id = preg_replace('#:[:\\._\\-]+#', ':', $id);
    $id = preg_replace('#[:\\._\\-]+:#', ':', $id);
    $cache[(string) $raw_id] = $id;
    if ($conf['syslog']) {
        syslog(LOG_WARNING, '[pageutils.php] cleanID: id to be returned: ' . $id);
    }
    return $id;
}
开发者ID:s7mx1,项目名称:dokuwiki,代码行数:64,代码来源:pageutils.php



注:本文中的utf8_romanize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP utf8_rtrim函数代码示例发布时间:2022-05-23
下一篇:
PHP utf8_recode函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap