當前位置: 首頁>>代碼示例>>PHP>>正文


PHP core類代碼示例

本文整理匯總了PHP中core的典型用法代碼示例。如果您正苦於以下問題:PHP core類的具體用法?PHP core怎麽用?PHP core使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了core類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Run block
  * Called from module::run_block
  * 
  * Params passed to 'block.data' 
  * action converted to object!
  * 
  * Extended params passed to {$block.params}
  * 
  * @throws modules_exception
  */
 function run($action, $params)
 {
     $_tag = $this->get_context()->get_tag();
     core::dprint('[BLOCK] start ' . $_tag . '::' . $action, core::E_DEBUG);
     $return = false;
     // @todo check for callable
     if (is_callable(array($this, $action))) {
         if (!empty($params)) {
             // convert parameters to object
             $c_params = functions::array2object($params);
             $data = call_user_func(array($this, $action), $c_params);
         } else {
             $data = call_user_func(array($this, $action));
         }
         // get block builtin properties
         $props = $this->get_block($action);
         // assign params
         $props['params'] = $params;
         $return = $this->get_context()->get_core()->lib('renderer')->render_block($props, $data);
     } else {
         throw new modules_exception('Not callable action supplied - ' . $action);
     }
     core::dprint('[/BLOCK] end ' . $_tag . '::' . $action, core::E_DEBUG);
     return $return;
 }
開發者ID:rustyJ4ck,項目名稱:moswarBot,代碼行數:36,代碼來源:module_blocks.php

