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


PHP getNextPrev函数代码示例

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


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

示例1: link_to_prev

function link_to_prev($atts, $thing)
{
    global $thisarticle, $id;
    global $next_id, $next_title, $next_utitle, $next_posted;
    global $prev_id, $prev_title, $prev_utitle, $prev_posted;
    extract(lAtts(array('showalways' => 0), $atts));
    if (!is_numeric(@$id)) {
        extract(getNextPrev($thisarticle['thisid'], @strftime('%Y-%m-%d %H:%M:%S', $thisarticle['posted']), @$GLOBALS['s']));
    }
    return $prev_id ? href(parse($thing), permlinkurl_id($prev_id)) : ($showalways ? parse($thing) : '');
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:11,代码来源:taghandlers.php

示例2: preText


//.........这里部分代码省略.........
                                    $out['s'] = 'default';
                                } else {
                                    $is_404 = 1;
                                }
                            } else {
                                $when = "{$u1}-{$u2}-{$u3}";
                                $rs = lookupByDateTitle($when, $u4);
                                $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                                $out['s'] = !empty($rs['Section']) ? $rs['Section'] : '';
                                $is_404 = (empty($out['s']) or empty($out['id']));
                            }
                            break;
                        case 'section_title':
                            if (empty($u2)) {
                                $out['s'] = ckEx('section', $u1) ? $u1 : '';
                                $is_404 = empty($out['s']);
                            } else {
                                $rs = lookupByTitleSection($u2, $u1);
                                $out['id'] = @$rs['ID'];
                                $out['s'] = @$rs['Section'];
                                $is_404 = (empty($out['s']) or empty($out['id']));
                            }
                            break;
                        case 'title_only':
                            $rs = lookupByTitle($u1);
                            $out['id'] = @$rs['ID'];
                            $out['s'] = empty($rs['Section']) ? ckEx('section', $u1) : $rs['Section'];
                            $is_404 = empty($out['s']);
                            break;
                        case 'id_title':
                            if (is_numeric($u1) && ckExID($u1)) {
                                $rs = lookupByID($u1);
                                $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                                $out['s'] = !empty($rs['Section']) ? $rs['Section'] : '';
                                $is_404 = (empty($out['s']) or empty($out['id']));
                            } else {
                                # We don't want to miss the /section/ pages
                                $out['s'] = ckEx('section', $u1) ? $u1 : '';
                                $is_404 = empty($out['s']);
                            }
                            break;
                    }
            }
        } else {
            $out['s'] = 'default';
        }
    } else {
        // Messy mode, but prevent to get the id for file_downloads
        if ($out['id'] && !$out['s']) {
            $out['s'] = safe_field('section', 'textpattern', "ID='" . doSlash($out['id']) . "'");
        }
    }
    // Resolve AuthorID from Authorname
    if ($out['author']) {
        $out['author'] = safe_field('name', 'txp_users', "RealName like '" . doSlash($out['author']) . "'");
    }
    // Stats: found or not
    $out['status'] = $is_404 ? '404' : '200';
    if ($out['s'] == 'file_download') {
        // get id of potential filename
        if (!is_numeric($out['id'])) {
            $rs = safe_row("*", "txp_file", "filename='" . doSlash($out['id']) . "'");
        } else {
            $rs = safe_row("*", "txp_file", "id='" . intval($out['id']) . "'");
        }
        $out = $rs ? array_merge($out, $rs) : array('s' => 'file_download', 'file_error' => 404);
        return $out;
    }
    if (!$is_404) {
        $out['s'] = empty($out['s']) ? 'default' : $out['s'];
    }
    $s = $out['s'];
    $id = $out['id'];
    // hackish
    if (empty($id)) {
        $GLOBALS['is_article_list'] = true;
    }
    // by this point we should know the section, so grab its page and css
    $rs = safe_row("*", "txp_section", "name = '" . doSlash($s) . "' limit 1");
    $out['page'] = @$rs['page'];
    // Remove the below line if nothing breaks
    // 		$out['css']  = @$rs['css'];
    if (is_numeric($id)) {
        $idrs = safe_row("Posted, AuthorID, Keywords", "textpattern", "ID=" . doSlash($id));
        extract($idrs);
        if ($np = getNextPrev($id, $Posted, $s)) {
            $out = array_merge($out, $np);
        }
        $out['id_keywords'] = $Keywords;
        $out['id_author'] = get_author_name($AuthorID);
    }
    $out['path_from_root'] = $path_from_root;
    // these are deprecated as of 1.0
    $out['pfr'] = $path_from_root;
    // leaving them here for plugin compat
    $out['path_to_site'] = $path_to_site;
    $out['permlink_mode'] = $permlink_mode;
    $out['sitename'] = htmlspecialchars($sitename);
    return $out;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:publish.php

