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


PHP Core::get方法代码示例

本文整理汇总了PHP中Core::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::get方法的具体用法?PHP Core::get怎么用?PHP Core::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core的用法示例。


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

示例1: 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);
     }
     //template header
     $this->template->title = __('Blog');
     $this->template->meta_description = core::config('general.site_name') . ' ' . __('blog section.');
     $posts = new Model_Post();
     $posts->where('status', '=', Model_Post::STATUS_ACTIVE)->where('id_forum', 'IS', NULL);
     if (($search = Core::get('search')) !== NULL and strlen(Core::get('search')) >= 3) {
         $posts->where_open()->where('title', 'like', '%' . $search . '%')->or_where('description', 'like', '%' . $search . '%')->where_close();
     }
     $res_count = clone $posts;
     $res_count = $res_count->count_all();
     // check if there are some post
     if ($res_count > 0) {
         // pagination module
         $pagination = Pagination::factory(array('view' => 'pagination', 'total_items' => $res_count))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action()));
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__("Page ") . $pagination->current_page));
         //we sort all ads with few parameters
         $posts = $posts->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
     } else {
         $posts = NULL;
         $pagination = NULL;
     }
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/blog/listing', array('posts' => $posts, 'pagination' => $pagination, 'user' => Auth::instance()->get_user()));
 }
开发者ID:nick-catanchin-ie,项目名称:common,代码行数:31,代码来源:blog.php

