Changeset 1695978
- Timestamp:
- 07/13/2017 09:17:01 PM (9 years ago)
- Location:
- trustedsite-reviews/trunk
- Files:
-
- 5 edited
-
js/overview.js (modified) (4 diffs)
-
lib/App.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
-
trustedsite-reviews.php (modified) (2 diffs)
-
views/overview.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trustedsite-reviews/trunk/js/overview.js
r1658867 r1695978 8 8 var endpointUrl = "https://www.trustedsite.com" 9 9 10 var refreshInterval; 10 var refreshInterval; 11 11 12 12 function refresh(){ 13 13 var apiUrl = endpointUrl + '/rpc/ajax?do=lookup-site-status&jsoncallback=?&rand='+new Date().getTime()+'&host=' + encodeURIComponent(host); 14 var woocommerce = parseInt($("#ts-data").attr("data-woocommerce")); 14 15 jQuery.getJSON(apiUrl,function(data) { 15 16 console.log(data); … … 17 18 if(status === 'none'){ 18 19 jQuery("#manage").hide(); 20 jQuery("#settings").hide(); 21 22 jQuery("#pitch").show(); 19 23 jQuery("#activation").show(); 20 24 }else{ 21 25 siteId = data['siteId']; 26 22 27 jQuery("#activation").hide(); 28 jQuery("#pitch").hide(); 29 30 if(woocommerce && false){ 31 jQuery("#settings").show(); 32 }else{ 33 jQuery("#pitch").show(); 34 } 35 23 36 jQuery("#manage").show(); 37 24 38 setTimeout(function(){ 25 39 clearInterval(refreshInterval); … … 43 57 var host = $("#host").val(); 44 58 var email = $("#email").val(); 45 var signupUrl = endpointUrl + "/app/partner/signup?ctx=popup&host=" + encodeURIComponent(host) + "&email=" + encodeURIComponent(email) + "& aff=472614&platform=5&ctx=popup";59 var signupUrl = endpointUrl + "/app/partner/signup?ctx=popup&host=" + encodeURIComponent(host) + "&email=" + encodeURIComponent(email) + "&platformId=5&ctx=popup&affId=6"; 46 60 var signupWindow = window.open(signupUrl, "_blank", "width=900 height=700 left=" + left + " top=" + top); 47 61 }); … … 52 66 window.open(endpointUrl + "/user/reviews/?siteId="+ siteId, "_blank", "width=900 height=700 left=" + left + " top=" + top); 53 67 }); 68 69 jQuery("#ts-product-reviews-gallery").change(updateSettings); 70 jQuery("#ts-product-stars").change(updateSettings); 71 54 72 refreshInterval = setInterval(refresh, 1000); 73 } 74 75 function updateSettings(){ 76 var postData = { 77 action: 'ts_reviews_update_settings', 78 ts_product_reviews_gallery_enabled: jQuery("#ts-product-reviews-gallery").is(":checked") ? 1 : 0, 79 ts_product_stars_enabled: jQuery("#ts-product-stars").is(":checked") ? 1 : 0 80 }; 81 console.log(ajaxObj.ajax_url); 82 console.log(postData); 83 84 $.post(ajaxObj.ajax_url, postData, function (data) { 85 console.log(data); 86 }); 55 87 } 56 88 -
trustedsite-reviews/trunk/lib/App.php
r1658870 r1695978 3 3 if ( ! defined( 'ABSPATH' ) ) exit; 4 4 5 require_once('AdminApi.php'); 5 6 class App 6 7 { … … 15 16 add_action('admin_menu', 'TSReviews\App::adminMenus'); 16 17 add_action('wp_footer', 'TSReviews\App::injectMainCode'); 17 add_action('admin_enqueue_scripts', 'TSReviews\App::scripts'); 18 add_action('admin_enqueue_scripts', 'TSReviews\App::scripts'); 18 19 19 if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { 20 App::install_woocommerce(); 20 if (App::hasWoocommerce()) { 21 add_action('wp_ajax_ts_reviews_update_settings', 'TSReviews\AdminApi::updateSettings'); 22 App::installWoocommerce(); 21 23 } 22 24 } 23 25 24 public static function post_purchase_review($order_id) 26 public static function hasWoocommerce(){ 27 return in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))); 28 } 29 30 public static function postPurchaseReview($order_id) 25 31 { 26 32 $endpoint_host = "https://www.trustedsite.com"; … … 50 56 } 51 57 52 public static function install _woocommerce()58 public static function installWoocommerce() 53 59 { 54 add_action('woocommerce_thankyou', 'TSReviews\App::post_purchase_review'); 60 add_action('woocommerce_thankyou', 'TSReviews\App::postPurchaseReview'); 61 if(intval(get_option(AdminApi::PRODUCT_REVIEWS_GALLERY_ENABLED_OPT)) == 1){ 62 add_action('woocommerce_after_single_product', 'TSReviews\App::installProductReviewsGallery'); 63 } 64 65 if(intval(get_option(AdminApi::PRODUCT_STARS_ENABLED_OPT)) == 1){ 66 add_action('woocommerce_single_product_summary', 'TSReviews\App::installProductPageStars'); 67 } 55 68 } 56 69 … … 64 77 65 78 } 79 80 public static function installProductPageStars(){ 81 global $product; 82 $id = $product->id; 83 84 echo "<div class=\"trustedsite-widget\" data-type=\"7\" data-product-id=\"".$id."\"></div>"; 85 } 86 87 public static function installProductReviewsGallery() 88 { 89 global $product; 90 $id = $product->id; 91 echo "<div class=\"trustedsite-widget\" data-type=\"5\" data-product-id=\"".$id."\"></div><script src='".plugins_url('../widgets/product_review_gallery.js', __FILE__)."'></script>"; 92 } 66 93 67 94 public static function scripts($hook) { -
trustedsite-reviews/trunk/readme.txt
r1678590 r1695978 4 4 Requires at least: 4.2.0 5 5 Tested up to: 4.8.0 6 Stable tag: 1.0. 06 Stable tag: 1.0.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 65 65 == Changelog == 66 66 67 = 1.1 = 68 * Add settings page and affiliate ID 69 67 70 = 1.0 = 68 71 * The initial release -
trustedsite-reviews/trunk/trustedsite-reviews.php
r1658867 r1695978 5 5 * ------------------------------------------------------------------------------------------------------------------ 6 6 * @package trustedsite-reviews 7 * @version 1.0. 07 * @version 1.0.1 8 8 * Plugin Name: TrustedSite Reviews 9 9 * Description: Add TrustedSite Reviews to your site and start showing visitors how great your business is. 10 10 * Author: TrustedSite 11 * Version: 1.0. 011 * Version: 1.0.1 12 12 * Author URI: https://www.trustedsite.com/ 13 13 * ------------------------------------------------------------------------------------------------------------------ … … 17 17 return; 18 18 } 19 define('TS_REVIEWS', '1.0. 0');19 define('TS_REVIEWS', '1.0.1'); 20 20 21 21 add_action('activated_plugin','ts_reviews_save_activation_error'); -
trustedsite-reviews/trunk/views/overview.php
r1658867 r1695978 5 5 $arrHost = parse_url(home_url('', $scheme = 'http')); 6 6 $host = $arrHost['host']; 7 7 $woocommerce = in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) ? 1 : 0; 8 $ts_product_reviews_gallery_enabled = intval(get_option('ts_product_reviews_gallery_enabled', 0)); 9 $ts_product_stars_enabled = intval(get_option('ts_product_stars_enabled', 0)); 8 10 ?> 9 <div id="ts-data" data-host="<?php echo $host; ?>" data-emai ="<?php echo $email; ?>"></div>11 <div id="ts-data" data-host="<?php echo $host; ?>" data-email="<?php echo $email; ?>" data-woocommerce="<?php echo $woocommerce; ?>"></div> 10 12 <div class="wrap" id="overview"> 11 13 … … 17 19 <div id="postbox-container-2" class="postbox-container"> 18 20 <div class="postbox"> 19 <div class="meta-box-sortables" >21 <div class="meta-box-sortables" style="display:none;" id="pitch"> 20 22 <h2 class="hndle"><span>About TrustedSite Reviews</span></h2> 21 23 … … 51 53 </div> 52 54 </div> 55 56 <div class="meta-box-sortables" style="display:none;" id="settings"> 57 <h2 class="hndle"><span>Widget Settings</span></h2> 58 59 <div class="inside"> 60 <table class="form-table"> 61 <tbody> 62 <tr valign="top"> 63 <th scope="row" class="titledesc" style="width: 40%"> 64 <label >Product Reviews Gallery</label> 65 </th> 66 <td class="forminp forminp-checkbox"> 67 <label> 68 <input type="checkbox" id="ts-product-reviews-gallery" value="1" <?php echo $ts_product_reviews_gallery_enabled == 1 ? "checked" : "" ?>> 69 Enable 70 </label> 71 </td> 72 </tr> 73 <tr valign="top"> 74 <th scope="row" class="titledesc"> 75 <label >Product Stars</label> 76 </th> 77 <td class="forminp forminp-checkbox"> 78 <label> 79 <input type="checkbox" id="ts-product-stars" value="1" <?php echo $ts_product_stars_enabled == 1 ? "checked" : "" ?>> 80 Enable 81 </label> 82 </td> 83 </tr> 84 </tbody> 85 </table> 86 </div> 87 </div> 53 88 </div> 54 89 </div> 90 55 91 <div id="activation" style="display:none;"> 56 92 <div id="postbox-container-1" class="postbox-container"> … … 103 139 <input type="submit" class="button button-primary" value="Manage Account" style="margin-top: 8px; display: inline-block;" id="manage-account"> 104 140 </div> 105 106 141 </div> 107 142 </div>
Note: See TracChangeset
for help on using the changeset viewer.