Plugin Directory

Changeset 1391118


Ignore:
Timestamp:
04/10/2016 12:23:13 AM (10 years ago)
Author:
ashtonpaul
Message:

version 1.1

Location:
simple-constant-contact
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • simple-constant-contact/trunk/readme.txt

    r1006963 r1391118  
    11=== Simple Constant Contact ===
    2 Contributors: ashtonpaul
    3 Link: http://www.ashtonpaul.com/simplecc
    4 Donate link: http://www.ashtonpaul.com/simplecc
     2Contributors: ashtonpaul, elementsweb
     3Link: http://simplecc.ashtonpaul.com/
     4Donate link: http://simplecc.ashtonpaul.com/
    55Tags: plugin, constant, contact, newsletter, constant contact, wordpress, wordpress.org, form, signup, sign-up
    66Requires at least: 3.8
    7 Tested up to: 4.0
     7Tested up to: 4.4.2
    88Stable tag: trunk
    99License: GPLv2 or later
     
    1717== Installation ==
    18181. Install Simple Constant Contact either via the WordPress.org plugin directory, or by uploading the files to your server
    19 2. After activating Simple Constant Contact, navigate to the menu item 'Simple Constant Contact'.
    20 3. Click the 'Get Access Token' Button. Then login to your Constant Conatct account and authorize the plugin.
    21 4. Copy the Access Token code after authorizing the plugin and paste it back into the field label 'Constant Contact Access Token' on the plugin's wordpress options page.
    22 5. Enter a List name you want the email addresses to group under in your Constant Conact account (default is Simple Constant Contact).
    23 6. Use the shortcode [simpleCC] to display the form.
     192. After activating Simple Constant Contact, navigate to the options menu item 'Simple Constant Contact'.
     203. Click the 'Get Access Token' Button. Then login to your Constant Contact account and authorize the plugin.
     214. Copy the Access Token code after authorizing the plugin and paste it back into the field label 'Constant Contact Access Token' on the plugin's WordPress options page.
     225. Enter a List name you want the email addresses to group under in your Constant Contact account (default is Simple Constant Contact).
     236. Use the short-code [simpleCC] to display the form.
    24247. If you like you can leave the formatting as is or create your own stylesheets to match your theme.
    2525
     
    2929
    3030`
    31 <div class="simpleCC_plugin">   
    32     <form class="simpleCC_form" id="simpleCC_form" method="post">
    33         <label for="simpleCC_fname">First Name:<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label>
    34         <label for="simpleCC_lname">Last Name:<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label>
    35         <label for="simpleCC_email">Email:<input type="email" id="simpleCC_email" name="simpleCC_email" /></label>
     31<div class="simpleCC_plugin">
     32    <p id="simpleCC_error_message"></p>
     33    <form name="simpleCC_form" class="simpleCC_form" id="simpleCC_form" method="post" onsubmit="return simpleCC_message()">
     34        <label for="simpleCC_fname">
     35            First Name
     36            <input type="text" id="simpleCC_fname" name="simpleCC_fname" />
     37        </label>
     38        <label for="simpleCC_lname">
     39            Last Name
     40            <input type="text" id="simpleCC_lname" name="simpleCC_lname" />
     41        </label>
     42        <label for="simpleCC_email">
     43            Email
     44            <input type="email" id="simpleCC_email" name="simpleCC_email" />
     45        </label>
     46        <input type="hidden" name="simpleCC_submitted" id="simpleCC_submitted" value="" />
    3647        <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button>
    3748    </form>
    3849</div>
    3950`
     51== Screenshots ==
     521. This is how it looks with a little big of formatting via CSS
     532. Settings page
     54
    4055
    4156== Changelog ==
    4257= 1.0 =
    43 * initial release
    44 === Simple Constant Contact ===
    45 Contributors: ashtonpaul
    46 Link: http://www.ashtonpaul.com/simplecc
    47 Donate link: http://www.ashtonpaul.com/simplecc
    48 Tags: plugin, constant, contact, newsletter, constant contact, wordpress, wordpress.org, form, signup, sign-up
    49 Requires at least: 3.8
    50 Tested up to: 4.0
    51 Stable tag: trunk
    52 License: GPLv2 or later
    53 License URI: http://www.gnu.org/licenses/gpl-2.0.html
    54 
    55 Simple Wordpress Constant Contact Plugin to take name and email and allow to send that information straight to Constant Contact
    56  
    57 == Description ==
    58 The Simple Constant Contact Plugin is a quick and easy plugin to interface with your constant contact account. It takes the visitor's name and email and allows it to send that information directly to your Constant Contact account. Set up is easy. Just follow the instructions in the admin menu and you're on your way. The UI was left raw with class and id tags so you can apply your own styling to match your current theme.
    59  
    60 == Installation ==
    61 1. Install Simple Constant Contact either via the WordPress.org plugin directory, or by uploading the files to your server
    62 2. After activating Simple Constant Contact, navigate to the menu item 'Simple Constant Contact'.
    63 3. Click the 'Get Access Token' Button. Then login to your Constant Conatct account and authorize the plugin.
    64 4. Copy the Access Token code after authorizing the plugin and paste it back into the field label 'Constant Contact Access Token' on the plugin's wordpress options page.
    65 5. Enter a List name you want the email addresses to group under in your Constant Conact account (default is Simple Constant Contact).
    66 6. Use the shortcode [SimpleCC] to display the form.
    67 7. If you like you can leave the formatting as is or create your own stylesheets to match your theme.
    68 
    69 == Frequently Asked Questions ==
    70 
    71 = What is the HTML output so I can match my theme style? =
    72 
    73 `
    74 <div class="simpleCC_plugin">   
    75     <form class="simpleCC_form" id="simpleCC_form" method="post">
    76         <label for="simpleCC_fname">First Name:<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label>
    77         <label for="simpleCC_lname">Last Name:<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label>
    78         <label for="simpleCC_email">Email:<input type="email" id="simpleCC_email" name="simpleCC_email" /></label>
    79         <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button>
    80     </form>
    81 </div>
    82 `
    83 
    84 == Changelog ==
    85 = 1.0 =
    86 * initial release
     58* Initial release
     59= 1.1 =
     60* Update documentation to include usage on settings page
     61* Update redirect URI to subdomain
     62* Move settings page under options instead of main menu
     63* Add capability for custom success message
     64* Error handling on forms
     65* Success message on submit
     66* Fixed return bug for short-code (Thanks to elementsweb)
     67* Update readme file
     68* Added logo
     69* Added screenshot
  • simple-constant-contact/trunk/simple_constant_contact.php

    r991579 r1391118  
    22    /**
    33    * Plugin Name: Simple Constant Contact
    4     * Plugin URI: http://ashtonpaul.com/projects/simple_constant_contact
     4    * Plugin URI: http://www.ashtonpaul.com/project/simple-constant-contact/
    55    * Description: Simple Wordpress Newsletter Plugin to take name and email.
    6     * Version: 1.0
     6    * Version: 1.1
    77    * Author: Ashton Paul
    8     * Author URI: http://ashtonpaul.com/simplecc/
     8    * Author URI: http://ashtonpaul.com/
     9    * Contributors: elementsweb
    910    * Tags: plugin, constant, contact, newsletter, constant contact, wordpress, wordpress.org, form, signup, sign-up, sign up
    1011    * License: GPL2
    1112    *
    12     * Copyright (C) 2014  Ashton Paul (email [email protected])
     13    * Copyright (C) 2016  Ashton Paul (email: [email protected])
    1314    *
    1415    * This program is free software; you can redistribute it and/or
     
    5354        // debug variable to trigger html responses
    5455        public $enabled = false;
    55         public $error = false;     
     56        public $error = false; 
    5657       
    5758        // instance variable to help with memory management
     
    103104        // create a new connection to the constant contact by API and see if every thing is ready to go
    104105        private function ready(){
    105             // define constant ontact APIKEY and ACCESS_TOKEN and the contact list to be used
     106            // define constant contact APIKEY and ACCESS_TOKEN and the contact list to be used
    106107            if (!defined("APIKEY")) define("APIKEY", get_option('simpleCC_apikey'));           
    107108            if (!defined("ACCESS_TOKEN")) define("ACCESS_TOKEN", get_option('simpleCC_accesstoken'));
    108             if (!defined("WEBSITE_LIST")) define("WEBSITE_LIST", get_option('simpleCC_listname') ? get_option('simpleCC_listname') : 'Simple Constant Contact');
     109            if (!defined("WEBSITE_LIST")) {
     110                if (get_option('simpleCC_listname')) {
     111                    define("WEBSITE_LIST", get_option('simpleCC_listname'));
     112                }
     113                else {
     114                    define("WEBSITE_LIST", 'Simple Constant Contact');
     115                }   
     116            }
     117
     118            if (!defined("SUCCESS_MESSAGE")) {
     119                if (get_option('simpleCC_message_successful')) {
     120                    define("SUCCESS_MESSAGE", get_option('simpleCC_message_successful'));
     121                }
     122                else {
     123                    define("SUCCESS_MESSAGE", 'Thanks for subscribing!');
     124                }   
     125            }
     126
    109127           
    110128            try {
    111                
    112129                // instantiate new API reference variable
    113130                $this->cc = new ConstantContact(APIKEY);
     
    119136                }
    120137                    catch (CtctException $ex) {
     138                    echo 'Simple Constant Contact is not authenticated. Get a new Access Code.';
    121139                    $this->enabled = false;
    122140                }                       
     
    127145            }
    128146            catch (CtctException $ex) {
    129                 echo "Simple Constant Contact is not configured properly.";
    130                 return false;
     147                echo 'Simple Constant Contact is not configured properly.';
     148                $this->enabled = false;
     149                return $this->enabled;
    131150            }   
    132151        }
     
    139158            delete_option('simpleCC_accesstoken');
    140159            delete_option('simpleCC_listname');
     160            delete_option('simpleCC_message_successful');
     161            delete_option('simpleCC_redirect');
    141162           
    142163            // unregister it from options and options group
     
    145166            unregister_setting('simpleCC_options','simpleCC_accesstoken');
    146167            unregister_setting('simpleCC_options','simpleCC_listname');
     168            unregister_setting('simpleCC_options','simpleCC_message_successful');
    147169            unregister_setting('simpleCC_options','simpleCC_redirect');
    148170        }
     
    155177            register_setting('simpleCC_options','simpleCC_accesstoken');
    156178            register_setting('simpleCC_options','simpleCC_listname');
     179            register_setting('simpleCC_options','simpleCC_message_successful');
    157180            register_setting('simpleCC_options','simpleCC_redirect');
    158181
     
    160183            update_option('simpleCC_apikey','f7mpubkv2na59zpu5juuyfq3');
    161184            update_option('simpleCC_secret','GcgS2p6TDvwRJnxZtfag2tFp');
    162             update_option('simpleCC_redirect','http://ashtonpaul.com/simplecc/');
     185            update_option('simpleCC_redirect','http://simplecc.ashtonpaul.com/');
    163186           
    164187            // hook to remove all settings made on deactivation
     
    182205                if (is_email($email) && !empty($first_name) && !empty($last_name)) {
    183206                    $result = $this->contactEntry($first_name, $last_name, $email);
     207                    $submitted = true;
    184208                }
    185209            }
     
    189213        function simpleCC_option_page()
    190214        {
    191             // indicated that the options have been updated
    192             if (isset($_GET['settings-updated'])) {
    193             echo '<div id="setting-error-settings_updated" class="updated settings-error">';
    194             echo '<p><strong>Settings saved</strong></p></div>';
    195             }
    196            
    197215            ?>
    198216                <!-- display form in admin menu -->
    199217                <div class="wrap">
    200                     <h2>Simple Constant Contact Options Page</h2>
     218                    <h2>Simple Constant Contact Settings</h2>
    201219                    <form action="options.php" method="post" id="simpleCC-options-form">
    202220                        <?php settings_fields('simpleCC_options'); ?>               
     
    208226                                    &bull;Copy the access token and paste it in the input box below labeled <strong>"Constant Contact Access Token"</strong>.<br />
    209227                                </p>
     228                            <h3 class="title">Usage</h3>
     229                                <p>Put shortcode <strong>[simpleCC]</strong> wherever you want the form displayed.
     230                                </p>
    210231                        </div> 
    211232                        <hr>       
     
    214235                                <tr>
    215236                                    <th scope="row">
    216                                         <label for="simpleCC_listname">Constant Contact Access Token: </label>
     237                                        <label for="simpleCC_accesstoken">Constant Contact Access Token: </label>
    217238                                    </th>
    218239                                    <td>
     
    234255                                    </td>
    235256                                </tr>
     257                                <tr>
     258                                    <th scope="row">
     259                                        <label for="simpleCC_listname">Success Message: </label>   
     260                                    </th>
     261
     262                                    <td>
     263                                        <input type="text" size="35" id="simpleCC_message_successful" name="simpleCC_message_successful" value="<?php echo esc_attr( get_option('simpleCC_message_successful') ); ?>" />
     264                                    </td>
     265                                </tr>
    236266                            </tbody>
    237267                        </table>
     
    245275        function simpleCC_plugin_menu()
    246276        {
    247             add_menu_page('Simple Constant Contact','Simple Constant Contact', 'manage_options', 'simple-cc-plugin', array($this, 'simpleCC_option_page'));
     277            add_options_page('Simple Constant Contact', 'Simple Constant Contact', 9, 'simple-cc-plugin', array($this, 'simpleCC_option_page'));
    248278        }
    249279   
     
    252282            // test to see if all the settings are correct 
    253283            if ($this->ready()) {
    254             ?>
    255             <div class="simpleCC_plugin">   
    256                 <form class="simpleCC_form" id="simpleCC_form" method="post">
    257                     <label for="simpleCC_fname">First Name:<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label>
    258                     <label for="simpleCC_lname">Last Name:<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label>
    259                     <label for="simpleCC_email">Email:<input type="email" id="simpleCC_email" name="simpleCC_email" /></label>
    260                     <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button>
    261                 </form>
    262             </div>
    263             <?php
     284                if ($_POST['simpleCC_submitted'] == 'success') {
     285                    $_POST['simpleCC_submitted'] = '';
     286
     287                    if (get_option('simpleCC_message_successful') == '')
     288                        $message = 'Thanks for subscribing!';
     289                    else
     290                        $message = get_option('simpleCC_message_successful');
     291
     292                    return '<div class="simpleCC_plugin"><p id="simpleCC_error_message">'.$message.'</p></div>';
     293                }
     294                else {
     295                    return '<div class="simpleCC_plugin">
     296                                <p id="simpleCC_success_message"></p>
     297                                <p id="simpleCC_error_message"></p>
     298                                <form name="simpleCC_form" class="simpleCC_form" id="simpleCC_form" method="post" onsubmit="return simpleCC_message()">
     299                                    <label for="simpleCC_fname">First Name<input type="text" id="simpleCC_fname" name="simpleCC_fname" /></label>
     300                                    <label for="simpleCC_lname">Last Name<input type="text" id="simpleCC_lname" name="simpleCC_lname" /></label>
     301                                    <label for="simpleCC_email">Email<input type="email" id="simpleCC_email" name="simpleCC_email" /></label>
     302                                    <input type="hidden" name="simpleCC_submitted" id="simpleCC_submitted" value="" />
     303                                    <button id="simpleCC_submit" type="submit" name="simpleCC_submit" value="simpleCC_submit_successful">Submit</button>
     304                                </form>
     305                            </div>';
     306                }
    264307            }
     308        }
     309
     310        // Custom javascript
     311        function simpleCC_scripts_basic(){
     312            wp_register_script('simpleeCC_script', plugins_url('/js/simpleCC.js', __FILE__));
     313            wp_enqueue_script('simpleeCC_script');
    265314        }
    266315       
     
    272321            add_shortcode('simpleCC', array($this, 'simpleCC_display_form'));
    273322            add_action('admin_menu', array($this, 'simpleCC_plugin_menu'));
     323
     324            // javascript
     325            add_action( 'wp_enqueue_scripts', array($this, 'simpleCC_scripts_basic' ));
    274326        }
    275327
Note: See TracChangeset for help on using the changeset viewer.