示例3: preText


//.........这里部分代码省略.........
                        case 'id_title':
                            if (is_numeric($u1) && ckExID($u1)) {
                                $rs = lookupByID($u1);
                                $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                                $out['s'] = !empty($rs['Section']) ? $rs['Section'] : '';
                                $is_404 = (empty($out['s']) or empty($out['id']));
                            } else {
                                # We don't want to miss the /section/ pages
                                $out['s'] = ckEx('section', $u1) ? $u1 : '';
                                $is_404 = empty($out['s']);
                            }
                            break;
                    }
            }
        } else {
            $out['s'] = 'default';
        }
    } else {
        // Messy mode, but prevent to get the id for file_downloads
        if ($out['id'] && !$out['s']) {
            $rs = lookupByID($out['id']);
            $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
            $out['s'] = !empty($rs['Section']) ? $rs['Section'] : '';
            $is_404 = (empty($out['s']) or empty($out['id']));
        }
    }
    // Resolve AuthorID from Authorname
    if ($out['author']) {
        $name = urldecode(strtolower(urlencode($out['author'])));
        $name = safe_field('name', 'txp_users', "RealName like '" . doSlash($out['author']) . "'");
        if ($name) {
            $out['author'] = $name;
        } else {
            $out['author'] = '';
            $is_404 = true;
        }
    }
    // allow article preview
    if (gps('txpreview') and is_logged_in()) {
        global $nolog;
        $nolog = true;
        $rs = safe_row("ID as id,Section as s", 'textpattern', 'ID = ' . intval(gps('txpreview')) . ' limit 1');
        if ($rs and $is_404) {
            $is_404 = false;
            $out = array_merge($out, $rs);
        }
    }
    // Stats: found or not
    $out['status'] = $is_404 ? '404' : '200';
    $out['pg'] = is_numeric($out['pg']) ? intval($out['pg']) : '';
    $out['id'] = is_numeric($out['id']) ? intval($out['id']) : '';
    if ($out['s'] == 'file_download') {
        // get id of potential filename
        if (!is_numeric($out['id'])) {
            $rs = safe_row("*", "txp_file", "filename='" . doSlash($out['id']) . "' and status = 4");
        } else {
            $rs = safe_row("*", "txp_file", 'id=' . intval($out['id']) . ' and status = 4');
        }
        $out = $rs ? array_merge($out, $rs) : array('s' => 'file_download', 'file_error' => 404);
        return $out;
    }
    if (!$is_404) {
        $out['s'] = empty($out['s']) ? 'default' : $out['s'];
    }
    $s = $out['s'];
    $id = $out['id'];
    // hackish
    global $is_article_list;
    if (empty($id)) {
        $is_article_list = true;
    }
    // by this point we should know the section, so grab its page and css
    $rs = safe_row("page, css", "txp_section", "name = '" . doSlash($s) . "' limit 1");
    $out['page'] = @$rs['page'];
    $out['css'] = @$rs['css'];
    if (is_numeric($id) and !$is_404) {
        $a = safe_row('*, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod', 'textpattern', 'ID=' . intval($id) . (gps('txpreview') ? '' : ' and Status in (4,5)'));
        if ($a) {
            $Posted = $a['Posted'];
            $out['id_keywords'] = $a['Keywords'];
            $out['id_author'] = $a['AuthorID'];
            populateArticleData($a);
            $uExpires = $a['uExpires'];
            if ($uExpires and time() > $uExpires and !$publish_expired_articles) {
                $out['status'] = '410';
            }
            if ($np = getNextPrev($id, $Posted, $s)) {
                $out = array_merge($out, $np);
            }
        }
    }
    $out['path_from_root'] = rhu;
    // these are deprecated as of 1.0
    $out['pfr'] = rhu;
    // leaving them here for plugin compat
    $out['path_to_site'] = $path_to_site;
    $out['permlink_mode'] = $permlink_mode;
    $out['sitename'] = $sitename;
    return $out;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:publish.php

示例4: preText


