本文整理汇总了PHP中core::request方法的典型用法代码示例。如果您正苦于以下问题:PHP core::request方法的具体用法?PHP core::request怎么用?PHP core::request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::request方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
/**
* Automatically executed before the widget action. Can be used to set
* class properties, do authorization checks, and execute other custom code.
*
* @return void
*/
public function before()
{
// get all categories
if ($this->advanced != FALSE) {
$this->cat_items = Model_Category::get_as_array();
$this->cat_order_items = Model_Category::get_multidimensional();
$this->selected_category = NULL;
if (core::request('category')) {
$this->selected_category = core::request('category');
} elseif (Model_Category::current()->loaded()) {
$this->selected_category = core::config('general.search_multi_catloc') ? array(Model_Category::current()->seoname) : Model_Category::current()->seoname;
}
// get all locations
$this->loc_items = Model_Location::get_as_array();
$this->loc_order_items = Model_Location::get_multidimensional();
$this->selected_location = NULL;
if (core::request('location')) {
$this->selected_location = core::request('location');
} elseif (Model_Location::current()->loaded()) {
$this->selected_location = core::config('general.search_multi_catloc') ? array(Model_Location::current()->seoname) : Model_Location::current()->seoname;
}
}
if ($this->custom != FALSE) {
$fields = Model_Field::get_all();
$this->custom_fields = $fields;
}
}
示例2: action_create
public function action_create()
{
try {
if (!Valid::email(core::request('email'))) {
$this->_error(__('Invalid email'), 501);
} elseif (!is_numeric(core::request('id_product'))) {
$this->_error(__('Invalid product'), 501);
} else {
$product = new Model_Product(core::request('id_product'));
if ($product->loaded()) {
$user = Model_User::create_email(core::request('email'), core::request('name'));
$order = Model_Order::new_order($user, $product);
$order->confirm_payment(core::request('paymethod', 'API'), core::request('txn_id'), core::request('pay_date'), core::request('amount'), core::request('currency'), core::request('fee'));
//adding the notes
$order->notes = core::request('notes');
$order->save();
$this->rest_output(array('order' => self::get_order_array($order)));
} else {
$this->_error(__('Something went wrong'), 501);
}
}
} catch (Kohana_HTTP_Exception $khe) {
$this->_error($khe);
}
}
示例3: get_affiliate
/**
* get the affiliate from the query or from the cookie
* @return Model_Affiliate
*/
public static function get_affiliate()
{
$id_affiliate = core::request('aff', Cookie::get(self::$_cookie_name));
$affiliate = new Model_User();
if (Core::config('affiliate.active') == 1 and is_numeric($id_affiliate) and Theme::get('premium') == 1) {
$affiliate = new Model_User($id_affiliate);
//the user exists so we set again the cookie, just in case it's a different user or to renew it
if ($affiliate->loaded()) {
Cookie::set(self::$_cookie_name, $id_affiliate, time() + 24 * 60 * 60 * Core::config('affiliate.cookie'));
}
}
return $affiliate;
}
示例4: lili_search
function lili_search($item, $key, $cats)
{
?>
<?php
if (count($item) == 0 and $cats[$key]['id_category_parent'] != 1) {
?>
<option value="<?php
echo $cats[$key]['seoname'];
?>
" data-id="<?php
echo $cats[$key]['id'];
?>
" <?php
echo core::request('category') == $cats[$key]['seoname'] ? "selected" : '';
?>
><?php
echo $cats[$key]['name'];
?>
</option>
<?php
}
?>
<?php
if ($cats[$key]['id_category_parent'] == 1 or count($item) > 0) {
?>
<option value="<?php
echo $cats[$key]['seoname'];
?>
" <?php
echo core::request('category') == $cats[$key]['seoname'] ? "selected" : '';
?>
> <?php
echo $cats[$key]['name'];
?>
</option>
<optgroup label="<?php
echo $cats[$key]['name'];
?>
">
<?php
if (is_array($item)) {
array_walk($item, 'lili_search', $cats);
}
?>
</optgroup>
<?php
}
?>
<?php
}
示例5: action_index
/**
*
* Loads a basic list info
* @param string $view template to render
*/
public function action_index($view = NULL)
{
$this->template->title = __('Orders');
$this->template->styles = array('//cdn.jsdelivr.net/bootstrap.datepicker/0.1/css/datepicker.css' => 'screen');
$this->template->scripts['footer'] = array('//cdn.jsdelivr.net/bootstrap.datepicker/0.1/js/bootstrap-datepicker.js', 'js/oc-panel/crud/index.js', 'js/oc-panel/stats/dashboard.js');
$orders = new Model_Order();
$orders = $orders->where('status', '=', Model_Order::STATUS_PAID);
//filter email
if (core::request('email') !== NULL) {
$user = new Model_User();
$user->where('email', '=', core::request('email'))->limit(1)->find();
if ($user->loaded()) {
$orders = $orders->where('id_user', '=', $user->id_user);
}
}
//filter date
if (!empty(Core::request('from_date')) and !empty(Core::request('to_date'))) {
//Getting the dates range
$from_date = Core::request('from_date', strtotime('-1 month'));
$to_date = Core::request('to_date', time());
$orders = $orders->where('pay_date', 'between', array($from_date, $to_date));
}
//filter coupon
if (is_numeric(core::request('id_coupon'))) {
$orders = $orders->where('id_coupon', '=', core::request('id_coupon'));
}
//filter product
if (is_numeric(core::request('id_product'))) {
$orders = $orders->where('id_product', '=', core::request('id_product'));
}
//filter status
if (is_numeric(core::request('status'))) {
$orders = $orders->where('status', '=', core::request('status'));
}
//order by paid if we are filtering paid....
if (core::request('status') == Model_Order::STATUS_PAID) {
$orders->order_by('pay_date', 'desc');
} else {
$orders->order_by('id_order', 'desc');
}
$items_per_page = core::request('items_per_page', 10);
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $orders->count_all(), 'items_per_page' => $items_per_page))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
$pagination->title($this->template->title);
$orders = $orders->limit($items_per_page)->offset($pagination->offset)->find_all();
$pagination = $pagination->render();
$products = new Model_Product();
$products = $products->find_all();
$this->render('oc-panel/pages/order/index', array('orders' => $orders, 'pagination' => $pagination, 'products' => $products));
}
示例6: action_get
/**
* Handle GET requests.
*/
public function action_get()
{
try {
if (($coupon_name = $this->request->param('id')) != NULL) {
$coupon = new Model_Coupon();
$coupon->where('name', '=', $coupon_name)->where('number_coupons', '>', 0)->where('valid_date', '>', Date::unix2mysql())->where('status', '=', 1);
//filter by product
if (is_numeric(core::request('id_product'))) {
$coupon->where('id_product', '=', core::request('id_product'));
}
$coupon = $coupon->limit(1)->find();
$this->rest_output(array('coupon' => $coupon->loaded() ? $coupon->as_array() : FALSE));
} else {
$this->_error('You need to specify a coupon');
}
} catch (Kohana_HTTP_Exception $khe) {
$this->_error($khe);
}
}
示例7: lolo
function lolo($item, $key, $locs)
{
?>
<?php
if (core::config('general.search_multi_catloc')) {
?>
<option value="<?php
echo $locs[$key]['seoname'];
?>
" <?php
echo (is_array(core::request('location')) and in_array($locs[$key]['seoname'], core::request('location'))) ? "selected" : '';
?>
><?php
echo $locs[$key]['name'];
?>
</option>
<?php
} else {
?>
<option value="<?php
echo $locs[$key]['seoname'];
?>
" <?php
echo core::request('location') == $locs[$key]['seoname'] ? "selected" : '';
?>
><?php
echo $locs[$key]['name'];
?>
</option>
<?php
}
?>
<?php
if (count($item) > 0) {
?>
<optgroup label="<?php
echo $locs[$key]['name'];
?>
">
<?php
if (is_array($item)) {
array_walk($item, 'lolo', $locs);
}
?>
</optgroup>
<?php
}
?>
<?php
}
示例8: check_pricing
/**
* verifies pricing in an existing order
* @return void
*/
public function check_pricing()
{
//update order based on the price and the amount of
$days = core::get('featured_days');
if (is_numeric($days) and ($price = Model_Order::get_featured_price($days)) !== FALSE) {
$this->amount = $price;
//get price from config
$this->featured_days = $days;
$this->save();
}
//original coupon so we dont lose it while we do operations
$orig_coupon = $this->id_coupon;
//remove the coupon forced by get/post
if (core::request('coupon_delete') != NULL) {
$this->id_coupon = NULL;
} elseif (Model_Coupon::valid($this->id_product) and $this->id_coupon != Model_Coupon::current()->id_coupon) {
$this->id_coupon = Model_Coupon::current()->id_coupon;
} elseif ($this->coupon->loaded() and (Date::mysql2unix($this->coupon->valid_date) < time() or $this->coupon->status == 0 or $this->coupon->number_coupons == 0)) {
Alert::set(Alert::INFO, __('Coupon not valid, expired or already used.'));
$this->coupon->clear();
$this->id_coupon = NULL;
}
//add new discount
$new_amount = Model_Coupon::price($this->id_product, $this->original_price());
//recalculate price since it change the coupon
if ($orig_coupon != $this->id_coupon or $this->amount != $new_amount) {
$this->amount = $new_amount;
try {
$this->save();
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
}
}
示例9: execute
/**
* installs the software
* @return [type] [description]
*/
public static function execute()
{
$error_msg = '';
$install = TRUE;
$TABLE_PREFIX = '';
///////////////////////////////////////////////////////
//check DB connection
$link = @mysqli_connect(core::request('DB_HOST'), core::request('DB_USER'), core::request('DB_PASS'));
if (!$link) {
$error_msg = __('Cannot connect to server') . ' ' . core::request('DB_HOST');
$install = FALSE;
}
if ($link and $install === TRUE) {
if (core::request('DB_NAME')) {
//they selected to create the DB
if (core::request('DB_CREATE')) {
@mysqli_query($link, "CREATE DATABASE IF NOT EXISTS `" . core::request('DB_NAME') . "`");
}
$dbcheck = @mysqli_select_db($link, core::request('DB_NAME'));
if (!$dbcheck) {
$error_msg .= __('Database name') . ': ' . mysqli_error($link);
$install = FALSE;
}
} else {
$error_msg .= '<p>' . __('No database name was given') . '. ' . __('Available databases') . ':</p>';
$db_list = @mysqli_query($link, 'SHOW DATABASES');
$error_msg .= '<pre>';
if (!$db_list) {
$error_msg .= __('Invalid query') . ':<br>' . mysqli_error($link);
} else {
while ($row = mysqli_fetch_assoc($db_list)) {
$error_msg .= $row['Database'] . '<br>';
}
}
$error_msg .= '</pre>';
$install = FALSE;
}
}
//clean prefix
$TABLE_PREFIX = core::slug(core::request('TABLE_PREFIX'));
//save DB config/database.php
if ($install === TRUE) {
$_POST['TABLE_PREFIX'] = $TABLE_PREFIX;
$_GET['TABLE_PREFIX'] = $TABLE_PREFIX;
$search = array('[DB_HOST]', '[DB_USER]', '[DB_PASS]', '[DB_NAME]', '[TABLE_PREFIX]', '[DB_CHARSET]');
$replace = array(core::request('DB_HOST'), core::request('DB_USER'), core::request('DB_PASS'), core::request('DB_NAME'), $TABLE_PREFIX, core::request('DB_CHARSET'));
$install = install::replace_file(INSTALLROOT . 'samples/database.php', $search, $replace, APPPATH . 'config/database.php');
if (!$install === TRUE) {
$error_msg = __('Problem saving ' . APPPATH . 'config/database.php');
}
}
//install DB
if ($install === TRUE) {
//check if has key is posted if not generate
self::$hash_key = core::request('HASH_KEY') != '' ? core::request('HASH_KEY') : core::generate_password();
//check if DB was already installed, I use content since is the last table to be created
$installed = mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . $TABLE_PREFIX . "content'")) == 1 ? TRUE : FALSE;
if ($installed === FALSE) {
//if was installed do not launch the SQL.
include INSTALLROOT . 'samples/install.sql' . EXT;
}
}
///////////////////////////////////////////////////////
//AUTH config
if ($install === TRUE) {
$search = array('[HASH_KEY]', '[COOKIE_SALT]', '[QL_KEY]');
$replace = array(self::$hash_key, self::$hash_key, self::$hash_key);
$install = install::replace_file(INSTALLROOT . 'samples/auth.php', $search, $replace, APPPATH . 'config/auth.php');
if (!$install === TRUE) {
$error_msg = __('Problem saving ' . APPPATH . 'config/auth.php');
}
}
///////////////////////////////////////////////////////
//create robots.txt
if ($install === TRUE) {
$search = array('[SITE_URL]', '[SITE_FOLDER]');
$replace = array(core::request('SITE_URL'), core::request('SITE_FOLDER'));
$install = install::replace_file(INSTALLROOT . 'samples/robots.txt', $search, $replace, DOCROOT . 'robots.txt');
if (!$install === TRUE) {
$error_msg = __('Problem saving ' . DOCROOT . 'robots.txt');
}
}
///////////////////////////////////////////////////////
//create htaccess
if ($install === TRUE) {
$search = array('[SITE_FOLDER]');
$replace = array(core::request('SITE_FOLDER'));
$install = install::replace_file(INSTALLROOT . 'samples/example.htaccess', $search, $replace, DOCROOT . '.htaccess');
if (!$install === TRUE) {
$error_msg = __('Problem saving ' . DOCROOT . '.htaccess');
}
}
///////////////////////////////////////////////////////
//all good!
if ($install === TRUE) {
core::delete(INSTALLROOT . 'install.lock');
//.........这里部分代码省略.........
示例10: __
<div class="col-sm-12">
<?php
echo FORM::label('latitude', __('Latitude'), array('class' => 'control-label', 'for' => 'latitude'));
?>
<?php
echo FORM::input('latitude', core::request('latitude'), array('placeholder' => __('Longitude'), 'class' => 'form-control', 'id' => 'latitude'));
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<?php
echo FORM::label('longitude', __('Longitude'), array('class' => 'control-label', 'for' => 'longitude'));
?>
<?php
echo FORM::input('longitude', core::request('longitude'), array('placeholder' => __('Longitude'), 'class' => 'form-control', 'id' => 'longitude'));
?>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<?php
echo FORM::button('submit', __('Create'), array('type' => 'submit', 'class' => 'btn btn-primary', 'action' => Route::url('oc-panel', array('controller' => 'location', 'action' => 'create'))));
?>
</div>
</div>
</fieldset>
<?php
echo FORM::close();
?>
</div>
示例11: echo
<option value="<?php
echo $locs[$key]['seoname'];
?>
" <?php
echo (is_array(core::request('location')) and in_array($locs[$key]['seoname'], core::request('location'))) ? "selected" : '';
?>
><?php
echo $locs[$key]['name'];
?>
</option>
<?else:?>
<option value="<?php
echo $locs[$key]['seoname'];
?>
" <?php
echo core::request('location') == $locs[$key]['seoname'] ? "selected" : '';
?>
><?php
echo $locs[$key]['name'];
?>
</option>
<?endif?>
<?if (count($item)>0):?>
<optgroup label="<?php
echo $locs[$key]['name'];
?>
">
<? if (is_array($item)) array_walk($item, 'lolo_search', $locs);?>
</optgroup>
<?endif?>
<?}
示例12: __
echo __('Please now erase the folder');
?>
<code>/install/</code><br>
<a class="btn btn-success btn-large" href="<?php
echo core::request('SITE_URL');
?>
"><?php
echo __('Go to Your Website');
?>
</a>
<a class="btn btn-warning btn-large" href="<?php
echo core::request('SITE_URL');
?>
oc-panel/home/">Admin</a>
<?php
if (core::request('ADMIN_EMAIL')) {
?>
<span class="help-block">user: <?php
echo core::request('ADMIN_EMAIL');
?>
pass: <?php
echo core::request('ADMIN_PWD');
?>
</span>
<?php
}
?>
</p>
</div>
示例13: list_logic
/**
* gets data to the view and filters the ads
* @param Model_Category $category
* @param Model_Location $location
* @return array
*/
public function list_logic($category = NULL, $location = NULL)
{
//user recognition
$user = Auth::instance()->get_user() == NULL ? NULL : Auth::instance()->get_user();
$ads = new Model_Ad();
//filter by category or location
if ($category !== NULL) {
$ads->where('id_category', 'in', $category->get_siblings_ids());
}
if ($location !== NULL) {
$ads->where('id_location', 'in', $location->get_siblings_ids());
}
//only published ads
$ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
//if ad have passed expiration time dont show
if (core::config('advertisement.expire_date') > 0) {
$ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', Date::unix2mysql());
}
//if sort by distance
if (core::request('sort') == 'distance' and Model_User::get_userlatlng()) {
$ads->select(array(DB::expr('degrees(acos(sin(radians(' . $_COOKIE['mylat'] . ')) * sin(radians(`latitude`)) + cos(radians(' . $_COOKIE['mylat'] . ')) * cos(radians(`latitude`)) * cos(radians(abs(' . $_COOKIE['mylng'] . ' - `longitude`))))) * 69.172'), 'distance'))->where('latitude', 'IS NOT', NULL)->where('longitude', 'IS NOT', NULL);
}
// featured ads
$featured = NULL;
if (Theme::get('listing_slider') == 2) {
$featured = clone $ads;
$featured = $featured->where('featured', '>=', Date::unix2mysql())->order_by('featured', 'desc')->limit(Theme::get('num_home_latest_ads', 4))->find_all();
} elseif (Theme::get('listing_slider') == 3) {
$featured = clone $ads;
$featured = $featured->where('featured', '>=', Date::unix2mysql())->order_by(DB::expr('RAND()'))->limit(Theme::get('num_home_latest_ads', 4))->find_all();
}
$res_count = clone $ads;
$res_count = $res_count->count_all();
// check if there are some advet.-s
if ($res_count > 0) {
// pagination module
$pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count, 'items_per_page' => core::config('advertisement.advertisements_per_page')))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'category' => $category !== NULL ? $category->seoname : NULL, 'location' => $location !== NULL ? $location->seoname : NULL));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page));
/**
* order depending on the sort parameter
*/
switch (core::request('sort', core::config('advertisement.sort_by'))) {
//title z->a
case 'title-asc':
$ads->order_by('title', 'asc')->order_by('published', 'desc');
break;
//title a->z
//title a->z
case 'title-desc':
$ads->order_by('title', 'desc')->order_by('published', 'desc');
break;
//cheaper first
//cheaper first
case 'price-asc':
$ads->order_by('price', 'asc')->order_by('published', 'desc');
break;
//expensive first
//expensive first
case 'price-desc':
$ads->order_by('price', 'desc')->order_by('published', 'desc');
break;
//featured
//featured
case 'featured':
$ads->order_by('featured', 'desc')->order_by('published', 'desc');
break;
//rating
//rating
case 'rating':
$ads->order_by('rate', 'desc')->order_by('published', 'desc');
break;
//distance
//distance
case 'distance':
if (Model_User::get_userlatlng()) {
$ads->order_by('distance', 'asc')->order_by('published', 'asc');
}
break;
//oldest first
//oldest first
case 'published-asc':
$ads->order_by('published', 'asc');
break;
//newest first
//newest first
case 'published-desc':
default:
$ads->order_by('published', 'desc');
break;
}
//we sort all ads with few parameters
$ads = $ads->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
} else {
// array of categories sorted for view
//.........这里部分代码省略.........
示例14: elseif
<?php
} elseif ($values == 'INPUT') {
?>
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" id="filter__<?php
echo $field_name;
?>
" name="filter__<?php
echo $field_name;
?>
" placeholder="<?php
echo isset($captions[$field_name]) ? $captions[$field_name]['model'] . ' ' . $captions[$field_name]['caption'] : $field_name;
?>
" value="<?php
echo core::request('filter__' . $field_name);
?>
" >
</div>
</div>
<?php
}
?>
<?php
}
?>
<button type="submit" class="btn btn-primary btn-icon-left"><?php
echo __('Filter');
?>
</button>
</form>
示例15: action_listing
public function action_listing()
{
if (Theme::get('infinite_scroll')) {
$this->template->scripts['footer'][] = '//cdn.jsdelivr.net/jquery.infinitescroll/2.0b2/jquery.infinitescroll.js';
$this->template->scripts['footer'][] = 'js/listing.js';
}
$this->template->scripts['footer'][] = 'js/sort.js';
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
/**
* we get the model of category from controller to filter and generate urls titles etc...
*/
$category = NULL;
$category_parent = NULL;
if (Model_Category::current()->loaded()) {
$category = Model_Category::current();
//adding the category parent
if ($category->id_category_parent != 1 and $category->parent->loaded()) {
$category_parent = $category->parent;
}
}
//base title
if ($category !== NULL) {
//category image
if (($icon_src = $category->get_icon()) !== FALSE) {
Controller::$image = $icon_src;
}
$this->template->title = $category->name;
if ($category->description != '') {
$this->template->meta_description = $category->description;
} else {
$this->template->meta_description = $category->name . ' ' . __('sold in') . ' ' . Core::config('general.site_name');
}
} else {
$this->template->title = __('all');
$this->template->meta_description = __('List of all products in') . ' ' . Core::config('general.site_name');
}
if ($category_parent !== NULL) {
$this->template->title .= ' (' . $category_parent->name . ')';
Breadcrumbs::add(Breadcrumb::factory()->set_title($category_parent->name)->set_url(Route::url('list', array('category' => $category_parent->seoname))));
}
if ($category !== NULL) {
Breadcrumbs::add(Breadcrumb::factory()->set_title($category->name)->set_url(Route::url('list', array('category' => $category->seoname))));
}
//user recognition
$user = Auth::instance()->get_user() == NULL ? NULL : Auth::instance()->get_user();
$products = new Model_Product();
//filter by category
if ($category !== NULL) {
$products->where('id_category', 'in', $category->get_siblings_ids());
}
//only published products
$products->where('status', '=', Model_Product::STATUS_ACTIVE);
$res_count = $products->count_all();
// check if there are some advet.-s
if ($res_count > 0) {
// pagination module
$pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count, 'items_per_page' => core::config('general.products_per_page')))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'category' => $category !== NULL ? $category->seoname : NULL));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page));
/**
* order depending on the sort parameter
*/
switch (core::request('sort', core::config('general.sort_by'))) {
//title z->a
case 'title-asc':
$products->order_by('title', 'asc')->order_by('created', 'desc');
break;
//title a->z
//title a->z
case 'title-desc':
$products->order_by('title', 'desc')->order_by('created', 'desc');
break;
//cheaper first
//cheaper first
case 'price-asc':
$products->order_by('price', 'asc')->order_by('created', 'desc');
break;
//expensive first
//expensive first
case 'price-desc':
$products->order_by('price', 'desc')->order_by('created', 'desc');
break;
//featured
//featured
case 'featured':
default:
$products->order_by('featured', 'desc')->order_by('created', 'desc');
break;
//oldest first
//oldest first
case 'published-asc':
$products->order_by('created', 'asc');
break;
//newest first
//newest first
case 'published-desc':
$products->order_by('created', 'desc');
break;
}
//we sort all products with few parameters
$products = $products->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
//.........这里部分代码省略.........