コード例 #1
0
ファイル: sendinblue.php プロジェクト: niceit/rockets
        /**
         * Subscribe process
         */
        function subscribe()
        {
            $site_domain = str_replace('https://', '', home_url());
            $site_domain = str_replace('http://', '', $site_domain);
            $mailin = new Mailin('https://api.sendinblue.com/v1.0', SIB_Manager::$access_key, SIB_Manager::$secret_key);
            $code = esc_attr($_GET['code']);
            $list_id = intval($_GET['li']);
            $contact_info = SIB_Model_Contact::get_data_by_code($code);
            if ($contact_info != false) {
                $email = $contact_info['email'];
                $response = $mailin->get_user($email);
                if ($response['code'] == 'success') {
                    $listid = $response['data']['listid'];
                } else {
                    $listid = array();
                }
                if (SIB_Manager::$is_confirm_email == 'yes' && in_array($list_id, $listid) == false) {
                    $this->send_email('confirm', $email, $code, $list_id);
                }
                array_push($listid, $list_id);
                $attribues = maybe_unserialize($contact_info['info']);
                $mailin->create_update_user($email, $attribues, 0, $listid, null);
            }
            if (SIB_Manager::$redirect_url != '') {
                wp_redirect(SIB_Manager::$redirect_url);
                exit;
            }
            ?>
            <body style="margin:0; padding:0;">
            <table style="background-color:#ffffff" cellpadding="0" cellspacing="0" border="0" width="100%">
                <tbody>
                <tr style="border-collapse:collapse;">
                    <td style="border-collapse:collapse;" align="center">
                        <table cellpadding="0" cellspacing="0" border="0" width="540">
                            <tbody>
                            <tr>
                                <td style="line-height:0; font-size:0;" height="20"></td>
                            </tr>
                            </tbody>
                        </table>
                        <table cellpadding="0" cellspacing="0" border="0" width="540">
                            <tbody>
                            <tr>
                                <td style="line-height:0; font-size:0;" height="20">
                                    <div style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
                                        <?php 
            _e('Thank you for subscribing', 'sib_lang');
            ?>
</div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <table cellpadding="0" cellspacing="0" border="0" width="540">
                            <tbody>
                            <tr>
                                <td style="line-height:0; font-size:0;" height="20"></td>
                            </tr>
                            </tbody>
                        </table>
                        <table cellpadding="0" cellspacing="0" border="0" width="540">
                            <tbody>
                            <tr>
                                <td align="left">

                                    <div style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
                                        <br>
                                        <?php 
            echo __('You have just subscribed to the newsletter of ', 'sib_lang') . $site_domain . ' .';
            ?>
<br><br>
                                        <?php 
            _e('-SendinBlue', 'sib_lang');
            ?>
</div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <table cellpadding="0" cellspacing="0" border="0" width="540">
                            <tbody>
                            <tr>
                                <td style="line-height:0; font-size:0;" height="20">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                </tbody>
            </table>
            </body>
            <?php 
            exit;
        }
コード例 #2
0
ファイル: option-panel.php プロジェクト: eq0rip/srijanalaya
function logincust_subscribe_widget()
{
    if (!empty($_POST["logincust_mail"])) {
        require LOGINCUST_FREE_PATH . 'mailin.php';
        $was_submited = get_option('logincust_mail_was_submited', false);
        $user_info = get_userdata(1);
        $mailin = new Mailin("https://api.sendinblue.com/v2.0", "cHW5sxZnzE7mhaYb");
        $data = array("email" => $_POST["logincust_mail"], "attributes" => array("NAME" => $user_info->first_name, "SURNAME" => $user_info->last_name), "blacklisted" => 0, "listid" => array(34), "blacklisted_sms" => 0);
        $status = $mailin->create_update_user($data);
        if ($status['code'] == 'success') {
            if (empty($was_submited)) {
                add_option('logincust_mail_was_submited', true);
            }
        }
    }
    $was_submited = get_option('logincust_mail_was_submited', false);
    if ($was_submited == false) {
        echo sprintf('<p> %s </p><form class="logincust-submit-mail" method="post"><input name="logincust_mail" type="email" class="wp-pointer-input" value="' . get_option('admin_email') . '" /><input class="button wp-pointer-submit" type="submit" value="Submit"></form>', esc_html__('Our free, 4-lesson course on how to make your WordPress site run incredibly fast is barely waiting for its students. Ready to learn how to reduce your loading times by half? Come and join the 1st lesson here!', LOGINCUST_TEXTDOMAIN));
    } else {
        echo sprintf('<p> %s </p>', esc_html__('Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the “Unsubscribe� link included in each newsletter.', LOGINCUST_TEXTDOMAIN));
    }
}
コード例 #3
0
ファイル: bloom.php プロジェクト: Brandonsmith23/prodgyr
 /**
  * Subscribes to Sendinblue list. Returns either "success" string or error message.
  * @return string
  */
 function subscribe_sendinblue($api_key, $email, $list_id, $name, $last_name = '')
 {
     if (!function_exists('curl_init')) {
         return __('curl_init is not defined ', 'bloom');
     }
     if (!class_exists('Mailin')) {
         require_once ET_BLOOM_PLUGIN_DIR . 'subscription/sendinblue-v2.0/mailin.php';
     }
     $mailin = new Mailin('https://api.sendinblue.com/v2.0', $api_key);
     $user = $mailin->get_user($email);
     //check whether current email subscribed to current list
     if (!empty($user['data']['listid'])) {
         foreach ($user['data']['listid'] as $single_list_id) {
             if ((int) $list_id === (int) $single_list_id) {
                 return __('Already subscribed', 'bloom');
             }
         }
     }
     // subscribe current email to current list if not subscribed yet
     $attributes = array("NAME" => $name, "SURNAME" => $last_name);
     $blacklisted = 0;
     $listid = array($list_id);
     $listid_unlink = array();
     $blacklisted_sms = 0;
     $result = $mailin->create_update_user($email, $attributes, $blacklisted, $listid, $listid_unlink, $blacklisted_sms);
     if ('success' == $result['code']) {
         $error_message = 'success';
     } else {
         if (!empty($result['message'])) {
             $error_message = $result['message'];
         } else {
             $error_message = __('Unknown error', 'bloom');
         }
     }
     return $error_message;
 }