示例2: getAreaInfo

 private function getAreaInfo($idno)
 {
     $user = core::Singleton('user.area');
     $result = $user->getArea($idno);
     unset($user);
     return $result;
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:7,代碼來源:class.areainfo_get.php

示例3: getDescription

 private function getDescription($bid)
 {
     $user = core::Singleton('user.borrow_info');
     $result = $user->getBorrowDescription($bid);
     unset($user);
     return $result;
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:7,代碼來源:class.borrow_detail.php

示例4: indexAction

 /**
     默認頁
     @param void
     @return void
 */
 function indexAction()
 {
     $data = [];
     $cond = [];
     $url = '/admin/replace/index?1=1';
     if ($this->getRequest()->getQuery('dosubmit')) {
         $url .= '&dosubmit=dosubmit';
         if ($id = intval($this->getRequest()->getQuery('id'))) {
             $cond['id'] = $id;
             $url .= '&id=' . $cond['id'];
         }
         if ($Keywords = core::safe_str($this->getRequest()->getQuery('keywords'))) {
             $cond['keywords'] = $Keywords;
             $url .= '&Keywords=' . $cond['keywords'];
         }
         $this->getView()->assign('cond', $cond);
     }
     $page = $this->getRequest()->getQuery('page') ? intval($this->getRequest()->getQuery('page')) : 1;
     //每頁顯示數
     $offset = 15;
     $start = ($page - 1) * $offset;
     $data['data'] = $this->Keyword->search_replacewords_list($cond, $start, $offset);
     $total = $this->Keyword->count($cond, 'keywords');
     $totalpage = ceil($total / $offset);
     //超過一頁顯示分頁
     if ($totalpage > 1) {
         $url .= '&page=';
         $data['page'] = (new multi())->getSubContent($url, '', $totalpage, $page, 20, ' target="_self" ', '', '', 'no');
     }
     //每頁實際顯示數
     $data['perNum'] = $page > $totalpage ? 0 : $page == $totalpage ? $total % $offset : $offset;
     $this->getView()->assign('data', $data);
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:38,代碼來源:Replace.php

示例5: index

 public function index()
 {
     $crontabs_model = core::instance('crontabs_model');
     $data = $crontabs_model->getList(array(), '*', 'id DESC');
     $this->assign('data', $data);
     $this->display('index.html');
 }
開發者ID:Junec,項目名稱:crontabs,代碼行數:7,代碼來源:index.php

示例6: send

 public static function send($event)
 {
     $conf = core::conf();
     $db = core::db();
     // Поиск шаблона письма по имени события
     $template = $db->Execute(sprintf("SELECT `subject`,`text`,`tags` FROM {$conf->db_prefix}mail WHERE `event`='%s' AND `active`='1'", $event))->fields;
     $subject = htmlspecialchars_decode($template['subject']);
     $message = htmlspecialchars_decode($template['text']);
     $tags = explode(',', $template['tags']);
     // Замена тегов в письме на значения переменных
     foreach ($tags as $tag) {
         $tag = explode('.', $tag);
         if (is_array($GLOBALS[$tag[0]])) {
             $value = $GLOBALS[$tag[0]][$tag[1]];
         } elseif (is_object($GLOBALS[$tag[0]])) {
             $value = $GLOBALS[$tag[0]]->{$tag}[1];
         } else {
             $value = $GLOBALS[$tag[0]];
         }
         $subject = str_replace('{' . $tag[0] . '.' . $tag[1] . '}', $value, $subject);
         $message = str_replace('{' . $tag[0] . '.' . $tag[1] . '}', $value, $message);
     }
     $mail_to = $user->email;
     $mail_from = $conf->site_mail;
     // Отправка письма
     if ($subject != '' && $message != '') {
         $headers = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
         $headers .= 'To: ' . $user->name . ' <' . $mail_to . '>' . "\r\n";
         $headers .= 'From: ' . $conf->site_name . ' <' . $mail_from . '>' . "\r\n";
         mail($mail_to, $subject, $message, $headers);
     }
 }
開發者ID:jfkz,項目名稱:aquarel-cms,代碼行數:33,代碼來源:Controller.php

示例7: action_edit

 public function action_edit()
 {
     $this->template->scripts['footer'] = array('js/oc-panel/edit_profile.js');
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit profile')));
     // $this->template->title = $user->name;
     //$this->template->meta_description = $user->name;//@todo phpseo
     $user = Auth::instance()->get_user();
     $this->template->bind('content', $content);
     $this->template->content = View::factory('oc-panel/profile/edit', array('user' => $user, 'custom_fields' => Model_UserField::get_all()));
     if ($this->request->post()) {
         $user->name = core::post('name');
         $user->description = core::post('description');
         $user->email = core::post('email');
         $user->subscriber = core::post('subscriber', 0);
         //$user->seoname = $user->gen_seo_title(core::post('name'));
         $user->last_modified = Date::unix2mysql();
         //modify custom fields
         foreach ($this->request->post() as $custom_field => $value) {
             if (strpos($custom_field, 'cf_') !== FALSE) {
                 $user->{$custom_field} = $value;
             }
         }
         try {
             $user->save();
             Alert::set(Alert::SUCCESS, __('You have successfully changed your data'));
         } catch (Exception $e) {
             //throw 500
             throw HTTP_Exception::factory(500, $e->getMessage());
         }
         $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'edit')));
     }
 }
開發者ID:Chinese1904,項目名稱:openclassifieds2,代碼行數:32,代碼來源:profile.php

