Plugin Directory

Changeset 1742355


Ignore:
Timestamp:
10/06/2017 09:46:07 PM (8 years ago)
Author:
botosubdev
Message:

widgets updated, bugs fixed

Location:
botosub
Files:
4 added
2 deleted
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • botosub/tags/1.3/botosub.php

    r1678597 r1742355  
    5353{
    5454    $lang = "";
    55     if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; }else{ $lang = esc_attr( get_option('botosub_fb_lang') ); }
     55    if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; } else { $lang = esc_attr( get_option('botosub_fb_lang') ); }
    5656
    5757    echo '
     
    7272    }(document, "script", "facebook-jssdk"));
    7373    </script>
    74     ';
    75     wp_enqueue_style("botosub-top-plugin", plugins_url('/style.css', __FILE__));
    76     wp_enqueue_style("tingle", plugins_url('/tingle.min.css', __FILE__));
    77     wp_enqueue_script("tingle", plugins_url('/tingle.min.js', __FILE__));
     74    '; // sdk.js
     75    wp_enqueue_style("botosub-plugin", plugins_url('/botosubPlugin.css', __FILE__));
     76    wp_enqueue_script("botosub-plugin", plugins_url('/botosubPlugin.min.js', __FILE__));
    7877
    7978}
     
    9190    <ol style="margin-left:20px;">
    9291        <li>Register your Facebook Page in <a target="_blank" href="https://www.botosub.com/">Botosub</a>.</li>
    93         <li>Encourage users to click &#x22;Get Started&#x22; in Facebook message inbox.</li>
     92        <li>Add this plugin to your website so that users can sign up with a single click.</li>
    9493        <li>Send newsletters in <a target="_blank" href="https://www.botosub.com/">Botosub</a>.</li>
    9594    </ol>
     
    106105                <th scope="row" style="vertical-align: middle;"><label for="botosub_fb_lang">Language</label></th>
    107106                <td style="width:37%;">
    108                     <input type="text" size="10" placeholder="en_US" name="botosub_fb_lang" value="<?php echo esc_attr( get_option('botosub_fb_lang') ); ?>" /> <small>All supported languages available at <a href="https://www.facebook.com/translations/FacebookLocales.xml">here</a></small>
     107                    <input type="text" size="10" placeholder="en_US" name="botosub_fb_lang" value="<?php echo esc_attr( get_option('botosub_fb_lang') ); ?>" /> <small>All supported languages available at <a href="https://www.botosub.com/facebookLocales.json">here</a>. Some of them are en_US for English (US), de_DE for German, ar_AR for Arabic</small>
    109108                </td>
    110109            </tr>
     
    232231                <th class="botosub_mod_class" scope="row">Image Position</th>
    233232                <td class="botosub_mod_class">
    234                     <?php $mod_img_pos = (get_option('botosub_mod_img_pos') == FALSE) ? "" : get_option('botosub_mod_img_pos'); ?>
     233                    <?php $mod_img_pos = (get_option('botosub_mod_img_pos') === FALSE) ? "" : get_option('botosub_mod_img_pos'); ?>
    235234                    <select name="botosub_mod_img_pos" style="width:70%">
    236235                      <option value="0" <?php if ($mod_img_pos == "0" || $mod_img_pos == "") echo "selected"; ?>>Above Title</option>
     
    248247                    <?php $mod_img_when_val = (get_option('botosub_mod_img_when_val') == FALSE) ? "30" : get_option('botosub_mod_img_when_val'); ?>
    249248                    <input type="text" id="botosub_mod_img_when_val" name="botosub_mod_img_when_val" value="<?php echo $mod_img_when_val; ?>" style="margin-right:10px; width:10%" maxlength="2"/>
    250                     <?php $mod_img_when = (get_option('botosub_mod_img_when') == FALSE) ? "1" : get_option('botosub_mod_img_when'); ?>
     249                    <?php $mod_img_when = (get_option('botosub_mod_img_when') === FALSE) ? "1" : get_option('botosub_mod_img_when'); ?>
    251250                    <select id="botosub_mod_img_when" name="botosub_mod_img_when" style="width:55%" onchange="botosubWhenChHandler()">
    252251                      <option value="0" <?php if ($mod_img_when == "0" || $mod_img_when == "") echo "selected"; ?>>Page Loaded</option>
     
    259258                <th class="botosub_mod_class" scope="row" style="vertical-align: middle;">When the plugin pops up after closed by user</th>
    260259                <td class="botosub_mod_class">
    261                     <?php $mod_img_again_val = (get_option('botosub_mod_img_again_val') == FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>
     260                    <?php $mod_img_again_val = (get_option('botosub_mod_img_again_val') === FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>
    262261                    <input type="text" id="botosub_mod_img_again_val" name="botosub_mod_img_again_val" value="<?php echo $mod_img_again_val; ?>" style="margin-right:10px; width:10%" maxlength="2"/>
    263262                    <?php $mod_img_again = (get_option('botosub_mod_img_again') == FALSE) ? "0" : get_option('botosub_mod_img_again'); ?>
     
    365364{
    366365//    $form_action = apply_filters('mctb_form_action', null);
    367    
     366
     367    $lang = "";
     368    $botosub_page_id = get_option("botosub_page_id");
     369
     370    if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; } else { $lang = esc_attr( get_option('botosub_fb_lang') ); }
    368371
    369372    $tab_location_default = 'None';
    370 
    371373    $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
    372     if ($tab_location == 'Top') {
    373         $plugin_class = "botosub-plugin-top";
    374         $plugin_switch_class = "botosub-plugin-switch-top";
    375     } else if ($tab_location == 'Bottom') {
    376         $plugin_class = "botosub-plugin-bottom";
    377         $plugin_switch_class = "botosub-plugin-switch-bottom";
    378     }
    379    
    380 
    381     if ($tab_location == 'Top' || $tab_location == 'Bottom') {
     374
     375    ?>
     376    <script>
     377
     378        botosubPlugin.page_id = <?php echo $botosub_page_id; ?>;
     379
     380        // All supported languages available at https://www.botosub.com/facebookLocales.json
     381        botosubPlugin.lang = "<?php echo $lang; ?>";
     382
     383    </script>
     384    <?php
     385
     386
     387    if ($tab_location === 'Top' || $tab_location === 'Bottom') {
    382388    ?>
    383389   
    384390    <script>
    385         var botosub_hidden = true;
    386         var botosub_hideChar = "▲";
    387         var botosub_showChar = "▼";
    388 
     391
     392        var botosub_bar_position = "";
    389393        var botosub_tab_location = "<?php echo $tab_location ?>";
    390394        if (botosub_tab_location === "Top") {
    391             botosub_hideChar = "▲";
    392             botosub_showChar = "▼";
     395            botosub_bar_position = "top";
    393396        } else {
    394             botosub_hideChar = "▼";
    395             botosub_showChar = "▲";
     397            botosub_bar_position = "bottom";
    396398        }
    397399
    398         function botosubTogglePlugin() {
    399 
    400             if (botosub_hidden) {
    401                 document.getElementById("botosub-plugin").style.display = "none";
    402                 document.getElementById("botosub-plugin-switch").innerHTML = botosub_showChar;
    403                 botosub_hidden = false;
    404             } else {
    405                 document.getElementById("botosub-plugin").style.display = "block";
    406                 document.getElementById("botosub-plugin-switch").innerHTML = botosub_hideChar;
    407                 botosub_hidden = true;
    408             }
    409 
    410         }
    411 
    412         setTimeout(function () {
    413             document.getElementById("botosub-plugin-switch").innerHTML = botosub_hideChar;
    414         }, 500)
    415        
    416     </script>
    417 
    418 
    419     <!-- Botosub - SWITCH -->
    420     <div class="botosub-plugin-outer <?php echo $plugin_class ?> ">
    421         <div id="botosub-plugin" class="botosub-plugin-style" style="background: <?php
     400        var botosub_bar_bg_color = "<?php
    422401        $myOption_1 = '#fed136';
    423402        $myOption_2 = (get_option('botosub_box_bg_color') == FALSE) ? $myOption_1 : get_option('botosub_box_bg_color');
    424403        echo $myOption_2;
    425         ?>">
    426             <div style="padding-top: 5px; padding-bottom: 5px; min-height: 33px; text-align: center;">
    427                 <span style="<?php echo (get_option('botosub_text_style') == FALSE) ? "font-weight:bold; padding-right: 10px;" : get_option('botosub_text_style'); ?> color:<?php echo get_option('botosub_text_color'); ?>">
    428                     <?php
     404        ?>";
     405       
     406        var botosub_bar_text_style = "<?php echo (get_option('botosub_text_style') == FALSE) ? "font-weight:bold; padding-right: 10px;" : get_option('botosub_text_style'); ?>";
     407       
     408        var botosub_bar_text_color = "<?php echo get_option('botosub_text_color'); ?>";
     409       
     410        var botosub_bar_text = "<?php
    429411                    $myOption = (get_option('botosub_text') == FALSE) ? $botosub_newsletter_text : get_option('botosub_text');
    430412                    echo $myOption;
    431                     ?>
    432                 </span>
    433                 <div class="fb-messengermessageus"
    434                      messenger_app_id="627891880745321"
    435                      page_id="<?php echo get_option('botosub_page_id'); ?>"
    436                      color="blue"
    437                      size="large" >
    438                 </div>
    439             </div>
    440             <a target='_blank' href='https://www.botosub.com' style='position:absolute; bottom:4px; left:5px; font-size:.7em'>botosub</a>
    441         </div>
    442 
    443 
    444         <div id="botosub-plugin-switch-outer"
    445              class="<?php echo $plugin_switch_class ?>"
    446              style="background: <?php $myOption_2 = (get_option('botosub_box_bg_color') == FALSE) ? '#fed136' : get_option('botosub_box_bg_color');
    447              echo $myOption_2; ?>"
    448              onclick="botosubTogglePlugin()"><?php $switchColor = (get_option('botosub_switch_color') == FALSE) ? '#000' : get_option('botosub_switch_color'); ?>
    449             <span id="botosub-plugin-switch" style="float: right; padding: 5px 15px; color:<?php echo $switchColor; ?>">
    450         </span>
    451         </div>
    452     </div>
     413                    ?>";
     414
     415        var botosub_bar_sw_color = "<?php $switchColor = (get_option('botosub_switch_color') == FALSE) ? '#666' : get_option('botosub_switch_color'); ?>";
     416
     417        botosubPlugin.confBar({
     418            /*1*/   enabled : true ,
     419            /*2*/   type :  botosub_bar_position ,//type  "top" or "bottom" with lowercase
     420            /*3*/   hidden : false,
     421            /*4*/   bgColor : botosub_bar_bg_color,//bar background color
     422            /*5*/   switchColor : botosub_bar_sw_color, // switch button color
     423            /*6*/   text : botosub_bar_text,
     424            /*7*/   textStyle : botosub_bar_text_style,
     425            /*8*/   textColor : botosub_bar_text_color,
     426        });
     427
     428    </script>
    453429
    454430    <?php
    455431    }
    456     else if ($tab_location == 'Modal') {
     432    else if ($tab_location === 'Modal') {
    457433    ?>
    458434
    459435    <script>
     436
     437
     438        var botosub_mod_title = "<?php echo (get_option('botosub_mod_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_mod_title'); ?>";
     439        var botosub_mod_title_color = "<?php echo (get_option('botosub_mod_title_color') == FALSE) ? "#666" : get_option('botosub_mod_title_color'); ?>";
     440
     441        var botosub_mod_desc = "<?php echo (get_option('botosub_mod_desc') == FALSE) ? "" : get_option('botosub_mod_desc'); ?>";
     442        var botosub_mod_desc_color = "<?php echo (get_option('botosub_mod_desc_color') == FALSE) ? "" : get_option('botosub_mod_desc_color'); ?>";
    460443       
    461         <?php $mod_img_when = (get_option('botosub_mod_img_when') == FALSE) ? "0" : get_option('botosub_mod_img_when'); ?>
    462         <?php $mod_img_when_val = (get_option('botosub_mod_img_when_val') == FALSE) ? "0" : get_option('botosub_mod_img_when_val'); ?>
    463         var botosub_mWhen = "<?php echo $mod_img_when; ?>";
    464         var botosub_mWhenVal = parseInt("<?php echo $mod_img_when_val; ?>");
    465         var botosub_mFired = false;
    466 
    467         // NEW MODAL
    468         var botosub_modal = new tingle.modal({
    469             footer: false,
    470             stickyFooter: false,
    471             closeMethods: ['overlay', 'button', 'escape'],
    472             closeLabel: "Close",
    473             onOpen: function() {
    474 
    475             },
    476             onClose: function() {
    477                 var d = new Date();
    478                 localStorage.setItem("botosub_mcd", d.getTime());
    479             },
    480             beforeClose: function() {
    481                 return true; // close the modal
    482             }
    483         });
     444        var botosub_mod_img_when = "<?php echo (get_option('botosub_mod_img_when') == FALSE) ? "0" : get_option('botosub_mod_img_when'); ?>";
     445        var botosub_mod_img_when_val = <?php echo (get_option('botosub_mod_img_when_val') == FALSE) ? 30 : get_option('botosub_mod_img_when_val'); ?>;
     446
     447        var botosub_mod_img_again_val = <?php echo (get_option('botosub_mod_img_again_val') == FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>;
     448
     449        var botosub_mod_img_again = "<?php echo (get_option('botosub_mod_img_again') == FALSE) ? "0" : get_option('botosub_mod_img_again'); ?>";
     450
     451        var botosub_mod_img = "<?php echo (get_option('botosub_mod_img') == FALSE) ? "" : get_option('botosub_mod_img'); ?>";
     452
     453        var botosub_mod_img_pos = "<?php echo (get_option('botosub_mod_img_pos') == FALSE) ? "0" : get_option('botosub_mod_img_pos'); ?>";
     454
     455        botosubPlugin.confModal({
     456
     457            /*1*/   enabled : true ,
     458                /*
     459                    MODAL TYPE
     460                    0 PAGE LOAD
     461                    1 EXIT INTENT
     462                    2 SCROLL PERCENTAGE
     463                    3 OPEN INTERVAL     */
     464            /*2*/   type: botosub_mod_img_when,
     465                /*
     466                    TYPE VALUE
     467                    Page Percent ve Interval Seconds  */
     468            /*3*/   typeValue: botosub_mod_img_when_val,
     469
     470                /*   Repeat Type
     471                    0 ALWAYS OPEN
     472                    1 NO REPEAT
     473                    2 OPEN AFTER (repeatValue * MIN)
     474                    3 OPEN AFTER (repeatValue * HOURS)
     475                    4 OPEN AFTER (repeatValue * DAYS)  */
     476            /*4*/   repeatType: botosub_mod_img_again,
     477            /*5*/   repeatValue: botosub_mod_img_again_val,
     478            /*6*/   title: botosub_mod_title,
     479            /*7*/   titleColor: botosub_mod_title_color,
     480            /*8*/   description: botosub_mod_desc,
     481            /*9*/   descriptionColor: botosub_mod_desc_color,
     482            /*10*/  imageURL: botosub_mod_img,
     483
     484                /*  IMAGE VERTICAL ALIGNMENT
     485                    0 IMAGE AT TOP
     486                    1 IMAGE AT MIDDLE
     487                    2 IMAGE AT BOTTOM  */
     488            /*11*/  imagePosition: botosub_mod_img_pos,
     489
     490
     491      });
    484492       
    485         jQuery( document ).ready(function() {
    486 
    487             if (botosub_mWhen === "0") {
    488                 if (!botosub_mFired && botosubModalOk()) { botosub_modal.open(); botosub_mFired = true; }
    489             }
    490             else if (botosub_mWhen === "1") {
    491                 if(document.addEventListener)
    492                     document.addEventListener("mouseout", botosubExitIntent, false);
    493                 else if(document.attachEvent)
    494                     document.attachEvent("on" + "mouseout", botosubExitIntent);
    495             }
    496             else if (botosub_mWhen === "2") {
    497                 jQuery(window).scroll(function(e){
    498                     var s = jQuery(window).scrollTop(),
    499                     d = jQuery(document).height(),
    500                     c = jQuery(window).height();
    501 
    502                     var scrollPercent = (s / (d-c)) * 100;
    503                    
    504                     if (!botosub_mFired && scrollPercent >= (botosub_mWhenVal - 3) && scrollPercent <= (botosub_mWhenVal + 3) && botosubModalOk()) {
    505                         botosub_modal.open();
    506                         botosub_mFired = true;
    507                     }
    508                 });
    509             }
    510             else if (botosub_mWhen === "3") {
    511                 setTimeout(function(){ if (!botosub_mFired && botosubModalOk()) { botosub_modal.open(); botosub_mFired = true; } }, botosub_mWhenVal * 1000);
    512             }
    513         });
    514        
    515         function botosubExitIntent(e) {
    516 
    517             e = e ? e : window.event;
    518 
    519             if(e.target.tagName.toLowerCase() == "input")
    520                 return;
    521 
    522             var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
    523 
    524             if(e.clientX >= (vpWidth - 50))
    525                 return;
    526 
    527             if(e.clientY >= 50)
    528                 return;
    529 
    530             var from = e.relatedTarget || e.toElement;
    531             if(!from) {
    532 
    533                 if (!botosub_mFired && botosubModalOk()) { botosub_modal.open(); botosub_mFired = true; }
    534             }
    535         }
    536 
    537         function botosubModalOk() {
    538            
    539             var lastModalDisp = localStorage.getItem("botosub_mcd");
    540             if (lastModalDisp) {
    541 
    542                 <?php $mod_img_again = (get_option('botosub_mod_img_again') == FALSE) ? "0" : get_option('botosub_mod_img_again'); ?>
    543                 var mAgain = "<?php echo $mod_img_again; ?>";
    544                 if (mAgain === "0") { return true; }
    545                 else if (mAgain === "1") { return false; }
    546                
    547                 var dat = new Date();
    548                 dat.setTime(lastModalDisp);
    549                 var diff = Math.abs(new Date() - dat);
    550                 <?php $mod_img_again_val = (get_option('botosub_mod_img_again_val') == FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>
    551                 var mAgainVal = parseInt("<?php echo $mod_img_again_val; ?>");
    552                 var limit = 0;
    553                 if (mAgain === "2") { limit = mAgainVal * 60; }
    554                 else if (mAgain === "3") { limit = mAgainVal * 60 * 60; }
    555                 else if (mAgain === "4") { limit = mAgainVal * 60 * 60 * 24; }
    556                 if ((diff / 1000) < limit) {
    557                     return false;
    558                 }
    559                 else {
    560                     return true;
    561                 }
    562             }
    563             else {
    564                 return true;
    565             }           
    566         }
    567 
    568 
    569         <?php $myOption = (get_option('botosub_mod_img_pos') == FALSE) ? "0" : get_option('botosub_mod_img_pos'); ?>
    570         var mImgPos = "<?php echo $myOption; ?>";
    571         <?php $myOption = (get_option('botosub_mod_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_mod_title'); ?>
    572         <?php $urOption = (get_option('botosub_mod_title_color') == FALSE) ? "" : "color:" . get_option('botosub_mod_title_color') . ";"; ?>
    573         var mTitle = "<span style='display:block; font-size:2.5em; margin-bottom:15px;<?php echo $urOption; ?>'><?php echo $myOption; ?></span>";
    574         <?php $myOption = (get_option('botosub_mod_desc') == FALSE) ? "" : get_option('botosub_mod_desc'); ?>
    575         <?php $urOption = (get_option('botosub_mod_desc_color') == FALSE) ? "color:#666;" : "color:" . get_option('botosub_mod_desc_color') . ";"; ?>
    576         var mDesc = "<span style='display:block; font-size:26px; font-weight:300; line-height:36.4px; margin-bottom:15px;<?php echo $urOption; ?> '><?php echo $myOption; ?></span>";
    577         <?php $myOption = (get_option('botosub_mod_img') == FALSE) ? "" : "<img style='max-height:500px; margin-bottom:15px;' src='" . get_option('botosub_mod_img') . "'>"; ?>
    578         var mImg = "<?php echo $myOption; ?>";
    579         var mButton = '<div class="fb-messengermessageus" messenger_app_id="627891880745321" page_id="<?php echo get_option("botosub_page_id"); ?>" color="blue" size="xlarge"></div>';
    580 
    581         var mContent = "";
    582         if (mImgPos === "0") { mContent = mImg + mTitle + mDesc; }
    583         else if (mImgPos === "1") { mContent = mTitle + mImg + mDesc; }
    584         else if (mImgPos === "2") { mContent = mTitle + mDesc + mImg; }
    585         <?php $urOption = (get_option('botosub_mod_bg_color') == FALSE) ? "" : "background-color:" . get_option('botosub_mod_bg_color') . ";"; ?>
    586         var cnt = "<div style='text-align:center; font-family:alright_sansmedium,HelveticaNeue,Helvetica,Arial,sans-serif; -webkit-font-smoothing:antialiased;<?php echo $urOption; ?>'>" + mContent + mButton;
    587         cnt += "<a target='_blank' href='https://www.botosub.com' style='position:absolute; bottom:7px; right:7px; font-size:.8em'>botosub</a></div>";
    588 
    589         // set content
    590         botosub_modal.setContent(cnt);
    591493
    592494    </script>
    593495
     496    <?php
     497
     498    }
     499    else if ($tab_location === 'Shortcode') {
     500    ?>
     501
     502        <script>
     503
     504            <?php $botosub_newsletter_text = "Subscribe to our Newsletters from Messenger Chatbot!"; ?>
     505            // PLUGIN TITLE
     506            var botosub_sc_title = "<?php echo (get_option('botosub_sc_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_sc_title'); ?>";
     507
     508            var sc_title_color = "<?php echo (get_option('botosub_sc_title_color') == FALSE) ? "" : get_option('botosub_sc_title_color'); ?>";
     509            var sc_desc = "<?php echo (get_option('botosub_sc_desc') == FALSE) ? "" : get_option('botosub_sc_desc'); ?>";
     510            var sc_desc_color = "<?php echo (get_option('botosub_sc_desc_color') == FALSE) ? "" : get_option('botosub_sc_desc_color'); ?>";
     511            var sc_bg_color = "<?php echo (get_option('botosub_sc_bg_color') == FALSE) ? "" : get_option('botosub_sc_bg_color'); ?>";
     512            var sc_img = "<?php echo (get_option('botosub_sc_img') == FALSE) ? "" : get_option('botosub_sc_img'); ?>";
     513
     514            botosubPlugin.confInline ({
     515
     516                /*1*/   enabled : true,
     517                /*2*/   imageURL : sc_img,
     518                /*3*/   title: botosub_sc_title,
     519                /*4*/   titleColor : sc_title_color,
     520                /*5*/   bgColor : sc_bg_color,
     521                /*6*/   description : sc_desc,
     522                /*7*/   descriptionColor : sc_desc_color,
     523             });
     524
     525        </script>
    594526    <?php
    595527    }
     
    600532function botosub_letter_shortcode_init() {
    601533    // Add Shortcode
    602     function botosub_letter_shortcode( $atts , $content = null ) {
    603 
    604         $botosub_newsletter_text = "Subscribe to our Newsletters from Messenger Chatbot!";
    605         // PLUGIN TITLE
    606         $myOption = (get_option('botosub_sc_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_sc_title');
    607         $sc_title_color = (get_option('botosub_sc_title_color') == FALSE) ? "" : "color:" . get_option('botosub_sc_title_color') . ";";
    608         $sc_desc = (get_option('botosub_sc_desc') == FALSE) ? "" : get_option('botosub_sc_desc');
    609         $sc_desc_color = (get_option('botosub_sc_desc_color') == FALSE) ? "" : "color:" . get_option('botosub_sc_desc_color') . ";";
    610         $sc_bg_color = (get_option('botosub_sc_bg_color') == FALSE) ? "" : "background-color:" . get_option('botosub_sc_bg_color') . ";";
    611 
    612         $sc_img = (get_option('botosub_sc_img') == FALSE) ? "" : "<img src='" . get_option('botosub_sc_img') . "' style='display:inline-block; max-height:158px; float:left;'>";
    613 
    614 
    615         $div = "<div style='position:relative; border-radius: 16px; padding: 20px 20px; border: 1px solid #ccc!important; text-align:center; overflow:auto; height:200px;" . $sc_bg_color . "'>" . $sc_img . "
    616             <div style='display:table-cell; vertical-align:middle; line-height:normal; height:158px;'>
    617                 <span style='font-size: 1.2em; text-align: center; display: block; margin-bottom: 10px; " . $sc_title_color . "'>
    618                         " . $myOption . "
    619                     </span>
    620                     <span style='margin-bottom:10px; display:block; " . $sc_desc_color . "'>" . $sc_desc . "</span>
    621                 <div class='fb-messengermessageus' style='display:block; text-align:center;'
    622                      messenger_app_id='627891880745321'
    623                      page_id=" . get_option('botosub_page_id') . "
    624                      color='blue'
    625                      size='xlarge' >
    626                 </div>
    627             </div><a target='_blank' href='https://www.botosub.com' style='position:absolute; bottom:7px; right:7px; font-size:.7em'>botosub</a>
    628         </div>";
    629         return $div;
    630 
     534    function botosub_letter_shortcode( $atts , $content = null ) {
     535
     536        $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
     537
     538        if ($tab_location == 'Shortcode') {
     539            return "<div class=\"botosubInline\"></div>";
     540        }
    631541    }
    632542    add_shortcode( 'botosub_newsletters', 'botosub_letter_shortcode' );
  • botosub/tags/1.3/readme.txt

    r1682490 r1742355  
    1515<strong>Botosub is a simple yet effective marketing tool for sending newsletters from Facebook and increasing your Facebook users.</strong>
    1616
    17 This plugin offers top/bottom bar and shortcode sign-up for your users to subscribe to your Facebook page. Botosub plugin includes a "Message Us" button which opens a new window to Facebook Messenger. After clicking "Get Started", the user is subscribed and ready to receive newsletters from your Facebook page as a private message.
     17This plugin offers top/bottom bar, pop-up and shortcode sign-up for your users to subscribe to your Facebook page. Botosub plugin includes a "Send to Messenger" button which subscribes your users with one click. After clicking "Send to Messenger", the user is subscribed and ready to receive newsletters from your Facebook page as a private message.
    1818
    1919[youtube https://youtu.be/qX6TN5gIVgk]
     
    3131
    3232* <strong>Facebook page is required in order to send newsletters to Facebook users.</strong>
    33 * <strong>Only users that clicked "Get Started" button can receive chatbot newsletters.</strong>
    34 * Existing FB page followers or users that liked your page should also click "Get Started" button to receive newsletters.
     33* <strong>Only users that clicked "Send to Messenger" button can receive chatbot newsletters.</strong>
     34* Existing FB page followers or users that liked your page should also click "Send to Messenger" button to receive newsletters.
    3535
    3636== Installation ==
     
    41414. Customize your desired settings via Settings > Botosub. Facebook Page ID is required.
    42425. Login and choose your FB page in [Botosub](https://www.botosub.com). After choosing your page, Botosub chatbot can now send newsletters.
    43 6. Click "Message Us" button on your blog. Then click "Get Started" to subscribe yourself for newsletters as well.
     436. Click "Send to Messenger" button on your blog to subscribe yourself for newsletters as well.
    44447. Enter title, content URL, image URL in [Botosub dashboard](https://www.botosub.com/dashboard.html) and send to your users
    4545
     
    5252
    5353= Will my existing followers or people that liked my FB page receive newsletters? =
    54 Existing followers or people that liked your FB page should click "Get Started" button in FB message inbox to receive newsletters.
     54Existing followers or people that liked your FB page should click "Send to Messenger" in your blog or "Get Started" button in FB message inbox to receive newsletters.
    5555
    5656== Screenshots ==
     
    6363
    6464== Changelog ==
     65
     66= 1.3 =
     67
     68* Widgets updated, bugs fixed
    6569
    6670= 1.2 =
  • botosub/trunk/botosub.php

    r1678597 r1742355  
    5353{
    5454    $lang = "";
    55     if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; }else{ $lang = esc_attr( get_option('botosub_fb_lang') ); }
     55    if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; } else { $lang = esc_attr( get_option('botosub_fb_lang') ); }
    5656
    5757    echo '
     
    7272    }(document, "script", "facebook-jssdk"));
    7373    </script>
    74     ';
    75     wp_enqueue_style("botosub-top-plugin", plugins_url('/style.css', __FILE__));
    76     wp_enqueue_style("tingle", plugins_url('/tingle.min.css', __FILE__));
    77     wp_enqueue_script("tingle", plugins_url('/tingle.min.js', __FILE__));
     74    '; // sdk.js
     75    wp_enqueue_style("botosub-plugin", plugins_url('/botosubPlugin.css', __FILE__));
     76    wp_enqueue_script("botosub-plugin", plugins_url('/botosubPlugin.min.js', __FILE__));
    7877
    7978}
     
    9190    <ol style="margin-left:20px;">
    9291        <li>Register your Facebook Page in <a target="_blank" href="https://www.botosub.com/">Botosub</a>.</li>
    93         <li>Encourage users to click &#x22;Get Started&#x22; in Facebook message inbox.</li>
     92        <li>Add this plugin to your website so that users can sign up with a single click.</li>
    9493        <li>Send newsletters in <a target="_blank" href="https://www.botosub.com/">Botosub</a>.</li>
    9594    </ol>
     
    106105                <th scope="row" style="vertical-align: middle;"><label for="botosub_fb_lang">Language</label></th>
    107106                <td style="width:37%;">
    108                     <input type="text" size="10" placeholder="en_US" name="botosub_fb_lang" value="<?php echo esc_attr( get_option('botosub_fb_lang') ); ?>" /> <small>All supported languages available at <a href="https://www.facebook.com/translations/FacebookLocales.xml">here</a></small>
     107                    <input type="text" size="10" placeholder="en_US" name="botosub_fb_lang" value="<?php echo esc_attr( get_option('botosub_fb_lang') ); ?>" /> <small>All supported languages available at <a href="https://www.botosub.com/facebookLocales.json">here</a>. Some of them are en_US for English (US), de_DE for German, ar_AR for Arabic</small>
    109108                </td>
    110109            </tr>
     
    232231                <th class="botosub_mod_class" scope="row">Image Position</th>
    233232                <td class="botosub_mod_class">
    234                     <?php $mod_img_pos = (get_option('botosub_mod_img_pos') == FALSE) ? "" : get_option('botosub_mod_img_pos'); ?>
     233                    <?php $mod_img_pos = (get_option('botosub_mod_img_pos') === FALSE) ? "" : get_option('botosub_mod_img_pos'); ?>
    235234                    <select name="botosub_mod_img_pos" style="width:70%">
    236235                      <option value="0" <?php if ($mod_img_pos == "0" || $mod_img_pos == "") echo "selected"; ?>>Above Title</option>
     
    248247                    <?php $mod_img_when_val = (get_option('botosub_mod_img_when_val') == FALSE) ? "30" : get_option('botosub_mod_img_when_val'); ?>
    249248                    <input type="text" id="botosub_mod_img_when_val" name="botosub_mod_img_when_val" value="<?php echo $mod_img_when_val; ?>" style="margin-right:10px; width:10%" maxlength="2"/>
    250                     <?php $mod_img_when = (get_option('botosub_mod_img_when') == FALSE) ? "1" : get_option('botosub_mod_img_when'); ?>
     249                    <?php $mod_img_when = (get_option('botosub_mod_img_when') === FALSE) ? "1" : get_option('botosub_mod_img_when'); ?>
    251250                    <select id="botosub_mod_img_when" name="botosub_mod_img_when" style="width:55%" onchange="botosubWhenChHandler()">
    252251                      <option value="0" <?php if ($mod_img_when == "0" || $mod_img_when == "") echo "selected"; ?>>Page Loaded</option>
     
    259258                <th class="botosub_mod_class" scope="row" style="vertical-align: middle;">When the plugin pops up after closed by user</th>
    260259                <td class="botosub_mod_class">
    261                     <?php $mod_img_again_val = (get_option('botosub_mod_img_again_val') == FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>
     260                    <?php $mod_img_again_val = (get_option('botosub_mod_img_again_val') === FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>
    262261                    <input type="text" id="botosub_mod_img_again_val" name="botosub_mod_img_again_val" value="<?php echo $mod_img_again_val; ?>" style="margin-right:10px; width:10%" maxlength="2"/>
    263262                    <?php $mod_img_again = (get_option('botosub_mod_img_again') == FALSE) ? "0" : get_option('botosub_mod_img_again'); ?>
     
    365364{
    366365//    $form_action = apply_filters('mctb_form_action', null);
    367    
     366
     367    $lang = "";
     368    $botosub_page_id = get_option("botosub_page_id");
     369
     370    if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; } else { $lang = esc_attr( get_option('botosub_fb_lang') ); }
    368371
    369372    $tab_location_default = 'None';
    370 
    371373    $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
    372     if ($tab_location == 'Top') {
    373         $plugin_class = "botosub-plugin-top";
    374         $plugin_switch_class = "botosub-plugin-switch-top";
    375     } else if ($tab_location == 'Bottom') {
    376         $plugin_class = "botosub-plugin-bottom";
    377         $plugin_switch_class = "botosub-plugin-switch-bottom";
    378     }
    379    
    380 
    381     if ($tab_location == 'Top' || $tab_location == 'Bottom') {
     374
     375    ?>
     376    <script>
     377
     378        botosubPlugin.page_id = <?php echo $botosub_page_id; ?>;
     379
     380        // All supported languages available at https://www.botosub.com/facebookLocales.json
     381        botosubPlugin.lang = "<?php echo $lang; ?>";
     382
     383    </script>
     384    <?php
     385
     386
     387    if ($tab_location === 'Top' || $tab_location === 'Bottom') {
    382388    ?>
    383389   
    384390    <script>
    385         var botosub_hidden = true;
    386         var botosub_hideChar = "▲";
    387         var botosub_showChar = "▼";
    388 
     391
     392        var botosub_bar_position = "";
    389393        var botosub_tab_location = "<?php echo $tab_location ?>";
    390394        if (botosub_tab_location === "Top") {
    391             botosub_hideChar = "▲";
    392             botosub_showChar = "▼";
     395            botosub_bar_position = "top";
    393396        } else {
    394             botosub_hideChar = "▼";
    395             botosub_showChar = "▲";
     397            botosub_bar_position = "bottom";
    396398        }
    397399
    398         function botosubTogglePlugin() {
    399 
    400             if (botosub_hidden) {
    401                 document.getElementById("botosub-plugin").style.display = "none";
    402                 document.getElementById("botosub-plugin-switch").innerHTML = botosub_showChar;
    403                 botosub_hidden = false;
    404             } else {
    405                 document.getElementById("botosub-plugin").style.display = "block";
    406                 document.getElementById("botosub-plugin-switch").innerHTML = botosub_hideChar;
    407                 botosub_hidden = true;
    408             }
    409 
    410         }
    411 
    412         setTimeout(function () {
    413             document.getElementById("botosub-plugin-switch").innerHTML = botosub_hideChar;
    414         }, 500)
    415        
    416     </script>
    417 
    418 
    419     <!-- Botosub - SWITCH -->
    420     <div class="botosub-plugin-outer <?php echo $plugin_class ?> ">
    421         <div id="botosub-plugin" class="botosub-plugin-style" style="background: <?php
     400        var botosub_bar_bg_color = "<?php
    422401        $myOption_1 = '#fed136';
    423402        $myOption_2 = (get_option('botosub_box_bg_color') == FALSE) ? $myOption_1 : get_option('botosub_box_bg_color');
    424403        echo $myOption_2;
    425         ?>">
    426             <div style="padding-top: 5px; padding-bottom: 5px; min-height: 33px; text-align: center;">
    427                 <span style="<?php echo (get_option('botosub_text_style') == FALSE) ? "font-weight:bold; padding-right: 10px;" : get_option('botosub_text_style'); ?> color:<?php echo get_option('botosub_text_color'); ?>">
    428                     <?php
     404        ?>";
     405       
     406        var botosub_bar_text_style = "<?php echo (get_option('botosub_text_style') == FALSE) ? "font-weight:bold; padding-right: 10px;" : get_option('botosub_text_style'); ?>";
     407       
     408        var botosub_bar_text_color = "<?php echo get_option('botosub_text_color'); ?>";
     409       
     410        var botosub_bar_text = "<?php
    429411                    $myOption = (get_option('botosub_text') == FALSE) ? $botosub_newsletter_text : get_option('botosub_text');
    430412                    echo $myOption;
    431                     ?>
    432                 </span>
    433                 <div class="fb-messengermessageus"
    434                      messenger_app_id="627891880745321"
    435                      page_id="<?php echo get_option('botosub_page_id'); ?>"
    436                      color="blue"
    437                      size="large" >
    438                 </div>
    439             </div>
    440             <a target='_blank' href='https://www.botosub.com' style='position:absolute; bottom:4px; left:5px; font-size:.7em'>botosub</a>
    441         </div>
    442 
    443 
    444         <div id="botosub-plugin-switch-outer"
    445              class="<?php echo $plugin_switch_class ?>"
    446              style="background: <?php $myOption_2 = (get_option('botosub_box_bg_color') == FALSE) ? '#fed136' : get_option('botosub_box_bg_color');
    447              echo $myOption_2; ?>"
    448              onclick="botosubTogglePlugin()"><?php $switchColor = (get_option('botosub_switch_color') == FALSE) ? '#000' : get_option('botosub_switch_color'); ?>
    449             <span id="botosub-plugin-switch" style="float: right; padding: 5px 15px; color:<?php echo $switchColor; ?>">
    450         </span>
    451         </div>
    452     </div>
     413                    ?>";
     414
     415        var botosub_bar_sw_color = "<?php $switchColor = (get_option('botosub_switch_color') == FALSE) ? '#666' : get_option('botosub_switch_color'); ?>";
     416
     417        botosubPlugin.confBar({
     418            /*1*/   enabled : true ,
     419            /*2*/   type :  botosub_bar_position ,//type  "top" or "bottom" with lowercase
     420            /*3*/   hidden : false,
     421            /*4*/   bgColor : botosub_bar_bg_color,//bar background color
     422            /*5*/   switchColor : botosub_bar_sw_color, // switch button color
     423            /*6*/   text : botosub_bar_text,
     424            /*7*/   textStyle : botosub_bar_text_style,
     425            /*8*/   textColor : botosub_bar_text_color,
     426        });
     427
     428    </script>
    453429
    454430    <?php
    455431    }
    456     else if ($tab_location == 'Modal') {
     432    else if ($tab_location === 'Modal') {
    457433    ?>
    458434
    459435    <script>
     436
     437
     438        var botosub_mod_title = "<?php echo (get_option('botosub_mod_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_mod_title'); ?>";
     439        var botosub_mod_title_color = "<?php echo (get_option('botosub_mod_title_color') == FALSE) ? "#666" : get_option('botosub_mod_title_color'); ?>";
     440
     441        var botosub_mod_desc = "<?php echo (get_option('botosub_mod_desc') == FALSE) ? "" : get_option('botosub_mod_desc'); ?>";
     442        var botosub_mod_desc_color = "<?php echo (get_option('botosub_mod_desc_color') == FALSE) ? "" : get_option('botosub_mod_desc_color'); ?>";
    460443       
    461         <?php $mod_img_when = (get_option('botosub_mod_img_when') == FALSE) ? "0" : get_option('botosub_mod_img_when'); ?>
    462         <?php $mod_img_when_val = (get_option('botosub_mod_img_when_val') == FALSE) ? "0" : get_option('botosub_mod_img_when_val'); ?>
    463         var botosub_mWhen = "<?php echo $mod_img_when; ?>";
    464         var botosub_mWhenVal = parseInt("<?php echo $mod_img_when_val; ?>");
    465         var botosub_mFired = false;
    466 
    467         // NEW MODAL
    468         var botosub_modal = new tingle.modal({
    469             footer: false,
    470             stickyFooter: false,
    471             closeMethods: ['overlay', 'button', 'escape'],
    472             closeLabel: "Close",
    473             onOpen: function() {
    474 
    475             },
    476             onClose: function() {
    477                 var d = new Date();
    478                 localStorage.setItem("botosub_mcd", d.getTime());
    479             },
    480             beforeClose: function() {
    481                 return true; // close the modal
    482             }
    483         });
     444        var botosub_mod_img_when = "<?php echo (get_option('botosub_mod_img_when') == FALSE) ? "0" : get_option('botosub_mod_img_when'); ?>";
     445        var botosub_mod_img_when_val = <?php echo (get_option('botosub_mod_img_when_val') == FALSE) ? 30 : get_option('botosub_mod_img_when_val'); ?>;
     446
     447        var botosub_mod_img_again_val = <?php echo (get_option('botosub_mod_img_again_val') == FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>;
     448
     449        var botosub_mod_img_again = "<?php echo (get_option('botosub_mod_img_again') == FALSE) ? "0" : get_option('botosub_mod_img_again'); ?>";
     450
     451        var botosub_mod_img = "<?php echo (get_option('botosub_mod_img') == FALSE) ? "" : get_option('botosub_mod_img'); ?>";
     452
     453        var botosub_mod_img_pos = "<?php echo (get_option('botosub_mod_img_pos') == FALSE) ? "0" : get_option('botosub_mod_img_pos'); ?>";
     454
     455        botosubPlugin.confModal({
     456
     457            /*1*/   enabled : true ,
     458                /*
     459                    MODAL TYPE
     460                    0 PAGE LOAD
     461                    1 EXIT INTENT
     462                    2 SCROLL PERCENTAGE
     463                    3 OPEN INTERVAL     */
     464            /*2*/   type: botosub_mod_img_when,
     465                /*
     466                    TYPE VALUE
     467                    Page Percent ve Interval Seconds  */
     468            /*3*/   typeValue: botosub_mod_img_when_val,
     469
     470                /*   Repeat Type
     471                    0 ALWAYS OPEN
     472                    1 NO REPEAT
     473                    2 OPEN AFTER (repeatValue * MIN)
     474                    3 OPEN AFTER (repeatValue * HOURS)
     475                    4 OPEN AFTER (repeatValue * DAYS)  */
     476            /*4*/   repeatType: botosub_mod_img_again,
     477            /*5*/   repeatValue: botosub_mod_img_again_val,
     478            /*6*/   title: botosub_mod_title,
     479            /*7*/   titleColor: botosub_mod_title_color,
     480            /*8*/   description: botosub_mod_desc,
     481            /*9*/   descriptionColor: botosub_mod_desc_color,
     482            /*10*/  imageURL: botosub_mod_img,
     483
     484                /*  IMAGE VERTICAL ALIGNMENT
     485                    0 IMAGE AT TOP
     486                    1 IMAGE AT MIDDLE
     487                    2 IMAGE AT BOTTOM  */
     488            /*11*/  imagePosition: botosub_mod_img_pos,
     489
     490
     491      });
    484492       
    485         jQuery( document ).ready(function() {
    486 
    487             if (botosub_mWhen === "0") {
    488                 if (!botosub_mFired && botosubModalOk()) { botosub_modal.open(); botosub_mFired = true; }
    489             }
    490             else if (botosub_mWhen === "1") {
    491                 if(document.addEventListener)
    492                     document.addEventListener("mouseout", botosubExitIntent, false);
    493                 else if(document.attachEvent)
    494                     document.attachEvent("on" + "mouseout", botosubExitIntent);
    495             }
    496             else if (botosub_mWhen === "2") {
    497                 jQuery(window).scroll(function(e){
    498                     var s = jQuery(window).scrollTop(),
    499                     d = jQuery(document).height(),
    500                     c = jQuery(window).height();
    501 
    502                     var scrollPercent = (s / (d-c)) * 100;
    503                    
    504                     if (!botosub_mFired && scrollPercent >= (botosub_mWhenVal - 3) && scrollPercent <= (botosub_mWhenVal + 3) && botosubModalOk()) {
    505                         botosub_modal.open();
    506                         botosub_mFired = true;
    507                     }
    508                 });
    509             }
    510             else if (botosub_mWhen === "3") {
    511                 setTimeout(function(){ if (!botosub_mFired && botosubModalOk()) { botosub_modal.open(); botosub_mFired = true; } }, botosub_mWhenVal * 1000);
    512             }
    513         });
    514        
    515         function botosubExitIntent(e) {
    516 
    517             e = e ? e : window.event;
    518 
    519             if(e.target.tagName.toLowerCase() == "input")
    520                 return;
    521 
    522             var vpWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
    523 
    524             if(e.clientX >= (vpWidth - 50))
    525                 return;
    526 
    527             if(e.clientY >= 50)
    528                 return;
    529 
    530             var from = e.relatedTarget || e.toElement;
    531             if(!from) {
    532 
    533                 if (!botosub_mFired && botosubModalOk()) { botosub_modal.open(); botosub_mFired = true; }
    534             }
    535         }
    536 
    537         function botosubModalOk() {
    538            
    539             var lastModalDisp = localStorage.getItem("botosub_mcd");
    540             if (lastModalDisp) {
    541 
    542                 <?php $mod_img_again = (get_option('botosub_mod_img_again') == FALSE) ? "0" : get_option('botosub_mod_img_again'); ?>
    543                 var mAgain = "<?php echo $mod_img_again; ?>";
    544                 if (mAgain === "0") { return true; }
    545                 else if (mAgain === "1") { return false; }
    546                
    547                 var dat = new Date();
    548                 dat.setTime(lastModalDisp);
    549                 var diff = Math.abs(new Date() - dat);
    550                 <?php $mod_img_again_val = (get_option('botosub_mod_img_again_val') == FALSE) ? "10" : get_option('botosub_mod_img_again_val'); ?>
    551                 var mAgainVal = parseInt("<?php echo $mod_img_again_val; ?>");
    552                 var limit = 0;
    553                 if (mAgain === "2") { limit = mAgainVal * 60; }
    554                 else if (mAgain === "3") { limit = mAgainVal * 60 * 60; }
    555                 else if (mAgain === "4") { limit = mAgainVal * 60 * 60 * 24; }
    556                 if ((diff / 1000) < limit) {
    557                     return false;
    558                 }
    559                 else {
    560                     return true;
    561                 }
    562             }
    563             else {
    564                 return true;
    565             }           
    566         }
    567 
    568 
    569         <?php $myOption = (get_option('botosub_mod_img_pos') == FALSE) ? "0" : get_option('botosub_mod_img_pos'); ?>
    570         var mImgPos = "<?php echo $myOption; ?>";
    571         <?php $myOption = (get_option('botosub_mod_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_mod_title'); ?>
    572         <?php $urOption = (get_option('botosub_mod_title_color') == FALSE) ? "" : "color:" . get_option('botosub_mod_title_color') . ";"; ?>
    573         var mTitle = "<span style='display:block; font-size:2.5em; margin-bottom:15px;<?php echo $urOption; ?>'><?php echo $myOption; ?></span>";
    574         <?php $myOption = (get_option('botosub_mod_desc') == FALSE) ? "" : get_option('botosub_mod_desc'); ?>
    575         <?php $urOption = (get_option('botosub_mod_desc_color') == FALSE) ? "color:#666;" : "color:" . get_option('botosub_mod_desc_color') . ";"; ?>
    576         var mDesc = "<span style='display:block; font-size:26px; font-weight:300; line-height:36.4px; margin-bottom:15px;<?php echo $urOption; ?> '><?php echo $myOption; ?></span>";
    577         <?php $myOption = (get_option('botosub_mod_img') == FALSE) ? "" : "<img style='max-height:500px; margin-bottom:15px;' src='" . get_option('botosub_mod_img') . "'>"; ?>
    578         var mImg = "<?php echo $myOption; ?>";
    579         var mButton = '<div class="fb-messengermessageus" messenger_app_id="627891880745321" page_id="<?php echo get_option("botosub_page_id"); ?>" color="blue" size="xlarge"></div>';
    580 
    581         var mContent = "";
    582         if (mImgPos === "0") { mContent = mImg + mTitle + mDesc; }
    583         else if (mImgPos === "1") { mContent = mTitle + mImg + mDesc; }
    584         else if (mImgPos === "2") { mContent = mTitle + mDesc + mImg; }
    585         <?php $urOption = (get_option('botosub_mod_bg_color') == FALSE) ? "" : "background-color:" . get_option('botosub_mod_bg_color') . ";"; ?>
    586         var cnt = "<div style='text-align:center; font-family:alright_sansmedium,HelveticaNeue,Helvetica,Arial,sans-serif; -webkit-font-smoothing:antialiased;<?php echo $urOption; ?>'>" + mContent + mButton;
    587         cnt += "<a target='_blank' href='https://www.botosub.com' style='position:absolute; bottom:7px; right:7px; font-size:.8em'>botosub</a></div>";
    588 
    589         // set content
    590         botosub_modal.setContent(cnt);
    591493
    592494    </script>
    593495
     496    <?php
     497
     498    }
     499    else if ($tab_location === 'Shortcode') {
     500    ?>
     501
     502        <script>
     503
     504            <?php $botosub_newsletter_text = "Subscribe to our Newsletters from Messenger Chatbot!"; ?>
     505            // PLUGIN TITLE
     506            var botosub_sc_title = "<?php echo (get_option('botosub_sc_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_sc_title'); ?>";
     507
     508            var sc_title_color = "<?php echo (get_option('botosub_sc_title_color') == FALSE) ? "" : get_option('botosub_sc_title_color'); ?>";
     509            var sc_desc = "<?php echo (get_option('botosub_sc_desc') == FALSE) ? "" : get_option('botosub_sc_desc'); ?>";
     510            var sc_desc_color = "<?php echo (get_option('botosub_sc_desc_color') == FALSE) ? "" : get_option('botosub_sc_desc_color'); ?>";
     511            var sc_bg_color = "<?php echo (get_option('botosub_sc_bg_color') == FALSE) ? "" : get_option('botosub_sc_bg_color'); ?>";
     512            var sc_img = "<?php echo (get_option('botosub_sc_img') == FALSE) ? "" : get_option('botosub_sc_img'); ?>";
     513
     514            botosubPlugin.confInline ({
     515
     516                /*1*/   enabled : true,
     517                /*2*/   imageURL : sc_img,
     518                /*3*/   title: botosub_sc_title,
     519                /*4*/   titleColor : sc_title_color,
     520                /*5*/   bgColor : sc_bg_color,
     521                /*6*/   description : sc_desc,
     522                /*7*/   descriptionColor : sc_desc_color,
     523             });
     524
     525        </script>
    594526    <?php
    595527    }
     
    600532function botosub_letter_shortcode_init() {
    601533    // Add Shortcode
    602     function botosub_letter_shortcode( $atts , $content = null ) {
    603 
    604         $botosub_newsletter_text = "Subscribe to our Newsletters from Messenger Chatbot!";
    605         // PLUGIN TITLE
    606         $myOption = (get_option('botosub_sc_title') == FALSE) ? $botosub_newsletter_text : get_option('botosub_sc_title');
    607         $sc_title_color = (get_option('botosub_sc_title_color') == FALSE) ? "" : "color:" . get_option('botosub_sc_title_color') . ";";
    608         $sc_desc = (get_option('botosub_sc_desc') == FALSE) ? "" : get_option('botosub_sc_desc');
    609         $sc_desc_color = (get_option('botosub_sc_desc_color') == FALSE) ? "" : "color:" . get_option('botosub_sc_desc_color') . ";";
    610         $sc_bg_color = (get_option('botosub_sc_bg_color') == FALSE) ? "" : "background-color:" . get_option('botosub_sc_bg_color') . ";";
    611 
    612         $sc_img = (get_option('botosub_sc_img') == FALSE) ? "" : "<img src='" . get_option('botosub_sc_img') . "' style='display:inline-block; max-height:158px; float:left;'>";
    613 
    614 
    615         $div = "<div style='position:relative; border-radius: 16px; padding: 20px 20px; border: 1px solid #ccc!important; text-align:center; overflow:auto; height:200px;" . $sc_bg_color . "'>" . $sc_img . "
    616             <div style='display:table-cell; vertical-align:middle; line-height:normal; height:158px;'>
    617                 <span style='font-size: 1.2em; text-align: center; display: block; margin-bottom: 10px; " . $sc_title_color . "'>
    618                         " . $myOption . "
    619                     </span>
    620                     <span style='margin-bottom:10px; display:block; " . $sc_desc_color . "'>" . $sc_desc . "</span>
    621                 <div class='fb-messengermessageus' style='display:block; text-align:center;'
    622                      messenger_app_id='627891880745321'
    623                      page_id=" . get_option('botosub_page_id') . "
    624                      color='blue'
    625                      size='xlarge' >
    626                 </div>
    627             </div><a target='_blank' href='https://www.botosub.com' style='position:absolute; bottom:7px; right:7px; font-size:.7em'>botosub</a>
    628         </div>";
    629         return $div;
    630 
     534    function botosub_letter_shortcode( $atts , $content = null ) {
     535
     536        $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
     537
     538        if ($tab_location == 'Shortcode') {
     539            return "<div class=\"botosubInline\"></div>";
     540        }
    631541    }
    632542    add_shortcode( 'botosub_newsletters', 'botosub_letter_shortcode' );
  • botosub/trunk/readme.txt

    r1682490 r1742355  
    1515<strong>Botosub is a simple yet effective marketing tool for sending newsletters from Facebook and increasing your Facebook users.</strong>
    1616
    17 This plugin offers top/bottom bar and shortcode sign-up for your users to subscribe to your Facebook page. Botosub plugin includes a "Message Us" button which opens a new window to Facebook Messenger. After clicking "Get Started", the user is subscribed and ready to receive newsletters from your Facebook page as a private message.
     17This plugin offers top/bottom bar, pop-up and shortcode sign-up for your users to subscribe to your Facebook page. Botosub plugin includes a "Send to Messenger" button which subscribes your users with one click. After clicking "Send to Messenger", the user is subscribed and ready to receive newsletters from your Facebook page as a private message.
    1818
    1919[youtube https://youtu.be/qX6TN5gIVgk]
     
    3131
    3232* <strong>Facebook page is required in order to send newsletters to Facebook users.</strong>
    33 * <strong>Only users that clicked "Get Started" button can receive chatbot newsletters.</strong>
    34 * Existing FB page followers or users that liked your page should also click "Get Started" button to receive newsletters.
     33* <strong>Only users that clicked "Send to Messenger" button can receive chatbot newsletters.</strong>
     34* Existing FB page followers or users that liked your page should also click "Send to Messenger" button to receive newsletters.
    3535
    3636== Installation ==
     
    41414. Customize your desired settings via Settings > Botosub. Facebook Page ID is required.
    42425. Login and choose your FB page in [Botosub](https://www.botosub.com). After choosing your page, Botosub chatbot can now send newsletters.
    43 6. Click "Message Us" button on your blog. Then click "Get Started" to subscribe yourself for newsletters as well.
     436. Click "Send to Messenger" button on your blog to subscribe yourself for newsletters as well.
    44447. Enter title, content URL, image URL in [Botosub dashboard](https://www.botosub.com/dashboard.html) and send to your users
    4545
     
    5252
    5353= Will my existing followers or people that liked my FB page receive newsletters? =
    54 Existing followers or people that liked your FB page should click "Get Started" button in FB message inbox to receive newsletters.
     54Existing followers or people that liked your FB page should click "Send to Messenger" in your blog or "Get Started" button in FB message inbox to receive newsletters.
    5555
    5656== Screenshots ==
     
    6363
    6464== Changelog ==
     65
     66= 1.3 =
     67
     68* Widgets updated, bugs fixed
    6569
    6670= 1.2 =
Note: See TracChangeset for help on using the changeset viewer.