Plugin Directory

Changeset 1134670


Ignore:
Timestamp:
04/14/2015 05:21:21 PM (11 years ago)
Author:
FreshMail.com
Message:

popup bug fixed

Location:
freshmail-newsletter/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • freshmail-newsletter/trunk/CHANGELOG.md

    r1116142 r1134670  
    11### Changelog
     2
     3- 1.5.6 - 2015-04-14
     4    * Fix: fixed issue with popup
    25
    36- 1.5.5 - 2015-03-18
  • freshmail-newsletter/trunk/include/display_popup.php

    r1081877 r1134670  
    2222function fm_add_popup_to_header()
    2323{
    24 
    2524    global $wpdb;
    2625    $results = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.'fm_forms', OBJECT);
     
    2928    foreach ($results as $key => $val) {
    3029        $form_var = unserialize($val->freshmail_form_var);
    31         $postType = get_post_type( get_the_ID());
    32         if(($postType == 'page') ) {
    33             if (!isset($form_var['allowed_pages']) || !in_array(get_the_ID(), $form_var['allowed_pages']))
    34             {
     30        $postType = get_post_type(get_the_ID());
     31        if (($postType == 'page')) {
     32            if (!isset($form_var['allowed_pages']) || !in_array(get_the_ID(), $form_var['allowed_pages'])) {
    3533                break;
    3634            }
    3735        } elseif ($postType == 'post') {
    38             if(!isset($form_var['allowed_main_posts']) || !in_array(get_the_ID(), $form_var['allowed_main_posts']))
    39             {
     36            if (!isset($form_var['allowed_main_posts']) || !in_array(get_the_ID(), $form_var['allowed_main_posts'])) {
    4037                break;
    4138            }
    42         }   elseif ($postType == 'product') {
    43             if(!isset($form_var['allowed_products']) || !in_array(get_the_ID(), $form_var['allowed_products']))
    44             {
     39        } elseif ($postType == 'product') {
     40            if (!isset($form_var['allowed_products']) || !in_array(get_the_ID(), $form_var['allowed_products'])) {
    4541                break;
    4642            }
     
    5147        $allowedPages = array_merge((isset($form_var['allowed_pages']) ? $form_var['allowed_pages'] : array()), (isset($form_var['allowed_main_posts']) ? $form_var['allowed_main_posts'] : array()));
    5248        $allowedPages = array_merge($allowedPages, (isset($form_var['allowed_products']) ? $form_var['allowed_products'] : array()));
    53             /* check if page/post is allowed to display pop-up */
    54         if(!in_array(get_the_ID(), $allowedPages)) {
     49        /* check if page/post is allowed to display pop-up */
     50        if (!in_array(get_the_ID(), $allowedPages)) {
    5551            break;
    5652        }
    5753
    58         if(isset($_SESSION['fm_form_popup'][$val->form_id]['count'])) {
     54        if (isset($_SESSION['fm_form_popup'][$val->form_id]['count'])) {
    5955            $_SESSION['fm_form_popup'][$val->form_id]['count'] += 1;;
    6056        } else {
     
    9894                    $javascript_included = true; ?>
    9995                    <script type="text/javascript">
    100                         jQuery(document).ready(function() {
    101                             jQuery(document).bind("mousemove", function(event) {
    102                                 if (event.pageY < 15) {
     96                        jQuery(document).ready(function(){
     97                            jQuery(document).bind("mousemove", function(event){
     98                                if(event.pageY < 15){
    10399                                    jQuery("#fm_popup_<?php echo $val->form_id; ?>").dialog({ modal: true, resizable: false, draggable: false, autoOpen: false, width: 'auto', dialogClass: 'freshmail_dialog' });
    104100                                    jQuery("#fm_popup_<?php echo $val->form_id; ?>").parent().css({position: "fixed"}).end().dialog('open');
     
    119115                        $form_var['sec_min'][0] = $form_var['sec_min'][0] / 60;
    120116                    }
    121                     $javascript_included = true;
    122                     ?>
    123                     <script type="text/javascript">
    124                         jQuery(document).ready(function() {
     117                    $javascript_included = true; ?>
     118                    <script type="text/javascript">
     119                        jQuery(document).ready(function(){
    125120                            console.log('FreshMail - show pop-ups after <?php echo $form_var['sec_min'][0]; ?>seconds.');
    126                             setTimeout(function() {
     121                            setTimeout(function(){
    127122                                console.log('FreshMail - form <?php echo $val->form_id; ?> opened.');
    128123                                jQuery("#fm_popup_<?php echo $val->form_id; ?>").dialog({ modal: true, resizable: false, draggable: false, autoOpen: false, width: 'auto', dialogClass: 'freshmail_dialog' });
     
    136131
    137132                if ($form_var['when_to_show'] == "per_px") {
    138                     $javascript_included = true;
    139                     ?>
    140                     <script type="text/javascript">
    141                         jQuery(document).ready(function() {
     133                    $javascript_included = true; ?>
     134                    <script type="text/javascript">
     135                        window.showFreshmailPopup = true;
     136                        jQuery(document).ready(function(){
    142137                            console.log('FreshMail - show pop-ups after <?php echo $form_var['per_px'][0].' '.$form_var['per_px'][1]; ?> scrolled.');
    143                             jQuery(document).bind("scroll", function(event) {
    144                                 var max =<?php
     138                            jQuery(document).bind("scroll", function(event){
     139                                var max = <?php
    145140                                if ($form_var['per_px'][1]=="percent") {
    146141                                    echo "jQuery(document).height() * ".($form_var['per_px'][0]/100);
    147142                                } else {
    148143                                    echo $form_var['per_px'][0];
    149                                 }
    150                                 ?>;
    151                                 if ((jQuery(document).scrollTop() + jQuery(window).height()) > max) {
     144                                }   ?>;
     145                                if((jQuery(document).scrollTop() + jQuery(window).height()) > max && window.showFreshmailPopup == true){
    152146                                    console.log('FreshMail - form <?php echo $val->form_id; ?> opened after ' + jQuery(window).scrollTop() + 'px scrolled. <?php echo $form_var['per_px'][0].' '.$form_var['per_px'][1]; ?> - ' + max);
    153147                                    jQuery("#fm_popup_<?php echo $val->form_id; ?>").dialog({ modal: true, resizable: false, draggable: false, autoOpen: false, width: 'auto', dialogClass: 'freshmail_dialog' });
    154148                                    jQuery("#fm_popup_<?php echo $val->form_id; ?>").parent().css({position: "fixed"}).end().dialog('open');
    155149                                    jQuery.post(static_var.ajax, {'action': 'popup_show', 'form_id':<?php echo $val->form_id; ?>});
    156                                     jQuery(document).unbind("scroll");
     150                                    window.showFreshmailPopup = false;
    157151                                }
    158152                            });
     
    166160                    $javascript_included = true; ?>
    167161                    <script type="text/javascript">
    168                         jQuery(document).ready(function() {
     162                        jQuery(document).ready(function(){
    169163                            jQuery("#fm_popup_<?php echo $val->form_id; ?>").dialog({ modal: true, resizable: false, draggable: false, autoOpen: false, width: 'auto', dialogClass: 'freshmail_dialog' });
    170164                            jQuery("#fm_popup_<?php echo $val->form_id; ?>").parent().css({position: "fixed"}).end().dialog('open');
     
    178172    }
    179173
    180     echo "
    181 <!-- END FRESHMAIL POPUPS JAVASCRIPT CODE -->
    182 ";
     174    echo "<!-- END FRESHMAIL POPUPS JAVASCRIPT CODE -->";
    183175
    184176}
     
    186178function fm_add_popup_to_footer()
    187179{
    188 
    189180    global $wpdb;
    190181    $results = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.'fm_forms', OBJECT);
     
    233224            }
    234225
    235             if ($show_popup) {
    236                 ?>
     226            if ($show_popup) {  ?>
    237227
    238228                <!-- FRESHMAIL POPUPS -->
    239229                <div id="fm_popup_<?php echo $val->form_id; ?>" class="freshmail_popup">
    240         <?php echo do_shortcode('[FM_form'.$shortcode_atts.' id="'.$val->form_id.'"]'); ?>
    241     </div>
     230                    <?php echo do_shortcode('[FM_form'.$shortcode_atts.' id="'.$val->form_id.'"]'); ?>
     231                </div>
    242232                <div class="fm_popup_pos">&nbsp;</div>
    243233                <!-- END FRESHMAIL POPUPS -->
     
    247237        }
    248238    }
    249 
    250239}
    251240
  • freshmail-newsletter/trunk/wp-freshmail.php

    r1116142 r1134670  
    44 * Plugin URI: http://freshmail.com/plugin/wordpress-newsletter/
    55 * Description: FreshMail is an email marketing tool for creating and sending amazing newsletters. Our intuitive system leads users from campaign planning and creation to final reports. A free account lets you send up to 2000 messages to a maximum of 500 recipients each month.
    6  * Version: 1.5.5
     6 * Version: 1.5.6
    77 * Author: Borbis Media
    88 * Author URI: http://www.borbis.com
     
    2121// Define plugin version for upgrade
    2222if (!defined('WP_FRESHMAIL_VERSION')) {
    23     define('WP_FRESHMAIL_VERSION', '1.5.5');
     23    define('WP_FRESHMAIL_VERSION', '1.5.6');
    2424}
    2525
Note: See TracChangeset for help on using the changeset viewer.