当前位置: 首页>>代码示例>>PHP>>正文


PHP get_mb_substr函数代码示例

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


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

示例1: transferCategories

 function transferCategories()
 {
     $sSql = "SELECT \r\n        \t\t\t`CategoryID` AS `id`, \r\n        \t\t\t`CategoryName` AS `name`\r\n        \t\tFROM `ArticlesCategory`";
     $rResult = mysql_query($sSql, $this->rOldDb);
     $iCount = mysql_num_rows($rResult);
     while ($aCategory = mysql_fetch_assoc($rResult)) {
         if (get_mb_len($aCategory['name']) > 32) {
             $aCategory['name'] = get_mb_substr($aCategory['name'], 0, 32);
         }
         if ($this->existsCategory($aCategory['name'], 0, $this->_sType)) {
             continue;
         }
         //escape all values
         $aCategory['name'] = $this->oMigrationModule->_oDb->escape($aCategory['name']);
         $sSql = "INSERT INTO `sys_categories`(`Category`, `ID`, `Type`, `Owner`, `Status`, `Date`)\r\n            \t\t VALUES('" . $aCategory['name'] . "', '0', '" . $this->_sType . "', '0', 'active', NOW())";
         $iResult = (int) $this->oDolModule->_oDb->query($sSql);
         if ($iResult <= 0) {
             $this->setResultStatus('Database error. Cannot insert category in the database.');
             return MIGRATION_FAILED;
         }
     }
     return MIGRATION_SUCCESSFUL;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:23,代码来源:BxDataMigrationArticles.php

示例2: __construct

 /**
  * Constructor
  * $sSystem - comments system name
  * $iId - obect id to be commented
  */
 function __construct($sSystem, $iId, $iInit = 1)
 {
     parent::__construct();
     $this->_aSystems = $this->getSystems();
     if (!isset($this->_aSystems[$sSystem])) {
         return;
     }
     $this->_sSystem = $sSystem;
     $this->_aSystem = $this->_aSystems[$sSystem];
     $this->_aSystem['table_images'] = 'sys_cmts_images';
     $this->_aSystem['table_images2entries'] = 'sys_cmts_images2entries';
     $this->_aSystem['table_ids'] = 'sys_cmts_ids';
     $this->_aSystem['is_browse_filter'] = (int) $this->_bBrowseFilter;
     $this->_iDpMaxLevel = (int) $this->_aSystem['number_of_levels'];
     $this->_sDisplayType = $this->_iDpMaxLevel == 0 ? BX_CMT_DISPLAY_FLAT : BX_CMT_DISPLAY_THREADED;
     $this->_sDpSessionKey = 'bx_' . $this->_sSystem . '_dp_';
     $this->_sBrowseType = $this->_aSystem['browse_type'];
     $this->_sBrowseFilter = BX_CMT_FILTER_ALL;
     $this->_sBpSessionKeyType = 'bx_' . $this->_sSystem . '_bpt_';
     $this->_sBpSessionKeyFilter = 'bx_' . $this->_sSystem . '_bpf_';
     $this->_aOrder = array('by' => BX_CMT_ORDER_BY_DATE, 'way' => BX_CMT_ORDER_WAY_ASC);
     list($mixedUserDp, $mixedUserBpType, $mixedUserBpFilter) = $this->_getUserChoice();
     if (!empty($mixedUserDp)) {
         $this->_sDisplayType = $mixedUserDp;
     }
     if (!empty($mixedUserBpType)) {
         $this->_sBrowseType = $mixedUserBpType;
     }
     if (!empty($mixedUserBpFilter)) {
         $this->_sBrowseFilter = $mixedUserBpFilter;
     }
     $this->_sViewUrl = BX_DOL_URL_ROOT . 'cmts.php';
     $this->_sBaseUrl = BxDolPermalinks::getInstance()->permalink($this->_aSystem['base_url']);
     if (get_mb_substr($this->_sBaseUrl, 0, 4) != 'http') {
         $this->_sBaseUrl = BX_DOL_URL_ROOT . $this->_sBaseUrl;
     }
     $this->_sListAnchor = "cmts-anchor-%s-%d";
     $this->_oQuery = new BxDolCmtsQuery($this);
     $this->_sFormObject = 'sys_comment';
     $this->_sFormDisplayPost = 'sys_comment_post';
     $this->_sFormDisplayEdit = 'sys_comment_edit';
     $this->_sConnObjFriends = 'sys_profiles_friends';
     $this->_sConnObjSubscriptions = 'sys_profiles_subscriptions';
     $this->_sMenuObjManage = 'sys_cmts_item_manage';
     $this->_sMenuObjActions = 'sys_cmts_item_actions';
     $this->_sMetatagsObj = 'sys_cmts';
     if ($iInit) {
         $this->init($iId);
     }
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:55,代码来源:BxDolCmts.php

示例3: uriGenerate

function uriGenerate($s, $sTable, $sField, $iMaxLen = 255)
{
    $s = uriFilter($s);
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add date
    if (get_mb_len($s) > 240) {
        $s = get_mb_substr($s, 0, 240);
    }
    $s .= '-' . date('Y-m-d');
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add number
    for ($i = 0; $i < 999; ++$i) {
        if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) {
            return $s . '-' . $i;
        }
    }
    return rand(0, 999999999);
}
开发者ID:blas-dmx,项目名称:dolphin.pro,代码行数:22,代码来源:utils.inc.php

示例4: uriGenerate

function uriGenerate($s, $sTable, $sField, $iMaxLen = 255)
{
    //$s = get_mb_replace ('/[^\pL^\pN]+/u', '-', $s); // unicode characters
    $s = get_mb_replace('/([^\\d^\\w]+)/', '-', $s);
    // latin characters
    $s = get_mb_replace('/([-^]+)/', '-', $s);
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add date
    if (get_mb_len($s) > 240) {
        $s = get_mb_substr($s, 0, 240);
    }
    $s .= '-' . date('Y-m-d');
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add number
    for ($i = 0; $i < 999; ++$i) {
        if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) {
            return $s . '-' . $i;
        }
    }
    return rand(0, 999999999);
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:25,代码来源:utils.inc.php

示例5: uriGenerate

function uriGenerate($s, $sTable, $sField, $sEmpty = '-')
{
    $s = uriFilter($s, $sEmpty);
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // cut off redundant part
    if (get_mb_len($s) > 240) {
        $s = get_mb_substr($s, 0, 240);
    }
    // try to add date
    $s .= '-' . date('Y-m-d');
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add number
    for ($i = 0; $i < 999; ++$i) {
        if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) {
            return $s . '-' . $i;
        }
    }
    return rand(0, 999999999);
}
开发者ID:blas-dmx,项目名称:trident,代码行数:23,代码来源:utils.inc.php

示例6: getCorrectUri

 function getCorrectUri($sCaption, $iOwnerId = 0, $bCheck = true)
 {
     $sUri = uriFilter($sCaption);
     if (!$sUri) {
         $sUri = '-';
     }
     if (!$bCheck) {
         return $sUri;
     }
     if ($this->checkUriUniq($sUri, $iOwnerId)) {
         return $sUri;
     }
     if (get_mb_len($sUri) > 240) {
         $sUri = get_mb_substr($sUri, 0, 240);
     }
     $sUri .= '-' . date('Y-m-d');
     if ($this->checkUriUniq($sUri, $iOwnerId)) {
         return $sUri;
     }
     for ($i = 0; $i < 999; ++$i) {
         if ($this->checkUriUniq($sUri . '-' . $i, $iOwnerId)) {
             return $sUri . '-' . $i;
         }
     }
     return time();
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:26,代码来源:BxDolAlbums.php


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