本文整理汇总了PHP中mgm_get_class函数的典型用法代码示例。如果您正苦于以下问题:PHP mgm_get_class函数的具体用法?PHP mgm_get_class怎么用?PHP mgm_get_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mgm_get_class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: autoresponder_modules
function autoresponder_modules()
{
// data
$data = array();
// get modules
$data['autoresponder_modules'] = mgm_get_modules('autoresponder');
// autoresponders
foreach ($data['autoresponder_modules'] as $module) {
// get module
$module_object = mgm_get_module('mgm_' . $module, 'autoresponder');
// check
if (is_object($module_object)) {
// get html
$data['modules'][$module]['html'] = $module_object->settings();
// get code
$data['modules'][$module]['code'] = $module_object->code;
// get name
$data['modules'][$module]['name'] = $module_object->name;
}
}
// membership types
$data['membership_types'] = mgm_get_class('membership_types')->membership_types;
// active
$data['active_module'] = mgm_get_class('system')->active_modules['autoresponder'];
// load template view
$this->load->template('autoresponders/modules', array('data' => $data));
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:27,代码来源:mgm_admin_autoresponders.php
示例2: activation_activate
function activation_activate()
{
global $wpdb;
// local
extract($_POST);
// post
if (isset($btn_activate)) {
// default
$status = 'error';
// check
if (!empty($email)) {
// validate
$message = mgm_get_class('auth')->validate_subscription($email);
// check
if ($message === true) {
$status = 'success';
$message = __('Your account has been activated.', 'mgm');
}
} else {
$message = __('Email is not provided.', 'mgm');
}
// return response
echo json_encode(array('status' => $status, 'message' => $message));
exit;
}
// data
$data = array();
// load template view
$this->load->template('admin/activation/activate', array('data' => $data));
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:30,代码来源:mgm_admin.php
示例3: index
function index()
{
// data
$data = array();
// get active modules
$data['payment_modules'] = mgm_get_class('system')->get_active_modules('payment');
// mgm_log($data['payment_modules'], __FUNCTION__);
// load template view
$this->load->template('payments/index', array('data' => $data));
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:10,代码来源:mgm_admin_payments.php
示例4: disable
function disable($deactivate = false)
{
// deactivate
if ($deactivate) {
mgm_get_class('system')->deactivate_plugin($this->code);
}
// update state
$this->enabled = 'N';
// update option
$this->save();
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:11,代码来源:mgm_plugin.php
示例5: settings_update
function settings_update()
{
// form type
switch ($_POST['setting_form']) {
case 'main':
// form main
// set fields
$this->setting['clientid'] = $_POST['setting']['clientid'];
$this->setting['formid'] = $_POST['setting']['formid'];
$this->setting['listid'] = $_POST['setting']['listid'];
$this->setting['specialid'] = $_POST['setting']['specialid'];
$this->setting['doubleopt'] = $_POST['setting']['doubleopt'];
// fieldmap
$this->setting['fieldmap'] = $this->_make_assoc($_POST['setting']['fieldmap']);
// membershipmap
$this->setting['membershipmap'] = $this->_make_assoc($_POST['setting']['membershipmap']);
// update enable/disable
$this->enabled = $_POST['enabled'];
// enable/disable method
$activate_method = bool_from_yn($this->enabled) ? 'activate_module' : 'deactivate_module';
// update
$ret = call_user_func_array(array(mgm_get_class('system'), $activate_method), array($this->code, $this->type));
// save object options
$this->save();
// message
return json_encode(array('status' => 'success', 'message' => sprintf(__('%s settings updated', 'mgm'), $this->name)));
break;
case 'box':
default:
// from box
// set fields
$this->setting['clientid'] = $_POST['setting']['icontact']['clientid'];
$this->setting['formid'] = $_POST['setting']['icontact']['formid'];
$this->setting['listid'] = $_POST['setting']['icontact']['listid'];
$this->setting['specialid'] = $_POST['setting']['icontact']['specialid'];
$this->setting['doubleopt'] = $_POST['setting']['icontact']['doubleopt'];
// update object options
$this->save();
// message
return json_encode(array('status' => 'success', 'message' => sprintf(__('%s settings updated', 'mgm'), $this->name)));
break;
}
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:43,代码来源:mgm_icontact.php
示例6: mgm_box_bottom
?>
</div></p>
</div>
</div>
</div>
<?php
mgm_box_bottom();
?>
<?php
mgm_box_top('Captcha Settings');
?>
<?php
$recaptcha = mgm_get_class('recaptcha');
?>
<div class="table">
<div class="row">
<div class="cell width25">
<p><b><?php
_e('reCaptcha Public Key', 'mgm');
?>
:</b></p>
</div>
</div>
<div class="row">
<div class="cell width75">
<p><input type="text" name="recaptcha_public_key" value="<?php
echo esc_html($data['system_obj']->get_setting('recaptcha_public_key'));
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:31,代码来源:general.php
示例7: foreach
?>
';
// bind search field change
jQuery("select[name='search_field_name']").bind('change',function() {
// remove old
jQuery(":input[name='search_field_value']").remove();
// reset val
if(onchange_count > 0) search_val = search_val2 = '';
// on val
switch(jQuery(this).val()){
case 'membership_type':
jQuery('#fld_wrapper_two').html('');
var s=document.createElement('select');
s.name='search_field_value';
<?php
foreach (mgm_get_class('membership_types')->membership_types as $membership_type_value => $membership_type_text) {
?>
s.options[s.options.length]=new Option('<?php
echo $membership_type_text;
?>
','<?php
echo $membership_type_value;
?>
',false,<?php
echo $data['search_field_value'] == $membership_type_value ? 'true' : 'false';
?>
);
<?php
}
?>
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:31,代码来源:search_box.php
示例8: get_pack_desc
/**
* get pack description
*
* @param array $pack
* @return string $desc
*/
function get_pack_desc($pack)
{
// system
$system_obj = mgm_get_class('system');
// format
$date_fmt = mgm_get_date_format('date_format_short');
// tpl data
$tpl_data = array();
// tpl vars
$tpl_vars = array('membership_type', 'cost', 'currency', 'duration', 'duration_period', 'num_cycles', 'trial_cost', 'trial_duration', 'trial_duration_period', 'description', 'currency_sign', 'pack_start_date', 'pack_end_date');
// get template
if (!($pack_desc_template = $system_obj->get_template('pack_desc_template', array(), true))) {
$pack_desc_template = sprintf('[membership_type] - [cost] [currency] %s [duration] [duration_period] [num_cycles].<br/>
[if_trial_on] %s [trial_cost] [currency] %s [trial_duration] [trial_duration_period] [/if_trial_on]', __('per', 'mgm'), __('This pack includes a special, limited trial-offer:', 'mgm'), __('for', 'mgm'));
}
// lifetime template:
if ($pack['duration_type'] == 'l') {
// template -issue #988
if (!($pack_desc_template = $system_obj->get_template('pack_desc_lifetime_template', array(), true))) {
$pack_desc_template = sprintf('[membership_type] - [cost] [currency] %s', __('for Lifetime', 'mgm'));
}
} elseif ($pack['duration_type'] == 'dr') {
$date_range = '';
// check
if (mgm_is_valid_date($pack['duration_range_start_dt'], '-') && mgm_is_valid_date($pack['duration_range_end_dt'], '-')) {
$tpl_data['pack_start_date'] = date($date_fmt, strtotime($pack['duration_range_start_dt']));
$tpl_data['pack_end_date'] = date($date_fmt, strtotime($pack['duration_range_end_dt']));
}
if (!($pack_desc_template = $system_obj->get_template('pack_desc_date_range_template', array(), true))) {
$pack_desc_template = sprintf('[membership_type] - [cost] [currency] starts from [pack_start_date] to [pack_end_date]');
}
}
// currency - issue #1602
if (!isset($pack['currency']) || empty($pack['currency'])) {
$tpl_data['currency'] = $system_obj->get_setting('currency');
} else {
$tpl_data['currency'] = $pack['currency'];
}
// issue #1177
$tpl_data['currency_sign'] = mgm_get_currency_symbols($tpl_data['currency']);
// type
$tpl_data['membership_type'] = mgm_stripslashes_deep(mgm_get_class('membership_types')->get_type_name($pack['membership_type']));
$tpl_data['duration_period'] = strtolower($this->get_pack_duration($pack));
// transalation issue #950
$tpl_data['text_for'] = __('for', 'mgm');
$tpl_data['num_cycles'] = $pack['num_cycles'] == 0 ? __(' - Ongoing', 'mgm') : sprintf(' - %s %d %s', $tpl_data['text_for'], (int) $pack['num_cycles'], $pack['num_cycles'] == 1 ? __('time', 'mgm') : __('times', 'mgm'));
$tpl_data['trial_duration_period'] = strtolower($this->get_pack_duration($pack, true));
// merge rest, overwrite tpl_data
if (is_array($pack)) {
$tpl_data = array_merge($pack, $tpl_data);
}
// remove next lines as preg_replace will fail
$pack_desc_template = str_replace(array("\r\n", "\n", "\r"), '', $pack_desc_template);
// copy template
$pack_desc = $pack_desc_template;
// replace 0 cost
if (isset($tpl_data['cost']) && $tpl_data['cost'] == 0.0) {
$pack_desc = str_replace('[cost] [currency]', __('free', 'mgm'), $pack_desc);
}
// replace 0 trial_cost
if (isset($tpl_data['trial_cost']) && $tpl_data['trial_cost'] == 0.0) {
$pack_desc = str_replace('[trial_cost] [currency]', __('free', 'mgm'), $pack_desc);
}
// replace
foreach ($tpl_vars as $var) {
if (isset($tpl_data[$var])) {
$pack_desc = str_replace('[' . $var . ']', $tpl_data[$var], $pack_desc);
}
}
// num cycles
if ($pack['num_cycles']) {
$pack_desc = preg_replace("'\\[/?\\s?if_num_cycles\\s?\\]'i", '', $pack_desc);
} else {
$pack_desc = preg_replace("'\\[if_num_cycles\\s?\\](.*)\\[/if_num_cycles\\s?\\]'i", '', $pack_desc);
}
// trial on
if (isset($pack['trial_on']) && (int) $pack['trial_on'] == 1) {
$pack_desc = preg_replace("'\\[/?\\s?if_trial_on\\s?\\]'i", '', $pack_desc);
} else {
$pack_desc = preg_replace("'\\[if_trial_on\\s?\\](.*)\\[/if_trial_on\\s?\\]'i", '', $pack_desc);
}
// send
return $pack_desc;
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:90,代码来源:mgm_subscription_packs.php
示例9: 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
//.........这里部分代码省略.........
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:101,代码来源:mgm_theme_functions.php
示例10: mgm_get_class
<?php
/**
* Objects merge/update
* Add New content protection setting: using_the_excerpt_in_theme
* This is to prevent executing content protection callback if the_excerpt is being used in themes
*/
// read
$system_obj = mgm_get_class('system');
// check
if (!isset($system_obj->setting['using_the_excerpt_in_theme'])) {
// default to 'NO'
$system_obj->setting['using_the_excerpt_in_theme'] = 'N';
// save
$system_obj->save();
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:16,代码来源:mgm_object_merge.php
示例11: _default_setting
function _default_setting()
{
// ideal specific
$this->setting['aquirer'] = '';
$this->setting['merchant_id'] = '';
$this->setting['secret_key'] = '';
$this->setting['key_version'] = '1';
$this->setting['sub_id'] = '';
$this->setting['language'] = 'nl';
$this->setting['currency'] = mgm_get_class('system')->setting['currency'];
$this->setting['payment_mean_brand'] = '';
// purchase price
if (in_array('buypost', $this->supported_buttons)) {
$this->setting['purchase_price'] = 4.0;
}
// callback messages
$this->_setup_callback_messages();
// callback urls
$this->_setup_callback_urls();
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:20,代码来源:mgm_ideal.php
示例12: 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)) {
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;
}
}
//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
mgm_notify_admin_membership_cancellation_manual_removal_required($blogname, $user, $member);
}
return true;
}
return false;
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:67,代码来源:mgm_clickbank.php
示例13: recaptcha_check_answer
/**
* Calls an HTTP POST function to verify if the user's guess was correct
* @param string $privkey
* @param string $remoteip
* @param string $challenge
* @param string $response
* @param array $extra_params an array of extra variables to post to the server
* @return ReCaptchaResponse
*/
function recaptcha_check_answer($challenge, $response, $extra_params = array())
{
//system settings
$recaptcha_response = new stdClass();
$recaptcha_response->error = null;
$setting = mgm_get_class('system')->get_setting();
$use_ssl = isset($_SERVER['https']) ? true : false;
$remoteip = mgm_get_client_ip_address();
if (empty($setting['recaptcha_private_key']) || empty($setting['recaptcha_public_key'])) {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = __("reCAPTCHA API keys are blank. ", 'mgm');
return $recaptcha_response;
}
if ($remoteip == null || $remoteip == '') {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = __("For security reasons, you must pass the remote IP to reCAPTCHA", 'mgm');
return $recaptcha_response;
}
//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response->is_valid = false;
$recaptcha_response->error = __('The Captcha String isn\'t correct', 'mgm');
return $recaptcha_response;
}
$response = $this->_recaptcha_http_post($setting['recaptcha_verify_server'], "/recaptcha/api/verify", array('privatekey' => $setting['recaptcha_private_key'], 'remoteip' => $remoteip, 'challenge' => $challenge, 'response' => $response) + $extra_params);
$recaptcha_response->is_valid = $response['status'];
if (isset($response['error'])) {
$recaptcha_response->error = __('The Captcha String isn\'t correct', 'mgm');
}
return $recaptcha_response;
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:40,代码来源:mgm_recaptcha.php
示例14: _default_setting
function _default_setting()
{
// authorize.net specific
$this->setting['secretkey'] = '';
$this->setting['publishable_key'] = '';
$this->setting['currency'] = mgm_get_class('system')->setting['currency'];
// purchase price
if (in_array('buypost', $this->supported_buttons)) {
$this->setting['purchase_price'] = 4.0;
}
// callback messages
$this->_setup_callback_messages();
// callback urls
$this->_setup_callback_urls();
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:15,代码来源:mgm_stripe.php
示例15: sprintf
<div class="cell height10px">
<div class="information"><?php
echo sprintf(__('<a href="%s">Content Protection</a> is <b>%s</b>. Make sure its enabled to Protect Post/Page(s).', 'mgm'), 'javascript:mgm_set_tab_url(2,0)', mgm_protect_content() ? 'enabled' : 'disabled');
?>
</div>
</div>
</div>
<?php
}
?>
<div class="row"> </div>
<div class="row">
<div class="cell height10px">
<input type="checkbox" name="add_private_tags" value="Y" <?php
if (mgm_get_class('system')->setting['add_private_tags'] == "Y") {
echo "checked='checked'";
}
?>
/>
<b><?php
_e('Add Private Tags', 'mgm');
?>
</b>
</div>
</div>
<div class="row">
<div class="cell">
<div class="tips"><?php
_e('Will wrap full page content with [private] [/private] tags', 'mgm');
?>
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:31,代码来源:posts.php
示例16: editor
function editor()
{
global $wpdb;
// init
$data = array();
// hook
$data['download_hook'] = mgm_get_class('system')->get_setting('download_hook', 'download');
// downloads
$data['downloads'] = $wpdb->get_results("SELECT * FROM `" . TBL_MGM_DOWNLOAD . "`");
// load template view
$this->load->template('downloads/editor_list', array('data' => $data));
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:12,代码来源:mgm_admin_downloads.php
示例17: add
/**
* add
*
* @param array $data pack data
* @param array $options
*/
public function add($data, $options = NULL)
{
global $wpdb;
// init
$columns = $tran_data = array();
// payment type
$columns['payment_type'] = isset($data['buypost']) ? 'post_purchase' : 'subscription_purchase';
// user
// IMPORTANT: user_id has to be passed alogn with pack details, otherwise logged in user id
$tran_data['user_id'] = isset($options['user_id']) ? $options['user_id'] : mgm_get_user_id();
// register and purchase, capture post id
if (isset($options['post_id'])) {
$tran_data['post_id'] = (int) $options['post_id'];
}
// register and purchase postpack, capture postpack id & postpack post id
if (isset($options['postpack_id'])) {
$tran_data['postpack_id'] = (int) $options['postpack_id'];
}
if (isset($options['postpack_post_id'])) {
$tran_data['postpack_post_id'] = (int) $options['postpack_post_id'];
}
// subscription option : create|upgrade|downgrade|extend
if ($columns['payment_type'] == 'subscription_purchase') {
// registration flag, @ToDo will use "subscription_option" next onwards
// subscription option
$tran_data['subscription_option'] = isset($options['subscription_option']) ? $options['subscription_option'] : 'create';
// new registration @todo @depracate
$tran_data['is_registration'] = isset($options['is_registration']) ? 'Y' : 'N';
// another subscription purchase flag @todo @depracate
$tran_data['is_another_membership_purchase'] = isset($options['is_another_membership_purchase']) ? 'Y' : 'N';
// another subscription purchase - if upgrade from prev pack
// value should be reset once upgrade member object is replaced @todo @depracate
$tran_data['multiple_upgrade_prev_packid'] = isset($options['multiple_upgrade_prev_packid']) ? $options['multiple_upgrade_prev_packid'] : '';
// registration user email notification flag after user is active - issue #1468
$tran_data['notify_user'] = isset($options['notify_user']) ? $options['notify_user'] : false;
}
// others
// set system currency, will update at module level after module selection
//issue #1602
if (!isset($data['currency']) || empty($data['currency'])) {
$tran_data['currency'] = mgm_get_class('system')->get_setting('currency');
} else {
$tran_data['currency'] = $data['currency'];
}
// ip
$tran_data['client_ip'] = mgm_get_client_ip_address();
// payment email sent flag
$tran_data['payment_email'] = 0;
// merge with data
$tran_data = array_merge($data, $tran_data);
// set data
$columns['data'] = json_encode($tran_data);
// date
$columns['transaction_dt'] = date('Y-m-d H:i:s');
// user id
if (isset($tran_data['user_id']) && (int) $tran_data['user_id'] > 0) {
// add
$columns['user_id'] = $tran_data['user_id'];
}
// insert
$wpdb->insert(TBL_MGM_TRANSACTION, $columns);
// transaction id
$id = $wpdb->insert_id;
// run actions
do_action('mgm_transaction_item_add', $id, $columns['payment_type']);
// global
do_action('mgm_transaction_item_add_' . $columns['payment_type'], $id);
// individual
// return
return $id;
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:77,代码来源:mgm_transactions.php
示例18: _default_setting
/**
* set default settings
*
*/
function _default_setting()
{
// paypalexpress specific
$this->setting['username'] = '';
$this->setting['password'] = '';
$this->setting['signature'] = '';
$this->setting['locale'] = 'US';
$this->setting['currency'] = mgm_get_class('system')->setting['currency'];
//issue #974
$this->setting['max_failed_payments'] = 3;
// purchase price
if (in_array('buypost', $this->supported_buttons)) {
$this->setting['purchase_price'] = 4.0;
}
// callback messages
$this->_setup_callback_messages();
// callback urls
$this->_setup_callback_urls();
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:23,代码来源:mgm_paypalexpresscheckout.php
示例19: mgm_term_delete
/**
* taxonomy/category delete
*
* @param int term_id
* @param int term taxonomy id
* @param string taxonomy
* @return none
*/
function mgm_term_delete($term_id, $tt_id, $taxonomy)
{
// term
switch ($taxonomy) {
case 'category':
// class
$post_category = mgm_get_class('post_category');
// set
$post_category->access_membership_types[$term_id] = $_POST['mgm_category_access'];
// save
$post_category->save();
break;
case 'post_tag':
// nothing for tags
break;
default:
// class
$post_taxonomy = mgm_get_class('post_taxonomy');
// set
$post_taxonomy->access_membership_types[$term_id] = $_POST['mgm_taxonomy_access'];
// save
$post_taxonomy->save();
break;
}
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:33,代码来源:mgm_widget_post_category.php
示例20: mgm_sidebar_widget_text_admin
/**
* text widget : multiple instance
* admin instance
*
* @param array $widget_args
* @return void
* @since 1.0
*/
function mgm_sidebar_widget_text_admin($widget_args = 1)
{
global $wp_registered_widgets, $mgm_sidebar_widget;
static $updated = false;
if (is_numeric($widget_args)) {
$widget_args = array('number' => $widget_args);
}
$widget_args = wp_parse_args($widget_args, array('number' => -1));
extract($widget_args, EXTR_SKIP);
$options = $mgm_sidebar_widget->text_widget;
if (!is_array($options)) {
$options = array();
}
// m_sidebar
$m_sidebar = mgm_post_var('sidebar');
// updated
if (!$updated && !empty($m_sidebar)) {
$sidebar = (string) $m_sidebar;
$sidebars_widgets = wp_get_sidebars_widgets();
if (isset($sidebars_widgets[$sidebar])) {
$this_sidebar =& $sidebars_widgets[$sidebar];
} else {
$this_sidebar = array();
}
foreach ($this_sidebar as $_widget_id) {
// check
if (isset($wp_registered_widgets[$_widget_id]['callback']) && isset($wp_registered_widgets[$_widget_id]['params'][0]['number'])) {
if ('mgm_widget_text' == $wp_registered_widgets[$_widget_id]['callback']) {
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
if (!in_array("text-{$widget_number}", mgm_post_var('widget-id'))) {
// the widget has been removed.
unset($options[$widget_number]);
}
}
}
}
foreach ((array) mgm_post_var('mgm_widget_text') as $widget_number => $mgm_widget_text) {
if (!isset($mgm_widget_text['text']) && isset($options[$widget_number])) {
// user clicked cancel
continue;
}
// title
$title = isset($mgm_widget_text['title']) ? strip_tags(stripslashes($mgm_widget_text['title'])) : '';
// text
if (current_user_can('unfiltered_html')) {
$text = isset($mgm_widget_text['text']) ? stripslashes($mgm_widget_text['text']) : '';
} else {
$text = isset($mgm_widget_text['text']) ? stripslashes(wp_filter_post_kses($mgm_widget_text['text'])) : '';
}
// types
$access_membership_types = isset($mgm_widget_text['access_membership_types']) ? implode('|', $mgm_widget_text['access_membership_types']) : '';
// set
$options[$widget_number] = compact('title', 'text', 'access_membership_types');
}
// set
$mgm_sidebar_widget->text_widget = $options;
// update_option('mgm_sidebar_widget', $mgm_sidebar_widget);
$mgm_sidebar_widget->save();
// updated
$updated = true;
}
// get available membership types
$membership_types = mgm_get_class('membership_types')->membership_types;
// selected
$selected_membership_types = array();
// get selected
if (-1 == $number) {
$number = '%i%';
$title = '';
$text = '';
$selected_membership_types = implode(';', $membership_types);
} else {
$title = esc_attr($options[$number]['title']);
$text = format_to_edit($options[$number]['text']);
if (isset($options[$number]['access_membership_types'])) {
$selected_membership_types = explode('|', $options[$number]['access_membership_types']);
}
}
echo '<p>' . __('Available to', 'mgm') . ':<br />';
foreach ((array) $membership_types as $type_code => $type_name) {
if (is_array($selected_membership_types)) {
$c = in_array($type_code, $selected_membership_types) ? 'checked="checked"' : '';
} else {
$c = '';
}
echo '<input type="checkbox" id="mgm_widget_text_' . $number . '" class="checkbox" name="mgm_widget_text[' . $number . '][access_membership_types][]" value="' . $type_code . '" ' . $c . ' />
<label class="mgm_font_italic" for="' . __($type_code, 'mgm') . '">' . __($type_name, 'mgm') . '</label> ';
}
echo '</p>';
?>
<p>
//.........这里部分代码省略.........
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:101,代码来源:widget_text.php
注:本文中的mgm_get_class函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论