示例8: getTodayInvest

 public function getTodayInvest($userId)
 {
     $lj = core::Singleton('user.borrow_info');
     $result = $lj->getTodayInvest($userId);
     unset($lj);
     return $result;
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:7,代碼來源:class.todayinvest_get.php

示例9: getReceivePlan

 private function getReceivePlan($userId, $year, $search_month)
 {
     $user = core::Singleton('user.receive');
     $result = $user->getMyInvest($userId, $year, $search_month);
     unset($user);
     return $result;
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:7,代碼來源:class.receive_plan.php

示例10: factory

 /**
  * 獲取實例並初始化對像
  * 
  * @param String $plugName 緩存插件名
  * @return void
  */
 public static function factory($plugName = null, $setting = '')
 {
     require_once 'config/config.log.php';
     //判斷是否調用係統配置
     if (empty($plugName)) {
         $plugName = _LOG_SYSTEM;
         //$setting = _LOG_PATH;
     }
     $setting = strtoupper($setting);
     if (!empty($setting) && isset($GLOBALS['lOG_CONFIG'][$setting])) {
         $setting = $GLOBALS['lOG_CONFIG'][$setting];
     } else {
         $setting = $GLOBALS['lOG_CONFIG']['WWW'];
     }
     $plugName = strtolower($plugName);
     $sKey = self::getSKey($plugName, $setting);
     if (core::registry($sKey)) {
         return core::register($sKey);
     } else {
         $obj = self::instance($plugName);
         $obj->init($setting);
         core::register($sKey, $obj);
         //print_r($obj);
         return $obj;
     }
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:32,代碼來源:class.log.php

示例11: setApplicationBorrow

 public function setApplicationBorrow($data)
 {
     $db = core::db()->getConnect('CAILAI', true);
     $sql = sprintf('INSERT INTO `%s`(`user_phone`,`borrow_use`,`borrow_duration`,`borrow_money`) VALUES("%s","%s","%s","%s")', $this->tbl, $data['user_phone'], $data['borrow_use'], $data['borrow_duration'], $data['borrow_money']);
     $db->query($sql);
     return mysql_insert_id();
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:7,代碼來源:class.application_borrow.php

示例12: make_urls

 function make_urls()
 {
     if (core::in_editor()) {
         $this->append_urls('children', sprintf('?m=sat&c=menu&pid=%d', $this->id));
         $this->append_urls('self', sprintf('?m=sat&c=menu&pid=%d', $this->pid));
     }
 }
開發者ID:egregor-dev,項目名稱:SatCMS,代碼行數:7,代碼來源:collection.php

示例13: get_account_infor

 public function get_account_infor($account_name)
 {
     $db = core::db()->getConnect('DTS');
     $account_name = addslashes($account_name);
     $sql = sprintf("SELECT * FROM %s WHERE partner_name='%s'  LIMIT 1", $this->tbl, $account_name);
     return $db->query($sql, 'array');
 }
開發者ID:GStepOne,項目名稱:CI,代碼行數:7,代碼來源:class.privilege.php

示例14: renew

 /**
  * expired featured ads
  * @return void
  */
 public static function renew()
 {
     if (Core::config('general.subscriptions') == TRUE) {
         //get expired subscription that are active
         $subscriptions = new Model_Subscription();
         $subscriptions = $subscriptions->where('status', '=', 1)->where('expire_date', '<=', Date::unix2mysql())->order_by('created', 'desc')->find_all();
         foreach ($subscriptions as $s) {
             //disable the plan
             $s->status = 0;
             try {
                 $s->save();
             } catch (Exception $e) {
                 throw HTTP_Exception::factory(500, $e->getMessage());
             }
             $plan = $s->plan;
             if ($plan->loaded() and $plan->status == 1) {
                 //generate a new order
                 $order = Model_Order::new_order(NULL, $s->user, $plan->id_plan, $plan->price, core::config('payment.paypal_currency'), __('Subscription to ') . $plan->name);
                 //free plan no checkout
                 if ($plan->price == 0) {
                     $order->confirm_payment('cash');
                 } else {
                     $checkout_url = $s->user->ql('default', array('controller' => 'plan', 'action' => 'checkout', 'id' => $order->id_order));
                     $s->user->email('plan-expired', array('[PLAN.NAME]' => $plan->name, '[URL.CHECKOUT]' => $checkout_url));
                 }
             }
             //if plan loaded
         }
         //end foreach
     }
     //if subscription active
 }
開發者ID:ThomWensink,項目名稱:openclassifieds2,代碼行數:36,代碼來源:subscription.php

示例15: get_answers

 /** @return anket_answer_collection */
 function get_answers()
 {
     if (!isset($this->_answers)) {
         $this->_answers = core::module('anket')->get_answer_handle()->set_where('pid = %d', $this->id)->load();
     }
     return $this->_answers;
 }
開發者ID:egregor-dev,項目名稱:SatCMS,代碼行數:8,代碼來源:item.php


注:本文中的core類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。