本文整理汇总了PHP中JString::strLen方法的典型用法代码示例。如果您正苦于以下问题:PHP JString::strLen方法的具体用法?PHP JString::strLen怎么用?PHP JString::strLen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::strLen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shAddPaginationInfo
function shAddPaginationInfo($limit, $limitstart, $showall, $iteration, $url, $location, $shSeparator = null)
{
global $mainframe;
$sefConfig =& shRouter::shGetConfig();
$database =& JFactory::getDBO();
// get a default limit value, for urls where it's missing
$listLimit = shGetDefaultDisplayNumFromURL($url, $includeBlogLinks = true);
$defaultListLimit = shGetDefaultDisplayNumFromConfig($url, $includeBlogLinks = false);
//echo 'Incoming pagination : $listLimit : ' . $listLimit . ' | $defaultListLimit : ' . $defaultListLimit . "\n";
// clean suffix and index file before starting to add things to the url
// clean suffix
if (strpos($url, 'option=com_content') !== false && strpos($url, 'format=pdf') !== false) {
$shSuffix = '.pdf';
} else {
$shSuffix = $sefConfig->suffix;
}
$suffixLength = JString::strLen($shSuffix);
if (!empty($shSuffix) && $shSuffix != '/' && JString::substr($location, -$suffixLength) == $shSuffix) {
$location = JString::substr($location, 0, JString::strlen($location) - $suffixLength);
}
// clean index file
if ($sefConfig->addFile && (empty($shSuffix) || JString::subStr($location, -$suffixLength) != $shSuffix)) {
$indexFileLength = JString::strlen($sefConfig->addFile);
if ($sefConfig->addFile != '/' && JString::substr($location, -$indexFileLength) == $sefConfig->addFile) {
$location = JString::substr($location, 0, JString::strlen($location) - $indexFileLength);
}
}
// do we have a trailing slash ?
if (empty($shSeparator)) {
$shSeparator = JString::substr($location, -1) == '/' ? '' : '/';
}
if (!empty($limit) && is_numeric($limit)) {
$pagenum = intval($limitstart / $limit);
$pagenum++;
} else {
if (!isset($limit) && !empty($limitstart)) {
// only limitstart
if (strpos($url, 'option=com_content') !== false && strpos($url, 'view=article') !== false) {
$pagenum = intval($limitstart + 1);
// multipage article
} else {
$pagenum = intval($limitstart / $listLimit) + 1;
// blogs, tables, ...
}
} else {
$pagenum = $iteration;
}
}
// Make sure we do not end in infite loop here.
if ($pagenum < $iteration) {
$pagenum = $iteration;
}
// shumisha added to handle table-category and table-section which may have variable number of items per page
// There still will be a problem with filter, which may reduce the total number of items. Thus the item we are looking for
if ($sefConfig->alwaysAppendItemsPerPage || strpos($url, 'option=com_virtuemart') && $sefConfig->shVmUsingItemsPerPage) {
$shMultPageLength = $sefConfig->pagerep . (empty($limit) ? $listLimit : $limit);
} else {
$shMultPageLength = '';
}
// shumisha : modified to add # of items per page to URL, for table-category or section-category
if (!empty($sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']]) && false !== strpos($sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']], '%s')) {
$page = str_replace('%s', $pagenum, $sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']]) . $shMultPageLength;
} else {
$page = $sefConfig->pagerep . $pagenum . $shMultPageLength;
}
// V 1.2.4.t special processing to replace page number by headings
$shPageNumberWasReplaced = false;
if (strpos($url, 'option=com_content') !== false && strpos($url, 'view=article') !== false && !empty($limitstart)) {
// this is multipage article - limitstart instead of limit in J1.5
if ($sefConfig->shMultipagesTitle) {
parse_str($url, $shParams);
if (!empty($shParams['id'])) {
$shPageTitle = '';
$sql = 'SELECT c.id, c.fulltext, c.introtext FROM #__content AS c WHERE id=\'' . $shParams['id'] . '\'';
$database->setQuery($sql);
$contentElement = $database->loadObject();
if ($database->getErrorNum()) {
JError::RaiseError(500, $database->stderr());
}
$contentText = $contentElement->introtext . $contentElement->fulltext;
if (!empty($contentElement) && strpos($contentText, 'class="system-pagebreak') !== false) {
// search for mospagebreak tags
// copied over from pagebreak plugin
// expression to search for
$regex = '#<hr([^>]*)class=(\\"|\')system-pagebreak(\\"|\')([^>]*)\\/>#iU';
// find all instances of mambot and put in $matches
$shMatches = array();
preg_match_all($regex, $contentText, $shMatches, PREG_SET_ORDER);
// adds heading or title to <site> Title
if (empty($limitstart)) {
// if first page use heading of first mospagebreak
/* if ( $shMatches[0][2] ) {
parse_str( html_entity_decode( $shMatches[0][2] ), $args );
if ( @$args['heading'] ) {
$shPageTitle = stripslashes( $args['heading'] );
}
}*/
} else {
// for other pages use title of mospagebreak
if ($limitstart > 0 && $shMatches[$limitstart - 1][1]) {
//.........这里部分代码省略.........