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

PHP utf8_strlen函数代码示例

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

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



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

示例1: _preSave

 protected function _preSave()
 {
     $team = $this->_getTeamData();
     if (!$team) {
         $this->error(new XenForo_Phrase('requested_team_not_found'), 'team_id');
     }
     if ($team['user_id'] == $this->get('user_id')) {
         throw new Nobita_Teams_Exception_Abstract("You can't give banning to Owner of Team.", true);
         return false;
     }
     if ($this->isChanged('user_id')) {
         $userBan = $this->_getBanningModel()->getBanningByKeys($team['team_id'], $this->get('user_id'));
         if ($userBan) {
             $this->error(new XenForo_Phrase('this_user_is_already_banned'), 'user_id');
         } else {
             $user = $this->getModelFromCache('XenForo_Model_User')->getUserById($this->get('user_id'));
             if (!$user || $user['is_moderator'] || $user['is_admin']) {
                 $this->error(new XenForo_Phrase('this_user_is_an_admin_or_moderator_choose_another'), 'user_id');
             }
         }
     }
     $reason = trim($this->get('user_reason'));
     if (!utf8_strlen($reason)) {
         $this->error(new XenForo_Phrase('Teams_please_enter_reason_for_ban_user'), 'user_reason');
     } elseif (utf8_strlen($reason) > 255) {
         $this->error(new XenForo_Phrase('please_enter_message_with_no_more_than_x_characters', array('count' => 255)), 'user_reason');
     }
     if (!$this->get('end_date')) {
         throw new Nobita_Teams_Exception_Abstract("Please provide the end date.", true);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:Banning.php


示例2: utf8_str_pad

/**
* Replacement for str_pad. $padStr may contain multi-byte characters.
*
* @author Oliver Saunders <oliver (a) osinternetservices.com>
* @param string $input
* @param int $length
* @param string $padStr
* @param int $type ( same constants as str_pad )
* @return string
* @see http://www.php.net/str_pad
* @see utf8_substr
* @package utf8
* @subpackage strings
*/
function utf8_str_pad($input, $length, $padStr = ' ', $type = STR_PAD_RIGHT)
{
    $inputLen = utf8_strlen($input);
    if ($length <= $inputLen) {
        return $input;
    }
    $padStrLen = utf8_strlen($padStr);
    $padLen = $length - $inputLen;
    if ($type == STR_PAD_RIGHT) {
        $repeatTimes = ceil($padLen / $padStrLen);
        return utf8_substr($input . str_repeat($padStr, $repeatTimes), 0, $length);
    }
    if ($type == STR_PAD_LEFT) {
        $repeatTimes = ceil($padLen / $padStrLen);
        return utf8_substr(str_repeat($padStr, $repeatTimes), 0, floor($padLen)) . $input;
    }
    if ($type == STR_PAD_BOTH) {
        $padLen /= 2;
        $padAmountLeft = floor($padLen);
        $padAmountRight = ceil($padLen);
        $repeatTimesLeft = ceil($padAmountLeft / $padStrLen);
        $repeatTimesRight = ceil($padAmountRight / $padStrLen);
        $paddingLeft = utf8_substr(str_repeat($padStr, $repeatTimesLeft), 0, $padAmountLeft);
        $paddingRight = utf8_substr(str_repeat($padStr, $repeatTimesRight), 0, $padAmountLeft);
        return $paddingLeft . $input . $paddingRight;
    }
    trigger_error('utf8_str_pad: Unknown padding type (' . $type . ')', E_USER_ERROR);
}
开发者ID:01J,项目名称:topm,代码行数:42,代码来源:str_pad.php


示例3: buildCensorCacheValue

 /**
  * Builds the regex and censor cache value for a find/replace pair
  *
  * @param string $find
  * @param string $replace
  *
  * @return array|bool
  */
 public static function buildCensorCacheValue($find, $replace)
 {
     $find = trim(strval($find));
     if ($find === '') {
         return false;
     }
     $prefixWildCard = preg_match('#^\\*#', $find);
     $suffixWildCard = preg_match('#\\*$#', $find);
     $replace = is_int($replace) ? '' : trim(strval($replace));
     if ($replace === '') {
         $replace = utf8_strlen($find);
         if ($prefixWildCard) {
             $replace--;
         }
         if ($suffixWildCard) {
             $replace--;
         }
     }
     $regexFind = $find;
     if ($prefixWildCard) {
         $regexFind = substr($regexFind, 1);
     }
     if ($suffixWildCard) {
         $regexFind = substr($regexFind, 0, -1);
     }
     if (!strlen($regexFind)) {
         return false;
     }
     $regex = '#' . ($prefixWildCard ? '' : '(?<=\\W|^)') . preg_quote($regexFind, '#') . ($suffixWildCard ? '' : '(?=\\W|$)') . '#iu';
     return array('word' => $find, 'regex' => $regex, 'replace' => $replace);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:39,代码来源:CensorWords.php


示例4: validate

 public function validate()
 {
     $this->language->load('module/pim_localfilesystem');
     $error = array();
     if (utf8_strlen($this->request->post['alias']) < 1 || utf8_strlen($this->request->post['alias']) > 64) {
         $error['error_localfilesystem_alias'] = $this->language->get('error_localfilesystem_alias');
     } else {
         if (!isset($this->request->get['alias']) || isset($this->request->get['alias']) && $this->request->get['alias'] != $this->request->post['alias']) {
             // check if this volume alias already exist.
             $current_volumes = $this->config->get('pim_volumes');
             if (!empty($current_volumes) && is_array($current_volumes)) {
                 foreach ($current_volumes as $key => $volume) {
                     if (is_array($volume)) {
                         foreach ($volume as $vkey => $val) {
                             if ($vkey == $this->request->post['alias']) {
                                 $error['error_alias_exist'] = $this->language->get('error_alias_exist');
                             }
                         }
                     }
                 }
             }
         }
     }
     if (utf8_strlen($this->request->post['path']) < 1 || utf8_strlen($this->request->post['path']) > 600) {
         $error['error_localfilesystem_path'] = $this->language->get('error_localfilesystem_path');
     }
     return $error;
 }
开发者ID:vincentgy,项目名称:rubys,代码行数:28,代码来源:pim_localfilesystem.php


示例5: utf8_strrpos

function utf8_strrpos($string, $needle, $offset = NULL) {
	if (is_null($offset)) {
		$data = explode($needle, $string);

		if (count($data) > 1) {
			array_pop($data);

			$string = join($needle, $data);

			return utf8_strlen($string);
		}

		return false;
	} else {
		if (!is_int($offset)) {
			trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);

			return false;
		}

		$string = utf8_substr($string, $offset);

		if (false !== ($position = utf8_strrpos($string, $needle))) {
			return $position + $offset;
		}

		return false;
	}
}
开发者ID:halfhope,项目名称:ocStore,代码行数:29,代码来源:utf8.php


示例6: index

 public function index($setting = false)
 {
     if (!$setting || !$this->config->get('tracking_input_status') || $setting['language_id'] != $this->config->get('config_language_id') || isset($this->session->data['tracking_input_show']) && !$this->session->data['tracking_input_show'] || $this->config->get('tracking_input_no_cookie_only') && (isset($this->request->request['tracking']) || isset($this->request->cookie['tracking'])) || $this->config->get('tracking_input_show') == 'once' && isset($this->request->cookie['__octfsh__']) && (!isset($this->session->data['tracking_input_show']) || !$this->session->data['tracking_input_show'])) {
         return '';
     }
     $this->document->addScript('catalog/view/javascript/triyp.min.js');
     //$this->document->addScript('catalog/view/javascript/triyp.js');
     $this->session->data['tracking_input_show'] = true;
     if ($this->config->get('tracking_input_show') == 'once') {
         setcookie('__octfsh__', '1', time() + 2592000, '/');
     }
     $data['show_close_button'] = $this->config->get('tracking_input_show_close_button');
     $data['image_close'] = file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/image/close.png') ? 'catalog/view/theme/' . $this->config->get('config_template') . '/image/close.png' : 'catalog/view/theme/default/image/close.png';
     $data['image_loading'] = file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/image/loading.gif') ? 'catalog/view/theme/' . $this->config->get('config_template') . '/image/loading.gif' : 'catalog/view/theme/default/image/loading.gif';
     $data['send_link'] = html_entity_decode($this->url->link('module/tracking_input/send', '', isset($this->request->server['HTTPS']) && $this->request->server['HTTPS'] == 'on' ? 'SSL' : 'NONSSL'), ENT_QUOTES, 'UTF-8');
     $data['close_link'] = html_entity_decode($this->url->link('module/tracking_input/close', '', isset($this->request->server['HTTPS']) && $this->request->server['HTTPS'] == 'on' ? 'SSL' : 'NONSSL'), ENT_QUOTES, 'UTF-8');
     $data['text_thankyou'] = isset($setting['text_thankyou']) && utf8_strlen($setting['text_thankyou']) > 0 ? addcslashes(str_replace(array("\r\n", "\n", "\r"), array(' ', ' ', ' '), html_entity_decode($setting['text_thankyou'], ENT_QUOTES, 'UTF-8')), "'") : '';
     $data['error_message'] = isset($setting['error_message']) && utf8_strlen($setting['error_message']) > 0 ? addcslashes(str_replace(array("\r\n", "\n", "\r"), array(' ', ' ', ' '), html_entity_decode($setting['error_message'], ENT_QUOTES, 'UTF-8')), "'") : '';
     $data['json'] = array();
     foreach (array('send_link', 'close_link', 'text_thankyou', 'error_message') as $_v) {
         $data['json'][$_v] = $data[$_v];
     }
     $data['json'] = json_encode($data['json']);
     $data['text_message'] = html_entity_decode($setting['text'], ENT_QUOTES, 'UTF-8');
     $data['text_heading'] = html_entity_decode($setting['text_heading'], ENT_QUOTES, 'UTF-8');
     $data['send_button'] = $setting['button'];
     $this->language->load('affiliate/tracking_input');
     $data['text_loading'] = $this->language->get('text_please_wait');
     $_tpl = '/template/module/tracking_input_' . (isset($setting['template']) ? $setting['template'] : 'default_' . (substr($setting['position'], 0, 3) === 'col' ? 'column' : 'row')) . '.tpl';
     $_tpl = (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $_tpl) ? $this->config->get('config_template') : 'default') . $_tpl;
     return $this->load->view($_tpl, $data);
 }
开发者ID:pedrocones,项目名称:store,代码行数:32,代码来源:tracking_input.php


示例7: _preSave

 protected function _preSave()
 {
     if ($this->isChanged('req_message')) {
         $reqMessage = $this->get('req_message');
         $maxLength = 140;
         $reqMessage = preg_replace('/\\r?\\n/', ' ', $reqMessage);
         if (utf8_strlen($reqMessage) > $maxLength) {
             $this->error(new XenForo_Phrase('please_enter_message_with_no_more_than_x_characters', array('count' => $maxLength)), 'req_message');
         }
         $this->set('req_message', $reqMessage);
     }
     $maxTeams = 999;
     // secure?
     if ($this->isInsert()) {
         if ($this->_getMemberModel()->countAllTeamsForUser($this->get('user_id')) >= $maxTeams) {
             $this->error(new XenForo_Phrase('Teams_you_only_join_x_teams', array('max' => $maxTeams)));
         }
     }
     if ($this->get('user_id')) {
         $user = $this->_getUserModel()->getUserById($this->get('user_id'));
         if ($user) {
             $this->set('username', $user['username']);
         } else {
             $this->set('user_id', 0);
         }
     }
     if ($this->get('action_user_id')) {
         $user = $this->_getUserModel()->getUserById($this->get('action_user_id'));
         if ($user) {
             if ($user['username'] != $this->get('action_username')) {
                 $this->set('action_username', $user['username']);
             }
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:35,代码来源:Member.php


示例8: validate_password

function validate_password($password)
{
    global $pwd_policy;
    if (isset($pwd_policy)) {
        // Set up regular expressions.  Use p{Ll} instead of [a-z] etc.
        // to make sure accented characters are included
        $pattern = array('alpha' => '/\\p{L}/', 'lower' => '/\\p{Ll}/', 'upper' => '/\\p{Lu}/', 'numeric' => '/\\p{N}/', 'special' => '/[^\\p{L}|\\p{N}]/');
        // Check for conformance to each rule
        foreach ($pwd_policy as $rule => $value) {
            switch ($rule) {
                case 'length':
                    if (utf8_strlen($password) < $pwd_policy[$rule]) {
                        return FALSE;
                    }
                    break;
                default:
                    // turn on Unicode matching
                    $pattern[$rule] .= 'u';
                    $n = preg_match_all($pattern[$rule], $password, $matches);
                    if ($n === FALSE || $n < $pwd_policy[$rule]) {
                        return FALSE;
                    }
                    break;
            }
        }
    }
    // Everything is OK
    return TRUE;
}
开发者ID:ailurus1991,项目名称:MRBS,代码行数:29,代码来源:edit_users.php


示例9: validate

 public function validate()
 {
     if (utf8_strlen($this->request->post['email']) > 96 || !preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $this->request->post['email'])) {
         $this->error['email'] = $this->language->get('error_email');
     }
     return !$this->error;
 }
开发者ID:agyrafa,项目名称:module-newsletter-opencart,代码行数:7,代码来源:newsletter.php


示例10: explodeTags

 public static function explodeTags($tagsStr)
 {
     // sondh@2013-03-27
     // process the string manually to make sure unicode character works
     $len = utf8_strlen($tagsStr);
     $tags = array();
     $start = 0;
     $i = 0;
     while ($i <= $len) {
         if ($i < $len) {
             $char = utf8_substr($tagsStr, $i, 1);
         } else {
             $char = false;
         }
         if ($char === false or preg_match('/^' . Tinhte_XenTag_Constants::REGEX_SEPARATOR . '$/', $char)) {
             // this is a separator
             $tagLen = $i - $start;
             if ($tagLen > 0) {
                 $tags[] = utf8_substr($tagsStr, $start, $tagLen);
             }
             // skip the separator for the next tag
             $start = $i + 1;
         } else {
             // this is some other character
         }
         $i++;
     }
     return $tags;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:29,代码来源:Helper.php


示例11: update

 public static function update($targetClass, $targetPath, $sourceClass, $sourcesContents)
 {
     $targetContents = str_replace($sourceClass, $targetClass, $sourcesContents);
     $php = '<?php';
     $pos = utf8_strpos($targetContents, $php);
     if ($pos !== false) {
         $replacement = sprintf("%s\n\n// updated by %s at %s", $php, __CLASS__, date('c'));
         $targetContents = utf8_substr_replace($targetContents, $replacement, $pos, utf8_strlen($php));
     }
     $classPrefix = substr($targetClass, 0, strpos($targetClass, 'ShippableHelper_'));
     $offset = 0;
     while (true) {
         if (!preg_match('#DevHelper_Helper_ShippableHelper_[a-zA-Z_]+#', $targetContents, $matches, PREG_OFFSET_CAPTURE, $offset)) {
             break;
         }
         $siblingSourceClass = $matches[0][0];
         $offset = $matches[0][1];
         $siblingTargetClass = str_replace('DevHelper_Helper_', $classPrefix, $siblingSourceClass);
         $targetContents = substr_replace($targetContents, $siblingTargetClass, $offset, strlen($siblingSourceClass));
         class_exists($siblingTargetClass);
         $offset += 1;
     }
     $targetContents = preg_replace('#\\* @version \\d+\\s*\\n#', '$0 * @see ' . $sourceClass . "\n", $targetContents, -1, $count);
     return DevHelper_Generator_File::filePutContents($targetPath, $targetContents);
 }
开发者ID:maitandat1507,项目名称:DevHelper,代码行数:25,代码来源:ShippableHelper.php


示例12: IsCorrectLenght

 public static function IsCorrectLenght($text, $min, $max)
 {
     if (utf8_strlen($text) < $min || utf8_strlen($text) > $max) {
         return false;
     }
     return true;
 }
开发者ID:akrex,项目名称:taskmanager,代码行数:7,代码来源:validator.php


示例13: validate_configure

 public function validate_configure()
 {
     $json = array();
     if ($this->request->post['database'] == 'mysqli') {
         $connection = @new mysqli($this->request->post['database_hostname'], $this->request->post['database_username'], $this->request->post['database_password'], $this->request->post['database_name']);
         if ($connection->connect_error) {
             $json['error'] = $connection->connect_error;
         } else {
             $connection->close();
         }
     }
     if ($this->request->post['database'] == 'mysql') {
         $connection = @mysql_connect($this->request->post['database_hostname'], $this->request->post['database_username'], $this->request->post['database_password']);
         if (!$connection) {
             $json['error'] = $this->language->get('error_connection');
         } else {
             if (!@mysql_select_db($this->request->post['database_name'], $connection)) {
                 $json['error'] = $this->language->get('error_database');
             }
             mysql_close($connection);
         }
     }
     if (utf8_strlen($this->request->post['admin_username']) < 3 || utf8_strlen($this->request->post['admin_username']) > 32) {
         $json['error'] = $this->language->get('error_username');
     }
     if (utf8_strlen($this->request->post['admin_password']) < 6 || utf8_strlen($this->request->post['admin_password']) > 25) {
         $json['error'] = $this->language->get('error_password');
     }
     if (utf8_strlen($this->request->post['admin_email']) > 96 || !preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $this->request->post['admin_email'])) {
         $json['error'] = $this->language->get('error_email');
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput(json_encode($json));
 }
开发者ID:mehulsbhatt,项目名称:Logic-Invoice,代码行数:34,代码来源:install.php


示例14: convertEditorHtmlToBbCode

 /**
  * Converts WYSIWYG editor HTML back to BB code
  *
  * @param string $messageTextHtml HTML to convert
  * @param XenForo_Input $input
  * @param integer $htmlCharacterLimit Max length of HTML before processing; defaults to 4 * message length option
  *
  * @return string BB code input
  */
 public function convertEditorHtmlToBbCode($messageTextHtml, XenForo_Input $input, $htmlCharacterLimit = -1)
 {
     if ($htmlCharacterLimit < 0) {
         $htmlCharacterLimit = 4 * XenForo_Application::get('options')->messageMaxLength;
         // quadruple the limit as HTML can be a lot more verbose
     }
     if ($htmlCharacterLimit && utf8_strlen($messageTextHtml) > $htmlCharacterLimit) {
         throw new XenForo_Exception(new XenForo_Phrase('submitted_message_is_too_long_to_be_processed'), true);
     }
     $options = array();
     $requestPaths = XenForo_Application::get('requestPaths');
     $options['baseUrl'] = $requestPaths['fullBasePath'];
     $relativeResolver = $input->filterSingle('_xfRelativeResolver', XenForo_Input::STRING);
     if ($relativeResolver && isset($_SERVER['HTTP_USER_AGENT'])) {
         if (preg_match('#Firefox/([0-9]+)\\.([0-9]+)\\.([0-9]+)#i', $_SERVER['HTTP_USER_AGENT'], $match)) {
             // FF versions sometime before 3.6.12 have an issue with respecting the base tag of the editor,
             // 3.6.8 is a known version that has problems
             $useResolver = $match[1] <= 3 && $match[2] <= 6 && $match[3] <= 8;
         } else {
             $useResolver = false;
         }
         if ($useResolver) {
             // take off query string and then up to the last directory
             $relativeResolver = preg_replace('/\\?.*$/', '', $relativeResolver);
             $relativeResolver = preg_replace('#/[^/]+$#', '', $relativeResolver);
             $options['baseUrl'] = $relativeResolver;
         }
     }
     $rendered = XenForo_Html_Renderer_BbCode::renderFromHtml($messageTextHtml, $options);
     return trim(XenForo_Input::cleanString($rendered));
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:40,代码来源:Editor.php


示例15: formatUserNameMobile

function formatUserNameMobile($ID, $login, $realname, $firstname, $link = 0, $cut = 0)
{
    global $CFG_GLPI;
    $before = "";
    $after = "";
    $viewID = "";
    if (strlen($realname) > 0) {
        $temp = $realname;
        if (strlen($firstname) > 0) {
            if ($CFG_GLPI["names_format"] == FIRSTNAME_BEFORE) {
                $temp = $firstname . " " . $temp;
            } else {
                $temp .= " " . $firstname;
            }
        }
        if ($cut > 0 && utf8_strlen($temp) > $cut) {
            $temp = utf8_substr($temp, 0, $cut);
            $temp .= " ...";
        }
    } else {
        $temp = $login;
    }
    if ($ID > 0 && (strlen($temp) == 0 || $_SESSION["glpiis_ids_visible"])) {
        $viewID = "&nbsp;({$ID})";
    }
    if ($link == 1 && $ID > 0) {
        /*$before="<a title=\"".$temp."\"
          href=\"".$CFG_GLPI["root_doc"]."/front/user.form.php?id=".$ID."\">";*/
        $before = "<a title=\"" . $temp . "\"\n                  href=\"item.php?itemtype=user&menu=" . $_GET['menu'] . "&ssmenu=" . $_GET['ssmenu'] . "&id=" . $ID . "\" data-back='false'>";
        $after = "</a>";
    }
    //$username=$before.$temp.$viewID.$after;
    $username = $temp . $viewID;
    return $username;
}
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:35,代码来源:common.function.php


示例16: actionGetFind

 public function actionGetFind()
 {
     $users = array();
     $username = $this->_input->filterSingle('username', XenForo_Input::STRING);
     $email = $this->_input->filterSingle('user_email', XenForo_Input::STRING);
     if (empty($email)) {
         // backward compatibility
         $email = $this->_input->filterSingle('email', XenForo_Input::STRING);
     }
     if (XenForo_Helper_Email::isEmailValid($email)) {
         $visitor = XenForo_Visitor::getInstance();
         $session = bdApi_Data_Helper_Core::safeGetSession();
         if ($visitor->hasAdminPermission('user') && $session->checkScope(bdApi_Model_OAuth2::SCOPE_MANAGE_SYSTEM)) {
             // perform email search only if visitor is an admin and granted admincp scope
             $user = $this->_getUserModel()->getUserByEmail($email);
             if (!empty($user)) {
                 $users[$user['user_id']] = $user;
             }
         }
     }
     if (empty($users) && utf8_strlen($username) >= 2) {
         // perform username search only if nothing found and username is long enough
         $users = $this->_getUserModel()->getUsers(array('username' => array($username, 'r')), array('limit' => 10));
     }
     $data = array('users' => $this->_filterDataMany($this->_getUserModel()->prepareApiDataForUsers($users)));
     return $this->responseData('bdApi_ViewData_User_Find', $data);
 }
开发者ID:sushj,项目名称:bdApi,代码行数:27,代码来源:User.php


示例17: toExternalUrl

 /**
  * @param string $internalUrl
  * @return mixed The URL to access the target file from outside, if available, or FALSE.
  */
 public static function toExternalUrl($internalUrl)
 {
     $currentProc = ProcManager::getInstance()->getCurrentProcess();
     if ($currentProc) {
         $checknum = $currentProc->getChecknum();
     } else {
         $checknum = -1;
     }
     $urlParts = AdvancedPathLib::parse_url($internalUrl);
     if ($urlParts === false) {
         return $internalUrl;
     }
     if ($urlParts['scheme'] === EyeosAbstractVirtualFile::URL_SCHEME_SYSTEM) {
         // EXTERN
         try {
             $externPath = AdvancedPathLib::resolvePath($urlParts['path'], '/extern', AdvancedPathLib::OS_UNIX | AdvancedPathLib::RESOLVEPATH_RETURN_REFDIR_RELATIVE);
             return 'index.php?extern=' . $externPath;
         } catch (Exception $e) {
         }
         // APPS
         try {
             $appPath = AdvancedPathLib::resolvePath($urlParts['path'], '/apps', AdvancedPathLib::OS_UNIX | AdvancedPathLib::RESOLVEPATH_RETURN_REFDIR_RELATIVE);
             $appName = utf8_substr($appPath, 1, utf8_strpos($appPath, '/', 1));
             $appFile = utf8_substr($appPath, utf8_strlen($appName) + 1);
             return 'index.php?checknum=' . $checknum . '&appName=' . $appName . '&appFile=' . $appFile;
         } catch (Exception $e) {
         }
         return $internalUrl;
     }
     //TODO
     return $internalUrl;
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:36,代码来源:EyeosUrlTranslator.php


示例18: validateForm

 protected function validateForm()
 {
     if (utf8_strlen(trim($this->request->post['fullname'])) < 2 || utf8_strlen(trim($this->request->post['fullname'])) > 32) {
         $this->error['fullname'] = $this->language->get('error_fullname');
     }
     if ($this->request->post['password'] || !isset($this->request->get['user_id'])) {
         if (utf8_strlen($this->request->post['password']) < 4 || utf8_strlen($this->request->post['password']) > 20) {
             $this->error['password'] = $this->language->get('error_password');
         }
         if ($this->request->post['password'] != $this->request->post['confirm']) {
             $this->error['confirm'] = $this->language->get('error_confirm');
         }
     }
     if (!preg_match('/1[123456789]{1}\\d{9}$/', $this->request->post['telephone'])) {
         $this->error['telephone'] = $this->language->get('error_telephone');
     }
     if (utf8_strlen(trim($this->request->post['shipping_telephone'])) < 8 || utf8_strlen(trim($this->request->post['shipping_telephone'])) > 14) {
         $this->error['shipping_telephone'] = $this->language->get('error_shipping_telephone');
     }
     if (utf8_strlen(trim($this->request->post['address'])) < 3 || utf8_strlen(trim($this->request->post['address'])) > 128) {
         $this->error['address'] = $this->language->get('error_address');
     }
     if (utf8_strlen(trim($this->request->post['city'])) < 2 || utf8_strlen(trim($this->request->post['city'])) > 128) {
         $this->error['city'] = $this->language->get('error_city');
     }
     $this->load->model('localisation/country');
     $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
     if ($country_info && $country_info['postcode_required'] && (utf8_strlen(trim($this->request->post['postcode'])) < 2 || utf8_strlen(trim($this->request->post['postcode'])) > 10)) {
         $this->error['postcode'] = $this->language->get('error_postcode');
     }
     if ($this->request->post['country_id'] == '') {
         $this->error['country'] = $this->language->get('error_country');
     }
     if (!isset($this->request->post['zone_id']) || $this->request->post['zone_id'] == '') {
         $this->error['zone'] = $this->language->get('error_zone');
     }
     // 身份认证图片上check
     // 		if (!isset($this->request->post['filename']) || $this->request->post['filename']  == '') {
     // 			$this->error['identity_img'] = $this->language->get('error_identity_img');
     // 		}
     // Add sangsanghu 2015/09/11 ST
     if (isset($this->request->post['sub_commission_def_percent']) && isset($this->request->post['sub_settle_suspend_days'])) {
         if (!$this->request->post['sub_commission_def_percent']) {
             $this->error['sub_commission_def_percent'] = $this->language->get('error_commission_def_percent');
         } else {
             if (!preg_match('/^[0-9]*[1-9][0-9]*$/', $this->request->post['sub_commission_def_percent']) || $this->request->post['sub_commission_def_percent'] > $this->model_salesman_user->getParentCommission()) {
                 $this->error['sub_commission_def_percent'] = sprintf($this->language->get('error_commission_def_percent0'), $this->model_salesman_user->getParentCommission() . "%");
             }
         }
         if (!$this->request->post['sub_settle_suspend_days']) {
             $this->error['sub_settle_suspend_days'] = $this->language->get('error_settle_suspend_days');
         } else {
             if (!preg_match('/^[0-9]*[1-9][0-9]*$/', $this->request->post['sub_settle_suspend_days'])) {
                 $this->error['sub_settle_suspend_days'] = $this->language->get('error_settle_suspend_days0');
             }
         }
     }
     // Add sangsanghu 2015/09/11 END
     return !$this->error;
 }
开发者ID:menghaosha,项目名称:opencart_test,代码行数:60,代码来源:user.php


示例19: newProductBacklog

 function newProductBacklog()
 {
     global $agilemantis_au;
     // Check if team-user name fits into MantisBT regulations
     if (!(utf8_strlen($this->name) < 22 && user_is_name_valid($this->name) && user_is_name_unique($this->name))) {
         return null;
     }
     $p_username = $this->generateTeamUser($this->name);
     $p_email = $this->email;
     $p_email = trim($p_email);
     $t_seed = $p_email . $p_username;
     $t_password = auth_generate_random_password($t_seed);
     if (user_is_name_unique($p_username) === true) {
         user_create($p_username, $t_password, $p_email, 55, false, true, 'Team-User-' . $_POST['pbl_name']);
     } else {
         $t_user_id = $this->getUserIdByName($p_username);
         user_set_field($t_user_id, 'email', $p_email);
     }
     $user_id = $this->getLatestUser();
     $agilemantis_au->setAgileMantisUserRights($user_id, 1, 0, 0);
     if ($this->team == 0) {
         $this->team = $this->getLatestUser();
     }
     $t_sql = "INSERT INTO gadiv_productbacklogs (name, description, user_id) VALUES ( " . db_param(0) . ", " . db_param(1) . ", " . db_param(2) . ") ";
     $t_params = array($this->name, $this->description, $user_id);
     db_query_bound($t_sql, $t_params);
     $this->id = db_insert_id("gadiv_productbacklogs");
     $this->user_id = $user_id;
     return $this->id;
 }
开发者ID:CarlosPinedaT,项目名称:agileMantis,代码行数:30,代码来源:class_product_backlog.php


示例20: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     /**
      * fixes some anoying issues with noflood not detecting user flooding the chat
      * those are notice and invite
      */
     $cmdtocheck = array("send", "nick", "me", "notice", "invite");
     // fixes the count of noflood even if the text posted was empty (Neumann Valle (UTAN))
     if (in_array($this->name, $cmdtocheck) && $param != "") {
         $container =& pfcContainer::Instance();
         $nickid = $u->nickid;
         $isadmin = $container->getUserMeta($nickid, 'isadmin');
         $lastfloodtime = $container->getUserMeta($nickid, 'floodtime');
         $flood_nbmsg = $container->getUserMeta($nickid, 'flood_nbmsg');
         $flood_nbchar = $container->getUserMeta($nickid, 'flood_nbchar');
         $floodtime = time();
         if ($floodtime - $lastfloodtime <= $c->proxies_cfg[$this->proxyname]["delay"]) {
             // update the number of posted message indicator
             $flood_nbmsg++;
             // update the number of posted characteres indicator
             $flood_nbchar += utf8_strlen($param);
         } else {
             $flood_nbmsg = 0;
             $flood_nbchar = 0;
         }
         if (!$isadmin && ($flood_nbmsg > $c->proxies_cfg[$this->proxyname]["msglimit"] || $flood_nbchar > $c->proxies_cfg[$this->proxyname]["charlimit"])) {
             // warn the flooder
             $msg = _pfc("Please don't post so many message, flood is not tolerated");
             $xml_reponse->script("alert('" . addslashes($msg) . "');");
             // kick the flooder
             $cmdp = $p;
             $cmdp["param"] = null;
             $cmdp["params"][0] = "ch";
             $cmdp["params"][1] = $u->channels[$recipientid]["name"];
             $cmdp["params"][2] .= _pfc("kicked from %s by %s", $u->channels[$recipientid]["name"], "noflood");
             $cmd =& pfcCommand::Factory("leave");
             $cmd->run($xml_reponse, $cmdp);
             return false;
         }
         if ($flood_nbmsg == 0) {
             $container->setUserMeta($nickid, 'floodtime', $floodtime);
         }
         $container->setUserMeta($nickid, 'flood_nbmsg', $flood_nbmsg);
         $container->setUserMeta($nickid, 'flood_nbchar', $flood_nbchar);
     }
     // forward the command to the next proxy or to the final command
     $p["clientid"] = $clientid;
     $p["param"] = $param;
     $p["sender"] = $sender;
     $p["recipient"] = $recipient;
     $p["recipientid"] = $recipientid;
     return $this->next->run($xml_reponse, $p);
 }
开发者ID:ho96,项目名称:yii2-phpfreechat,代码行数:60,代码来源:noflood.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP utf8_strpos函数代码示例发布时间:2022-05-23
下一篇:
PHP utf8_stristr函数代码示例发布时间: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