Plugin Directory

Changeset 1745720


Ignore:
Timestamp:
10/12/2017 10:42:33 PM (8 years ago)
Author:
botosubdev
Message:

1.3.1 tagged

Location:
botosub
Files:
5 added
5 deleted
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • botosub/trunk/botosub.php

    r1742440 r1745720  
    44Plugin URI: https://www.botosub.com/
    55Description: Send Newsletters directly to Facebook Messenger users
    6 Version: 1.3
     6Version: 1.3.1
    77Author: Botosub Dev
    88License:     GPL2
     
    1616add_action('admin_init', 'botosub_admin_init');
    1717add_action('admin_menu', 'botosub_plugin_menu');
     18add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
    1819
    1920$botosub_newsletter_text = "Subscribe to our Newsletters from Messenger Chatbot!";
     
    2930    register_setting('bs_botosub_options', 'botosub_switch_color');
    3031    register_setting('bs_botosub_options', 'botosub_plugin_type');
     32    register_setting('bs_botosub_options', 'botosub_bar_type');
    3133   
    3234    register_setting('bs_botosub_options', 'botosub_sc_title');
     
    4749    register_setting('bs_botosub_options', 'botosub_mod_img_when_val');
    4850    register_setting('bs_botosub_options', 'botosub_mod_img_again');
    49     register_setting('bs_botosub_options', 'botosub_mod_img_again_val');
     51   
     52    register_setting('bs_botosub_options', 'botosub_bar_enabled');
     53    register_setting('bs_botosub_options', 'botosub_scode_enabled');
     54    register_setting('bs_botosub_options', 'botosub_mod_enabled');
     55}
     56
     57function load_custom_wp_admin_style() {
     58    wp_enqueue_style("botosub-admin-style", plugins_url('/css/adminStyle.css', __FILE__));
    5059}
    5160
     
    7382    </script>
    7483    '; // 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__));
     84    wp_enqueue_style("botosub-plugin", plugins_url('/css/botosubPlugin.css', __FILE__));
     85    wp_enqueue_script("botosub-plugin", plugins_url('/src/botosubPlugin.min.js', __FILE__));
    7786
    7887}
     
    8594function botosub_plugin_options()
    8695{
    87 //    echo '<div class="wrap">'; ?>
     96?>
     97
    8898<div class="wrap">
    8999    <h2>Botosub - Newsletters From Messenger Chatbot</h2>
     
    119129
    120130                    <select id="botosub_plugin_type" name="botosub_plugin_type" onchange="botosubChangeHandler()" style="width:40%">
    121                       <option value="Top" <?php if ($tab_location == "Top") echo "selected"; ?>>Top Bar</option>
    122                       <option value="Bottom" <?php if ($tab_location == "Bottom") echo "selected"; ?>>Bottom Bar</option>
     131                      <option value="Bar" <?php if ($tab_location == "Top" || $tab_location == "Bottom" || $tab_location == "Bar") echo "selected"; ?>>Bar</option>
    123132                      <option value="Shortcode" <?php if ($tab_location == "Shortcode") echo "selected"; ?>>Shortcode</option>
    124133                      <option value="Modal" <?php if ($tab_location == "Modal") echo "selected"; ?>>Modal</option>
    125                       <option value="None" <?php if ($tab_location == "None") echo "selected"; ?>>None</option>
    126134                    </select>
    127135                </td>
    128136
    129             </tr>
     137                <!-- bar -->
     138                <th id="botosub_bar_enabled_title" class="botosub_bar_class" scope="row">Disabled</th>
     139                <td class="botosub_bar_class">
     140                    <label class="btsSwitch">
     141                      <input id="botosub_bar_enabled" name="botosub_bar_enabled" type="checkbox" onchange="return enabledChTitle(this.id);">
     142                      <span class="btsSlider btsRound"></span>
     143                    </label>
     144                </td>
     145
     146                <!-- scode -->
     147                <th id="botosub_scode_enabled_title" class="botosub_scode_class" scope="row">Disabled</th>
     148                <td class="botosub_scode_class">
     149                    <label class="btsSwitch">
     150                      <input id="botosub_scode_enabled" name="botosub_scode_enabled" type="checkbox" onchange="return enabledChTitle(this.id);">
     151                      <span class="btsSlider btsRound"></span>
     152                    </label>
     153                </td>
     154
     155                <!-- modal -->
     156                <th id="botosub_mod_enabled_title" class="botosub_mod_class" scope="row">Disabled</th>
     157                <td class="botosub_mod_class">
     158                    <label class="btsSwitch">
     159                      <input id="botosub_mod_enabled" name="botosub_mod_enabled" type="checkbox" onchange="return enabledChTitle(this.id);">
     160                      <span class="btsSlider btsRound"></span>
     161                    </label>
     162                </td>
     163
     164            </tr>
     165           
     166            <tr valign="top">
     167                <!-- bar -->
     168                <th class="botosub_bar_class" scope="row">Bar Type</th>
     169                <td class="botosub_bar_class">
     170                    <?php
     171                    $bar_type = (get_option('botosub_bar_type') == FALSE) ? 'Bottom' : get_option('botosub_bar_type');
     172                    ?>
     173
     174                    <select id="botosub_bar_type" name="botosub_bar_type" style="width:40%">
     175                      <option value="Top" <?php if ($bar_type == "Top") echo "selected"; ?>>Top</option>
     176                      <option value="Bottom" <?php if ($bar_type == "Bottom") echo "selected"; ?>>Bottom</option>
     177                    </select>
     178                </td>
     179            </tr>
     180           
    130181            <tr valign="top">
    131182                <!-- bar -->
     
    272323           
    273324        </table>
    274 
    275         <p class="submit" style="text-align: center"><input type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>"/></p>
     325       
     326        <p class="submit" style="text-align: center"><input type="submit" class="button-primary" value="<?php echo 'Save Changes'; ?>"/></p>
    276327    </form>
    277328    <br/><br/>
     
    288339        var val = document.getElementById('botosub_plugin_type').value;
    289340
    290        if ( val === 'Shortcode' ) {
    291            displBar = "none";
    292            displSCode = "table-cell";
    293            displModal = "none";
    294        } else if ( val === 'Modal' ) {
    295            displBar = "none";
    296            displSCode = "none";
    297            displModal = "table-cell";
    298        } else if ( val === 'None' ) {
    299            displBar = "none";
    300            displSCode = "none";
    301            displModal = "none";
    302        } else {
    303            displBar = "table-cell";
    304            displSCode = "none";
    305            displModal = "none";
    306        }
     341
     342        if ( val === 'Shortcode' ) {
     343            displBar = "none";
     344            displSCode = "table-cell";
     345            displModal = "none";
     346        } else if ( val === 'Modal' ) {
     347            displBar = "none";
     348            displSCode = "none";
     349            displModal = "table-cell";
     350        } else if ( val === 'None' ) {
     351            displBar = "none";
     352            displSCode = "none";
     353            displModal = "none";
     354        } else {
     355            displBar = "table-cell";
     356            displSCode = "none";
     357            displModal = "none";
     358        }
    307359
    308360        var barElements = document.getElementsByClassName("botosub_bar_class");
     
    320372            modElements[ind].style.display = displModal;
    321373        }
    322 
    323374    }
    324375   
     
    351402    }
    352403   
    353     botosubChangeHandler();
    354     botosubWhenChHandler();
    355     botosubAgainChHandler();
    356 
     404   
     405    btsInit();
     406   
     407    function btsInit() {
     408
     409        botosubChangeHandler();
     410        botosubWhenChHandler();
     411        botosubAgainChHandler();
     412
     413
     414        var botosub_bar_enabled = <?php echo (get_option('botosub_bar_enabled') === FALSE || get_option('botosub_bar_enabled') === "") ? "false" : "true"; ?>;
     415        var botosub_scode_enabled = <?php echo (get_option('botosub_scode_enabled') === FALSE || get_option('botosub_scode_enabled') === "") ? "false" : "true"; ?>;
     416        var botosub_mod_enabled = <?php echo (get_option('botosub_mod_enabled') === FALSE || get_option('botosub_mod_enabled') === "") ? "false" : "true"; ?>;
     417
     418        if (botosub_bar_enabled) {
     419            document.getElementById("botosub_bar_enabled").checked = true;
     420            enabledChTitle("botosub_bar_enabled");
     421        }
     422        if (botosub_scode_enabled) {
     423            document.getElementById("botosub_scode_enabled").checked = true;
     424            enabledChTitle("botosub_scode_enabled");
     425        }
     426        if (botosub_mod_enabled) {
     427            document.getElementById("botosub_mod_enabled").checked = true;
     428            enabledChTitle("botosub_mod_enabled");
     429        }
     430    }
     431
     432    function enabledChTitle(id) {
     433
     434        if (document.getElementById(id).checked) {
     435            document.getElementById(id + "_title").innerHTML = "Enabled";
     436        }
     437        else {
     438            document.getElementById(id + "_title").innerHTML = "Disabled";
     439        }
     440    }
     441   
    357442</script>
    358443    <?php
     
    370455    if (get_option('botosub_fb_lang')==''){ $lang = "en_US"; } else { $lang = esc_attr( get_option('botosub_fb_lang') ); }
    371456
    372     $tab_location_default = 'None';
     457    $tab_location_default = 'Modal';
    373458    $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
    374459
     460    $bar_enabled = (get_option('botosub_bar_enabled') === FALSE || get_option('botosub_bar_enabled') === "") ? "false" : "true";
     461    $scode_enabled = (get_option('botosub_scode_enabled') === FALSE || get_option('botosub_scode_enabled') === "") ? "false" : "true";
     462    $mod_enabled = (get_option('botosub_mod_enabled') === FALSE || get_option('botosub_mod_enabled') === "") ? "false" : "true";
     463   
    375464    ?>
    376465    <script>
    377466
     467        var botosub_bar_enabled = <?php echo $bar_enabled; ?>;
     468        var botosub_scode_enabled = <?php echo $scode_enabled; ?>;
     469        var botosub_mod_enabled = <?php echo $mod_enabled; ?>;
     470
    378471        botosubPlugin.page_id = <?php echo $botosub_page_id; ?>;
    379472
     
    385478
    386479
    387     if ($tab_location === 'Top' || $tab_location === 'Bottom') {
     480    if ($bar_enabled === "true") {
    388481    ?>
    389482   
     
    391484
    392485        var botosub_bar_position = "";
    393         var botosub_tab_location = "<?php echo $tab_location ?>";
     486        var botosub_tab_location = "<?php echo (get_option('botosub_bar_type') == FALSE) ? 'Bottom' : get_option('botosub_bar_type'); ?>";
    394487        if (botosub_tab_location === "Top") {
    395488            botosub_bar_position = "top";
     
    416509
    417510        botosubPlugin.confBar({
    418             /*1*/   enabled : true ,
     511            /*1*/   enabled : botosub_bar_enabled,
    419512            /*2*/   type :  botosub_bar_position ,//type  "top" or "bottom" with lowercase
    420513            /*3*/   hidden : false,
     
    430523    <?php
    431524    }
    432     else if ($tab_location === 'Modal') {
     525    if ($mod_enabled === "true") {
    433526    ?>
    434527
     
    455548        botosubPlugin.confModal({
    456549
    457             /*1*/   enabled : true ,
     550            /*1*/   enabled : botosub_mod_enabled,
    458551                /*
    459552                    MODAL TYPE
     
    497590
    498591    }
    499     else if ($tab_location === 'Shortcode') {
     592    if ($scode_enabled === "true") {
    500593    ?>
    501594
     
    514607            botosubPlugin.confInline ({
    515608
    516                 /*1*/   enabled : true,
     609                /*1*/   enabled : botosub_scode_enabled,
    517610                /*2*/   imageURL : sc_img,
    518611                /*3*/   title: botosub_sc_title,
     
    534627    function botosub_letter_shortcode( $atts , $content = null ) {
    535628
    536         $tab_location = (get_option('botosub_plugin_type') == FALSE) ? $tab_location_default : get_option('botosub_plugin_type');
    537 
    538         if ($tab_location == 'Shortcode') {
     629        $scode_enabled = (get_option('botosub_scode_enabled') === FALSE || get_option('botosub_scode_enabled') === "") ? "false" : "true";
     630
     631        if ($scode_enabled == 'true') {
    539632            return "<div class=\"botosubInline\"></div>";
    540633        }
  • botosub/trunk/readme.txt

    r1742450 r1745720  
    44Requires at least: 3.1
    55Tested up to: 4.8
    6 Stable tag: 1.3
     6Stable tag: 1.3.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6464== Changelog ==
    6565
     66= 1.3.1 =
     67
     68* Multiple widgets can be added to a page now
     69
    6670= 1.3 =
    6771
Note: See TracChangeset for help on using the changeset viewer.