本文整理汇总了PHP中storeAddress函数的典型用法代码示例。如果您正苦于以下问题:PHP storeAddress函数的具体用法?PHP storeAddress怎么用?PHP storeAddress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了storeAddress函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_var
/**
IMPORTANT :
- Change mailcimp API Key and List ID by your own
- Change message from user email recipient by your own
*/
/*
*Handle Email Subscription Form, Use GET instead of POST since Internet Explorer makes restriction on POST request
*/
// check email into post data
if (isset($_GET['submit_email'])) {
// $email = $_GET['email'];
$email = filter_var(@$_GET['email'], FILTER_SANITIZE_EMAIL);
if (!isset($response['error']) || $response['error'] === '') {
// Store email address
// $response = $this->storeAddress($email);
$response = storeAddress($email);
}
echo json_encode($response);
}
/**
* store address to mailchimp mailing list
* IMPORTANT :
- Replace 'YOUR_APIKEY_HERE' by your api key from your mailchimp
Get one here http://admin.mailchimp.com/account/api/
- Replace 'YOUR_LISTID_HERE' by your list's unique ID
Create a list here http://admin.mailchimp.com/lists/
Then Click the "settings" link for the list - the Unique Id is at the bottom of that page.
*/
function storeAddress($user_email)
{
$m_response = array();
示例2: get_post_meta
?>
</p>
<p><?php
echo get_post_meta($post->ID, 'sm_form_content', true);
?>
</p>
</div>
</div>
<div id='sm_form_wrapper'>
<?php
echo get_post_meta($post->ID, 'ssm_select_data_save_method', true);
?>
<p>
<input type='email' id='sm_email' class='sm_field' name='sm_email' placeholder='Enter Your Email Address...' required >
<input type="submit" name="submit" value="<?php
echo get_post_meta($post->ID, 'sm_form_cta_text', true);
?>
" class="sm_submit" id='sm_submit' />
</p>
</form>
<span id="response">
<?php
require_once 'inc/store-address.php';
if ($_GET['submit']) {
echo storeAddress();
}
?>
</span>
</div>
</div>
示例3: widget
function widget($args, $instance)
{
extract($args);
$title = $instance['title'];
$newsletter_service = $instance['service'];
$mailchimp_key = $instance['mailchimp_key'];
$mailchimp_list = $instance['mailchimp_list'];
$sendloop_username = $instance['sendloop_user'];
$sendloop_list = $instance['sendloop_list'];
$newsletter_text = $instance['newsletter_text'];
?>
<?php
echo $before_widget;
?>
<?php
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<?php
if (!empty($newsletter_service)) {
?>
<div class="bg-newsletter-top left"></div>
<div class="newsletter left">
<?php
if (!empty($newsletter_text)) {
?>
<span><?php
echo $newsletter_text;
?>
</span><?php
}
?>
<?php
if ($newsletter_service == 'Sendloop') {
?>
<div class="bg-newsletter-input">
<form action="http://<?php
echo $sendloop_username;
?>
.sendloop.com/subscribe.php" method="post">
<div class="searchform-left left"></div>
<input type="text" name="FormValue_Fields[EmailAddress]" value="" id="FormValue_EmailAddress" class="newsletter_email input-newsletter" src="style/img/menu-contact.png"/>
<input type="submit" name="FormButton_Subscribe" value="" id="FormButton_Subscribe" class="newsletter_button submit-newsletter"/>
<input type="hidden" name="FormValue_ListID" value="<?php
echo $sendloop_list;
?>
" id="FormValue_ListID" />
<input type="hidden" name="FormValue_Command" value="Subscriber.Add" id="FormValue_Command" />
<div class="searchform-right right"></div>
</form>
<div class="border-down-widget left" style="height:2px"></div>
</div><!-- bg-newsletter-input -->
<?php
} elseif ($newsletter_service == 'MailChimp') {
?>
<form id="signup" action="<?php
echo $_SERVER['PHP_SELF'];
?>
" method="get">
<div class="bg-newsletter-input">
<div class="searchform-left left">
<input type="text" name="email" id="email" class="input-newsletter"/>
<input type="hidden" name="_mailchimp_key" id="_mailchimp_key" value="<?php
echo $mailchimp_key;
?>
"/>
<input type="hidden" name="_mailchimp_list" id="_mailchimp_list" value="<?php
echo $mailchimp_list;
?>
"/>
<input type="submit" src="" name="submit" value="" class="btn submit-newsletter" alt="Submit" />
<input type="text" style="display: none" value="<?php
echo get_template_directory_uri() . '/script/mailchimp/inc/store-address.php';
?>
" name="hidden_path" class="hidden_path">
<div class="clear"></div>
<div class="searchform-right right"></div>
</div>
</div>
<div id="response">
<?php
get_template_part('/script/mailchimp/inc/store-address.php');
if (isset($_GET['submit'])) {
echo storeAddress();
}
?>
</div>
</form>
<script type="text/javascript" src="<?php
echo get_template_directory_uri() . '/script/mailchimp/js/mailing-list.js';
?>
"></script>
//.........这里部分代码省略.........
示例4: storeAddress
function storeAddress($apikey, $listid)
{
// $your_apikey = '78a6118343c6bf1cdade80bb4162e0b3-us9';
// $my_list_unique_id = "e5cd1cb09f";
$your_apikey = $apikey;
$my_list_unique_id = $listid;
// Validation
if (!$_GET['email']) {
return "No email address provided";
}
if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\$/i", $_GET['email'])) {
return "Email address is invalid!";
}
require_once 'MCAPI.class.php';
// grab an API Key from http://admin.mailchimp.com/account/api/
$api = new MCAPI($your_apikey);
// grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
// Click the "settings" link for the list - the Unique Id is at the bottom of that page.
$list_id = $my_list_unique_id;
if ($api->listSubscribe($list_id, $_GET['email'], '') === true) {
// It worked!
return 'Success! Check your email to confirm.';
} else {
// An error ocurred, return error message
return 'Error: ' . $api->errorMessage;
}
}
// If being called via ajax, autorun the function
if (isset($_GET['ajax'])) {
echo storeAddress($_GET['apikey'], $_GET['listid']);
}
示例5: widget
function widget($args, $instance)
{
extract($args);
$title = $instance['title'];
$newsletter_service = $instance['service'];
$mailchimp_key = $instance['mailchimp_key'];
$mailchimp_list = $instance['mailchimp_list'];
$newsletter_text = $instance['newsletter_text'];
$madmimi_signup = $instance['madmimi_user'];
?>
<?php
echo $before_widget;
?>
<?php
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<?php
if (!empty($newsletter_service)) {
?>
<div class="newsleter-widget">
<?php
if (!empty($newsletter_text)) {
?>
<p><?php
echo $newsletter_text;
?>
</p><?php
}
?>
<div id="newsleter-form-footer">
<?php
if ($newsletter_service == 'MadMimi') {
?>
<form action="https://madmimi.com/signups/subscribe/<?php
echo $madmimi_signup;
?>
" method="post" id="mad_mimi_signup_form" target="_blank" onsubmit="return MadMimiNewsletter()">
<div class="newsletter">
<input id="signup_email" name="signup[email]" type="text" placeholder="" data-invalid-message="This field is invalid" onfocus="if(value==defaultValue)value=''" onblur="if(value=='')value=defaultValue" class="required newsletter_email input-newsletter" value="Enter your email...">
<input id="webform_submit_button" value="<?php
_e('', 'tkingdom');
?>
" type="submit" class="submit newsletter_button btn submit-newsletter" data-default-text="" data-submitting-text="" data-invalid-text="">
<div class="mimi_field_feedback tk_newsletter_response"></div><span class="mimi_funk"></span>
</div>
</form>
<?php
} elseif ($newsletter_service == 'MailChimp') {
?>
<form id="signup" action="<?php
echo $_SERVER['PHP_SELF'];
?>
" method="get">
<div class="newsletter">
<input type="text" name="email" id="email" class="input-newsletter" onfocus="if(value==defaultValue)value=''" onblur="if(value=='')value=defaultValue" value="Enter your email..."/>
<input type="hidden" name="_mailchimp_key" id="_mailchimp_key" value="<?php
echo $mailchimp_key;
?>
"/>
<input type="hidden" name="_mailchimp_list" id="_mailchimp_list" value="<?php
echo $mailchimp_list;
?>
"/>
<input type="submit" src="" name="submit" value="<?php
_e('', 'tkingdom');
?>
" class="btn submit-newsletter" alt="Submit" />
<input type="text" style="display: none" value="<?php
echo get_template_directory_uri() . '/script/mailchimp/inc/store-address.php';
?>
" name="hidden_path" class="hidden_path">
<div class="clear"></div>
<label for="email" id="address-label">
<span id="response">
<?php
get_template_part('/script/mailchimp/inc/store-address.php');
if (isset($_GET['submit'])) {
echo storeAddress();
}
?>
</span>
</label>
</div>
</form>
<script type="text/javascript" src="<?php
echo get_template_directory_uri() . '/script/mailchimp/js/mailing-list.js';
?>
"></script>
<?php
}
?>
</div>
</div>
//.........这里部分代码省略.........
示例6: require_once
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Ajax Mailing List Sign Up System</title>
<link type="text/css" rel="stylesheet" href="css/default.css" />
</head>
<body>
<p id="description">Monthly news and updates plus discounts on all our products.</p>
<form id="signup" action="<?php
echo $_SERVER['PHP_SELF'];
?>
" method="get">
<fieldset>
<legend>Join Our Mailing List</legend>
<label for="email" id="address-label">Email Address
<span id="response">
<? require_once('inc/store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?>
</span>
</label>
<input type="text" name="email" id="email" />
<input type="image" src="i/join.jpg" name="submit" value="Join" class="btn" alt="Join" />
<div id="no-spam">We'll never spam or give this address away</div>
</fieldset>
</form>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/mailing-list.js"></script>
</body>
</html>