WordPress.org

Plugin Directory

Changeset 1507041


Ignore:
Timestamp:
10/03/16 03:01:01 (8 months ago)
Author:
benhays
Message:

2.0 release

Location:
gravity-forms-wysija-add-on/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • gravity-forms-wysija-add-on/trunk/gravity-forms-wysija.php

    r1261824 r1507041  
    44Plugin URI: https://github.com/bhays/gravity-forms-wysija 
    55Description: Integrates the Gravity Forms plugin with the MailPoet Newsletters plugin, creating a menage-a-plugin. 
    6 Version: 1.4.1 
     6Version: 2.0 
    77Author: Ben Hays 
    88Author URI: http://benhays.com 
     
    1111 
    1212------------------------------------------------------------------------ 
    13 Copyright 2013 Ben Hays 
     13Copyright 2016 Ben Hays 
    1414 
    1515This program is free software; you can redistribute it and/or modify 
     
    2828*/ 
    2929 
    30 add_action('init',  array('GFWysija', 'init')); 
    31 register_activation_hook( __FILE__, array("GFWysija", "add_permissions")); 
     30define( 'GF_WYSIJA_ADDON_VERSION', '2.0' ); 
    3231 
    33 class GFWysija { 
     32add_action( 'gform_loaded', array( 'GF_MailPoet_Startup', 'load' ), 5 ); 
    3433 
    35     private static $path = "gravity-forms-wysija/gravity-forms-wysija.php"; 
    36     private static $url = "http://www.gravityforms.com"; 
    37     private static $slug = "gravity-forms-wysija"; 
    38     private static $version = "1.4.1"; 
    39     private static $min_gravityforms_version = "1.6.10"; 
    40     private static $supported_fields = array( 
    41                         "checkbox", "radio", "select", "text", "website", "textarea", "email", 
    42                         "hidden", "number", "phone", "multiselect", "post_title", 
    43                         "post_tags", "post_custom_field", "post_content", "post_excerpt" 
    44                     ); 
     34class GF_MailPoet_Startup { 
    4535 
    46     //Plugin starting point. Will load appropriate files 
    47     public static function init(){ 
    48         //supports logging 
    49         add_filter("gform_logging_supported", array("GFWysija", "set_logging_supported")); 
     36    public static function load() { 
    5037 
    51         if(basename($_SERVER['PHP_SELF']) == "plugins.php") { 
    52  
    53             //loading translations 
    54             load_plugin_textdomain( 'gravity-forms-wysija', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 
    55  
    56             //force new remote request for version info on the plugin page 
    57             //self::flush_version_info(); 
    58         } 
    59  
    60         add_action('after_plugin_row_' . self::$path, array('GFWysija', 'plugin_row') ); 
    61  
    62         if(!self::is_gravityforms_supported() || !self::is_wysija_installed() ){ 
    63            return; 
    64         } 
    65  
    66         if(is_admin()){ 
    67             //loading translations 
    68             load_plugin_textdomain( 'gravity-forms-wysija', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 
    69  
    70             add_filter("transient_update_plugins", array('GFWysija', 'check_update')); 
    71             add_filter("site_transient_update_plugins", array('GFWysija', 'check_update')); 
    72  
    73             add_action('install_plugins_pre_plugin-information', array('GFWysija', 'display_changelog')); 
    74         } 
    75  
    76         //integrating with Members plugin 
    77         if(function_exists('members_get_capabilities')) 
    78             add_filter('members_get_capabilities', array("GFWysija", "members_get_capabilities")); 
    79  
    80         //creates the subnav left menu 
    81         add_filter("gform_addon_navigation", array('GFWysija', 'create_menu')); 
    82  
    83         if(self::is_wysija_page()){ 
    84  
    85             //enqueueing sack for AJAX requests 
    86             wp_enqueue_script(array("sack")); 
    87  
    88             //loading data lib 
    89             require_once(self::get_base_path() . "/inc/data.php"); 
    90  
    91             //loading Gravity Forms tooltips 
    92             require_once(GFCommon::get_base_path() . "/tooltips.php"); 
    93             add_filter('gform_tooltips', array('GFWysija', 'tooltips')); 
    94  
    95             //runs the setup when version changes 
    96             self::setup(); 
    97  
    98          } 
    99          else if(in_array(RG_CURRENT_PAGE, array("admin-ajax.php"))){ 
    100  
    101             //loading data class 
    102             require_once(self::get_base_path() . "/inc/data.php"); 
    103  
    104             add_action('wp_ajax_rg_update_feed_active', array('GFWysija', 'update_feed_active')); 
    105             add_action('wp_ajax_gf_select_wysija_form', array('GFWysija', 'select_wysija_form')); 
    106  
    107         } 
    108         else{ 
    109              //handling post submission. 
    110             add_action("gform_after_submission", array('GFWysija', 'export'), 10, 2); 
    111         } 
    112     } 
    113  
    114     public static function update_feed_active(){ 
    115         check_ajax_referer('rg_update_feed_active','rg_update_feed_active'); 
    116         $id = $_POST["feed_id"]; 
    117         $feed = GFWysijaData::get_feed($id); 
    118         GFWysijaData::update_feed($id, $feed["form_id"], $_POST["is_active"], $feed["meta"]); 
    119     } 
    120  
    121     //Displays current version details on Plugin's page 
    122     public static function display_changelog(){ 
    123         if($_REQUEST["plugin"] != self::$slug) 
    124             return; 
    125  
    126         RGWysijaUpgrade::display_changelog(self::$slug, self::get_key(), self::$version); 
    127     } 
    128  
    129     public static function check_update($update_plugins_option){ 
    130         if ( get_option( 'gf_wysija_version' ) != self::$version ) { 
    131             require_once( 'inc/data.php' ); 
    132             GFWysijaData::update_table(); 
     38        if ( ! method_exists( 'GFForms', 'include_feed_addon_framework' ) ) { 
     39            return; 
    13340        } 
    13441 
    135         update_option( 'gf_wysija_version', self::$version ); 
     42        require_once( 'class-gfmailpoetaddon.php' ); 
    13643 
    137         return $update_plugins_option; 
    138     } 
    139  
    140     private static function get_key(){ 
    141         if(self::is_gravityforms_supported()) 
    142             return GFCommon::get_key(); 
    143         else 
    144             return ""; 
    145     } 
    146     //--------------------------------------------------------------------------------------- 
    147  
    148     //Returns true if the current page is an Feed pages. Returns false if not 
    149     private static function is_wysija_page(){ 
    150         $current_page = trim(strtolower(rgget("page"))); 
    151         $wysija_pages = array("gf_wysija"); 
    152  
    153         return in_array($current_page, $wysija_pages); 
    154     } 
    155  
    156     //Creates or updates database tables. Will only run when version changes 
    157     private static function setup(){ 
    158  
    159         if(get_option("gf_wysija_version") != self::$version) 
    160             GFWysijaData::update_table(); 
    161  
    162         update_option("gf_wysija_version", self::$version); 
    163     } 
    164  
    165     //Adds feed tooltips to the list of tooltips 
    166     public static function tooltips($tooltips){ 
    167         $wysija_tooltips = array( 
    168             "wysija_contact_list" => "<h6>" . __("MailPoet Lists", "gravity-forms-wysija") . "</h6>" . __("Select the MailPoet lists you would like to add your contacts to.", "gravity-forms-wysija"), 
    169             "wysija_gravity_form" => "<h6>" . __("Gravity Form", "gravity-forms-wysija") . "</h6>" . __("Select the Gravity Form you would like to integrate with MailPoet. Contacts generated by this form will be automatically added the selected MailPoet lists.", "gravity-forms-wysija"), 
    170             "wysija_welcome" => "<h6>" . __("Send Welcome Email", "gravity-forms-wysija") . "</h6>" . __("When this option is enabled, users will receive an automatic welcome email from MailPoet upon being added to your MailPoet list.", "gravity-forms-wysija"), 
    171             "wysija_map_fields" => "<h6>" . __("Map Fields", "gravity-forms-wysija") . "</h6>" . __("Associate your MailPoet newsletter questions to the appropriate Gravity Form fields by selecting.", "gravity-forms-wysija"), 
    172             "wysija_optin_condition" => "<h6>" . __("Opt-In Condition", "gravity-forms-wysija") . "</h6>" . __("When the opt-in condition is enabled, form submissions will only be exported to MailPoet when the condition is met. When disabled all form submissions will be exported.", "gravity-forms-wysija"), 
    173             "wysija_double_optin" => "<h6>" . __("Double Opt-In", "gravity-forms-wysija") . "</h6>" . __("When the double opt-in option is enabled, MailPoet will send a confirmation email to the user and will only add them to your MailPoet list upon confirmation.", "gravity-forms-wysija") 
    174         ); 
    175         return array_merge($tooltips, $wysija_tooltips); 
    176     } 
    177  
    178     //Creates MailPoet left nav menu under Forms 
    179     public static function create_menu($menus){ 
    180  
    181         // Adding submenu if user has access 
    182         $permission = self::has_access("gravityforms_wysija"); 
    183         if(!empty($permission)) 
    184             $menus[] = array("name" => "gf_wysija", "label" => __("MailPoet", "gravity-forms-wysija"), "callback" =>  array("GFWysija", "wysija_page"), "permission" => $permission); 
    185  
    186         return $menus; 
    187     } 
    188  
    189     public static function wysija_page(){ 
    190         $view = rgar($_GET, 'view'); 
    191         if( $view == 'edit' ) 
    192             self::edit_page($_GET['id']); 
    193         else 
    194             self::list_page(); 
    195     } 
    196  
    197     //Displays the wysija feeds list page 
    198     private static function list_page(){ 
    199         if(!self::is_gravityforms_supported()){ 
    200             die(__(sprintf("MailPoet Add-On requires Gravity Forms %s. Upgrade automatically on the %sPlugin page%s.", self::$min_gravityforms_version, "<a href='plugins.php'>", "</a>"), "gravity-forms-wysija")); 
    201         } 
    202  
    203         if(rgpost("action") == "delete"){ 
    204             check_admin_referer("list_action", "gf_wysija_list"); 
    205  
    206             $id = absint($_POST["action_argument"]); 
    207             GFWysijaData::delete_feed($id); 
    208             ?> 
    209             <div class="updated fade" style="padding:6px"><?php _e("Feed deleted.", "gravity-forms-wysija") ?></div> 
    210             <?php 
    211         } 
    212         else if (!empty($_POST["bulk_action"])){ 
    213             check_admin_referer("list_action", "gf_wysija_list"); 
    214             $selected_feeds = $_POST["feed"]; 
    215             if(is_array($selected_feeds)){ 
    216                 foreach($selected_feeds as $feed_id) 
    217                     GFWysijaData::delete_feed($feed_id); 
    218             } 
    219             ?> 
    220             <div class="updated fade" style="padding:6px"><?php _e("Feeds deleted.", "gravity-forms-wysija") ?></div> 
    221             <?php 
    222         } 
    223  
    224         ?> 
    225         <div class="wrap"> 
    226  
    227             <h2><?php _e("MailPoet Newsletter Feeds", "gravity-forms-wysija"); ?> 
    228             <a class="add-new-h2" href="admin.php?page=gf_wysija&view=edit&id=0"><?php _e("Add New", "gravity-forms-wysija") ?></a> 
    229             </h2> 
    230  
    231  
    232             <form id="feed_form" method="post"> 
    233                 <?php wp_nonce_field('list_action', 'gf_wysija_list') ?> 
    234                 <input type="hidden" id="action" name="action"/> 
    235                 <input type="hidden" id="action_argument" name="action_argument"/> 
    236  
    237                 <div class="tablenav"> 
    238                     <div class="alignleft actions" style="padding:8px 0 7px 0;"> 
    239                         <label class="hidden" for="bulk_action"><?php _e("Bulk action", "gravity-forms-wysija") ?></label> 
    240                         <select name="bulk_action" id="bulk_action"> 
    241                             <option value=''> <?php _e("Bulk action", "gravity-forms-wysija") ?> </option> 
    242                             <option value='delete'><?php _e("Delete", "gravity-forms-wysija") ?></option> 
    243                         </select> 
    244                         <?php 
    245                         echo '<input type="submit" class="button" value="' . __("Apply", "gravity-forms-wysija") . '" onclick="if( jQuery(\'#bulk_action\').val() == \'delete\' && !confirm(\'' . __("Delete selected feeds? ", "gravity-forms-wysija") . __("\'Cancel\' to stop, \'OK\' to delete.", "gravity-forms-wysija") .'\')) { return false; } return true;"/>'; 
    246                         ?> 
    247                     </div> 
    248                 </div> 
    249                 <table class="widefat fixed" cellspacing="0"> 
    250                     <thead> 
    251                         <tr> 
    252                             <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th> 
    253                             <th scope="col" id="active" class="manage-column check-column"></th> 
    254                             <th scope="col" class="manage-column"><?php _e("Form", "gravity-forms-wysija") ?></th> 
    255                             <th scope="col" class="manage-column"><?php _e("MailPoet Lists", "gravity-forms-wysija") ?></th> 
    256                         </tr> 
    257                     </thead> 
    258  
    259                     <tfoot> 
    260                         <tr> 
    261                             <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th> 
    262                             <th scope="col" id="active" class="manage-column check-column"></th> 
    263                             <th scope="col" class="manage-column"><?php _e("Form", "gravity-forms-wysija") ?></th> 
    264                             <th scope="col" class="manage-column"><?php _e("MailPoet Lists", "gravity-forms-wysija") ?></th> 
    265                         </tr> 
    266                     </tfoot> 
    267  
    268                     <tbody class="list:user user-list"> 
    269                         <?php 
    270  
    271                         $settings = GFWysijaData::get_feeds(); 
    272                         if(is_array($settings) && sizeof($settings) > 0){ 
    273                             foreach($settings as $setting){ 
    274                                 ?> 
    275                                 <tr class='author-self status-inherit' valign="top"> 
    276                                     <th scope="row" class="check-column"><input type="checkbox" name="feed[]" value="<?php echo $setting["id"] ?>"/></th> 
    277                                     <td><img src="<?php echo self::get_base_url() ?>/images/active<?php echo intval($setting["is_active"]) ?>.png" alt="<?php echo $setting["is_active"] ? __("Active", "gravity-forms-wysija") : __("Inactive", "gravity-forms-wysija");?>" title="<?php echo $setting["is_active"] ? __("Active", "gravity-forms-wysija") : __("Inactive", "gravity-forms-wysija");?>" onclick="ToggleActive(this, <?php echo $setting['id'] ?>); " /></td> 
    278                                     <td class="column-title"> 
    279                                         <a href="admin.php?page=gf_wysija&view=edit&id=<?php echo $setting["id"] ?>" title="<?php _e("Edit", "gravity-forms-wysija") ?>"><?php echo $setting["form_title"] ?></a> 
    280                                         <div class="row-actions"> 
    281                                             <span class="edit"> 
    282                                             <a href="admin.php?page=gf_wysija&view=edit&id=<?php echo $setting["id"] ?>" title="<?php _e("Edit", "gravity-forms-wysija") ?>"><?php _e("Edit", "gravity-forms-wysija") ?></a> 
    283                                             | 
    284                                             </span> 
    285  
    286                                             <span class="trash"> 
    287                                             <a title="<?php _e("Delete", "gravity-forms-wysija") ?>" href="javascript: if(confirm('<?php _e("Delete this feed? ", "gravity-forms-wysija") ?> <?php _e("\'Cancel\' to stop, \'OK\' to delete.", "gravity-forms-wysija") ?>')){ DeleteSetting(<?php echo $setting["id"] ?>);}"><?php _e("Delete", "gravity-forms-wysija")?></a> 
    288  
    289                                             </span> 
    290                                         </div> 
    291                                     </td> 
    292                                     <td class="column-date"> 
    293                                     <?php 
    294                                         $str = ''; 
    295                                         $lists = self::get_wysija_lists(); 
    296                                         foreach( $lists as $l ) 
    297                                         { 
    298                                             if( in_array($l['list_id'], $setting['meta']['lists']) ) 
    299                                             { 
    300                                                 $str .= $l['name'].", "; 
    301                                             } 
    302                                         } 
    303                                         echo rtrim($str, ', '); 
    304                                     ?> 
    305  
    306                                     </td> 
    307                                 </tr> 
    308                                 <?php 
    309                             } 
    310                         } 
    311                         else{ 
    312                             ?> 
    313                             <tr> 
    314                                 <td colspan="4" style="padding:20px;"> 
    315                                     <?php _e(sprintf("You don't have any MailPoet Newsletter feeds configured. Let's go %screate one%s!", '<a href="admin.php?page=gf_wysija&view=edit&id=0">', "</a>"), "gravity-forms-wysija"); ?> 
    316                                 </td> 
    317                             </tr> 
    318                             <?php 
    319                         } 
    320                         ?> 
    321                     </tbody> 
    322                 </table> 
    323             </form> 
    324         </div> 
    325         <script type="text/javascript"> 
    326             function DeleteSetting(id){ 
    327                 jQuery("#action_argument").val(id); 
    328                 jQuery("#action").val("delete"); 
    329                 jQuery("#feed_form")[0].submit(); 
    330             } 
    331             function ToggleActive(img, feed_id){ 
    332                 var is_active = img.src.indexOf("active1.png") >=0 
    333                 if(is_active){ 
    334                     img.src = img.src.replace("active1.png", "active0.png"); 
    335                     jQuery(img).attr('title','<?php _e("Inactive", "gravity-forms-wysija") ?>').attr('alt', '<?php _e("Inactive", "gravity-forms-wysija") ?>'); 
    336                 } 
    337                 else{ 
    338                     img.src = img.src.replace("active0.png", "active1.png"); 
    339                     jQuery(img).attr('title','<?php _e("Active", "gravity-forms-wysija") ?>').attr('alt', '<?php _e("Active", "gravity-forms-wysija") ?>'); 
    340                 } 
    341  
    342                 var mysack = new sack(ajaxurl); 
    343                 mysack.execute = 1; 
    344                 mysack.method = 'POST'; 
    345                 mysack.setVar( "action", "rg_update_feed_active" ); 
    346                 mysack.setVar( "rg_update_feed_active", "<?php echo wp_create_nonce("rg_update_feed_active") ?>" ); 
    347                 mysack.setVar( "feed_id", feed_id ); 
    348                 mysack.setVar( "is_active", is_active ? 0 : 1 ); 
    349                 mysack.encVar( "cookie", document.cookie, false ); 
    350                 mysack.onError = function() { alert('<?php _e("Ajax error while updating feed", "gravity-forms-wysija" ) ?>' )}; 
    351                 mysack.runAJAX(); 
    352  
    353                 return true; 
    354             } 
    355         </script> 
    356         <?php 
    357     } 
    358  
    359     private static function edit_page(){ 
    360         ?> 
    361         <style> 
    362             .wysija_col_heading{padding-bottom:2px; border-bottom: 1px solid #ccc; font-weight:bold;} 
    363             .wysija_field_cell {min-width: 120px; padding: 6px 20px 0 0; margin-right:25px;} 
    364             .gfield_required{color:red;} 
    365  
    366             .feeds_validation_error{ background-color:#FFDFDF;} 
    367             .feeds_validation_error td{ margin-top:4px; margin-bottom:6px; padding-top:6px; padding-bottom:6px; border-top:1px dotted #C89797; border-bottom:1px dotted #C89797} 
    368  
    369             .left_header{float:left; width:200px;} 
    370             .margin_vertical_10{margin: 10px 0;} 
    371             #wysija_doubleoptin_warning{padding-left: 5px; padding-bottom:4px; font-size: 10px;} 
    372             .wysija_group_condition{padding-bottom:6px; padding-left:20px;} 
    373             .wysija_checkbox { margin-left: 203px; display: block; margin-bottom: 3px;} 
    374         </style> 
    375         <script type="text/javascript"> 
    376             var form = Array(); 
    377         </script> 
    378         <div class="wrap"> 
    379             <h2><?php _e("MailPoet Newsletter Feed", "gravity-forms-wysija") ?></h2> 
    380         <?php 
    381         //getting setting id (0 when creating a new one) 
    382         $id = !empty($_POST["wysija_setting_id"]) ? $_POST["wysija_setting_id"] : absint($_GET["id"]); 
    383         $default = array( 
    384             'meta' => array( 
    385                 'double_optin' => true, 
    386                 'is_active' => true, 
    387                 'lists' => array(), 
    388             ), 
    389             'is_active' => true, 
    390         ); 
    391         $config = empty($id) ? $default : GFWysijaData::get_feed($id); 
    392  
    393         //self::log_debug("Feed is set to: ".print_r($config, true)); 
    394  
    395         // Get details from survey if we have one 
    396         if (rgempty("list_id", $config["meta"])) 
    397         { 
    398             $merge_vars = array(); 
    399         } 
    400         else 
    401         { 
    402             $details = self::get_wysija_details(); 
    403         } 
    404  
    405         //updating meta information 
    406         if(rgpost("gf_wysija_submit")){ 
    407             //self::log_debug('Posting up on the block: '.print_r($_POST, true)); 
    408  
    409             $config["form_id"] = absint($_POST["gf_wysija_form"]); 
    410             $config["meta"]["lists"] = rgpost('gf_wysija_lists'); 
    411  
    412             $is_valid = true; 
    413             $details = self::get_wysija_details(); 
    414  
    415             $field_map = array(); 
    416             foreach($details as $k=>$v){ 
    417                 $field_name = "wysija_map_field_".$k; 
    418                 $mapped_field = stripslashes($_POST[$field_name]); 
    419  
    420                 if(!empty($mapped_field)){ 
    421                     $field_map[$k] = $mapped_field; 
    422                 } 
    423                 else{ 
    424                     unset($field_map[$k]); 
    425                     if( isset($v['required']) ){ 
    426                         $is_valid = false; 
    427                     } 
    428                 } 
    429             } 
    430  
    431             $config["meta"]["field_map"] = $field_map; 
    432             $config["meta"]["double_optin"] = rgpost("wysija_double_optin") ? true : false; 
    433             $config["meta"]["welcome_email"] = rgpost("wysija_welcome_email") ? true : false; 
    434  
    435             $config["meta"]["optin_enabled"] = rgpost("wysija_optin_enable") ? true : false; 
    436             $config["meta"]["optin_field_id"] = $config["meta"]["optin_enabled"] ? rgpost("wysija_optin_field_id") : ""; 
    437             $config["meta"]["optin_operator"] = $config["meta"]["optin_enabled"] ? rgpost("wysija_optin_operator") : ""; 
    438             $config["meta"]["optin_value"] = $config["meta"]["optin_enabled"] ? rgpost("wysija_optin_value") : ""; 
    439  
    440             if($is_valid){ 
    441                 $id = GFWysijaData::update_feed($id, $config["form_id"], $config["is_active"], $config["meta"]); 
    442                 ?> 
    443                 <div class="updated fade" style="padding:6px"><?php echo sprintf(__("Feed Updated. %sback to list%s", "gravity-forms-wysija"), "<a href='?page=gf_wysija'>", "</a>") ?></div> 
    444                 <input type="hidden" name="wysija_setting_id" value="<?php echo $id ?>"/> 
    445                 <?php 
    446             } 
    447             else{ 
    448                 ?> 
    449                 <div class="error" style="padding:6px"><?php echo __("Feed could not be updated. Please enter all required information below.", "gravity-forms-wysija") ?></div> 
    450                 <?php 
    451             } 
    452         } 
    453  
    454         ?> 
    455         <form method="post" action=""> 
    456             <input type="hidden" name="wysija_setting_id" value="<?php echo $id ?>"/> 
    457  
    458             <div id="wysija_form_container" valign="top" class="margin_vertical_10"> 
    459                 <label for="gf_wysija_form" class="left_header"><?php _e("Gravity Form", "gravity-forms-wysija"); ?> <?php gform_tooltip("wysija_gravity_form") ?></label> 
    460  
    461                 <select id="gf_wysija_form" name="gf_wysija_form" onchange="SelectForm(jQuery('#gf_wysija_list').val(), jQuery(this).val());"> 
    462                 <option value=""><?php _e("Select a form", "gravity-forms-wysija"); ?> </option> 
    463                 <?php 
    464                 $forms = RGFormsModel::get_forms(); 
    465                 foreach($forms as $form){ 
    466                     $selected = absint($form->id) == rgar($config,"form_id") ? "selected='selected'" : ""; 
    467                     ?> 
    468                     <option value="<?php echo absint($form->id) ?>"  <?php echo $selected ?>><?php echo esc_html($form->title) ?></option> 
    469                     <?php 
    470                 } 
    471                 ?> 
    472                 </select> 
    473                 &nbsp;&nbsp; 
    474                 <img src="<?php echo GFWysija::get_base_url() ?>/images/loading.gif" id="wysija_wait" style="display: none;"/> 
    475             </div> 
    476             <div id="wysija_field_group" valign="top" <?php echo empty($config["meta"]["lists"]) || empty($config["form_id"]) ? "style='display:none;'" : "" ?>> 
    477                 <div id="wysija_field_container" valign="top" class="margin_vertical_10" > 
    478                     <label for="wysija_fields" class="left_header"><?php _e("Map Fields", "gravity-forms-wysija"); ?> <?php gform_tooltip("wysija_map_fields") ?></label> 
    479  
    480                     <div id="wysija_field_list"> 
    481                     <?php 
    482                     if(!empty($config["form_id"])){ 
    483  
    484                         //getting list of all MailPoet details for the selected newsletter 
    485                         $details = self::get_wysija_details(); 
    486  
    487                         //getting field map UI 
    488                         echo self::get_field_mapping($config, $config["form_id"], $details); 
    489  
    490                         //getting list of selection fields to be used by the optin 
    491                         $form_meta = RGFormsModel::get_form_meta($config["form_id"]); 
    492                     } 
    493                     ?> 
    494                     </div> 
    495                 </div> 
    496                 <div class="margin_vertical_10"> 
    497                     <label for="gf_wysija_list" class="left_header"><?php _e("MailPoet Lists", "gravity-forms-wysija"); ?> <?php gform_tooltip("wysija_contact_list") ?></label> 
    498                     <?php 
    499  
    500                     //global wysija settings 
    501                     $settings = get_option("gf_wysija_settings"); 
    502  
    503                     //getting all MailPoet Newsletters 
    504                     $lists = self::get_wysija_lists(); 
    505  
    506                     if (!$lists): 
    507                         echo __("Could not load MailPoet lists.", "gravity-forms-wysija"); 
    508                         self::log_debug("Could not load MailPoet lists."); 
    509                     else: 
    510                         foreach ($lists as $l): 
    511                             $checked = (is_array($config['meta']['lists']) && in_array($l['list_id'], $config['meta']['lists'])) ? "checked='checked'" : ""; 
    512                             ?> 
    513                             <label class="wysija_checkbox"><input type="checkbox" name="gf_wysija_lists[]" value="<?php echo $l['list_id'] ?>" <?php echo $checked ?>> <?php echo $l['name'] ?></label> 
    514                             <?php 
    515                         endforeach; 
    516                     endif; 
    517                     ?> 
    518                 </div> 
    519  
    520                 <div id="wysija_optin_container" valign="top" class="margin_vertical_10"> 
    521                     <label for="wysija_optin" class="left_header"><?php _e("Opt-In Condition", "gravity-forms-wysija"); ?> <?php gform_tooltip("wysija_optin_condition") ?></label> 
    522                     <div id="wysija_optin"> 
    523                         <table> 
    524                             <tr> 
    525                                 <td> 
    526                                     <input type="checkbox" id="wysija_optin_enable" name="wysija_optin_enable" value="1" onclick="if(this.checked){jQuery('#wysija_optin_condition_field_container').show('slow');} else{jQuery('#wysija_optin_condition_field_container').hide('slow');}" <?php echo rgar($config["meta"],"optin_enabled") ? "checked='checked'" : ""?>/> 
    527                                     <label for="wysija_optin_enable"><?php _e("Enable", "gravity-forms-wysija"); ?></label> 
    528                                 </td> 
    529                             </tr> 
    530                             <tr> 
    531                                 <td> 
    532                                     <div id="wysija_optin_condition_field_container" <?php echo !rgar($config["meta"],"optin_enabled") ? "style='display:none'" : ""?>> 
    533                                         <div id="wysija_optin_condition_fields" style="display:none"> 
    534                                             <?php _e("Export to MailPoet if ", "gravity-forms-wysija") ?> 
    535                                             <select id="wysija_optin_field_id" name="wysija_optin_field_id" class='optin_select' onchange='jQuery("#wysija_optin_value_container").html(GetFieldValues(jQuery(this).val(), "", 20));'></select> 
    536                                             <select id="wysija_optin_operator" name="wysija_optin_operator" > 
    537                                                 <option value="is" <?php echo rgar($config["meta"], "optin_operator") == "is" ? "selected='selected'" : "" ?>><?php _e("is", "gravity-forms-wysija") ?></option> 
    538                                                 <option value="isnot" <?php echo rgar($config["meta"], "optin_operator") == "isnot" ? "selected='selected'" : "" ?>><?php _e("is not", "gravity-forms-wysija") ?></option> 
    539                                                 <option value=">" <?php echo rgar($config['meta'], 'optin_operator') == ">" ? "selected='selected'" : "" ?>><?php _e("greater than", "gravity-forms-wysija") ?></option> 
    540                                                 <option value="<" <?php echo rgar($config['meta'], 'optin_operator') == "<" ? "selected='selected'" : "" ?>><?php _e("less than", "gravity-forms-wysija") ?></option> 
    541                                                 <option value="contains" <?php echo rgar($config['meta'], 'optin_operator') == "contains" ? "selected='selected'" : "" ?>><?php _e("contains", "gravity-forms-wysija") ?></option> 
    542                                                 <option value="starts_with" <?php echo rgar($config['meta'], 'optin_operator') == "starts_with" ? "selected='selected'" : "" ?>><?php _e("starts with", "gravity-forms-wysija") ?></option> 
    543                                                 <option value="ends_with" <?php echo rgar($config['meta'], 'optin_operator') == "ends_with" ? "selected='selected'" : "" ?>><?php _e("ends with", "gravity-forms-wysija") ?></option> 
    544                                             </select> 
    545                                             <div id="wysija_optin_value_container" name="wysija_optin_value_container" style="display:inline;"></div> 
    546                                         </div> 
    547                                         <div id="wysija_optin_condition_message" style="display:none"> 
    548                                             <?php _e( 'To create an Opt-In condition, your form must have a field supported by conditional logic.', 'gravity-forms-wysija' ) ?> 
    549                                         </div> 
    550                                     </div> 
    551                                 </td> 
    552                             </tr> 
    553                         </table> 
    554                     </div> 
    555  
    556                     <script type="text/javascript"> 
    557                         <?php 
    558                         if(!empty($config["form_id"])){ 
    559                             ?> 
    560                             //creating Javascript form object 
    561                             form = <?php echo GFCommon::json_encode($form_meta)?> ; 
    562  
    563                             //initializing drop downs 
    564                             jQuery(document).ready(function(){ 
    565                                 var selectedField = "<?php echo str_replace('"', '\"', $config["meta"]["optin_field_id"])?>"; 
    566                                 var selectedValue = "<?php echo str_replace('"', '\"', $config["meta"]["optin_value"])?>"; 
    567                                 SetOptin(selectedField, selectedValue); 
    568  
    569                             }); 
    570                         <?php 
    571                         } 
    572                         ?> 
    573                     </script> 
    574                 </div> 
    575                 <?php /* Hide Options for now 
    576                 <div id="wysija_options_container" valign="top" class="margin_vertical_10"> 
    577                     <label for="wysija_options" class="left_header"><?php _e("Options", "gravity-forms-wysija"); ?></label> 
    578                     <div id="wysija_options"> 
    579                         <table> 
    580                             <tr><td><input type="checkbox" name="wysija_double_optin" id="wysija_double_optin" value="1" <?php echo rgar($config["meta"],"double_optin") ? "checked='checked'" : "" ?> onclick="var element = jQuery('#wysija_doubleoptin_warning'); if(this.checked){element.hide('slow');} else{element.show('slow');}"/> <?php _e("Double Opt-In" , "gravity-forms-wysija") ?>  <?php gform_tooltip("wysija_double_optin") ?> <br/><span id='wysija_doubleoptin_warning' <?php echo rgar($config["meta"], "double_optin") ? "style='display:none'" : "" ?>>(<?php _e("Abusing this may cause your MailPoet account to be suspended.", "gravity-forms-wysija") ?>)</span></td></tr> 
    581                             <tr><td><input type="checkbox" name="wysija_welcome_email" id="wysija_welcome_email" value="1" <?php echo rgar($config["meta"],"welcome_email") ? "checked='checked'" : "" ?>/> <?php _e("Send Welcome Email" , "gravity-forms-wysija") ?> <?php gform_tooltip("wysija_welcome") ?></td></tr> 
    582                         </table> 
    583                     </div> 
    584                 </div> 
    585                 */?> 
    586                 <div id="wysija_submit_container" class="margin_vertical_10"> 
    587                     <input type="submit" name="gf_wysija_submit" value="<?php echo empty($id) ? __("Save", "gravity-forms-wysija") : __("Update", "gravity-forms-wysija"); ?>" class="button-primary"/> 
    588                     <input type="button" value="<?php _e("Cancel", "gravity-forms-wysija"); ?>" class="button" onclick="javascript:document.location='admin.php?page=gf_wysija'" /> 
    589                 </div> 
    590             </div> 
    591         </form> 
    592         </div> 
    593         <script type="text/javascript"> 
    594  
    595             function SelectList(listId){ 
    596                 if(listId){ 
    597                     jQuery("#wysija_form_container").slideDown(); 
    598                     jQuery("#gf_wysija_form").val(""); 
    599                 } 
    600                 else{ 
    601                     jQuery("#wysija_form_container").slideUp(); 
    602                     EndSelectForm(""); 
    603                 } 
    604             } 
    605  
    606             function SelectForm(listId, formId){ 
    607                 if(!formId){ 
    608                     jQuery("#wysija_field_group").slideUp(); 
    609                     return; 
    610                 } 
    611  
    612                 jQuery("#wysija_wait").show(); 
    613                 jQuery("#wysija_field_group").slideUp(); 
    614  
    615                 var mysack = new sack(ajaxurl); 
    616                 mysack.execute = 1; 
    617                 mysack.method = 'POST'; 
    618                 mysack.setVar( "action", "gf_select_wysija_form" ); 
    619                 mysack.setVar( "gf_select_wysija_form", "<?php echo wp_create_nonce("gf_select_wysija_form") ?>" ); 
    620                 mysack.setVar( "list_id", listId); 
    621                 mysack.setVar( "form_id", formId); 
    622                 mysack.encVar( "cookie", document.cookie, false ); 
    623                 mysack.onError = function() {jQuery("#wysija_wait").hide(); alert('<?php _e("Ajax error while selecting a form", "gravity-forms-wysija") ?>' )}; 
    624                 mysack.runAJAX(); 
    625  
    626                 return true; 
    627             } 
    628  
    629             function SetOptin(selectedField, selectedValue){ 
    630  
    631                 //load form fields 
    632                 jQuery("#wysija_optin_field_id").html(GetSelectableFields(selectedField, 20)); 
    633                 var optinConditionField = jQuery("#wysija_optin_field_id").val(); 
    634  
    635                 if(optinConditionField){ 
    636                     jQuery("#wysija_optin_condition_message").hide(); 
    637                     jQuery("#wysija_optin_condition_fields").show(); 
    638                     jQuery("#wysija_optin_value_container").html(GetFieldValues(optinConditionField, selectedValue, 20)); 
    639                     jQuery("#wysija_optin_value").val(selectedValue); 
    640                 } 
    641                 else{ 
    642                     jQuery("#wysija_optin_condition_message").show(); 
    643                     jQuery("#wysija_optin_condition_fields").hide(); 
    644                 } 
    645             } 
    646  
    647             function EndSelectForm(fieldList, form_meta, grouping, groups){ 
    648                 //setting global form object 
    649                 form = form_meta; 
    650                 if(fieldList){ 
    651  
    652                     SetOptin("",""); 
    653  
    654                     jQuery("#wysija_field_list").html(fieldList); 
    655                     jQuery("#wysija_groupings").html(grouping); 
    656  
    657                     for(var i in groups) 
    658                         SetGroupCondition(groups[i]["main"], groups[i]["sub"],"",""); 
    659  
    660                     // Two tooltips now for GF 1.7.7 updates 
    661                     // qtip will be removed soon 
    662                     if( jQuery.fn.tooltip ) 
    663                     { 
    664                         jQuery( '.tooltip_wysija_groups' ).tooltip({ 
    665                             show: 500, 
    666                             hide: 1000, 
    667                             content: function () { 
    668                                 return jQuery(this).prop('title'); 
    669                             } 
    670                         }); 
    671                     } 
    672  
    673                     if( jQuery.fn.qtip ){ 
    674                         jQuery('.tooltip_wysija_groups').qtip({ 
    675                              content: jQuery('.tooltip_wysija_groups').attr('tooltip'), // Use the tooltip attribute of the element for the content 
    676                              show: { delay: 500, solo: true }, 
    677                              hide: { when: 'mouseout', fixed: true, delay: 200, effect: 'fade' }, 
    678                              style: "gformsstyle", 
    679                              position: { 
    680                               corner: { 
    681                                    target: "topRight", 
    682                                    tooltip: "bottomLeft" 
    683                                    } 
    684                               } 
    685                           }); 
    686                     } 
    687                     jQuery("#wysija_field_group").slideDown(); 
    688  
    689                 } 
    690                 else{ 
    691                     jQuery("#wysija_field_group").slideUp(); 
    692                     jQuery("#wysija_field_list").html(""); 
    693                 } 
    694                 jQuery("#wysija_wait").hide(); 
    695             } 
    696  
    697             function GetFieldValues(fieldId, selectedValue, labelMaxCharacters, inputName){ 
    698                 if(!inputName){ 
    699                     inputName = 'wysija_optin_value'; 
    700                 } 
    701  
    702                 if(!fieldId) 
    703                     return ""; 
    704  
    705                 var str = ""; 
    706                 var field = GetFieldById(fieldId); 
    707                 if(!field) 
    708                     return ""; 
    709  
    710                 var isAnySelected = false; 
    711  
    712                 if(field["type"] == "post_category" && field["displayAllCategories"]){ 
    713                     str += '<?php $dd = wp_dropdown_categories(array("class"=>"optin_select", "orderby"=> "name", "id"=> "wysija_optin_value", "name"=> "wysija_optin_value", "hierarchical"=>true, "hide_empty"=>0, "echo"=>false)); echo str_replace("\n","", str_replace("'","\\'",$dd)); ?>'; 
    714                 } 
    715                 else if(field.choices){ 
    716                     str += '<select id="' + inputName +'" name="' + inputName +'" class="optin_select">'; 
    717  
    718                     for(var i=0; i<field.choices.length; i++){ 
    719                         var fieldValue = field.choices[i].value ? field.choices[i].value : field.choices[i].text; 
    720                         var isSelected = fieldValue == selectedValue; 
    721                         var selected = isSelected ? "selected='selected'" : ""; 
    722                         if(isSelected) 
    723                             isAnySelected = true; 
    724  
    725                         str += "<option value='" + fieldValue.replace(/'/g, "&#039;") + "' " + selected + ">" + TruncateMiddle(field.choices[i].text, labelMaxCharacters) + "</option>"; 
    726                     } 
    727  
    728                     if(!isAnySelected && selectedValue){ 
    729                         str += "<option value='" + selectedValue.replace(/'/g, "&#039;") + "' selected='selected'>" + TruncateMiddle(selectedValue, labelMaxCharacters) + "</option>"; 
    730                     } 
    731                     str += "</select>"; 
    732                 } 
    733                 else 
    734                 { 
    735                     selectedValue = selectedValue ? selectedValue.replace(/'/g, "&#039;") : ""; 
    736                     //create a text field for fields that don't have choices (i.e text, textarea, number, email, etc...) 
    737                     str += "<input type='text' placeholder='<?php _e( "Enter value", "gravity-forms-wysija" ); ?>' id='" + inputName + "' name='" + inputName +"' value='" + selectedValue.replace(/'/g, "&#039;") + "'>"; 
    738                 } 
    739  
    740                 return str; 
    741             } 
    742  
    743             function GetFieldById(fieldId){ 
    744                 for(var i=0; i<form.fields.length; i++){ 
    745                     if(form.fields[i].id == fieldId) 
    746                         return form.fields[i]; 
    747                 } 
    748                 return null; 
    749             } 
    750  
    751             function TruncateMiddle(text, maxCharacters){ 
    752                 if(text.length <= maxCharacters) 
    753                     return text; 
    754                 var middle = parseInt(maxCharacters / 2); 
    755                 return text.substr(0, middle) + "..." + text.substr(text.length - middle, middle); 
    756             } 
    757  
    758             function GetSelectableFields(selectedFieldId, labelMaxCharacters){ 
    759                 var str = ""; 
    760                 var inputType; 
    761  
    762                 for(var i=0; i<form.fields.length; i++){ 
    763                     fieldLabel = form.fields[i].adminLabel ? form.fields[i].adminLabel : form.fields[i].label; 
    764                     inputType = form.fields[i].inputType ? form.fields[i].inputType : form.fields[i].type; 
    765                     if (IsConditionalLogicField(form.fields[i])) { 
    766                         var selected = form.fields[i].id == selectedFieldId ? "selected='selected'" : ""; 
    767                         str += "<option value='" + form.fields[i].id + "' " + selected + ">" + TruncateMiddle(fieldLabel, labelMaxCharacters) + "</option>"; 
    768                     } 
    769                 } 
    770                 return str; 
    771             } 
    772  
    773             function IsConditionalLogicField(field){ 
    774                 inputType = field.inputType ? field.inputType : field.type; 
    775                 var supported_fields = ["checkbox", "radio", "select", "text", "website", "textarea", 
    776                 "email", "hidden", "number", "phone", "multiselect", "post_title", 
    777                                         "post_tags", "post_custom_field", "post_content", "post_excerpt"]; 
    778  
    779                 var index = jQuery.inArray(inputType, supported_fields); 
    780  
    781                 return index >= 0; 
    782             } 
    783  
    784         </script> 
    785  
    786         <?php 
    787  
    788     } 
    789     public static function get_wysija_lists() 
    790     { 
    791         $data = array('name','list_id'); 
    792         $conditions = array('is_enabled'=>1); 
    793         $modelList = WYSIJA::get('list','model'); 
    794  
    795         return $modelList->get($data, $conditions); 
     44        GFAddOn::register( 'GFMailPoetAddon' ); 
    79645    } 
    79746 
    798     public static function add_permissions(){ 
    799         global $wp_roles; 
    800         $wp_roles->add_cap("administrator", "gravityforms_wysija"); 
    801         $wp_roles->add_cap("administrator", "gravityforms_wysija_uninstall"); 
    802     } 
    803  
    804     public static function selected($selected, $current){ 
    805         return $selected === $current ? " selected='selected'" : ""; 
    806     } 
    807  
    808     //Target of Member plugin filter. Provides the plugin with Gravity Forms lists of capabilities 
    809     public static function members_get_capabilities( $caps ) { 
    810         return array_merge($caps, array("gravityforms_wysija", "gravityforms_wysija_uninstall")); 
    811     } 
    812  
    813     public static function disable_wysija(){ 
    814         delete_option("gf_wysija_settings"); 
    815     } 
    816  
    817     public static function select_wysija_form(){ 
    818  
    819         check_ajax_referer("gf_select_wysija_form", "gf_select_wysija_form"); 
    820         $form_id =  intval(rgpost("form_id")); 
    821         $setting_id =  intval(rgpost("setting_id")); 
    822  
    823         //getting list of all MailPoet details for the selected contact list 
    824         $details = self::get_wysija_details(); 
    825  
    826         //getting configuration 
    827         $config = GFWysijaData::get_feed($setting_id); 
    828  
    829         //getting field map UI 
    830         $field_map = self::get_field_mapping($config, $form_id, $details); 
    831  
    832         // Escape quotes and strip extra whitespace and line breaks 
    833         $field_map = str_replace("'","\'",$field_map); 
    834         //$field_map = preg_replace('/[ \t]+/', ' ', preg_replace('/\s*$^\s*/m', "\n", $field_map)); 
    835  
    836         //getting list of selection fields to be used by the optin 
    837         $form_meta = RGFormsModel::get_form_meta($form_id); 
    838         $selection_fields = GFCommon::get_selection_fields($form_meta, rgars($config, "meta/optin_field_id")); 
    839         $group_condition = array(); 
    840         $group_names = array(); 
    841         $grouping = ''; 
    842  
    843         //fields meta 
    844         $form = RGFormsModel::get_form_meta($form_id); 
    845  
    846         die("EndSelectForm('".$field_map."', ".GFCommon::json_encode($form).", '" . str_replace("'", "\'", $grouping) . "', " . json_encode($group_names) . " );"); 
    847     } 
    848  
    849     private static function get_field_mapping($config, $form_id, $details){ 
    850  
    851         //getting list of all fields for the selected form 
    852         $form_fields = self::get_form_fields($form_id); 
    853  
    854         $str = "<table cellpadding='0' cellspacing='0'><tr><td class='wysija_col_heading'>" . __("MailPoet Fields", "gravity-forms-wysija") . "</td><td class='wysija_col_heading'>" . __("Form Fields", "gravity-forms-wysija") . "</td></tr>"; 
    855  
    856         if(!isset($config["meta"])) 
    857             $config["meta"] = array("field_map" => "", 'list_id'=>''); 
    858  
    859         foreach( $details as $k=>$v ) 
    860         { 
    861             $selected_field = rgar($config["meta"]["field_map"], $k); 
    862             $required = isset($v['required']) ? "<span class='gfield_required'>*</span>" : ''; 
    863             $error_class = isset($v['required']) && empty($selected_field) && !empty($_POST["gf_wysija_submit"]) ? " feeds_validation_error" : ""; 
    864             $str .= "<tr class='$error_class'><td class='wysija_field_cell'>".$v['name']." $required</td><td class='wysija_field_cell'>".self::get_mapped_field_list($k, $selected_field, $form_fields)."</td></tr>"; 
    865         } 
    866  
    867         $str .= "</table>"; 
    868  
    869         return $str; 
    870     } 
    871  
    872     public static function get_form_fields($form_id){ 
    873         $form = RGFormsModel::get_form_meta($form_id); 
    874         $fields = array(); 
    875  
    876         //Adding default fields 
    877         array_push($form["fields"],array("id" => "date_created" , "label" => __("Entry Date", "gravity-forms-wysija"))); 
    878         array_push($form["fields"],array("id" => "ip" , "label" => __("User IP", "gravity-forms-wysija"))); 
    879         array_push($form["fields"],array("id" => "source_url" , "label" => __("Source Url", "gravity-forms-wysija"))); 
    880         array_push($form["fields"],array("id" => "form_title" , "label" => __("Form Title", "gravity-forms-wysija"))); 
    881         $form = self::get_entry_meta($form); 
    882         if(is_array($form["fields"])){ 
    883             foreach($form["fields"] as $field){ 
    884                 if(is_array(rgar($field, "inputs"))){ 
    885  
    886                     //If this is an address field, add full name to the list 
    887                     if(RGFormsModel::get_input_type($field) == "address") 
    888                         $fields[] =  array($field["id"], GFCommon::get_label($field) . " (" . __("Full" , "gravity-forms-wysija") . ")"); 
    889  
    890                     foreach($field["inputs"] as $input) 
    891                         $fields[] =  array($input["id"], GFCommon::get_label($field, $input["id"])); 
    892                 } 
    893                 else if(!rgar($field,"displayOnly")){ 
    894                     $fields[] =  array($field["id"], GFCommon::get_label($field)); 
    895                 } 
    896             } 
    897         } 
    898         return $fields; 
    899     } 
    900  
    901     private static function get_entry_meta($form){ 
    902         $entry_meta = GFFormsModel::get_entry_meta($form["id"]); 
    903         $keys = array_keys($entry_meta); 
    904         foreach ($keys as $key){ 
    905             array_push($form["fields"],array("id" => $key , "label" => $entry_meta[$key]['label'])); 
    906         } 
    907         return $form; 
    908     } 
    909  
    910     private static function get_address($entry, $field_id){ 
    911         $street_value = str_replace("  ", " ", trim($entry[$field_id . ".1"])); 
    912         $street2_value = str_replace("  ", " ", trim($entry[$field_id . ".2"])); 
    913         $city_value = str_replace("  ", " ", trim($entry[$field_id . ".3"])); 
    914         $state_value = str_replace("  ", " ", trim($entry[$field_id . ".4"])); 
    915         $zip_value = trim($entry[$field_id . ".5"]); 
    916         $country_value = GFCommon::get_country_code(trim($entry[$field_id . ".6"])); 
    917  
    918         $address = $street_value; 
    919         $address .= !empty($address) && !empty($street2_value) ? "  $street2_value" : $street2_value; 
    920         $address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? "  $city_value" : $city_value; 
    921         $address .= !empty($address) && !empty($city_value) && !empty($state_value) ? "  $state_value" : $state_value; 
    922         $address .= !empty($address) && !empty($zip_value) ? "  $zip_value" : $zip_value; 
    923         $address .= !empty($address) && !empty($country_value) ? "  $country_value" : $country_value; 
    924  
    925         return $address; 
    926     } 
    927  
    928     public static function get_mapped_field_list($variable_name, $selected_field, $fields){ 
    929         $field_name = "wysija_map_field_" . $variable_name; 
    930         $str = "<select name='$field_name' id='$field_name'><option value=''></option>"; 
    931         foreach($fields as $field){ 
    932             $field_id = $field[0]; 
    933             $field_label = esc_html(GFCommon::truncate_middle($field[1], 40)); 
    934  
    935             $selected = $field_id == $selected_field ? "selected='selected'" : ""; 
    936             $str .= "<option value='" . $field_id . "' ". $selected . ">" . $field_label . "</option>"; 
    937         } 
    938         $str .= "</select>"; 
    939         return $str; 
    940     } 
    941  
    942     public static function export($entry, $form, $is_fulfilled = false){ 
    943  
    944         //Make sure MailPoet exists 
    945         if( !class_exists("WYSIJA") ) 
    946             return; 
    947  
    948         //loading data class 
    949         require_once(self::get_base_path() . "/inc/data.php"); 
    950  
    951         //getting all active feeds 
    952         $feeds = GFWysijaData::get_feed_by_form($form["id"], true); 
    953         foreach($feeds as $feed){ 
    954             //only export if user has opted in 
    955             if(self::is_optin($form, $feed, $entry)) 
    956             { 
    957                 self::export_feed($entry, $form, $feed); 
    958                 //updating meta to indicate this entry has already been subscribed to MailPoet. This will be used to prevent duplicate subscriptions. 
    959                 self::log_debug("Marking entry " . $entry["id"] . " as subscribed"); 
    960                 gform_update_meta($entry["id"], "wysija_is_subscribed", true); 
    961             } 
    962             else 
    963             { 
    964                 self::log_debug("Opt-in condition not met; not subscribing entry " . $entry["id"] . " to list"); 
    965             } 
    966         } 
    967     } 
    968  
    969     public static function has_wysija($form_id){ 
    970         if(!class_exists("GFWysijaData")) 
    971             require_once(self::get_base_path() . "/inc/data.php"); 
    972  
    973         //Getting settings associated with this form 
    974         $config = GFWysijaData::get_feed_by_form($form_id); 
    975  
    976         if(!$config) 
    977             return false; 
    978  
    979         return true; 
    980     } 
    981  
    982     // Magic goes here 
    983     public static function export_feed($entry, $form, $feed){ 
    984  
    985         $double_optin = $feed["meta"]["double_optin"] ? true : false; 
    986         $send_welcome = $feed["meta"]["welcome_email"] ? true : false; 
    987         $email_field_id = $feed["meta"]["field_map"]["email"]; 
    988  
    989         // Build parameter list of questions and values 
    990         $params = array( 
    991             'lists' => $feed['meta']['lists'], 
    992         ); 
    993  
    994         foreach( $feed['meta']['field_map'] as $k => $v ){ 
    995             $field = RGFormsModel::get_field($form, $v); 
    996             $params[$k] = apply_filters("gform_wysija_field_value", rgar($entry, $v), $form['id'], $v, $entry); 
    997         } 
    998  
    999         //self::log_debug('Params are: '.print_r($params, true)); 
    1000  
    1001         // Send info to MailPoet 
    1002         $data = array( 
    1003             'user'      => array( 
    1004                 'email' => $params['email'], 
    1005                 'firstname' => $params['first_name'], 
    1006                 'lastname' => $params['last_name'], 
    1007             ), 
    1008             'user_list' => array( 
    1009                 'list_ids' => $params['lists'], 
    1010             ) 
    1011         ); 
    1012  
    1013         $create_user = &WYSIJA::get('user','helper'); 
    1014         $create_user->addSubscriber($data); 
    1015  
    1016         // Should be done now 
    1017     } 
    1018  
    1019     public static function plugin_row() 
    1020     { 
    1021         if ( ! self::is_gravityforms_supported() || ! self::is_wysija_installed() ) 
    1022         { 
    1023             $message = sprintf( __( '%sGravity Forms%s 1.6.10 is required. Activate it now or %spurchase it today!%s', 'gravity-forms-wysija' ), '<a href="http://benjaminhays.com/gravityforms">', '</a>', '<a href="http://benjaminhays.com/gravityforms">', '</a>' ); 
    1024             $message .= '<br/>'.sprintf( __( 'MailPoet Newsletters plugin is required for this to work. %sDownload it now.%s', 'gravity-forms-wysija' ), '<a href="http://wordpress.org/extend/plugins/wysija-newsletters/">', '</a>' ); 
    1025             self::display_plugin_message( $message, true ); 
    1026         } 
    1027     } 
    1028  
    1029     public static function display_plugin_message($message, $is_error = false) 
    1030     { 
    1031         $style = ''; 
    1032         if($is_error) 
    1033         { 
    1034             $style = 'style="background-color: #ffebe8;"'; 
    1035         } 
    1036         echo '</tr><tr class="plugin-update-tr"><td colspan="5" class="plugin-update"><div class="update-message" ' . $style . '>' . $message . '</div></td>'; 
    1037     } 
    1038  
    1039     public static function uninstall(){ 
    1040  
    1041         //loading data lib 
    1042         require_once(self::get_base_path() . "/inc/data.php"); 
    1043  
    1044         if(!GFWysija::has_access("gravityforms_wysija_uninstall")) 
    1045             die(__("You don't have adequate permission to uninstall MailPoet Add-On.", "gravity-forms-wysija")); 
    1046  
    1047         //droping all tables 
    1048         GFWysijaData::drop_tables(); 
    1049  
    1050         //removing options 
    1051         delete_option("gf_wysija_settings"); 
    1052         delete_option("gf_wysija_version"); 
    1053  
    1054         //Deactivating plugin 
    1055         $plugin = "gravity-forms-wysija/wysija.php"; 
    1056         deactivate_plugins($plugin); 
    1057         update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated')); 
    1058     } 
    1059  
    1060     public static function is_optin($form, $settings, $entry){ 
    1061         $config = $settings["meta"]; 
    1062  
    1063         $field = RGFormsModel::get_field($form, $config["optin_field_id"]); 
    1064  
    1065         if(empty($field) || !$config["optin_enabled"]) 
    1066             return true; 
    1067  
    1068         $operator = isset($config["optin_operator"]) ? $config["optin_operator"] : ""; 
    1069         $field_value = RGFormsModel::get_field_value($field, array()); 
    1070         $is_value_match = RGFormsModel::is_value_match($field_value, $config["optin_value"], $operator); 
    1071         $is_visible = !RGFormsModel::is_field_hidden($form, $field, array(), $entry); 
    1072  
    1073         $is_optin = $is_value_match && $is_visible; 
    1074  
    1075         return $is_optin; 
    1076  
    1077     } 
    1078  
    1079     private static function get_wysija_details() 
    1080     { 
    1081         $ret = array( 
    1082             'first_name' => array('name' => 'First Name'), 
    1083             'last_name'  => array('name' => 'Last Name'), 
    1084             'email'      => array('name' => 'Email', 'required' => 1), 
    1085         ); 
    1086  
    1087         return $ret; 
    1088     } 
    1089  
    1090     private static function is_gravityforms_installed(){ 
    1091         return class_exists("RGForms"); 
    1092     } 
    1093  
    1094     private static function is_gravityforms_supported(){ 
    1095         if(class_exists("GFCommon")){ 
    1096             $is_correct_version = version_compare(GFCommon::$version, self::$min_gravityforms_version, ">="); 
    1097             return $is_correct_version; 
    1098         } 
    1099         else{ 
    1100             return false; 
    1101         } 
    1102     } 
    1103  
    1104     private static function is_wysija_installed(){ 
    1105         return class_exists("WYSIJA"); 
    1106     } 
    1107  
    1108     protected static function has_access($required_permission){ 
    1109         $has_members_plugin = function_exists('members_get_capabilities'); 
    1110         $has_access = $has_members_plugin ? current_user_can($required_permission) : current_user_can("level_7"); 
    1111         if($has_access) 
    1112             return $has_members_plugin ? $required_permission : "level_7"; 
    1113         else 
    1114             return false; 
    1115     } 
    1116  
    1117     // Clean strings from MailPoet, we don't need any HTML or line breaks 
    1118     protected function ws_clean($string){ 
    1119         $chars = array(" 
    1120 ", "\n", "\r", "chr(13)",  "\t", "\0", "\x0B"); 
    1121         $string = str_replace($chars, '', trim(strip_tags($string))); 
    1122         return $string; 
    1123     } 
    1124  
    1125     //Returns the url of the plugin's root folder 
    1126     protected function get_base_url(){ 
    1127         return plugins_url(null, __FILE__); 
    1128     } 
    1129  
    1130     //Returns the physical path of the plugin's root folder 
    1131     protected static function get_base_path(){ 
    1132         $folder = basename(dirname(__FILE__)); 
    1133         return WP_PLUGIN_DIR . "/" . $folder; 
    1134     } 
    1135  
    1136     function set_logging_supported($plugins) 
    1137     { 
    1138         $plugins[self::$slug] = "MailPoet"; 
    1139         return $plugins; 
    1140     } 
    1141  
    1142     private static function log_error($message){ 
    1143         if(class_exists("GFLogging")) 
    1144         { 
    1145             GFLogging::include_logger(); 
    1146             GFLogging::log_message(self::$slug, $message, KLogger::ERROR); 
    1147         } 
    1148     } 
    1149  
    1150     private static function log_debug($message){ 
    1151         if(class_exists("GFLogging")) 
    1152         { 
    1153             GFLogging::include_logger(); 
    1154             GFLogging::log_message(self::$slug, $message, KLogger::DEBUG); 
    1155         } 
    1156     } 
    115747} 
    115848 
    1159 if(!function_exists("rgget")){ 
    1160 function rgget($name, $array=null){ 
    1161     if(!isset($array)) 
    1162         $array = $_GET; 
    1163  
    1164     if(isset($array[$name])) 
    1165         return $array[$name]; 
    1166  
    1167     return ""; 
    1168 } 
     49function gf_mailpoet_feed_addon() { 
     50    return GFMailPoetAddOn::get_instance(); 
    116951} 
    117052 
    1171 if(!function_exists("rgpost")){ 
    1172 function rgpost($name, $do_stripslashes=true){ 
    1173     if(isset($_POST[$name])) 
    1174         return $do_stripslashes ? stripslashes_deep($_POST[$name]) : $_POST[$name]; 
    1175  
    1176     return ""; 
    1177 } 
     53register_activation_hook(__FILE__, 'gf_mailpoet_plugin_activation'); 
     54function gf_mailpoet_plugin_activation() { 
     55    $notices= get_option('gf_mailpoet_plugin_deferred_admin_notices', array()); 
     56    $notices[]= __("<strong>Gravity Forms MailPoet Add-on notice</strong> <br/><br/><strong>Update all your MailPoet feeds</strong> after upgrading to version 2.0.</br><br/> This add-on now uses the updated Gravity Forms feed settings, which allows you to set feeds individually for each form. Go to Form Settings -> MailPoet to create your feeds for a given form.", 'gravity-forms-wysija'); 
     57    update_option('gf_mailpoet_plugin_deferred_admin_notices', $notices); 
    117858} 
    117959 
    1180 if(!function_exists("rgar")){ 
    1181 function rgar($array, $name){ 
    1182     if(isset($array[$name])) 
    1183         return $array[$name]; 
    1184  
    1185     return ''; 
    1186 } 
     60add_action('admin_notices', 'gf_mailpoet_plugin_admin_notices'); 
     61function gf_mailpoet_plugin_admin_notices() { 
     62    if ($notices = get_option('gf_mailpoet_plugin_deferred_admin_notices')) { 
     63        foreach ($notices as $notice) { 
     64            echo "<div class='notice notice-warning is-dismissable'><p>$notice</p></div>"; 
     65        } 
     66        delete_option('gf_mailpoet_plugin_deferred_admin_notices'); 
     67    } 
    118768} 
    118869 
    1189 if(!function_exists("rgempty")){ 
    1190 function rgempty($name, $array = null){ 
    1191     if(!$array) 
    1192         $array = $_POST; 
    1193  
    1194     $val = rgget($name, $array); 
    1195     return empty($val); 
     70register_deactivation_hook(__FILE__, 'gf_mailpoet_plugin_deactivation'); 
     71function gf_mailpoet_plugin_deactivation() { 
     72    delete_option('gf_mailpoet_plugin_deferred_admin_notices'); 
    119673} 
    1197 } 
    1198  
    1199 if(!function_exists("rgblank")){ 
    1200 function rgblank($text){ 
    1201     return empty($text) && strval($text) != "0"; 
    1202 } 
    1203 } 
    1204  
    1205 ?> 
  • gravity-forms-wysija-add-on/trunk/languages/gravity-forms-wysija.pot

    r732511 r1507041  
    1 # This file is distributed under the same license as the Gravity Forms Wysija Newsletters package. 
     1#, fuzzy 
    22msgid "" 
    33msgstr "" 
    4 "PO-Revision-Date: 2013-06-26 23:19:00+0000\n" 
     4"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 
     5"Project-Id-Version: Gravity Forms MailPoet Add-on\n" 
     6"POT-Creation-Date: 2016-07-31 11:24+0800\n" 
     7"PO-Revision-Date: 2016-07-31 11:24+0800\n" 
     8"Last-Translator: \n" 
     9"Language-Team: \n" 
    510"MIME-Version: 1.0\n" 
    611"Content-Type: text/plain; charset=UTF-8\n" 
    712"Content-Transfer-Encoding: 8bit\n" 
    8 "Plural-Forms: nplurals=2; plural=n != 1;\n" 
    9 "X-Generator: GlotPress/0.1\n" 
    10 "Project-Id-Version: Gravity Forms Wysija Newsletters\n" 
     13"X-Generator: Poedit 1.8.8\n" 
     14"X-Poedit-Basepath: ..\n" 
     15"X-Poedit-WPHeader: gravity-forms-wysija.php\n" 
     16"X-Poedit-SourceCharset: UTF-8\n" 
     17"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" 
     18"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" 
     19"_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 
     20"X-Poedit-SearchPath-0: .\n" 
     21"X-Poedit-SearchPathExcluded-0: *.js\n" 
    1122 
    12 #: gravity-forms-wysija.php:166 gravity-forms-wysija.php:253 
    13 #: gravity-forms-wysija.php:262 gravity-forms-wysija.php:495 
    14 msgid "Wysija Lists" 
     23#: class-gfmailpoetaddon.php:53 
     24msgid "Where did my feeds go?" 
    1525msgstr "" 
    1626 
    17 #: gravity-forms-wysija.php:166 
    18 msgid "Select the Wysija lists you would like to add your contacts to." 
     27#: class-gfmailpoetaddon.php:54 
     28msgid "" 
     29"Your feeds for MailPoet can now be found under each form, under <strong>Form " 
     30"Settings -> MailPoet</strong>." 
    1931msgstr "" 
    2032 
    21 #: gravity-forms-wysija.php:167 gravity-forms-wysija.php:457 
    22 msgid "Gravity Form" 
     33#: class-gfmailpoetaddon.php:55 
     34msgid "Add your feeds now" 
    2335msgstr "" 
    2436 
    25 #: gravity-forms-wysija.php:167 
    26 msgid "Select the Gravity Form you would like to integrate with Wysija. Contacts generated by this form will be automatically added the selected Wysija lists." 
     37#: class-gfmailpoetaddon.php:128 
     38msgid "MailPoet Feed Settings" 
    2739msgstr "" 
    2840 
    29 #: gravity-forms-wysija.php:168 
    30 msgid "Send Welcome Email" 
     41#: class-gfmailpoetaddon.php:131 
     42msgid "Feed name" 
    3143msgstr "" 
    3244 
    33 #: gravity-forms-wysija.php:168 
    34 msgid "When this option is enabled, users will receive an automatic welcome email from Wysija upon being added to your Wysija list." 
    35 msgstr "" 
    36  
    37 #: gravity-forms-wysija.php:169 gravity-forms-wysija.php:476 
     45#: class-gfmailpoetaddon.php:138 
    3846msgid "Map Fields" 
    3947msgstr "" 
    4048 
    41 #: gravity-forms-wysija.php:169 
    42 msgid "Associate your Wysija newsletter questions to the appropriate Gravity Form fields by selecting." 
     49#: class-gfmailpoetaddon.php:140 
     50msgid "" 
     51"Associate your MailPoet newsletter questions to the appropriate Gravity Form " 
     52"fields by selecting." 
    4353msgstr "" 
    4454 
    45 #: gravity-forms-wysija.php:170 gravity-forms-wysija.php:519 
    46 msgid "Opt-In Condition" 
     55#: class-gfmailpoetaddon.php:144 
     56msgid "First Name" 
    4757msgstr "" 
    4858 
    49 #: gravity-forms-wysija.php:170 
    50 msgid "When the opt-in condition is enabled, form submissions will only be exported to Wysija when the condition is met. When disabled all form submissions will be exported." 
     59#: class-gfmailpoetaddon.php:149 
     60msgid "Last Name" 
    5161msgstr "" 
    5262 
    53 #: gravity-forms-wysija.php:171 
    54 msgid "Double Opt-In" 
     63#: class-gfmailpoetaddon.php:154 
     64msgid "Email" 
    5565msgstr "" 
    5666 
    57 #: gravity-forms-wysija.php:171 
    58 msgid "When the double opt-in option is enabled, Wysija will send a confirmation email to the user and will only add them to your Wysija list upon confirmation." 
     67#: class-gfmailpoetaddon.php:163 
     68msgid "Condition" 
    5969msgstr "" 
    6070 
    61 #: gravity-forms-wysija.php:182 
    62 msgid "Wysija" 
     71#: class-gfmailpoetaddon.php:165 
     72msgid "Enable Condition" 
    6373msgstr "" 
    6474 
    65 #: gravity-forms-wysija.php:207 
    66 msgid "Feed deleted." 
     75#: class-gfmailpoetaddon.php:166 
     76msgid "Process this feed if" 
    6777msgstr "" 
    6878 
    69 #: gravity-forms-wysija.php:218 
    70 msgid "Feeds deleted." 
     79#: class-gfmailpoetaddon.php:180 
     80msgid "Name" 
    7181msgstr "" 
    7282 
    73 #: gravity-forms-wysija.php:225 
    74 msgid "Wysija Newsletter Feeds" 
     83#: class-gfmailpoetaddon.php:181 class-gfmailpoetaddon.php:217 
     84msgid "MailPoet Lists" 
    7585msgstr "" 
    7686 
    77 #: gravity-forms-wysija.php:226 
    78 msgid "Add New" 
     87#: class-gfmailpoetaddon.php:219 
     88msgid "Select the MailPoet lists you would like to add your contacts to." 
    7989msgstr "" 
    8090 
    81 #: gravity-forms-wysija.php:237 gravity-forms-wysija.php:239 
    82 msgid "Bulk action" 
     91#: class-gfmailpoetaddon.php:224 
     92msgid "Could not load MailPoet lists." 
    8393msgstr "" 
    8494 
    85 #: gravity-forms-wysija.php:240 gravity-forms-wysija.php:285 
    86 msgid "Delete" 
     95#: gravity-forms-wysija.php:56 
     96msgid "" 
     97"<strong>Gravity Forms MailPoet Add-on notice</strong> <br/><br/" 
     98"><strong>Update all your MailPoet feeds</strong> after upgrading to version " 
     99"2.0.</br><br/> This add-on now uses the updated Gravity Forms feed settings, " 
     100"which allows you to set feeds individually for each form. Go to Form " 
     101"Settings -> MailPoet to create your feeds for a given form." 
    87102msgstr "" 
    88103 
    89 #: gravity-forms-wysija.php:243 
    90 msgid "Apply" 
     104#. Plugin Name of the plugin/theme 
     105msgid "Gravity Forms MailPoet Add-on" 
    91106msgstr "" 
    92107 
    93 #: gravity-forms-wysija.php:243 
    94 msgid "Delete selected feeds? " 
    95 msgstr "" 
    96  
    97 #: gravity-forms-wysija.php:243 gravity-forms-wysija.php:285 
    98 msgid "\\'Cancel\\' to stop, \\'OK\\' to delete." 
    99 msgstr "" 
    100  
    101 #: gravity-forms-wysija.php:252 gravity-forms-wysija.php:261 
    102 msgid "Form" 
    103 msgstr "" 
    104  
    105 #: gravity-forms-wysija.php:275 gravity-forms-wysija.php:337 
    106 msgid "Active" 
    107 msgstr "" 
    108  
    109 #: gravity-forms-wysija.php:275 gravity-forms-wysija.php:333 
    110 msgid "Inactive" 
    111 msgstr "" 
    112  
    113 #: gravity-forms-wysija.php:277 gravity-forms-wysija.php:280 
    114 msgid "Edit" 
    115 msgstr "" 
    116  
    117 #: gravity-forms-wysija.php:285 
    118 msgid "Delete this feed? " 
    119 msgstr "" 
    120  
    121 #: gravity-forms-wysija.php:348 
    122 msgid "Ajax error while updating feed" 
    123 msgstr "" 
    124  
    125 #: gravity-forms-wysija.php:377 
    126 msgid "Wysija Newsletter Feed" 
    127 msgstr "" 
    128  
    129 #: gravity-forms-wysija.php:441 
    130 msgid "Feed Updated. %sback to list%s" 
    131 msgstr "" 
    132  
    133 #: gravity-forms-wysija.php:447 
    134 msgid "Feed could not be updated. Please enter all required information below." 
    135 msgstr "" 
    136  
    137 #: gravity-forms-wysija.php:460 
    138 msgid "Select a form" 
    139 msgstr "" 
    140  
    141 #: gravity-forms-wysija.php:505 
    142 msgid "Could not load Wysija lists." 
    143 msgstr "" 
    144  
    145 #: gravity-forms-wysija.php:525 
    146 msgid "Enable" 
    147 msgstr "" 
    148  
    149 #: gravity-forms-wysija.php:532 
    150 msgid "Export to Wysija if " 
    151 msgstr "" 
    152  
    153 #: gravity-forms-wysija.php:535 
    154 msgid "is" 
    155 msgstr "" 
    156  
    157 #: gravity-forms-wysija.php:536 
    158 msgid "is not" 
    159 msgstr "" 
    160  
    161 #: gravity-forms-wysija.php:537 
    162 msgid "greater than" 
    163 msgstr "" 
    164  
    165 #: gravity-forms-wysija.php:538 
    166 msgid "less than" 
    167 msgstr "" 
    168  
    169 #: gravity-forms-wysija.php:539 
    170 msgid "contains" 
    171 msgstr "" 
    172  
    173 #: gravity-forms-wysija.php:540 
    174 msgid "starts with" 
    175 msgstr "" 
    176  
    177 #: gravity-forms-wysija.php:541 
    178 msgid "ends with" 
    179 msgstr "" 
    180  
    181 #: gravity-forms-wysija.php:546 
    182 msgid "To create an Opt-In condition, your form must have a field supported by conditional logic." 
    183 msgstr "" 
    184  
    185 #: gravity-forms-wysija.php:585 
    186 msgid "Save" 
    187 msgstr "" 
    188  
    189 #: gravity-forms-wysija.php:585 
    190 msgid "Update" 
    191 msgstr "" 
    192  
    193 #: gravity-forms-wysija.php:586 
    194 msgid "Cancel" 
    195 msgstr "" 
    196  
    197 #: gravity-forms-wysija.php:621 
    198 msgid "Ajax error while selecting a form" 
    199 msgstr "" 
    200  
    201 #: gravity-forms-wysija.php:722 
    202 msgid "Enter value" 
    203 msgstr "" 
    204  
    205 #: gravity-forms-wysija.php:840 
    206 msgid "Wysija Fields" 
    207 msgstr "" 
    208  
    209 #: gravity-forms-wysija.php:840 
    210 msgid "Form Fields" 
    211 msgstr "" 
    212  
    213 #: gravity-forms-wysija.php:863 
    214 msgid "Entry Date" 
    215 msgstr "" 
    216  
    217 #: gravity-forms-wysija.php:864 
    218 msgid "User IP" 
    219 msgstr "" 
    220  
    221 #: gravity-forms-wysija.php:865 
    222 msgid "Source Url" 
    223 msgstr "" 
    224  
    225 #: gravity-forms-wysija.php:866 
    226 msgid "Form Title" 
    227 msgstr "" 
    228  
    229 #: gravity-forms-wysija.php:874 
    230 msgid "Full" 
    231 msgstr "" 
    232  
    233 #: gravity-forms-wysija.php:1009 
    234 msgid "%sGravity Forms%s 1.6.10 is required. Activate it now or %spurchase it today!%s" 
    235 msgstr "" 
    236  
    237 #: gravity-forms-wysija.php:1010 
    238 msgid "Wysija Newsletters plugin is required for this to work. %sDownload it now.%s" 
    239 msgstr "" 
    240  
    241 #: gravity-forms-wysija.php:1031 
    242 msgid "You don't have adequate permission to uninstall Wysija Add-On." 
    243 msgstr "" 
    244  
    245 #: gravity-forms-wysija.php:0 
    246 msgid "Gravity Forms Wysija Add-on" 
    247 msgstr "" 
    248  
    249 #: gravity-forms-wysija.php:0 
     108#. Plugin URI of the plugin/theme 
    250109msgid "https://github.com/bhays/gravity-forms-wysija" 
    251110msgstr "" 
    252111 
    253 #: gravity-forms-wysija.php:0 
    254 msgid "Integrates the Gravity Forms plugin with the Wysija plugin, creating a menage-a-plugin." 
     112#. Description of the plugin/theme 
     113msgid "" 
     114"Integrates the Gravity Forms plugin with the MailPoet Newsletters plugin, " 
     115"creating a menage-a-plugin." 
    255116msgstr "" 
    256117 
    257 #: gravity-forms-wysija.php:0 
     118#. Author of the plugin/theme 
    258119msgid "Ben Hays" 
    259120msgstr "" 
    260121 
    261 #: gravity-forms-wysija.php:0 
     122#. Author URI of the plugin/theme 
    262123msgid "http://benhays.com" 
    263124msgstr "" 
    264  
    265 #: gravity-forms-wysija.php:0 
    266 msgid "1.1" 
    267 msgstr "" 
  • gravity-forms-wysija-add-on/trunk/readme.txt

    r1261824 r1507041  
    44Tags: gravity forms, gravityforms, wysija, wysija newsletters, mail poet, 
    55Requires at least: 3.3 
    6 Tested up to: 4.3.1 
    7 Stable tag: 1.4.1 
     6Tested up to: 4.5.3 
     7Stable tag: 2.0 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    1515Create Mail Poet Newsletter subscribers from Gravity Form entires. 
    1616 
    17 Requires Gravity Forms version 1.6.10 or higher. 
     17Requires Gravity Forms version 1.9.16 or higher. 
    1818 
    1919Thanks to Dave at Deckerweb - http://deckerweb.de - for i18n enhancements and German translation 
     
    24242. Create a form with the appropriate fields via Gravity Forms 
    25253. Setup Mail Poet Newsletters with one or many lists 
    26 4. Navigate to Forms->Mail Poet to setup feeds linking your forms and lists 
     264. Navigate to a form then select MailPoet under Settings and setup your feeds 
    2727 
    2828== Frequently asked questions == 
     
    3131 
    3232== Changelog == 
     33 
     34### 2.0 
     35* Make use of the GFFeedAddOn class 
    3336 
    3437### 1.4.1 
     
    5558 
    5659== Upgrade notice == 
     60= 2.0 = 
     61This update requires that you create new feeds for your forms. 
Note: See TracChangeset for help on using the changeset viewer.