Changeset 3133949
- Timestamp:
- 08/12/2024 06:46:11 AM (18 months ago)
- Location:
- ryviu
- Files:
-
- 14 edited
-
tags/3.1.25/assets/css/ryviu-admin.css (modified) (2 diffs)
-
tags/3.1.25/assets/js/check-ryviu.js (modified) (1 diff)
-
tags/3.1.25/includes/class-ryviu.php (modified) (2 diffs)
-
tags/3.1.25/includes/functions.php (modified) (1 diff)
-
tags/3.1.25/includes/main-class.php (modified) (2 diffs)
-
tags/3.1.25/includes/settings.php (modified) (2 diffs)
-
tags/3.1.25/ryviu.php (modified) (1 diff)
-
trunk/assets/css/ryviu-admin.css (modified) (2 diffs)
-
trunk/assets/js/check-ryviu.js (modified) (1 diff)
-
trunk/includes/class-ryviu.php (modified) (2 diffs)
-
trunk/includes/functions.php (modified) (1 diff)
-
trunk/includes/main-class.php (modified) (2 diffs)
-
trunk/includes/settings.php (modified) (2 diffs)
-
trunk/ryviu.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ryviu/tags/3.1.25/assets/css/ryviu-admin.css
r3112810 r3133949 405 405 } 406 406 407 .r-cl-update .notice-dismiss, 407 408 .r-cl-connect .notice-dismiss { 408 409 top: 50%; … … 424 425 } 425 426 426 .notice-success.r-cl-connect { 427 428 .notice-success.r-cl-connect, 429 .notice-success.r-cl-update { 427 430 display: none; 428 431 } 429 432 430 .r--alshow { 433 .rpl--hide{ 434 display: none!important; 435 } 436 437 .r--alshow, 438 .rpl--show { 431 439 display: block !important; 432 440 } -
ryviu/tags/3.1.25/assets/js/check-ryviu.js
r3112810 r3133949 25 25 }); 26 26 } 27 28 if ($('a.ryviu-update-frontend').length) { 29 $('a.ryviu-update-frontend').on('click', function () { 30 $.ajax({ 31 url: ajaxurl, 32 method: "POST", 33 data: { 34 action: 'ryviu_update_frontend' 35 }, 36 dataType: "json", 37 38 success: function (res) { 39 let data = res.data; 40 console.log(data); 41 if (data.status == 'success') { 42 43 setTimeout(function () { 44 location.reload(); 45 }, 2000); 46 47 $('.r-cl-update.notice-success').removeClass('rpl--hide'); 48 $('.r-cl-update.notice-success').addClass('rpl--show'); 49 $('.r-cl-update.notice-info').addClass('rpl--hide'); 50 } 51 alert(data.mes); 52 } 53 }); 54 }); 55 } 27 56 }); -
ryviu/tags/3.1.25/includes/class-ryviu.php
r3112810 r3133949 131 131 // Add js to check Ryviu connect 132 132 133 wp_enqueue_script( 'ryviu_check_connect', RYVIU_URL_ASSETS.'js/check-ryviu.js?version= 3' );133 wp_enqueue_script( 'ryviu_check_connect', RYVIU_URL_ASSETS.'js/check-ryviu.js?version=51' ); 134 134 135 135 if ( 'settings_page_ryviu-setting-admin' == $hook ) { … … 197 197 } 198 198 } 199 $ryviu_scripts_app = array( 200 'ryviu-local' => RYVIU_URL_ASSETS.'js/local-ryviu.js', 201 'ryviu-app' => 'https://cdn.ryviu.com/v/static/js/app.js?shop='.constant( 'RYVIU_SHOP_DOMAIN' ).$rocket_param.'&t='.time() 202 ); 199 $ryviu_version = get_option( 'ryviu_version' ); 200 if(!$ryviu_version || ($ryviu_version && $ryviu_version == 1)){ 201 $ryviu_scripts_app = array( 202 'ryviu-local' => RYVIU_URL_ASSETS.'js/local-ryviu.js', 203 'ryviu-app' => 'https://cdn.ryviu.com/v/static/js/app.js?shop='.constant( 'RYVIU_SHOP_DOMAIN' ).$rocket_param.'&t='.time() 204 ); 205 }else{ 206 $ryviu_scripts_app = array( 207 'ryviu-local' => RYVIU_URL_ASSETS.'js/local-ryviu.js', 208 'ryviu-app' => 'https://cdn2.ryviu.com/v/static/js/app.js?shop='.constant( 'RYVIU_SHOP_DOMAIN' ).$rocket_param.'&t='.time() 209 ); 210 } 203 211 204 212 wp_enqueue_style( 'ryviu-local-css', RYVIU_URL_ASSETS.'css/local-ryviu.css', array(), RYVIU_WOO_VERSION ); -
ryviu/tags/3.1.25/includes/functions.php
r3112810 r3133949 673 673 674 674 /** 675 * Ryviu: Ajax to check Store connect 676 * 677 * @param Request object $request Data. 678 * @return JSON data 679 */ 680 add_action( 'wp_ajax_ryviu_update_frontend', 'ryviu_update_frontend' ); 681 function ryviu_update_frontend() { 682 RyviuMain::ryviu_update_frontend(2); 683 } 684 685 /** 675 686 * Description for this functions 676 687 * -
ryviu/tags/3.1.25/includes/main-class.php
r3128435 r3133949 70 70 } 71 71 72 public static function ryviu_update_frontend($ryviu_version = 2, $res = true) { 73 // Update the Ryviu version option 74 update_option('ryviu_version', $ryviu_version); 75 76 // Retrieve and update the Ryviu settings 77 $ryviu_settings_reviews = get_option('ryviu_settings_reviews'); 78 if (is_array($ryviu_settings_reviews)) { 79 $ryviu_settings_reviews['ryviu_frontend_version'] = $ryviu_version; 80 update_option('ryviu_settings_reviews', $ryviu_settings_reviews); 81 } 82 83 // Prepare and send the POST request to update client settings 84 $update_link = 'https://app.ryviu.io/update-client-settings'; 85 $response = wp_remote_post($update_link, [ 86 'body' => [ 87 'domain' => site_url(), 88 'ryviu_version' => $ryviu_version 89 ] 90 ]); 91 if($res){ 92 // Check if the POST request was successful 93 if (is_wp_error($response)) { 94 wp_send_json_error([ 95 'status' => 'error', 96 'mes' => 'There was an issue updating the frontend. Please try again.' 97 ]); 98 } else { 99 wp_send_json_success([ 100 'status' => 'success', 101 'mes' => 'The frontend has been updated with the new design. Please navigate to your store to check.' 102 ]); 103 } 104 } 105 106 } 107 72 108 public static function check_product_slug() { 73 109 $settings = get_option( 'ryviu_client_settings' ); … … 96 132 97 133 $default_opt = array( 134 'ryviu_frontend_version' => 1, 98 135 'position_display' => 1, 99 136 'priority_position_display' => 6, -
ryviu/tags/3.1.25/includes/settings.php
r3112810 r3133949 120 120 public function general_settings(){ 121 121 $fields = [ 122 'ryviu_frontend_version' => 'Reviews widget interface', 122 123 'position_display_widget' => 'Star rating on product page', 123 124 'show_average_rating' => 'Show average rating', … … 222 223 } 223 224 225 public function ryviu_frontend_version_callback(){ 226 227 $select = isset($this->options['ryviu_frontend_version']) ? $this->options['ryviu_frontend_version'] : '1'; 228 229 echo '<select id="ryviu_frontend_version" class="ryviu_settings_reviews" name="ryviu_settings_reviews[ryviu_frontend_version]">'; 230 231 $themes = array('1' => 'Version 1', '2' => 'Version 2'); 232 233 foreach ($themes as $key => $data) { 234 echo '<option value="'. $key .'" '. $this->check_selected($select, $key) .'>'. $data .'</option>'; 235 } 236 echo '</select>'; 237 } 238 224 239 public function position_display_widget_in_loop_callback(){ 225 240 $trace_fn = debug_backtrace(); -
ryviu/tags/3.1.25/ryviu.php
r3128435 r3133949 76 76 // Show notice when do not connect store with Ryviu 77 77 function r_admin_notices() { 78 78 79 $settings = get_option( 'ryviu_client_settings' ); 80 81 $image_url = RYVIU_URL_ASSETS.'images/logo-ryviu-v8.svg'; 79 82 80 83 if(!$settings || $settings == new \stdClass()){ 81 $image_url = RYVIU_URL_ASSETS.'images/logo-ryviu-v8.svg';82 84 echo '<div class="notice notice-error is-dismissible r-cl-connect"><div class="r--notices"><img src="'.$image_url.'" alt="" /><p><b>Ryviu:</b> It looks like there is a problem connecting your store to Ryviu. Please <a class="ryviu-check-connect" href="javascript:void(0)">click here</a> to check the issue, or please <a target="_blank" href="https://www.ryviu.com/contact-us">contact us</a> for help.</p></div></div>'; 83 echo '<div class="notice notice-success is-dismissible r-cl-connect"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu: Successful connection</b></p></div>'; 85 echo '<div class="notice notice-success is-dismissible r-cl-connect"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu:</b> Successful connection.</p></div>'; 86 }else{ 87 $ryviu_settings = get_option( 'ryviu_settings_reviews' ); 88 $ryviu_version = get_option( 'ryviu_version' ); 89 if (array_key_exists('ryviu_frontend_version', $ryviu_settings)) { 90 $ryviu_frontend_version = $ryviu_settings['ryviu_frontend_version']; 91 92 if(!$ryviu_version){ 93 $ryviu_version = $ryviu_frontend_version; 94 RyviuMain::ryviu_update_frontend($ryviu_frontend_version, false); 95 }else{ 96 if($ryviu_frontend_version != $ryviu_version){ 97 $ryviu_version = $ryviu_frontend_version; 98 RyviuMain::ryviu_update_frontend($ryviu_frontend_version, false); 99 } 100 } 101 } 102 103 if(!$ryviu_version || ($ryviu_version && $ryviu_version == 1)){ 104 echo '<div class="notice notice-info is-dismissible r-cl-update"><div class="r--notices"><img src="'.$image_url.'" alt="" /><p><b>Ryviu:</b> Enhancing your store\'s frontend with the new design for the reviews widget, featuring a user-friendly layout and more customizable options. <a class="ryviu-view-demo" target="_blank" href="https://version2.omazing.us/">Click here</a> to see the demo or <a class="ryviu-update-frontend" href="javascript:void(0)">update now</a>.</p></div></div>'; 105 echo '<div class="notice notice-success is-dismissible rpl--hide r-cl-update"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu:</b> Successful update.</p></div>'; 106 } 84 107 } 85 108 } -
ryviu/trunk/assets/css/ryviu-admin.css
r2969086 r3133949 405 405 } 406 406 407 .r-cl-update .notice-dismiss, 407 408 .r-cl-connect .notice-dismiss { 408 409 top: 50%; … … 424 425 } 425 426 426 .notice-success.r-cl-connect { 427 428 .notice-success.r-cl-connect, 429 .notice-success.r-cl-update { 427 430 display: none; 428 431 } 429 432 430 .r--alshow { 433 .rpl--hide{ 434 display: none!important; 435 } 436 437 .r--alshow, 438 .rpl--show { 431 439 display: block !important; 432 440 } -
ryviu/trunk/assets/js/check-ryviu.js
r2969086 r3133949 25 25 }); 26 26 } 27 28 if ($('a.ryviu-update-frontend').length) { 29 $('a.ryviu-update-frontend').on('click', function () { 30 $.ajax({ 31 url: ajaxurl, 32 method: "POST", 33 data: { 34 action: 'ryviu_update_frontend' 35 }, 36 dataType: "json", 37 38 success: function (res) { 39 let data = res.data; 40 console.log(data); 41 if (data.status == 'success') { 42 43 setTimeout(function () { 44 location.reload(); 45 }, 2000); 46 47 $('.r-cl-update.notice-success').removeClass('rpl--hide'); 48 $('.r-cl-update.notice-success').addClass('rpl--show'); 49 $('.r-cl-update.notice-info').addClass('rpl--hide'); 50 } 51 alert(data.mes); 52 } 53 }); 54 }); 55 } 27 56 }); -
ryviu/trunk/includes/class-ryviu.php
r2915558 r3133949 131 131 // Add js to check Ryviu connect 132 132 133 wp_enqueue_script( 'ryviu_check_connect', RYVIU_URL_ASSETS.'js/check-ryviu.js?version= 3' );133 wp_enqueue_script( 'ryviu_check_connect', RYVIU_URL_ASSETS.'js/check-ryviu.js?version=51' ); 134 134 135 135 if ( 'settings_page_ryviu-setting-admin' == $hook ) { … … 197 197 } 198 198 } 199 $ryviu_scripts_app = array( 200 'ryviu-local' => RYVIU_URL_ASSETS.'js/local-ryviu.js', 201 'ryviu-app' => 'https://cdn.ryviu.com/v/static/js/app.js?shop='.constant( 'RYVIU_SHOP_DOMAIN' ).$rocket_param.'&t='.time() 202 ); 199 $ryviu_version = get_option( 'ryviu_version' ); 200 if(!$ryviu_version || ($ryviu_version && $ryviu_version == 1)){ 201 $ryviu_scripts_app = array( 202 'ryviu-local' => RYVIU_URL_ASSETS.'js/local-ryviu.js', 203 'ryviu-app' => 'https://cdn.ryviu.com/v/static/js/app.js?shop='.constant( 'RYVIU_SHOP_DOMAIN' ).$rocket_param.'&t='.time() 204 ); 205 }else{ 206 $ryviu_scripts_app = array( 207 'ryviu-local' => RYVIU_URL_ASSETS.'js/local-ryviu.js', 208 'ryviu-app' => 'https://cdn2.ryviu.com/v/static/js/app.js?shop='.constant( 'RYVIU_SHOP_DOMAIN' ).$rocket_param.'&t='.time() 209 ); 210 } 203 211 204 212 wp_enqueue_style( 'ryviu-local-css', RYVIU_URL_ASSETS.'css/local-ryviu.css', array(), RYVIU_WOO_VERSION ); -
ryviu/trunk/includes/functions.php
r3090726 r3133949 673 673 674 674 /** 675 * Ryviu: Ajax to check Store connect 676 * 677 * @param Request object $request Data. 678 * @return JSON data 679 */ 680 add_action( 'wp_ajax_ryviu_update_frontend', 'ryviu_update_frontend' ); 681 function ryviu_update_frontend() { 682 RyviuMain::ryviu_update_frontend(2); 683 } 684 685 /** 675 686 * Description for this functions 676 687 * -
ryviu/trunk/includes/main-class.php
r3128431 r3133949 70 70 } 71 71 72 public static function ryviu_update_frontend($ryviu_version = 2, $res = true) { 73 // Update the Ryviu version option 74 update_option('ryviu_version', $ryviu_version); 75 76 // Retrieve and update the Ryviu settings 77 $ryviu_settings_reviews = get_option('ryviu_settings_reviews'); 78 if (is_array($ryviu_settings_reviews)) { 79 $ryviu_settings_reviews['ryviu_frontend_version'] = $ryviu_version; 80 update_option('ryviu_settings_reviews', $ryviu_settings_reviews); 81 } 82 83 // Prepare and send the POST request to update client settings 84 $update_link = 'https://app.ryviu.io/update-client-settings'; 85 $response = wp_remote_post($update_link, [ 86 'body' => [ 87 'domain' => site_url(), 88 'ryviu_version' => $ryviu_version 89 ] 90 ]); 91 if($res){ 92 // Check if the POST request was successful 93 if (is_wp_error($response)) { 94 wp_send_json_error([ 95 'status' => 'error', 96 'mes' => 'There was an issue updating the frontend. Please try again.' 97 ]); 98 } else { 99 wp_send_json_success([ 100 'status' => 'success', 101 'mes' => 'The frontend has been updated with the new design. Please navigate to your store to check.' 102 ]); 103 } 104 } 105 106 } 107 72 108 public static function check_product_slug() { 73 109 $settings = get_option( 'ryviu_client_settings' ); … … 96 132 97 133 $default_opt = array( 134 'ryviu_frontend_version' => 1, 98 135 'position_display' => 1, 99 136 'priority_position_display' => 6, -
ryviu/trunk/includes/settings.php
r3112296 r3133949 120 120 public function general_settings(){ 121 121 $fields = [ 122 'ryviu_frontend_version' => 'Reviews widget interface', 122 123 'position_display_widget' => 'Star rating on product page', 123 124 'show_average_rating' => 'Show average rating', … … 222 223 } 223 224 225 public function ryviu_frontend_version_callback(){ 226 227 $select = isset($this->options['ryviu_frontend_version']) ? $this->options['ryviu_frontend_version'] : '1'; 228 229 echo '<select id="ryviu_frontend_version" class="ryviu_settings_reviews" name="ryviu_settings_reviews[ryviu_frontend_version]">'; 230 231 $themes = array('1' => 'Version 1', '2' => 'Version 2'); 232 233 foreach ($themes as $key => $data) { 234 echo '<option value="'. $key .'" '. $this->check_selected($select, $key) .'>'. $data .'</option>'; 235 } 236 echo '</select>'; 237 } 238 224 239 public function position_display_widget_in_loop_callback(){ 225 240 $trace_fn = debug_backtrace(); -
ryviu/trunk/ryviu.php
r3128431 r3133949 76 76 // Show notice when do not connect store with Ryviu 77 77 function r_admin_notices() { 78 78 79 $settings = get_option( 'ryviu_client_settings' ); 80 81 $image_url = RYVIU_URL_ASSETS.'images/logo-ryviu-v8.svg'; 79 82 80 83 if(!$settings || $settings == new \stdClass()){ 81 $image_url = RYVIU_URL_ASSETS.'images/logo-ryviu-v8.svg';82 84 echo '<div class="notice notice-error is-dismissible r-cl-connect"><div class="r--notices"><img src="'.$image_url.'" alt="" /><p><b>Ryviu:</b> It looks like there is a problem connecting your store to Ryviu. Please <a class="ryviu-check-connect" href="javascript:void(0)">click here</a> to check the issue, or please <a target="_blank" href="https://www.ryviu.com/contact-us">contact us</a> for help.</p></div></div>'; 83 echo '<div class="notice notice-success is-dismissible r-cl-connect"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu: Successful connection</b></p></div>'; 85 echo '<div class="notice notice-success is-dismissible r-cl-connect"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu:</b> Successful connection.</p></div>'; 86 }else{ 87 $ryviu_settings = get_option( 'ryviu_settings_reviews' ); 88 $ryviu_version = get_option( 'ryviu_version' ); 89 if (array_key_exists('ryviu_frontend_version', $ryviu_settings)) { 90 $ryviu_frontend_version = $ryviu_settings['ryviu_frontend_version']; 91 92 if(!$ryviu_version){ 93 $ryviu_version = $ryviu_frontend_version; 94 RyviuMain::ryviu_update_frontend($ryviu_frontend_version, false); 95 }else{ 96 if($ryviu_frontend_version != $ryviu_version){ 97 $ryviu_version = $ryviu_frontend_version; 98 RyviuMain::ryviu_update_frontend($ryviu_frontend_version, false); 99 } 100 } 101 } 102 103 if(!$ryviu_version || ($ryviu_version && $ryviu_version == 1)){ 104 echo '<div class="notice notice-info is-dismissible r-cl-update"><div class="r--notices"><img src="'.$image_url.'" alt="" /><p><b>Ryviu:</b> Enhancing your store\'s frontend with the new design for the reviews widget, featuring a user-friendly layout and more customizable options. <a class="ryviu-view-demo" target="_blank" href="https://version2.omazing.us/">Click here</a> to see the demo or <a class="ryviu-update-frontend" href="javascript:void(0)">update now</a>.</p></div></div>'; 105 echo '<div class="notice notice-success is-dismissible rpl--hide r-cl-update"><p class="r--notices"><img src="'.$image_url.'" alt="" /><b>Ryviu:</b> Successful update.</p></div>'; 106 } 84 107 } 85 108 }
Note: See TracChangeset
for help on using the changeset viewer.