コード例 #4
0
ファイル: settings.php プロジェクト: axeljohansson1988/oddcv
function pirate_forms_admin()
{
    global $current_user;
    $pirate_forms_options = get_option('pirate_forms_settings_array');
    $plugin_options = pirate_forms_plugin_options();
    ?>

	<div class="wrap">

		<h1><?php 
    esc_html_e('Pirate Forms', 'pirate-forms');
    ?>
</h1>


		<div class="pirate-options">
			<ul class="pirate-forms-nav-tabs" role="tablist">
				<li role="presentation" class="active"><a href="#0" aria-controls="how_to_use" role="tab" data-toggle="tab"><?php 
    esc_html_e('How to use', 'pirate-forms');
    ?>
</a></li>
				<li role="presentation"><a href="#1" aria-controls="options" role="tab" data-toggle="tab"><?php 
    esc_html_e('Options', 'pirate-forms');
    ?>
</a></li>
				<li role="presentation"><a href="#2" aria-controls="fields" role="tab" data-toggle="tab"><?php 
    esc_html_e('Fields Settings', 'pirate-forms');
    ?>
</a></li>
				<li role="presentation"><a href="#3" aria-controls="labels" role="tab" data-toggle="tab"><?php 
    esc_html_e('Fields Labels', 'pirate-forms');
    ?>
</a></li>
				<li role="presentation"><a href="#4" aria-controls="messages" role="tab" data-toggle="tab"><?php 
    esc_html_e('Alert Messages', 'pirate-forms');
    ?>
</a></li>
				<li role="presentation"><a href="#5" aria-controls="smtp" role="tab" data-toggle="tab"><?php 
    esc_html_e('SMTP', 'pirate-forms');
    ?>
</a></li>
			</ul>

			<div class="pirate-forms-tab-content">

				<div id="0" class="pirate-forms-tab-pane active">

					<h2 class="pirate_forms_welcome_text"><?php 
    esc_html_e('Welcome to Pirate Forms!', 'pirate-forms');
    ?>
</h2>
					<p class= "pirate_forms_subheading"><?php 
    esc_html_e('To get started, just ', 'pirate-forms');
    ?>
<b><?php 
    esc_html_e('configure all the options ', 'pirate-forms');
    ?>
</b><?php 
    esc_html_e('you need, hit save and start using the created form.', 'pirate-forms');
    ?>
</p>

					<hr>

					<p><?php 
    esc_html_e('There are 3 ways of using the newly created form:', 'pirate-forms');
    ?>
</p>
					<ol>
						<li><?php 
    esc_html_e('Add a ', 'pirate-forms');
    ?>
<strong><a href="<?php 
    echo admin_url('widgets.php');
    ?>
"><?php 
    esc_html_e('widget', 'pirate-forms');
    ?>
</a></strong></li>
						<li><?php 
    esc_html_e('Use the shortcode ', 'pirate-forms');
    ?>
<strong><code>[pirate_forms]</code></strong><?php 
    esc_html_e(' in any page or post.', 'pirate-forms');
    ?>
</li>
						<li><?php 
    esc_html_e('Use the shortcode ', 'pirate-forms');
    ?>
<strong><code>&lt;?php echo do_shortcode( '[pirate_forms]' ) ?&gt;</code></strong><?php 
    esc_html_e(' in the theme\'s files.', 'pirate-forms');
    ?>
</li>
					</ol>

					<hr>

					<div class="rate_plugin_invite">

						<h4><?php 
    esc_html_e('Are you enjoying Pirate Forms?', 'pirate-forms');
    ?>
</h4>

						<p class="review-link"><?php 
    echo sprintf(esc_html__('Rate our plugin on %sWordPress.org%s. We\'d really appreciate it!', 'pirate-forms'), '<a href="https://wordpress.org/support/view/plugin-reviews/pirate-forms" target="_blank" rel="nofollow"> ', '</a>');
    ?>
</p>

						<p><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></p>

						<p><small><?php 
    echo sprintf(esc_html__('If you want a more complex Contact Form Plugin please check %sthis link%s.', 'pirate-forms'), '<a href="http://www.codeinwp.com/blog/best-contact-form-plugins-wordpress/" target="_blank" >', '</a>');
    ?>
</small></p>
					</div>


				</div>

				<?php 
    $pirate_forms_nr_tabs = 1;
    foreach ($plugin_options as $plugin_options_tab) {
        echo '<div id="' . $pirate_forms_nr_tabs . '" class="pirate-forms-tab-pane">';
        ?>
					<form method="post" class="pirate_forms_contact_settings">

						<?php 
        $pirate_forms_nr_tabs++;
        foreach ($plugin_options_tab as $key => $value) {
            /* Label */
            if (!empty($value[0])) {
                $opt_name = $value[0];
            }
            /* ID */
            $opt_id = $key;
            /* Description */
            if (!empty($value[1])) {
                $opt_desc = $value[1];
            } else {
                $opt_desc = '';
            }
            /* Input type */
            if (!empty($value[2])) {
                $opt_type = $value[2];
            } else {
                $opt_type = '';
            }
            /* Default value */
            if (!empty($value[3])) {
                $opt_default = $value[3];
            } else {
                $opt_default = '';
            }
            /* Value */
            $opt_val = isset($pirate_forms_options[$opt_id]) ? $pirate_forms_options[$opt_id] : $opt_default;
            /* Options if checkbox, select, or radio */
            $opt_options = empty($value[4]) ? array() : $value[4];
            switch ($opt_type) {
                case "title":
                    if (!empty($opt_name)) {
                        echo '<h3 class="title">' . $opt_name . '</h3><hr />';
                    }
                    break;
                case "text":
                    ?>

									<div class="pirate-forms-grouped">

										<label for="<?php 
                    echo $opt_id;
                    ?>
"><?php 
                    echo $opt_name;
                    if (!empty($opt_desc)) {
                        if ($opt_id == "pirateformsopt_email" || $opt_id == "pirateformsopt_email_recipients" || $opt_id == "pirateformsopt_confirm_email") {
                            echo '<span class="dashicons dashicons-editor-help"></span>';
                        }
                        echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
                    }
                    ?>

										</label>

										<input name="<?php 
                    echo $opt_id;
                    ?>
" id="<?php 
                    echo $opt_id;
                    ?>
" type="<?php 
                    echo $opt_type;
                    ?>
" value="<?php 
                    echo stripslashes($opt_val);
                    ?>
" class="widefat">
									</div>

									<?php 
                    break;
                case "textarea":
                    ?>

									<div class="pirate-forms-grouped">

										<label for="<?php 
                    echo $opt_id;
                    ?>
"><?php 
                    echo $opt_name;
                    if (!empty($opt_desc)) {
                        if ($opt_id == "pirateformsopt_confirm_email") {
                            echo '<span class="dashicons dashicons-editor-help"></span>';
                        }
                        echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
                    }
                    ?>

										</label>

										<textarea name="<?php 
                    echo $opt_id;
                    ?>
" id="<?php 
                    echo $opt_id;
                    ?>
" type="<?php 
                    echo $opt_type;
                    ?>
" value="<?php 
                    echo stripslashes($opt_val);
                    ?>
" rows="5" cols="30"></textarea>
									</div>

									<?php 
                    break;
                case "select":
                    ?>
									<div class="pirate-forms-grouped">

										<label for="<?php 
                    echo $opt_id;
                    ?>
"><?php 
                    echo $opt_name;
                    if (!empty($opt_desc)) {
                        echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
                    }
                    ?>

										</label>

										<select name="<?php 
                    echo $opt_id;
                    ?>
" id="<?php 
                    echo $opt_id;
                    ?>
">
											<?php 
                    foreach ($opt_options as $key => $val) {
                        $selected = '';
                        if ($opt_val == $key) {
                            $selected = 'selected';
                        }
                        ?>
												<option value="<?php 
                        echo $key;
                        ?>
" <?php 
                        echo $selected;
                        ?>
><?php 
                        echo $val;
                        ?>
</option>
											<?php 
                    }
                    ?>
										</select>


									</div>

								<?php 
                    break;
                case "checkbox":
                    ?>
									<div class="pirate-forms-grouped">

										<label for="<?php 
                    echo $opt_id;
                    ?>
"><?php 
                    echo $opt_name;
                    if (!empty($opt_desc)) {
                        if ($opt_id == "pirateformsopt_store" || $opt_id == "pirateformsopt_blacklist") {
                            echo '<span class="dashicons dashicons-editor-help"></span>';
                        }
                        echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
                    }
                    ?>

										</label>

										<?php 
                    $checked = '';
                    if (array_key_exists($opt_id, $pirate_forms_options)) {
                        $checked = 'checked';
                    }
                    ?>

											<input type="checkbox" value="yes" name="<?php 
                    echo $opt_id;
                    ?>
" id="<?php 
                    echo $opt_id;
                    ?>
" <?php 
                    echo $checked;
                    ?>
>Yes

									</div>


								<?php 
                    break;
            }
        }
        ?>
						<input name="save" type="submit" value="<?php 
        _e('Save changes', 'pirate-forms');
        ?>
" class="button-primary pirate-forms-save-button">
						<input type="hidden" name="action" value="save">
						<input type="hidden" name="proper_nonce" value="<?php 
        echo wp_create_nonce($current_user->user_email);
        ?>
">

					</form><!-- .pirate_forms_contact_settings -->
					<div class="ajaxAnimation"></div>
				</div><!-- .pirate-forms-tab-pane -->

				<?php 
    }
    ?>

			</div><!-- .pirate-forms-tab-content -->
		</div><!-- .pirate-options -->

		<div class="pirate-subscribe postbox card">
			<h3 class="title"><?php 
    esc_html_e('Get Our Free Email Course', 'islemag');
    ?>
</h3>
			<div class="pirate-forms-subscribe-content">
				<?php 
    if (!empty($_POST["pirate_forms_mail"])) {
        require PIRATE_FORMS_PATH . 'mailin.php';
        $user_info = get_userdata(1);
        $mailin = new Mailin("https://api.sendinblue.com/v2.0", "cHW5sxZnzE7mhaYb");
        $data = array("email" => $_POST["pirate_forms_mail"], "attributes" => array("NAME" => $user_info->first_name, "SURNAME" => $user_info->last_name), "blacklisted" => 0, "listid" => array(51), "blacklisted_sms" => 0);
        $status = $mailin->create_update_user($data);
        if ($status['code'] == 'success') {
            update_option('pirate_forms_subscribe', true);
        }
    }
    $was_submited = get_option('pirate_forms_subscribe', false);
    if ($was_submited == false) {
        echo sprintf('<p> %s </p><form class="pirate-forms-submit-mail" method="post"><input name="pirate_forms_mail" type="email" value="' . get_option('admin_email') . '" /><input class="button" type="submit" value="Submit"></form>', esc_html__('Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'pirate-forms'));
    } else {
        echo sprintf('<p> %s </p>', esc_html__('Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the "Unsubscribe" link included in each newsletter.', 'pirate-forms'));
    }
    ?>
			</div>
		</div>



	</div><!-- .wrap -->

	<?php 
}
コード例 #5
0
 /**
  * Subscribes to Sendinblue list. Returns either "success" string or error message.
  * @return string
  */
 function subscribe_sendinblue($api_key, $email, $list_id, $name, $last_name = '')
 {
     if (!function_exists('curl_init')) {
         return __('curl_init is not defined ', 'rapidology');
     }
     if (!class_exists('Mailin')) {
         require_once RAD_RAPIDOLOGY_PLUGIN_DIR . 'subscription/sendinblue-v2.0/mailin.php';
     }
     $mailin = new Mailin('https://api.sendinblue.com/v2.0', $api_key);
     $user = $mailin->get_user($email);
     if ('failure' == $user['code']) {
         $attributes = array("NAME" => $name, "SURNAME" => $last_name);
         $blacklisted = 0;
         $listid = array($list_id);
         $listid_unlink = array();
         $blacklisted_sms = 0;
         $result = $mailin->create_update_user($email, $attributes, $blacklisted, $listid, $listid_unlink, $blacklisted_sms);
         if ('success' == $result['code']) {
             $error_message = 'success';
         } else {
             if (!empty($result['message'])) {
                 $error_message = $result['message'];
             } else {
                 $error_message = __('Unknown error', 'rapidology');
             }
         }
     } else {
         $error_message = __('Already subscribed', 'rapidology');
     }
     return $error_message;
 }