Changeset 1957112
- Timestamp:
- 10/15/2018 07:44:49 PM (7 years ago)
- Location:
- thrivehive/trunk
- Files:
-
- 6 edited
-
README.md (modified) (2 diffs)
-
controllers/menus.php (modified) (2 diffs)
-
controllers/snippets.php (modified) (1 diff)
-
lib/snippet_display.php (modified) (1 diff)
-
lib/thrivehive_buttons.php (modified) (1 diff)
-
thrivehive.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thrivehive/trunk/README.md
r1954622 r1957112 37 37 1. Download `whm.pem` from Google Drive Dev and place it in `~/Thrivehive/keys/` 38 38 2. Run `sh scripts/update_skeleton_directory.sh` 39 40 ## --- IMPORTANT --- 41 42 The version number of the plugin MUST COMPLY with the following format: 43 44 ``` 45 vX.X(XX) 46 ``` 47 48 For example: 49 50 `v1.1 (Regular release)` 51 52 or 53 54 `v1.101 (Bugfix)` 55 56 The version needs to be updated in thrivehive.php and the change needs to be added to the changelog here along with the version number. 39 57 40 58 ## Deployment … … 87 105 88 106 ## Screenshots 89 90 107 91 108 ## Changelog -
thrivehive/trunk/controllers/menus.php
r1951087 r1957112 9 9 require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' ); 10 10 require_once( ABSPATH . 'wp-includes/nav-menu.php' ); 11 include_once( TH_PLUGIN_ROOT . '/lib/thrivehive_buttons.php');12 11 include_once( TH_PLUGIN_ROOT . '/lib/thrivehive_forms.php'); 13 12 include_once( TH_PLUGIN_ROOT . '/lib/thrivehive_theme_options.php'); … … 546 545 547 546 return array('message' => 'success'); 548 }549 550 /**551 *Gets custom thrivehive buttons552 *@example URL - /menus/get_buttons553 *@api554 *@return array of button objects and their properties555 **/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 button566 *@example URL - /menus/get_button567 *@api568 *@return array containing the button and its properties569 **/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 database583 *@example URL - /menus/set_button584 *@api585 *@return array containing the button with its new values586 **/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 values663 *@example URL - /menus/create_button664 *@api665 *@return array containing the button created666 **/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();756 547 } 757 548 -
thrivehive/trunk/controllers/snippets.php
r1914280 r1957112 157 157 $html = th_display_button($atts); 158 158 break; 159 case "th_wysiwyg_button": 160 $html = th_display_wysiwyg_button($atts); 161 break; 159 162 case "th_address": 160 163 $html = th_display_address($atts); -
thrivehive/trunk/lib/snippet_display.php
r1951087 r1957112 69 69 70 70 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 **/ 79 function 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>"; 71 88 } 72 89 -
thrivehive/trunk/lib/thrivehive_buttons.php
r1136398 r1957112 80 80 return $wpdb->prefix . "TH_" . "buttons"; 81 81 } 82 82 83 ?> -
thrivehive/trunk/thrivehive.php
r1954622 r1957112 5 5 *Plugin URI: http://thrivehive.com 6 6 *Description: A plugin to include ThriveHive's tracking code 7 *Version: 2. 3017 *Version: 2.4 8 8 *Author: ThriveHive 9 9 *Author URI: http://thrivehive.com … … 28 28 @include_once TH_PLUGIN_ROOT . "/models/attachment.php"; 29 29 @include_once TH_PLUGIN_ROOT . "/lib/thrivehive_buttons.php"; 30 @include_once TH_PLUGIN_ROOT . "/lib/thrivehive_wysiwyg_buttons.php"; 30 31 @include_once TH_PLUGIN_ROOT . "/lib/thrivehive_forms.php"; 31 32 @include_once TH_PLUGIN_ROOT . "/lib/thrivehive_theme_options.php"; … … 39 40 function version_check(){ 40 41 //UPDATE THIS WHEN WE MAKE VERSION CHANGES 41 $db_version = '1.1 19';42 $db_version = '1.120'; 42 43 $update = null; 43 44 … … 46 47 $update = $db_version; 47 48 } 49 48 50 if(!$ver || $update){ 49 51 //update_option('thrivehive_vers', $db_version); 50 52 thrivehive_create_button_db($update); 53 thrivehive_create_wysiwyg_button_db($update); 51 54 thrivehive_create_theme_options_table($update); 52 55 thrivehive_create_forms_db($update); 53 56 thrivehive_create_snippets_db($update); 54 55 } }57 } 58 } 56 59 57 60 add_filter('body_class', 'bg_repeat_body_class'); … … 423 426 add_shortcode( 'th_button', 'th_display_button' ); 424 427 428 //[th_button] 429 add_shortcode( 'th_wysiwyg_button', 'th_display_wysiwyg_button' ); 430 425 431 //[th_address] 426 432 add_shortcode( 'th_address', 'th_display_address'); … … 530 536 register_activation_hook(__FILE__, 'th_permalinks'); 531 537 register_activation_hook(__FILE__, 'thrivehive_create_button_db'); 538 register_activation_hook(__FILE__, 'thrivehive_create_wysiwyg_button_db'); 532 539 register_activation_hook(__FILE__, 'thrivehive_create_theme_options_table'); 533 540 register_activation_hook(__FILE__, 'thrivehive_create_forms_db'); … … 743 750 744 751 } 752 /** 753 *Sets up the database for the wysiwyg buttons 754 **/ 755 function 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 745 773 function thrivehive_create_forms_db($version=null) { 746 774 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.