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


PHP title2uri函数代码示例

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


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

示例1: getTagsView

 function getTagsView($aTotalTags, $sHrefTempl)
 {
     global $oTemplConfig;
     global $oSysTemplate;
     if (empty($aTotalTags)) {
         return MsgBox(_t('_Empty'));
     }
     $iMinFontSize = $oTemplConfig->iTagsMinFontSize;
     $iMaxFontSize = $oTemplConfig->iTagsMaxFontSize;
     $iFontDiff = $iMaxFontSize - $iMinFontSize;
     $iMinRating = min($aTotalTags);
     $iMaxRating = max($aTotalTags);
     $iRatingDiff = $iMaxRating - $iMinRating;
     $iRatingDiff = $iRatingDiff == 0 ? 1 : $iRatingDiff;
     $sCode = '<div class="tags_wrapper">';
     $aUnit = array();
     foreach ($aTotalTags as $sTag => $iCount) {
         $aUnit['tagSize'] = $iMinFontSize + round($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff));
         $aUnit['tagHref'] = str_replace('{tag}', urlencode(title2uri($sTag)), $sHrefTempl);
         $aUnit['countCapt'] = _t('_Count');
         $aUnit['countNum'] = $iCount;
         $aUnit['tag'] = htmlspecialchars_adv($sTag);
         if ($this->_sTagTmplContent) {
             $sCode .= $oSysTemplate->parseHtmlByContent($this->_sTagTmplContent, $aUnit);
         } else {
             $sCode .= $oSysTemplate->parseHtmlByName($this->_sTagTmplName, $aUnit);
         }
     }
     $sCode .= '</div>';
     $sCode .= '<div class="clear_both"></div>';
     return $sCode;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:32,代码来源:BxBaseTags.php

示例2: getCategoriesView

 function getCategoriesView($aTotalCategories, $sHrefTempl, $iColumns)
 {
     global $oSysTemplate;
     if (empty($aTotalCategories)) {
         return MsgBox(_t('_Empty'));
     }
     if (!$iColumns) {
         $iColumns = 1;
     }
     $iCount = count($aTotalCategories);
     $iRowCount = floor($iCount / $iColumns) + ($iCount % $iColumns ? 1 : 0);
     $iWidthPr = floor(100 / $iColumns);
     $i = 0;
     $sCode = '<div class="categories_wrapper bx-def-bc-margin bx-def-font-large">';
     foreach ($aTotalCategories as $sCategory => $iCatCount) {
         if (!($i % $iRowCount)) {
             if ($i) {
                 $sCode .= '</div>';
             }
             $sCode .= '<div class="categories_col" style="width: ' . $iWidthPr . '%">';
         }
         $aUnit['catHref'] = str_replace('{tag}', rawurlencode(title2uri($sCategory)), $sHrefTempl);
         $aUnit['category'] = htmlspecialchars_adv($sCategory);
         $aUnit['count'] = $iCatCount;
         if ($this->_sCategTmplContent) {
             $sCode .= $oSysTemplate->parseHtmlByContent($this->_sCategTmplContent, $aUnit);
         } else {
             $sCode .= $oSysTemplate->parseHtmlByName($this->_sCategTmplName, $aUnit);
         }
         $i++;
     }
     $sCode .= '</div></div>';
     return $sCode;
 }
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:34,代码来源:BxBaseCategories.php

示例3: getLinkSet

function getLinkSet($sLinkString, $sUrlPrefix, $sDivider = ';,', $bUriConvert = false)
{
    $aSet = preg_split('/[' . $sDivider . ']/', $sLinkString, 0, PREG_SPLIT_NO_EMPTY);
    $sFinalSet = '';
    foreach ($aSet as $sKey) {
        $sLink = $sUrlPrefix . urlencode($bUriConvert ? title2uri($sKey) : $sKey);
        $sFinalSet .= '<a href="' . $sUrlPrefix . urlencode(title2uri(trim($sKey))) . '">' . $sKey . '</a> ';
    }
    return trim($sFinalSet, ' ');
}
开发者ID:blas-dmx,项目名称:dolphin.pro,代码行数:10,代码来源:utils.inc.php

