本文整理匯總了PHP中IPSText::convertUnicode方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::convertUnicode方法的具體用法?PHP IPSText::convertUnicode怎麽用?PHP IPSText::convertUnicode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::convertUnicode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _getMembers
/**
* Returns possible matches for the string input
*
* @return @e void Outputs to screen
*/
protected function _getMembers()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$name = IPSText::convertUnicode($this->convertAndMakeSafe($this->request['name'], 0), true);
$name = IPSText::convertCharsets($name, 'utf-8', IPS_DOC_CHAR_SET);
//-----------------------------------------
// Check length
//-----------------------------------------
if (IPSText::mbstrlen($name) < 3) {
$this->returnJsonError('requestTooShort');
}
//-----------------------------------------
// Try query...
//-----------------------------------------
$this->DB->build(array('select' => 'm.members_display_name, m.member_id, m.members_seo_name, m.member_group_id', 'from' => array('members' => 'm'), 'where' => "m.members_l_display_name LIKE '" . $this->DB->addSlashes(strtolower($name)) . "%'", 'order' => $this->DB->buildLength('m.members_display_name') . ' ASC', 'limit' => array(0, 15), 'add_join' => array(array('select' => 'p.*', 'from' => array('profile_portal' => 'p'), 'where' => 'p.pp_member_id=m.member_id', 'type' => 'left'))));
$this->DB->execute();
//-----------------------------------------
// Got any results?
//-----------------------------------------
if (!$this->DB->getTotalRows()) {
$this->returnJsonArray(array());
}
$return = array();
while ($r = $this->DB->fetch()) {
$url = $this->registry->output->buildSEOUrl("app=core&module=modcp&do=editmember&mid={$r['member_id']}", 'public');
$photo = IPSMember::buildProfilePhoto($r);
$group = IPSMember::makeNameFormatted('', $r['member_group_id']);
$return[$r['member_id']] = array('name' => $r['members_display_name'], 'showas' => '<strong>' . $r['members_display_name'] . '</strong> (' . $group . ')', 'img' => $photo['pp_thumb_photo'], 'img_w' => $photo['pp_mini_width'], 'img_h' => $photo['pp_mini_height'], 'url' => $url);
}
$this->returnJsonArray($return);
}
示例2: formatUrl
/**
* Formats the URL (.htaccess SEO, etc)
*
* @access public
* @param string Raw URL
* @param string Any special SEO title passed
* @param string Any special SEO template to use. If none is passed but SEO is enabled, IPB will search all templates for a match
* @return string Formatted URL
*/
public function formatUrl($url, $seoTitle = '', $seoTemplate = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
if (!ipsRegistry::$settings['use_friendly_urls']) {
return $url;
}
$_template = FALSE;
$seoTitle = !empty($seoTitle) && !is_array($seoTitle) ? array($seoTitle) : $seoTitle;
$_seoTitleForCache = is_array($seoTitle) ? implode(';', $seoTitle) : '';
$_md5 = md5($url . $_seoTitleForCache . $seoTemplate);
$_s = '';
$cached = $this->getCachedFurl($_md5);
if (!is_null($cached)) {
return $cached;
}
//-----------------------------------------
// If using URL sessions, fix the URL...
//-----------------------------------------
if (!IN_ACP and strstr($url, 's=')) {
preg_match("/s=([a-zA-Z0-9]{32})(.*?)\$/", $url, $matches);
if (!empty($matches[2])) {
$url = preg_replace("/s=([a-zA-Z0-9]{32})(&|&)/", '', $url);
$_s = $matches[1];
}
if (strstr($url, 's=0')) {
$url = preg_replace("/(\\?|&|;)s=0(&|&)/", '', $url);
$_s = '';
}
}
if ($this->settings['use_friendly_urls'] and is_array($seoTitle) && count($seoTitle)) {
/* SEO Tweak - if default app is forums then don't bother with act=idx nonsense */
if (IPS_DEFAULT_APP == 'forums' and !$this->settings['actidx_override']) {
if (stristr($url, 'act=idx')) {
$url = str_ireplace(array(IPS_PUBLIC_SCRIPT . '?act=idx', '?act=idx', 'act=idx'), '', $url);
}
}
if ($seoTemplate and isset($this->seoTemplates[$seoTemplate])) {
$_template = $seoTemplate;
}
/* Need to search for one - fast? */
if ($_template === FALSE) {
/* Search for one, then. Possibly a bit slower than we'd like! */
foreach ($this->seoTemplates as $key => $data) {
if (stristr(str_replace($this->settings['board_url'], '', $url), $key)) {
$_template = $key;
break;
}
}
}
/* Got one to work with? */
if ($_template !== FALSE) {
if (count($seoTitle) == 1 && (substr($seoTitle[0], 0, 2) == '%%' and substr($seoTitle[0], -2) == '%%')) {
$seoTitle[0] = IPSText::makeSeoTitle(substr($seoTitle[0], 2, -2));
}
/* Do we need to encode? */
if (IPS_DOC_CHAR_SET != 'UTF-8') {
foreach ($seoTitle as $id => $item) {
$seoTitle[$id] = urlencode($item);
}
}
if (count($seoTitle) == 1) {
$replace = str_replace('#{__title__}', IPSText::convertUnicode($seoTitle[0]), $this->seoTemplates[$_template]['out'][1]);
// See http://community.invisionpower.com/resources/bugs.html/_/ip-board/transliteration-r37146
} else {
$replace = $this->seoTemplates[$_template]['out'][1];
foreach ($seoTitle as $id => $item) {
$replace = str_replace('#{__title-' . $id . '__}', IPSText::convertUnicode($item), $replace);
// See http://community.invisionpower.com/resources/bugs.html/_/ip-board/transliteration-r37146
}
}
$url = preg_replace($this->seoTemplates[$_template]['out'][0], $replace, $url);
$_anchor = '';
$__url = $url;
/* Protect html entities */
$url = preg_replace('/&#(\\d)/', "~|~\\1", $url);
if (strstr($url, '&')) {
$restUrl = substr($url, strpos($url, '&'));
$url = substr($url, 0, strpos($url, '&'));
} else {
$restUrl = '';
}
/* Anchor */
if (strstr($restUrl, '#')) {
$_anchor = substr($restUrl, strpos($restUrl, '#'));
$restUrl = substr($restUrl, 0, strpos($restUrl, '#'));
}
switch ($this->settings['url_type']) {
case 'path_info':
if ($this->settings['htaccess_mod_rewrite']) {
//.........這裏部分代碼省略.........
示例3: arrayWalkConvert
/**
* Callback to convert unicode and charset for AJAX requests
*
* @param mixed Value
* @param string Key
* @return @e void
*/
public function arrayWalkConvert(&$value, $key)
{
if (is_string($value)) {
$value = IPSText::convertCharsets(IPSText::convertUnicode($value), "utf-8", IPS_DOC_CHAR_SET);
}
}