本文整理匯總了PHP中mgm_get_class函數的典型用法代碼示例。如果您正苦於以下問題:PHP mgm_get_class函數的具體用法?PHP mgm_get_class怎麽用?PHP mgm_get_class使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mgm_get_class函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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));
}
示例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));
}
示例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));
}
示例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();
}
示例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;
}
}
示例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'));
示例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
}
?>
示例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;
}
示例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
//.........這裏部分代碼省略.........
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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');
?>