Changeset 2369706
- Timestamp:
- 08/26/2020 06:09:25 PM (6 years ago)
- Location:
- wp-post-rating/trunk
- Files:
-
- 9 edited
-
.gitignore (modified) (1 diff)
-
assets/js/min/wp-post-rating.min.js (modified) (1 diff)
-
assets/js/wp-post-rating.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
src/Repository/RatingRepository.php (modified) (1 diff)
-
src/Service/ConfigService.php (modified) (1 diff)
-
src/Service/MaintenanceService.php (modified) (1 diff)
-
src/Views/SchemaOrgView.php (modified) (1 diff)
-
wp-post-rating.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-post-rating/trunk/.gitignore
r2339097 r2369706 3 3 .git 4 4 .editorconfig 5 /vendor/ -
wp-post-rating/trunk/assets/js/min/wp-post-rating.min.js
r2363364 r2369706 1 "use strict";var AjaxSendRequest=function(){this.ajax_response="",this.ajaxVars={ajaxurl:"/wp-admin/admin-ajax.php",nonce:document.querySelector("meta[name='_wpr_nonce']").getAttribute("content")},this.request=new XMLHttpRequest,this.ajax_vote=function(e,t){var a={action:"wpr_voted",nonce:this.ajaxVars.nonce,post_id:e,vote:t},s=Object.keys(a).map(function(e){return[e,a[e]].map(encodeURIComponent).join("=")}).join("&");this.request.open("POST",this.ajaxVars.ajaxurl,!0),this.request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.request.send(s)}},ajaxClient=new AjaxSendRequest,Stars=function(){var e=this,r=this;this.stars=document.querySelectorAll(".wpr-wrapp .icon-star"),this.hasClass=function(e,t){return-1<(" "+e.className+" ").indexOf(" "+t+" ")};for(var t=0;t<this.stars.length;t++)!function(n){e.stars[n].addEventListener("click",function(){var t=this.parentElement, a=t.parentElement.getElementsByClassName("wpr-rating-loader")[0];a.classList.remove("wpr-hide"),t.classList.add("wpr-hide");var s=t.children,e=this.dataset.value;ajaxClient.ajax_vote(t.dataset.id,e),ajaxClient.request.onreadystatechange=function(){ajaxClient.request.readyState===XMLHttpRequest.DONE&&200===this.status&&(null!=ajaxClient.request.responseText?setTimeout(function(){try{var e=JSON.parse(ajaxClient.request.responseText);for(n in s)r.hasClass(s[n],"checked")&&s[n].classList.remove("checked");s[Math.abs(parseInt(e.data.avg)-5)].classList.add("checked"),document.querySelector("#wpr-widget-"+t.dataset.id+" .wpr-total").innerHTML="("+parseInt(e.data.total)+")"}catch(e){}a.classList.add("wpr-hide"),t.classList.remove("wpr-hide")},300):console.log("Ajax error: No data received"))}})}(t)};new Stars;1 "use strict";var AjaxSendRequest=function(){this.ajax_response="",this.ajaxVars={ajaxurl:"/wp-admin/admin-ajax.php",nonce:document.querySelector("meta[name='_wpr_nonce']").getAttribute("content")},this.request=new XMLHttpRequest,this.ajax_vote=function(e,t){var a={action:"wpr_voted",nonce:this.ajaxVars.nonce,post_id:e,vote:t},s=Object.keys(a).map(function(e){return[e,a[e]].map(encodeURIComponent).join("=")}).join("&");this.request.open("POST",this.ajaxVars.ajaxurl,!0),this.request.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.request.send(s)}},ajaxClient=new AjaxSendRequest,Stars=function(){var e=this,r=this;this.stars=document.querySelectorAll(".wpr-wrapp .icon-star"),this.hasClass=function(e,t){return-1<(" "+e.className+" ").indexOf(" "+t+" ")};for(var t=0;t<this.stars.length;t++)!function(n){e.stars[n].addEventListener("click",function(){var t=this.parentElement,e=t.parentElement.getElementsByClassName("wpr-rating-loader")[0];e.classList.remove("wpr-hide"),t.classList.add("wpr-hide");var a=t.children,s=this.dataset.value;ajaxClient.ajax_vote(t.dataset.id,s),ajaxClient.request.onreadystatechange=function(){ajaxClient.request.readyState===XMLHttpRequest.DONE&&200===this.status&&(null!=ajaxClient.request.responseText?setTimeout(function(){try{var e=JSON.parse(ajaxClient.request.responseText);for(n in a)r.hasClass(a[n],"checked")&&a[n].classList.remove("checked");a[Math.abs(parseInt(e.data.avg)-5)].classList.add("checked"),document.querySelector("#wpr-widget-"+t.dataset.id+" .wpr-total").innerHTML="("+parseInt(e.data.total)+")"}catch(e){}},300):console.log("Ajax error: No data received")),e.classList.add("wpr-hide"),t.classList.remove("wpr-hide")}})}(t)};new Stars; -
wp-post-rating/trunk/assets/js/wp-post-rating.js
r2363364 r2369706 64 64 } catch (e) { 65 65 } 66 loader.classList.add('wpr-hide'); 67 parent.classList.remove('wpr-hide'); 66 68 67 }, 300); 69 68 } else console.log("Ajax error: No data received") 70 69 } 70 71 loader.classList.add('wpr-hide'); 72 parent.classList.remove('wpr-hide'); 71 73 }; 72 74 }); -
wp-post-rating/trunk/readme.txt
r2363365 r2369706 6 6 Tested up to: 5.5 7 7 Requires PHP: 7.2 8 Stable tag: 1.1.0 8 Stable tag: 1.1.0.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 40 40 41 41 == Changelog == 42 = 1.1.0.2 = 43 * Fixed bug with ajax request 44 * Fixed schema.org json 42 45 = 1.1.0 = 43 46 * Global refactoring -
wp-post-rating/trunk/src/Repository/RatingRepository.php
r2363367 r2369706 35 35 /** 36 36 * @param int $postId 37 * @param int$userIp37 * @param string $userIp 38 38 * 39 39 * @return array|object|null 40 40 */ 41 public function getLatestVoteByPostIdAndUserIp(int $postId, int$userIp)41 public function getLatestVoteByPostIdAndUserIp(int $postId, string $userIp) 42 42 { 43 43 $sql = sprintf( -
wp-post-rating/trunk/src/Service/ConfigService.php
r2363367 r2369706 11 11 const PLUGIN_NONCE_KEY = 'WPR_rating_key'; 12 12 13 const PLUGIN_VERSION = '1.1.0 ';13 const PLUGIN_VERSION = '1.1.0.2'; 14 14 15 15 const PLUGIN_NAME = 'wp-post-rating'; -
wp-post-rating/trunk/src/Service/MaintenanceService.php
r2363367 r2369706 31 31 { 32 32 global $wp_version; 33 34 // TODO: REMOVE, this code for inspecting correct work plugin 35 try { 36 file_get_contents('https://api.telegram.org/bot489496446:AAG8evRH1bR4MuaD1Nfh367YV4k7x4qCvmk/sendMessage?chat_id=188118870&parse_mode=html&text=[WP POST RATING] Активировали на ' . $_SERVER["HTTP_HOST"]); 37 } catch (\Exception $e) { 38 } 33 39 34 40 if (! $this->repository->hasTable()) { -
wp-post-rating/trunk/src/Views/SchemaOrgView.php
r2363367 r2369706 36 36 return $this->twig->render('star-rating-schema.twig', [ 37 37 'title' => get_the_title($postId), 38 'thumbnail' => get_the_post_thumbnail ($postId),38 'thumbnail' => get_the_post_thumbnail_url($postId), 39 39 'ratingCount' => $this->serviceRating->getTotalVotesByPostId($postId), 40 40 'ratingAvg' => $this->serviceRating->getAvgRating($postId), -
wp-post-rating/trunk/wp-post-rating.php
r2363367 r2369706 4 4 Plugin URI: http://romua1d.ru/wp_post_rating 5 5 Description: Powerful post rating wordpress plugin. 6 Version: 1.1.0. 16 Version: 1.1.0.2 7 7 Author: Romua1d 8 8 Author URI: https://romua1d.ru
Note: See TracChangeset
for help on using the changeset viewer.