示例4: __construct

 function __construct($sMode = '', $sValue = '', $sValue2 = '', $sValue3 = '')
 {
     switch ($sMode) {
         case 'pending':
             if (false !== bx_get('bx_store_filter')) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => process_db_input(bx_get('bx_store_filter'), BX_TAGS_STRIP), 'field' => '', 'operator' => 'against');
             }
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "administration";
             $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'my_pending':
             $oMain = $this->getMain();
             $this->aCurrent['restriction']['owner']['value'] = $oMain->_iProfileId;
             $this->aCurrent['restriction']['activeStatus']['value'] = 'pending';
             $this->sBrowseUrl = "browse/user/" . getNickName($oMain->_iProfileId);
             $this->aCurrent['title'] = _t('_bx_store_page_title_pending_approval');
             unset($this->aCurrent['rss']);
             break;
         case 'search':
             if ($sValue) {
                 $this->aCurrent['restriction']['keyword'] = array('value' => $sValue, 'field' => '', 'operator' => 'against');
             }
             if ($sValue2) {
                 $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
                 $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
                 $this->aCurrent['restriction']['category']['value'] = $sValue2;
                 if (is_array($sValue2)) {
                     $this->aCurrent['restriction']['category']['operator'] = 'in';
                 }
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $sValue2 = $GLOBALS['MySQL']->unescape($sValue2);
             $this->sBrowseUrl = "search/{$sValue}/" . (is_array($sValue2) ? implode(',', $sValue2) : $sValue2);
             $this->aCurrent['title'] = _t('_bx_store_page_title_search_results') . ' ' . (is_array($sValue2) ? implode(', ', $sValue2) : $sValue2) . ' ' . $sValue;
             unset($this->aCurrent['rss']);
             break;
         case 'user':
             $iProfileId = $GLOBALS['oBxStoreModule']->_oDb->getProfileIdByNickName($sValue, false);
             $GLOBALS['oTopMenu']->setCurrentProfileID($iProfileId);
             // select profile subtab, instead of module tab
             if (!$iProfileId) {
                 $this->isError = true;
             } else {
                 $this->aCurrent['restriction']['owner']['value'] = $iProfileId;
             }
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/user/{$sValue}";
             $iProfileId = getID($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_author', $iProfileId ? getNickName($iProfileId) : $sValue);
             if (bx_get('rss')) {
                 $aData = getProfileInfo($iProfileId);
                 if ($aData['Avatar']) {
                     $a = array('ID' => $aData['author_id'], 'Avatar' => $aData['thumb']);
                     $aImage = BxDolService::call('photos', 'get_image', array($a, 'browse'), 'Search');
                     if (!$aImage['no_image']) {
                         $this->aCurrent['rss']['image'] = $aImage['file'];
                     }
                 }
             }
             break;
         case 'admin':
             $this->aCurrent['restriction']['owner']['value'] = 0;
             $this->sBrowseUrl = "browse/admin";
             $this->aCurrent['title'] = _t('_bx_store_page_title_admin_products');
             break;
         case 'category':
             $this->aCurrent['join']['category'] = array('type' => 'inner', 'table' => 'sys_categories', 'mainField' => 'id', 'onField' => 'ID', 'joinFields' => '');
             $this->aCurrent['restriction']['category_type']['value'] = $this->aCurrent['name'];
             $this->aCurrent['restriction']['category']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/category/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_category', $sValue);
             break;
         case 'tag':
             $this->aCurrent['restriction']['tag']['value'] = $sValue;
             $sValue = $GLOBALS['MySQL']->unescape($sValue);
             $this->sBrowseUrl = "browse/tag/" . title2uri($sValue);
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_by_tag', $sValue);
             break;
         case 'free':
             $this->aCurrent['restriction']['price'] = array('value' => 'Free', 'field' => 'price_range', 'operator' => '=');
             $this->sBrowseUrl = "browse/free";
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_free_products') . ' ' . $sValue;
             break;
         case 'recent':
             $this->sBrowseUrl = 'browse/recent';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_recent');
             break;
         case 'top':
             $this->sBrowseUrl = 'browse/top';
             $this->aCurrent['sorting'] = 'top';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_top_rated');
             break;
         case 'popular':
             $this->sBrowseUrl = 'browse/popular';
             $this->aCurrent['sorting'] = 'popular';
             $this->aCurrent['title'] = _t('_bx_store_page_title_browse_popular');
             break;
//.........这里部分代码省略.........
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:101,代码来源:BxStoreSearchResult.php

示例5: GenSearchResult

    /**
     * Generate a Block of searching result by Tag (GET is tagKey)
     *
     * @return HTML presentation of data
     */
    function GenSearchResult()
    {
        if (!$this->isAllowedBlogPostSearch(true)) {
            return $this->_oTemplate->displayAccessDenied();
        }
        $iCheckedMemberID = $this->_iVisitorID;
        $bNoProfileMode = false !== bx_get('ownerID') || false !== bx_get('blogOwnerName') ? false : true;
        $sRetHtml = '';
        $sSearchedTag = uri2title(process_db_input(bx_get('tagKey'), BX_TAGS_STRIP));
        $iMemberID = $this->defineUserId();
        $sTagsC = _t('_Tags');
        $sNoBlogC = _t('_bx_blog_No_blogs_available');
        require_once $this->_oConfig->getClassPath() . 'BxBlogsSearchUnit.php';
        $oTmpBlogSearch = new BxBlogsSearchUnit($this);
        $oTmpBlogSearch->PerformObligatoryInit($this, 4);
        $oTmpBlogSearch->aCurrent['restriction']['tag2']['value'] = $sSearchedTag;
        $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage();
        if ($iMemberID > 0) {
            $oTmpBlogSearch->aCurrent['restriction']['owner']['value'] = $iMemberID;
        }
        if ($iMemberID != 0 && $iMemberID == $iCheckedMemberID || $this->isAdmin() == true) {
            $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = '';
        }
        $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
        $sBlogPostsVal = '<div class="blogs-view bx-def-bc-padding">' . $sBlogPostsVal . '</div>';
        $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $oTmpBlogSearch->getCurrentUrl('tag', 0, title2uri($sSearchedTag));
        $sBlogPostsVal .= $oTmpBlogSearch->showPagination3();
        $sBlogPosts = $oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0 ? MsgBox(_t('_Empty')) : $sBlogPostsVal;
        $sContentSect = DesignBoxContent($sTagsC . ' - ' . $sSearchedTag, $sBlogPostsVal, 1);
        if ($bNoProfileMode == false) {
            $sRightSect = '';
            if ($iMemberID > -1) {
                $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID);
                if (!$aBlogsRes) {
                    $sNoBlogC = MsgBox($sNoBlogC);
                    $sRetHtml = <<<EOF
<div class="{$sWidthClass}">
    {$sNoBlogC}
</div>
<div class="clear_both"></div>
EOF;
                } else {
                    $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes);
                    $sWidthClass = $iMemberID > 0 ? 'cls_info_left' : 'cls_res_thumb';
                    $sRetHtml = $this->Templater($sContentSect, $sRightSect, $sWidthClass);
                }
            } else {
                $sRetHtml = MsgBox(_t('_Profile Not found Ex'));
            }
        } else {
            $sRetHtml = <<<EOF
<div class="{$sWidthClass}">
    {$sContentSect}
</div>
<div class="clear_both"></div>
EOF;
        }
        return $sRetHtml;
    }
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:64,代码来源:BxBlogsModule.php

