public function testToArrayDisposed() { $xs = $this->createHotObservable([onNext(110, 1), onNext(220, 2), onNext(330, 3), onNext(440, 4), onNext(550, 5)]); $results = $this->scheduler->startWithCreate(function () use($xs) { return $xs->toArray(); }); $this->assertMessages([], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions()); }
/** * @test */ public function it_passes_on_completed_from_sources() { $ys = $this->createHotObservable(array(onCompleted(250))); $results = $this->scheduler->startWithCreate(function () use($ys) { return Observable::mergeAll($ys); }); $this->assertMessages(array(onCompleted(250)), $results->getMessages()); $this->assertSubscriptions(array(subscribe(200, 250)), $ys->getSubscriptions()); }
/** * @test */ public function subscribeOn_never() { $xs = $this->createHotObservable([onNext(150, 1)]); $results = $this->scheduler->startWithCreate(function () use($xs) { return $xs->subscribeOn($this->scheduler); }); $this->assertMessages([], $results->getMessages()); $this->assertSubscriptions([subscribe(201, 1001)], $xs->getSubscriptions()); }
/** * @test */ public function pluck_array_numeric_index() { $xs = $this->createHotObservable([onNext(180, [-1, -1, -1, -1]), onNext(210, [4, 3, 2, 1]), onNext(240, [4, 3, 20, 10]), onNext(290, [4, 3, 200, 100]), onNext(350, [4, 3, 2000, 1000]), onCompleted(400)]); $results = $this->scheduler->startWithCreate(function () use($xs) { return $xs->pluck(2); }); $this->assertMessages([onNext(210, 2), onNext(240, 20), onNext(290, 200), onNext(350, 2000), onCompleted(400)], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 400)], $xs->getSubscriptions()); }
/** * @test */ public function it_passes_the_last_on_complete() { $xs = $this->createColdObservable(array(onNext(100, 4), onNext(200, 2), onNext(300, 3), onNext(400, 1), onCompleted(500))); $ys = $this->createColdObservable(array(onNext(50, 'foo'), onNext(100, 'bar'), onNext(150, 'baz'), onNext(200, 'qux'), onCompleted(250))); $results = $this->scheduler->startWithCreate(function () use($xs, $ys) { return $xs->merge($ys); }); $this->assertMessages(array(onNext(250, 'foo'), onNext(300, 4), onNext(300, 'bar'), onNext(350, 'baz'), onNext(400, 2), onNext(400, 'qux'), onNext(500, 3), onNext(600, 1), onCompleted(700)), $results->getMessages()); $this->assertSubscriptions(array(subscribe(200, 700)), $xs->getSubscriptions()); $this->assertSubscriptions(array(subscribe(200, 450)), $ys->getSubscriptions()); }
/** * @test */ public function flatMapTo_it_passes_on_error() { $xs = $this->createColdObservable(array(onNext(100, 4), onNext(200, 2), onNext(300, 3), onNext(400, 1), onCompleted(510))); $ys = $this->createColdObservable(array(onNext(50, 'foo'), onNext(100, 'bar'), onNext(150, 'baz'), onError(210, new Exception()), onCompleted(250))); $results = $this->scheduler->startWithCreate(function () use($xs, $ys) { return $xs->flatMapTo($ys); }); $this->assertMessages(array(onNext(350, "foo"), onNext(400, "bar"), onNext(450, "baz"), onNext(450, "foo"), onNext(500, "bar"), onError(510, new Exception())), $results->getMessages()); $this->assertSubscriptions(array(subscribe(200, 510)), $xs->getSubscriptions()); $this->assertSubscriptions(array(subscribe(300, 510), subscribe(400, 510), subscribe(500, 510)), $ys->getSubscriptions()); }
function charges_AfterInsert() { //charges_AfterInsert @4-B46BA208 //Custom Code @13-2A29BDB7 global $now; global $EP; global $regcharges; global $Tpl; subscribe(CCGetUserID(), $_REQUEST["id"], $this->charge->DBValue); mailout("NewSubscribe", $now["notifyads"], CCGetUserID(), 1000000000, time(), $EP); //End Custom Code }
/** * @test */ public function defaultIfEmpty_empty_2() { $xs = $this->createHotObservable([onCompleted(420)]); $results = $this->scheduler->startWithCreate(function () use($xs) { return $xs->defaultIfEmpty(new ReturnObservable(-1)); }); // Note: these tests differ from the RxJS tests that they were based on because RxJS was // explicitly using the immediate scheduler on subscribe internally. When we pass the // proper scheduler in, the subscription gets scheduled which requires an extra tick. $this->assertMessages([onNext(421, -1), onCompleted(421)], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 420)], $xs->getSubscriptions()); }
function doit() { global $HTTP_POST_VARS, $mytrail, $auth, $sess; if (get_notification_method($auth->auth['uname'], $mytrail['id']) != -1) { change_subscription($auth->auth['uname'], $mytrail['id'], $newn); } else { subscribe($auth->auth['uname'], $mytrail['id'], $newn); } $str = ""; if ($HTTP_POST_VARS['reloadparent'] == "1") { $str = "?reloadparent=1"; } header("Location: " . $sess->url($mytrail['path'] . $str)); }
/** * @test */ public function defer_dispose() { $invoked = 0; $xs = null; $results = $this->scheduler->startWithCreate(function () use(&$invoked, &$xs) { return Observable::defer(function () use(&$invoked, &$xs) { $invoked++; $xs = $this->createColdObservable([onNext(100, $this->scheduler->getClock()), onNext(200, $invoked), onNext(1100, 1000)]); return $xs; }); }); $this->assertMessages([onNext(300, 200), onNext(400, 1)], $results->getMessages()); $this->assertEquals(1, $invoked); $this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions()); }
/** * response all msg * @param $postObj * @return string */ function response($postObj) { $log = new Logs(); $return = ''; $msgType = $postObj->MsgType; $logmsg = '[user] ' . $postObj->FromUserName . ' [msg-type] ' . $msgType; switch ($msgType) { case MSGTYPE_EVENT: $logmsg .= ' [event] ' . $postObj->Event; switch ($postObj->Event) { case 'subscribe': //关注 $return = subscribe($postObj); break; case 'unsubscribe': unsubscribe($postObj); break; case 'CLICK': switch ($postObj->EventKey) { case 'MENU_NEWS': $return = news($postObj); break; } } break; case MSGTYPE_TEXT: //txt $logmsg .= ' [content] ' . $postObj->Content; $return = textResponse($postObj); break; default: $return = news($postObj); break; } if (!$log->write_log($logmsg, 'access')) { if (DEBUG) { echo 'error: ' . $log->error; } } return $return; }
/** * @test */ public function min_some_dispose() { $error = new \Exception(); $xs = $this->createHotObservable([onNext(150, 'z'), onNext(210, 'b'), onNext(220, 'c'), onNext(230, 'a')]); $results = $this->scheduler->startWithDispose(function () use($xs, $error) { return $xs->min(); }, 400); $this->assertMessages([], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 400)], $xs->getSubscriptions()); }
{ BoincSubscription::delete($user->id, $thread->id); if (!BoincSubscription::lookup($user->id, $thread->id)) { page_head(tra("Unsubscription successful")); show_forum_header($user); show_title($forum, $thread); echo "<p>" . tra("You are no longer subscribed to %1. You will no longer receive notifications for this thread.", "<b>" . cleanup_title($thread->title) . "</b>"); } else { page_head(tra("Unsubscription failed")); echo "<p>" . tra("We are currently unable to unsubscribe you from %1. Please try again later..", "<b>" . cleanup_title($thread->title) . "</b>"); } echo "</p><p><br /><a href=\"forum_thread.php?id=" . $thread->id . "\">" . tra("Return to thread") . "</a></p>"; page_tail(); } if (!$thread || !$action) { error_page(tra("Unknown subscription action")); } $user = get_logged_in_user(); check_tokens($user->authenticator); if ($action == "subscribe") { subscribe($forum, $thread, $user); exit; } else { if ($action == "unsubscribe") { unsubscribe($forum, $thread, $user); exit; } } ?>
/** * @test */ public function partitionDisposed() { $xs = $this->createHotObservable([onNext(180, 5), onNext(210, 4), onNext(240, 3), onNext(290, 2), onNext(350, 1), onCompleted(360)]); $observables = null; $s1 = null; $s2 = null; $r1 = $this->scheduler->createObserver(); $r2 = $this->scheduler->createObserver(); $this->scheduler->scheduleAbsolute(TestScheduler::CREATED, function () use(&$observables, $xs) { $observables = $xs->partition([$this, 'isEven']); }); $this->scheduler->scheduleAbsolute(TestScheduler::SUBSCRIBED, function () use(&$observables, &$s1, &$s2, $r1, $r2) { $s1 = $observables[0]->subscribe($r1); $s2 = $observables[1]->subscribe($r2); }); $this->scheduler->scheduleAbsolute(280, function () use(&$s1, &$s2) { $s1->dispose(); $s2->dispose(); }); $this->scheduler->start(); $this->assertMessages([onNext(210, 4)], $r1->getMessages()); $this->assertMessages([onNext(240, 3)], $r2->getMessages()); $this->assertSubscriptions([subscribe(200, 280), subscribe(200, 280)], $xs->getSubscriptions()); }
function addToTestAdminQueue($uid, $pid) { if (!canTestAdminPuzzle($uid, $pid)) { return FALSE; } $sql = sprintf("INSERT INTO testAdminQueue (uid, pid) VALUES ('%s', '%s')", mysql_real_escape_string($uid), mysql_real_escape_string($pid)); query_db($sql); // Subscribe testadmins to comments on their puzzles subscribe($uid, $pid); }
} else { $query = "insert into charges (`charge`, `user_id`, `cause`, `date`) values ('" . $payment_gross . "', '" . mysql_escape_string($buyer_id) . "', 'Payment made for Item Number {$ItemNum}', '" . time() . "')"; $sum->query($query); $query = "insert into charges (`charge`, `user_id`, `cause`, `date`) values ('-" . $payment_gross . "', '" . mysql_escape_string($buyer_id) . "', 'Payment used to start Item Number {$ItemNum}', '" . time() . "')"; $sum->query($query); startlistingnow($ItemNum, $buyer_id); } } elseif ($lookdb->f("amt_due") > $payment_gross) { $query = "insert into charges (`charge`, `user_id`, `cause`, `date`) values ('" . $payment_gross . "', '" . mysql_escape_string($buyer_id) . "', 'Payment for Item Number {$ItemNum} :: Error - The Amount Paid Was Less Than The Amount Due - Amount paid has been added to your account, but your listing has not been started', '" . time() . "')"; $sum->query($query); $failed = "Error: The Amount Paid Was Less Than The Amount Due - Amount paid has been added to your account, but your listing has not been started"; } } } } elseif (ltrim(end(explode("-", $item_name))) == "Subscription") { subscribe($payer_id, $item_number, $payment_gross); if ($payer_id) { $lookdb->query("SELECT * FROM users WHERE user_id='" . $payer_id . "'"); if ($lookdb->next_record()) { $ld = array("first" => $lookdb->f("first_name"), "last" => $lookdb->f("last_name"), "user_login" => $lookdb->f("user_login"), "email" => $lookdb->f("email"), "address" => $lookdb->f("address1"), "address2" => $lookdb->f("address2"), "state" => $lookdb->f("state_id"), "zip" => $lookdb->f("zip"), "city" => $lookdb->f("city"), "phonedy" => $lookdb->f("phone_day"), "phoneevn" => $lookdb->f("phone_evn"), "fax" => $lookdb->f("fax"), "ip" => $lookdb->f("ip_insert"), "date_created" => $lookdb->f("date_created")); } } $EP["EMAIL:PAYMENT_SUBJECT"] = "PayPal Subscription"; $EP["EMAIL:PAYMENT_AMOUNT"] = $charges["currency"] . $payment_gross; $EP["EMAIL:PAYER_EMAIL"] = $payer_email; $EP["EMAIL:CURRENT_USERNAME"] = $ld["user_login"]; $EP["EMAIL:CURRENT_USERID"] = $ld["ID"]; $EP["EMAIL:CURRENT_USER_FIRST_NAME"] = $ld["first"]; $EP["EMAIL:CURRENT_USER_LAST_NAME"] = $ld["last"]; $EP["EMAIL:CURRENT_USER_EMAIL"] = $ld["email"]; $EP["EMAIL:CURRENT_USER_ADDRESS"] = $ld["address"];
//the minimum required fields $usage = array("AccountId" => $newAccountId, "Quantity" => 5, "StartDateTime" => '2010-04-08T12:22:22', "UOM" => 'Each'); $result = uploadUsages($instance, array($usage)); print "\nUsage Created: " . $result->result->Id; print "\n-------------------------------------------------------------------------------"; print "\nUSE CASE #10:QUERY PRODUCT CATALOG"; print "\n-------------------------------------------------------------------------------"; $query = "SELECT Id, Name FROM Product"; $records = queryAll($instance, $query); print "\nAll Product count:" . count($records); print "\n-------------------------------------------------------------------------------"; print "\nUSE CASE #11:GENERATE INVOICE"; print "\n-------------------------------------------------------------------------------"; # GENERATE & QUERY & POST INVOICE print "\nGenerating Invoice..."; $result = subscribe($instance, $ProductRatePlan, false, false); $success = $result->result->Success; $accountId = $success ? $result->result->AccountId : ""; if ($accountId) { $invoiceDate = date('Y-m-d\\TH:i:s'); $targetDate = date('Y-m-d\\TH:i:s', strtotime('+2 month', strtotime($invoiceDate))); $result = generateInvoice($instance, $accountId, $invoiceDate, $targetDate); $success = $result->result->Success; $msg = $success ? $result->result->Id : $result->result->Errors->Code . " (" . $result->result->Errors->Message . ")"; print "\nInvoice Created: " . $msg . "\n"; if ($success) { # QUERY Invoice $query = "SELECT Id, InvoiceNumber,Status FROM Invoice WHERE id = '" . $result->result->Id . "'"; $records = queryAll($instance, $query); print "\nInvoice Queried ({$query}): " . $records[0]->InvoiceNumber . " " . $records[0]->Status . "\n"; # POST Invoice
/** * @test */ public function timeout_timeout_does_not_occur() { $xs = $this->createHotObservable([onNext(70, 1), onNext(130, 2), onNext(240, 3), onNext(320, 4), onNext(410, 5), onCompleted(500)]); $ys = $this->createColdObservable([onNext(50, -1), onNext(200, -2), onNext(310, -3), onCompleted(320)]); $results = $this->scheduler->startWithCreate(function () use($xs, $ys) { return $xs->timeout(100, $ys); }); $this->assertMessages([onNext(240, 3), onNext(320, 4), onNext(410, 5), onCompleted(500)], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 500)], $xs->getSubscriptions()); $this->assertSubscriptions([], $ys->getSubscriptions()); }
/** * @test */ public function connectable_observable_multiple_non_overlapped_connections() { $xs = $this->createHotObservable([onNext(210, 1), onNext(220, 2), onNext(230, 3), onNext(240, 4), onNext(250, 5), onNext(260, 6), onNext(270, 7), onNext(280, 8), onNext(290, 9), onCompleted(300)]); $subject = new TestSubject(); $conn = $xs->multicast($subject); $c1 = null; $this->scheduler->scheduleAbsolute(225, function () use(&$c1, $conn) { $c1 = $conn->connect(); }); $this->scheduler->scheduleAbsolute(241, function () use(&$c1) { $c1->dispose(); }); $this->scheduler->scheduleAbsolute(245, function () use(&$c1) { $c1->dispose(); }); // idempotency test $this->scheduler->scheduleAbsolute(251, function () use(&$c1) { $c1->dispose(); }); // idempotency test $this->scheduler->scheduleAbsolute(260, function () use(&$c1) { $c1->dispose(); }); // idempotency test $c2 = null; $this->scheduler->scheduleAbsolute(249, function () use(&$c2, $conn) { $c2 = $conn->connect(); }); $this->scheduler->scheduleAbsolute(255, function () use(&$c2) { $c2->dispose(); }); $this->scheduler->scheduleAbsolute(265, function () use(&$c2) { $c2->dispose(); }); // idempotency test $this->scheduler->scheduleAbsolute(280, function () use(&$c2) { $c2->dispose(); }); // idempotency test $c3 = null; $this->scheduler->scheduleAbsolute(275, function () use(&$c3, $conn) { $c3 = $conn->connect(); }); $this->scheduler->scheduleAbsolute(295, function () use(&$c3) { $c3->dispose(); }); $results = $this->scheduler->startWithCreate(function () use($xs, $conn) { return $conn; }); $this->assertMessages([onNext(230, 3), onNext(240, 4), onNext(250, 5), onNext(280, 8), onNext(290, 9)], $results->getMessages()); $this->assertSubscriptions([subscribe(225, 241), subscribe(249, 255), subscribe(275, 295)], $xs->getSubscriptions()); }
function groupDispatch($op) { if (isset($_POST['undo'])) { $op = 'groups'; } if (isset($_POST['cancelselector'])) { $op = 'groups'; } if (isset($_POST['okselector'])) { $op = 'savemembers'; } switch ($op) { case "groups": groups(); break; case "subscribe": subscribe(); break; case "savemembers": savemembers(); break; case "editgroup": editgroup(); break; case "savegroup": savegroup(); break; case "delgroup": delgroup(); break; } }
/** * @test */ public function throttle_noisy_observable_drops_items() { $xs = $this->createHotObservable([onNext(150, 1), onNext(250, 2), onNext(251, 3), onNext(252, 4), onNext(253, 5), onNext(254, 6), onNext(255, 7), onNext(256, 8), onNext(257, 9), onNext(550, 10), onNext(850, 11)]); $results = $this->scheduler->startWithCreate(function () use($xs) { return $xs->throttle(200); }); $this->assertMessages([onNext(250, 2), onNext(450, 9), onNext(650, 10), onNext(850, 11)], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions()); }
function manageSubscriptions($focus) { //Process Subscription Lists first //compare current list of subscriptions to original list and see if there are any additions $orig_subscription_arr = array(); $curr_subscription_arr = array(); //build array of original subscriptions if (isset($_REQUEST['orig_enabled_values']) && !empty($_REQUEST['orig_enabled_values'])) { $orig_subscription_arr = explode(",", $_REQUEST['orig_enabled_values']); $orig_subscription_arr = process_subscriptions($orig_subscription_arr); } //build array of current subscriptions if (isset($_REQUEST['enabled_subs']) && !empty($_REQUEST['enabled_subs'])) { $curr_subscription_arr = explode(",", $_REQUEST['enabled_subs']); $curr_subscription_arr = process_subscriptions($curr_subscription_arr); } //compare both arrays and find differences $i = 0; while ($i < count($curr_subscription_arr) / 2) { //if current subscription existed in original subscription list, do nothing if (in_array($curr_subscription_arr['campaign' . $i], $orig_subscription_arr)) { //nothing to process } else { //current subscription is new, so subscribe subscribe($curr_subscription_arr['campaign' . $i], $curr_subscription_arr['prospect_list' . $i], $focus); } $i = $i + 1; } //Now process UnSubscription Lists first //compare current list of subscriptions to original list and see if there are any additions $orig_unsubscription_arr = array(); $curr_unsubscription_arr = array(); //build array of original subscriptions if (isset($_REQUEST['orig_disabled_values']) && !empty($_REQUEST['orig_disabled_values'])) { $orig_unsubscription_arr = explode(",", $_REQUEST['orig_disabled_values']); $orig_unsubscription_arr = process_subscriptions($orig_unsubscription_arr); } //build array of current subscriptions if (isset($_REQUEST['disabled_subs']) && !empty($_REQUEST['disabled_subs'])) { $curr_unsubscription_arr = explode(",", $_REQUEST['disabled_subs']); $curr_unsubscription_arr = process_subscriptions($curr_unsubscription_arr); } //compare both arrays and find differences $i = 0; while ($i < count($curr_unsubscription_arr) / 2) { //if current subscription existed in original subscription list, do nothing if (in_array($curr_unsubscription_arr['campaign' . $i], $orig_unsubscription_arr)) { //nothing to process } else { //current subscription is new, so subscribe unsubscribe($curr_unsubscription_arr['campaign' . $i], $focus); } $i = $i + 1; } }
/** * * @test */ public function distinct_CustomKey_some_throw() { $error = new \Exception(); $xs = $this->createHotObservable([onNext(280, ['id' => 4]), onNext(300, ['id' => 2]), onNext(350, ['id' => 4]), onNext(380, ['id' => 3]), onNext(400, ['id' => 3]), onCompleted(420)]); $results = $this->scheduler->startWithCreate(function () use($xs, $error) { return $xs->distinctKey(function ($x) use($error) { if ($x['id'] === 3) { throw $error; } return $x['id']; })->map(function ($x) { return $x['id']; }); }); $this->assertMessages([onNext(280, 4), onNext(300, 2), onError(380, $error)], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 380)], $xs->getSubscriptions()); }
function sendAction($mac, $action, $s20Table) { // // Sends an $action (ON=1, OFF = 0) to S20 specified by $mac // It retries until a proper reply is received with the desired // power status // However, we have detected that the reported power status just // after an action fails sometimes, and therefore you should not // use this function alone. Prefer switchAndCheck() below, which // performs a double check of the final state. // subscribe($mac, $s20Table); $msg = ACTION . $mac . TWENTIES; if ($action) { $msg .= ON; } else { $msg .= OFF; } $hexRecMsg = createSocketSendHexMsgWaitReply($mac, $msg, $s20Table); $status = (int) hexdec(substr($hexRecMsg, -2, 2)); }
/*input data action--> subscribe, unsubscribe for unsubsribe--> token(sent to the email), and email_id. for subscribe--> emails_id */ if (isset($_POST['action'])) { switch ($_POST['action']) { case 'unsubscribe': if (isset($_POST['token']) && isset($_POST['email'])) { $return = unsubscribe($_POST['email'], $_POST['token']); echo json_encode($return); } break; case 'subscribe': if (isset($_POST['email'])) { $return = subscribe($_POST['email']); echo json_encode($return); } break; } } function unsubscribe($email, $token) { require_once $_SERVER['DOCUMENT_ROOT'] . '/mailer/application/connect_db.php'; $return = array('status' => 1, 'error' => ''); $object = new connect_db(); $primary_key = 0; if ($object->email_exists($email)) { //echo 'email exists'; $primary_key = $object->get_primarykey($email); } else {
$scripts = getJs($allScripts, ['search' => 1, 'imageSwitch' => 1, 'maps' => 1, 'productMap' => 1], true); require_once APP_PATH . 'model/getAllProperties.php'; require_once APP_PATH . 'model/getSimilarProducts.php'; require_once APP_PATH . 'model/checkIfMailExists.php'; require_once APP_PATH . 'model/subscribe.php'; require_once APP_PATH . 'model/sendSuccessMail.php'; if (isset($_POST['email'], $_POST['zip'], $_POST['register-newsletter'])) { if (!empty($_POST['email']) && !empty($_POST['zip'])) { // trim the mail $mail = trim($_POST['email']); // trim the zip $zip = trim($_POST['zip']); // proof if email already registered $proofedMail = checkIfMailExists($mail, $db); if ($proofedMail == true) { $msg = subscribe($mail, $zip, $db); $send = sendSuccessMail($mail); } else { $error = 'Diese E-Mail wird bereits verwendet!'; } } elseif (empty($_POST['email']) && empty($_POST['zip'])) { $error = 'Bitte prüfen Sie Ihre Eingaben!'; } elseif (empty($_POST['zip'])) { $error = 'Sie haben keine Postleitzahl eingegeben!'; } elseif (empty($_POST['email'])) { $error = 'Sie haben keine E-Mail angegeben!'; } } $product = $products[$detailUrl['existingIndex']]; // Muss nach $products gecalled werden $similar = getSimilarProducts($product['product_id'], $product['category_id'], $product['subcategory_id'], $db);
public function testRetryObservableCompletes() { $xs = $this->createColdObservable([onNext(100, 1), onNext(150, 2), onNext(200, 3), onCompleted(250)]); $results = $this->scheduler->startWithCreate(function () use($xs) { return $xs->retry(3); }); $this->assertMessages([onNext(300, 1), onNext(350, 2), onNext(400, 3), onCompleted(450)], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 450)], $xs->getSubscriptions()); }
/** * @test */ public function publishLast_zip_dispose() { $xs = $this->createHotObservable([onNext(110, 7), onNext(220, 3), onNext(280, 4), onNext(290, 1), onNext(340, 8), onNext(360, 5), onNext(370, 6), onNext(390, 7), onNext(410, 13), onNext(430, 2), onNext(450, 9), onNext(520, 11), onNext(560, 20), onCompleted(600)]); $results = $this->scheduler->startWithDispose(function () use($xs) { return $xs->publishLast(function (Observable $ys) { return $ys->zip([$ys], [$this, 'add']); }); }, 470); $this->assertMessages([], $results->getMessages()); $this->assertSubscriptions([subscribe(200, 470)], $xs->getSubscriptions()); }
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://{$dc}.api.mailchimp.com/3.0/lists/{$list_id}/members/"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0'); curl_setopt($ch, CURLOPT_USERPWD, "user:{$apikey}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data); $result = json_decode(curl_exec($ch)); if ($result->title == "Member Exists" || isset($result->id)) { ?> <h1>Thank you</h1> <a href="a.pdf" class="btn">Download File</a> <style> .btn{ display: inline-block; padding: 10px; border: 1px solid #ccc; background-color: #efefef; text-decoration: none; } </style> <?php } } subscribe($apikey, $email, $dc, $list_id);
function portal_set_newsletters($session, $subscribe_ids, $unsubscribe_ids) { global $beanList, $beanFiles; $error = new SoapError(); if (!portal_validate_authenticated($session)) { $error->set_error('invalid_session'); return array('result_count' => -1, 'entry_list' => array(), 'error' => $error->get_soap_array()); } require_once 'modules/Campaigns/utils.php'; $contact = new Contact(); $contact->retrieve($_SESSION['user_id']); if (!empty($contact->id)) { foreach ($subscribe_ids as $campaign_id) { subscribe($campaign_id, null, $contact, true); } foreach ($unsubscribe_ids as $campaign_id) { unsubscribe($campaign_id, $contact); } } return $error->get_soap_array(); }