• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CASHSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CASHSystem的典型用法代码示例。如果您正苦于以下问题:PHP CASHSystem类的具体用法?PHP CASHSystem怎么用?PHP CASHSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CASHSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testValidReturn

 function testValidReturn()
 {
     if ($this->cash_test_url) {
         $return = json_decode(CASHSystem::getURLContents(CASH_API_URL . 'verbose/element/getmarkup/100/status_uid/whatever', false, true));
         // test valid JSON:
         $this->assertNotNull($return);
         // make sure all the bits and pieces are in place
         $this->assertTrue(isset($return->status_code));
         $this->assertTrue(isset($return->status_uid));
         $this->assertTrue(isset($return->status_message));
         $this->assertTrue(isset($return->contextual_message));
         $this->assertTrue(isset($return->request_type));
         $this->assertTrue(isset($return->action));
         $this->assertTrue(isset($return->payload));
         $this->assertTrue(isset($return->api_version));
         $this->assertTrue(isset($return->timestamp));
         // test types for the standardized bits, ignore the variable pieces
         $this->assertTrue(is_int($return->status_code));
         $this->assertTrue(is_string($return->status_uid));
         $this->assertTrue(is_string($return->status_message));
         $this->assertTrue(is_string($return->contextual_message));
         $this->assertTrue(is_string($return->request_type));
         $this->assertTrue(is_string($return->action));
         $this->assertTrue(is_int($return->api_version));
         $this->assertTrue(is_int($return->timestamp));
     }
 }
开发者ID:blacktire,项目名称:DIY,代码行数:27,代码来源:300_BasicHTTPAPITests.php


示例2: getData

 public function getData()
 {
     if ($this->options['skip_login']) {
         $show_final_message = true;
     } else {
         $show_final_message = false;
         $this->element_data['browserid_js'] = CASHSystem::getBrowserIdJS($this->element_id);
         if ($this->status_uid == 'people_signintolist_200') {
             $show_final_message = true;
         } elseif ($this->status_uid == 'people_signintolist_400') {
             // sign-in failed, try element-specific password and check that the
             // address is for realy realz on the list
             if (trim($this->original_request['password']) == trim($this->options['alternate_password'])) {
                 $status_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getaddresslistinfo', 'address' => $this->original_request['address'], 'list_id' => $this->options['email_list_id']));
                 if ($status_request->response['payload']) {
                     $show_final_message = true;
                 }
             }
         }
     }
     if ($show_final_message) {
         if ($this->options['asset_id'] != 0) {
             // first we "unlock" the asset, telling the platform it's okay to generate a link for non-private assets
             $unlock_request = new CASHRequest(array('cash_request_type' => 'asset', 'cash_action' => 'unlock', 'id' => $this->options['asset_id']));
             // next we make the link
             $asset_request = new CASHRequest(array('cash_request_type' => 'asset', 'cash_action' => 'getasset', 'id' => $this->options['asset_id']));
             $this->element_data['asset_title'] = $asset_request->response['payload']['title'];
             $this->element_data['asset_description'] = $asset_request->response['payload']['description'];
         }
         $this->setTemplate('success');
     }
     return $this->element_data;
 }
开发者ID:blacktire,项目名称:DIY,代码行数:33,代码来源:SecureDownload.php


