Plugin Directory

Changeset 1957112


Ignore:
Timestamp:
10/15/2018 07:44:49 PM (7 years ago)
Author:
thrivehive
Message:

v2.4

Location:
thrivehive/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • thrivehive/trunk/README.md

    r1954622 r1957112  
    37371. Download `whm.pem` from Google Drive Dev and place it in `~/Thrivehive/keys/`
    38382. Run `sh scripts/update_skeleton_directory.sh`
     39
     40## --- IMPORTANT ---
     41
     42The version number of the plugin MUST COMPLY with the following format:
     43
     44```
     45vX.X(XX)
     46```
     47
     48For example:
     49
     50`v1.1 (Regular release)`
     51
     52or
     53
     54`v1.101 (Bugfix)`
     55
     56The version needs to be updated in thrivehive.php and the change needs to be added to the changelog here along with the version number.
    3957
    4058## Deployment
     
    87105
    88106## Screenshots
    89 
    90107
    91108## Changelog
  • thrivehive/trunk/controllers/menus.php

    r1951087 r1957112  
    99require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
    1010require_once( ABSPATH . 'wp-includes/nav-menu.php' );
    11 include_once( TH_PLUGIN_ROOT . '/lib/thrivehive_buttons.php');
    1211include_once( TH_PLUGIN_ROOT . '/lib/thrivehive_forms.php');
    1312include_once( TH_PLUGIN_ROOT . '/lib/thrivehive_theme_options.php');
     
    546545
    547546        return array('message' => 'success');
    548     }
    549 
    550     /**
    551     *Gets custom thrivehive buttons
    552     *@example URL - /menus/get_buttons
    553     *@api
    554     *@return array of button objects and their properties
    555     **/
    556     public function get_buttons() {
    557         global $json_api;
    558 
    559         $buttons = get_thrivehive_buttons();
    560 
    561         return array('buttons' => $buttons);
    562     }
    563 
    564     /**
    565     *Gets a single thrivehive button
    566     *@example URL - /menus/get_button
    567     *@api
    568     *@return array containing the button and its properties
    569     **/
    570     public function get_button() {
    571         global $json_api;
    572 
    573         if(!isset($_REQUEST['id'])){
    574             $json_api->error("You must include the `id` of the button to retrieve");
    575         }
    576         $button = get_thrivehive_button($_REQUEST['id']);
    577 
    578         return array('button' => $button);
    579     }
    580 
    581     /**
    582     *Sets the button's values and updates it in the database
    583     *@example URL - /menus/set_button
    584     *@api
    585     *@return array containing the button with its new values
    586     **/
    587     public function set_button() {
    588         global $json_api;
    589 
    590         if(!isset($_REQUEST['id'])){
    591             $json_api->error("You must include the `id` of the button to edit");
    592         }
    593         if(!isset($_REQUEST['text'])){
    594             $json_api->error("You must include the `text` value");
    595         }
    596         if(!isset($_REQUEST['norm_gradient1'])){
    597             $json_api->error("You must include the `norm_gradient1` value");
    598         }
    599         if(!isset($_REQUEST['norm_gradient2'])){
    600             $json_api->error("You must include the `norm_gradient2` value");
    601         }
    602         if(!isset($_REQUEST['hover_gradient1'])){
    603             $json_api->error("You must include the `hover_gradient1` value");
    604         }
    605         if(!isset($_REQUEST['hover_gradient2'])){
    606             $json_api->error("You must include the `hover_gradient2` value");
    607         }
    608         if(!isset($_REQUEST['norm_border_color'])){
    609             $json_api->error("You must include the `norm_border_color` value");
    610         }
    611         if(!isset($_REQUEST['hover_border_color'])){
    612             $json_api->error("You must include the `hover_border_color` value");
    613         }
    614         if(!isset($_REQUEST['norm_text_color'])){
    615             $json_api->error("You must include the `norm_text_color` value");
    616         }
    617         if(!isset($_REQUEST['hover_text_color'])){
    618             $json_api->error("You must include the `hover_text_color` value");
    619         }
    620         if(!isset($_REQUEST['generated_css'])){
    621             $json_api->error("You must include the `generated_css` value");
    622         }
    623         if(!isset($_REQUEST['url'])){
    624             $json_api->error("You must include the redirect `url` value");
    625         }
    626         if(!isset($_REQUEST['target'])){
    627             $json_api->error("You must include the window `target` value");
    628         }
    629         /*if(!isset($_REQUEST['nonce'])){
    630             $json_api->error("You must include the `nonce` value");
    631         }*/
    632 
    633         $nonce_id = $json_api->get_nonce_id('menus', 'set_button');
    634 
    635         $nonce = wp_create_nonce($nonce_id);
    636 
    637         if(!wp_verify_nonce($nonce, $nonce_id)){
    638             $json_api->error("Your 'nonce' value was incorrect. Use the 'get_nonce' API method.");
    639         }
    640 
    641         $data = array(
    642             'text'=>stripcslashes($_REQUEST['text']),
    643             'norm_gradient1'=>$_REQUEST['norm_gradient1'],
    644             'norm_gradient2'=>$_REQUEST['norm_gradient2'],
    645             'hover_gradient1'=>$_REQUEST['hover_gradient1'],
    646             'hover_gradient2'=>$_REQUEST['hover_gradient2'],
    647             'norm_border_color'=>$_REQUEST['norm_border_color'],
    648             'hover_border_color'=>$_REQUEST['hover_border_color'],
    649             'norm_text_color'=>$_REQUEST['norm_text_color'],
    650             'hover_text_color'=>$_REQUEST['hover_text_color'],
    651             'generated_css'=>$_REQUEST['generated_css'],
    652             'url'=>$_REQUEST['url'],
    653             'target'=>$_REQUEST['target']
    654             );
    655 
    656         $button = set_thrivehive_button($_REQUEST['id'], $data);
    657 
    658         return array($button);
    659     }
    660 
    661     /**
    662     *Create a new thrivehive button with all the specified values
    663     *@example URL - /menus/create_button
    664     *@api
    665     *@return array containing the button created
    666     **/
    667     public function create_button() {
    668         global $json_api;
    669 
    670         if(!isset($_REQUEST['text'])){
    671             $json_api->error("You must include the `text` value");
    672         }
    673         if(!isset($_REQUEST['norm_gradient1'])){
    674             $json_api->error("You must include the `norm_gradient1` value");
    675         }
    676         if(!isset($_REQUEST['norm_gradient2'])){
    677             $json_api->error("You must include the `norm_gradient2` value");
    678         }
    679         if(!isset($_REQUEST['hover_gradient1'])){
    680             $json_api->error("You must include the `hover_gradient1` value");
    681         }
    682         if(!isset($_REQUEST['hover_gradient2'])){
    683             $json_api->error("You must include the `hover_gradient2` value");
    684         }
    685         if(!isset($_REQUEST['norm_border_color'])){
    686             $json_api->error("You must include the `norm_border_color` value");
    687         }
    688         if(!isset($_REQUEST['hover_border_color'])){
    689             $json_api->error("You must include the `hover_border_color` value");
    690         }
    691         if(!isset($_REQUEST['norm_text_color'])){
    692             $json_api->error("You must include the `norm_text_color` value");
    693         }
    694         if(!isset($_REQUEST['hover_text_color'])){
    695             $json_api->error("You must include the `hover_text_color` value");
    696         }
    697         if(!isset($_REQUEST['generated_css'])){
    698             $json_api->error("You must include the `generated_css` value");
    699         }
    700         if(!isset($_REQUEST['url'])){
    701             $json_api->error("You must include the redirect `url` value");
    702         }
    703         if(!isset($_REQUEST['target'])){
    704             $json_api->error("You must include the window `target` value");
    705         }
    706         /*if(!isset($_REQUEST['nonce'])){
    707             $json_api->error("You must include the `nonce` value");
    708         }*/
    709 
    710         $nonce_id = $json_api->get_nonce_id('menus', 'create_button');
    711 
    712         $nonce = wp_create_nonce($nonce_id);
    713 
    714         if(!wp_verify_nonce($nonce, $nonce_id)){
    715             $json_api->error("Your 'nonce' value was incorrect. Use the 'get_nonce' API method.");
    716         }
    717         $data = array(
    718             'text'=>stripcslashes($_REQUEST['text']),
    719             'norm_gradient1'=>$_REQUEST['norm_gradient1'],
    720             'norm_gradient2'=>$_REQUEST['norm_gradient2'],
    721             'hover_gradient1'=>$_REQUEST['hover_gradient1'],
    722             'hover_gradient2'=>$_REQUEST['hover_gradient2'],
    723             'norm_border_color'=>$_REQUEST['norm_border_color'],
    724             'hover_border_color'=>$_REQUEST['hover_border_color'],
    725             'norm_text_color'=>$_REQUEST['norm_text_color'],
    726             'hover_text_color'=>$_REQUEST['hover_text_color'],
    727             'generated_css'=>$_REQUEST['generated_css'],
    728             'url'=>$_REQUEST['url'],
    729             'target'=>$_REQUEST['target']
    730             );
    731         $button = create_thrivehive_button($data);
    732         return array('button' => $button);
    733     }
    734 
    735     public function delete_button() {
    736         global $json_api;
    737 
    738         if(!isset($_REQUEST['id'])){
    739             $json_api->error("You must include the `id` of the button to edit");
    740         }
    741         /*if(!isset($_REQUEST['nonce'])){
    742             $json_api->error("You must include the `nonce` value");
    743         }*/
    744 
    745         $nonce_id = $json_api->get_nonce_id('menus', 'delete_button');
    746 
    747         $nonce = wp_create_nonce($nonce_id);
    748 
    749         if(!wp_verify_nonce($nonce, $nonce_id)){
    750             $json_api->error("Your 'nonce' value was incorrect. Use the 'get_nonce' API method.");
    751         }
    752 
    753         delete_thrivehive_button($_REQUEST['id']);
    754 
    755         return array();
    756547    }
    757548
  • thrivehive/trunk/controllers/snippets.php

    r1914280 r1957112  
    157157                $html = th_display_button($atts);
    158158                break;
     159            case "th_wysiwyg_button":
     160                $html = th_display_wysiwyg_button($atts);
     161                break;
    159162            case "th_address":
    160163                $html = th_display_address($atts);
  • thrivehive/trunk/lib/snippet_display.php

    r1951087 r1957112  
    6969
    7070    return  "<a class='thrivehive-button' target='$target' style='$css display: inline-block;' href='$url'>$text</a>";
     71}
     72
     73/**
     74 *Displays a wysiwyg button
     75 *@return string css for the specified thrivehive button
     76 *
     77 * todo: refactor this so the widget and shortcode output the same html
     78 **/
     79function th_display_wysiwyg_button ($atts){
     80    $id = isset($atts['id']) ? $atts['id'] : 1;
     81    $buttonOptions = get_wysiwyg_button( $id );
     82    $text = stripslashes($buttonOptions['text']);
     83    $url = stripslashes($buttonOptions['url']);
     84    $target = stripslashes($buttonOptions['target']);
     85    $classes =  stripslashes($buttonOptions['classes']);
     86
     87    return  "<a class='$classes' target='$target' href='$url'>$text</a>";
    7188}
    7289
  • thrivehive/trunk/lib/thrivehive_buttons.php

    r1136398 r1957112  
    8080    return $wpdb->prefix . "TH_" . "buttons";
    8181}
     82
    8283?>
  • thrivehive/trunk/thrivehive.php

    r1954622 r1957112  
    55   *Plugin URI: http://thrivehive.com
    66   *Description: A plugin to include ThriveHive's tracking code
    7    *Version: 2.301
     7   *Version: 2.4
    88   *Author: ThriveHive
    99   *Author URI: http://thrivehive.com
     
    2828@include_once TH_PLUGIN_ROOT . "/models/attachment.php";
    2929@include_once TH_PLUGIN_ROOT . "/lib/thrivehive_buttons.php";
     30@include_once TH_PLUGIN_ROOT . "/lib/thrivehive_wysiwyg_buttons.php";
    3031@include_once TH_PLUGIN_ROOT . "/lib/thrivehive_forms.php";
    3132@include_once TH_PLUGIN_ROOT . "/lib/thrivehive_theme_options.php";
     
    3940function version_check(){
    4041  //UPDATE THIS WHEN WE MAKE VERSION CHANGES
    41   $db_version = '1.119';
     42  $db_version = '1.120';
    4243  $update = null;
    4344
     
    4647    $update = $db_version;
    4748  }
     49
    4850  if(!$ver || $update){
    4951    //update_option('thrivehive_vers', $db_version);
    5052    thrivehive_create_button_db($update);
     53    thrivehive_create_wysiwyg_button_db($update);
    5154    thrivehive_create_theme_options_table($update);
    5255    thrivehive_create_forms_db($update);
    5356    thrivehive_create_snippets_db($update);
    54 
    55 }}
     57  }
     58}
    5659
    5760add_filter('body_class', 'bg_repeat_body_class');
     
    423426add_shortcode( 'th_button', 'th_display_button' );
    424427
     428//[th_button]
     429add_shortcode( 'th_wysiwyg_button', 'th_display_wysiwyg_button' );
     430
    425431//[th_address]
    426432add_shortcode( 'th_address', 'th_display_address');
     
    530536register_activation_hook(__FILE__, 'th_permalinks');
    531537register_activation_hook(__FILE__, 'thrivehive_create_button_db');
     538register_activation_hook(__FILE__, 'thrivehive_create_wysiwyg_button_db');
    532539register_activation_hook(__FILE__, 'thrivehive_create_theme_options_table');
    533540register_activation_hook(__FILE__, 'thrivehive_create_forms_db');
     
    743750
    744751}
     752/**
     753*Sets up the database for the wysiwyg buttons
     754**/
     755function thrivehive_create_wysiwyg_button_db($version=null) {
     756  global $wpdb;
     757  $table_name = $wpdb->prefix . "TH_" . "wysiwyg_buttons";
     758  $sql = "CREATE TABLE " . $table_name . " (
     759      id INT NOT NULL AUTO_INCREMENT,
     760      text VARCHAR(100) NULL,
     761      url TEXT NULL,
     762      target VARCHAR(10) NULL,
     763      classes TEXT NULL,
     764      PRIMARY KEY  (id)
     765      );";
     766  if(!thrivehive_table_exists($table_name) || $version) {
     767    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     768    update_option('thrivehive_vers', $version);
     769    dbDelta($sql);
     770  }
     771}
     772
    745773function thrivehive_create_forms_db($version=null) {
    746774  global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.