本文整理汇总了PHP中core::get方法的典型用法代码示例。如果您正苦于以下问题:PHP core::get方法的具体用法?PHP core::get怎么用?PHP core::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_list
/**
* displays the topics on a forums
* @return [type] [description]
*/
public function action_list()
{
//in case performing a search
if (strlen($search = core::get('search')) >= 3) {
return $this->action_search($search);
}
$this->template->styles = array('css/forums.css' => 'screen');
$this->template->scripts['footer'][] = 'js/forums.js';
$forum = new Model_Forum();
$forum->where('seoname', '=', $this->request->param('forum', NULL))->cached()->limit(1)->find();
if ($forum->loaded()) {
//template header
$this->template->title = $forum->name . ' - ' . __('Forum');
$this->template->meta_description = $forum->description;
Breadcrumbs::add(Breadcrumb::factory()->set_title($forum->name));
//count all topics
$count = DB::select(array(DB::expr('COUNT("id_post")'), 'count'))->from(array('posts', 'p'))->where('id_post_parent', 'IS', NULL)->where('id_forum', '=', $forum->id_forum)->cached()->execute();
$count = array_keys($count->as_array('count'));
$pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => isset($count[0]) ? $count[0] : 0))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'forum' => $this->request->param('forum')));
$pagination->title($this->template->title);
//getting all the topic for the forum
$topics = DB::select('p.*')->select(array(DB::select(DB::expr('COUNT("id_post")'))->from(array('posts', 'pc'))->where('pc.id_post_parent', '=', DB::expr(Database::instance('default')->table_prefix() . 'p.id_post'))->where('pc.id_forum', '=', $forum->id_forum)->where('pc.status', '=', Model_Post::STATUS_ACTIVE)->group_by('pc.id_post_parent'), 'count_replies'))->select(array(DB::select('ps.created')->from(array('posts', 'ps'))->where('ps.id_post', '=', DB::expr(Database::instance('default')->table_prefix() . 'p.id_post'))->or_where('ps.id_post_parent', '=', DB::expr(Database::instance('default')->table_prefix() . 'p.id_post'))->where('ps.id_forum', '=', $forum->id_forum)->where('ps.status', '=', Model_Post::STATUS_ACTIVE)->order_by('ps.created', 'DESC')->limit(1), 'last_message'))->from(array('posts', 'p'))->where('id_post_parent', 'IS', NULL)->where('id_forum', '=', $forum->id_forum)->where('status', '=', Model_Post::STATUS_ACTIVE)->order_by('last_message', 'DESC')->limit($pagination->items_per_page)->offset($pagination->offset)->as_object()->execute();
$pagination = $pagination->render();
$this->template->bind('content', $content);
$this->template->content = View::factory('pages/forum/list', array('topics' => $topics, 'forum' => $forum, 'pagination' => $pagination));
} else {
//throw 404
throw HTTP_Exception::factory(404, __('Page not found'));
}
}
示例2: action_index
/**
* List all Advertisements (PUBLISHED)
*/
public function action_index()
{
//template header
$this->template->title = __('Advertisements');
$this->template->meta_description = __('Advertisements');
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('List')));
$this->template->scripts['footer'][] = 'js/jquery.toolbar.js';
$this->template->scripts['footer'][] = 'js/oc-panel/moderation.js';
$ads = new Model_Ad();
$fields = array('title', 'id_ad', 'published', 'created', 'id_category', 'id_location', 'status');
//filter ads by status
$status = is_numeric(Core::get('status')) ? Core::get('status') : Model_Ad::STATUS_PUBLISHED;
$ads = $ads->where('status', '=', $status);
// sort ads by search value
if ($q = $this->request->query('search')) {
$ads = $ads->where('title', 'like', '%' . $q . '%');
if (core::config('general.search_by_description') == TRUE) {
$ads = $ads->or_where('description', 'like', '%' . $q . '%');
}
}
$ads_count = clone $ads;
$res_count = $ads_count->count_all();
if ($res_count > 0) {
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $res_count, 'items_per_page' => 50))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
$ads = $ads->order_by(core::get('order', 'published'), core::get('sort', 'desc'))->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$this->template->content = View::factory('oc-panel/pages/ad', array('res' => $ads, 'pagination' => $pagination, 'fields' => $fields));
} else {
$this->template->content = View::factory('oc-panel/pages/ad', array('res' => NULL, 'fields' => $fields));
}
}
示例3: action_index
public function action_index()
{
//if they want to see a single post
$seotitle = $this->request->param('seotitle', NULL);
if ($seotitle !== NULL) {
return $this->action_view($seotitle);
}
//in case performing a search
$search = core::get('search');
if (strlen($search) >= 3) {
return $this->action_search($search);
}
//template header
$this->template->title = __(' Frequently Asked Questions - FAQ');
$this->template->meta_description = core::config('general.site_name') . ' ' . __('frequently asked questions.');
$this->template->styles = array('css/faq.css' => 'screen');
$this->template->scripts['footer'] = array('js/faq.js');
//FAQ CMS
$faqs = new Model_Content();
$faqs = $faqs->where('type', '=', 'help')->where('status', '=', '1')->order_by('order', 'asc')->find_all();
$this->template->bind('content', $content);
if (strlen(core::config('general.faq_disqus')) > 0) {
$disqus = View::factory('pages/disqus', array('disqus' => core::config('general.faq_disqus')));
} else {
$disqus = '';
}
$this->template->content = View::factory('pages/faq/listing', array('faqs' => $faqs, 'disqus' => $disqus));
}
示例4: action_saveorder
/**
* saves the forum in a specific order and change the parent
* @return void
*/
public function action_saveorder()
{
$this->auto_render = FALSE;
$this->template = View::factory('js');
$forum = new Model_Forum(core::get('id_forum'));
if ($forum->loaded()) {
//saves the current forum
$forum->id_forum_parent = core::get('id_forum_parent');
$forum->parent_deep = core::get('deep');
//saves the forums in the same parent the new orders
$order = 0;
foreach (core::get('brothers') as $id_forum) {
$id_forum = substr($id_forum, 3);
//removing the li_ to get the integer
//not the main forum so loading and saving
if ($id_forum != core::get('id_forum')) {
$c = new Model_Forum($id_forum);
$c->order = $order;
$c->save();
} else {
//saves the main forum
$forum->order = $order;
$forum->save();
}
$order++;
}
Core::delete_cache();
$this->template->content = __('Saved');
} else {
$this->template->content = __('Error');
}
}
示例5: action_saveorder
/**
* saves the location in a specific order and change the parent
* @return void
*/
public function action_saveorder()
{
$this->auto_render = FALSE;
$this->template = View::factory('js');
$loc = new Model_Location(core::get('id_location'));
if ($loc->loaded()) {
//saves the current location
$loc->id_location_parent = core::get('id_location_parent');
$loc->parent_deep = core::get('deep');
//saves the categories in the same parent the new orders
$order = 0;
foreach (core::get('brothers') as $id_loc) {
$id_loc = substr($id_loc, 3);
//removing the li_ to get the integer
//not the main location so loading and saving
if ($id_loc != core::get('id_location')) {
$c = new Model_Location($id_loc);
$c->order = $order;
$c->save();
} else {
//saves the main location
$loc->order = $order;
$loc->save();
}
$order++;
}
$this->template->content = __('Saved');
} else {
$this->template->content = __('Error');
}
}
示例6: lili
function lili($item, $key, $cats)
{
?>
<option value="<?php
echo $cats[$key]['seoname'];
?>
" <?php
echo core::get('category') == $cats[$key]['seoname'] ? 'selected' : '';
?>
>
<?php
echo $cats[$key]['name'];
?>
</option>
<?php
if (count($item) > 0) {
?>
<optgroup label="<?php
echo HTML::chars($cats[$key]['name']);
?>
">
<?php
if (is_array($item)) {
array_walk($item, 'lili', $cats);
}
?>
<?php
}
?>
<?php
}
示例7: action_index
/**
*
* Loads a basic list info
* @param string $view template to render
*/
public function action_index($view = NULL)
{
$this->template->title = __('Coupons');
$this->template->scripts['footer'][] = 'js/oc-panel/coupon.js';
$elements = new Model_Coupon();
if (core::get('name') !== NULL) {
$elements = $elements->where('name', '=', core::get('name'));
}
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $elements->count_all()))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
$pagination->title($this->template->title);
$elements = $elements->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$pagination = $pagination->render();
$this->render('oc-panel/pages/coupon/index', array('elements' => $elements, 'pagination' => $pagination));
}
示例8: action_index
public function action_index()
{
$messages = Model_Message::get_threads($this->user, core::get('status'));
$res_count = $messages->count_all();
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Messaging'))->set_url(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index'))));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Inbox')));
Controller::$full_width = TRUE;
if ($res_count > 0) {
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/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()));
Breadcrumbs::add(Breadcrumb::factory()->set_title(sprintf(__("Page %d"), $pagination->current_page)));
$messages = $messages->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$this->template->styles = array('css/jquery.sceditor.default.theme.min.css' => 'screen');
$this->template->scripts['footer'] = array('js/jquery.sceditor.bbcode.min.js', 'js/messages.js');
$this->template->content = View::factory('oc-panel/pages/messages/index', array('messages' => $messages, 'pagination' => $pagination, 'user' => $this->user));
} else {
$this->template->content = View::factory('oc-panel/pages/messages/index', array('messages' => NULL, 'pagination' => NULL, 'user' => $this->user));
}
}
示例9: before
/**
* Initialize properties before running the controller methods (actions),
* so they are available to our action.
* @param string $template view to use as template
* @return void
*/
public function before($template = NULL)
{
Theme::checker();
$this->maintenance();
//Gets a coupon if selected
Model_Coupon::current();
if ($this->auto_render === TRUE) {
// Load the template
$this->template = $template === NULL ? 'oc-panel/main' : $template;
//if its and ajx request I want only the content
if (Core::get('rel') == 'ajax') {
$this->template = 'oc-panel/content';
}
$this->template = View::factory($this->template);
// Initialize empty values
$this->template->title = __('Panel') . ' - ' . core::config('general.site_name');
$this->template->meta_keywords = '';
$this->template->meta_description = '';
$this->template->meta_copyright = 'Open eShop ' . Core::VERSION;
$this->template->header = '';
$this->template->content = '';
$this->template->footer = '';
$this->template->styles = array();
$this->template->scripts = array();
$this->template->user = Auth::instance()->get_user();
//non ajax request
if (Core::get('rel') != 'ajax') {
if (core::get('print') == 1) {
$this->template->header = '';
$this->template->footer = '';
} else {
$this->template->header = View::factory('oc-panel/header');
$this->template->footer = View::factory('oc-panel/footer');
}
//other color
if (Theme::get('admin_theme') == 'bootstrap') {
Theme::$styles = array('//cdn.jsdelivr.net/bootswatch/3.3.6/paper/bootstrap.min.css' => 'screen', '//cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css?v=print' => 'print', '//cdn.jsdelivr.net/chosen/1.0.0/chosen.css' => 'screen', '//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.css' => 'screen', '//cdn.jsdelivr.net/sweetalert/1.1.3/sweetalert.css' => 'screen', 'css/jquery.sceditor.default.theme.min.css' => 'screen', 'css/loadingbar.css' => 'screen', 'css/icon-picker.min.css' => 'screen', 'css/font-awesome.min.css' => 'screen', 'css/summernote.css' => 'screen', 'css/admin-styles.css?v=' . Core::VERSION => 'screen');
} else {
Theme::$styles = array('//cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css' => 'screen', '//cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css?v=print' => 'print', '//cdn.jsdelivr.net/bootswatch/3.3.6/' . Theme::get('admin_theme', 'cerulean') . '/bootstrap.min.css' => 'screen', '//cdn.jsdelivr.net/chosen/1.0.0/chosen.css' => 'screen', '//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.css' => 'screen', '//cdn.jsdelivr.net/sweetalert/1.1.3/sweetalert.css' => 'screen', 'css/jquery.sceditor.default.theme.min.css' => 'screen', 'css/loadingbar.css' => 'screen', 'css/icon-picker.min.css' => 'screen', 'css/font-awesome.min.css' => 'screen', 'css/summernote.css' => 'screen', 'css/admin-styles.css?v=' . Core::VERSION => 'screen');
}
Theme::$scripts['footer'] = array('//code.jquery.com/jquery-1.10.2.min.js', '//cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js', '//cdn.jsdelivr.net/chosen/1.0.0/chosen.jquery.min.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'chosen')), (Kohana::$environment !== Kohana::DEVELOPMENT ? 'market.' . Core::DOMAIN . '' : 'eshop.lo') . '/embed.js', 'js/oc-panel/theme.init.js?v=' . Core::VERSION, 'js/jquery.sceditor.bbcode.min.js', 'js/summernote.min.js', 'js/summernote-ext-video.js', 'js/jquery.validate.min.js', Route::url('jslocalization', array('controller' => 'jslocalization', 'action' => 'validate')), 'js/jquery.cookie.min.js', 'js/iconPicker.min.js', 'js/oc-panel/sidebar.js?v=' . Core::VERSION, '//cdn.jsdelivr.net/bootstrap.tagsinput/0.3.9/bootstrap-tagsinput.min.js', '//cdn.jsdelivr.net/sweetalert/1.1.3/sweetalert.min.js', 'js/jquery.bootgrid.min.js', 'js/query.bootgrid.fa.min.js', 'js/form.js?v=' . Core::VERSION);
}
}
}
示例10: action_index
/**
*
* Loads a basic list info
* @param string $view template to render
*/
public function action_index($view = NULL)
{
$this->template->title = __('Reviews');
$this->template->scripts['footer'][] = 'js/oc-panel/crud/index.js';
$reviews = new Model_Review();
//$reviews = $reviews->where('status', '=', Model_Review::STATUS_ACTIVE);
if (core::get('email') !== NULL) {
$user = new Model_User();
$user->where('email', '=', core::get('email'))->limit(1)->find();
if ($user->loaded()) {
$reviews = $reviews->where('id_user', '=', $user->id_user);
}
}
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $reviews->count_all()))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
$pagination->title($this->template->title);
$reviews = $reviews->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$pagination = $pagination->render();
$this->render('oc-panel/pages/review/index', array('reviews' => $reviews, 'pagination' => $pagination));
}
示例11: action_index
/**
*
* Loads a basic list info
* @param string $view template to render
*/
public function action_index($view = NULL)
{
$this->template->title = __('Affiliates Commissions');
$this->template->scripts['footer'][] = 'js/oc-panel/crud/index.js';
$commissions = new Model_Affiliate();
//filter by email
if (core::get('email') !== NULL) {
$user = new Model_User();
$user->where('email', '=', core::get('email'))->limit(1)->find();
if ($user->loaded()) {
$commissions = $commissions->where('id_user', '=', $user->id_user);
}
}
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $commissions->count_all()))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
$pagination->title($this->template->title);
$commissions = $commissions->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$pagination = $pagination->render();
$this->render('oc-panel/pages/affiliate/index', array('commissions' => $commissions, 'pagination' => $pagination));
}
示例12: action_index
/**
*
* Loads a basic list info
* @param string $view template to render
*/
public function action_index($view = NULL)
{
$this->template->title = __($this->_orm_model);
$this->template->scripts['footer'][] = 'js/oc-panel/crud/index.js';
$elements = ORM::Factory($this->_orm_model);
//->find_all();
//email search
if (Valid::email(core::get('email'))) {
$users = new Model_User();
$users->where('email', '=', core::get('email'))->limit(1)->find();
if ($users->loaded()) {
$elements->where('id_user', '=', $users->id_user);
}
}
$pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $elements->count_all()))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
$pagination->title($this->template->title);
$elements = $elements->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$pagination = $pagination->render();
$this->render('oc-panel/pages/download/index', array('elements' => $elements, 'pagination' => $pagination));
}
示例13: action_index
public function action_index()
{
require_once Kohana::find_file('vendor', 'php-googlemap/GoogleMap', 'php');
$this->before('/pages/maps');
$this->template->title = __('Map');
$height = Core::get('height', '100%');
$width = Core::get('width', '100%');
$map = new GoogleMapAPI();
$map->setWidth($width);
$map->setHeight($height);
$map->disableSidebar();
$map->setMapType('map');
$map->setZoomLevel(Core::get('zoom', core::config('advertisement.map_zoom')));
//$map->mobile = TRUE;
$atributes = array("target='_blank'");
if (core::get('controls') == 0) {
$map->disableMapControls();
$map->disableTypeControls();
$map->disableScaleControl();
$map->disableZoomEncompass();
$map->disableStreetViewControls();
$map->disableOverviewControl();
}
//only 1 marker
if (core::get('address') != '') {
$map->addMarkerByAddress(core::get('address'), core::get('address'));
} else {
//last ads, you can modify this value at: general.feed_elements
$ads = DB::select('a.seotitle')->select(array('c.seoname', 'category'), 'a.title', 'a.published', 'a.address')->from(array('ads', 'a'))->join(array('categories', 'c'), 'INNER')->on('a.id_category', '=', 'c.id_category')->where('a.status', '=', Model_Ad::STATUS_PUBLISHED)->where('a.address', 'IS NOT', NULL)->order_by('published', 'desc')->limit(Core::config('general.map_elements'))->as_object()->cached()->execute();
foreach ($ads as $a) {
//d($a);
if (strlen($a->address) > 3) {
$url = Route::url('ad', array('category' => $a->category, 'seotitle' => $a->seotitle));
$map->addMarkerByAddress($a->address, $a->title, HTML::anchor($url, $a->title, $atributes));
}
}
//only center if not a single ad
$map->setCenterCoords(Core::get('lon', core::config('advertisement.center_lon')), Core::get('lat', core::config('advertisement.center_lat')));
}
$this->template->map = $map;
}
示例14: action_register
/**
* simple registration without password
* @return [type] [description]
*/
public function action_register()
{
$provider_name = $this->request->param('id');
$this->template->content = View::factory('pages/auth/register-social', array('provider' => $provider_name, 'uid' => core::get('uid'), 'name' => core::get('name')));
if (core::post('email') and CSRF::valid('register_social')) {
$email = core::post('email');
if (Valid::email($email, TRUE)) {
//register the user in DB
Model_User::create_social($email, core::post('name'), $provider_name, core::get('uid'));
//log him in
Auth::instance()->social_login($provider_name, core::get('uid'));
Alert::set(Alert::SUCCESS, __('Welcome!'));
//change the redirect
$this->redirect(Route::url('default'));
} else {
Form::set_errors(array(__('Invalid Email')));
}
}
//template header
$this->template->title = __('Register new user');
}
示例15: request
/**
* shortcut to get or post
* @param [type] $key [description]
* @param [type] $default [description]
* @return [type] [description]
*/
public static function request($key, $default = NULL)
{
return core::post($key) !== NULL ? core::post($key) : core::get($key, $default);
}