示例3: getMarkup

 public function getMarkup()
 {
     // define $markup to store all screen output
     $markup = '';
     // the default form and basic elements:
     $default_markup = '<form id="cash_' . self::type . '_form_' . $this->element_id . '" class="cash_form ' . self::type . '" method="post" action="">';
     if ($this->options->display_title) {
         $default_markup .= '<h2 class="cash_title">' . $this->options->display_title . '</h2>';
     }
     if ($this->options->display_message) {
         $default_markup .= '<p class="cash_message">' . $this->options->display_message . '</p>';
     }
     $default_markup .= '' . '<div class="cash_address_container"><label for="address">Email</label>' . '<input type="email" name="address"  placeholder="Your Email Address" value="" class="cash_input cash_input_address" /></div>' . '<div class="cash_password_container"><label for="password">Password</label>' . '<input type="password" name="password" value="" class="cash_input cash_input_password" /></div>' . '<div class="cash_hidden"><input type="hidden" name="cash_request_type" value="people" />' . '<input type="hidden" name="cash_action" value="signintolist" />' . '<input type="hidden" name="list_id" value="' . $this->options->email_list_id . '" class="cash_input cash_input_list_id" />' . '<input type="hidden" name="element_id" value="' . $this->element_id . '" class="cash_input cash_input_element_id" />' . '<input type="hidden" id="browseridassertion_' . $this->element_id . '" name="browseridassertion" value="" class="cash_input cash_input_element_id" /></div>' . '<input type="submit" value="log in" class="button" /> <span class="cash_divider_text"> - or - </span> <a href="javascript:void(0)" id="browserid_login_link_' . $this->element_id . '"><img src="' . CASH_PUBLIC_URL . 'assets/images/browserid.png" alt="log in with browser id" class="cash_browserid_button" /></a>' . '</form>';
     $default_markup .= CASHSystem::getBrowserIdJS($this->element_id);
     switch ($this->status_uid) {
         case 'people_signintolist_400':
             // error, likely in the email format. error message + default form
             $markup = '<div class="cash_error ' . self::type . '">' . 'We could not verify your login. Please try again.' . '</div>' . $default_markup;
             break;
         case 'empty':
             $markup = '';
             break;
         default:
             // default form
             $markup = $default_markup;
     }
     return $markup;
 }
开发者ID:nodots,项目名称:DIY,代码行数:28,代码来源:SignIn.php