//.........这里部分代码省略.........
                    $out['author'] = safe_field('name', 'txp_users', "RealName like '{$author_name}'");
                    break;
                case strtolower(gTxt('file_download')):
                    $out['s'] = 'file_download';
                    $out['id'] = !empty($u2) ? $u2 : '';
                    break;
                case 'p':
                    $out['p'] = is_numeric($u2) ? $u2 : '';
                    break;
                default:
                    // then see if the prefs-defined permlink scheme is usable
                    switch ($permlink_mode) {
                        case 'section_id_title':
                            $out['s'] = ckEx('section', $u1) ? $u1 : 'default';
                            $out['id'] = is_numeric($u2) && ckExID($u2) ? $u2 : '';
                            break;
                        case 'year_month_day_title':
                            if (empty($u4)) {
                                $out['month'] = "{$u1}-{$u2}";
                                if (!empty($u3)) {
                                    $out['month'] .= "-{$u3}";
                                }
                                $out['s'] = 'default';
                            } else {
                                $when = date("Y-m-d", strtotime("{$u1}-{$u2}-{$u3}") + $timeoffset);
                                $rs = lookupByDateTitle($when, $u4);
                                $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                                $out['s'] = !empty($rs['Section']) ? $rs['Section'] : '';
                            }
                            break;
                        case 'section_title':
                            $rs = lookupByTitleSection($u2, $u1);
                            $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                            $out['s'] = ckEx('section', $u1) ? $u1 : 'default';
                            break;
                        case 'title_only':
                            $rs = lookupByTitle($u1);
                            $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                            $out['s'] = !empty($rs['Section']) ? $rs['Section'] : ckEx('section', $u1) ? $u1 : 'default';
                            break;
                        case 'id_title':
                            if (is_numeric($u1) && ckExID($u1)) {
                                $rs = lookupByID($u1);
                                $out['id'] = !empty($rs['ID']) ? $rs['ID'] : '';
                                $out['s'] = !empty($rs['Section']) ? $rs['Section'] : 'default';
                            } else {
                                # We don't want to miss the /section/ pages
                                $out['s'] = ckEx('section', $u1) ? $u1 : 'default';
                            }
                            break;
                    }
            }
        } else {
            $out['s'] = 'default';
        }
    } else {
        // Messy mode, but prevent to get the id for file_downloads
        if ($out['id'] && !$out['s']) {
            $out['s'] = safe_field('section', 'textpattern', "ID='" . doSlash($out['id']) . "'");
        }
    }
    if ($out['s'] == 'file_download') {
        // get id of potential filename
        if (!is_numeric($out['id'])) {
            $rs = safe_row("*", "txp_file", "filename='" . $out['id'] . "'");
        } else {
            $rs = safe_row("*", "txp_file", "id='" . $out['id'] . "'");
        }
        $out = $rs ? array_merge($out, $rs) : array('s' => 'file_download', 'file_error' => 404);
        return $out;
    }
    $out['s'] = empty($out['s']) ? 'default' : $out['s'];
    $s = $out['s'];
    $id = $out['id'];
    // hackish
    if (empty($id)) {
        $GLOBALS['is_article_list'] = true;
    }
    // by this point we should know the section, so grab its page and css
    $rs = safe_row("*", "txp_section", "name = '{$s}' limit 1");
    $out['page'] = @$rs['page'];
    $out['css'] = @$rs['css'];
    if (is_numeric($id)) {
        $idrs = safe_row("Posted, AuthorID, Keywords", "textpattern", "ID={$id}");
        extract($idrs);
        if ($np = getNextPrev($id, $Posted, $s)) {
            $out = array_merge($out, $np);
        }
        $out['id_keywords'] = $Keywords;
        $out['id_author'] = get_author_name($AuthorID);
    }
    $out['path_from_root'] = $path_from_root;
    // these are deprecated as of 1.0
    $out['pfr'] = $path_from_root;
    // leaving them here for plugin compat
    $out['path_to_site'] = $path_to_site;
    $out['permlink_mode'] = $permlink_mode;
    $out['sitename'] = htmlspecialchars($sitename);
    return $out;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:publish.php

示例5: prev_title

