本文整理汇总了PHP中kernel类的典型用法代码示例。如果您正苦于以下问题:PHP kernel类的具体用法?PHP kernel怎么用?PHP kernel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kernel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: command_dd
function command_dd()
{
$args = func_get_args();
$options = $this->get_options();
$dd = kernel::single('dev_docbuilder_dd');
if (empty($args)) {
$dd->export();
} else {
foreach ($args as $app_id) {
$dd->export_tables($app_id);
}
}
if ($filename = $options['result-file']) {
ob_start();
$dd->output();
$out = ob_get_contents();
ob_end_clean();
if (!is_dir(dirname($filename))) {
throw new Exception('cannot find the ' . dirname($filename) . 'directory');
} elseif (is_dir($filename)) {
throw new Exception('the result-file path is a directory.');
}
file_put_contents($options['result-file'], $out);
echo 'data dictionary doc export success.';
} else {
$dd->output();
}
}
示例2: display
function display($tmpl_file, $app_id = null)
{
array_unshift($this->_files, $tmpl_file);
$this->_vars = $this->pagedata;
if ($p = strpos($tmpl_file, ':')) {
$object = kernel::service('tpl_source.' . substr($tmpl_file, 0, $p));
if ($object) {
$tmpl_file_path = substr($tmpl_file, $p + 1);
$last_modified = $object->last_modified($tmpl_file_path);
}
} else {
$tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
$last_modified = filemtime($tmpl_file);
}
if (!$last_modified) {
//无文件
}
$compile_id = $this->compile_id($tmpl_file);
if ($object) {
$compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
} else {
$compile_code = $this->_compiler()->compile_file($tmpl_file);
}
eval('?>' . $compile_code);
array_shift($this->_files);
}
示例3: command_do
/**
* 根据提交的图片全局配置大小,生成相应的缩略图
* filesystem图片重新生成
* @param null - 通过function_get_args方法来获取
* @return null
*/
public function command_do()
{
$options = $this->get_options();
$imageSet = app::get('image')->getConf('image.set');
if (isset($options['large'])) {
$setting['l'] = $imageSet['L'];
} elseif (isset($options['middle'])) {
$setting['m'] = $imageSet['M'];
} elseif (isset($options['small'])) {
$setting['s'] = $imageSet['S'];
} else {
$setting = $imageSet;
}
$objLibImage = kernel::single('image_data_image');
$pagesize = 50;
$imgObj = kernel::single('image_clip');
$imgMdl = app::get('image')->model('images');
$filter['disabled'] = 0;
$count = $imgMdl->count($filter);
logger::info(sprintf('Total %d records', $count));
for ($i = 0; $i < $count; $i += $pagesize) {
$rows = $imgMdl->getList('ident', $filter, $i, $pagesize);
foreach ($rows as $row) {
$objLibImage->rebuild($row['ident'], $setting);
}
logger::info(sprintf('%d records Completed!', $i + count($rows)));
}
}
示例4: exec
public function exec($params = null)
{
$params = array('time_start' => strtotime(date('Y-m-d 00:00:00', strtotime('-1 day'))), 'time_end' => strtotime(date('Y-m-d 23:59:59', strtotime('-1 day'))), 'time_insert' => strtotime(date('Y-m-d', strtotime('-1 day'))));
if (kernel::single('sysstat_shop_taskdata')->exec($params)) {
return true;
}
}
示例5: add
public function add()
{
$article_id = input::get('article_id');
if ($article_id) {
$articles = app::get('sysinfo')->model('article');
$artnode = app::get('sysinfo')->model('article_nodes');
$articleinfo = $articles->getRow('*', array('article_id' => $article_id));
$pagedata['articleinfo'] = $articleinfo;
$pagedata['artnode'] = $artnode->getRow('*', array('node_id' => $articleinfo['node_id']));
}
$nodeId = input::get('node_id');
if (!empty($nodeId)) {
$pagedata['article']['node_id'] = $nodeId;
}
$sysinfoLibNode = kernel::single('sysinfo_article_node');
$nodeList = $sysinfoLibNode->getNodeList();
foreach ($nodeList as $key => $value) {
$selectmaps[$key]['node_id'] = $value['node_id'];
$selectmaps[$key]['step'] = $value['node_depth'];
$selectmaps[$key]['node_name'] = $value['node_name'];
}
$articlecatlist = app::get("sysinfo")->model("article_nodes")->getlist("*");
$pagedata["articlecatlist"] = $articlecatlist;
$pagedata['selectmaps'] = $selectmaps;
$pagedata['platform_options'] = $this->platforms;
return $this->page('sysinfo/admin/article/editor.html', $pagedata);
}
示例6: index
function index($method = 'apply', $app_id = 'b2c', &$callback = '', $api_url = '')
{
$this->Certi = base_certificate::get('certificate_id');
$this->Token = base_certificate::get('token');
$this->Node_id = base_shopnode::node_id($app_id);
$token = $this->Token;
$sess_id = kernel::single('base_session')->sess_id();
$apply['certi_id'] = $this->Certi;
if ($this->Node_id) {
$apply['node_idnode_id'] = $this->Node_id;
}
$apply['sess_id'] = $sess_id;
$str = '';
ksort($apply);
foreach ($apply as $key => $value) {
$str .= $value;
}
$apply['certi_ac'] = md5($str . $token);
if ($method == 'apply') {
if ($apply['node_idnode_id']) {
$this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '" ></iframe>';
} else {
$this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=apply&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '&api_url=' . $api_url . '" ></iframe>';
}
} elseif ($method == 'accept') {
if ($apply['node_idnode_id']) {
$this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&node_id=' . $apply['node_idnode_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '" ></iframe>';
} else {
$this->pagedata['_PAGE_CONTENT'] = '<iframe width="100%" height="100%" src="' . MATRIX_RELATION_URL . '?source=accept&certi_id=' . $apply['certi_id'] . '&sess_id=' . $apply['sess_id'] . '&certi_ac=' . $apply['certi_ac'] . '&callback=' . $callback . '" ></iframe>';
}
} else {
$this->pagedata['_PAGE_CONTENT'] = "";
}
$this->page();
}
示例7: __construct
function __construct()
{
error_reporting(E_ALL ^ E_NOTICE);
if (isset($_POST['dbname'], $_POST['dbuser'], $_POST['dbhost'], $_POST['data'])) {
$this->install_mode = 'service';
if (file_exists('../config/install.lock')) {
$this->service_install_res('false', 'Access denied by install.lock');
}
$_POST['uname'] = $_POST['dbuser'];
$_POST['pwd'] = $_POST['dbpass'];
$_POST['prefix'] = $_POST['prefix'] ? $_POST['prefix'] : 'sdb_';
$_POST['use_demo'] = $_POST['data'] == 'true' ? true : false;
$_POST['stimezone'] = $_POST['stimezone'] ? $_POST['stimezone'] : 8;
parent::kernel();
$this->service_install_mode();
}
if (file_exists('../config/install.lock')) {
$this->responseCode('403');
echo 'Access denied by install.lock';
exit;
} else {
parent::kernel();
$this->checkPerm();
$this->run();
}
}
示例8: getInfo
public function getInfo($params)
{
$filter = array();
$paymenList = array();
$objPayment = kernel::single('ectools_data_payment');
$row = $params['fields'];
if ($params['payment_id']) {
$filterBill['payment_id'] = $filter['payment_id'] = $params['payment_id'];
}
if ($params['tids']) {
$filterBill['tid'] = explode(',', $params['tids']);
}
if ($params['status']) {
$filter['status|in'] = explode(',', $params['status']);
}
if ($filter) {
$objMdlPayment = app::get('ectools')->model('payments');
$paymentBill = $objMdlPayment->getRow($row, $filter);
}
if ($filterBill) {
$objMdlTradePaybill = app::get('ectools')->model('trade_paybill');
$billList = $objMdlTradePaybill->getList('payment_id,tid,payment,status', $filterBill);
}
if ($paymentBill && $billList) {
foreach ($billList as $val) {
$paymentBill['trade'][$val['tid']] = $val;
}
}
return $paymentBill;
}
示例9: post_install
public function post_install()
{
kernel::log('Initial ectools');
kernel::single('base_initial', 'ectools')->init();
kernel::log('Initial Regions');
kernel::single('ectools_regions_mainland')->install();
}
示例10: _get_obj
private static function _get_obj($obj_name)
{
$_obj_name = self::$_widgets_conf[$obj_name];
$object_class = self::$_prefix . $_obj_name;
$object = kernel::single($object_class);
return $object;
}
示例11: getData
/**
* 获取单笔交易数据
*
* @param array $params 接口传入参数
* @return array
*/
public function getData($params, $oauth)
{
if (isset($oauth['shop_id'])) {
$filter['shop_id'] = $oauth['shop_id'];
} else {
if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
$filter['user_id'] = $params['oauth']['account_id'];
} elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
$sellerId = $params['oauth']['account_id'];
$filter['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $this->sellerId), 'seller');
}
}
if ($params['oid']) {
$params['oid'] = explode(',', $params['oid']);
}
$tradeInfo = kernel::single('systrade_getTradeData')->getTradeInfo($params['fields'], $params['tid'], $params['oid'], $filter);
if ($tradeInfo['dlytmpl_id']) {
$dlytmpl = app::get('systrade')->rpcCall('logistics.dlytmpl.get', ['template_id' => $tradeInfo['dlytmpl_id'], 'fields' => 'corp_id,name']);
$corptmpl = app::get('systrade')->rpcCall('logistics.dlycorp.get', ['corp_id' => $dlytmpl['corp_id'], 'fields' => 'corp_code,corp_name']);
$tradeInfo['dlytmpl_name'] = $dlytmpl['name'];
$tradeInfo['corptmpl_name'] = $corptmpl['corp_name'];
$tradeInfo['corptmpl_code'] = $corptmpl['corp_code'];
}
//这里判断货到付款
//现在判断货到付款在订单里没有字段标示,所以采用两个字段相结合,就是支付为线下支付且订单状态是待支付的时候,就判断为货到付款
if ($tradeInfo['pay_type'] == "offline" && $tradeInfo['type'] == "WAIT_SELLER_SEND_GOODS") {
$tradeInfo['is_cod'] = "true";
} else {
$tradeInfo['is_cod'] = "false";
}
$tradeInfo = $this->__paramsToString($tradeInfo);
return $tradeInfo;
}
示例12: callback
public function callback(&$recv)
{
$objMath = kernel::single('ectools_math');
$money = $objMath->number_multiple(array($recv['orderAmount'], 0.01));
$merid = $this->getConf('mer_id', substr(__CLASS__, 0, strrpos(__CLASS__, '_')));
$mer_key = $this->getConf('mer_key', substr(__CLASS__, 0, strrpos(__CLASS__, '_')));
$sign = $recv['signature'];
$sign_method = $recv['signMethod'];
$arrs = array("version" => $recv['version'], "charset" => $recv['charset'], "transType" => $recv['transType'], "respCode" => $recv['respCode'], "respMsg" => $recv['respMsg'], "merAbbr" => $recv['merAbbr'], "merId" => $recv['merId'], "orderNumber" => $recv['orderNumber'], "traceNumber" => $recv['traceNumber'], "traceTime" => $recv['traceTime'], "qid" => $recv['qid'], "orderAmount" => $recv['orderAmount'], "orderCurrency" => $recv['orderCurrency'], "respTime" => $recv['respTime'], "settleCurrency" => $recv['settleCurrency'], "settleDate" => $recv['settleDate'], "settleAmount" => $recv['settleAmount'], "exchangeDate" => $recv['exchangeDate'], "exchangeRate" => $recv['exchangeRate'], "cupReserved" => $recv['cupReserved']);
$chkvalue = $this->sign($arrs, $sign_method, $mer_key);
$ret['payment_id'] = $arrs['orderNumber'];
$ret['account'] = $arrs['merId'];
$ret['bank'] = app::get('ectools')->_('银联');
$ret['pay_account'] = app::get('ectools')->_('付款帐号');
$ret['currency'] = 'CNY';
$ret['money'] = $money;
$ret['paycost'] = '0.000';
$ret['cur_money'] = $money;
$ret['tradeno'] = $recv['traceNumber'];
// $ret['t_payed'] = strtotime($recv['settleDate']) ? strtotime($recv['settleDate']) : time();
$ret['t_payed'] = time();
$ret['pay_app_id'] = 'unionpay';
$ret['pay_type'] = 'online';
$ret['memo'] = 'unionpay';
if ($sign == $chkvalue && $recv['respCode'] == 00) {
$ret['status'] = 'succ';
} else {
$ret['status'] = 'failed';
}
return $ret;
}
示例13: validate
public function validate($cart_objects, &$condition)
{
$all = $condition['aggregator'] === 'all';
$true = (bool) $condition['value'];
if (!isset($condition['conditions'])) {
return true;
}
if (!is_array($condition['conditions'])) {
return false;
}
foreach ($condition['conditions'] as $_cond) {
if (!is_object($this->{$_cond}['type'])) {
$this->{$_cond}['type'] = kernel::single($_cond['type']);
}
$oCond = $this->{$_cond}['type'];
$validated = $oCond->validate($cart_objects, $_cond);
// return boolean
if ($all && $validated !== $true) {
// 所有不符合 如果有一个满足返回false
return false;
} elseif (!$all && $validated === $true) {
// 任意一条符合 则返回true
return true;
}
}
return $all ? true : false;
}
示例14: updateStatus
public function updateStatus($params)
{
$itemId = $params['item_id'];
$status = $params['approve_status'];
$result = kernel::single('sysitem_data_item')->setSaleStatus(intval($itemId), $status);
return $result;
}
示例15: save
function save()
{
$this->begin();
$objMemLv = $this->app->model('member_lv');
if ($objMemLv->validate($_POST, $msg)) {
if ($_POST['member_lv_id']) {
$olddata = app::get('b2c')->model('member_lv')->dump($_POST['member_lv_id']);
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
if ($objMemLv->save($_POST)) {
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.members')) {
if (method_exists($obj_operatorlogs, 'member_lv_log')) {
$newdata = app::get('b2c')->model('member_lv')->dump($_POST['member_lv_id']);
$obj_operatorlogs->member_lv_log($newdata, $olddata);
}
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
$this->end(true, app::get('b2c')->_('保存成功'));
} else {
$this->end(false, app::get('b2c')->_('保存失败'));
}
} else {
$this->end(false, $msg);
}
}