示例6: PrintAdvertisementsByTag

    /**
     * Compose result of searching Advertisements by Tag
     *
     * @param $sTag	selected tag string
     * @return HTML result
     */
    function PrintAdvertisementsByTag($sTag)
    {
        $sSiteUrl = BX_DOL_URL_ROOT;
        $sSafeTag = addslashes(trim(strtolower($sTag)));
        $sTagResultC = _t('_bx_ads_search_results_by_tag');
        $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads');
        $sHomeLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1";
        $sBreadCrumbs = <<<EOF
<a href="{$sHomeLink}">{$sBrowseAllAds}</a> / {$sTagResultC} - {$sSafeTag}
EOF;
        require_once $this->_oConfig->getClassPath() . 'BxAdsSearchUnit.php';
        $oTmpAdsSearch = new BxAdsSearchUnit();
        if ($iRandLim > 0) {
            $oTmpAdsSearch->aCurrent['paginate']['perPage'] = (int) $iRandLim;
        } else {
            $oTmpAdsSearch->aCurrent['paginate']['perPage'] = 10;
        }
        $oTmpAdsSearch->aCurrent['sorting'] = 'last';
        $oTmpAdsSearch->aCurrent['restriction']['tag']['value'] = $sSafeTag;
        $sAdsByTags = $oTmpAdsSearch->displayResultBlock();
        if ($oTmpAdsSearch->aCurrent['paginate']['totalNum'] == 0) {
            $sAdsByTags = MsgBox(_t('_Empty'));
        } else {
            // Prepare link to pagination
            $sSafeTagS = title2uri($sSafeTag);
            if ($this->bUseFriendlyLinks == false) {
                $sRequest = $this->sHomeUrl . "classifieds_tags.php?tag={$sSafeTagS}&page={page}&per_page={per_page}";
            } else {
                $sRequest = BX_DOL_URL_ROOT . "ads/tag/{$sSafeTagS}/{per_page}/{page}";
            }
            // End of prepare link to pagination
            $oTmpAdsSearch->aCurrent['paginate']['page_url'] = $sRequest;
            $sAdsByTags .= $oTmpAdsSearch->showPagination();
        }
        return DesignBoxContent($sBreadCrumbs, $sAdsByTags, 1);
    }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:42,代码来源:BxAdsModule.php