function prev_title()
{
    global $thisarticle, $next_id, $next_title, $prev_id, $prev_title;
    assert_article();
    if (!is_array($thisarticle)) {
        return '';
    }
    if (!isset($thisarticle['prev_title'])) {
        $np = getNextPrev();
        $thisarticle = $thisarticle + $np;
        extract($np);
    }
    return escape_title($prev_title);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:14,代码来源:taghandlers.php

示例6: _textpattern


//.........这里部分代码省略.........
             }
             // We have a match
             if (@$pretext_replacement) {
                 break;
             }
         }
         // foreach permlinks end
         // If there is no match restore the most likely partial match. Sorted by number of components and then precedence
         if (!@$pretext_replacement && count($this->partial_matches)) {
             $pt_slice = array_slice($this->partial_matches, -1);
             $pretext_replacement = array_shift($pt_slice);
         }
         unset($this->partial_matches);
         // Restore the cleaver_partial_match if there is no other matches
         if (!@$pretext_replacement && $this->cleaver_partial_match) {
             $pretext_replacement = $this->cleaver_partial_match;
         }
         unset($this->cleaver_partial_match);
         // Extract the settings for this permlink
         @extract($permlinks[$pretext_replacement['permlink_id']]['settings']);
         // If pretext_replacement is still set here then we have a match
         if (@$pretext_replacement) {
             $this->debug('Pretext Replacement ' . print_r($pretext_replacement, 1));
             if (!empty($des_section)) {
                 $pretext_replacement['s'] = $des_section;
             }
             if (!empty($des_category)) {
                 $pretext_replacement['c'] = $des_category;
             }
             if (!empty($des_feed)) {
                 $pretext_replacement[$des_feed] = 1;
             }
             if (@$pretext_replacement['id'] && @$pretext_replacement['Posted']) {
                 if ($np = getNextPrev($pretext_replacement['id'], $pretext_replacement['Posted'], @$pretext_replacement['s'])) {
                     $pretext_replacement = array_merge($pretext_replacement, $np);
                 }
             }
             unset($pretext_replacement['Posted']);
             // If there is a match then we most set the http status correctly as txp's pretext might set it to 404
             $pretext_replacement['status'] = '200';
             // Store the orginial HTTP status code
             // We might need to log the page hit if it equals 404
             $orginial_status = $pretext['status'];
             // Txp only looks at the month, but due to how we phase the month we can manipulate the sql to our needs
             if (array_key_exists('date', $pretext_replacement)) {
                 $pretext_replacement['month'] = $pretext_replacement['date'];
                 unset($pretext_replacement['date']);
             } else {
                 if (array_key_exists('year', $pretext_replacement) || array_key_exists('month', $pretext_replacement) || array_key_exists('day', $pretext_replacement)) {
                     $month = '';
                     $month .= array_key_exists('year', $pretext_replacement) ? $pretext_replacement['year'] . '-' : '____-';
                     $month .= array_key_exists('month', $pretext_replacement) ? $pretext_replacement['month'] . '-' : '__-';
                     $month .= array_key_exists('day', $pretext_replacement) ? $pretext_replacement['day'] . ' ' : '__ ';
                     $pretext_replacement['month'] = $month;
                     unset($pretext_replacement['year']);
                     unset($pretext_replacement['day']);
                 }
             }
             // Section needs to be defined so we can always get a page template.
             if (!array_key_exists('s', $pretext_replacement)) {
                 if (!@$pretext_replacement['id']) {
                     $pretext_replacement['s'] = 'default';
                 } else {
                     $pretext_replacement['s'] = safe_field('Section', 'textpattern', 'ID = ' . $pretext_replacement['id']);
                 }
             }
开发者ID:gbp,项目名称:gbp_permanent_links,代码行数:67,代码来源:gbp_permanent_links.php

示例7: link_to_prev

function link_to_prev($atts, $thing)
{
    global $id, $prev_id, $prev_title;
    extract(lAtts(array('showalways' => 0), $atts));
    if (intval($id) == 0) {
        global $thisarticle, $s;
        extract(getNextPrev($thisarticle['thisid'], @strftime('%Y-%m-%d %H:%M:%S', $thisarticle['posted']), @$s));
    }
    if ($prev_id) {
        $url = permlinkurl_id($prev_id);
        if ($thing) {
            $thing = parse($thing);
            return '<a rel="prev" href="' . $url . '"' . ($prev_title != $thing ? ' title="' . $prev_title . '"' : '') . '>' . $thing . '</a>';
        }
        return $url;
    }
    return $showalways ? parse($thing) : '';
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:18,代码来源:taghandlers.php

示例8: prev_title

function prev_title()
{
    global $thisarticle;
    assert_article();
    if (!is_array($thisarticle)) {
        return '';
    }
    if (!isset($thisarticle['prev'])) {
        $thisarticle = $thisarticle + getNextPrev();
    }
    if ($thisarticle['prev'] !== false) {
        return escape_title($thisarticle['prev']['title']);
    } else {
        return '';
    }
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:16,代码来源:taghandlers.php


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