本文整理汇总了PHP中wlm_arrval函数的典型用法代码示例。如果您正苦于以下问题:PHP wlm_arrval函数的具体用法?PHP wlm_arrval怎么用?PHP wlm_arrval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wlm_arrval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recurly
function recurly($that)
{
require_once $that->pluginDir . '/extlib/WP_RecurlyClient.php';
$client = new WP_RecurlyClient($that->GetOption('recurlyapikey'));
if (wlm_arrval($_GET, 'act') == 'reg') {
$plan_code = $_GET['plan_code'];
$account_code = $_GET['account_code'];
$account = $client->get_account($account_code);
$subscriptions = $client->get_subscriptions($account_code);
if (empty($account) || empty($subscriptions)) {
//maybe redirect to cancel url?
return;
}
//check that this subscription is actually in the users subscriptions
$current_subscription = null;
$found = false;
foreach ($subscriptions as $s) {
if ($s['plan_code'] == $plan_code) {
$found = true;
$current_subscription = $s;
}
}
if (!$found) {
//cheatin huh?
return;
}
if ($current_subscription['state'] != 'active') {
return;
}
$plan = $client->get_plan($plan_code);
$_POST['lastname'] = $account['last_name'];
$_POST['firstname'] = $account['first_name'];
$_POST['action'] = 'wpm_register';
$_POST['wpm_id'] = $plan['accounting_code'];
$_POST['username'] = $account['email'];
$_POST['email'] = $account['email'];
$_POST['password1'] = $_POST['password2'] = 'sldkfjsdlkfj';
$_POST['sctxnid'] = $current_subscription['uuid'];
$that->ShoppingCartRegistration();
} else {
$listen = array('canceled_subscription_notification', 'expired_subscription_notification', 'renewed_subscription_notification', 'updated_subscription_notification');
$notif = file_get_contents("php://input");
$type = $client->get_notification_type($notif);
if (in_array($type, $listen)) {
$subscription = $client->get_subscription_from_notif($notif);
$_POST['sctxnid'] = $subscription['uuid'];
if ($subscription['state'] == 'active') {
$that->ShoppingCartReactivate();
} else {
$that->ShoppingCartDeactivate();
}
} else {
//nothing to do
}
}
}
示例2: AuthorizeNet
function AuthorizeNet($that)
{
require_once $that->pluginDir . '/extlib/anet_sdk/AuthorizeNet.php';
define("AUTHORIZENET_API_LOGIN_ID", $that->GetOption('anloginid'));
define("AUTHORIZENET_TRANSACTION_KEY", $that->GetOption('antransid'));
define("AUTHORIZENET_MD5_SETTING", $that->GetOption('anmd5hash'));
$anetsandbox = $that->GetOption('anetsandbox');
$request = new AuthorizeNetTD();
if ((int) $anetsandbox != 1) {
$request->setSandbox(false);
}
$response = $request->getTransactionDetails(wlm_arrval($_GET, 'x_trans_id'));
// Check if transaction response, transaction_id and authCode if present.
if (!isset($response->xml->transaction->responseCode) || !isset($response->xml->transaction->authCode) || !isset($response->xml->transaction->transId)) {
return;
}
// Check if transaction code is approved.
if ($response->xml->transaction->responseCode != 1) {
return;
}
foreach ($response->xml->transaction->lineItems->lineItem as $lineItem) {
$_POST['wpm_id'] = (string) $lineItem->itemId;
}
foreach ($response->xml->transaction->billTo as $billTo) {
$_POST['lastname'] = (string) $billTo->lastName;
$_POST['firstname'] = (string) $billTo->firstName;
$_POST['password1'] = $_POST['password2'] = 'sldkfjsdlkfj';
}
foreach ($response->xml->transaction->customer as $customer) {
$_POST['username'] = (string) $customer->email;
$_POST['email'] = (string) $customer->email;
}
$_POST['action'] = 'wpm_register';
$_POST['sctxnid'] = (string) $response->xml->transaction->transId;
$amount = (string) $response->xml->transaction->authAmount;
$transaction_id = (string) $response->xml->transaction->transId;
$x_md5_hash = (string) $_GET['x_MD5_Hash'];
$amount = isset($amount) ? $amount : "0.00";
// Generate hash for checking with authorize.net submitted hash value.
$generated_hash = strtoupper(md5(AUTHORIZENET_MD5_SETTING . AUTHORIZENET_API_LOGIN_ID . $transaction_id . $amount));
// Let's verify is authorize.net and generate hash is valid.
if ($x_md5_hash === $generated_hash) {
$that->ShoppingCartRegistration();
} else {
$that->ShoppingCartDeactivate();
}
}
示例3: Spreedly
function Spreedly($that)
{
$this->that = $that;
$wlmspreedly = new WLMSpreedly($that);
$wpm_levels = $that->GetOption('wpm_levels');
$current_user = wp_get_current_user();
$spreedly_user = "";
/* LETS END EVERYTHING IF WE CANT CONNECT TO SPREEDLY */
if (!$wlmspreedly->athenticated) {
//
die("Oppss!! Something went wrong.Theres an error connecting to Pin Payments, please try again.");
}
/* REDIRECT AFTER REGISTRATION */
if (isset($_GET['reg_id'])) {
$plan_id = $_GET['reg_id'];
$sku = $wlmspreedly->get_plan_sku($plan_id);
/* Get/Create Spreedly user */
if (array_key_exists($sku, $wpm_levels)) {
//make sure that its a correct membership level id
if ($current_user->ID != 0) {
//make sure that the user is logged in
$wl_user = new WishListMemberUser($current_user->ID);
//get wlm user details
$wl_user_levels = $wl_user->Levels;
//get user levels
//check if he has a for approval membership level using spreedly
if (array_key_exists($sku, $wl_user_levels) && $wl_user_levels[$sku]->Pending == "Pin Payments Confirmation") {
//get user spreedly account
$spreedly_user = $wlmspreedly->get_subscriber($wl_user_levels[$sku]->TxnID);
//if no user, lets create
if (is_null($spreedly_user)) {
$spreedly_user = $wlmspreedly->add_subscriber($wl_user_levels[$sku]->TxnID, $current_user->user_login, $current_user->user_email);
}
}
}
}
/* Now we have our spreedly user account for this member */
if (!is_null($spreedly_user) && isset($spreedly_user->customer_id)) {
$name = explode(" ", $current_user->display_name, 2);
$user_data = array("id" => $spreedly_user->customer_id, "email" => $current_user->user_email, "first_name" => $name[0], "last_name" => $name[1]);
/* Redirect to spreedly payment form */
header('Location:' . $this->generate_subscription_url($wlmspreedly->spreedlyname, $plan_id, $user_data));
exit(0);
}
}
/* REDIRECT AFTER MEMBER PAYS FROM SPREEDLY AND CLICK "CONTINUE" LINK */
if (isset($_GET['sku']) && array_key_exists($_GET['sku'], $wpm_levels)) {
//make sure that its a correct membership level id
if ($current_user->ID != 0) {
//make sure that the user is logged in
//get user membership levels
$wl_user = new WishListMemberUser($current_user->ID);
$wl_user_levels = $wl_user->Levels;
//based on the txnid, get the spreedly user for this member
$user = $wlmspreedly->get_subscriber($wl_user_levels[wlm_arrval($_GET, 'sku')]->TxnID);
if (!is_null($user)) {
$txn_detail = array("txnid" => $wl_user_levels[wlm_arrval($_GET, 'sku')]->TxnID, "user_id" => $current_user->ID, "level_id" => $_GET['sku']);
$this->process_membership($txn_detail, $user);
$afterreg = $this->get_after_reg_url($wpm_levels, $_GET['sku']);
header('Location:' . $afterreg);
exit(0);
}
}
}
/* SPREEDLY NOTIFICATION FOR CHANGES IN USERS AND THERE TRANSACTIONS */
if (isset($_POST['subscriber_ids'])) {
$ids = $_POST['subscriber_ids'];
$ids = explode(",", $ids);
foreach ($ids as $id) {
$user = $wlmspreedly->get_subscriber($id);
$txn_details = $this->get_txn_details($id);
foreach ($txn_details as $txn_detail) {
$this->process_membership($txn_detail, $user);
}
}
}
}
示例4: trim
}
}
// save API Key
if (wlm_arrval($_POST, 'spreedlytoken')) {
$_POST['spreedlytoken'] = trim(wlm_arrval($_POST, 'spreedlytoken'));
$wpmy = trim(preg_replace('/[^A-Za-z0-9]/', '', $_POST['spreedlytoken']));
if ($wpmy == $_POST['spreedlytoken']) {
$this->SaveOption('spreedlytoken', $spreedlytoken = $wpmy);
echo "<div class='updated fade'>" . __('<p>API Token Changed. Make sure that your API Token matches the one specified in your Pin Payments site configuration.</p>', 'wishlist-member') . "</div>";
} else {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Pin Payments API Token may only contain letters and numbers.</p>', 'wishlist-member') . "</div>";
}
}
// save Machine Name
if (wlm_arrval($_POST, 'spreedlyname')) {
$_POST['spreedlyname'] = trim(wlm_arrval($_POST, 'spreedlyname'));
$this->SaveOption('spreedlyname', $_POST['spreedlyname']);
echo "<div class='updated fade'>" . __('<p>Site Name Changed.</p>', 'wishlist-member') . "</div>";
}
$spreedlythankyou_url = $wpm_scregister . $spreedlythankyou;
$spreedlytoken = $this->GetOption('spreedlytoken');
$spreedlyname = $this->GetOption('spreedlyname');
$for_approval_registration = $this->GetOption('wlm_for_approval_registration');
if (!$for_approval_registration) {
$for_approval_registration = array();
} else {
$for_approval_registration = unserialize($for_approval_registration);
}
$regurl = WLMREGISTERURL;
// END Initialization
} else {
示例5: trim
$_POST['genericthankyou'] = trim(wlm_arrval($_POST, 'genericthankyou'));
$wpmx = trim(preg_replace('/[^A-Za-z0-9]/', '', $_POST['genericthankyou']));
if ($wpmx == $_POST['genericthankyou']) {
if ($this->RegURLExists($wpmx, null, 'genericthankyou')) {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Post to URL (' . $wpmx . ') is already in use by a Membership Level or another Shopping Cart. Please try a different one.</p>', 'wishlist-member') . "</div>";
} else {
$this->SaveOption('genericthankyou', $genericthankyou = $wpmx);
echo "<div class='updated fade'>" . __('<p>Post To URL Changed.</p>', 'wishlist-member') . "</div>";
}
} else {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Post To URL may only contain letters and numbers.</p>', 'wishlist-member') . "</div>";
}
}
// save Secret Key
if (wlm_arrval($_POST, 'genericsecret')) {
$_POST['genericsecret'] = trim(wlm_arrval($_POST, 'genericsecret'));
$wpmy = trim(preg_replace('/[^A-Za-z0-9]/', '', $_POST['genericsecret']));
if ($wpmy == $_POST['genericsecret']) {
$this->SaveOption('genericsecret', $genericsecret = $wpmy);
echo "<div class='updated fade'>" . __('<p>Secret Key Changed.</p>', 'wishlist-member') . "</div>";
} else {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Secret key may only contain letters and numbers.</p>', 'wishlist-member') . "</div>";
}
}
$genericthankyou_url = $wpm_scregister . $genericthankyou;
// END Initialization
} else {
// START Interface
?>
<!-- Generic -->
<p><?php
示例6: IsFallBackURL
/**
* Check if the current Registration URL
* is a Fallback URL
*
* A fallback Registration URL allows the user
* to enter the email address he used for payment
* to proceed with his incomplete registration
*
* @param string $reg value of $_GET['reg']
*/
function IsFallBackURL($reg)
{
$reg = explode('/', $reg, 3);
$hash = wlm_arrval($reg, 0);
$time = wlm_arrval($reg, 1);
$fallback = wlm_arrval($reg, 2);
if ($fallback == 'fallback') {
$expire = $time + 3600;
if ($expire > time()) {
if ($hash == md5($_SERVER['REMOTE_ADDR'] . '__' . $time . '__' . $this->GetAPIKey())) {
return true;
}
}
}
return false;
}
示例7: script
GENERAL PROGRAM NOTES: (This script was based on Mike's Autoresponder integrations.)
Purpose: This is the UI part of the code. This is displayed as the admin area for Infusionsoft Integration in WLM Dashboard.
Location: admin/
Calling program : integration.autoresponder.php
Logic Flow:
1. integration.autoresponder.php displays this script (integration.autoresponder.infusionsoft.php)
and displays current or default settings
2. on user update, this script submits value to integration.autoresponder.php, which in turn save the value
3. after saving the values, integration.autoresponder.php call this script again with $wpm_levels contains the membership levels and $data contains the Infusionsoft Integration settings for each membership level.
*/
$__index__ = 'infusionsoft';
$__ar_options__[$__index__] = 'Infusionsoft';
$__ar_videotutorial__[$__index__] = wlm_video_tutorial('integration', 'ar', $__index__);
require_once $this->pluginDir . '/lib/integration.autoresponder.infusionsoft.php';
if ($data['ARProvider'] == $__index__) {
if (wlm_arrval($_POST, 'update_ifauto')) {
$tagsSelections = array();
foreach ((array) $wpm_levels as $sku => $level) {
$n = 'auto_istag_add_app' . $sku;
if (isset($_POST[$n])) {
$tagsSelections[$sku] = $_POST[$n];
}
}
$istags = maybe_serialize($tagsSelections);
$this->SaveOption('auto_istags_add_app', $istags);
$tagsSelections = array();
foreach ((array) $wpm_levels as $sku => $level) {
$n = 'auto_istag_add_rem' . $sku;
if (isset($_POST[$n])) {
$tagsSelections[$sku] = $_POST[$n];
}
示例8: foreach
<?php
if ($this->GetAllSavedSearch()) {
?>
<select style="width: 130px; vertical-align: top;" id="save-search" onchange="top.location = this.value">
<option value="">Saved Searches</option>
<?php
foreach ($this->GetAllSavedSearch() as $value) {
?>
<option value="?page=<?php
echo $this->MenuID;
?>
&wl=members&<?php
echo http_build_query($value['value']);
?>
" <?php
if (wlm_arrval($_GET, 'saved_search') == $value['name']) {
echo " selected='true'";
}
?>
><?php
echo $value['name'];
?>
</option>
<?php
}
?>
</select>
<?php
}
?>
</p>
示例9: isset
} else {
if ($this->GetOption('WLM_BroadcastLog') == 1) {
$log = true;
} else {
$log = false;
}
}
//check if old stat is missing
$isold_missing = $this->IsEmailBroadcastMissingStats();
if ($isold_missing) {
$this->EmailBroadcastSyncStat();
}
//get the number of emails in queue
$email_queue_count = $this->GetEmailBroadcastQueue(null, false, false, 0, true);
/* variables for page numbers */
$pagenum = isset($_GET['pagenum']) ? absint(wlm_arrval($_GET, 'pagenum')) : 0;
if (empty($pagenum)) {
$pagenum = 1;
}
$per_page = 20;
$start = $pagenum == '' || $pagenum < 0 ? 0 : ($pagenum - 1) * $per_page;
$broadcast_emails = $this->GetALLEmailbroadcast(false, $start, $per_page);
$emails_count = $this->GetALLEmailbroadcast(true);
/* Prepare pagination */
$num_pages = ceil($emails_count / $per_page);
$page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $num_pages, 'current' => $pagenum));
?>
<h2>
<?php
_e('Members » Email Broadcast', 'wishlist-member');
?>
示例10: maybe_serialize
}
$istags = maybe_serialize($tagsSelections);
$this->SaveOption('istags_cancelled_app', $istags);
$tagsSelections = array();
foreach ((array) $wpm_levels as $sku => $level) {
$n = 'istag_cancelled_rem' . $sku;
if (isset($_POST[$n])) {
$tagsSelections[$sku] = $_POST[$n];
}
}
$istags = maybe_serialize($tagsSelections);
$this->SaveOption('istags_cancelled_rem', $istags);
echo "<div class='updated fade'>" . __('<p>Membership Level tag settings updated.</p>', 'wishlist-member') . "</div>";
}
//pay per post tag settings
if (wlm_arrval($_POST, 'update_tags_pp')) {
$posts = $this->GetPayPerPosts(array('post_title', 'post_type'), false);
$istagspp_add_app = array();
$istagspp_add_rem = array();
$istagspp_remove_app = array();
$istagspp_remove_rem = array();
foreach ($posts as $post) {
$sku = 'payperpost-' . $post->ID;
$n = 'istagpp_add_app' . $sku;
if (isset($_POST[$n])) {
$istagspp_add_app[$sku] = $_POST[$n];
}
$n = 'istagpp_add_rem' . $sku;
if (isset($_POST[$n])) {
$istagspp_add_rem[$sku] = $_POST[$n];
}
示例11: trim
$_POST['ultracartthankyou'] = trim(wlm_arrval($_POST, 'ultracartthankyou'));
$wpmx = trim(preg_replace('/[^A-Za-z0-9]/', '', $_POST['ultracartthankyou']));
if ($wpmx == $_POST['ultracartthankyou']) {
if ($this->RegURLExists($wpmx, null, 'ultracartthankyou')) {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Post to URL (' . $wpmx . ') is already in use by a Membership Level or another Shopping Cart. Please try a different one.</p>', 'wishlist-member') . "</div>";
} else {
$this->SaveOption('ultracartthankyou', $ultracartthankyou = $wpmx);
echo "<div class='updated fade'>" . __('<p>Post To URL Changed.</p>', 'wishlist-member') . "</div>";
}
} else {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Post To URL may only contain letters and numbers.</p>', 'wishlist-member') . "</div>";
}
}
// save Secret Key
if (wlm_arrval($_POST, 'ultracartsecret')) {
$_POST['ultracartsecret'] = trim(wlm_arrval($_POST, 'ultracartsecret'));
$wpmy = trim(preg_replace('/[^A-Za-z0-9]/', '', $_POST['ultracartsecret']));
if ($wpmy == $_POST['ultracartsecret']) {
$this->SaveOption('ultracartsecret', $ultracartsecret = $wpmy);
echo "<div class='updated fade'>" . __('<p>Secret Key Changed.</p>', 'wishlist-member') . "</div>";
} else {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Secret key may only contain letters and numbers.</p>', 'wishlist-member') . "</div>";
}
}
$ultracartthankyou_url = $wpm_scregister . $ultracartthankyou;
// END Initialization
} else {
// START Interface
?>
<!-- UltraCart -->
<blockquote>
示例12: date
$date = date("F j, Y, h:i:s A");
$logfile = ABSPATH . $icID[$key] . ".txt";
if (file_exists($logfile)) {
$logfilehandler = fopen($logfile, 'a');
} else {
$logfilehandler = fopen($logfile, 'w');
}
if (!$logfilehandler) {
echo "<div class='error fade'>" . __('<p>Error Creating Log File. Please check folder permission or manually create the file ' . ABSPATH . $logfile . '</p>', 'wishlist-member') . "</div>";
} else {
fclose($logfilehandler);
}
}
}
if (isset($_GET['action']) == 'clear' && isset($_GET['level']) != "" && !isset($_POST['update_icontact'])) {
$logfile = ABSPATH . $icID[wlm_arrval($_GET, 'level')] . ".txt";
if (file_exists($logfile)) {
$logfilehandler = fopen($logfile, 'w');
}
if (!$logfilehandler) {
echo "<div class='error fade'>" . __('<p>Error Clearing Log File. Please check folder permission or manually clear the file ' . ABSPATH . $logfile . '</p>', 'wishlist-member') . "</div>";
} else {
echo "<div class='error fade'>" . __('<p>Successfully cleared the file ' . ABSPATH . $logfile . '</p>', 'wishlist-member') . "</div>";
fclose($logfilehandler);
}
}
?>
<form method="post">
<input type="hidden" name="saveAR" value="saveAR" />
<h2 class="wlm-integration-steps"><?php
_e('Step 1. Create your iContact Integration Password', 'wishlist-member');
示例13: OneShoppingCart
function OneShoppingCart($that)
{
if (in_array(strtolower(trim(wlm_arrval($_POST, 'status'))), array('accepted', 'approved', 'authorized', 'pending'))) {
//accept even PENDING, let checkstatus handle it later
// add_filter('rewrite_rules_array',array(&$that,'RewriteRules'));
// $GLOBALS['wp_rewrite']->flush_rules();
if (!trim(wlm_arrval($_POST, 'name'))) {
$_POST['name'] = 'Firstname Lastname';
}
$name = explode(' ', $_POST['name']);
$_POST['lastname'] = array_pop($name);
$_POST['firstname'] = implode(' ', $name);
$_POST['action'] = 'wpm_register';
$_POST['wpm_id'] = $_POST['sku1'];
$_POST['username'] = $_POST['email1'];
$orig_email = $_POST['email'] = $_POST['email1'];
$_POST['password1'] = $_POST['password2'] = $that->PassGen();
$address = array();
$address['company'] = $_POST['shipCompany'];
$address['address1'] = $_POST['shipAddress1'];
$address['address2'] = $_POST['shipAddress2'];
$address['city'] = $_POST['shipCity'];
$address['state'] = $_POST['shipState'];
$address['zip'] = $_POST['shipZip'];
$address['country'] = $_POST['shipCountry'];
$_POST['sctxnid'] = $_POST['orderID'];
$_POST['wpm_useraddress'] = $address;
//cache the order
$onescmerchantid = trim($that->GetOption('onescmerchantid'));
$onescapikey = trim($that->GetOption('onescapikey'));
if ($onescmerchantid && $onescapikey) {
require_once $that->pluginDir . '/extlib/OneShopAPI.php';
require_once $that->pluginDir . '/extlib/WLMOneShopAPI.php';
$api = new WLMOneShopAPI($onescmerchantid, $onescapikey, 'https://www.mcssl.com');
$order = $api->get_order_by_id($_POST['orderID'], true);
$that->SaveOption("1scorder_" . $_POST['orderID'], $order);
}
// support 1SC upsells
if (trim($that->GetOption('onesc_include_upsells'))) {
if (count($order['upsells'])) {
$_POST['additional_levels'] = $order['upsells'];
}
}
$that->ShoppingCartRegistration();
} else {
$onescmerchantid = trim($that->GetOption('onescmerchantid'));
$onescapikey = trim($that->GetOption('onescapikey'));
if ($onescmerchantid && $onescapikey) {
$raw_post_data = file_get_contents('php://input');
require_once $that->pluginDir . '/extlib/OneShopAPI.php';
$API = new OneShopAPI($that->GetOption('onescmerchantid'), $that->GetOption('onescapikey'), 'https://www.mcssl.com');
$requestBodyXML = new DOMDocument();
# Load the request body into XML and check that the result has been parsed into XML
if ($requestBodyXML->loadXML($raw_post_data) == true) {
$notificationType = $requestBodyXML->documentElement->nodeName;
$tokenNode = $requestBodyXML->getElementsByTagName('Token')->item(0)->nodeValue;
switch ($notificationType) {
case "NewOrder":
$apiResult = $API->GetOrderById($tokenNode);
break;
default:
# May have other types of notifications in the future
break;
}
$apiResultXML = new DOMDocument();
if ($apiResultXML->loadXML($apiResult) == true) {
# Check if the API returned an error
$apiSuccess = $apiResultXML->getElementsByTagName('Response')->item(0)->getAttribute('success');
if ($apiSuccess == 'true') {
$orderXML =& $apiResultXML;
$sku = $orderXML->getElementsByTagName('Sku')->item(0)->nodeValue;
$status = strtolower($orderXML->getElementsByTagName('OrderStatusType')->item(0)->nodeValue);
$levels = array_keys($that->GetOption('wpm_levels'));
$_POST['sctxnid'] = $orderXML->getElementsByTagName('OrderId')->item(0)->nodeValue;
if ($status == 'accepted') {
$that->ShoppingCartReactivate();
// Add hook for Shoppingcart reactivate so that other plugins can hook into this
$_POST['sc_type'] = '1ShoppingCart';
do_action('wlm_shoppingcart_rebill', $_POST);
} else {
$that->ShoppingCartDeactivate();
}
}
}
}
}
}
}
示例14: foreach
$this->SaveOption('recurlyapikey', $recurlyapikey);
}
if (wlm_arrval($_POST, 'connections')) {
$connections = $_POST['connections'];
foreach ($connections as $i => $k) {
if (!empty($k) && $recurlyconnections[$i] != $k) {
//changed so re-integrate
$url = $recurlythankyou_url . "?act=reg&account_code={{account_code}}&plan_code={{plan_code}}";
$client->update_plan($k, array('success_url' => $url, 'accounting_code' => $i));
}
}
$recurlyconnections = $connections;
$this->SaveOption('recurlyconnections', $recurlyconnections);
}
if (wlm_arrval($_POST, 'recurlythankyou')) {
$_POST['recurlythankyou'] = trim(wlm_arrval($_POST, 'recurlythankyou'));
$wpmx = trim(preg_replace('/[^A-Za-z0-9]/', '', $_POST['recurlythankyou']));
if ($wpmx == $_POST['recurlythankyou']) {
if ($this->RegURLExists($wpmx, null, 'recurlythankyou')) {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Post to URL (' . $wpmx . ') is already in use by a Membership Level or another Shopping Cart. Please try a different one.</p>', 'wishlist-member') . "</div>";
} else {
$this->SaveOption('recurlythankyou', $recurlythankyou = $wpmx);
echo "<div class='updated fade'>" . __('<p>Post To URL Changed.</p>', 'wishlist-member') . "</div>";
}
} else {
echo "<div class='error fade'>" . __('<p><b>Error:</b> Post To URL may only contain letters and numbers.</p>', 'wishlist-member') . "</div>";
}
}
// END Initialization
} else {
// START Interface
示例15: widget
function widget($args = array(), $instance = array())
{
global $WishListMemberInstance;
// If $instance is false then this means that the widget is being called directly by other functions
// We then set the $instance
$is_active = is_active_widget(false, false, 'wishlistwidget', true);
if (!$instance) {
// If there are active WLM widgets, we get the settings of the first one
if ($is_active) {
$wlm_widget_settings = get_option('widget_wishlistwidget');
foreach ((array) $wlm_widget_settings as $setting) {
$instance['wpm_widget_hiderss'] = $setting['wpm_widget_hiderss'];
$instance['wpm_widget_hideregister'] = $setting['wpm_widget_hideregister'];
$instance['wpm_widget_nologinbox'] = $setting['wpm_widget_nologinbox'];
$instance['wpm_widget_hidelevels'] = $setting['wpm_widget_hidelevels'];
$instance['wpm_widget_fieldwidth'] = $setting['wpm_widget_fieldwidth'];
break;
}
} else {
// If no WLM widget active then set default settings.
$instance['wpm_widget_hiderss'] = 0;
$instance['wpm_widget_hideregister'] = 0;
$instance['wpm_widget_nologinbox'] = 0;
$instance['wpm_widget_hidelevels'] = 0;
$instance['wpm_widget_fieldwidth'] = 0;
}
}
extract($args);
$wpm_levels = $WishListMemberInstance->GetOption('wpm_levels');
$wpm_current_user = wp_get_current_user();
if ($instance['wpm_widget_nologinbox'] != 1 || $wpm_current_user->ID) {
if (!wlm_arrval($_GET, 'reg')) {
$output = '';
if (!$return) {
echo $before_widget . $before_title;
if ($wpm_current_user->ID) {
if (isset($args["title"])) {
echo $args["title"];
} else {
echo $instance['title'];
}
} else {
if (isset($args["title2"])) {
echo $args["title2"];
} else {
echo $instance['title2'];
}
}
echo $after_title;
echo "<div id='wlmember_loginwidget'>";
}
if ($wpm_current_user->ID) {
$name = $wpm_current_user->first_name;
if (!$name) {
$name = $wpm_current_user->user_nicename;
}
if (!$name) {
$name = $wpm_current_user->user_login;
}
$output .= '<p>' . trim(sprintf(__('Welcome %1$s', 'wishlist-member'), $name)) . '</p>';
$levels = $WishListMemberInstance->GetMembershipLevels($wpm_current_user->ID, null, null, null, true);
$inactivelevels = $WishListMemberInstance->GetMemberInactiveLevels($wpm_current_user->ID);
sort($levels);
// <- we sort the levels
if (!$instance['wpm_widget_hidelevels']) {
$clevels = count($levels);
if ($clevels) {
// $output.=__("» Level", "» Levels", $clevels, 'wishlist-member');
if ($clevels == 1) {
$output .= __("» Level", 'wishlist-member');
} else {
$output .= __("» Levels", 'wishlist-member');
}
$output .= ': ';
if ($clevels > 1) {
$output .= '<br /><div id="" style="margin-left:1em">';
}
$morelevels = false;
$maxmorelevels = $return ? 1000000000 : 2;
for ($i = 0; $i < $clevels; $i++) {
if ($i > $maxmorelevels && !$morelevels) {
$output .= '<div id="wlm_morelevels" style="display:none">';
$morelevels = true;
}
if ($clevels > 1) {
$output .= '· ';
}
$strike = '';
if (in_array($levels[$i], $inactivelevels)) {
$output .= '<strike>';
$strike = '</strike>';
}
$output .= $wpm_levels[$levels[$i]]['name'];
$output .= $strike;
$output .= '<br />';
}
if ($morelevels) {
$output .= '</div>';
$output .= '· <label style="cursor:pointer;" onclick="wlmml=document.getElementById(\'wlm_morelevels\');wlmml.style.display=wlmml.style.display==\'none\'?\'block\':\'none\';this.innerHTML=wlmml.style.display==\'none\'?\'' . __('More levels', 'wishlist-member') . ' <small>∇</small>\':\'' . __('Less levels', 'wishlist-member') . ' <small>Δ</small>\';this.blur()">' . __('More levels', 'wishlist-member') . ' <small>∇</small></label>';
}
//.........这里部分代码省略.........