示例7: displaySearchUnit

    function displaySearchUnit($aResSQL)
    {
        $iVisitorID = getLoggedId();
        $oMain = $this->getBlogsMain();
        $iPostID = (int) $aResSQL['id'];
        $sBlogsImagesUrl = BX_BLOGS_IMAGES_URL;
        $bPossibleToView = $oMain->oPrivacy->check('view', $iPostID, $oMain->_iVisitorID);
        if (!$bPossibleToView) {
            if ($this->sMobileWrapper) {
                return $this->_wrapMobileUnit($oMain->_oTemplate->parseHtmlByTemplateName('browse_unit_private_mobile', array()), $iPostID, $oMain);
            } else {
                return $oMain->_oTemplate->parseHtmlByName('browse_unit_private.html', array('extra_css_class' => ''));
            }
        }
        $sCategories = $aResSQL['Categories'];
        $aCategories = $oMain->getTagLinks($aResSQL['Categories'], 'category', CATEGORIES_DIVIDER);
        $sStyle = '';
        $sFriendStyle = '';
        $sPostVote = '';
        $sPostMode = '';
        $sVotePostRating = $this->oRate->getJustVotingElement(0, 0, $aResSQL['Rate']);
        $aProfileInfo = getProfileInfo($aResSQL['ownerId']);
        $sAuthorTitle = process_line_output(getNickName($aProfileInfo['ID']));
        $sAuthorUsername = getUsername($aProfileInfo['ID']);
        $sAuthorLink = getProfileLink($aProfileInfo['ID']);
        $sCategoryName = $aResSQL['Categories'];
        $sPostLink = $this->getCurrentUrl('file', $iPostID, $aResSQL['uri']) . $sCategoryUrlAdd;
        $sAllCategoriesLinks = '';
        if (count($aCategories) > 0) {
            foreach ($aCategories as $iKey => $sCatValue) {
                $sCatLink = $this->getCurrentUrl('category', title2uri($sCatValue), title2uri($sCatValue), array('ownerId' => $aResSQL['ownerId'], 'ownerName' => $sAuthorUsername));
                $sCatName = process_line_output($sCatValue);
                $aAllCategoriesLinks[] = '<a href="' . $sCatLink . '">' . $sCatName . '</a>';
            }
            $aAllCategoriesLinkHrefs = implode(", ", $aAllCategoriesLinks);
            $sAllCategoriesLinks = <<<EOF
<span class="margined">
    <span>{$aAllCategoriesLinkHrefs}</span>
</span>
EOF;
        }
        $sAdminCheck = $sAdminStatus = '';
        if ($this->bShowCheckboxes) {
            $sAdminCheck = <<<EOF
<div class="browseCheckbox"><input id="ch{$iPostID}" type="checkbox" name="bposts[]" value="{$iPostID}" /></div>
EOF;
            $sPostStatus = process_line_output($aResSQL['PostStatus']);
            $sAdminStatus = <<<EOF
&nbsp;({$sPostStatus})
EOF;
        }
        $sPostCaption = process_line_output($aResSQL['title']);
        $sPostCaptionHref = <<<EOF
<a class="unit_title bx-def-font-h2" href="{$sPostLink}">{$sPostCaption}</a>{$sAdminStatus}
EOF;
        if ($this->iPostViewType == 3 || $this->sMobileWrapper) {
            $sFriendStyle = "2";
            $sPostMode = '_post';
            $sPostCaptionHref = '<div class="unit_title bx-def-font-h2">' . $sPostCaption . '</div>';
        }
        $sDateTime = defineTimeInterval($aResSQL['date']);
        //$oCmtsView = new BxTemplCmtsView ('blogposts', (int)$iPostID);
        $iCommentsCnt = (int) $aResSQL['CommentsCount'];
        $sTagsCommas = $aResSQL['tag'];
        //$aTags = split(',', $sTagsCommas);
        $aTags = preg_split("/[;,]/", $sTagsCommas);
        //search by tag skiping
        if ($this->sSearchedTag != '' && in_array($this->sSearchedTag, $aTags) == false) {
            return;
        }
        $sTagsHrefs = '';
        $aTagsHrefs = array();
        foreach ($aTags as $sTagKey) {
            if ($sTagKey != '') {
                $sTagLink = $this->getCurrentUrl('tag', $iPostID, htmlspecialchars(title2uri($sTagKey)));
                $sTagsHrefAny = <<<EOF
<a href="{$sTagLink}" title="{$sTagKey}">{$sTagKey}</a>
EOF;
                $aTagsHrefs[] = $sTagsHrefAny;
            }
        }
        $sTagsHrefs = implode(", ", $aTagsHrefs);
        $sTags = <<<EOF
<span class="margined">
    <span>{$sTagsHrefs}</span>
</span>
EOF;
        $sPostText = $aResSQL['bodyText'];
        $bOwner = $iVisitorID == $aResSQL['ownerId'] ? true : false;
        $sOwnerThumb = $sPostPicture = $sPreviewPicture = '';
        if ($aResSQL['PostPhoto'] && $this->iPostViewType == 3) {
            $oMain->_oTemplate->addJs('plugins/fancybox/|jquery.fancybox.js');
            $oMain->_oTemplate->addCss('plugins/fancybox/|jquery.fancybox.css');
            $sPostPicture = $oMain->_oTemplate->parseHtmlByName('picture_preview.html', array('img_url_big' => $sBlogsImagesUrl . 'orig_' . $aResSQL['PostPhoto'], 'img_url_small' => $sBlogsImagesUrl . 'big_' . $aResSQL['PostPhoto']));
        }
        if ($aResSQL['PostPhoto'] && ($this->iPostViewType == 1 || $this->iPostViewType == 4 || $this->iPostViewType == 5)) {
            $sStyle = 'padding-right:' . ($this->iThumbSize + 10) . 'px; min-height:' . $this->iThumbSize . 'px;';
            $sPreviewPicture = '<div class="unit_img"><img class="bx-def-shadow bx-def-round-corners" src="' . $sBlogsImagesUrl . 'big_' . $aResSQL['PostPhoto'] . '" /></div>';
        }
        if ($this->iPostViewType == 4) {
//.........这里部分代码省略.........
开发者ID:noormcs,项目名称:studoro,代码行数:101,代码来源:BxBlogsSearchUnit.php

示例8: getTagContent

 function getTagContent($sTag = '', $iPage = 1, $iPerPage = 0)
 {
     $sTag = uri2title(process_db_input($sTag, BX_TAGS_STRIP));
     $iPage = (int) $iPage;
     $iPerPage = (int) $iPerPage;
     $sTagDisplay = $GLOBALS['MySQL']->unescape($sTag);
     return array($sTagDisplay, $this->getSearchContent(array('tag' => $sTag), 'tag/' . title2uri($sTagDisplay) . '/', $iPage, $iPerPage));
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:8,代码来源:BxDolTextModule.php

示例9: _parseAnything

 function _parseAnything($s, $sDiv, $sLinkStart, $sClassName = '')
 {
     $sRet = '';
     $a = explode($sDiv, $s);
     $sClass = $sClassName ? 'class="' . $sClassName . '"' : '';
     foreach ($a as $sName) {
         $sRet .= '<a ' . $sClass . ' href="' . $sLinkStart . title2uri($sName) . '">' . $sName . '</a> ';
     }
     return $sRet;
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:10,代码来源:BxDolTwigTemplate.php

示例10: searchCategories

 /**
  * Function will search poll used the recived category name;
  *
  * @param  : $sCategory (string) - poll's category;
  * @param  : $sExtraParam (string) - extra URI params;
  * @param  : $bUseInitPart (boolean) - if isset this param, function will add poll's js part;
  * @return : (text) - html presentation data;
  */
 function searchCategories($sCategory, $sExtraParam = null, $bUseInitPart = true)
 {
     $sOutputCode = null;
     //concat init part;
     if ($bUseInitPart) {
         $sOutputCode = $this->getInitPollPage();
     }
     $this->oSearch->aCurrent['restriction']['category']['value'] = $sCategory;
     $sExtraParam .= '&category=' . urlencode(title2uri($sCategory));
     $sOutputCode .= $this->showSearchResult(_t('_bx_poll_browse_category') . ': ' . htmlspecialchars_adv($sCategory), $sExtraParam);
     return $sOutputCode;
 }
开发者ID:toxalot,项目名称:dolphin.pro,代码行数:20,代码来源:BxPollModule.php

示例11: displayList

 function displayList($aParams)
 {
     $sSampleType = $aParams['sample_type'];
     $iViewerType = $aParams['viewer_type'];
     $iStart = isset($aParams['start']) ? (int) $aParams['start'] : -1;
     $iPerPage = isset($aParams['count']) ? (int) $aParams['count'] : -1;
     $bShowEmpty = isset($aParams['show_empty']) ? $aParams['show_empty'] : true;
     $bAdminPanel = $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (isset($aParams['admin_panel']) && $aParams['admin_panel'] || $sSampleType == 'admin');
     $sModuleUri = $this->_oConfig->getUri();
     $aEntries = $this->_oDb->getEntries($aParams);
     if (empty($aEntries)) {
         return $bShowEmpty ? MsgBox(_t('_' . $sModuleUri . '_msg_no_results')) : "";
     }
     $oTags = new BxDolTags();
     $oCategories = new BxDolCategories();
     //--- Language translations ---//
     $sLKLinkPublish = _t('_' . $sModuleUri . '_lcaption_publish');
     $sLKLinkEdit = _t('_' . $sModuleUri . '_lcaption_edit');
     $sLKLinkDelete = _t('_' . $sModuleUri . '_lcaption_delete');
     $sBaseUri = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri();
     $sJsMainObject = $this->_oConfig->getJsObject();
     $aResult['sample'] = $sSampleType;
     $aResult['bx_repeat:entries'] = array();
     foreach ($aEntries as $aEntry) {
         $sVotes = "";
         if ($this->_oConfig->isVotesEnabled()) {
             $oVotes = $this->_oModule->_createObjectVoting($aEntry['id']);
             $sVotes = $oVotes->getJustVotingElement(0, $aEntry['id']);
         }
         $aTags = $oTags->explodeTags($aEntry['tags']);
         $aCategories = $oCategories->explodeTags($aEntry['categories']);
         $aTagItems = array();
         foreach ($aTags as $sTag) {
             $sTag = trim($sTag);
             $aTagItems[] = array('href' => $sBaseUri . 'tag/' . title2uri($sTag), 'title' => $sTag);
         }
         $aCategoryItems = array();
         foreach ($aCategories as $sCategory) {
             $sCategory = trim($sCategory);
             $aCategoryItems[] = array('href' => $sBaseUri . 'category/' . title2uri($sCategory), 'title' => $sCategory);
         }
         $aResult['bx_repeat:entries'][] = array('id' => $this->_oConfig->getSystemPrefix() . $aEntry['id'], 'caption' => str_replace("\$", "&#36;", $aEntry['caption']), 'class' => !in_array($sSampleType, array('view')) ? ' ' . $this->sCssPrefix . '-text-snippet' : '', 'date' => getLocaleDate($aEntry['when_uts'], BX_DOL_LOCALE_DATE), 'comments' => (int) $aEntry['cmts_count'], 'bx_repeat:categories' => $aCategoryItems, 'bx_repeat:tags' => $aTagItems, 'content' => str_replace("\$", "&#36;", $aEntry['content']), 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aEntry['uri'], 'voting' => $sVotes, 'bx_if:checkbox' => array('condition' => $bAdminPanel, 'content' => array('id' => $aEntry['id'])), 'bx_if:status' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('status' => _t('_' . $sModuleUri . '_status_' . $aEntry['status']))), 'bx_if:featured' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (int) $aEntry['featured'] == 1, 'content' => array()), 'bx_if:edit_link' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('edit_link_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/' . $aEntry['uri'], 'edit_link_caption' => $sLKLinkEdit)));
     }
     $aResult['paginate'] = '';
     if (!in_array($sSampleType, array('id', 'uri', 'view', 'search_unit'))) {
         if (!empty($sSampleType)) {
             $this->_updatePaginate($aParams);
         }
         $aResult['paginate'] = $this->oPaginate->getPaginate($iStart, $iPerPage);
     }
     $aResult['loading'] = LoadingBox($sModuleUri . '-' . $sSampleType . '-loading');
     $sRes = $this->parseHtmlByName('list.html', $aResult);
     return $sRes;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:54,代码来源:BxDolTextTemplate.php

示例12: getPostCategoriesBlock

    function getPostCategoriesBlock()
    {
        $iMemberID = (int) $this->aViewingPostInfo['OwnerID'];
        $sOwnerNickname = getNickName($iMemberID);
        $aProf = array('Permalink' => $sOwnerNickname, 'Link' => $iMemberID);
        $sOwnerAddAp = $iMemberID == $this->_iVisitorID || $this->isAllowedApprove() || $this->isAllowedPostEdit(-1) || $this->isAllowedPostDelete(-1) ? '' : "AND `PostStatus`='approval'";
        $sStatusFilter = $this->isAdmin() == true ? '' : $sOwnerAddAp;
        $sNewC = ucfirst(_t('_new'));
        $sCategoriesC = _t('_bx_blog_Categories');
        $sPostsCL = strtolower(_t('_bx_blog_Posts'));
        $sFolderIcon = $this->_oTemplate->getIconUrl('folder_small.png');
        $sCategories = '';
        $oCategories = new BxDolCategories();
        $aAllCategories = $oCategories->getCategoriesList('bx_blogs', $iMemberID);
        if (is_array($aAllCategories) && count($aAllCategories) > 0) {
            foreach ($aAllCategories as $iCatID => $sCategoryName) {
                $sCategoryNameS = addslashes($sCategoryName);
                $iCountCatPost = $this->_oDb->getPostsCntInCategory($sCategoryNameS, $sStatusFilter, $iMemberID);
                if ($iCountCatPost == 0) {
                    continue;
                }
                $sCatName = process_line_output($sCategoryName);
                $sSpacerName = $this->sSpacerPath;
                $aCat = array('Permalink' => title2uri($sCategoryName), 'Link' => title2uri($sCategoryName));
                $sCatLink = $this->genBlogLink('show_member_blog', $aProf, $aCat);
                $sCategories .= <<<EOF
<div class="cls_result_row">
\t<div class="cls_res_thumb margined" >
\t\t<div class="thumbnail_block" style="border-width:0px;">
\t\t\t<span style="vertical-align:middle;">
\t\t\t\t<img class="cls_categ_icon" src="{$sFolderIcon}" alt="" />
\t\t\t</span>
\t\t</div>
\t</div>
\t<div class="cls_categ_name">
\t\t<a href="{$sCatLink}">{$sCatName}</a>&nbsp;<span class="blog_author">({$iCountCatPost} {$sPostsCL})</span>
\t</div>
\t<!-- {$sCatActions} -->
\t<div class="clear_both"></div>
</div>
EOF;
            }
        }
        $sCategoriesActions = '';
        if ($this->_iVisitorID == $iMemberID && $iMemberID > 0 || $this->bAdminMode == true) {
            $sCategoriesActions = BxDolPageView::getBlockCaptionMenu(mktime(), array('cat_new' => array('href' => bx_html_attribute($_SERVER['PHP_SELF']) . "?action=add_category&ownerID={$iMemberID}", 'title' => $sNewC, 'active' => 0)));
        }
        $sCategoriesVal = <<<EOF
<div class="blog-cat-view">
\t{$sCategories}
</div>
EOF;
        return DesignBoxContent($sCategoriesC, $sCategoriesVal, 1, $sCategoriesActions);
    }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:54,代码来源:BxBlogsModule.php

示例13: displaySearchUnit

    function displaySearchUnit($aResSQL)
    {
        $iVisitorID = (int) $_COOKIE['memberID'];
        $oMain = $this->getBlogsMain();
        $sTagsSmallIcon = $sClockIcon = $sCommentsIcon = $sCategoryIcon = '';
        if ($oMain->_oTemplate) {
            $sTagsSmallIcon = $oMain->_oTemplate->getIconUrl('tgs.png');
            $sClockIcon = $oMain->_oTemplate->getIconUrl('clock.png');
            $sCommentsIcon = $oMain->_oTemplate->getIconUrl('comments.png');
            $sCategoryIcon = $oMain->_oTemplate->getIconUrl('folder_small.png');
        }
        $iPostID = (int) $aResSQL['id'];
        $sBlogsImagesUrl = BX_BLOGS_IMAGES_URL;
        $bPossibleToView = $oMain->oPrivacy->check('view', $iPostID, $oMain->_iVisitorID);
        if (!$bPossibleToView) {
            return $oMain->_oTemplate->parseHtmlByName('browse_unit_private.html', array('extra_css_class' => ''));
        }
        $sCategories = $aResSQL['Categories'];
        $aCategories = $oMain->getTagLinks($aResSQL['Categories'], 'category', CATEGORIES_DIVIDER);
        $sFriendStyle = '';
        $sPostVote = '';
        $sPostMode = '';
        $sVotePostRating = $this->oRate->getJustVotingElement(0, 0, $aResSQL['Rate']);
        $aProfileInfo = getProfileInfo($aResSQL['ownerId']);
        $sOwnerNickname = process_line_output($aProfileInfo['NickName']);
        $sCategoryName = $aResSQL['Categories'];
        $sPostLink = $this->getCurrentUrl('file', $iPostID, $aResSQL['uri']) . $sCategoryUrlAdd;
        $sAllCategoriesLinks = '';
        if (count($aCategories) > 0) {
            foreach ($aCategories as $iKey => $sCatValue) {
                $sCatLink = $this->getCurrentUrl('category', title2uri($sCatValue), title2uri($sCatValue), array('ownerId' => $aResSQL['ownerId'], 'ownerName' => $sOwnerNickname));
                $sCatName = process_line_output($sCatValue);
                $aAllCategoriesLinks[] = '<a href="' . $sCatLink . '">' . $sCatName . '</a>';
            }
            $aAllCategoriesLinkHrefs = implode(", ", $aAllCategoriesLinks);
            $sAllCategoriesLinks = <<<EOF
<span class="margined">
\t<span>{$aAllCategoriesLinkHrefs}</span>
</span>
EOF;
        }
        $sAdminCheck = $sAdminStatus = '';
        if ($this->bShowCheckboxes) {
            $sAdminCheck = <<<EOF
<div class="browseCheckbox"><input id="ch{$iPostID}" type="checkbox" name="bposts[]" value="{$iPostID}" /></div>
EOF;
            $sPostStatus = process_line_output($aResSQL['PostStatus']);
            $sAdminStatus = <<<EOF
&nbsp;({$sPostStatus})
EOF;
        }
        $sPostCaption = process_line_output($aResSQL['title']);
        $sPostCaptionHref = <<<EOF
<a class="actions" href="{$sPostLink}">{$sPostCaption}</a>{$sAdminStatus}
EOF;
        if ($this->iPostViewType == 3) {
            $sFriendStyle = "2";
            $sPostMode = '_post';
            $sPostCaptionHref = '<div class="actions">' . $sPostCaption . '</div>';
        }
        $sDateTime = defineTimeInterval($aResSQL['date']);
        //$oCmtsView = new BxTemplCmtsView ('blogposts', (int)$iPostID);
        $iCommentsCnt = (int) $aResSQL['CommentsCount'];
        $sAuthor = '';
        if ($this->iPostViewType == 2) {
            $sAuthor = getProfileLink($aResSQL['ownerId']);
            $sAuthor = '<a href="' . $sAuthor . '">' . $sOwnerNickname . '</a>';
        }
        $sTagsCommas = $aResSQL['tag'];
        //$aTags = split(',', $sTagsCommas);
        $aTags = preg_split("/[;,]/", $sTagsCommas);
        //search by tag skiping
        if ($this->sSearchedTag != '' && in_array($this->sSearchedTag, $aTags) == false) {
            return;
        }
        $sTagsHrefs = '';
        $aTagsHrefs = array();
        foreach ($aTags as $sTagKey) {
            if ($sTagKey != '') {
                $sTagLink = $this->getCurrentUrl('tag', $iPostID, htmlspecialchars(title2uri($sTagKey)));
                $sTagsHrefAny = <<<EOF
<a href="{$sTagLink}" title="{$sTagKey}">{$sTagKey}</a>
EOF;
                $aTagsHrefs[] = $sTagsHrefAny;
            }
        }
        $sTagsHrefs = implode(", ", $aTagsHrefs);
        $sTags = <<<EOF
<span class="margined">
\t<span>{$sTagsHrefs}</span>
</span>
EOF;
        $sPostText = process_html_output($aResSQL['bodyText']);
        //$sPostText = addslashes( clear_xss( trim( process_pass_data($aResSQL['bodyText']))));
        $bFriend = is_friends($iVisitorID, $aResSQL['ownerId']);
        $bOwner = $iVisitorID == $aResSQL['ownerId'] ? true : false;
        $sOwnerThumb = $sPostPicture = '';
        if ($aResSQL['PostPhoto'] && $this->iPostViewType == 3) {
            $sSpacerName = getTemplateIcon('spacer.gif');
            $sPostPicture = <<<EOF
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:shopexts,代码行数:101,代码来源:BxBlogsSearchUnit.php

示例14: testTitleToUri

 /**
  * @see title2uri
  * @dataProvider providerForTitleToUri
  */
 function testTitleToUri($sIn, $sOut)
 {
     $this->assertEquals(title2uri($sIn), $sOut);
 }
开发者ID:Baloo7super,项目名称:dolphin,代码行数:8,代码来源:UtilTest.php


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