示例2: initialize

 /**
  * 
  * Initializes the php-gettext
  * Remember to load first php-gettext
  * @param string $locale
  * @param string $charset
  * @param string $domain
  */
 public static function initialize($locale = 'en_UK', $charset = 'utf-8', $domain = 'messages')
 {
     /**
      * setting the statics so later we can access them from anywhere
      */
     //we allow to choose lang from the url
     if (Core::config('i18n.allow_query_language') == 1) {
         if (Core::get('language') !== NULL) {
             $locale = Core::get('language');
         } elseif (Cookie::get('user_language') !== NULL) {
             $locale = Cookie::get('user_language');
         }
         Cookie::set('user_language', $locale, Core::config('auth.lifetime'));
     }
     self::$lang = $locale;
     //used in i18n kohana
     self::$locale = $locale;
     self::$charset = $charset;
     self::$domain = $domain;
     //time zone set in the config
     date_default_timezone_set(Kohana::$config->load('i18n')->timezone);
     //Kohana core charset, used in the HTML templates as well
     Kohana::$charset = self::$charset;
     /**
      * In Windows LC_MESSAGES are not recognized by any reason.
      * So we check if LC_MESSAGES is defined to avoid bugs,
      * and force using gettext
      */
     if (defined('LC_MESSAGES')) {
         $locale_res = setlocale(LC_MESSAGES, self::$locale);
     } else {
         $locale_res = FALSE;
     }
     // used with a function money_format
     setlocale(LC_MONETARY, self::$locale);
     /**
      * check if gettext exists if not uses gettext dropin
      */
     if (!function_exists('_') or $locale_res === FALSE or empty($locale_res)) {
         /**
          * gettext override
          * v 1.0.11
          * https://launchpad.net/php-gettext/
          * We load php-gettext here since Kohana_I18n tries to create the function __() function when we extend it.
          * PHP-gettext already does this.
          */
         require Kohana::find_file('vendor', 'php-gettext/gettext', 'inc');
         T_setlocale(LC_MESSAGES, self::$locale);
         T_bindtextdomain(self::$domain, DOCROOT . 'languages');
         T_bind_textdomain_codeset(self::$domain, self::$charset);
         T_textdomain(self::$domain);
         //force to use the gettext dropin
         self::$dropin = TRUE;
     } else {
         bindtextdomain(self::$domain, DOCROOT . 'languages');
         bind_textdomain_codeset(self::$domain, self::$charset);
         textdomain(self::$domain);
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:67,代码来源:i18n.php

示例3: write

 public static function write($message)
 {
     //формируем строку лога
     $string = date('Y.m.d, H:i:s') . '::' . $message . "\n";
     //определяем файл
     $logFile = Core::get()->CONFIG['path']['root'] . 'log.txt';
     //записываем
     file_put_contents($logFile, $string, FILE_APPEND);
 }
开发者ID:alexxxiy,项目名称:geekbrains-homework-php02-miniFramework,代码行数:9,代码来源:logger.php

示例4: action_status

 public function action_status()
 {
     if ($this->request->param('id') !== NULL and is_numeric($id_msg_thread = $this->request->param('id')) and is_numeric(Core::get('status'))) {
         if (Model_Message::status_thread($id_msg_thread, $this->user, Core::get('status'))) {
             Alert::set(Alert::SUCCESS, __('Done'));
         }
     } else {
         Alert::set(Alert::ERROR, __('Message not found'));
     }
     $this->redirect(Route::url('oc-panel', array('controller' => 'messages', 'action' => 'index')));
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:11,代码来源:messages.php

示例5: action_saveorder

 /**
  * saves the category in a specific order and change the parent
  * @return void 
  */
 public function action_saveorder()
 {
     $this->auto_render = FALSE;
     $this->template = View::factory('js');
     if (Menu::change_order(Core::get('order'))) {
         Core::delete_cache();
         $this->template->content = __('Saved');
     } else {
         $this->template->content = __('Error');
     }
 }
开发者ID:Ryanker,项目名称:open-eshop,代码行数:15,代码来源:menu.php

示例6: action_saveorder

 /**
  * saves the category in a specific order and change the parent
  * @return void 
  */
 public function action_saveorder()
 {
     $this->auto_render = FALSE;
     $this->template = View::factory('js');
     if (Menu::change_order(Core::get('order'))) {
         Cache::instance()->delete_all();
         Theme::delete_minified();
         $this->template->content = __('Saved');
     } else {
         $this->template->content = __('Error');
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:16,代码来源:menu.php

示例7: menu_page

function menu_page()
{
    $user = Core::get()->getLoggedInUser();
    Core::get()->setActiveTemplate("menu");
    $output = '
		<h4>Velkommen (' . $user->navn . ') ' . $user->username . '</h4>
		<a href="index.php?q=order_new" data-transition="slide" data-icon="new" data-role="button" data-iconpos="right">Ny ordre</a>

		<a href="index.php?q=logout" data-transition="slide" data-icon="back" data-role="button" data-iconpos="right">Log ud</a>

	';
    return $output;
}
开发者ID:BerlingskeMedia,项目名称:gadesalg,代码行数:13,代码来源:menu.php

示例8: logout_page

function logout_page()
{
    // Unset some cookie shit
    // Say bye
    Core::get()->loggedIn(false);
    $output = '
		<h3>Du er nu logget ud - tak for besøget</h3>
		<form id="login_again" action="index.php?q=login" method="post">
			<button type="submit" data-theme="a">Login igen</button>
		</form>
	';
    return $output;
}
开发者ID:BerlingskeMedia,项目名称:gadesalg,代码行数:13,代码来源:login.php

示例9: action_products

 /**
  * API that return the products.
  * Allows api/products/<category_optional>?order1=rate&sort=asc&order2=version&sort=desc
  * @return [type] [description]
  */
 public function action_products()
 {
     $this->auto_render = FALSE;
     $sort_allowed = array('asc', 'desc');
     $order_allowed = array('id_category', 'created', 'updated', 'price', 'title', 'rate');
     $order1 = Core::get('order1');
     //default value
     if (!in_array($order1, $order_allowed) or $order1 === NULL) {
         $order1 = 'id_category';
     }
     $sort1 = Core::get('sort1');
     //default value
     if (!in_array($sort1, $sort_allowed) or $sort1 === NULL) {
         $sort1 = 'asc';
     }
     $order2 = Core::get('order2');
     //default value
     if (!in_array($order2, $order_allowed) or $order2 === NULL) {
         $order2 = 'price';
     }
     $sort2 = Core::get('sort2');
     //default value
     if (!in_array($sort2, $sort_allowed) or $sort2 === NULL) {
         $sort2 = 'asc';
     }
     $items = array();
     //products filtered
     $products = new Model_Product();
     $products = $products->where('status', '=', Model_Product::STATUS_ACTIVE)->order_by($order1, $sort1)->order_by($order2, $sort2);
     //filter by category
     $seo_category = $this->request->param('id');
     if ($seo_category !== NULL) {
         $category = new Model_Category();
         $category->where('seoname', '=', $seo_category)->limit(1)->find();
         if ($category->loaded()) {
             $products->where('id_category', '=', $category->id_category);
         }
     }
     $products = $products->cached()->find_all();
     $i = 0;
     foreach ($products as $p) {
         $url = Route::url('product', array('seotitle' => $p->seotitle, 'category' => $p->category->seoname));
         $urlmin = Route::url('product-minimal', array('seotitle' => $p->seotitle, 'category' => $p->category->seoname));
         $in_offer = Date::mysql2unix($p->offer_valid) > time() ? TRUE : FALSE;
         $items[] = array('id_product' => $p->id_product, 'order' => $i, 'title' => $p->title, 'seoname' => $p->seotitle, 'skins' => $p->skins, 'url_more' => $url, 'url_buy' => $url, 'url_demo' => !empty($p->url_demo) ? Route::url('product-demo', array('seotitle' => $p->seotitle, 'category' => $p->category->seoname)) : '', 'url_screenshot' => URL::base() . $p->get_first_image('image'), 'type' => $p->category->seoname, 'price' => $p->price, 'currency' => $p->currency, 'price_offer' => $in_offer === TRUE ? $p->price_offer : NULL, 'offer_valid' => $in_offer === TRUE ? $p->offer_valid : NULL, 'rate' => $p->rate, 'created' => $p->created, 'updated' => $p->updated, 'version' => $p->version, 'description' => Text::removebbcode(preg_replace('/&(?!\\w+;)/', '&amp;', $p->description)));
         $i++;
     }
     $this->response->headers('Content-type', 'application/javascript');
     $this->response->body(json_encode($items));
 }
开发者ID:johnulist,项目名称:open-eshop,代码行数:55,代码来源:api.php

示例10: getArticleById

 public function getArticleById($id)
 {
     // выполняем запрос
     // Один запрос к БД лучше чем два, поэтому сразу вытягиваем и username из таблицы Users
     $predicates[] = Core::get()->db->predicate('articleid', $id);
     //делаем join на таблицу Users
     $join = Core::get()->db->join('Users', 'userid', 'Articles', 'userid');
     $article = Core::get()->db->select('Articles', array('title', 'filename', 'Users.username'), $predicates, $join)[0];
     //если ничего не вернул, возвращаем false
     if (is_null($article)) {
         return false;
     }
     //достаем из файла текст статьи
     $article['text'] = file_get_contents(Core::get()->CONFIG['path']['root'] . $article['filename']);
     return $article;
 }
开发者ID:alexxxiy,项目名称:geekbrains-homework-php02-miniFramework,代码行数:16,代码来源:modelArticles.php

示例11: settings_page

function settings_page()
{
    Core::get()->setActiveTemplate("app");
    $output = '
		<form id="settings" data-ajax="false" action="index.php?q=menu" method="post">

			<h2>Indstillinger:</h2>

			<div data-role="fieldcontain">
				<label for="test">Test</label>
				<input data-inline="true" type="checkbox" id="test" name="test" class="custom" />
			</div>

		</form>
	';
    return $output;
}
开发者ID:BerlingskeMedia,项目名称:gadesalg,代码行数:17,代码来源:settings.php

示例12: 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;
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:41,代码来源:map.php

示例13: action_index

 public function action_index()
 {
     //force update check reload
     if (Core::get('reload') == 1) {
         Core::get_updates(TRUE);
     }
     $versions = core::config('versions');
     if (Core::get('json') == 1) {
         $this->auto_render = FALSE;
         $this->template = View::factory('js');
         $this->template->content = json_encode($versions);
     } else {
         Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Updates')));
         $this->template->title = __('Updates');
         //check if we have latest version of OC
         if (key($versions) != core::version) {
             Alert::set(Alert::ALERT, __('You are not using latest version of OC, please update.') . '<br/><br/><a class="btn btn-primary update_btn" href="' . Route::url('oc-panel', array('controller' => 'update', 'action' => 'latest')) . '">
             ' . __('Update') . '</a>');
         }
         //pass to view from local versions.php
         $this->template->content = View::factory('oc-panel/pages/tools/versions', array('versions' => $versions, 'latest_version' => key($versions)));
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:23,代码来源:update.php

示例14: addModel

 protected function addModel($modelName)
 {
     //имя модели с большой буквы
     $modelName = mb_strtoupper(mb_substr($modelName, 0, 1)) . mb_strtolower(mb_substr($modelName, 1, mb_strlen($modelName) - 1));
     //проверяем, возможно модель уже загружена
     if (isset($this->model[$modelName])) {
         return true;
     } else {
         //файл модели
         $modelFile = Core::get()->CONFIG['path']['model'] . 'model' . $modelName . '.php';
         if (is_file($modelFile)) {
             require_once $modelFile;
             //класс модели
             $modelClass = 'Model' . $modelName;
             //создаем объект модели и кладем его в массив доступных моделей данного контроллера
             $this->model[$modelName] = new $modelClass();
             //возвращаем запрашиваемую модель для использования
             return $this->model[$modelName];
         } else {
             $this->setError(404, 'Model ' . $modelName . ' not found');
             return false;
         }
     }
 }
开发者ID:alexxxiy,项目名称:geekbrains-homework-php02-miniFramework,代码行数:24,代码来源:controller.php

示例15: initialize

 /**
  * initialize theme
  * @param  string $theme forcing theme to load used in the admin
  * @return void        
  */
 public static function initialize($theme = NULL)
 {
     //we are not forcing the view of other theme
     if ($theme === NULL) {
         //first we check if it's a mobile device
         if (($mobile_theme = self::is_mobile()) !== FALSE) {
             $theme = $mobile_theme;
         } else {
             $theme = Core::config('appearance.theme');
         }
         //if we allow the user to select the theme, perfect for the demo
         if (Core::config('appearance.allow_query_theme') == '1') {
             if (Core::get('theme') !== NULL) {
                 $theme = Core::get('theme');
             } elseif (Cookie::get('theme') !== '') {
                 $theme = Cookie::get('theme');
             }
         }
         //we save the cookie for next time
         Cookie::set('theme', $theme, Core::config('auth.lifetime'));
     }
     //check the theme exists..
     if (!file_exists(self::theme_init_path($theme))) {
         $theme = Core::config('appearance.theme');
     }
     //load theme init.php like in module, to load default JS and CSS for example
     self::$theme = $theme;
     Kohana::load(self::theme_init_path(self::$theme));
     self::load();
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:35,代码来源:theme.php


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