示例4: postToPaypal

 protected function postToPaypal($method_name, $nvp_parameters)
 {
     // Set the API operation, version, and API signature in the request.
     $request_parameters = array('METHOD' => $method_name, 'VERSION' => $this->api_version, 'PWD' => $this->api_password, 'USER' => $this->api_username, 'SIGNATURE' => $this->api_signature);
     $request_parameters = array_merge($request_parameters, $nvp_parameters);
     // Get response from the server.
     $http_response = CASHSystem::getURLContents($this->api_endpoint, $request_parameters, true);
     if ($http_response) {
         // Extract the response details.
         $http_response = explode("&", $http_response);
         $parsed_response = array();
         foreach ($http_response as $i => $value) {
             $tmpAr = explode("=", $value);
             if (sizeof($tmpAr) > 1) {
                 $parsed_response[$tmpAr[0]] = urldecode($tmpAr[1]);
             }
         }
         if (0 == sizeof($parsed_response) || !array_key_exists('ACK', $parsed_response)) {
             $this->setErrorMessage("Invalid HTTP Response for POST (" . $nvpreq . ") to " . $this->api_endpoint);
             return false;
         }
         if ("SUCCESS" == strtoupper($parsed_response["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($parsed_response["ACK"])) {
             return $parsed_response;
         } else {
             $this->setErrorMessage(print_r($parsed_response, true));
             return false;
         }
     } else {
         $this->setErrorMessage('could not reach Paypal servers');
         return false;
     }
 }
开发者ID:blacktire,项目名称:DIY,代码行数:32,代码来源:PaypalSeed.php


示例5: prepMarkup

	public function prepMarkup($post) {
		if ($post->type == 'regular') {
			$textbody = '';
			$textbodyarray = explode('.',strip_tags($post->{'regular-body'}));
			if (count($textbodyarray) > 3) {
				$textbodyarray = array_slice($textbodyarray,0,3);
			}
			$textbody = implode('.',$textbodyarray) . '...';

			$innermarkup = "<div class=\"cashmusic_social cashmusic_tumblr\">"
			. '<h2><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . $post->{$post->type . '-title'} . '</a></h2><div>' . $textbody . '</div><div class="cashmusic_social_date"><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . CASHSystem::formatAgo($post->{'unix-timestamp'}) . ' / tumblr</a> </div>'
			. '<div style="clear:both;overflow:hidden;visibility:hidden;height:1px;">.</div></div>';
		} else if ($post->type == 'photo') {
			$innermarkup = "<div class=\"cashmusic_social cashmusic_tumblr\">"
			. '<div><img src="' . $post->{'photo-url-500'} . '" width="100%" alt="" /><br />' . $post->{'photo-caption'} . '</div><div class="cashmusic_social_date"><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . CASHSystem::formatAgo($post->{'unix-timestamp'}) . ' / tumblr</a> </div>'
			. '<div style="clear:both;overflow:hidden;visibility:hidden;height:1px;">.</div></div>';
		} else if ($post->type == 'video') {
			$innermarkup = "<div class=\"cashmusic_social cashmusic_tumblr\">"
			. '<div><div class="cashmusic_social_video_container">' . $post->{'video-player'} . '</div><br />' . $post->{'video-caption'} . '</div><div class="cashmusic_social_date"><a href="' . $post->{'url-with-slug'} . '" target="_blank">' . CASHSystem::formatAgo($post->{'unix-timestamp'}) . ' / tumblr</a> </div>'
			. '<div style="clear:both;overflow:hidden;visibility:hidden;height:1px;">.</div></div>';
		}
		/*
		The CSS to go along with the video container:
		
		Thanks to http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
		
		echo '<style type="text/css">';
		echo '.cashmusic_video_container {position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}';
		echo '.cashmusic_video_container iframe, .cashmusic_video_container object, .cashmusic_video_container embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
		echo '</style>';
		*/
	}
开发者ID:GabeGibitz,项目名称:DIY,代码行数:32,代码来源:TumblrSeed.php


示例6: prepMarkup

	public function prepMarkup($tweet) {
		$tmp_profile_img = $tweet->user->profile_image_url;
		if ($tmp_profile_img == 'http://static.twitter.com/images/default_profile_normal.png') {
			$tmp_profile_img = 'http://a2.twimg.com/sticky/default_profile_images/default_profile_' . rand(0, 6) . '_normal.png';
		}
		$innermarkup = "<div class=\"cashmusic_social cashmusic_twitter\"><img src=\"$tmp_profile_img\" class=\"cashmusic_twitter_avatar\" alt=\"avatar\" />"
		. "<div class=\"cashmusic_twitter_namespc\"><a href=\"http://twitter.com/" . $tweet->user->screen_name . "\">@" . $tweet->user->screen_name . "</a><br />" . $tweet->user->name . "</div><div class=\"cashmusic_clearall\">.</div>"
		. "<div class=\"tweet\">" . $tweet->text . '<div class="cashmusic_social_date"><a href="http://twitter.com/#!/' . $tweet->user->screen_name . '/status/' . $tweet->id_str . '" target="_blank">' . CASHSystem::formatAgo($tweet->created_at) . ' / twitter</a> </div></div>';
		/*
		The CSS to go along with the twitter markup:
		
		From our stuff up on http://marketairglovamusic.com/
		
		.cashmusic_social {margin:10px 0 20px 0;padding:15px;background-color:#fff;border-top-left-radius:5px 5px;border-top-right-radius:5px 5px;border-bottom-right-radius:5px 5px;border-bottom-left-radius:5px 5px;}
		.cashmusic_social a {color:#cdcdcd;}
		.cashmusic_twitter {font:14.5px/1.75em georgia,'times new roman',times,serif;}
		.cashmusic_twitter_avatar {float:left;margin:1px 8px 8px 0;}
		.cashmusic_twitter_namespc {color:#cdcdcd;font:11px/1.5em helvetica,"helvetica neue",arial,sans-serif;}
		.cashmusic_twitter_namespc a {color:#007e3d;font:bold 15px/1.85em helvetica,"helvetica neue",arial,sans-serif;}
		.cashmusic_twitter a {color:#007e3d;}
		.cashmusic_tumblr h2, .cashmusic_tumblr h2 a, #topmenu * a, h2 {color:#111;font:28px/1em 'IM Fell English',georgia,'times new roman',times,serif;}
		.cashmusic_social_date {margin-top:10px;color:#cdcdcd;font:11px/1.75em helvetica,"helvetica neue",arial,sans-serif;}
		.cashmusic_clearall {clear:both;height:1px;overflow:hidden;visibility:hidden;}
		*/
	}
开发者ID:GabeGibitz,项目名称:DIY,代码行数:25,代码来源:TwitterSeed.php


示例7: testURLsAndContent

 function testURLsAndContent()
 {
     if ($this->s3_key) {
         $s3 = new S3Seed($this->cash_user_id, $this->s3_connection_id);
         // check for the timestamp in the public link for the public test file
         $test_content = CASHSystem::getURLContents('http://' . $this->s3_bucket . '.s3.amazonaws.com/' . 'test' . $this->timestamp);
         $this->assertPattern('/' . $this->timestamp . '/', $test_content);
         // and in the private link generated for the private test file
         $test_content = CASHSystem::getURLContents($s3->getExpiryURL('test_private' . $this->timestamp, 20));
         $this->assertPattern('/' . $this->timestamp . '/', $test_content);
         // now test headers -- relies on fopen wrappers
         if (ini_get('allow_url_fopen')) {
             // first defaults, both present:
             file_get_contents($s3->getExpiryURL('test_private' . $this->timestamp, 20));
             $this->assertTrue(array_search('Content-Disposition: attachment', $http_response_header));
             $this->assertTrue(array_search('Cache-Control: no-cache', $http_response_header));
             // no-cache only:
             file_get_contents($s3->getExpiryURL('test_private' . $this->timestamp, 20, false, true));
             $this->assertFalse(array_search('Content-Disposition: attachment', $http_response_header));
             $this->assertTrue(array_search('Cache-Control: no-cache', $http_response_header));
             // attachment only:
             file_get_contents($s3->getExpiryURL('test_private' . $this->timestamp, 20, true, false));
             $this->assertTrue(array_search('Content-Disposition: attachment', $http_response_header));
             $this->assertFalse(array_search('Cache-Control: no-cache', $http_response_header));
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:27,代码来源:103_S3Seed.php


示例8: cashmusic_shortcode

 function cashmusic_shortcode($attributes)
 {
     extract(shortcode_atts(array('element' => false, 'name' => false), $attributes));
     if ($element) {
         CASHSystem::embedElement($element);
     } else {
         echo '<!-- CASH Music error: no such element found -->';
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:9,代码来源:cashmusic.php


示例9: getData

 public function getData()
 {
     // define $markup to store all screen output
     $item_request = new CASHRequest(array('cash_request_type' => 'commerce', 'cash_action' => 'getitem', 'id' => $this->options['item_id']));
     $item = $item_request->response['payload'];
     $this->element_data['item_name'] = $item['name'];
     $this->element_data['item_price'] = number_format($item['price'], 2, '.', '');
     $this->element_data['item_flexible_price'] = $item['flexible_price'];
     $this->element_data['item_description'] = $item['description'];
     $this->element_data['item_asset'] = $item['fulfillment_asset'];
     if ($item['available_units'] != 0) {
         $this->element_data['is_available'] = true;
     } else {
         $this->element_data['is_available'] = false;
     }
     $currency_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'getsettings', 'type' => 'use_currency', 'user_id' => $this->element_data['user_id']));
     if ($currency_request->response['payload']) {
         $this->element_data['currency'] = CASHSystem::getCurrencySymbol($currency_request->response['payload']);
     } else {
         $this->element_data['currency'] = CASHSystem::getCurrencySymbol('USD');
     }
     if ($this->status_uid == 'commerce_finalizepayment_200' || $this->status_uid == 'element_redeemcode_200' || $this->status_uid == 'commerce_initiatecheckout_200' && $this->original_response['payload'] == 'force_success') {
         if ($item['fulfillment_asset'] != 0) {
             $fulfillment_request = new CASHRequest(array('cash_request_type' => 'asset', 'cash_action' => 'getfulfillmentassets', 'asset_details' => $item['fulfillment_asset']));
             if ($fulfillment_request->response['payload']) {
                 $this->element_data['fulfillment_assets'] = new ArrayIterator($fulfillment_request->response['payload']);
             }
         }
         $this->setTemplate('success');
     } elseif ($this->status_uid == 'commerce_initiatecheckout_400') {
         // could happen on a database glitch, but probably means the user set a pay-minimum price below the
         // minimum price. what a heel.
         $this->element_data['error_message'] = 'Make sure you enter a price of at least ' . $this->element_data['currency'] . $item['price'] . ' and try again.';
     } elseif ($this->status_uid == 'commerce_finalizepayment_400' || $this->status_uid == 'element_redeemcode_400') {
         // payerid is specific to paypal, so this is temporary to tell between canceled and errored:
         if (isset($_GET['PayerID'])) {
             //$this->element_data['error_message'] = $this->options['message_error'];
             $this->element_data['error_message'] = print_r($this->original_response, true);
         }
     } elseif (isset($_POST['singlepurchase1'])) {
         $total_price = $item['price'];
         if (isset($_POST['total_price'])) {
             $total_price = $_POST['total_price'];
         }
         $this->element_data['total_price'] = $total_price;
         if ($this->element_data['region1_cost'] + $this->element_data['region2_cost'] == 0.0) {
             $this->element_data['no_shipping'] = true;
         }
         if ($total_price >= $item['price']) {
             $this->setTemplate('shipping');
         } else {
             $this->element_data['error_message'] = 'Make sure you enter a price of at least ' . $this->element_data['currency'] . $item['price'] . ' and try again.';
         }
     }
     return $this->element_data;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:56,代码来源:SinglePurchase.php


示例10: getData

 public function getData()
 {
     if ($this->unlocked || $this->hide) {
         $this->setTemplate('empty');
     } else {
         if ($this->status_uid == 'people_signintolist_400') {
             $this->element_data['error_message'] = 'Could not verify your login. Please try again.';
         }
         $this->element_data['browserid_js'] = CASHSystem::getBrowserIdJS($this->element_id);
     }
     return $this->element_data;
 }
开发者ID:blacktire,项目名称:DIY,代码行数:12,代码来源:SignIn.php


示例11: getData

 public function getData()
 {
     switch ($this->status_uid) {
         case 'people_signup_200' || 'people_verifyaddress_200':
             // successful submit, return messaging and optionally an asset link
             $show_final_message = true;
             if ($this->status_uid == 'people_signup_200' && !$this->options['do_not_verify']) {
                 // if this is a first submit and we're verifying the email, first check to see if it's been verified already
                 $verification_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'checkverification', 'address' => $this->original_response['payload']['address'], 'list_id' => $this->options['email_list_id']));
                 if (!$verification_request->response['payload']) {
                     // not verified, so do not show the final message, and instead give a "you must verify" jam
                     $show_final_message = false;
                     $this->setTemplate('mustverify');
                 }
             }
             if ($show_final_message) {
                 $all_friends = array($this->original_request['friend1'], $this->original_request['friend2'], $this->original_request['friend3']);
                 if (!empty($this->original_request['main_name'])) {
                     $from_name = $this->original_request['main_name'];
                 } else {
                     $from_name = $this->original_request['address'];
                 }
                 if (!empty($this->options['email_html_message'])) {
                     $html_message = str_replace('</body>', '<br /><br /><br /><small>This e-card was sent from <a href="' . CASHSystem::getCurrentURL() . '">' . CASHSystem::getCurrentURL() . '</a></small></body>', $this->options['email_html_message']);
                 } else {
                     $html_message = false;
                 }
                 foreach ($all_friends as $friend) {
                     if (filter_var($friend, FILTER_VALIDATE_EMAIL)) {
                         CASHSystem::sendEmail(trim($this->options['email_subject']) . ' ' . $from_name, CASHSystem::getDefaultEmail(), $friend, $this->options['email_message'] . "\n\n\nThis e-card was sent from " . CASHSystem::getCurrentURL(), '', $html_message);
                     }
                 }
                 if ($this->options['asset_id'] != 0) {
                     // first we "unlock" the asset, telling the platform it's okay to generate a link for non-private assets
                     $unlock_request = new CASHRequest(array('cash_request_type' => 'asset', 'cash_action' => 'unlock', 'id' => $this->options['asset_id']));
                     // next we make the link
                     $asset_request = new CASHRequest(array('cash_request_type' => 'asset', 'cash_action' => 'getasset', 'id' => $this->options['asset_id']));
                     $this->element_data['asset_title'] = $asset_request->response['payload']['title'];
                     $this->element_data['asset_description'] = $asset_request->response['payload']['description'];
                 }
                 $this->setTemplate('success');
             }
             break;
         case 'people_signup_400':
             // error, likely in the email format. error message + default form
             $this->element_data['error_message'] = $this->options['message_invalid_email'];
             break;
     }
     return $this->element_data;
 }
开发者ID:blacktire,项目名称:DIY,代码行数:50,代码来源:ECard.php


示例12: getAPIDetails

 /**
  * Returns the (best guess at) APE URL
  * fix that typo. I refuse. It's too funny.
  *
  * @return array
  */
 public static function getAPIDetails()
 {
     if (!defined('STDIN')) {
         // check for command line
         $api_url = 'http' . (empty($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] != 443 ? '' : 's') . '://' . $_SERVER['HTTP_HOST'] . str_replace('/admin', '/api', ADMIN_WWW_BASE_PATH);
         $api_response = json_decode(CASHSystem::getURLContents($api_url));
         if ($api_response->greeting == 'hi.') {
             return array('api_url' => $api_url, 'api_version' => $api_response->api_version);
         } else {
             return false;
         }
         return $api_url;
     } else {
         return false;
     }
 }
开发者ID:nodots,项目名称:DIY,代码行数:22,代码来源:AdminHelper.php


示例13: __construct

 public function __construct($effective_user_id = false, $primary_request = false)
 {
     $this->platform_type = CASHSystem::getSystemSettings('instancetype');
     if (!$this->platform_type) {
         $this->platform_type = 'single';
     }
     $this->stored_responses = array();
     $this->stored_data = array();
     $this->page_data = array();
     if ($effective_user_id) {
         $this->effective_user_id = $effective_user_id;
     }
     if ($primary_request) {
         $this->primary_request = $primary_request;
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:16,代码来源:AdminCore.php


示例14: getTumblrFeed

 public function getTumblrFeed($tumblr_domain, $start_at = 0, $tagged = false, $post_types = false)
 {
     if ($tumblr_domain) {
         $default_post_types = array('regular' => true, 'link' => true, 'quote' => false, 'photo' => true, 'conversation' => false, 'video' => true, 'audio' => true, 'answer' => false);
         if (is_array($post_types)) {
             $final_post_types = array_merge($default_post_types, $post_types);
         } else {
             $final_post_types = $default_post_types;
         }
         $tumblr_domain = str_replace(array('http://', '/'), '', $tumblr_domain);
         $tumblr_url = 'http://' . $tumblr_domain . '/api/read/json?start=' . $start_at . '&num=30';
         if ($tagged) {
             $tumblr_url .= '&tagged=' . urlencode($tagged);
         }
         $feed_data = $this->getCachedURL('com.tumblr', 'domain_' . str_replace('.', '', $tumblr_domain) . $start_at, $tumblr_url, 'raw', false);
         if ($feed_data) {
             // tumblr's funny, JSONP only, so we cache its return and strip of some extra
             $feed_data = str_replace('var tumblr_api_read = ', '', $feed_data);
             // strip off the variable declaration
             $feed_data = substr($feed_data, 0, strlen($feed_data) - 2);
             // and the trailing semicolon+newline
             // decode the trimmed content, then return just the posts
             $feed_data = json_decode($feed_data);
             $feed_data = $feed_data->posts;
             // make a dummy array to save final posts
             $final_feed_data = array();
             // loop through all the posts, filter by type
             foreach ($feed_data as $post) {
                 if ($final_post_types[$post->type]) {
                     $post->formatted_date = CASHSystem::formatTimeAgo($post->{'unix-timestamp'});
                     $final_feed_data[] = $post;
                 }
             }
             $feed_data = $final_feed_data;
         }
         return $feed_data;
     } else {
         return false;
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:40,代码来源:TumblrSeed.php


示例15: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (isset($data['error'])) {
         return 'There was an error. (general) Please try again.';
     } else {
         $connections = CASHSystem::getSystemSettings('system_connections');
         require_once CASH_PLATFORM_ROOT . '/lib/oauth2/OAuth2Client.php';
         require_once CASH_PLATFORM_ROOT . '/lib/oauth2/OAuth2Exception.php';
         require_once CASH_PLATFORM_ROOT . '/lib/mailchimp/MC_OAuth2Client.php';
         $oauth_options = array('redirect_uri' => $connections['com.mailchimp']['redirect_uri'], 'client_id' => $connections['com.mailchimp']['client_id'], 'client_secret' => $connections['com.mailchimp']['client_secret'], 'code' => $data['code']);
         $client = new MC_OAuth2Client($oauth_options);
         $session = $client->getSession();
         if ($session) {
             require_once CASH_PLATFORM_ROOT . '/lib/mailchimp/MailChimp.class.php';
             $cn = new MC_OAuth2Client($oauth_options);
             $cn->setSession($session, false);
             $odata = $cn->api('metadata', 'GET');
             $access_token = $session['access_token'];
             $api_key = $session['access_token'] . '-' . $odata['dc'];
             $api = new MailChimp($api_key);
             $lists = $api->call('lists/list');
             $return_markup = '<h4>Connect to MailChimp</h4>' . '<p>Now just choose a list and save the connection.</p>' . '<form accept-charset="UTF-8" method="post" action="">' . '<input type="hidden" name="dosettingsadd" value="makeitso" />' . '<input id="connection_name_input" type="hidden" name="settings_name" value="(MailChimp list)" />' . '<input type="hidden" name="settings_type" value="com.mailchimp" />' . '<input type="hidden" name="key" value="' . $api_key . '" />' . '<label for="list">Choose a list to connect to:</label>' . '<select id="list_select" name="list">';
             $selected = ' selected="selected"';
             $list_name = false;
             foreach ($lists['data'] as $list) {
                 if ($selected) {
                     $list_name = $list['name'];
                 }
                 $return_markup .= '<option value="' . $list['id'] . '"' . $selected . '>' . $list['name'] . '</option>';
                 $selected = false;
             }
             $return_markup .= '</select><br /><br />' . '<div><input class="button" type="submit" value="Add The Connection" /></div>' . '</form>' . '<script type="text/javascript">' . '$("#connection_name_input").val("' . $list_name . ' (MailChimp)");' . '$("#list_select").change(function() {' . '	var newvalue = this.options[this.selectedIndex].text + " (MailChimp)";' . '	$("#connection_name_input").val(newvalue);' . '});' . '</script>';
             return $return_markup;
         } else {
             return 'There was an error. (session) Please try again.';
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:38,代码来源:MailchimpSeed.php


示例16: testWhatever

 function testWhatever()
 {
     $request = new CASHRequest();
     // test script-scope sesstion values:
     $value = $request->sessionGet('foobar', 'script');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz', 'script');
     $value = $request->sessionGet('foobar', 'script');
     $this->assertEqual($value, 'baz');
     $request->sessionClear('foobar', 'script');
     $value = $request->sessionGet('foobar', 'script');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz', 'script');
     $request->sessionClearAll();
     $value = $request->sessionGet('foobar', 'script');
     $this->assertFalse($value);
     // test persistent-scope sesstion values:
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz');
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
     // fail without startSession()
     $session = CASHSystem::startSession();
     $this->assertTrue($session);
     echo 'Session started: ' . json_encode($session) . "\n";
     $request->sessionSet('foobar', 'baz');
     $value = $request->sessionGet('foobar');
     $this->assertEqual($value, 'baz');
     $request->sessionClear('foobar');
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz');
     $request->sessionClearAll();
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:37,代码来源:006_CASHData.php


示例17: header

 ***************************************************************************************************/
if (strrpos($_SERVER['REQUEST_URI'], 'controller.php') !== false) {
    header('Location: ./');
    exit;
}
/***************************************************************************************************
 *
 * INCLUDES AND STARTUP
 *
 ***************************************************************************************************/
require_once __DIR__ . '/constants.php';
// instead of the previous require_once(CASH_PLATFORM_PATH) call, we manually
// load CASHSystem and set admin_primary_cash_request to the first CASHRequest set
include_once dirname(CASH_PLATFORM_PATH) . '/classes/core/CASHSystem.php';
include_once dirname(CASH_PLATFORM_PATH) . '/lib/mustache/Mustache.php';
$admin_primary_cash_request = CASHSystem::startUp(true);
// admin-specific autoloader
function cash_admin_autoloadCore($classname)
{
    $file = ADMIN_BASE_PATH . '/classes/' . $classname . '.php';
    if (file_exists($file)) {
        require_once $file;
    }
}
spl_autoload_register('cash_admin_autoloadCore');
// make an object to use throughout the pages
$cash_admin = new AdminCore($admin_primary_cash_request->sessionGet('cash_effective_user'), $admin_primary_cash_request);
$cash_admin->mustache_groomer = new Mustache();
$cash_admin->page_data['www_path'] = ADMIN_WWW_BASE_PATH;
$cash_admin->page_data['public_url'] = CASH_PUBLIC_URL;
$cash_admin->page_data['platform_version'] = CASHRequest::$version;
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:controller.php


示例18: testProcessWebhooks

 function testProcessWebhooks()
 {
     $time = time();
     // only run if key / list have been set properly
     if ($this->api_key && $this->api_list_id) {
         $data_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'getapicredentials', 'user_id' => $this->cash_user_id));
         $api_credentials = $data_request->response['payload'];
         // valid API url, but likely localhost
         $webhook_api_url = CASH_API_URL . '/verbose/people/processwebhook/origin/com.mailchimp/list_id/' . $this->test_list_id . '/api_key/' . $api_credentials['api_key'];
         // make sure we're rejecting bad keys
         $bad_webhook_api_url = CASH_API_URL . '/verbose/people/processwebhook/origin/com.mailchimp/list_id/' . $this->test_list_id . '/api_key/incorrect';
         $response = json_decode(CASHSystem::getURLContents($bad_webhook_api_url, array('sample' => 'data'), true));
         // TODO: this is currently returning 400, we need to get that to 403, but we'll test for not-200
         //       which at least proves we're not accepting bad keys
         $this->assertNotEqual($response->status_code, 200);
         $test_address = 'dev+shouldnotsubscribe' . $time . '@cashmusic.org';
         $add_post_data = array("type" => "subscribe", "fired_at" => "2009-03-26 21:35:57", "data" => array("id" => "8a25ff1d98", "list_id" => "a6b5da1054", "email" => $test_address, "email_type" => "html", "merges" => null, "ip_opt" => "10.20.10.30", "ip_signup" => "10.20.10.30"));
         CASHSystem::getURLContents($webhook_api_url, $add_post_data, true);
         $list_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getaddresslistinfo', 'list_id' => $this->test_list_id, 'address' => $test_address));
         // make sure that the address has been added to the local list
         $this->assertTrue($list_request->response['payload']);
         $remove_post_data = array("type" => "unsubscribe", "fired_at" => "2009-03-26 21:36:52", "data" => array("id" => "8a25ff1d98", "action" => "unsub", "reason" => "manual", "list_id" => "a6b5da1054", "email" => $test_address, "email_type" => "html", "merges" => null, "ip_opt" => "10.20.10.30", "ip_signup" => "10.20.10.30"));
         CASHSystem::getURLContents($webhook_api_url, $remove_post_data, true);
         $list_request = new CASHRequest(array('cash_request_type' => 'people', 'cash_action' => 'getaddresslistinfo', 'list_id' => $this->test_list_id, 'address' => $test_address));
         // now make sure that the address has been removed
         $this->assertEqual($list_request->response['payload']['active'], 0);
     }
 }
开发者ID:umamiMike,项目名称:platform,代码行数:28,代码来源:101_MailchimpSeed.php


示例19: array_merge

// parsing posted data:
if (isset($_POST['docampaignedit'])) {
    // do the actual list add stuffs...
    $edit_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'editcampaign', 'id' => $request_parameters[0], 'title' => $_POST['campaign_title'], 'description' => $_POST['campaign_description']));
    if ($edit_response['status_uid'] == 'element_editcampaign_200') {
        AdminHelper::formSuccess('Success. Edited.', '/');
    } else {
        AdminHelper::formFailure('Error. There was a problem editing your campaign.', '/');
    }
}
$current_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getcampaign', 'id' => $request_parameters[0]));
$cash_admin->page_data['ui_title'] = 'Campaigns: Edit "' . $current_response['payload']['title'] . '"';
$current_campaign = $current_response['payload'];
if (is_array($current_campaign)) {
    $cash_admin->page_data = array_merge($cash_admin->page_data, $current_campaign);
}
$cash_admin->page_data['form_state_action'] = 'docampaignedit';
$cash_admin->page_data['button_text'] = 'Save changes';
$elements_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getelementsforcampaign', 'id' => $request_parameters[0]));
if (is_array($elements_response['payload'])) {
    foreach ($elements_response['payload'] as &$element) {
        if  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CATSUtility类代码示例发布时间:2022-05-23
下一篇:
PHP C类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap