本文整理汇总了PHP中uriFilter函数的典型用法代码示例。如果您正苦于以下问题:PHP uriFilter函数的具体用法?PHP uriFilter怎么用?PHP uriFilter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uriFilter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: serviceSetAvatar
function serviceSetAvatar($iPhotoID, $iAuthorId = 0)
{
if (!$iAuthorId) {
$iAuthorId = getLoggedId();
}
$aFileInfo = $this->_oDb->getFileInfo(array('fileId' => $iPhotoID));
$sProfileAlbumUri = uriFilter(str_replace('{nickname}', getUsername($iAuthorId), $this->_oConfig->getGlParam('profile_album_name')));
if ($sProfileAlbumUri != $aFileInfo['albumUri']) {
return false;
}
return $this->_oDb->setAvatar($iPhotoID, $aFileInfo['albumId']);
}
示例3: getBlockCode_ProfilePhotos
function getBlockCode_ProfilePhotos()
{
list($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3) = $this->aAddParams;
if ($sParamValue != 'owner') {
return '';
}
$oSearch = $this->getSearchObject();
$oSearch->aCurrent['restriction']['album'] = array('value' => '', 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
$oSearch->aCurrent['restriction']['album_owner'] = array('value' => '', 'field' => 'Owner', 'operator' => '=', 'paramName' => 'albumOwner', 'table' => 'sys_albums');
$sUri = uriFilter(str_replace('{nickname}', $sParamValue1, $this->oConfig->getGlParam('profile_album_name')));
$aParams = array('album' => $sUri, 'owner' => $this->iOwnerId);
$aCustom = array('per_page' => $this->oConfig->getGlParam('number_top'), 'simple_paginate' => FALSE);
$aHtml = $oSearch->getBrowseBlock($aParams, $aCustom);
return array($aHtml['code'], $aHtml['menu_top'], $aHtml['menu_bottom'], '');
}
示例4: _getMediaAlbumsArray
function _getMediaAlbumsArray($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false)
{
switch ($sType) {
case 'photo':
$sModuleName = 'photos';
$sType = 'bx_photos';
$sMemAction = 'BX_PHOTOS_VIEW';
break;
case 'video':
$sModuleName = 'videos';
$sType = 'bx_videos';
$sMemAction = 'BX_VIDEOS_VIEW';
break;
case 'music':
$sModuleName = 'sounds';
$sType = 'bx_sounds';
$sMemAction = 'BX_SOUNDS_VIEW';
break;
default:
return array();
}
if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) {
return array();
}
bx_import('BxDolMemberInfo');
$oMemberInfo = BxDolMemberInfo::getObjectInstance(getParam('sys_member_info_thumb'));
$isSetAvatarFromDefaultAlbumOnly = $oMemberInfo->isSetAvatarFromDefaultAlbumOnly();
bx_import('BxDolAlbums');
$o = new BxDolAlbums($sType, (int) $iIdProfile);
$aList = $o->getAlbumList(array('owner' => (int) $iIdProfile, 'show_empty' => $isShowEmptyAlbums), 1, 1000);
$aRet = array();
foreach ($aList as $r) {
if (!BxDolService::call($sModuleName, 'get_album_privacy', array((int) $r['ID'], $iIdProfileViewer), 'Search')) {
continue;
}
if ($isSetAvatarFromDefaultAlbumOnly) {
$isDefaulAlbum = $r['Uri'] == uriFilter(str_replace('{nickname}', getUsername($iIdProfile), getParam($sType . '_profile_album_name'))) ? 1 : 0;
} else {
$isDefaulAlbum = 1;
}
$aRet[] = array('Id' => $r['ID'], 'Title' => $r['Caption'], 'Num' => $r['ObjCount'], 'DefaultAlbum' => $isDefaulAlbum);
}
return $aRet;
}
示例5: BxVideosPageAlbumsMy
function BxVideosPageAlbumsMy(&$oShared, $iOwnerId, $aParams = array())
{
parent::BxDolPageView('bx_videos_albums_my');
$this->oTemplate = $oShared->_oTemplate;
$this->oConfig = $oShared->_oConfig;
$this->oDb = $oShared->_oDb;
$this->iOwnerId = $iOwnerId;
$this->aAddParams = $aParams;
$this->oSearch = new BxVideosSearch('album', $this->aAddParams[1], 'owner', getNickName($this->iOwnerId));
$this->oAlbum = new BxDolAlbums('bx_videos', $this->iOwnerId);
if (isset($this->aSystemBlocks[$this->aAddParams[0]])) {
$this->aCurrentBlocks = $this->aSystemBlocks[$this->aAddParams[0]];
} else {
$this->aCurrentBlocks = $this->aSystemBlocks['main'];
}
$this->oTemplate->addCss(array('my.css', 'browse.css'));
$this->oSearch->aCurrent['restriction']['ownerId'] = array('value' => $this->iOwnerId, 'field' => 'Owner', 'operator' => '=', 'paramName' => 'ownerId');
$sCaption = str_replace('{nickname}', getNickName($this->iOwnerId), $this->oConfig->getGlParam('profile_album_name'));
$aOwnerDefAlbumInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => uriFilter($sCaption), 'owner' => $this->iOwnerId));
if (!is_array($aOwnerDefAlbumInfo) || empty($aOwnerDefAlbumInfo)) {
$aData = array('caption' => $sCaption, 'location' => _t('_' . $this->oConfig->getMainPrefix() . '_undefined'), 'owner' => $this->iOwnerId, 'AllowAlbumView' => BX_DOL_PG_ALL);
$this->oAlbum->addAlbum($aData, false);
}
}
示例6: 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);
}
示例7: serviceGetProfileAlbumFiles
function serviceGetProfileAlbumFiles($iProfileId)
{
$iProfileId = (int) $iProfileId;
$sNickKey = '{nickname}';
$sNickName = getUsername($iProfileId);
$sDefAlbumName = $this->oModule->_oConfig->getGlParam('profile_album_name');
if (strpos($sDefAlbumName, $sNickKey) !== false) {
$sCaption = str_replace($sNickKey, $sNickName, $sDefAlbumName);
} else {
$sCaption = $sDefAlbumName;
$this->aCurrent['restriction']['album_owner'] = array('value' => $iProfileId, 'field' => 'Owner', 'operator' => '=', 'paramName' => 'albumOwner', 'table' => 'sys_albums');
}
$sUri = uriFilter($sCaption);
$this->aCurrent['sorting'] = 'album_order';
$this->aCurrent['restriction']['album'] = array('value' => $sUri, 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
$aFiles = $this->getSearchData();
if (is_array($aFiles)) {
foreach ($aFiles as $iKey => $aData) {
$aFiles[$iKey]['file'] = $this->getImgUrl($aData['id'], 'icon');
}
} else {
$aFiles = array();
}
return $aFiles;
}
示例8: checkDefaultAlbums
function checkDefaultAlbums($iProfileId)
{
$sUri = $this->_oConfig->getUri();
$aAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($iProfileId)));
foreach ($aAlbums as $sAlbum) {
$aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbum), 'owner' => $iProfileId));
if (!empty($aAlbumInfo) && is_array($aAlbumInfo)) {
continue;
}
$this->oAlbums->addAlbum(array('caption' => $sAlbum, 'location' => _t('_bx_' . $sUri . '_undefined'), 'owner' => $iProfileId, 'AllowAlbumView' => $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri, 'album_view')), false);
}
}
示例9: getPhotoBlock
//.........这里部分代码省略.........
$this->aCurrent['restriction']['tag']['value'] = strip_tags($sKeyValue);
break;
case 'Limit':
$this->aCurrent['paginate']['perPage'] = (int) $sKeyValue;
break;
case 'DisplayPagination':
if ($sKeyValue == 1) {
$aShowParams['showPaginate'] = 1;
}
break;
case 'DisplayViews':
if ($sKeyValue == 1) {
$aShowParams['showViews'] = 1;
}
break;
case 'DisplayWhenAgo':
if ($sKeyValue == 1) {
$aShowParams['showDate'] = 1;
}
break;
case 'DisplayLink':
if ($sKeyValue == 1) {
$aShowParams['showLink'] = 1;
}
break;
case 'DisplayProfile':
if ($sKeyValue == 1) {
$aShowParams['showFrom'] = 1;
}
break;
}
}
}
$this->aCurrent['paginate']['perPage'] = 20;
$aFilesList = $this->getSearchData();
$iCnt = $this->aCurrent['paginate']['totalNum'];
if ($iCnt) {
$aUnit = array();
$aUnits = array();
if (defined('BX_PROFILE_PAGE') || defined('BX_MEMBER_PAGE')) {
$iPhotoWidth = 294;
$sImgWidth = 'style="width:' . $iPhotoWidth . 'px;"';
} else {
$iPhotoWidth = (int) $this->oModule->_oConfig->getGlParam('file_width');
$iPhotoWidth = $iPhotoWidth > 1 ? $iPhotoWidth : 600;
$sImgWidth = '';
}
foreach ($aFilesList as $iKey => $aData) {
$sPicUrl = $this->getImgUrl($aData['Hash'], 'icon');
$aUnits[] = array('imageId' => $iKey + 1, 'picUrl' => $sPicUrl);
$sPicLinkElements .= 'aPicLink[' . ($iKey + 1) . '] = ' . $aData['id'] . ';';
if ($iKey == 0) {
$aAdd = array('switchWidth' => $iPhotoWidth + 2, 'imgWidth' => $sImgWidth);
$aUnit['switcherUnit'] = $this->getSwitcherUnit($aData, $aShowParams, $aAdd);
}
}
$aUnit['moduleUrl'] = BX_DOL_URL_ROOT . $this->oModule->_oConfig->getBaseUri();
$aUnit['bx_repeat:iconBlock'] = $aUnits;
$aUnit['count'] = $iCnt;
$aUnit['contWidth'] = $iCnt * 40;
$aUnit['picWidth'] = $iPhotoWidth;
$aUnit['picBoxWidth'] = $aUnit['switchWidth'] = $iPhotoWidth + 2;
$aUnit['switchWidthOut'] = $aUnit['switchWidth'] + 4;
if ($aUnit['contWidth'] > $aUnit['picWidth']) {
$bScroller = true;
$aUnit['containerWidth'] = $aUnit['picBoxWidth'] - 72;
} else {
$bScroller = false;
$aUnit['containerWidth'] = $aUnit['contWidth'];
}
$aUnit['bx_if:scrollerBack'] = array('condition' => $bScroller, 'content' => array(1));
$aUnit['bx_if:scrollerNext'] = array('condition' => $bScroller, 'content' => array(1));
$aUnit['picLinkElements'] = $sPicLinkElements;
if ($aShowParams['showPaginate'] == 1) {
$aLinkAddon = $this->getLinkAddByPrams();
$oPaginate = new BxDolPaginate(array('page_url' => $aUnit['changeUrl'], 'count' => $iCnt, 'info' => false, 'per_page' => 1, 'page' => $this->aCurrent['paginate']['page'], 'per_page_changer' => false, 'page_reloader' => false, 'on_change_page' => 'getCurrentImage({page})'));
$aUnit['paginate'] = $oPaginate->getPaginate();
} else {
$aUnit['paginate'] = '';
}
$this->oTemplate->addCss('search.css');
return $this->oTemplate->parseHtmlByName('photo_switcher.html', $aUnit);
} elseif ($this->oModule->_iProfileId != 0 && $this->oModule->_iProfileId == (int) $this->aCurrent['restriction']['owner']['value']) {
ob_start();
?>
<div class="paginate">
<div class="view_all" style="background-image:url(__img_src__)">
<a href="__lnk_url__" title="__lnk_title__">__lnk_content__</a>
</div>
</div>
<?php
$sCode = ob_get_clean();
$sLinkTitle = _t('_bx_photos_add');
$sNickName = getNickName($this->oModule->_iProfileId);
$sCaption = uriFilter(str_replace('{nickname}', $sNickName, $this->oModule->_oConfig->getGlParam('profile_album_name')));
$aUnit = array('img_src' => $this->oTemplate->getIconUrl('more.png'), 'lnk_url' => $this->oModule->_oConfig->getBaseUri() . 'albums/my/add_objects/' . $sCaption . '/owner/' . $sNickName, 'lnk_title' => $sLinkTitle, 'lnk_content' => $sLinkTitle);
return MsgBox(_t('_Empty')) . $this->oTemplate->parseHtmlByContent($sCode, $aUnit);
}
return MsgBox(_t('_Empty'));
}
示例10: getProfilePhotoBlock
function getProfilePhotoBlock($aParams)
{
$sCaption = str_replace('{nickname}', getUsername($aParams['PID']), $this->oModule->_oConfig->getGlParam('profile_album_name'));
$sUri = uriFilter($sCaption);
$oAlbum = new BxDolAlbums('bx_photos');
$aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sUri, 'owner' => $aParams['PID']), array('ID'));
if (empty($aAlbumInfo) && $this->oModule->_iProfileId == (int) $aParams['PID']) {
$aData = array('caption' => $sCaption, 'location' => _t('_bx_photos_undefined'), 'owner' => $this->oModule->_iProfileId, 'AllowAlbumView' => $this->oModule->oAlbumPrivacy->_oDb->getDefaultValueModule('photos', 'album_view'));
$aAlbumInfo['ID'] = $oAlbum->addAlbum($aData, false);
}
if (!$this->oModule->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->oModule->_iProfileId)) {
return '';
}
$this->aCurrent['sorting'] = 'album_order';
$this->aCurrent['restriction']['album'] = array('value' => $sUri, 'field' => 'Uri', 'operator' => '=', 'paramName' => 'albumUri', 'table' => 'sys_albums');
return $this->getPhotoBlock($aParams);
}
示例11: addObjectToAlbum
function addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter = true, $iAuthorId = 0, $aAlbumParams = array())
{
if (!$iAuthorId) {
$iAuthorId = $this->_iOwnerId;
}
$iObjId = (int) $iObjId;
$aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId), array('ID'));
if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) {
$iAlbumID = (int) $aAlbumInfo['ID'];
} else {
$iPrivacy = $sAlbumUri == $oAlbums->getAlbumDefaultName() ? BX_DOL_PG_HIDDEN : BX_DOL_PG_NOBODY;
if (isset($aAlbumParams['privacy'])) {
$iPrivacy = (int) $aAlbumParams['privacy'];
}
$aData = array('caption' => $sAlbumUri, 'location' => _t('_' . $oAlbums->sType . '_undefined'), 'owner' => $iAuthorId, 'AllowAlbumView' => $iPrivacy);
$iAlbumID = $oAlbums->addAlbum($aData, false);
}
$oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter);
}
示例12: 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);
}
示例13: checkDefaultAlbums
function checkDefaultAlbums($iProfileId)
{
$sUri = $this->_oConfig->getUri();
$aAlbums = $this->_oConfig->getDefaultAlbums(true, array('{nickname}' => getUsername($iProfileId)));
foreach ($aAlbums as $sAlbum) {
$aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbum), 'owner' => $iProfileId));
if (!empty($aAlbumInfo) && is_array($aAlbumInfo)) {
continue;
}
$this->oAlbums->addAlbum(array('caption' => $sAlbum, 'owner' => $iProfileId, 'AllowAlbumView' => $sAlbum == getParam('sys_album_default_name') ? BX_DOL_PG_HIDDEN : $this->oAlbumPrivacy->_oDb->getDefaultValueModule($sUri, 'album_view')), false);
}
}
示例14: addObjectToAlbum
function addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter = true, $iAuthorId = 0)
{
if (!$iAuthorId) {
$iAuthorId = $this->_iOwnerId;
}
$iObjId = (int) $iObjId;
$aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId), array('ID'));
if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) {
$iAlbumID = (int) $aAlbumInfo['ID'];
} else {
$aData = array('caption' => $sAlbumUri, 'location' => _t('_' . $oAlbums->sType . '_undefined'), 'owner' => $iAuthorId);
$iAlbumID = $oAlbums->addAlbum($aData, false);
}
$oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter);
}
示例15: addObjectToAlbum
function addObjectToAlbum(&$oAlbums, $sAlbumUri, $iObjId, $bUpdateCounter = true, $iAuthorId = 0, $aAlbumParams = array())
{
if (!$iAuthorId) {
$iAuthorId = $this->_iOwnerId;
}
$iObjId = (int) $iObjId;
$aAlbumInfo = $oAlbums->getAlbumInfo(array('fileUri' => uriFilter($sAlbumUri), 'owner' => $iAuthorId), array('ID'));
if (is_array($aAlbumInfo) && count($aAlbumInfo) > 0) {
$iAlbumID = (int) $aAlbumInfo['ID'];
} else {
if (isset($aAlbumParams['privacy'])) {
$iPrivacy = (int) $aAlbumParams['privacy'];
} elseif ($sAlbumUri == $oAlbums->getAlbumDefaultName()) {
$iPrivacy = BX_DOL_PG_HIDDEN;
} else {
bx_import('BxDolPrivacyQuery');
$oPrivacy = new BxDolPrivacyQuery();
$iPrivacy = $oPrivacy->getDefaultValueModule($this->oModule->_oConfig->getUri(), 'album_view');
if (!$iPrivacy) {
$iPrivacy = BX_DOL_PG_NOBODY;
}
}
$aData = array('caption' => $sAlbumUri, 'owner' => $iAuthorId, 'AllowAlbumView' => $iPrivacy);
$iAlbumID = $oAlbums->addAlbum($aData, false);
}
$oAlbums->addObject($iAlbumID, $iObjId, $bUpdateCounter);
}