Вход Регистрация
Файл: core/class/nav.php
Строк: 48
<?php

/**
 * @package     Prime Social
 * @link        http://primesocial.ru
 * @copyright   Copyright (C) 2016 Prime Social
 * @author      BoB | http://primesocial.ru/about
 */

/**
 * Class Navigator
 */
class Navigator
{
    
/**
     * Navigator constructor.
     * @param $all
     * @param $pnumber
     * @param string $query
     */
    
public function __construct($all$pnumber$query '')
    {
        
$this->all $all;
        
$this->pnumber $pnumber;
        
$this->query $query;
        
$this->= isset($_GET['p']) ? (int)$_GET['p'] : 1;
        if (isset(
$_POST['p'])) {
            
$this->= (int)$_POST['p'];
        }


    }

    
/**
     * @return float|int
     */
    
public function start()
    {
        
$this->num_ps ceil($this->all $this->pnumber);
        if (isset(
$_GET['last']))
            
$this->$this->num_ps;
        
$this->start $this->$this->pnumber $this->pnumber;
        if (
$this->$this->num_ps || $this->1) {
            
$this->1;
            
$this->start 0;
        }
        return 
$this->start;
    }

    
/**
     * @return string
     */
    
public function navi()
    {
        global 
$lng;
        if (
$this->num_ps 2)
            return 
'';
        
$buff DIV_BLOCK;

        if (
$this->1) {
            
$n $this->p;
            
$n--;
            
$buff .= '&laquo;<a href="' $_SERVER['SCRIPT_NAME'] . '?p=' $n '&amp;' $this->query '">' $lng['Orqaga'] . '</a>';
        }

        if ((
$this->1) && ($this->!= $this->num_ps)) {
            
$buff .= ' | ';
        }

        if (
$this->!= $this->num_ps) {
            
$p $this->p;
            
$p++;
            
$buff .= ' <a href="' $_SERVER['SCRIPT_NAME'] . '?p=' $p '&amp;' $this->query '">' $lng['Oldinga'] . '</a>&raquo;';
        }
        
$buff .= '<br/>';
        for (
$pr ''$i 1$i <= $this->num_ps$i++) {
            
$buff .=
            
$pr = (($i == || $i == $this->num_ps || abs($i $this->p) < 5) ? ($i == $this->" [$i] " ' <a href="' $_SERVER['SCRIPT_NAME'] . '?p=' $i '&amp;' $this->query '">' $i '</a> ') : (($pr == ' .. ' || $pr == '') ? '' ' .. '));
        }
        if (
$this->num_ps 9) {
            
$buff .= '</div>' DIV_BLOCK '<form action="' $_SERVER['SCRIPT_NAME'] . '?' $this->query '" method="POST">
                <input type="text" size="3" name="p" value="' 
$this->'">
                <INPUT type="submit" name="" value="&gt;&gt;"><br></FORM>'
;
        }

        
$buff .= '</div>';
        return 
$buff '';
    }
}
Онлайн: 1
Реклама