Plugin Directory

Changeset 1581607


Ignore:
Timestamp:
01/25/2017 12:36:13 AM (9 years ago)
Author:
elevio
Message:

Allow for V4 loading, and custom tag taxonomy

Location:
elevio/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • elevio/trunk/elevio.php

    r1468150 r1581607  
    66Author: Elevio
    77Author URI: https://elev.io
    8 Version: 3.5.5
     8Version: 4.0.1
    99*/
    1010
  • elevio/trunk/plugin_files/Elevio.class.php

    r1459968 r1581607  
    1919    protected $category_taxonomy = null;
    2020    protected $post_taxonomy = null;
     21    protected $tag_taxonomy = null;
     22    protected $version = null;
    2123
    2224    /**
     
    127129
    128130    /**
     131     * Returns Elevio tag taxonomy
     132     *
     133     * @return int
     134     */
     135    public function get_tag_taxonomy()
     136    {
     137        if (is_null($this->tag_taxonomy))
     138        {
     139            $this->tag_taxonomy = get_option('elevio_tag_taxonomy', 'post_tag');
     140        }
     141
     142        return $this->tag_taxonomy;
     143    }
     144
     145    /**
    129146     * Returns Elevio secret_id
    130147     *
     
    139156
    140157        return $this->secret_id;
     158    }
     159
     160    /**
     161     * Returns version they want to load
     162     * This is a new setting, so needs to backfill
     163     *
     164     * @return int
     165     */
     166    public function get_version()
     167    {
     168
     169        if (is_null($this->version))
     170        {
     171            $this->version = (int)get_option('elevio_version');
     172
     173            if (!($this->version)) {
     174                if(!($this->get_account_id())) {
     175                    // they are new, load v4
     176                    $this->version = 4;
     177                } else {
     178                    // they were already using... be safe and load v3
     179                    $this->version = 3;
     180                }
     181            }
     182        }
     183
     184        return $this->version;
    141185    }
    142186
  • elevio/trunk/plugin_files/ElevioAdmin.class.php

    r1450968 r1581607  
    151151        delete_option('elevio_category_taxonomy');
    152152        delete_option('elevio_post_taxonomy');
     153        delete_option('elevio_tag_taxonomy');
     154        delete_option('elevio_version');
    153155    }
    154156
    155157    protected function update_options($data)
    156158    {
     159
    157160        // check if we are handling Elevio settings form
    158161        if (isset($data['settings_form']) == false && isset($data['new_account_id_form']) == false)
     
    181184        }
    182185
     186        if(isset($data['elevio_tag_taxonomy'])) {
     187            update_option('elevio_tag_taxonomy', $data['elevio_tag_taxonomy']);
     188        }
     189
     190        if(isset($data['elevio_version'])) {
     191            update_option('elevio_version', $data['elevio_version']);
     192        }
     193
    183194
    184195        if (isset($data['changes_saved']) && $data['changes_saved'] == '1')
  • elevio/trunk/plugin_files/helpers/SettingsHelper.class.php

    r1450968 r1581607  
    5252                            </td>
    5353                        </tr>
    54                         <tr>
     54
     55                        <tr>
     56                            <th scope="row">
     57                                <label for="elevio_is_enabled">I would like to load versions: <?php echo Elevio::get_instance()->get_version() ?></label>
     58                            </th>
     59                            <td>
     60                                <select name="elevio_version" id="elevio_version" >
     61                                    <?php foreach (array(3, 4) as $version) { ?>
     62                                        <option <?php echo(Elevio::get_instance()->get_version() === $version?'selected="selected"':'')?>><?php echo $version;?></option>
     63                                    <?php }?>
     64                                </select>
     65                                (Version 4 is recommended)
     66                            </td>
     67                        </tr>
     68                        <tr>
    5569                            <th scope="row">
    5670                                <label for="elevio_category_taxonomy">Category taxonomy:</label>
     
    7488                                    <?php }?>
    7589                                </select>
     90                            </td>
     91                        </tr>
     92                        <tr>
     93                            <th scope="row">
     94                                <label for="elevio_tag_taxonomy">Tag taxonomy:</label>
     95                            </th>
     96                            <td>
     97                                <select name="elevio_category_taxonomy" id="elevio_category_taxonomy" >
     98                                    <?php foreach (get_taxonomies() as $term) { ?>
     99                                        <option <?php echo(Elevio::get_instance()->get_category_taxonomy() === $term?'selected="selected"':'')?>><?php echo $term;?></option>
     100                                    <?php }?>
     101                                </select>
    76102                            </td>
    77103                        </tr>
  • elevio/trunk/plugin_files/helpers/TrackingCodeInfoHelper.class.php

    r1450968 r1581607  
    1717            </strong>)</p></div>
    1818
    19             <form method="post" action="?page=elevio_settings">
     19            <div class="postbox">
     20                <form method="post" action="?page=elevio_settings">
     21                    <div class="postbox_content">
     22                        <table class="form-table">
     23                            <tr>
     24                                <th scope="row">
     25                                    <label for="elevio_is_enabled">Show elevio on site?</label>
     26                                </th>
     27                                <td>
     28                                    <input type="checkbox" name="elevio_is_enabled" id="elevio_is_enabled" value="1" <?php echo Elevio::get_instance()->is_enabled()?'checked="checked"':''; ?> />
     29                                </td>
     30                            </tr>
    2031
    21                 <table class="form-table">
    22                     <tr>
    23                         <th scope="row">
    24                             <label for="elevio_is_enabled">Show elevio on site?</label>
    25                         </th>
    26                         <td>
    27                             <input type="checkbox" name="elevio_is_enabled" id="elevio_is_enabled" value="1" <?php echo Elevio::get_instance()->is_enabled()?'checked="checked"':''; ?> />
    28                         </td>
    29                     </tr>
     32                            <tr>
     33                                <th scope="row">
     34                                    <label for="elevio_version">I would like to load version: </label>
     35                                </th>
     36                                <td>
     37                                    <select name="elevio_version" id="elevio_version" >
     38                                        <?php foreach (array(3, 4) as $version) { ?>
     39                                            <option <?php echo(Elevio::get_instance()->get_version() === $version?'selected="selected"':'')?>><?php echo $version;?></option>
     40                                        <?php }?>
     41                                    </select>
     42                                    (Version 4 is recommended)
     43                                </td>
     44                            </tr>
    3045
    31                     <tr>
    32                         <th scope="row">
    33                             <label for="elevio_category_taxonomy">Category taxonomy:</label>
    34                         </th>
    35                         <td>
    36                             <select name="elevio_category_taxonomy" id="elevio_category_taxonomy" >
    37                                 <?php foreach (get_taxonomies() as $term) { ?>
    38                                     <option <?php echo(Elevio::get_instance()->get_category_taxonomy() === $term?'selected="selected"':'')?>><?php echo $term;?></option>
    39                                 <?php }?>
    40                             </select>
    41                         </td>
    42                     </tr>
    43                     <tr>
    44                         <th scope="row">
    45                             <label for="elevio_post_taxonomy">Post taxonomy:</label>
    46                         </th>
    47                         <td>
    48                            <select name="elevio_post_taxonomy" id="elevio_post_taxonomy" >
    49                                 <?php foreach (get_post_types() as $term) { ?>
    50                                     <option <?php echo(Elevio::get_instance()->get_post_taxonomy() === $term?'selected="selected"':'')?>><?php echo $term;?></option>
    51                                 <?php }?>
    52                             </select>
    53                         </td>
    54                     </tr>
     46                            <tr>
     47                                <th scope="row">
     48                                    <label for="elevio_category_taxonomy">Category taxonomy:</label>
     49                                </th>
     50                                <td>
     51                                    <select name="elevio_category_taxonomy" id="elevio_category_taxonomy" >
     52                                        <?php foreach (get_taxonomies() as $term) { ?>
     53                                            <option <?php echo(Elevio::get_instance()->get_category_taxonomy() === $term?'selected="selected"':'')?>><?php echo $term;?></option>
     54                                        <?php }?>
     55                                    </select>
     56                                </td>
     57                            </tr>
     58                            <tr>
     59                                <th scope="row">
     60                                    <label for="elevio_post_taxonomy">Post taxonomy:</label>
     61                                </th>
     62                                <td>
     63                                   <select name="elevio_post_taxonomy" id="elevio_post_taxonomy" >
     64                                        <?php foreach (get_post_types() as $term) { ?>
     65                                            <option <?php echo(Elevio::get_instance()->get_post_taxonomy() === $term?'selected="selected"':'')?>><?php echo $term;?></option>
     66                                        <?php }?>
     67                                    </select>
     68                                </td>
     69                            </tr>
     70                            <tr>
     71                                <th scope="row">
     72                                    <label for="elevio_post_taxonomy">Tag taxonomy:</label>
     73                                </th>
     74                                <td>
     75                                   <select name="elevio_tag_taxonomy" id="elevio_tag_taxonomy" >
     76                                        <?php foreach (get_taxonomies() as $term) { ?>
     77                                            <option <?php echo(Elevio::get_instance()->get_tag_taxonomy() === $term?'selected="selected"':'')?>><?php echo $term;?></option>
     78                                        <?php }?>
     79                                    </select>
     80                                </td>
     81                            </tr>
    5582
    56                 </table>
     83                        </table>
    5784
    58                 <p class="submit">
    59                     <input type="hidden" name="settings_form" value="1">
    60                     <input type="hidden" name="elevio_enable_form" value="1">
    61                     <input type="submit" class="button-primary" value="<?php _e('Save changes') ?>" />
    62                 </p>
    63             </form>
     85                        <p class="submit">
     86                            <input type="hidden" name="settings_form" value="1">
     87                            <input type="hidden" name="elevio_enable_form" value="1">
     88                            <input type="submit" class="button-primary" value="<?php _e('Save changes') ?>" />
     89                        </p>
     90                    </div>
     91                </form>
     92            </div>
    6493            <?php
    6594
  • elevio/trunk/plugin_files/models/post.php

    r1468150 r1581607  
    7676
    7777  function set_tags_value() {
     78    $args['tag_taxonomy'] = Elevio::get_instance()->get_tag_taxonomy();
    7879    global $json_api;
    7980      $this->tags = array();
    80       if ($wp_tags = get_the_tags($this->id)) {
     81      if ($wp_tags = get_the_terms($this->id, $args['tag_taxonomy'])) {
    8182        foreach ($wp_tags as $wp_tag) {
    8283          $this->tags[] = new Elevio_Sync_Tag($wp_tag);
  • elevio/trunk/readme.txt

    r1468150 r1581607  
    22Contributors: Elevio
    33Tags: zendesk, desk.com, uservoice, zopim, olark, snapengage, livechat, knowledge base, live chat, support, intercom, statuspage, freshdesk, intercom
    4 Stable tag: 3.5.5
     4Stable tag: 4.0.1
    55Requires at least: 2.8
    66Tested up to: 4.4.2
     
    5151== Changelog ==
    5252
     53= 4.0.1 =
     54* Allows direct loading of Version 4
     55* Allows for custom taxonomy
     56
    5357= 3.5.0 =
    5458* Choose the category and post taxonomy you want to sync, in case you are using something other than the standard structure.
Note: See TracChangeset for help on using the changeset viewer.