本文整理汇总了PHP中mgm_get_module函数的典型用法代码示例。如果您正苦于以下问题:PHP mgm_get_module函数的具体用法?PHP mgm_get_module怎么用?PHP mgm_get_module使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mgm_get_module函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module_setting_box
function module_setting_box()
{
// make local
extract($_REQUEST);
// get module
$module_class = mgm_get_module($module, 'payment');
// load settings box
echo $module_class->settings_box();
}
示例2: module_settings
function module_settings()
{
// make local
extract($_REQUEST);
// get module
$module_class = mgm_get_module($module, 'autoresponder');
// update
if (isset($update) && $update == 'true') {
// settings update
echo $module_class->settings_update();
} else {
// load settings form
$module_class->settings();
}
}
示例3: field_payment_gateways_callback
/**
* Callback for payment_gateways field
* prints all active modules, javascript callback and json data shows per pack
* or filtered
*
* @param array $field
* @param string $name
* @param string $value
* @return string
*/
function field_payment_gateways_callback($field, $name, $value)
{
// display as
$dispaly_as_selectbox = $this->_get_subscription_options_as();
//check subscription options custom_field is enabled:
$continue = false;
// cf
$obj_customfields = mgm_get_class('member_custom_fields');
// subo
$arr_sub_options = $obj_customfields->get_field_by_name('subscription_options');
// check
if (isset($arr_sub_options['id']) && !empty($obj_customfields->sort_orders) && in_array($arr_sub_options['id'], $obj_customfields->sort_orders)) {
$continue = true;
}
// return
if (!$continue) {
return '';
}
$system_obj = mgm_get_class('system');
// args
$args = $this->get_config('args', array());
// selected_subscription
$selected_subs = mgm_get_selected_subscription($args);
// get active modules
$a_payment_modules = $system_obj->get_active_modules('payment');
/* @todo deprecate load here since gateways are loaded for post purchase also
// get modules for packs:
$allpacks = mgm_get_class('subscription_packs')->get_packs();
// init
$pack_modules = array();
// loop
foreach ($allpacks as $allp) {
// reset
$include = mgm_select_subscription($allp,$selected_subs);
// skip other when a package sent as selected
if($selected_subs !== false){
if(empty($include)) continue;
}
//issue #1532
if(is_array($allp['modules'])){
$pack_modules = array_merge($pack_modules,$allp['modules']);
}
}
// pack
$pack_modules = array_unique($pack_modules);
mgm_pr($pack_modules);*/
// payment modules
$payment_modules = array();
// loop
if (!empty($a_payment_modules)) {
// loop
foreach ($a_payment_modules as $payment_module) {
// not trial
if (in_array($payment_module, array('mgm_free', 'mgm_trial'))) {
continue;
}
// included modules
// if( ! in_array($payment_module, $pack_modules) ) continue;
// store
$payment_modules[] = $payment_module;
}
}
// make unique
$payment_modules = apply_filters('mgm_payment_gateways_as_custom_field', array_unique($payment_modules));
// check count
$module_count = count($payment_modules);
// one active
$hide_div = $module_count === 1 ? 'style="display:none;"' : '';
// NOTE: uncomment the below line to enable module display even if only one exists
// $hide_div = "";
// NOTE: do not change the id: mgm_payment_gateways_container
$html = sprintf('<div id="mgm_payment_gateways_container" class="mgm_payment_wrapper" %s >', $hide_div);
//loop through payment modules:
if ($module_count == 0) {
$html .= sprintf('<div>%s</div>', __('No active payment module', 'mgm'));
} else {
//print each module:
foreach ($payment_modules as $payment_module) {
//checked: if(selected/only one gateway exists)
if (isset($_POST['mgm_payment_gateways'])) {
$checked = $payment_module == $_POST['mgm_payment_gateways'] ? 'checked="true"' : '';
} else {
$checked = !empty($value) && $value == $field['value'] || $module_count === 1 ? 'checked="true"' : '';
}
// get obj
$mod_obj = mgm_get_module($payment_module, 'payment');
// html
$img_url = mgm_site_url($mod_obj->logo);
// desc
//.........这里部分代码省略.........
示例4: mgm_get_module
<?php
/**
* Objects merge/update
* Add worldpay gateway_successpage and gateway_failedpage settings
*/
// read
$worldpay = mgm_get_module('worldpay', 'payment');
if (isset($worldpay->setting['gateway_successpage'])) {
$worldpay->setting['gateway_successpage'] = '<html>
<head>
<meta http-equiv="refresh" content="<WPDISPLAY ITEM=MC_redirectin>;url=<WPDISPLAY ITEM=MC_success>" />
<title>Thank you for your payment</title>
</head>
<WPDISPLAY FILE=header.html DEFAULT="<body bgcolor=#ffffff>">
<h1><WPDISPLAY ITEM=MC_sitename></h1>
<WPDISPLAY ITEM=name>, thank you for your payment of
<WPDISPLAY ITEM=amountString> for
<WPDISPLAY ITEM=desc>
<div>Click <a href="<WPDISPLAY ITEM=MC_success>"><strong>here</strong></a> to return to the site if you are not redirected within <WPDISPLAY ITEM=MC_redirectin> seconds</div>
<WPDISPLAY ITEM=banner>
<WPDISPLAY FILE=footer.html DEFAULT="</body>">
</html>';
$worldpay->save();
}
// end file
示例5: cancel_recurring_subscription
/**
* Cancel Recurring Subscription
* This is not a private function
* @param int/string $trans_ref
* @param int $user_id
* @param int/string $subscr_id
* @param int $pack_id
* @return boolean
*/
function cancel_recurring_subscription($trans_ref = null, $user_id = null, $subscr_id = null, $pack_id = null)
{
//if coming form process return after a subscription payment
if (!empty($trans_ref)) {
$transdata = $this->_get_transaction_passthrough($trans_ref);
if ($transdata['payment_type'] != 'subscription_purchase') {
return false;
}
$user_id = $transdata['user_id'];
if (isset($transdata['is_another_membership_purchase']) && $transdata['is_another_membership_purchase'] == 'Y') {
$member = mgm_get_member_another_purchase($user_id, $transdata['membership_type']);
} else {
$member = mgm_get_member($user_id);
}
if (isset($member->payment_info->module) && !empty($member->payment_info->module)) {
if (isset($member->payment_info->subscr_id)) {
$subscr_id = $member->payment_info->subscr_id;
} else {
//check pack is recurring:
$pid = $pack_id ? $pack_id : $member->pack_id;
if ($pid) {
$s_packs = mgm_get_class('subscription_packs');
$sel_pack = $s_packs->get_pack($pid);
if ($sel_pack['num_cycles'] != 1) {
$subscr_id = 0;
}
}
}
//check for same module: if not call the same function of the applicale module.
if (str_replace('mgm_', '', $member->payment_info->module) != str_replace('mgm_', '', $this->code)) {
mgm_log('RECALLing ' . $member->payment_info->module . ': cancel_recurring_subscription FROM: ' . $this->code);
return mgm_get_module($member->payment_info->module, 'payment')->cancel_recurring_subscription($trans_ref, null, null, $pack_id);
}
//skip if same pack is updated
if (empty($member->pack_id) || is_numeric($pack_id) && $pack_id == $member->pack_id) {
return false;
}
} else {
return false;
}
} else {
if ($this->setting['aquirer'] != 'sisow') {
// skip sisow
return false;
//skip as trans reff will need to be passed always
}
}
//only for subscription_purchase
if ($this->setting['aquirer'] == 'sisow') {
if (!isset($member)) {
$member = mgm_get_member($user_id);
}
$txn_id = $member->payment_info->txn_id;
//mgm_pr($member);
// endpoint
$endpoint = $this->_get_endpoint();
// set
$endpoint = str_replace('[action]', 'CancelReservationRequest', $endpoint);
// keys
$compute_keys = array($txn_id, $this->setting['merchant_id'], $this->setting['secret_key']);
$compute_sha1 = sha1(implode('', $compute_keys));
$post_data = array('trxid' => $txn_id, 'merchantid' => $this->setting['merchant_id'], 'sha1' => $compute_sha1);
// headers
$http_headers = array();
//array('Content-Type' => 'text/xml');
//mgm_pr($post_data); die;
// create curl post
$http_response = mgm_remote_post($endpoint, $post_data, array('headers' => $http_headers, 'timeout' => 30, 'sslverify' => false));
mgm_log($http_response, __FUNCTION__);
// parse
if ($xml = @simplexml_load_string($http_response)) {
mgm_log($xml, __FUNCTION__);
// redirect to issuer
if (isset($xml->reservation->status)) {
return (string) $xml->reservation->status == 'Cancelled' ? true : false;
} else {
return false;
}
}
}
//send email only if setting enabled
if (!empty($subscr_id) || $subscr_id === 0) {
$system_obj = mgm_get_class('system');
$dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
//send email only if setting enabled
if (!$dge) {
// blog
$blogname = get_option('blogname');
// user
$user = get_userdata($user_id);
// notify admin
//.........这里部分代码省略.........
示例6: mgm_post_setup_meta_box_form
/**
* the meta box for post/page purchase
*
*/
function mgm_post_setup_meta_box_form($post)
{
// get object
$post_obj = mgm_get_post($post->ID);
$datepickerformat = mgm_get_datepicker_format();
// set default price
if ($post_obj->purchase_cost == 0) {
if (mgm_get_module('mgm_paypal', 'payment')->setting['purchase_price']) {
$post_obj->purchase_cost = mgm_get_module('mgm_paypal', 'payment')->setting['purchase_price'];
} else {
$post_obj->purchase_cost = mgm_get_class('system')->setting['post_purchase_price'];
}
}
// protect
$protect_content = mgm_protect_content();
//issue#: 414(changed id submitpost => submitpost_member for the below div )
?>
<div class="submitbox" id="submitpost_member">
<div class="misc-pub-section">
<p id="howto">
<?php
_e('Select which membership types will have access to read this post/page.', 'mgm');
?>
<?php
_e('Note: The private parts of the post should be inside the following tags: <strong>[private]</strong> <em>your text</em> <strong>[/private]</strong>', 'mgm');
?>
</p>
<p>
<div class="mgm_post_setup_meta_box_div">
<input type="checkbox" name="check_all" value="mgm_post[access_membership_types][]" /> <span><?php
_e('Select all', 'mgm');
?>
</span>
</div>
</p>
<p>
<?php
echo mgm_make_checkbox_group('mgm_post[access_membership_types][]', mgm_get_class('membership_types')->get_membership_types(), $post_obj->access_membership_types, MGM_KEY_VALUE);
?>
</p>
<?php
if ($protect_content == false) {
?>
<div class="information mgm_width_230px"><?php
echo sprintf(__('<a href="%s">Content Protection</a> is <b>%s</b>. Make sure its enabled to Protect Post/Page.', 'mgm'), 'admin.php?page=mgm/admin', $protect_content ? 'enabled' : 'disabled');
?>
</div>
<?php
}
?>
</div>
<div class="misc-pub-section">
<b><?php
_e('Pay Per Post', 'mgm');
?>
:</b>
<a href="#payperpost" class="mgm-toggle"><?php
_e('Edit');
?>
</a>
<div id="payperpostdiv" class="hide-if-js">
<div class="mgm_padding_5px">
<p class="postpurhase-heading"><?php
_e('Purchasable Settings', 'mgm');
?>
:</p>
<ul class="mgm_post_setup_meta_box_ul">
<li>
<label><?php
_e('If the user doesn\'t have access, is this post/page available to buy?', 'mgm');
?>
</label><br/>
<input type="radio" class="radio" name="mgm_post[purchasable]" value='N' <?php
mgm_check_if_match('N', $post_obj->purchasable);
?>
/>
<label><?php
_e('No', 'mgm');
?>
</label>
<input type="radio" class="radio" name="mgm_post[purchasable]" value='Y' <?php
mgm_check_if_match('Y', $post_obj->purchasable);
?>
/>
<label><?php
_e('Yes', 'mgm');
?>
</label>
</li>
//.........这里部分代码省略.........
示例7: mgm_get_payment_processed_page_html
/**
* get payment processed page html
*
* @param void
* @return string
* @since 1.5
*/
function mgm_get_payment_processed_page_html()
{
// home url
$home_url = trailingslashit(get_option('siteurl'));
// current module
$module = mgm_request_var('module', '', true);
// check
if (!mgm_is_valid_module($module) || empty($module)) {
// redirect
mgm_redirect($home_url);
}
// init
$html = '';
// refresh wait time
$refresh_wait_time = 5;
//in seconds
// redirect url
$redirect_url = '';
// redirect
$do_redirect = true;
// refresh header for post redirecr
if (isset($_GET['post_redirect'])) {
// redirect url
$redirect_url = strip_tags($_GET['post_redirect']);
} elseif (isset($_GET['register_redirect'])) {
// redirect url, if 1/true, redirect to profile, else its register & redirect url
if ($_GET['register_redirect'] != 1) {
$redirect_url = strip_tags($_GET['register_redirect']);
} else {
// auto login
$system_obj = mgm_get_class('system');
//issue# 1392
$current_user_id = get_current_user_id();
// check if set
if ($autologin_redirect_url = $system_obj->get_setting('autologin_redirect_url')) {
$page_title = '';
$redirect_url = $autologin_redirect_url;
//short code support
if (!empty($current_user_id)) {
$user = get_userdata($current_user_id);
$redirect_url = str_replace('[username]', $user->user_login, $redirect_url);
}
} elseif (mgm_get_user_package_redirect_url($current_user_id) && $current_user_id) {
$page_title = '';
$redirect_url = mgm_get_user_package_redirect_url($current_user_id);
} else {
$page_title = 'Profile';
$redirect_url = mgm_get_custom_url('profile');
}
}
// check not logged in, #948 paypal fails to redirect
if (!is_user_logged_in()) {
// user login
if (isset($_GET['trans_ref'])) {
// re construct redirect url
$redirect_url = mgm_get_custom_url('login', false, array('trans_ref' => strip_tags($_GET['trans_ref']), 'auto_login' => true, 'redirect_to' => $redirect_url));
}
}
}
// check and set
if (!empty($redirect_url) && $do_redirect) {
// alter
$redirect_url = apply_filters('mgm_register_redirect', $redirect_url);
// no headers
if (!headers_sent()) {
@header(sprintf('Refresh: %d;url=%s', $refresh_wait_time, $redirect_url));
} else {
$html .= sprintf('<script language="javascript">window.setTimeout(function(){window.location.href="%s";}, %d)</script>', $redirect_url, (int) $refresh_wait_time * 5);
}
}
// module object
$module_object = mgm_get_module($module, 'payment');
// [domain]/subscribe/?method=payment_processed&module=mgm_paypal&status=success
// [domain]/subscribe/?method=payment_processed&module=mgm_paypal&status=cancel
// status and message
$arr_shortcodes = array('transaction_amount' => '');
// check
if (!isset($_GET['status']) || $_GET['status'] == 'success') {
// mgm_replace_oldlinks_with_tag is a patch for replacing the old link
$message = $module_object->setting['success_message'] ? mgm_replace_oldlinks_with_tag($module_object->setting['success_message'], 'payment_success_message') : $system_obj->get_template('payment_success_message', array(), true);
// get price
if (isset($_GET['trans_ref'])) {
// tarns
$_GET['trans_ref'] = mgm_decode_id(strip_tags($_GET['trans_ref']));
// get transaction data
$trans = mgm_get_transaction($_GET['trans_ref']);
// set amount
if ($trans['module'] == 'manualpay') {
$arr_shortcodes['transaction_amount'] = $trans['data']['cost'] . ' ' . $trans['data']['currency'];
}
// update googe analytics:
$html .= apply_filters('mgm_payment_processed_page_analytics', $trans);
// @todo, callback in template function
//.........这里部分代码省略.........
示例8: cancel_recurring_subscription
/**
* Cancel Recurring Subscription
* This is not a private function
* @param int/string $trans_ref
* @param int $user_id
* @param int/string $subscr_id
* @param int $pack_id
* @return boolean
*/
function cancel_recurring_subscription($trans_ref = null, $user_id = null, $subscr_id = null, $pack_id = null)
{
//if coming form process return after a subscription payment
if (!empty($trans_ref)) {
$transdata = $this->_get_transaction_passthrough($trans_ref);
if ($transdata['payment_type'] != 'subscription_purchase') {
return false;
}
$user_id = $transdata['user_id'];
if (isset($transdata['is_another_membership_purchase']) && $transdata['is_another_membership_purchase'] == 'Y') {
$member = mgm_get_member_another_purchase($user_id, $transdata['membership_type']);
} else {
$member = mgm_get_member($user_id);
}
if (isset($member->payment_info->module) && !empty($member->payment_info->module)) {
if (isset($member->payment_info->subscr_id)) {
$subscr_id = $member->payment_info->subscr_id;
} else {
//check pack is recurring:
$pid = $pack_id ? $pack_id : $member->pack_id;
if ($pid) {
$s_packs = mgm_get_class('subscription_packs');
$sel_pack = $s_packs->get_pack($pid);
if ($sel_pack['num_cycles'] != 1) {
$subscr_id = 0;
}
}
}
//check for same module: if not call the same function of the applicale module.
if (str_replace('mgm_', '', $member->payment_info->module) != str_replace('mgm_', '', $this->code)) {
mgm_log('RECALLing ' . $member->payment_info->module . ': cancel_recurring_subscription FROM: ' . $this->code);
return mgm_get_module($member->payment_info->module, 'payment')->cancel_recurring_subscription($trans_ref, null, null, $pack_id);
}
//skip if same pack is updated
if (empty($member->pack_id) || is_numeric($pack_id) && $pack_id == $member->pack_id) {
return false;
}
} else {
return false;
}
}
// when a subscription found
if ($subscr_id) {
// @todo add api call
// query data
$query_data = array();
// add internal vars
$secure = array('clientAccnum' => $this->setting['client_acccnum'], 'clientSubacc' => $this->setting['client_subacc'], 'username' => $this->setting['datalink_username'], 'password' => $this->setting['datalink_password']);
// merge
$query_data = array_merge($query_data, $secure);
// overwrite post data array with secure params
// method
$query_data['action'] = 'cancelSubscription';
//check
if (isset($member)) {
$query_data['subscriptionId'] = $member->payment_info->subscr_id;
} else {
$query_data['subscriptionId'] = $subscr_id;
}
// xml response
$query_data['returnXML'] = 1;
// post string
$query_string = _http_build_query($query_data, null, '&');
// endpoint
$endpoint = $this->_get_endpoint('datalink_sms');
// url
$url = $endpoint . '?' . $query_string;
// log
mgm_log($url, $this->module . '_' . __FUNCTION__);
// remote get
$http_response = mgm_remote_get($url, null, null, false);
// log
mgm_log($http_response, $this->module . '_' . __FUNCTION__);
// xml
if ($xml = @simplexml_load_string($http_response)) {
// log
mgm_log($xml, $this->module . '_' . __FUNCTION__);
// return
return (int) $xml == 1;
// success
}
// end api call
} elseif (is_null($subscr_id) || $subscr_id === 0) {
$system_obj = mgm_get_class('system');
$dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
// check
if (!$dge) {
// blog
$blogname = get_option('blogname');
// user
$user = get_userdata($user_id);
//.........这里部分代码省略.........
示例9: cancel_recurring_subscription
/**
* Cancel Recurring Subscription
* This is not a private function
* @param int/string $trans_ref
* @param int $user_id
* @param int/string $subscr_id
* @return boolean
*/
function cancel_recurring_subscription($trans_ref = null, $user_id = null, $subscr_id = null, $pack_id = null)
{
//if coming form process return after a subscription payment
if (!empty($trans_ref)) {
$transdata = $this->_get_transaction_passthrough($trans_ref);
if ($transdata['payment_type'] != 'subscription_purchase') {
return false;
}
$user_id = $transdata['user_id'];
if (isset($transdata['is_another_membership_purchase']) && $transdata['is_another_membership_purchase'] == 'Y') {
$member = mgm_get_member_another_purchase($user_id, $transdata['membership_type']);
} else {
$member = mgm_get_member($user_id);
}
if (isset($member->payment_info->module) && !empty($member->payment_info->module)) {
if (isset($member->payment_info->subscr_id)) {
$subscr_id = $member->payment_info->subscr_id;
} else {
//check pack is recurring:
$pid = $pack_id ? $pack_id : $member->pack_id;
if ($pid) {
$s_packs = mgm_get_class('subscription_packs');
$sel_pack = $s_packs->get_pack($pid);
if ($sel_pack['num_cycles'] != 1) {
$subscr_id = 0;
}
// 0 stands for a lost subscription id
}
}
//check for same module: if not call the same function of the applicale module.
if (str_replace('mgm_', '', $member->payment_info->module) != str_replace('mgm_', '', $this->code)) {
// mgm_log('RECALLing '. $member->payment_info->module .': cancel_recurring_subscription FROM: ' . $this->code);
return mgm_get_module($member->payment_info->module, 'payment')->cancel_recurring_subscription($trans_ref, null, null, $pack_id);
}
//skip if same pack is updated
if (empty($member->pack_id) || is_numeric($pack_id) && $pack_id == $member->pack_id) {
return false;
}
} else {
return false;
}
}
//ony for subscription_purchase
if ($subscr_id) {
// end point
$endpoint = $this->_get_endpoint('unsubscribe');
// base
// add query
$url = add_query_arg(array('SUBSCRIPTION_ID' => urlencode($subscr_id), 'MERCHANT_ID' => urlencode($this->setting['merchant_id']), 'ZombaioGWPass' => urlencode($this->setting['gw_pass']), 'ReasonCode' => urlencode(11)), $endpoint);
// create curl post
//$buffer = $this->_curl_post($url);
// headers
$http_headers = array();
// fetch
$http_response = mgm_remote_post($url, $post_data, array('headers' => $http_headers, 'timeout' => 30, 'sslverify' => false));
// verify
if ($http_response == 1) {
return true;
} else {
// message
return $this->_get_cancel_error($http_response);
}
} elseif ($subscr_id === 0) {
//send email to admin if subscription Id is absent
$system_obj = mgm_get_class('system');
$dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
//send email only if setting enabled
if (!$dge) {
$user = get_userdata($user_id);
//send notification email to admin:
$message = __('The User: ', 'mgm') . $user->user_email . ' (' . $user_id . ') ' . __('has upgraded/cancelled subscription.', 'mgm');
$message .= "<br/>" . __('Please unsubscribe the user subscription from Gateway Merchant panel.', 'mgm');
if (!empty($member->transaction_id)) {
$message .= "<br/>" . __('MGM Transaction Id:', 'mgm') . $member->transaction_id;
}
//admin email:
if (!empty($system_obj->setting['admin_email'])) {
@mgm_mail($system_obj->setting['admin_email'], sprintf(__('[%s] User Subscription Cancellation', 'mgm'), get_option('blogname')), $message);
}
}
return true;
}
return false;
}
示例10: _confirm_notify
/**
* Confirm notify URL.
*
* related to issue#: 528
* As PAYPALPRO doesn't use overridden notifyurl, and posts IPN to default IPN settings URL on merchant panel
* Confirm module field in transactions table/mgm_member object
*
*/
function _confirm_notify()
{
$mod_code = '';
//check possible params for transaction id [rp_invoice_id, invoice, custom]
if (isset($_POST['rp_invoice_id']) && is_numeric($_POST['rp_invoice_id'])) {
$transaction_id = $_POST['rp_invoice_id'];
} elseif (isset($_POST['invoice']) && is_numeric($_POST['invoice'])) {
$transaction_id = $_POST['invoice'];
} elseif (isset($_POST['custom']) && is_numeric($_POST['custom'])) {
$transaction_id = $_POST['custom'];
} elseif (isset($_POST['custom']) && !is_numeric($_POST['custom']) && preg_match('/^subscription_/', $_POST['custom'])) {
//for backward compatibility:
//transaction cannot be found for old users:
$transdata = $this->_get_transaction_passthrough($_POST['custom']);
$member = mgm_get_member($transdata['user_id']);
if (isset($member->payment_info->module) && !empty($member->payment_info->module)) {
$mod_code = preg_match('/mgm_/', $member->payment_info->module) ? $member->payment_info->module : 'mgm_' . $transdata['module'];
}
}
//if a transaction id is found
if (isset($transaction_id)) {
$transdata = mgm_get_transaction($transaction_id);
if (!empty($transdata['module'])) {
$mod_code = preg_match('/mgm_/', $transdata['module']) ? $transdata['module'] : 'mgm_' . $transdata['module'];
}
}
//if module code is found and not belongs to current module, then invode process_notify() function of the applicable module.
if (!empty($mod_code) && $mod_code != $this->code) {
// recall process_notifyof the module
// keep the log untill paypal is resolved.
// mgm_log('FROM PAYMENT: recalling ' . $mod_code .'->process_notify() FROM: '. $this->code );
mgm_get_module($mod_code, 'payment')->process_notify();
// return
return false;
}
return true;
}
示例11: mgm_get_module
<?php
/**
* Objects merge/update
* Add eWay webservice username and password to settings
*/
// read
$eway = mgm_get_module('eway', 'payment');
if (!isset($eway->setting['username'])) {
$eway->setting['username'] = '';
$eway->setting['password'] = '';
$eway->save();
}
// end file
示例12: _update_modules
function _update_modules()
{
// get modules
$modules = mgm_get_modules('payment');
// loop
foreach ($modules as $module) {
// instance
$module_object = mgm_get_module('mgm_' . $module, 'payment');
// update message
$module_object->_setup_callback_messages(array(), true);
// update from global template
// update option
$module_object->save();
}
}
示例13: mgm_get_post_purchase_buttons
//.........这里部分代码省略.........
$item_name = apply_filters('mgm_postpack_purchase_itemname', sprintf(__('Purchase Post Pack - %s', 'mgm'), $postpack->name));
// post id
$post_id = mgm_get_postpack_posts_csv($postpack_id);
// set pack
$pack = array('duration' => 1, 'item_name' => $item_name, 'buypost' => 1, 'cost' => $cost, 'title' => $postpack->name, 'product' => $product, 'post_id' => $post_id, 'postpack_id' => $postpack_id, 'postpack_post_id' => $postpack_post_id, 'allowed_modules' => $modules);
}
}
// check
if (!$pack) {
return __('Error in Payment! No data available ');
exit;
}
// guest token -issue #1421
if (isset($_POST['guest_purchase']) && $_POST['guest_purchase'] == TRUE && $user->ID <= 0) {
$pack['guest_token'] = sanitize_title_for_query(mgm_create_token());
}
// addon options
if (isset($addon_options) && !empty($addon_options)) {
$pack['addon_options'] = $addon_options;
}
// get coupon
$post_purchase_coupon = mgm_save_partial_fields(array('on_postpurchase' => true), 'mgm_postpurchase_field', $pack['cost'], false, 'postpurchase');
// alter
mgm_get_post_purchase_coupon_pack($post_purchase_coupon, $pack);
// Eg: $_POST['mgm_payment_gateways'] = mgm_paypal
$cf_payment_gateways = isset($_POST['mgm_payment_gateways']) && !empty($_POST['mgm_payment_gateways']) ? $_POST['mgm_payment_gateways'] : null;
// bypass step2 if payment gateway is submitted: issue #: 469
if (!is_null($cf_payment_gateways)) {
// get pack
// mgm_get_upgrade_coupon_pack($member, $selected_pack);
// cost
if ((double) $pack['cost'] > 0) {
//get an object of the payment gateway:
$mod_obj = mgm_get_module($cf_payment_gateways, 'payment');
// tran options
$tran_options = array('user_id' => $user->ID);
// is register & purchase
if (isset($_POST['post_id'])) {
$tran_options['post_id'] = (int) $_POST['post_id'];
}
// postpack id
if (isset($_POST['postpack_id'])) {
$tran_options['postpack_id'] = (int) $_POST['postpack_id'];
}
// is register & purchase postpack
if (isset($_POST['postpack_post_id']) && isset($_POST['postpack_id'])) {
$tran_options['postpack_post_id'] = (int) $_POST['postpack_post_id'];
$tran_options['postpack_id'] = (int) $_POST['postpack_id'];
}
// create transaction
$tran_id = mgm_add_transaction($pack, $tran_options);
// bypass directly to process return if manual payment:
if ($cf_payment_gateways == 'mgm_manualpay') {
// set
$_POST['custom'] = $tran_id;
// direct call to module return function:
$mod_obj->process_return();
// exit
exit;
}
// encode id:
$tran_id = mgm_encode_id($tran_id);
$redirect = $mod_obj->_get_endpoint('html_redirect', true);
$redirect = add_query_arg(array('tran_id' => $tran_id), $redirect);
// redirect
mgm_redirect($redirect);
示例14: activate
function activate()
{
global $wpdb;
// get auth
$auth = mgm_get_class('auth');
// verify key
if ($auth->verify()) {
// migration once / it will take care
require_once 'migration/mgm_migrate.php';
// check and set each schedules
foreach (mgm_get_defined_schedules() as $schedule_name => $event_name) {
// set up daily cron event, once
if (!wp_next_scheduled($event_name)) {
// add
wp_schedule_event(time(), $schedule_name, $event_name);
// the name of event/schedule hook
}
}
// create pages run always now, only when new pages added it will execute
mgm_create_custom_pages();
// run others once
if (!get_option('mgm_version') || version_compare(get_option('mgm_upgrade_id'), '1.8', '<')) {
// add version/upgrade compare, transaction added on 1.8 and pages later
// create pages
// mgm_create_custom_pages();
// enable active modules
$payment_modules = mgm_get_class('system')->get_active_modules('payment');
// active modules
if ($payment_modules) {
// loop
foreach ($payment_modules as $module) {
// install modules
mgm_get_module($module, 'payment')->enable();
// enable only
}
}
// update
update_option('mgm_version', $auth->get_product_info('product_version'));
// version
update_option('mgm_build', $auth->get_product_info('product_build'));
// build
}
}
}
示例15: mgm_update_transaction_data
/**
* update transactions missing data
*/
function mgm_update_transaction_data()
{
// db
global $wpdb;
//
// sql
$sql = "SELECT id,user_id,module,data,transaction_dt FROM `" . TBL_MGM_TRANSACTION . "` \r\r\n\t WHERE 1 AND (`user_id` IS NULL OR `user_id` = 0) AND module IS NOT NULL LIMIT 0, 50";
// check missing user_id
if ($transactions = $wpdb->get_results($sql)) {
// log
// mgm_log($transactions, __FUNCTION__);
// loop
foreach ($transactions as $transaction) {
// pack
$pack = json_decode($transaction->data, true);
// check
if (isset($pack['user_id']) && (int) $pack['user_id'] > 0) {
// id
$user_id = $pack['user_id'];
// update
$wpdb->update(TBL_MGM_TRANSACTION, array('user_id' => $user_id), array('id' => $transaction->id));
// log
mgm_log($wpdb->last_query, __FUNCTION__);
}
}
}
// authorizenet module
$authorizenet = mgm_get_module('authorizenet', 'payment');
// if active
if ($authorizenet->is_enabled()) {
// fetch module transactions
// mgm_log('Enabled', __FUNCTION__);
// 1699,1700,1711,1712,1714,1716,1718,1721,1725,1734,1735,1724,1722
mgm_fetch_authorizenet_missing_txn_id($authorizenet);
}
}