本文整理汇总了PHP中tools::htmlentitiesUTF8方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::htmlentitiesUTF8方法的具体用法?PHP tools::htmlentitiesUTF8怎么用?PHP tools::htmlentitiesUTF8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::htmlentitiesUTF8方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pagination
public function pagination($nbProducts = 10)
{
if (!self::$initialized) {
$this->init();
}
$nArray = Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50);
// Clean duplicate values
$nArray = array_unique($nArray);
asort($nArray);
$this->n = abs((int) Tools::getValue('n', isset(self::$cookie->nb_item_per_page) && self::$cookie->nb_item_per_page >= 10 ? self::$cookie->nb_item_per_page : (int) Configuration::get('PS_PRODUCTS_PER_PAGE')));
$this->p = abs((int) Tools::getValue('p', 1));
if (!is_numeric(Tools::getValue('p', 1)) || Tools::getValue('p', 1) < 0) {
Tools::redirect('404.php');
}
$current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']);
//delete parameter page
$current_url = preg_replace('/(\\?)?(&)?p=\\d+/', '$1', $current_url);
$range = 5;
/* how many pages around page selected原值2改为更大值,但仍存在诸多问题 */
if ($this->p < 0) {
$this->p = 0;
}
if (isset(self::$cookie->nb_item_per_page) && $this->n != self::$cookie->nb_item_per_page && in_array($this->n, $nArray)) {
self::$cookie->nb_item_per_page = $this->n;
}
if ($this->p > $nbProducts / $this->n + 1) {
Tools::redirect(preg_replace('/[&?]p=\\d+/', '', $_SERVER['REQUEST_URI']));
}
$pages_nb = ceil($nbProducts / (int) $this->n);
$start = (int) ($this->p - $range);
if ($start < 1) {
$start = 1;
}
$stop = (int) ($this->p + $range);
if ($stop > $pages_nb) {
$stop = (int) $pages_nb;
}
self::$smarty->assign('nb_products', $nbProducts);
$pagination_infos = array('products_per_page' => (int) Configuration::get('PS_PRODUCTS_PER_PAGE'), 'pages_nb' => $pages_nb, 'p' => $this->p, 'n' => $this->n, 'nArray' => $nArray, 'range' => $range, 'start' => $start, 'stop' => $stop, 'current_url' => $current_url);
self::$smarty->assign($pagination_infos);
}
示例2: assignPagination
public function assignPagination($limit, $nbPosts)
{
$this->n = $limit;
$this->p = abs((int) Tools::getValue('p', 1));
$current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']);
//delete parameter page
$current_url = preg_replace('/(\\?)?(&)?p=\\d+/', '$1', $current_url);
$range = 2;
/* how many pages around page selected */
if ($this->p < 1) {
$this->p = 1;
}
$pages_nb = ceil($nbPosts / (int) $this->n);
$start = (int) ($this->p - $range);
if ($start < 1) {
$start = 1;
}
$stop = (int) ($this->p + $range);
if ($stop > $pages_nb) {
$stop = (int) $pages_nb;
}
$this->context->smarty->assign('nb_posts', $nbPosts);
$pagination_infos = array('products_per_page' => $limit, 'pages_nb' => $pages_nb, 'p' => $this->p, 'n' => $this->n, 'range' => $range, 'start' => $start, 'stop' => $stop, 'current_url' => $current_url);
$this->context->smarty->assign($pagination_infos);
}
示例3: pagination
public function pagination($nbProducts = 10)
{
if (!self::$initialized) {
$this->init();
}
$nArray = (int) Configuration::get('TAS_ITEMS_PER_PAGE') != 20 ? array((int) Configuration::get('TAS_ITEMS_PER_PAGE'), 20) : array(20);
// Clean duplicate values
$nArray = array_unique($nArray);
asort($nArray);
$this->n = abs((int) Tools::getValue('n', (isset(self::$cookie->nb_item_per_page) and self::$cookie->nb_item_per_page >= 20) ? self::$cookie->nb_item_per_page : (int) Configuration::get('TAS_ITEMS_PER_PAGE')));
$this->p = abs((int) Tools::getValue('p', 1));
$current_url = tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']);
//delete parameter page
$current_url = preg_replace('/(\\?)?(&)?p=\\d+/', '$1', $current_url);
$range = 2;
/* how many pages around page selected */
if ($this->p < 0) {
$this->p = 0;
}
if (isset(self::$cookie->nb_item_per_page) and $this->n != self::$cookie->nb_item_per_page and in_array($this->n, $nArray)) {
self::$cookie->nb_item_per_page = $this->n;
}
if ($this->p > $nbProducts / $this->n + 1) {
$this->p = 1;
}
$pages_nb = ceil($nbProducts / (int) $this->n);
$start = (int) ($this->p - $range);
if ($start < 1) {
$start = 1;
}
$stop = (int) ($this->p + $range);
if ($stop > $pages_nb) {
$stop = (int) $pages_nb;
}
self::$smarty->assign('nb_products', $nbProducts);
$pagination_infos = array('products_per_page' => (int) Configuration::get('TAS_ITEMS_PER_PAGE'), 'pages_nb' => $pages_nb, 'p' => $this->p, 'n' => $this->n, 'nArray' => $nArray, 'range' => $range, 'start' => $start, 'stop' => $stop, 'current_url' => $current_url);
self::$smarty->assign($pagination_infos);
}