本文整理汇总了PHP中vmc::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP vmc::singleton方法的具体用法?PHP vmc::singleton怎么用?PHP vmc::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmc
的用法示例。
在下文中一共展示了vmc::singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* send
* 必有方法,发送时调用.
*
* config参数为getOptions取得的所有项的配置结果
*
* @param mixed $target ['email']
* @param mixed $title
* @param mixed $config
*/
public function send($target, $title, $content, $config)
{
logger::debug(__CLASS__ . var_export(func_get_args(), 1));
$new_msg = array('member_id' => $target['member_id'], 'target' => $target['email'], 'subject' => $title, 'content' => $content, 'createtime' => time(), 'msg_type' => 'email', 'status' => 'sent');
app::get('b2c')->model('member_msg')->save($new_msg);
if (!($email_to = $target['email'])) {
return false;
}
if ($config['sendway'] == 'mail') {
$this->email = vmc::singleton('desktop_email_email');
}
$this->email->Sender = $this->Sender = $config['usermail'];
$this->email->Subject = $this->Subject = $this->email->inlineCode($title);
$From = $this->email->inlineCode(app::get('site')->getConf('site_name')) . '<' . $config['usermail'] . '>';
$header = array('Return-path' => '<' . $config['usermail'] . '>', 'Date' => date('r'), 'From' => $From, 'MIME-Version' => '1.0', 'Subject' => $this->Subject, 'To' => $email_to, 'Content-Type' => 'text/html; charset=UTF-8; format=flowed', 'Content-Transfer-Encoding' => 'base64');
$body = chunk_split(base64_encode($content));
$header = $this->email->buildHeader($header);
$config['sendway'] = $config['sendway'] ? $config['sendway'] : 'smtp';
switch ($config['sendway']) {
case 'sendmail':
$result = $this->email->SendmailSend($email_to, $header, $body);
break;
case 'mail':
$result = $this->email->MailSend($email_to, $header, $body);
break;
case 'smtp':
$result = $this->email->SmtpSend($email_to, $header, $body, $config);
break;
default:
$result = false;
break;
}
return $result;
}
示例2: create
public function create($intext, $long_touch)
{
$mdl_image = app::get('image')->model('image');
if ($exits_image = $mdl_image->dump(md5($intext . $long_touch))) {
return $exits_image;
}
$tmp_file = tempnam(TMP_DIR, 'qrcode');
wechat_qrcode_QRcode::png($intext, $tmp_file, 'L', 8, 4);
list($w, $h, $type) = getimagesize($tmp_file);
if ($long_touch) {
//加入额外图像
$resize_tmp_file = tempnam(TMP_DIR, 'qrcode_resize');
$image_tool = vmc::singleton('image_tools_gd');
$image_tool->resize($tmp_file, $resize_tmp_file, $w, $h, $type, $w + 180, $h + 220, false, 20);
$water_file = PUBLIC_DIR . '/misc/long_touch.gif';
list($w_w, $w_h, $w_type) = getimagesize($water_file);
$warermark_set = array('wm_opacity' => 100, 'watermark_width' => $w_w, 'watermark_height' => $w_h, 'type' => $w_type, 'src_width' => $w + 180, 'src_height' => $h + 180, 'dest_x' => ($w + 180 - 120) / 2, 'dest_y' => $h + 50);
$image_tool->watermark($resize_tmp_file, $water_file, $warermark_set);
}
$storager = new base_storager();
if ($long_touch) {
list($url, $ident, $storage) = explode('|', $storager->save_upload($resize_tmp_file, 'image', '', $msg, '.png'));
} else {
list($url, $ident, $storage) = explode('|', $storager->save_upload($tmp_file, 'image', '', $msg, '.png'));
}
$tmp_qrcode_image = array('image_id' => md5($intext . $long_touch), 'storage' => $storage, 'image_name' => 'TMP_QRCODE', 'ident' => $ident, 'url' => $url, 'width' => $w, 'height' => $h, 'last_modified' => time());
$mdl_image->save($tmp_qrcode_image);
unlink($tmp_file);
if ($long_touch) {
unlink($resize_tmp_file);
}
return $tmp_qrcode_image;
}
示例3: monitor_change
public function monitor_change($theme)
{
$config_file_path = vmc::get_themes_root_dir() . '/' . $theme . '/config.xml';
$last_modify_time = filemtime($config_file_path);
if (!$last_modify_time) {
return false;
}
$exist_last_time = app::get('site')->getConf($theme . '_theme_last_config');
$exist_last_time = $exist_last_time ? $exist_last_time : 0;
if ($exist_last_time - $last_modify_time == 0) {
return true;
} else {
app::get('site')->setConf($theme . '_theme_last_config', $last_modify_time);
}
$config_xml_content = file_get_contents($config_file_path);
if ($config_xml_content) {
$theme_info = vmc::singleton('site_utility_xml')->xml2arrayValues($config_xml_content);
}
if (empty($theme_info)) {
return false;
}
$config = $theme_info;
$theme_sdf = array('theme_id' => $config['theme']['id']['value'], 'theme_dir' => $theme, 'name' => $config['theme']['name']['value'], 'version' => $config['theme']['version']['value'], 'info' => $config['theme']['info']['value'], 'author' => $config['theme']['author']['value'], 'config' => array());
$theme_sdf = vmc_('site', 'theme_install_config', $theme_sdf, $config);
if (!vmc::singleton('site_theme_base')->update_theme($theme_sdf)) {
return false;
}
return $theme_sdf;
}
示例4: detail_columns_modifier
public function detail_columns_modifier(&$detail_pages)
{
if ($this->app->getConf('site.get_policy.method') == 1 && $detail_pages['detail_point']) {
unset($detail_pages['detail_point']);
}
$objuser = vmc::singleton('desktop_user');
if ($objuser->is_super()) {
return;
}
$perss = $objuser->group();
$get = $_GET;
$menu_path = 'app=' . $_GET['app'] . '&' . 'ctl=' . $_GET['ctl'] . '&' . 'act=' . $_GET['act'];
$menus = app::get('desktop')->model('menus');
$filter = array('menu_type' => 'menu', 'menu_path' => $menu_path);
$row = $menus->getList('*', $filter);
$detail_action = array_keys($detail_pages);
foreach ($row as $key => $v) {
if ($v['addon']) {
$addon = unserialize($v['addon']);
if ($addon['url_params'] && $addon['url_params']['action'] == 'detail') {
if (!in_array($v['permission'], (array) $perss)) {
if ($detail_pages[$addon['url_params']['finderview']]) {
unset($detail_pages[$addon['url_params']['finderview']]);
}
}
}
}
continue;
}
}
示例5: create_ftp_file
public function create_ftp_file($data, $params, $page = 1)
{
$local_file = tempnam(DATA_DIR . "/backup/", $params['model']);
if (is_null($this->remote_file)) {
$this->remote_file = $params['model'] . '.' . $params['post']['_io_type'];
}
$file = fopen($local_file, "w");
$model = app::get($params['app_id'])->model($params['model']);
if (method_exists($model, 'export_csv')) {
$rs = $model->export_csv($data);
} else {
$rs = '';
if (is_array($data)) {
$data = (array) $data;
if (empty($data['title']) && empty($data['contents'])) {
$rs = implode("\n", $data);
} else {
if ($page == 1) {
$rs = $data['title'] . "\n" . implode("\n", (array) $data['contents']);
} else {
$rs = implode("\n", (array) $data['contents']);
}
}
} else {
$rs = (string) $data;
}
}
fwrite($file, $rs);
fclose($file);
$obj_ftp = vmc::singleton('base_ftp');
$resume = $obj_ftp->size($this->remote_file);
$obj_ftp->nb_put($this->remote_file, $local_file, FTP_BINARY, $resume);
unlink($local_file);
return true;
}
示例6: makeTemplate
/**
* 生成模板(用于后台处理显示使用)
*
* @param array $aTemplate
* @param array $aData
* @return string
*/
public function makeTemplate($aTemplate = array(), $aData = array(), $vpath = 'conditions', $is_auto = false)
{
if (empty($this->default_aggregator)) {
return false;
}
return vmc::singleton($this->default_aggregator)->view($aTemplate, $aData, $vpath, 0, null, $is_auto);
}
示例7: generate
/**
* 订单完成\归档.
*
* @param $sdf array 订单ID\操作者ID\操作者名称
*
* @return bool - 成功与否
*/
public function generate($sdf, &$msg = '')
{
$mdl_order = app::get('b2c')->model('orders');
$order_sdf = $mdl_order->dump($sdf['order_id']);
//订单作废前验证
foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
if (!$service->exec($order_sdf, $msg)) {
return false;
}
}
$order_sdf['status'] = 'finish';
// 更新退款日志结果
if ($mdl_order->save($order_sdf)) {
//订单日志记录
vmc::singleton('b2c_order_log')->set_operator(array('ident' => $sdf['op_id'] ? $sdf['op_id'] : $order_sdf['member_id'], 'model' => $sdf['op_id'] ? 'shopadmin' : 'members', 'name' => $sdf['op_name'] ? $sdf['op_name'] : '会员'))->set_order_id($order_sdf['order_id'])->success('finish', '订单已完成归档!', $order_sdf);
} else {
$msg = '完成\\归档失败!';
return false;
}
//订单作废时同步扩展服务
foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
if (!$service->exec($order_sdf, $msg)) {
//记录日志,不中断
logger::error($sdf['order_id'] . '完成归档时出错!' . $msg);
}
}
return true;
}
示例8: exec
public function exec(&$order_sdf, &$msg = '')
{
$pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $order_sdf['member_id']);
$env_list = array('order_id' => $order_sdf['order_id'], 'timestr' => date('Y-m-d H:i:s', $order_sdf['last_modify']));
vmc::singleton('b2c_messenger_stage')->trigger('orders-end', $env_list, array('email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile'], 'member_id' => $order_sdf['member_id']));
return true;
}
示例9: exec
/**
* 订单创建完成时
* @params array - 订单完整数据,含ITEMS
* @return boolean - 执行成功与否
*/
public function exec($sdf, &$msg = '')
{
logger::debug($sdf['order_id'] . 'createfinish exec');
if ($sdf['is_cod'] == 'Y') {
$freeze_data = array();
foreach ($sdf['items'] as $key => $item) {
//购买数量计数
vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
//组织库存冻结数据
$freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
}
//库存冻结
if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
logger::error('库存冻结异常!ORDER_ID:' . $sdf['order_id'] . ',' . $msg);
}
}
/* 订单金额为0 **/
$order_sdf = $sdf;
if ($order_sdf['order_total'] == '0') {
// 生成支付账单
$obj_bill = vmc::singleton('ectools_bill');
$bill_sdf = array('bill_type' => 'payment', 'pay_object' => 'order', 'pay_mode' => in_array($order_sdf['pay_app'], array('-1', 'cod', 'offline')) ? 'offline' : 'online', 'order_id' => $order_sdf['order_id'], 'pay_app_id' => $order_sdf['pay_app'], 'pay_fee' => $order_sdf['cost_payment'], 'member_id' => $order_sdf['member_id'], 'status' => 'succ', 'money' => $order_sdf['order_total'], 'memo' => '订单0元时自动生成');
if (!$obj_bill->generate($bill_sdf, $msg)) {
//TODO 自动支付失败,
logger::error('订单0元时自动支付失败!' . $msg);
return;
}
}
return true;
}
示例10: seller_login
public function seller_login($userData, $vcode = false, &$msg)
{
$userData = utils::_filter_input($userData);
//过滤xss攻击
if (!$vcode || !base_vcode::verify('passport', $vcode)) {
$msg = '验证码错误';
return false;
}
//如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
if (!$userData['login_type']) {
$userPassport = vmc::singleton('seller_user_passport');
$userData['login_type'] = $userPassport->get_login_account_type($userData['login_name']);
}
$filter = array('login_type' => $userData['login_type'], 'login_name' => $userData['login_name']);
$account = app::get('seller')->model('sellers')->getList('member_id, login_name, createtime', $filter);
if (!$account) {
$msg = '不存在的用户';
return false;
}
$login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['login_name']));
if ($account[0]['login_password'] != $login_password) {
$msg = '登录密码错误';
return false;
}
return $account[0]['member_id'];
}
示例11: detail_payments
/**
* 下拉参数数据的展示的实现
* @param string payment id支付单序号
* @return string 详情内容
*/
public function detail_payments($payment_id)
{
$payment = $this->app->model('payments');
if ($_POST['payment_id']) {
$sdf = $_POST;
unset($_POST['_method']);
if ($payment->save($sdf)) {
echo 'ok';
}
} else {
$sdf_payment = $payment->dump($payment_id, '*', array('orders' => '*'));
if ($sdf_payment) {
$render = $this->app->render();
$render->pagedata['payments'] = $sdf_payment;
if (isset($render->pagedata['payments']['op_id']) && $render->pagedata['payments']['op_id']) {
$arr_pam['login_name'] = vmc::singleton('b2c_user_object')->get_member_name(null, $render->pagedata['payments']['op_id']);
if (!$arr_pam['login_name']) {
$obj_pam = app::get('pam')->model('account');
$arr_pam = $obj_pam->dump(array('account_id' => $render->pagedata['payments']['op_id']), 'login_name');
}
$render->pagedata['payments']['op_id'] = $arr_pam['login_name'] ? $arr_pam['login_name'] : '-';
} else {
$render->pagedata['payments']['op_id'] = '-';
}
if (isset($render->pagedata['payments']['orders']) && $render->pagedata['payments']['orders']) {
foreach ($render->pagedata['payments']['orders'] as $key => $arr_order_bills) {
$render->pagedata['payments']['order_id'] = $key;
}
}
return $render->fetch('payments/payments.html', $this->app->app_id);
} else {
return '无内容';
}
}
}
示例12: _instance
/**
* 实例化存储方式类.
*/
private function _instance()
{
$params = $this->storage_policy();
$obj_name = 'importexport_policy_' . $params['policy'];
$this->policy_obj = vmc::singleton($obj_name);
return true;
}
示例13: index
function index($key = 'passport')
{
$vcode = vmc::singleton('base_vcode');
$vcode->length(4);
$vcode->verify_key($key);
$vcode->display();
}
示例14: index
public function index()
{
header('Location:index.php?app=b2c&ctl=admin_setting&act=index');
die;
$dashboard_from = $this->_request->get_post('f');
$dashboard_to = $this->_request->get_post('t');
$default_enter = true;
if (!$dashboard_to) {
$dashboard_to = strtotime(date('Y-m-d'));
} else {
$default_enter = false;
}
if (!$dashboard_from) {
$dashboard_from = strtotime('-1 week', $dashboard_to);
} else {
$default_enter = false;
}
//权限带入
$user = vmc::singleton('desktop_user');
$is_super = $user->is_super();
$group = $user->group();
$group = (array) $group;
//统一时间格式
if (strpos($dashboard_from, ':')) {
$dashboard_from = strtotime($dashboard_from);
$dashboard_to = strtotime($dashboard_to);
}
if ($dashboard_from > $dashboard_to) {
$tmp_t = $dashboard_to;
$dashboard_to = $dashboard_from;
$dashboard_from = $tmp_t;
}
//桌面挂件排序,用户自定义
if ($default_enter && cacheobject::get('desktop.dashboard.widgets' . $dashboard_to, $cache_data) && isset($cache_data['data'])) {
$this->pagedata['cached_time'] = $cache_data['cached_time'];
$widgets = $cache_data['data'];
} else {
foreach (vmc::servicelist('desktop.widgets') as $key => $obj) {
if ($is_super || in_array(get_class($obj), $group)) {
$item = array('title' => $obj->get_title(), 'layout' => $obj->get_layout(), 'html' => $obj->get_html($dashboard_from, $dashboard_to), 'order' => $obj->get_order());
if (method_exists($obj, 'get_classname')) {
$item['classname'] = $obj->get_classname();
}
$widgets[$item['layout']][] = $item;
}
}
if ($default_enter) {
$cache_data = array('cached_time' => time(), 'data' => $widgets);
cacheobject::set('desktop.dashboard.widgets' . $dashboard_to, $cache_data, time() + 86400);
//缓存24小时
}
}
$this->pagedata['widgets'] = $widgets;
$this->pagedata['dashboard_from'] = $dashboard_from;
$this->pagedata['dashboard_to'] = $dashboard_to;
//快捷
$this->pagedata['tody'] = date('Y-m-d H:i', strtotime(date('Y-m-d')));
$this->pagedata['from_arr'] = array('w' => date('Y-m-d H:i', strtotime('-1 week', strtotime($this->pagedata['tody']))), 'm' => date('Y-m-d H:i', strtotime('-1 month', strtotime($this->pagedata['tody']))), 'q' => date('Y-m-d H:i', strtotime('-3 month', strtotime($this->pagedata['tody']))));
$this->display('dashboard.html');
}
示例15: get_output
function get_output()
{
$render = $this->app->render();
$act = app::get('desktop')->model('menus')->getList('menu_id,app_id,menu_title,menu_path,workground', array('menu_type' => 'workground', 'disabled' => 'false'));
$user = vmc::singleton('desktop_user');
if ($user->is_super()) {
$aData = $act;
} else {
$group = $user->group();
//print_r($group);
$meuns = app::get('desktop')->model('menus');
$data = array();
foreach ($group as $key => $val) {
$aTmp = $meuns->workgroup($val);
foreach ($aTmp as $val) {
$data[] = $val;
}
}
$aData = $data;
}
$menu_id = array();
$wrokground = array();
foreach ((array) $aData as $value) {
if (!in_array($value['menu_id'], (array) $menu_id)) {
$workground[] = $value;
}
$menu_id[] = $value['menu_id'];
}
$render->pagedata['actions'] = $workground;
$render->pagedata['side'] = "sidepanel";
return $render->fetch('sidepanel.html');
}