Plugin Directory

Changeset 1675072


Ignore:
Timestamp:
06/09/2017 08:23:20 PM (9 years ago)
Author:
botosubdev
Message:

modal type added

Location:
botosub/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • botosub/trunk/botosub.php

    r1673372 r1675072  
    44Plugin URI: https://www.botosub.com/
    55Description: Send Newsletters directly to Facebook Messenger users
    6 Version: 1.1
     6Version: 1.2
    77Author: Botosub Dev
    88License:     GPL2
     
    2929    register_setting('bs_botosub_options', 'botosub_switch_color');
    3030    register_setting('bs_botosub_options', 'botosub_plugin_type');
     31   
    3132    register_setting('bs_botosub_options', 'botosub_sc_title');
    3233    register_setting('bs_botosub_options', 'botosub_sc_title_color');
     
    3536    register_setting('bs_botosub_options', 'botosub_sc_bg_color');
    3637    register_setting('bs_botosub_options', 'botosub_sc_img');
     38
     39    register_setting('bs_botosub_options', 'botosub_mod_title');
     40    register_setting('bs_botosub_options', 'botosub_mod_title_color');
     41    register_setting('bs_botosub_options', 'botosub_mod_desc');
     42    register_setting('bs_botosub_options', 'botosub_mod_desc_color');
     43    register_setting('bs_botosub_options', 'botosub_mod_bg_color');
     44    register_setting('bs_botosub_options', 'botosub_mod_img');
     45    register_setting('bs_botosub_options', 'botosub_mod_img_pos');
    3746}
    3847
     
    6170    ';
    6271    wp_enqueue_style("botosub-top-plugin", plugins_url('/style.css', __FILE__));
     72    wp_enqueue_style("tingle", plugins_url('/tingle.min.css', __FILE__));
     73    wp_enqueue_script("tingle", plugins_url('/tingle.min.js', __FILE__));
     74
    6375
    6476}
     
    102114
    103115                    ?>
    104                     <input type="radio" name="botosub_plugin_type"
    105                            value="Top" <?php echo $tab_location == "Top" ? "checked" : "" ?> > Top Bar
    106                     <input type="radio" name="botosub_plugin_type"
    107                            value="Bottom" <?php echo $tab_location == "Bottom" ? "checked" : "" ?> > Bottom Bar                   
    108                     <input type="radio" name="botosub_plugin_type"
    109                            value="Shortcode" <?php echo $tab_location == "Shortcode" ? "checked" : "" ?> > Shortcode
     116
     117                    <select id="botosub_plugin_type" name="botosub_plugin_type" onchange="changeHandler()" style="width:40%">
     118                      <option value="Top" <?php if ($tab_location == "Top") echo "selected"; ?>>Top Bar</option>
     119                      <option value="Bottom" <?php if ($tab_location == "Bottom") echo "selected"; ?>>Bottom Bar</option>
     120                      <option value="Shortcode" <?php if ($tab_location == "Shortcode") echo "selected"; ?>>Shortcode</option>
     121                      <option value="Modal" <?php if ($tab_location == "Modal") echo "selected"; ?>>Modal</option>
     122                      <option value="None" <?php if ($tab_location == "None") echo "selected"; ?>>None</option>
     123                    </select>
    110124                </td>
    111125
     
    121135                <td class="botosub_bar_class"><input type="text" name="botosub_text_color" placeholder="#ffffff"
    122136                           value="<?php echo get_option('botosub_text_color'); ?>"/></td>
    123                
     137
    124138                <!-- scode -->
    125139                <th class="botosub_scode_class" scope="row">Title</th>
     
    131145                <td class="botosub_scode_class"><input type="text" name="botosub_sc_title_color" placeholder="#333"
    132146                           value="<?php echo get_option('botosub_sc_title_color'); ?>"/></td>
     147               
     148                <!-- modal -->
     149                <th class="botosub_mod_class" scope="row">Title</th>
     150                <td class="botosub_mod_class">
     151                    <input type="text" name="botosub_mod_title" style="width:70%;" placeholder="<?php echo $botosub_newsletter_text; ?>" value="<?php echo get_option('botosub_mod_title'); ?>" />
     152                </td>
     153               
     154                <th class="botosub_mod_class" scope="row">Title Color</th>
     155                <td class="botosub_mod_class"><input type="text" name="botosub_mod_title_color" placeholder="#333"
     156                           value="<?php echo get_option('botosub_mod_title_color'); ?>"/></td>
    133157
    134158            </tr>
     
    154178                <td class="botosub_scode_class"><input type="text" name="botosub_sc_desc_color" placeholder="#333"
    155179                           value="<?php echo get_option('botosub_sc_desc_color'); ?>"/></td>
     180               
     181                <!-- modal -->
     182                <th class="botosub_mod_class" scope="row">Description</th>
     183                <td class="botosub_mod_class">
     184                    <input type="text" name="botosub_mod_desc" style="width:70%;" value="<?php echo get_option('botosub_mod_desc'); ?>" />
     185                </td>
     186               
     187                <th class="botosub_mod_class" scope="row">Description Color</th>
     188                <td class="botosub_mod_class"><input type="text" name="botosub_mod_desc_color" placeholder="#333"
     189                           value="<?php echo get_option('botosub_mod_desc_color'); ?>"/></td>
    156190            </tr>
    157191            <tr valign="top">
     
    169203                <th class="botosub_scode_class" scope="row">Shortcode</th>
    170204                <td class="botosub_scode_class"><span style="margin-bottom: 20px; font-size: 21px; font-weight: 300; line-height: 1.4;">[botosub_newsletters]</span></td>
     205               
     206                <!-- modal -->
     207                <th class="botosub_mod_class" scope="row">Background Color</th>
     208                <td class="botosub_mod_class">
     209                    <input type="text" name="botosub_mod_bg_color" placeholder="#ffffff" style="width:70%;" value="<?php echo get_option('botosub_mod_bg_color'); ?>" />
     210                </td>
     211
    171212            </tr>
    172213
     
    178219                    <input type="text" name="botosub_sc_img" placeholder="" style="width:70%;" value="<?php echo get_option('botosub_sc_img'); ?>" />
    179220                </td>
     221               
     222                <!-- modal -->
     223                <th class="botosub_mod_class" scope="row">Image URL</th>
     224                <td class="botosub_mod_class">
     225                    <input type="text" name="botosub_mod_img" style="width:70%" placeholder="" value="<?php echo get_option('botosub_mod_img'); ?>" />
     226                </td>
     227               
     228                <th class="botosub_mod_class" scope="row">Image Position</th>
     229                <td class="botosub_mod_class">
     230                    <?php $mod_img_pos = (get_option('botosub_mod_img_pos') == FALSE) ? "" : get_option('botosub_mod_img_pos'); ?>
     231                    <select name="botosub_mod_img_pos" style="width:100%">
     232                      <option value="0" <?php if ($mod_img_pos == "0" || $mod_img_pos == "") echo "selected"; ?>>Above Title</option>
     233                      <option value="1" <?php if ($mod_img_pos == "1") echo "selected"; ?>>Above Description</option>
     234                      <option value="2" <?php if ($mod_img_pos == "2") echo "selected"; ?>>Below Description</option>
     235                    </select>
     236                </td>
    180237
    181238            </tr>
     
    190247
    191248<script>
    192     var radios = document.querySelectorAll('input[type=radio][name="botosub_plugin_type"]');
    193 
    194     function changeHandler(event) {
    195 
    196         var displBar = "", displSCode = "";
    197         var val = document.querySelector('input[type=radio][name="botosub_plugin_type"]:checked').value;
     249
     250
     251    function changeHandler() {
     252
     253        var displBar = "", displSCode = "", displModal = "";
     254        var val = document.getElementById('botosub_plugin_type').value;
     255
    198256       if ( val === 'Shortcode' ) {
    199257           displBar = "none";
    200258           displSCode = "table-cell";
     259           displModal = "none";
     260       } else if ( val === 'Modal' ) {
     261           displBar = "none";
     262           displSCode = "none";
     263           displModal = "table-cell";
     264       } else if ( val === 'None' ) {
     265           displBar = "none";
     266           displSCode = "none";
     267           displModal = "none";
    201268       } else {
    202269           displBar = "table-cell";
    203270           displSCode = "none";
     271           displModal = "none";
    204272       }
    205273
     
    213281            scodeElements[ind].style.display = displSCode;
    214282        }
    215 
    216         var barInputs = document.getElementsByClassName("bar_input");
    217         for (var ind = 0; ind < barInputs.length; ind++) {
    218             if (val === "Shortcode"){
    219                 var att = document.createAttribute("disabled");
    220                 att.value = "disabled";
    221                 barInputs[ind].setAttributeNode(att);
    222             }
    223             else {
    224                 barInputs[ind].removeAttribute("disabled");
    225             }
     283       
     284        var modElements = document.getElementsByClassName("botosub_mod_class");
     285        for (var ind = 0; ind < modElements.length; ind++) {
     286            modElements[ind].style.display = displModal;
    226287        }
     288
    227289    }
    228290
     291
    229292    changeHandler();
    230293
    231     Array.prototype.forEach.call(radios, function(radio) {
    232        radio.addEventListener('change', changeHandler);
    233     });
    234294</script>
    235295    <?php
     
    243303   
    244304
    245     $tab_location_default = 'Bottom';
     305    $tab_location_default = 'None';
    246306
    247307    $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
     
    249309        $plugin_class = "botosub-plugin-top";
    250310        $plugin_switch_class = "botosub-plugin-switch-top";
    251     } else {
     311    } else if ($tab_location == 'Bottom') {
    252312        $plugin_class = "botosub-plugin-bottom";
    253313        $plugin_switch_class = "botosub-plugin-switch-bottom";
     
    290350        }, 500)
    291351
     352
     353        // NEW MODAL
     354        var modal = new tingle.modal({
     355            footer: false,
     356            stickyFooter: false,
     357            closeMethods: ['overlay', 'button', 'escape'],
     358            closeLabel: "Close",
     359            onOpen: function() {
     360
     361            },
     362            onClose: function() {
     363
     364            },
     365            beforeClose: function() {
     366                return true; // close the modal
     367            }
     368        });
     369
     370
     371        var mTitle = "<span style='display:block; font-size:2.5em; margin-bottom:15px;'>GET FREE UPDATES</span>";
     372        var mDesc = "<span style='display:block; font-size:26px; font-weight:300; line-height:36.4px; margin-bottom:15px; color:#666; '>JOIN OVER 200,000 SUBSCRIBERS</span>";
     373        var mImg = "<img style='max-height:500px; margin-bottom:15px;' src='https://image.freepik.com/free-vector/magic-wand-and-rabbit-in-a-hat_23-2147493063.jpg'>";
     374        var mButton = '<div class="fb-messengermessageus" messenger_app_id="627891880745321" page_id="<?php echo get_option("botosub_page_id"); ?>" color="blue" size="xlarge"></div>';
     375       
     376        var cnt = "<div style='text-align:center; font-family:alright_sansmedium,HelveticaNeue,Helvetica,Arial,sans-serif; -webkit-font-smoothing:antialiased;'>" + mImg + mTitle + mDesc + mButton;
     377        cnt += "</div>";
     378
     379        // set content
     380        modal.setContent(cnt);
     381        modal.open();
     382       
    292383    </script>
    293384
     
    357448                     page_id=" . get_option('botosub_page_id') . "
    358449                     color='blue'
    359                      size='large' >
     450                     size='xlarge' >
    360451                </div>
    361452            </div>
  • botosub/trunk/readme.txt

    r1673372 r1675072  
    33Tags: newsletter, facebook, messenger, chatbot, bots, email, marketing, newsletters, opt-in, social, signup
    44Requires at least: 3.1
    5 Tested up to: 4.7.5
     5Tested up to: 4.8
    66Stable tag: 1.1
    77License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.