本文整理汇总了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;
}
示例2: getAreaInfo
private function getAreaInfo($idno)
{
$user = core::Singleton('user.area');
$result = $user->getArea($idno);
unset($user);
return $result;
}
示例3: getDescription
private function getDescription($bid)
{
$user = core::Singleton('user.borrow_info');
$result = $user->getBorrowDescription($bid);
unset($user);
return $result;
}
示例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);
}
示例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');
}
示例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);
}
}
示例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')));
}
}
示例8: getTodayInvest
public function getTodayInvest($userId)
{
$lj = core::Singleton('user.borrow_info');
$result = $lj->getTodayInvest($userId);
unset($lj);
return $result;
}
示例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;
}
示例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;
}
}
示例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();
}
示例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));
}
}
示例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');
}
示例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
}
示例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;
}