├── LICENSE ├── admin ├── activation.php ├── admin.php ├── assets │ ├── css │ │ ├── admin.css │ │ ├── jquery-ui.min.css │ │ └── select2.min.css │ ├── images │ │ ├── loading.svg │ │ └── wp-review-pro.jpg │ └── js │ │ ├── admin.import.js │ │ ├── admin.js │ │ ├── editor-plugin.js │ │ ├── rating-inputs.js │ │ ├── review-items.js │ │ ├── review-notice.js │ │ ├── select2.min.js │ │ └── wp-review-tab-widget-admin.js ├── class-wp-review-form-field.php ├── class-wp-review-importer.php ├── class-wp-review-options.php ├── class-wpr-review-notice.php ├── demo-importer.php ├── demo-importer │ ├── class-wp-import.php │ ├── class-wp-review-demo-importer.php │ └── parsers.php ├── font-awesome-icons.php ├── metaboxes.php ├── options │ ├── facebook.php │ ├── google.php │ ├── hello-bar.php │ ├── help.php │ ├── import.php │ ├── multisite.php │ ├── popup.php │ ├── review.php │ ├── role-manager.php │ └── yelp.php └── review-options-meta-box.php ├── box-templates ├── aqua.php ├── default.php └── global │ └── partials │ ├── review-links.php │ └── review-schema.php ├── comments └── comments.php ├── filter-list.php ├── includes ├── ajax.php ├── comments.php ├── demo │ └── demo-content.xml ├── enqueue.php ├── functions.php ├── schemas.php ├── shortcodes.php ├── widget.php └── widgets │ └── class-wp-review-tab-widget.php ├── languages └── wp-review.pot ├── public ├── css │ ├── amp.css │ ├── font-awesome.min.css │ ├── magnific-popup.css │ └── wp-review.css ├── fonts │ ├── FontAwesome.otf │ ├── font-icons.eot │ ├── font-icons.svg │ ├── font-icons.ttf │ ├── font-icons.woff │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ └── fontawesome-webfont.woff2 ├── images │ ├── amazon.jpg │ ├── aqua.jpg │ ├── blue.jpg │ ├── darkside.jpg │ ├── dash.jpg │ ├── default.jpg │ ├── edge.jpg │ ├── enterprise.jpg │ ├── facebook.jpg │ ├── fizzy.jpg │ ├── gamer.jpg │ ├── gravity.jpg │ ├── largethumb.png │ ├── shell.jpg │ ├── smallthumb.png │ ├── tabbed.jpg │ ├── tabbed2.jpg │ ├── xiaomi.jpg │ └── zine.jpg └── js │ ├── jquery.magnific-popup.min.js │ ├── js.cookie.min.js │ ├── main.js │ └── wp-review-tab-widget.js ├── rating-types ├── circle-input.php ├── circle-output.php ├── percentage-input.js ├── percentage-input.php ├── percentage-output.php ├── point-input.js ├── point-input.php ├── point-output.php ├── star-input.js ├── star-input.php ├── star-output.php ├── thumbs-input.php └── thumbs-output.php ├── readme.txt ├── template-list.php └── wp-review.php /admin/activation.php: -------------------------------------------------------------------------------- 1 | h2{margin-top:0}.wpr-vertical-tabs__content .nav-tab-active{background-color:#fff;border-bottom-color:#fff}.clearfix:before,.clearfix:after{content:" ";display:table}.clearfix:after{clear:both}.clearfix{*zoom:1}.wp_review_schema_type_options textarea{width:77%;min-height:80px}.wp-review-field select{width:15em;margin-left:0}.wp-review-field #wp_review_product_price{width:70px}.wp-review-field .wp-color-result{margin:0}.wp-review-field .large-text{width:77%}.wp-review-field input{margin:0;padding:5px 8px}.wp-review-field .wp-picker-container{display:inline-block}.wp-review-field .wp-picker-container label{flex:none;width:auto}.wp-review-field .wp-picker-container input[type="text"].wp-color-picker{padding:4px;width:65px}.wp-review-field .wp-picker-container .iris-picker{box-sizing:initial}.wp-review-field .wp-picker-container .wp-picker-open+.wp-picker-input-wrap{width:140px}#wp-wp_review_pros-wrap textarea.wp-editor-area,#wp-wp_review_cons-wrap textarea.wp-editor-area,#wp-wp_review_desc-wrap textarea.wp-editor-area{border:0}.wp_review_schema_options_label{vertical-align:top;padding-top:5px}.wpr_image_upload_field{display:inline-block}.wp-review-item th{text-align:left}.wp-review-item td:first-child{text-align:center}.wp-review-item .handle{cursor:move}.wp-review-links td:first-child{text-align:center}.wp-review-links .handle{cursor:move}.wp-review-links input[type="text"]{padding:5px 8px}.has-border-bottom{border-bottom:1px solid #ddd;margin-bottom:20px;padding-bottom:20px}.review-total{text-align:right}.wp-review-field-option:not(.pyre_field) .wp-picker-holder{position:absolute;z-index:9}.review-value-incorrect{border-color:#F00 !important}#wp_review_id_hint{margin-left:8px}.wp-review-admin-options .form-table td{padding:20px 10px;vertical-align:top}.wp-review-admin-options p.description{font-weight:normal;font-style:normal}.wp-review-admin-options .wp-review-field>label .description{margin-left:0}.wp-review-admin-options .wp-review-field input{padding:7px;border-radius:2px;margin:0;box-shadow:inset 0 1px 3px rgba(0,0,0,0.1)}.wp-review-admin-options .wp-review-field input[type=radio]{border-radius:50%}.wp-review-admin-options .wp-review-field input[type=checkbox]{border-radius:0}.wp-review-admin-options .wp-review-field .large-text{width:70%}.wp-review-admin-options .wp-review-field .description{display:block;color:#888;font-style:normal;margin-top:5px}.wp-review-admin-options #wp_review_shortcode_hint_field span{display:inline;margin-left:6px}.wp-review-admin-options .wp-review-thumbnail-options label{margin-right:0;width:90%}.wp-review-description label{margin-bottom:-20px;display:block}.wp-review-theme-defaults-msg{position:relative}.wp-review-theme-defaults-msg a.button{display:inline-block;margin-bottom:8px}.wp-review-theme-defaults-msg a.close-notice{position:absolute;top:0;right:0}.edit-ratings-notice.update-nag{background:#fff9e8;margin-right:0}#wp-review-width-slider{width:70%;float:left;margin-top:12px;margin-right:25px;border-radius:0;max-width:600px;border:0;background:#d8d8d8;height:8px}#wp-review-width-slider .ui-slider-handle{background:#fff;box-shadow:0 0px 3px rgba(0,0,0,0.4);border-radius:2px}#wp-review-width-slider.ui-slider-horizontal .ui-slider-range-min{border:0;border-radius:2px;background:#0184bb}#wp_review_width{width:60px}.wrap.wp-review .nav-tab-wrapper{border-bottom:1px solid #ccc;margin-top:16px}.wrap.wp-review .nav-tab-wrapper a:focus{box-shadow:none}.nav-tab-hidden{display:none}.nav-tab-hidden.nav-tab-active{display:block}textarea#wp-review-migrate-log{width:600px;max-width:100%;height:200px;display:none}.already-migrated-msg{display:none}#start-migrate{margin-bottom:12px}#wp-review-settings-tab-contents>div{display:none;max-width:900px}#wp-review-settings-tab-contents .settings-tab-general{display:block}.pros-cons-title{max-width:25%}.column-wp_review_rating,.column-wp_review_comment_rating{text-align:center;position:relative;width:110px}.column-wp_review_rating .review-star,.column-wp_review_comment_rating .review-star{position:relative;letter-spacing:1px}.column-wp_review_rating .no-rating,.column-wp_review_comment_rating .no-rating{color:#aaa;font-style:italic}#editwpreview{overflow:hidden}#editwpreview .inside{float:left;padding:3px 0 2px 5px;margin:0;text-align:left}#editwpreview .inside input{width:180px}#editwpreview label{padding:2px 0}h4.wp-review-comment-title{margin-top:0;margin-bottom:1em}.review-result-wrapper{position:relative;display:inline-block;font-size:0}.postbox .review-result-wrapper a,.postbox .review-result i{cursor:pointer}.review-result{position:absolute;top:0;left:0;height:22px;overflow:hidden;white-space:nowrap}.wp-review-rating-feature{display:inline-block}.wp-review-notice{position:relative}.wpr_image_upload_img{margin:0 0 10px;padding:0;max-width:100%;height:auto;float:left;display:inline-block}.wpr-hide{display:none}.wpr-tabs .tab-title.nav-tab-active{background-color:#fff;border-bottom-color:#fff}.wpr-box-template-images{display:flex;flex-wrap:wrap}.wpr-box-template-images .wpr-box-template-image{flex:0 0 50%;display:block;outline:0;box-shadow:none;text-decoration:none;text-align:center;color:#333;font-weight:700;margin-bottom:5px}.wpr-box-template-images .wpr-box-template-image img{padding:4px;width:100%;height:auto;display:block}.wpr-box-template-images .wpr-box-template-image.active img{background-color:#0073aa}#wpr-review-items-app *{box-sizing:border-box}#wpr-review-items-app .wpr-review-item{background-color:#f7f7f7;padding:10px 10px 10px 30px;margin-bottom:5px}#wpr-review-items-app .wpr-review-item .setting-row:first-of-type .col-2 input{width:100%;padding:5px;background:#fff}#wpr-review-items-app .wpr-review-item .col-3 input{float:right;background:#fff}#wpr-review-items-app .wpr-review-item .wpr-icon-move{cursor:move;position:absolute;left:5px;top:16px}#wpr-review-items-app .setting-row{padding:5px 0}#wpr-review-items-app .final-row .col-3{text-align:right}#wpr-review-items-app .final-row .col-3 input{float:right;min-width:52px}#wpr-review-items-app .final-row .col-3 label{margin:4px 10px 0 0;display:inline-block;font-weight:bold}#wpr-review-items-app .wpr-percentage-input-wrapper{margin-top:10px}#wpr-review-items-app .wp-picker-container{display:inline-block}#wpr-review-items-app .wp-picker-holder *{box-sizing:initial}@media (min-width: 768px){#wpr-review-items-app .wpr-review-item{position:relative}#wpr-review-items-app .delete-item{position:absolute;right:10px;bottom:10px}#wpr-review-items-app .setting-row{display:flex;flex-wrap:wrap}#wpr-review-items-app .col-1{flex:0 0 20%}#wpr-review-items-app .col-2{flex:0 0 60%;padding:0 10px}#wpr-review-items-app .col-3{flex:0 0 20%}}#wp_review_box_template_wrapper{position:relative}#wp_review_box_template_preview{position:absolute;left:250px;top:0px;z-index:1000;padding:3px;box-shadow:0 0 3px rgba(0,0,0,0.2);background:#fff}#wp_review_box_template_preview.loading{background:#eee url(../images/loading.svg) no-repeat center center}#wp_review_box_template_preview.loading img{visibility:hidden}#wp_review_box_template_img,#wp_review_box_template_preview_img{max-width:414px;height:auto}.wpr-switch{display:inline-block}.wpr-switch input{position:absolute !important;clip:rect(0, 0, 0, 0);height:1px;width:1px;border:0;overflow:hidden}.wpr-switch label{float:left;display:inline-block;min-width:45px;background-color:#e4e4e4;color:rgba(0,0,0,0.6);font-size:12px;font-weight:700;line-height:28px;text-align:center;text-shadow:none;border:1px solid rgba(0,0,0,0.2);box-shadow:inset 0 1px 3px rgba(0,0,0,0.3),0 1px rgba(255,255,255,0.1);transition:all 0.1s ease-in-out}.wpr-switch label:hover{cursor:pointer}.wpr-switch label:first-of-type{border-radius:3px 0 0 3px;border-right:0;font-weight:normal}.wpr-switch label:last-of-type{border-radius:0 3px 3px 0;border-left:0;font-weight:normal}input.wpr-switch__on:checked+label,input.wpr-switch__off:checked+label{background:#0085ba;border-color:#0073aa #006799 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;margin-bottom:2px}input.wpr-switch__on:checked+label:hover,input.wpr-switch__off:checked+label:hover{background:#008ec2;border-color:#006799;color:#fff}input.wpr-switch__off:checked+label,input.wpr-switch__off:checked+label:hover{color:#fff;background:#f5786f;border-color:#bd4c44 #bd4c44 #bd4c44;box-shadow:0 1px 0 #bd4c44;text-shadow:none}#wp-review-demo-importer-popup{background:#fff;border:1px solid #eaeaeb;border-radius:3px;box-shadow:0 1px 0 #fff inset,0 1px 5px rgba(0,0,0,0.1);position:relative;width:auto;max-width:600px;margin:50px auto}#wp-review-demo-importer-modal-header{border-bottom:1px solid #eaeaeb;background:#FAFBFD;padding:12px 20px}#wp-review-demo-importer-modal-header .spinner{margin-top:14px}#wp-review-demo-importer-modal-header h2,#wp-review-demo-importer-modal-content h4{padding:0 !important;margin:0 !important}#wp-review-demo-importer-modal-header h2{font-size:1.8em;line-height:2em}#wp-review-demo-importer-modal-content{background:#fff;padding:20px;overflow:auto;height:300px;width:100%;box-sizing:border-box}#wp-review-demo-importer-modal-content p{padding:0;margin:0}#wp-review-demo-importer-modal-footer{border-top:1px solid #eaeaeb;background:#FAFBFD;padding:12px 20px;display:inline-block;width:100%;box-sizing:border-box}#wp-review-demo-importer-modal-footer-info{float:left}#wp-review-demo-importer-modal-footer-button{float:right;display:none;text-transform:uppercase}.wp-admin select.mce-selectbox{padding:0}#wp-review-metabox-userReview .inside>p:first-of-type label,#wp-review-metabox-userReview .inside>p:nth-of-type(2) label,#wp-review-metabox-userReview .inside>p:nth-of-type(3) label,#wp-review-metabox-userReview .inside>p:nth-of-type(4) label{padding-right:0;margin-left:5px}.wp-review-subsite-wrapper{display:none}.wp-review-pro-text{color:#00cc66}.wp-review-disabled{position:relative;cursor:pointer}.wp-review-disabled:before{content:" ";display:block;position:absolute;top:0;left:0;right:0;bottom:0;z-index:100}.wp-review-disabled.inline-block{display:inline-block}.wp-review-disabled.wpr-switch,.wp-review-disabled.has-bg{opacity:0.3}option.disabled{color:#aaa} 2 | -------------------------------------------------------------------------------- /admin/assets/css/jquery-ui.min.css: -------------------------------------------------------------------------------- 1 | /*--------------------------- 2 | * jQuery UI Slider 3 | *--------------------------*/ 4 | .ui-slider { position: relative; text-align: left; } 5 | .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.3em; cursor: default; } 6 | .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } 7 | .ui-slider-horizontal { height: .8em; } 8 | .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } 9 | .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } 10 | .ui-slider-horizontal .ui-slider-range-min { left: 0; } 11 | .ui-slider-horizontal .ui-slider-range-max { right: 0; } 12 | .ui-slider-vertical { width: .8em; height: 100px; } 13 | .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } 14 | .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } 15 | .ui-slider-vertical .ui-slider-range-min { bottom: 0; } 16 | .ui-slider-vertical .ui-slider-range-max { top: 0; } 17 | 18 | /* Date Picker Default Styles */ 19 | .ui-datepicker { 20 | padding: 0; 21 | margin: 0; 22 | -webkit-border-radius: 0; 23 | -moz-border-radius: 0; 24 | border-radius: 0; 25 | background-color: #fff; 26 | border: 1px solid #dfdfdf; 27 | border-top: none; 28 | -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); 29 | box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); 30 | min-width: 17em; 31 | width: auto; 32 | } 33 | 34 | .ui-datepicker * { 35 | padding: 0; 36 | font-family: "Open Sans", sans-serif; 37 | -webkit-border-radius: 0; 38 | -moz-border-radius: 0; 39 | border-radius: 0; 40 | } 41 | 42 | .ui-datepicker table { 43 | font-size: 13px; 44 | margin: 0; 45 | border: none; 46 | border-collapse: collapse; 47 | } 48 | 49 | .ui-datepicker .ui-widget-header, 50 | .ui-datepicker .ui-datepicker-header { 51 | background-image: none; 52 | border: none; 53 | color: #fff; 54 | font-weight: normal; 55 | } 56 | 57 | .ui-datepicker .ui-datepicker-header .ui-state-hover { 58 | background: transparent; 59 | border-color: transparent; 60 | cursor: pointer; 61 | } 62 | 63 | .ui-datepicker .ui-datepicker-title { 64 | margin: 0; 65 | padding: 10px 0; 66 | color: #fff; 67 | font-size: 14px; 68 | line-height: 14px; 69 | text-align: center; 70 | } 71 | 72 | .ui-datepicker .ui-datepicker-prev, 73 | .ui-datepicker .ui-datepicker-next { 74 | position: relative; 75 | top: 0; 76 | height: 34px; 77 | width: 34px; 78 | } 79 | 80 | .ui-datepicker .ui-state-hover.ui-datepicker-prev, 81 | .ui-datepicker .ui-state-hover.ui-datepicker-next { 82 | border: none; 83 | } 84 | 85 | .ui-datepicker .ui-datepicker-prev, 86 | .ui-datepicker .ui-datepicker-prev-hover { 87 | left: 0; 88 | } 89 | 90 | .ui-datepicker .ui-datepicker-next, 91 | .ui-datepicker .ui-datepicker-next-hover { 92 | right: 0; 93 | } 94 | 95 | .ui-datepicker .ui-datepicker-next span, 96 | .ui-datepicker .ui-datepicker-prev span { 97 | display: none; 98 | } 99 | 100 | .ui-datepicker .ui-datepicker-prev { 101 | float: left; 102 | } 103 | 104 | .ui-datepicker .ui-datepicker-next { 105 | float: right; 106 | } 107 | 108 | .ui-datepicker .ui-datepicker-prev:before, 109 | .ui-datepicker .ui-datepicker-next:before { 110 | font: normal 20px/34px 'dashicons'; 111 | padding-left: 7px; 112 | color: #fff; 113 | speak: none; 114 | -webkit-font-smoothing: antialiased; 115 | -moz-osx-font-smoothing: grayscale; 116 | width: 34px; 117 | height: 34px; 118 | } 119 | 120 | .ui-datepicker .ui-datepicker-prev:before { 121 | content: '\f341'; 122 | } 123 | 124 | .ui-datepicker .ui-datepicker-next:before { 125 | content: '\f345'; 126 | } 127 | 128 | .ui-datepicker .ui-datepicker-prev-hover:before, 129 | .ui-datepicker .ui-datepicker-next-hover:before { 130 | opacity: 0.7; 131 | } 132 | 133 | .ui-datepicker select.ui-datepicker-month, 134 | .ui-datepicker select.ui-datepicker-year { 135 | width: 33%; 136 | } 137 | 138 | .ui-datepicker thead { 139 | color: #fff; 140 | font-weight: 600; 141 | } 142 | 143 | .ui-datepicker th { 144 | padding: 10px; 145 | } 146 | 147 | .ui-datepicker td { 148 | padding: 0; 149 | border: 1px solid #f4f4f4; 150 | } 151 | 152 | .ui-datepicker td.ui-datepicker-other-month { 153 | border: transparent; 154 | } 155 | 156 | .ui-datepicker td.ui-datepicker-week-end { 157 | background-color: #f4f4f4; 158 | border: 1px solid #f4f4f4; 159 | } 160 | 161 | .ui-datepicker td.ui-datepicker-today { 162 | background-color: #f0f0c0; 163 | } 164 | 165 | .ui-datepicker td.ui-datepicker-current-day { 166 | background: #bbdd88; 167 | } 168 | 169 | .ui-datepicker td .ui-state-default { 170 | background: transparent; 171 | border: none; 172 | text-align: center; 173 | text-decoration: none; 174 | width: auto; 175 | display: block; 176 | padding: 5px 10px; 177 | font-weight: normal; 178 | color: #444; 179 | } 180 | 181 | .ui-datepicker td.ui-state-disabled .ui-state-default { 182 | opacity: 0.5; 183 | } 184 | 185 | /* Default Color Scheme */ 186 | .ui-datepicker .ui-widget-header, 187 | .ui-datepicker .ui-datepicker-header { 188 | background: #00a0d2; 189 | } 190 | 191 | .ui-datepicker thead { 192 | background: #32373c; 193 | } 194 | 195 | .ui-datepicker td .ui-state-hover { 196 | background: #0073aa; 197 | color: #fff; 198 | } 199 | 200 | /* WordPress Color Schemes */ 201 | 202 | /* Fresh */ 203 | .admin-color-fresh .ui-datepicker .ui-widget-header, 204 | .admin-color-fresh .ui-datepicker .ui-datepicker-header { 205 | background: #00a0d2; 206 | } 207 | 208 | .admin-color-fresh .ui-datepicker thead { 209 | background: #32373c; 210 | } 211 | 212 | .admin-color-fresh .ui-datepicker td .ui-state-hover { 213 | background: #0073aa; 214 | color: #fff; 215 | } 216 | 217 | /* Blue */ 218 | .admin-color-blue .ui-datepicker .ui-widget-header, 219 | .admin-color-blue .ui-datepicker .ui-datepicker-header { 220 | background: #52accc; 221 | } 222 | 223 | .admin-color-blue .ui-datepicker thead { 224 | background: #4796b3; 225 | } 226 | 227 | .admin-color-blue .ui-datepicker td .ui-state-hover { 228 | background: #096484; 229 | color: #fff; 230 | } 231 | 232 | /* Coffee */ 233 | .admin-color-coffee .ui-datepicker .ui-widget-header, 234 | .admin-color-coffee .ui-datepicker .ui-datepicker-header { 235 | background: #59524c; 236 | } 237 | 238 | .admin-color-coffee .ui-datepicker thead { 239 | background: #46403c; 240 | } 241 | 242 | .admin-color-coffee .ui-datepicker td .ui-state-hover { 243 | background: #c7a589; 244 | color: #fff; 245 | } 246 | 247 | /* Ectoplasm */ 248 | .admin-color-ectoplasm .ui-datepicker .ui-widget-header, 249 | .admin-color-ectoplasm .ui-datepicker .ui-datepicker-header { 250 | background: #523f6d; 251 | } 252 | 253 | .admin-color-ectoplasm .ui-datepicker thead { 254 | background: #413256; 255 | } 256 | 257 | .admin-color-ectoplasm .ui-datepicker td .ui-state-hover { 258 | background: #a3b745; 259 | color: #fff; 260 | } 261 | 262 | /* Midnight */ 263 | .admin-color-midnight .ui-datepicker .ui-widget-header, 264 | .admin-color-midnight .ui-datepicker .ui-datepicker-header { 265 | background: #363b3f; 266 | } 267 | 268 | .admin-color-midnight .ui-datepicker thead { 269 | background: #26292c; 270 | } 271 | 272 | .admin-color-midnight .ui-datepicker td .ui-state-hover { 273 | background: #e14d43; 274 | color: #fff; 275 | } 276 | 277 | /* Ocean */ 278 | .admin-color-ocean .ui-datepicker .ui-widget-header, 279 | .admin-color-ocean .ui-datepicker .ui-datepicker-header { 280 | background: #738e96; 281 | } 282 | 283 | .admin-color-ocean .ui-datepicker thead { 284 | background: #627c83; 285 | } 286 | 287 | .admin-color-ocean .ui-datepicker td .ui-state-hover { 288 | background: #9ebaa0; 289 | color: #fff; 290 | } 291 | 292 | /* Sunrise */ 293 | .admin-color-sunrise .ui-datepicker .ui-widget-header, 294 | .admin-color-sunrise .ui-datepicker .ui-datepicker-header, 295 | .admin-color-sunrise .ui-datepicker .ui-datepicker-header .ui-state-hover { 296 | background: #cf4944; 297 | } 298 | 299 | .admin-color-sunrise .ui-datepicker th { 300 | border-color: #be3631; 301 | background: #be3631; 302 | } 303 | 304 | .admin-color-sunrise .ui-datepicker td .ui-state-hover { 305 | background: #dd823b; 306 | color: #fff; 307 | } 308 | 309 | /* Light */ 310 | .admin-color-light .ui-datepicker .ui-widget-header, 311 | .admin-color-light .ui-datepicker .ui-datepicker-header { 312 | background: #e5e5e5; 313 | } 314 | 315 | .admin-color-light .ui-datepicker thead { 316 | background: #888; 317 | } 318 | 319 | .admin-color-light .ui-datepicker .ui-datepicker-title, 320 | .admin-color-light .ui-datepicker td .ui-state-default, 321 | .admin-color-light .ui-datepicker .ui-datepicker-prev:before, 322 | .admin-color-light .ui-datepicker .ui-datepicker-next:before { 323 | color: #555; 324 | } 325 | 326 | .admin-color-light .ui-datepicker td .ui-state-hover { 327 | background: #e5e5e5; 328 | } 329 | 330 | /* bbPress Color Schemes */ 331 | 332 | /* Evergreen */ 333 | .admin-color-bbp-evergreen .ui-datepicker .ui-widget-header, 334 | .admin-color-bbp-evergreen .ui-datepicker .ui-datepicker-header { 335 | background: #56b274; 336 | } 337 | 338 | .admin-color-bbp-evergreen .ui-datepicker thead { 339 | background: #36533f; 340 | } 341 | 342 | .admin-color-bbp-evergreen .ui-datepicker td .ui-state-hover { 343 | background: #446950; 344 | color: #fff; 345 | } 346 | 347 | /* Mint */ 348 | .admin-color-bbp-mint .ui-datepicker .ui-widget-header, 349 | .admin-color-bbp-mint .ui-datepicker .ui-datepicker-header { 350 | background: #4ca26a; 351 | } 352 | 353 | .admin-color-bbp-mint .ui-datepicker thead { 354 | background: #4f6d59; 355 | } 356 | 357 | .admin-color-bbp-mint .ui-datepicker td .ui-state-hover { 358 | background: #5fb37c; 359 | color: #fff; 360 | } -------------------------------------------------------------------------------- /admin/assets/images/loading.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /admin/assets/images/wp-review-pro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MyThemeShopTeam/WP-Review/112ae436f86bd04b05b905636830a2db502fc960/admin/assets/images/wp-review-pro.jpg -------------------------------------------------------------------------------- /admin/assets/js/admin.import.js: -------------------------------------------------------------------------------- 1 | jQuery( function( $ ) { 2 | 'use strict'; 3 | 4 | var $section_header = $( '#import h2' ); 5 | var default_error = { message: wprImportVars.server_error }; 6 | var source, nonce; 7 | 8 | $( '#wp-review-import-options-btn' ).on( 'click', function( ev ) { 9 | ev.preventDefault(); 10 | var $btn, code, check; 11 | $btn = $( this ); 12 | code = $( '#wp-review-import-options-code' ).val().trim(); 13 | if ( ! code ) { 14 | return; 15 | } 16 | check = confirm( wprImportVars.confirmOptionsImport ); 17 | if ( ! check ) { 18 | return; 19 | } 20 | $btn.prop( 'disabled', true ); 21 | var request = wp.ajax.post( 'wp_review_import_options', { 22 | code: code, 23 | _ajax_nonce: wprImportVars.importOptionsNonce 24 | }); 25 | request.done( function( response ) { 26 | window.location.href = window.location.href; 27 | }); 28 | request.fail( function( response ) { 29 | console.error( response ); 30 | $btn.prop( 'disabled', false ); 31 | }); 32 | }); 33 | } ); 34 | -------------------------------------------------------------------------------- /admin/assets/js/editor-plugin.js: -------------------------------------------------------------------------------- 1 | ( function( tinymce, wpreview, $ ) { 2 | "use strict"; 3 | 4 | var getShortcode = function( name, attrs ) { 5 | var output = '[' + name; 6 | for ( var k in attrs ) { 7 | if ( ! attrs[ k ] ) { 8 | continue; 9 | } 10 | output += ' ' + k + '="' + attrs[ k ] + '"'; 11 | } 12 | output += ']'; 13 | return output; 14 | }; 15 | 16 | function getWPReviewButton( editor ) { 17 | return { 18 | text: wprVars.reviewBox, 19 | onclick: function() { 20 | var dialog = editor.windowManager.open({ 21 | title: wprVars.reviewBox, 22 | body: [ 23 | { 24 | type: 'textbox', 25 | name: 'id', 26 | label: wprVars.reviewId, 27 | tooltip: wprVars.leaveReviewIdEmpty 28 | } 29 | ], 30 | buttons: [ 31 | { 32 | id: 'wpr-insert-shortcode', 33 | classes: 'widget btn primary first abs-layout-item', 34 | text: wprVars.insert, 35 | onclick: function() { 36 | dialog.submit(); 37 | } 38 | }, 39 | { 40 | id: 'wpr-cancel-shortcode', 41 | text: wprVars.cancel, 42 | onclick: function() { 43 | dialog.close(); 44 | } 45 | } 46 | ], 47 | onsubmit: function( e ) { 48 | var name = 'wp-review', 49 | attrs = e.data; 50 | 51 | editor.insertContent( getShortcode( name, attrs ) ); 52 | } 53 | }); 54 | } 55 | }; 56 | } 57 | 58 | function getReviewTotalButton( editor ) { 59 | return { 60 | text: wprVars.reviewTotal, 61 | onclick: function() { 62 | var dialog = editor.windowManager.open({ 63 | title: wprVars.reviewTotal, 64 | body: [ 65 | { 66 | type: 'textbox', 67 | name: 'id', 68 | label: wprVars.reviewId, 69 | tooltip: wprVars.leaveReviewIdEmpty 70 | } 71 | ], 72 | buttons: [ 73 | { 74 | id: 'wpr-insert-shortcode', 75 | classes: 'widget btn primary first abs-layout-item', 76 | text: wprVars.insert, 77 | onclick: function() { 78 | dialog.submit(); 79 | } 80 | }, 81 | { 82 | id: 'wpr-cancel-shortcode', 83 | text: wprVars.cancel, 84 | onclick: function() { 85 | dialog.close(); 86 | } 87 | } 88 | ], 89 | onsubmit: function( e ) { 90 | var name = 'wp-review-total', 91 | attrs = e.data; 92 | 93 | editor.insertContent( getShortcode( name, attrs ) ); 94 | } 95 | }); 96 | } 97 | }; 98 | } 99 | 100 | function getVisitorRatingButton( editor ) { 101 | return { 102 | text: wprVars.visitorRating, 103 | onclick: function() { 104 | var dialog = editor.windowManager.open({ 105 | title: wprVars.visitorRating, 106 | body: [ 107 | { 108 | type: 'textbox', 109 | name: 'id', 110 | label: wprVars.reviewId, 111 | tooltip: wprVars.leaveReviewIdEmpty 112 | } 113 | ], 114 | buttons: [ 115 | { 116 | id: 'wpr-insert-shortcode', 117 | classes: 'widget btn primary first abs-layout-item', 118 | text: wprVars.insert, 119 | onclick: function() { 120 | dialog.submit(); 121 | } 122 | }, 123 | { 124 | id: 'wpr-cancel-shortcode', 125 | text: wprVars.cancel, 126 | onclick: function() { 127 | dialog.close(); 128 | } 129 | } 130 | ], 131 | onsubmit: function( e ) { 132 | var name = 'wp-review-visitor-rating', 133 | attrs = e.data; 134 | 135 | editor.insertContent( getShortcode( name, attrs ) ); 136 | } 137 | }); 138 | } 139 | }; 140 | } 141 | 142 | tinymce.create( 'tinymce.plugins.WPReviewPro', { 143 | /** 144 | * Initializes the plugin, this will be executed after the plugin has been created. 145 | * This call is done before the editor instance has finished it's initialization so use the onInit event 146 | * of the editor instance to intercept that event. 147 | * 148 | * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. 149 | * @param {string} url Absolute URL to where the plugin is located. 150 | */ 151 | init : function( ed, url ) { 152 | ed.addButton( 'wpreviewpro', { 153 | type: 'menubutton', 154 | icon: 'dashicons dashicons-before dashicons-star-filled', 155 | menu: [ 156 | getWPReviewButton( ed ), 157 | getReviewTotalButton( ed ), 158 | getVisitorRatingButton( ed ) 159 | ] 160 | }); 161 | }, 162 | 163 | /** 164 | * Creates control instances based in the incomming name. This method is normally not 165 | * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons 166 | * but you sometimes need to create more complex controls like listboxes, split buttons etc then this 167 | * method can be used to create those. 168 | * 169 | * @param {String} n Name of the control to create. 170 | * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control. 171 | * @return {tinymce.ui.Control} New control instance or null if no control was created. 172 | */ 173 | createControl : function(n, cm) { 174 | return null; 175 | }, 176 | 177 | /** 178 | * Returns information about the plugin as a name/value array. 179 | * The current keys are longname, author, authorurl, infourl and version. 180 | * 181 | * @return {Object} Name/value array containing information about the plugin. 182 | */ 183 | getInfo : function() { 184 | return { 185 | longname : 'WP Review Buttons', 186 | author : 'MTS', 187 | authorurl : 'https://mythemeshop.com', 188 | version : '3.0.0' 189 | }; 190 | } 191 | }); 192 | 193 | // Register plugin 194 | tinymce.PluginManager.add( 'wp_review', tinymce.plugins.WPReviewPro ); 195 | })( tinymce, wpreview, jQuery ); 196 | -------------------------------------------------------------------------------- /admin/assets/js/rating-inputs.js: -------------------------------------------------------------------------------- 1 | ( function( $ ) { 2 | "use strict"; 3 | 4 | var defaults = { 5 | value: 0, 6 | color: '', 7 | callback: null 8 | }; 9 | 10 | function triggerCallback( options, value ) { 11 | if ( typeof options.callback == 'function' ) { 12 | options.callback.call( options._this, value ); 13 | } 14 | } 15 | 16 | // Star input. 17 | $.fn.wprStarInput = function( method ) { 18 | var methods = { 19 | init: function( options ) { 20 | var _this = this, wrapper, html, starHtml, width; 21 | options = $.extend( {}, defaults, this.data(), options ); 22 | if ( this.val() ) { 23 | options.value = this.val() ? parseFloat( this.val() ) : 0; 24 | } 25 | options._this = this; 26 | 27 | width = parseFloat( options.value ) * 20; 28 | 29 | starHtml = ''; 30 | for ( var i = 0; i < 5; i++ ) { 31 | starHtml += ''; 32 | } 33 | 34 | html = '
\ 35 |
' + starHtml + '
\ 36 |
' + starHtml + '
\ 37 |
'; 38 | 39 | wrapper = $( html ); 40 | this.before( wrapper ); 41 | 42 | if ( typeof options.ready == 'function' ) { 43 | options.ready.call( this, wrapper, options ) 44 | } 45 | 46 | wrapper.on( 'mousemove', function( ev ) { 47 | var newWidth; 48 | newWidth = ev.pageX - $( this ).offset().left; 49 | newWidth = newWidth / $( this ).width() * 100; 50 | newWidth = Math.ceil( newWidth / 10 ) * 10; 51 | $( this ).attr( 'data-value', newWidth / 20 ); // width / 100 * 5 52 | $( this ).find( '.stars-result' ).css( 'width', newWidth + '%' ); 53 | $( this ).attr( 'data-width', newWidth ); 54 | }).on( 'mouseleave', function() { 55 | // Reset to old width. 56 | $( this ).find( '.stars-result' ).css( 'width', width + '%' ); 57 | $( this ).attr( 'data-width', width ); 58 | $( this ).attr( 'data-value', options.value ); 59 | }).on( 'click', function() { 60 | width = $( this ).attr( 'data-width' ); 61 | options.value = parseFloat( $( this ).attr( 'data-value' ) ); 62 | _this.val( options.value ); 63 | triggerCallback( options, options.value ); 64 | }); 65 | 66 | wrapper.css({ color: options.color }); 67 | 68 | this.on( 'change', function() { 69 | var value = $( this ).val() ? parseFloat( $( this ).val() ) : 0; 70 | wrapper.attr( 'data-value', value ); 71 | wrapper.attr( 'data-width', value * 20 ); 72 | wrapper.find( '.stars-result' ).css( 'width', ( value * 20 ) + '%' ); 73 | triggerCallback( options, value ); 74 | }); 75 | } 76 | }; 77 | 78 | if ( ! method || typeof method == 'object' ) { 79 | methods.init.apply( this, arguments ); 80 | return; 81 | } 82 | if ( methods[ method ] ) { 83 | methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) ); 84 | return; 85 | } 86 | }; 87 | 88 | // Percentage input. 89 | $.fn.wprPercentageInput = function( method ) { 90 | var methods = { 91 | init: function( options ) { 92 | var _this = this, wrapper; 93 | options = $.extend( {}, defaults, this.data(), options ); 94 | if ( this.val() ) { 95 | options.value = this.val(); 96 | } 97 | options._this = this; 98 | 99 | if ( ! options.inactiveColor ) { 100 | options.inactiveColor = '#ccc'; 101 | } 102 | 103 | wrapper = $( '
' ); 104 | this.before( wrapper ); 105 | 106 | if ( typeof options.ready == 'function' ) { 107 | options.ready.call( this, wrapper, options ) 108 | } 109 | 110 | wrapper.slider({ 111 | min: 0, 112 | max: 100, 113 | step: 1, 114 | range: 'min', 115 | value: options.value, 116 | create: function( ev, ui ) { 117 | wrapper.css( 'backgroundColor', options.inactiveColor ); 118 | wrapper.find( '.ui-slider-range' ).css( 'backgroundColor', options.color ); 119 | }, 120 | slide: function( ev, ui ) { 121 | triggerCallback( options, ui.value ); 122 | } 123 | }); 124 | 125 | this.on( 'change', function() { 126 | var value = $( this ).val(); 127 | wrapper.slider( 'value', value ); 128 | triggerCallback( options, value ); 129 | }); 130 | } 131 | }; 132 | 133 | if ( ! method || typeof method == 'object' ) { 134 | methods.init.apply( this, arguments ); 135 | return; 136 | } 137 | if ( methods[ method ] ) { 138 | methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) ); 139 | return; 140 | } 141 | }; 142 | 143 | // Point input. 144 | $.fn.wprPointInput = function( method ) { 145 | var methods = { 146 | init: function( options ) { 147 | var _this = this, wrapper; 148 | options = $.extend( {}, defaults, this.data(), options ); 149 | if ( this.val() ) { 150 | options.value = this.val(); 151 | } 152 | options._this = this; 153 | 154 | if ( ! options.inactiveColor ) { 155 | options.inactiveColor = '#ccc'; 156 | } 157 | 158 | wrapper = $( '
' ); 159 | this.before( wrapper ); 160 | 161 | if ( typeof options.ready == 'function' ) { 162 | options.ready.call( this, wrapper, options ) 163 | } 164 | 165 | wrapper.slider({ 166 | min: 0, 167 | max: 10, 168 | step: 0.1, 169 | range: 'min', 170 | value: options.value, 171 | create: function( ev, ui ) { 172 | wrapper.css( 'backgroundColor', options.inactiveColor ); 173 | wrapper.find( '.ui-slider-range' ).css( 'backgroundColor', options.color ); 174 | }, 175 | slide: function( ev, ui ) { 176 | triggerCallback( options, ui.value ); 177 | } 178 | }); 179 | 180 | this.on( 'change', function() { 181 | var value = $( this ).val(); 182 | wrapper.slider( 'value', value ); 183 | triggerCallback( options, value ); 184 | }); 185 | } 186 | }; 187 | 188 | if ( ! method || typeof method == 'object' ) { 189 | methods.init.apply( this, arguments ); 190 | return; 191 | } 192 | if ( methods[ method ] ) { 193 | methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) ); 194 | return; 195 | } 196 | }; 197 | 198 | })( jQuery ); 199 | -------------------------------------------------------------------------------- /admin/assets/js/review-items.js: -------------------------------------------------------------------------------- 1 | ( function( Backbone, $ ) { 2 | "use strict"; 3 | 4 | if ( ! $( '#wpr-review-items-app' ).length ) { 5 | return; 6 | } 7 | 8 | var App = { 9 | Models: {}, 10 | Collections: {}, 11 | Views: {} 12 | }; 13 | 14 | App.Models.Item = Backbone.Model.extend({ 15 | defaults: function() { 16 | return { 17 | id: '', 18 | item_id: '', 19 | wp_review_item_title: '', 20 | wp_review_item_star: 0, 21 | wp_review_item_color: $( '#wpr-review-color-value' ).val(), 22 | wp_review_item_inactive_color: $( '#wpr-review-inactive-color-value' ).val(), 23 | type: $( '#wpr-review-type-2' ).val() || wprVars.globalReviewType 24 | }; 25 | } 26 | }); 27 | 28 | App.Collections.Items = Backbone.Collection.extend({ 29 | model: App.Models.Item 30 | }); 31 | 32 | App.Views.ItemView = Backbone.View.extend({ 33 | template: wp.template( 'wpr-review-item' ), 34 | 35 | className: 'wpr-review-item', 36 | 37 | initialize: function() { 38 | this.model.on( 'destroy', this.remove, this ); 39 | }, 40 | 41 | events: { 42 | 'click .delete-item': 'remove', 43 | 'change .input-title': 'changeTitle', 44 | 'change .input-star': 'changeScore' 45 | }, 46 | 47 | render: function() { 48 | var _this = this, 49 | data; 50 | 51 | data = this.model.toJSON(); 52 | data.itemNameSetting = wp.template( 'wpr-review-item-name' )( data ); 53 | data.itemColorSetting = wp.template( 'wpr-review-item-color' )( data ); 54 | data.itemInactiveColorSetting = wp.template( 'wpr-review-item-inactive-color' )( data ); 55 | if ( $( '#tmpl-wpr-review-item-' + data.type + '-rating' ).length ) { 56 | data.itemRatingSetting = wp.template( 'wpr-review-item-' + data.type + '-rating' )( data ); 57 | } else { 58 | data.itemRatingSetting = wp.template( 'wpr-review-item-rating' )( data ); 59 | } 60 | this.$el.html( this.template( data ) ); 61 | 62 | this.$( '.input-color' ).wpColorPicker({ 63 | change: function( ev, ui ) { 64 | var color = ui.color.toString(); 65 | _this.$( '.wpr-star-input-wrapper' ).css({ color: color }); 66 | _this.$( '.wpr-input-wrapper.ui-slider .ui-slider-range' ).css({ backgroundColor: color }); 67 | _this.model.set( 'wp_review_item_color', color ); 68 | } 69 | }); 70 | 71 | this.$( '.input-inactive-color' ).wpColorPicker({ 72 | change: function( ev, ui ) { 73 | var color = ui.color.toString(); 74 | _this.$( '.wpr-star-input-wrapper .stars-bg' ).css({ color: color }); 75 | _this.$( '.wpr-input-wrapper.ui-slider' ).css({ backgroundColor: color }); 76 | _this.model.set( 'wp_review_item_inactive_color', color ); 77 | } 78 | }); 79 | 80 | function validateValue( value, min, max ) { 81 | value = parseFloat( value ); 82 | if ( isNaN( value ) || min !== undefined && value < min || max !== undefined && value > max ) { 83 | _this.$el.find( '.input-star, .input-star-display' ).addClass( 'review-value-incorrect' ); 84 | } else { 85 | _this.$el.find( '.input-star, .input-star-display' ).removeClass( 'review-value-incorrect' ); 86 | } 87 | } 88 | 89 | switch ( this.model.get( 'type' ) ) { 90 | case 'star': 91 | var _this = this; 92 | 93 | this.$( '.input-star' ).wprStarInput({ 94 | ready: function( wrapper, options ) { 95 | this.appendTo( this.closest( '.col-2' ).next() ); 96 | }, 97 | callback: function( value ) { 98 | validateValue( value, 0, wprVars.reviewTypes.star.max ); 99 | _this.model.set( 'wp_review_item_star', value ); 100 | } 101 | }); 102 | break; 103 | 104 | case 'percentage': 105 | this.$( '.input-star' ).wprPercentageInput({ 106 | ready: function( wrapper, options ) { 107 | this.appendTo( this.closest( '.col-2' ).next() ); 108 | }, 109 | callback: function( value ) { 110 | this.val( value ); 111 | validateValue( value, 0, wprVars.reviewTypes.percentage.max ); 112 | _this.model.set( 'wp_review_item_star', value ); 113 | } 114 | }); 115 | break; 116 | 117 | case 'point': 118 | this.$( '.input-star' ).wprPointInput({ 119 | ready: function( wrapper, options ) { 120 | this.appendTo( this.closest( '.col-2' ).next() ); 121 | }, 122 | callback: function( value ) { 123 | this.val( value ); 124 | validateValue( value, 0, wprVars.reviewTypes.point.max ); 125 | _this.model.set( 'wp_review_item_star', value ); 126 | } 127 | }); 128 | break; 129 | } 130 | 131 | this.$el.attr( 'data-id', this.model.get( 'id' ) ); 132 | return this; 133 | }, 134 | 135 | remove: function() { 136 | collection.remove( this.model ); 137 | }, 138 | 139 | changeTitle: function( ev ) { 140 | this.model.set( 'wp_review_item_title', ev.target.value ); 141 | }, 142 | 143 | changeScore: function( ev ) { 144 | this.model.set( 'wp_review_item_star', parseFloat( ev.target.value ) ); 145 | } 146 | }); 147 | 148 | App.Views.AppView = Backbone.View.extend({ 149 | el: '#wpr-review-items-app', 150 | 151 | initialize: function() { 152 | this.render(); 153 | this.collection.on( 'add', this.renderOne, this ); 154 | this.collection.on( 'remove', this.remove, this ); 155 | this.collection.on( 'add', this.calculateTotal, this ); 156 | this.collection.on( 'change', this.calculateTotal, this ); 157 | this.collection.on( 'remove', this.calculateTotal, this ); 158 | this.collection.on( 'add change remove', this.updateAppAttr, this ); 159 | }, 160 | 161 | events: { 162 | 'click .add-item': 'addItem', 163 | 'change #wpr-review-type-2': 'changeType' 164 | }, 165 | 166 | render: function() { 167 | this.$( '.wpr-review-items' ).html( '' ); 168 | this.collection.each( this.renderOne, this ); 169 | this.calculateTotal(); 170 | this.$( '.wpr-review-items' ).sortable({ 171 | handle: '.wpr-icon-move' 172 | }); 173 | return this; 174 | }, 175 | 176 | renderOne: function( item ) { 177 | var view = new App.Views.ItemView({ model: item }); 178 | this.$( '.wpr-review-items' ).append( view.render().el ); 179 | }, 180 | 181 | calculateTotal: function() { 182 | if ( ! this.$el.attr( 'data-changed' ) ) { 183 | return; 184 | } 185 | 186 | var total = 0, 187 | count = this.collection.length; 188 | 189 | if ( count ) { 190 | _.each( this.collection.models, function( item ) { 191 | total += ! isNaN( item.get( 'wp_review_item_star' ) ) ? parseFloat( item.get( 'wp_review_item_star' ) * 1 ) : 0; 192 | }); 193 | total = Math.round( total * 100 / count ) / 100; 194 | } 195 | 196 | this.$( '.input-total' ).val( total ); 197 | }, 198 | 199 | remove: function( item ) { 200 | this.$el.find( '.wpr-review-item[data-id="' + item.get( 'id' ) + '"]' ).remove(); 201 | }, 202 | 203 | addItem: function() { 204 | var model = new App.Models.Item(); 205 | model.set( 'id', 'a' + parseInt( Math.random() * 100 ) ); 206 | this.collection.add( model ); 207 | }, 208 | 209 | changeType: function( ev ) { 210 | var type = ev.target.value; 211 | if ( type == 'none' ) { 212 | return; 213 | } 214 | _.each( this.collection.models, function( item ) { 215 | item.set( 'type', type ); 216 | }); 217 | this.render(); 218 | }, 219 | 220 | updateAppAttr: function() { 221 | this.$el.attr( 'data-changed', '1' ); 222 | } 223 | }); 224 | 225 | function onSelectType() { 226 | $( '#wpr-review-type-2' ).val( $( this ).val() ).trigger( 'change' ); 227 | } 228 | $( '#wp_review_type' ).on( 'change', onSelectType ); 229 | 230 | // App initialize. 231 | var items = $( '#wpr-review-items-data' ).val(); 232 | items = items ? JSON.parse( items ) : []; 233 | items.map( function( item, index ) { 234 | item.item_id = item.id; 235 | item.id = index; 236 | return item; 237 | }); 238 | 239 | var collection = new App.Collections.Items( items ); 240 | 241 | var appView = new App.Views.AppView({ 242 | collection: collection 243 | }); 244 | })( Backbone, jQuery ); 245 | -------------------------------------------------------------------------------- /admin/assets/js/review-notice.js: -------------------------------------------------------------------------------- 1 | ( function( $ ) { 2 | "use strict"; 3 | 4 | function dismiss( later ) { 5 | $.post( 6 | ajaxurl, 7 | { 8 | action: 'wpr_dismiss_review_notice', 9 | later: later 10 | }, 11 | function( response ) { 12 | $( '#wpr-review-notice' ).remove(); 13 | } 14 | ) 15 | } 16 | 17 | $( document ).ready( function() { 18 | $( '.wpr-review-notice-btn-dismiss, #wpr-review-notice .notice-dismiss' ).on( 'click', function() { 19 | dismiss(); 20 | }); 21 | $( '.wpr-review-notice-btn-later' ).on( 'click', function() { 22 | dismiss( true ); 23 | }); 24 | }); 25 | })( jQuery ); 26 | -------------------------------------------------------------------------------- /admin/assets/js/wp-review-tab-widget-admin.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Plugin Name: WP Review 3 | * Plugin URI: http://mythemeshop.com/plugins/wp-review/ 4 | * Description: Create reviews! Choose from Stars, Percentages, Circles or Points for review scores. Supports Retina Display, WPMU & Unlimited Color Schemes. 5 | * Author: MyThemesShop 6 | * Author URI: http://mythemeshop.com/ 7 | */ 8 | jQuery(document).on('click', function(e) { 9 | var $this = jQuery(e.target); 10 | var $form = $this.closest('.wp_review_tab_options_form'); 11 | 12 | if ($this.is('.wp_review_tab_enable_toprated')) { 13 | $form.find('.wp_review_tab_toprated_order').slideToggle($this.is(':checked')); 14 | $form.find('.wp_review_tab_toprated_title').slideToggle($this.is(':checked')); 15 | $form.find('.wp_review_tab_top_rated_filter').slideToggle($this.is(':checked')); 16 | } else if ($this.is('.wp_review_tab_enable_recent')) { 17 | $form.find('.wp_review_tab_recent_order').slideToggle($this.is(':checked')); 18 | $form.find('.wp_review_tab_recent_title').slideToggle($this.is(':checked')); 19 | } else if ($this.is('.wp_review_tab_enable_mostvoted')) { 20 | $form.find('.wp_review_tab_mostvoted_order').slideToggle($this.is(':checked')); 21 | $form.find('.wp_review_tab_mostvoted_title').slideToggle($this.is(':checked')); 22 | } else if ($this.is('.wp_review_tab_enable_recent_ratings')) { 23 | $form.find('.wp_review_tab_recent_ratings_order').slideToggle($this.is(':checked')); 24 | $form.find('.wp_review_tab_recent_ratings_title').slideToggle($this.is(':checked')); 25 | $form.find('.wp_review_restrict_recent_review').slideToggle($this.is(':checked')); 26 | } else if ($this.is('.wp_review_tab_enable_custom')) { 27 | $form.find('.wp_review_tab_custom_order').slideToggle($this.is(':checked')); 28 | $form.find('.wp_review_tab_custom_title').slideToggle($this.is(':checked')); 29 | $form.find('.wp_review_tab_custom_reviews').slideToggle($this.is(':checked')); 30 | } else if ($this.is('.wp_review_tab_order_header')) { 31 | e.preventDefault(); 32 | $form.find('.wp_review_tab_order').slideToggle(); 33 | $form.find('.wp_review_tab_titles').slideUp(); 34 | } else if ($this.is('.wp_review_tab_titles_header')) { 35 | e.preventDefault(); 36 | $form.find('.wp_review_tab_titles').slideToggle(); 37 | $form.find('.wp_review_tab_order').slideUp(); 38 | } 39 | }); 40 | -------------------------------------------------------------------------------- /admin/class-wp-review-form-field.php: -------------------------------------------------------------------------------- 1 | '', 25 | 'class' => '', 26 | 'name' => '', 27 | 'on_label' => _x( 'Yes', 'switch label', 'wp-review' ), 28 | 'off_label' => _x( 'No', 'switch label', 'wp-review' ), 29 | 'value' => 0, 30 | 'echo' => true, 31 | 'disabled' => false, 32 | ) 33 | ); 34 | 35 | $switch_id = $args['id'] ? $args['id'] : 'wpr-switch-' . mt_rand( 100, 999 ); 36 | $switch_name = $args['name'] ? $args['name'] : $switch_id; 37 | $value = intval( $args['value'] ); 38 | 39 | if ( $args['disabled'] ) { 40 | $args['class'] .= ' wp-review-disabled'; 41 | } 42 | ob_start(); 43 | ?> 44 |
45 | > 46 | 47 | > 48 | 49 |
50 | numposts = apply_filters( 'wp_review_import_numposts', 10 ); 30 | } 31 | 32 | /** 33 | * AJAX handler for importing options. 34 | */ 35 | public function import_options() { 36 | check_ajax_referer( 'wp-review-import-options' ); 37 | if ( empty( $_POST['code'] ) ) { 38 | wp_send_json_error(); 39 | } 40 | $code = wp_unslash( $_POST['code'] ); 41 | if ( wp_review_import_options( $code ) ) { 42 | wp_send_json_success(); 43 | } 44 | wp_send_json_error(); 45 | } 46 | 47 | /** 48 | * Runs extra tasks. 49 | */ 50 | public function extra_tasks() { 51 | if ( ! function_exists( 'Display_Select_Review' ) ) { 52 | add_shortcode( 'select-review', '__return_empty_string' ); 53 | } 54 | } 55 | } 56 | 57 | $plugin_importer = new WP_Review_Importer(); 58 | -------------------------------------------------------------------------------- /admin/class-wp-review-options.php: -------------------------------------------------------------------------------- 1 | hook = add_options_page( 38 | __( 'WP Review', 'wp-review' ), 39 | __( 'WP Review', 'wp-review' ), 40 | 'wp_review_global_options', 41 | 'wp-review/admin/options.php', 42 | array( $this, 'render' ) 43 | ); 44 | 45 | add_action( "load-{$this->hook}", array( $this, 'load' ) ); 46 | } 47 | 48 | } 49 | 50 | /** 51 | * Runs some functions on page load. 52 | */ 53 | public function load() { 54 | add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) ); 55 | } 56 | 57 | /** 58 | * Adds classes to body tag. 59 | * 60 | * @param string $classes Body classes. 61 | * @return string 62 | */ 63 | public function admin_body_classes( $classes ) { 64 | $classes .= ' wp-review-admin-options'; 65 | return $classes; 66 | } 67 | 68 | /** 69 | * Registers settings. 70 | */ 71 | public function register_settings() { 72 | register_setting( 'wpreview-settings-group', 'wp_review_options' ); 73 | } 74 | 75 | /** 76 | * Gets options page tabs. 77 | * 78 | * @return array 79 | */ 80 | protected function get_tabs() { 81 | $tabs_content = array( 82 | 'review' => array( 83 | 'title' => __( 'Global', 'wp-review' ), 84 | 'icon' => 'cogs', 85 | 'capability' => 'wp_review_global_options', 86 | 'multisite_enabled' => 'hide_global_options_', 87 | ), 88 | 'popup' => array( 89 | 'title' => __( 'Popup', 'wp-review' ), 90 | 'icon' => 'sticky-note', 91 | 'capability' => 'manage_options', 92 | 'multisite_enabled' => 'hide_general_popup_', 93 | ), 94 | 'hello-bar' => array( 95 | 'title' => __( 'Notification Bar', 'wp-review' ), 96 | 'icon' => 'warning', 97 | 'capability' => 'manage_options', 98 | 'multisite_enabled' => 'hide_general_bar_', 99 | ), 100 | 'yelp' => array( 101 | 'title' => __( 'Yelp Reviews', 'wp-review' ), 102 | 'icon' => 'yelp', 103 | 'capability' => 'manage_options', 104 | 'multisite_enabled' => 'hide_yelp_reviews_', 105 | ), 106 | 'google' => array( 107 | 'title' => __( 'Google Reviews', 'wp-review' ), 108 | 'icon' => 'google', 109 | 'capability' => 'manage_options', 110 | 'multisite_enabled' => 'hide_google_reviews_', 111 | ), 112 | 'facebook' => array( 113 | 'title' => __( 'Facebook Reviews', 'wp-review' ), 114 | 'icon' => 'facebook', 115 | 'capability' => 'manage_options', 116 | 'multisite_enabled' => 'hide_facebook_reviews_', 117 | ), 118 | 'role-manager' => array( 119 | 'title' => __( 'Role Manager', 'wp-review' ), 120 | 'icon' => 'user', 121 | 'capability' => 'administrator', 122 | 'multisite_enabled' => 'hide_role_manager_', 123 | ), 124 | 'import' => array( 125 | 'title' => __( 'Import Reviews', 'wp-review' ), 126 | 'icon' => 'download', 127 | 'capability' => 'wp_review_import_reviews', 128 | 'multisite_enabled' => 'hide_import_', 129 | ), 130 | 'help' => array( 131 | 'title' => __( 'Help', 'wp-review' ), 132 | 'icon' => 'question-circle', 133 | 'capability' => 'manage_options', 134 | 'multisite_enabled' => 'hide_help_', 135 | ), 136 | ); 137 | 138 | $tabs = array(); 139 | 140 | foreach ( $tabs_content as $key => $tab ) { 141 | $hide = wp_review_network_option( $tab['multisite_enabled'] ); 142 | if ( current_user_can( $tab['capability'] ) && ! $hide ) { 143 | $tabs[] = array( 144 | 'id' => $key, 145 | 'title' => $tab['title'], 146 | 'icon' => 'fa fa-' . $tab['icon'], 147 | 'view' => WP_REVIEW_ADMIN . 'options/' . $key . '.php', 148 | ); 149 | } 150 | } 151 | 152 | if ( is_multisite() && is_main_site() && current_user_can( 'administrator' ) ) { 153 | $tabs[] = array( 154 | 'id' => 'multisite_settings', 155 | 'title' => __( 'Multisite Settings', 'wp-review' ), 156 | 'icon' => 'fa fa-sitemap', 157 | 'view' => WP_REVIEW_ADMIN . 'options/multisite.php', 158 | ); 159 | } 160 | return $tabs; 161 | } 162 | 163 | /** 164 | * Renders page content. 165 | */ 166 | public function render() { 167 | $tabs = $this->get_tabs(); 168 | ?> 169 |
170 |

171 | 172 |
173 | 174 | 175 |
176 |
    177 | 178 |
  • 179 | 180 |
181 | 182 |
183 | 184 |
185 |

186 | 187 | 188 |
189 | 190 |
191 | 192 |
193 |
194 |
195 | init(); 201 | -------------------------------------------------------------------------------- /admin/class-wpr-review-notice.php: -------------------------------------------------------------------------------- 1 | = this value. 31 | * 32 | * @var int 33 | */ 34 | private $review_count = 10; 35 | 36 | /** 37 | * Initializes class. 38 | */ 39 | public function init() { 40 | add_action( 'admin_notices', array( $this, 'show_notice' ) ); 41 | add_action( 'wp_ajax_wpr_dismiss_review_notice', array( $this, 'handle_dismiss' ) ); 42 | } 43 | 44 | /** 45 | * Shows the notice. 46 | */ 47 | public function show_notice() { 48 | if ( ! $this->should_show() ) { 49 | return; 50 | } 51 | ?> 52 |
53 |
54 |

55 |
56 | 57 | 58 | 59 | 63 | 67 |
68 |
69 | 70 | 109 | dismiss_later_key, time() + MONTH_IN_SECONDS ); 120 | } else { 121 | update_option( $this->dismiss_key, '1' ); 122 | } 123 | } 124 | 125 | /** 126 | * Checks if should show the notice. 127 | */ 128 | private function should_show() { 129 | 130 | if ( get_option( $this->dismiss_key ) ) { 131 | return false; 132 | } 133 | 134 | $later_date = absint( get_option( $this->dismiss_later_key ) ); 135 | if ( $later_date > time() ) { 136 | return false; 137 | } 138 | 139 | // Backwards compatibility for transients used in versions <= 5.2.5 140 | if ( get_transient( 'wpr_review_notice_dismiss' ) ) { 141 | update_option( $this->dismiss_key, '1' ); 142 | return false; 143 | } 144 | 145 | $query = wp_review_get_reviews_query( 146 | 'latest', 147 | array( 148 | 'post_num' => $this->review_count, 149 | 'post_status' => 'any', 150 | ) 151 | ); 152 | return intval( $query->post_count ) === $this->review_count; 153 | } 154 | } 155 | 156 | $review_notice = new WPR_Review_Notice(); 157 | $review_notice->init(); 158 | -------------------------------------------------------------------------------- /admin/demo-importer.php: -------------------------------------------------------------------------------- 1 | import( $file ); 22 | } 23 | 24 | /** 25 | * Prints demo importer popup. 26 | */ 27 | function wp_review_print_demo_importer_popup() { 28 | ?> 29 |
30 |
31 |
32 |

33 |
34 |
35 |
36 | 40 |
41 |
42 | import( $file ); 26 | remove_filter( 'wp_import_post_data_processed', array( $this, 'filter_post_data' ) ); 27 | } 28 | 29 | /** 30 | * Filters post data before inserting. 31 | * 32 | * @param array $post_data Post data. 33 | * @return array 34 | */ 35 | public function filter_post_data( $post_data ) { 36 | if ( 'attachment' !== $post_data['post_type'] ) { 37 | $post_data['post_status'] = 'draft'; 38 | } 39 | return $post_data; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /admin/options/facebook.php: -------------------------------------------------------------------------------- 1 | 9 |
10 | ' . esc_html__( 'Click here', 'wp-review' ) . '' 15 | ); 16 | ?> 17 |
18 | 19 |
20 |
21 | 22 | 23 |
24 | 25 |
26 | 27 | 28 | 29 |
30 |
31 | 32 |
33 |
34 | 35 | 36 |
37 | 38 |
39 | 40 | 41 | 42 |
43 |
44 | 45 |

46 | -------------------------------------------------------------------------------- /admin/options/google.php: -------------------------------------------------------------------------------- 1 | 9 |
10 |
11 | 12 | 13 |
14 | 15 |
16 | 17 | 18 | 19 |
20 | 21 | 22 | ' . esc_html__( 'Click here', 'wp-review' ) . '' 27 | ); 28 | ?> 29 | 30 |
31 | -------------------------------------------------------------------------------- /admin/options/hello-bar.php: -------------------------------------------------------------------------------- 1 | 9 |
10 | 14 | 15 |
16 |

17 | 18 |
19 |
20 | 21 | 22 |
23 | 24 |
25 | render_switch( 27 | array( 28 | 'id' => 'wp_review_hello_bar_enable', 29 | 'name' => 'wp_review_hello_bar[enable]', 30 | 'disabled' => true, 31 | ) 32 | ); 33 | ?> 34 |
35 |
36 | 37 |
38 | 39 |
40 |
41 | 42 | 43 |
44 |
45 | 46 | 47 | 48 |
49 |
50 | 51 |
52 |
53 | 54 | 55 |
56 |
57 | 58 | 59 | 60 |
61 |
62 | 63 |
64 |
65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 |
73 |
74 | 75 |
76 |
77 | 78 | 79 |
80 |
81 | 82 | 83 | 84 |
85 |
86 | 87 |
88 |
89 | 90 | 91 |
92 |
93 | 94 | 95 | 96 |
97 |
98 | 99 |
100 |
101 | 102 | 103 |
104 |
105 | render_switch( 107 | array( 108 | 'id' => 'wp_review_hello_bar_target_blank', 109 | 'name' => 'wp_review_hello_bar[target_blank]', 110 | 'disabled' => true, 111 | ) 112 | ); 113 | ?> 114 |
115 |
116 |
117 |
118 | 119 | 231 |
232 | -------------------------------------------------------------------------------- /admin/options/help.php: -------------------------------------------------------------------------------- 1 | 9 |

10 | 11 |

12 |

13 | FREE​: ', 'wp-review' ); ?> 14 | https://mythemeshop.com/#signup 15 |

16 |

17 | 18 | https://mythemeshop.com/wordpress-101/ 19 | 20 |

21 |

22 | 23 |

24 | 25 |

26 | 27 |

28 | -------------------------------------------------------------------------------- /admin/options/import.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
12 | 13 |
14 | 15 |
16 | 17 |

18 |
19 |
20 | 21 |
22 |
23 | 24 |
25 | 26 |
27 | 36 | 37 | 38 | 'disabled' ) ); ?> 39 | 40 | 41 |

42 | %1$s: %2$s ', 45 | esc_html__( 'Warning', 'wp-review' ), 46 | esc_html__( 'This action is IRREVERSIBLE! Take a backup of your database before proceeding.', 'wp-review' ) 47 | ); 48 | ?> 49 |

50 | 51 | 52 |
53 |
54 | 55 |
56 |
57 | 58 |
59 | 60 |
61 | 62 |
63 |

64 |

65 |

66 |
67 |
68 |
69 | 70 |
71 |
72 | 73 |
74 | 75 |
76 | 77 |

78 |
79 |
80 | -------------------------------------------------------------------------------- /admin/options/multisite.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
12 | 13 |
14 | 15 |
16 | 32 |
33 |
34 | 35 | blog_id ) ) { 38 | $hide_options = wp_review_option( 'hide_global_options_' . $site->blog_id ); 39 | $hide_role_manager = wp_review_option( 'hide_role_manager_' . $site->blog_id ); 40 | $hide_import = wp_review_option( 'hide_import_' . $site->blog_id ); 41 | ?> 42 |
43 |

44 |
45 |
46 | 47 |
48 | 49 |
50 | render_switch( 52 | array( 53 | 'id' => 'wp_review_show_global_options_' . $site->blog_id, 54 | 'name' => 'wp_review_options[hide_global_options_' . $site->blog_id . ']', 55 | 'value' => ! empty( $hide_options ), 56 | ) 57 | ); 58 | ?> 59 |
60 |
61 | 62 |
> 63 | 64 |
65 |
66 | 67 | 68 |
69 | 70 |
71 | render_switch( 73 | array( 74 | 'id' => 'wp_review_hide_general_popup_' . $site->blog_id, 75 | 'name' => 'wp_review_options[hide_general_popup_' . $site->blog_id . ']', 76 | 'disabled' => true, 77 | ) 78 | ); 79 | ?> 80 |
81 |
82 | 83 |
84 |
85 | 86 | 87 |
88 | 89 |
90 | render_switch( 92 | array( 93 | 'id' => 'wp_review_hide_general_bar_' . $site->blog_id, 94 | 'name' => 'wp_review_options[hide_general_bar_' . $site->blog_id . ']', 95 | 'disabled' => true, 96 | ) 97 | ); 98 | ?> 99 |
100 |
101 | 102 |
103 |
104 | 105 | 106 |
107 | 108 |
109 | render_switch( 111 | array( 112 | 'id' => 'wp_review_hide_yelp_reviews_' . $site->blog_id, 113 | 'name' => 'wp_review_options[hide_yelp_reviews_' . $site->blog_id . ']', 114 | 'disabled' => true, 115 | ) 116 | ); 117 | ?> 118 |
119 |
120 | 121 |
122 |
123 | 124 | 125 |
126 | 127 |
128 | render_switch( 130 | array( 131 | 'id' => 'wp_review_hide_facebook_reviews_' . $site->blog_id, 132 | 'name' => 'wp_review_options[hide_facebook_reviews_' . $site->blog_id . ']', 133 | 'disabled' => true, 134 | ) 135 | ); 136 | ?> 137 |
138 |
139 | 140 |
141 |
142 | 143 | 144 |
145 | 146 |
147 | render_switch( 149 | array( 150 | 'id' => 'wp_review_hide_google_reviews_' . $site->blog_id, 151 | 'name' => 'wp_review_options[hide_google_reviews_' . $site->blog_id . ']', 152 | 'disabled' => true, 153 | ) 154 | ); 155 | ?> 156 |
157 |
158 | 159 |
160 |
161 | 162 |
163 | 164 |
165 | render_switch( 167 | array( 168 | 'id' => 'wp_review_hide_role_manager_' . $site->blog_id, 169 | 'name' => 'wp_review_options[hide_role_manager_' . $site->blog_id . ']', 170 | 'value' => ! empty( $hide_role_manager ), 171 | ) 172 | ); 173 | ?> 174 |
175 |
176 | 177 |
178 |
179 | 180 |
181 | 182 |
183 | render_switch( 185 | array( 186 | 'id' => 'wp_review_hide_import_' . $site->blog_id, 187 | 'name' => 'wp_review_options[hide_import_' . $site->blog_id . ']', 188 | 'value' => ! empty( $hide_import ), 189 | ) 190 | ); 191 | ?> 192 |
193 |
194 | 195 |
196 |
197 |

198 | blog_id ); 200 | 201 | $hide_review_links = wp_review_option( 'hide_review_links_' . $site->blog_id ); 202 | $hide_user_reviews = wp_review_option( 'hide_user_reviews_' . $site->blog_id ); 203 | ?> 204 |
205 |
206 |
207 | 208 |
209 | 210 |
211 | render_switch( 213 | array( 214 | 'id' => 'wp_review_hide_ratings_in_posts_' . $site->blog_id, 215 | 'name' => 'wp_review_options[hide_ratings_in_posts_' . $site->blog_id . ']', 216 | 'value' => ! empty( $hide_in_posts ), 217 | ) 218 | ); 219 | ?> 220 |
221 |
222 |
223 | 224 | 225 |
> 226 | 227 |
228 |
229 | 230 | 231 |
232 | 233 |
234 | render_switch( 236 | array( 237 | 'id' => 'wp_review_hide_popup_box__' . $site->blog_id, 238 | 'name' => 'wp_review_options[hide_popup_box_' . $site->blog_id . ']', 239 | 'disabled' => true, 240 | ) 241 | ); 242 | ?> 243 |
244 |
245 | 246 |
247 |
248 | 249 | 250 |
251 | 252 |
253 | render_switch( 255 | array( 256 | 'id' => 'wp_review_hide_notification_bar__' . $site->blog_id, 257 | 'name' => 'wp_review_options[hide_notification_bar_' . $site->blog_id . ']', 258 | 'disabled' => true, 259 | ) 260 | ); 261 | ?> 262 |
263 |
264 | 265 |
266 |
267 | 268 | 269 |
270 | 271 |
272 | render_switch( 274 | array( 275 | 'id' => 'wp_review_hide_features__' . $site->blog_id, 276 | 'name' => 'wp_review_options[hide_features_' . $site->blog_id . ']', 277 | 'disabled' => true, 278 | ) 279 | ); 280 | ?> 281 |
282 |
283 | 284 |
285 |
286 | 287 |
288 | 289 |
290 | render_switch( 292 | array( 293 | 'id' => 'wp_review_hide_review_links__' . $site->blog_id, 294 | 'name' => 'wp_review_options[hide_review_links_' . $site->blog_id . ']', 295 | 'value' => ! empty( $hide_review_links ), 296 | ) 297 | ); 298 | ?> 299 |
300 |
301 | 302 |
303 |
304 | 305 | 306 |
307 | 308 |
309 | render_switch( 311 | array( 312 | 'id' => 'wp_review_hide_review_description__' . $site->blog_id, 313 | 'name' => 'wp_review_options[hide_review_description_' . $site->blog_id . ']', 314 | 'disabled' => true, 315 | ) 316 | ); 317 | ?> 318 |
319 |
320 | 321 |
322 |
323 | 324 |
325 | 326 |
327 | render_switch( 329 | array( 330 | 'id' => 'wp_review_hide_user_reviews__' . $site->blog_id, 331 | 'name' => 'wp_review_options[hide_user_reviews_' . $site->blog_id . ']', 332 | 'value' => ! empty( $hide_user_reviews ), 333 | ) 334 | ); 335 | ?> 336 |
337 |
338 | 339 |
340 | 341 |
342 | 345 | -------------------------------------------------------------------------------- /admin/options/popup.php: -------------------------------------------------------------------------------- 1 | 9 |
10 |
11 | 12 | 13 |
14 | 15 |
16 | render_switch( 18 | array( 19 | 'id' => 'wp_review_popup_enable', 20 | 'name' => 'wp_review_popup[enable]', 21 | 'disabled' => true, 22 | ) 23 | ); 24 | ?> 25 |
26 |
27 | 28 |
29 | 30 |
31 |
32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 |
41 |
42 | 43 |
44 |
45 | 46 | 47 |
48 | 49 |
50 | 51 | 57 | 58 |
59 |
60 | 61 |
62 |
63 | 64 | 65 |
66 | 67 |
68 | 69 | 76 | 77 |
78 |
79 | 80 |
81 |
82 | 83 | 84 |
85 | 86 |
87 | 88 | 89 | 90 |
91 |
92 | 93 |
94 |
95 | 96 | (0.1 - 1) 97 | 98 |
99 | 100 |
101 | 102 | 103 | 104 |
105 |
106 | 107 | true ) ); ?> 108 |
109 |
110 | 111 | 112 |
113 | 114 |
115 | 116 | 122 | 123 |
124 |
125 | 126 |
127 |
128 | 129 | 130 |
131 | 132 |
133 | 134 | 140 | 141 |
142 |
143 | 144 |
145 |
146 | 147 | 148 |
149 | 150 |
151 | 152 | esc_html__( 'All categories', 'wp-review' ), 156 | 'orderby' => 'name', 157 | 'hide_empty' => false, 158 | 'name' => 'wp_review_popup[category]', 159 | 'id' => 'wp_review_popup_category', 160 | ) 161 | ); 162 | ?> 163 | 164 |
165 |
166 | 167 |
168 |
169 | 170 | 171 |
172 | 173 |
174 | 175 | 176 | 177 |
178 |
179 | 180 |
181 |
182 | 183 | 184 |
185 | 186 |
187 | 188 | 194 | 195 |
196 |
197 |
198 | 199 |
200 |
201 | 202 | 203 |
204 | 205 |
206 | 207 | 208 | 209 | 210 |
211 | 212 |
213 |
214 | 215 |
216 | 217 | 227 | 228 | 229 | 230 | 231 |

232 |
233 | 234 |
235 | 236 | 241 | 242 |
243 | 244 |
245 | 246 | 251 | 252 |
253 | 254 |
255 | 256 | 267 | 268 |
269 | 270 |
271 | 272 |
273 | 274 |
275 | -------------------------------------------------------------------------------- /admin/options/role-manager.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 | 12 | $role ) { 15 | $role_caps = $role['capabilities']; 16 | ?> 17 |
18 |
19 | 20 | 21 |
22 | 23 |
24 |
25 | $capability ) { 27 | $checked = isset( $role_caps[ $cap ] ) ? 'checked="checked"' : ''; 28 | ?> 29 |
30 | 31 | 35 | 36 |
37 | 38 |
39 |
40 |
41 | 42 |
43 | -------------------------------------------------------------------------------- /admin/options/yelp.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 |
21 | 22 | 23 | ' . esc_html__( 'Click here', 'wp-review' ) . '' 28 | ); 29 | ?> 30 | 31 |
32 | -------------------------------------------------------------------------------- /admin/review-options-meta-box.php: -------------------------------------------------------------------------------- 1 | ID, 'wp_review_type', true ); 23 | if ( '' === $type_post_value ) { 24 | // Default value when create post. 25 | $type_post_value = wp_review_option( 'review_type', 'none' ); 26 | } 27 | $type = $type_post_value; 28 | 29 | $schema = wp_review_get_review_schema( $post->ID ); 30 | $schema_data = get_post_meta( $post->ID, 'wp_review_schema_options', true ); 31 | 32 | $heading = get_post_meta( $post->ID, 'wp_review_heading', true ); 33 | // $available_types = apply_filters('wp_review_metabox_types', wp_review_get_review_types() ); 34 | $available_types = wp_review_get_rating_types(); 35 | $schemas = wp_review_schema_types(); 36 | 37 | $rating_schema = wp_review_get_rating_schema( $post->ID ); 38 | $custom_author = get_post_meta( $post->ID, 'wp_review_custom_author', true ); 39 | $author = get_post_meta( $post->ID, 'wp_review_author', true ); 40 | 41 | $form_field = new WP_Review_Form_Field(); 42 | ?> 43 | 44 |
45 | 54 | 55 |
56 |
57 |
58 | 59 |
60 | 61 |
62 | 79 | 80 | 81 | 82 | ' . intval( $post->ID ) . '' ); 85 | ?> 86 | 87 |
88 |
89 | 90 |
91 |
92 | 93 |
94 | 95 |
96 | 97 |
98 |
99 | 100 |
101 | 102 |
103 |
104 | 105 |
106 | 107 |
108 | 113 |
114 |
115 | 116 | 177 |
178 | 179 |
180 |
181 | 182 | 183 |
184 | 185 |
186 | render_switch( 188 | array( 189 | 'id' => 'wp_review_show_schema_data', 190 | 'name' => 'wp_review_show_schema_data', 191 | 'disabled' => true, 192 | ) 193 | ); 194 | ?> 195 |
196 |
197 | 198 |
199 |
200 |
201 | 202 | 203 |
204 | 205 |
206 | render_switch( 208 | array( 209 | 'id' => 'wp_review_enable_embed', 210 | 'name' => 'wp_review_enable_embed', 211 | 'disabled' => true, 212 | ) 213 | ); 214 | ?> 215 |
216 |
217 |
218 |
219 | 220 | 221 | 239 | 240 | 241 | 242 | 260 | 261 |
262 | 33 | 34 | 37 | 38 | 39 |
40 | 41 | 42 | 43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | 56 | 57 | 85 | 86 | 87 | 88 | 94 |
95 | 96 | true, 99 | 'class' => 'review-total', 100 | ) ); 101 | endif; ?> 102 |
103 | 104 | 105 | 106 |
107 |

108 | 109 |
110 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 119 | 125 | 126 | ( ) 127 | 128 |
129 |
130 | 131 | 132 | 133 |
134 | 135 | 140 | 188 | tag). 200 | * @param int $post_id Current post ID. 201 | * @param array $colors Color data. 202 | */ 203 | $color_output = apply_filters( 'wp_review_box_template_default_style', $color_output, $review['post_id'], $colors ); 204 | 205 | echo $color_output; 206 | 207 | // Schema json-dl. 208 | echo wp_review_get_schema( $review ); 209 | // phpcs:enable 210 | -------------------------------------------------------------------------------- /box-templates/global/partials/review-links.php: -------------------------------------------------------------------------------- 1 | 15 | 35 | -------------------------------------------------------------------------------- /box-templates/global/partials/review-schema.php: -------------------------------------------------------------------------------- 1 | 21 |
22 | 23 | $data ) { 25 | if ( ! empty( $data['omit'] ) || empty( $schema_data[ $data['name'] ] ) ) { 26 | continue; 27 | } 28 | 29 | if ( ! empty( $data['multiline'] ) ) { 30 | $reviewed_item_data .= '

' . $data['label'] . ': ' . preg_replace( '/\r\n|[\r\n]/', ', ', $schema_data[ $data['name'] ] ) . '

'; 31 | continue; 32 | } 33 | 34 | if ( 'image' === $data['name'] && ! isset( $data['part_of'] ) ) { 35 | 36 | if ( ! empty( $schema_data['image']['id'] ) ) { 37 | $image = wp_get_attachment_image( $schema_data['image']['id'], apply_filters( 'wp_review_item_reviewed_image_size', 'medium' ) ); 38 | } 39 | continue; 40 | } 41 | 42 | if ( 'image' === $data['type'] ) { 43 | $reviewed_item_data .= '

' . $data['label'] . ': ' . wp_get_attachment_image( $schema_data[ $data['name'] ]['id'] ) . '

'; 44 | continue; 45 | } 46 | 47 | if ( 'url' === $data['name'] && ! isset( $data['part_of'] ) ) { 48 | if ( ! empty( $schema_data['url'] ) ) { 49 | $more_text = ! empty( $schema_data['more_text'] ) ? $schema_data['more_text'] : __( '[ More ]', 'wp-review' ); 50 | $link = '' . esc_html( $more_text ) . ''; 51 | if ( ! empty( $schema_data['use_button_style'] ) ) { 52 | $url = ''; 53 | } else { 54 | $url = '

' . $link . '

'; 55 | } 56 | } 57 | continue; 58 | } 59 | 60 | $reviewed_item_data .= '

' . $data['label'] . ': ' . $schema_data[ $data['name'] ] . '

'; 61 | } 62 | if ( ! empty( $image ) ) { 63 | echo '
' . $image . '
'; 64 | } 65 | if ( ! empty( $reviewed_item_data ) ) { 66 | echo '
' . $reviewed_item_data . $url . '
'; 67 | } 68 | ?> 69 |
70 | -------------------------------------------------------------------------------- /comments/comments.php: -------------------------------------------------------------------------------- 1 | 16 |

17 | 21 | 22 | 23 |
24 |

25 | 43 |

44 | 45 |
    46 | 1 && get_option( 'page_comments' ) ) { // Are there comments to navigate through. 48 | ?> 49 | 53 | 1 && get_option( 'page_comments' ) ) { // Are there comments to navigate through. 59 | ?> 60 | 64 | 65 |
66 |
67 | 68 | 69 | 70 |
71 |
72 | '

' . __( 'Leave a Reply', 'wp-review' ) . '

', 76 | 'comment_notes_before' => '', 77 | 'comment_notes_after' => '', 78 | 'label_submit' => __( 'Post Comment', 'wp-review' ), 79 | 'comment_field' => '

', 80 | 'fields' => apply_filters( 81 | 'comment_form_default_fields', 82 | array( 83 | 'author' => '

' . ( $req ? '' : '' ) . '

', 84 | 'email' => '', 85 | 'url' => '

', 86 | 'cookies' => '', 87 | ) 88 | ), 89 | ); 90 | comment_form( $comments_args ); 91 | ?> 92 |
93 |
94 | 95 | -------------------------------------------------------------------------------- /includes/ajax.php: -------------------------------------------------------------------------------- 1 | 0 && 56 | ! wp_review_has_reviewed( $post_id, $user_id, $uip, WP_REVIEW_COMMENT_TYPE_VISITOR ) && 57 | ( is_user_logged_in() || ! wp_review_option( 'registered_only' ) ) 58 | ) { 59 | $insert = wp_insert_comment( 60 | array( 61 | 'user_id' => $user_id, 62 | 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR, 63 | 'comment_post_ID' => $post_id, 64 | 'comment_parent' => 0, 65 | 'comment_author_IP' => $uip, 66 | // translators: review text. 67 | 'comment_content' => sprintf( __( 'Visitor Rating: %s', 'wp-review' ), $review_text ), 68 | 'comment_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '', 69 | 'comment_date' => current_time( 'mysql' ), 70 | 'comment_date_gmt' => current_time( 'mysql', 1 ), 71 | 'comment_approved' => 1, 72 | ) 73 | ); 74 | 75 | if ( $insert ) { 76 | if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review ) ) { 77 | $post_reviews = mts_get_post_reviews( $post_id, true ); 78 | 79 | echo $post_reviews['rating'] . '|' . $post_reviews['count']; 80 | exit; 81 | } else { 82 | wp_delete_comment( $insert ); 83 | } 84 | } 85 | } 86 | 87 | echo 'MTS_REVIEW_DB_ERROR'; 88 | exit; 89 | } 90 | 91 | 92 | /** 93 | * AJAX User review rating 94 | * Replaces mts_review_get_review(). 95 | */ 96 | function wp_review_ajax_rate() { 97 | check_ajax_referer( 'wp-review-security', 'nonce' ); 98 | $post_id = intval( $_POST['post_id'] ); 99 | $review = filter_input( INPUT_POST, 'review' ); 100 | $review = round( $review, 2 ); 101 | $review_data = array( 102 | 'total' => $review, 103 | ); 104 | wp_review_visitor_rate( $post_id, $review_data ); 105 | exit; 106 | } 107 | 108 | 109 | /** 110 | * Migrates ratings. 111 | */ 112 | function wp_review_ajax_migrate_ratings() { 113 | if ( ! current_user_can( 'manage_options' ) ) { 114 | return; 115 | } 116 | 117 | if ( get_option( 'wp_review_has_migrated', false ) ) { 118 | return; 119 | } 120 | 121 | global $wpdb; 122 | 123 | $start = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : 0; 124 | $limit = 100; 125 | $current_blog_id = get_current_blog_id(); 126 | 127 | $query = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->base_prefix . 'mts_wp_reviews WHERE blog_id = ' . $current_blog_id . ' LIMIT ' . $limit . ' OFFSET ' . $start ); // WPCS: unprepared SQL ok. 128 | 129 | foreach ( $query as $review ) { 130 | 131 | if ( 0 == $review->rate ) { 132 | continue; // Skip 0-star ratings. 133 | } 134 | 135 | $insert = wp_insert_comment( 136 | array( 137 | 'user_id' => $review->user_id, 138 | 'comment_type' => WP_REVIEW_COMMENT_TYPE_VISITOR, 139 | 'comment_post_ID' => $review->post_id, 140 | 'comment_parent' => 0, 141 | 'comment_content' => sprintf( 142 | // translators: visitors rating. 143 | __( 'Visitor Rating: %s', 'wp-review' ), 144 | sprintf( 145 | // translators: review rate. 146 | __( '%s Stars', 'wp-review' ), 147 | $review->rate 148 | ) 149 | ), 150 | 'comment_author_IP' => $review->user_ip, 151 | 'comment_date' => gmdate( 'Y-m-d H:i:s', ( strtotime( $review->date ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ), 152 | 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime( $review->date ) ), 153 | 'comment_approved' => 1, 154 | ) 155 | ); 156 | 157 | if ( $insert ) { 158 | if ( update_comment_meta( $insert, WP_REVIEW_VISITOR_RATING_METAKEY, $review->rate ) ) { 159 | // Purge cache. 160 | mts_get_post_reviews( $review->post_id, true ); 161 | } else { 162 | wp_delete_comment( $insert ); 163 | } 164 | } 165 | } 166 | 167 | $end = $start + count( $query ); // $wpdb->num_rows; 168 | // $migrated_rows = get_option( 'wp_review_migrated_rows', 0 ); 169 | update_option( 'wp_review_migrated_rows', $end ); 170 | 171 | $total_rows = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . $wpdb->base_prefix . 'mts_wp_reviews WHERE blog_id = ' . $current_blog_id ); // WPCS: unprepared SQL ok. 172 | $migration_finished = 0; 173 | if ( $total_rows == $end ) { 174 | update_option( 'wp_review_has_migrated', 1 ); 175 | $migration_finished = 1; 176 | } 177 | 178 | echo wp_json_encode( 179 | array( 180 | 'start' => $start, 181 | 'lastrow' => $end, 182 | 'rowsleft' => $total_rows - $end, 183 | 'finished' => $migration_finished, 184 | ) 185 | ); 186 | 187 | die(); 188 | } 189 | 190 | 191 | /** 192 | * Ajax handle for loading reviews. 193 | */ 194 | function wp_review_ajax_load_reviews() { 195 | $options = $_POST; // WPCS: csrf ok. 196 | 197 | // Options are same as widgets args to keep compatibility. 198 | $options = wp_parse_args( 199 | $options, 200 | array( 201 | 'post_num' => 5, 202 | 'page' => 1, 203 | 'review_type' => '', 204 | 'thumb_size' => 'small', 205 | 'cat' => '', 206 | 'number_of_days' => '', 207 | ) 208 | ); 209 | 210 | $type = ! empty( $options['_type'] ) ? $options['_type'] : 'recent'; 211 | 212 | $query = wp_review_get_reviews_query( $type, $options ); 213 | 214 | if ( ! $query->have_posts() ) { 215 | wp_send_json_success( '' ); 216 | } 217 | 218 | $page = ! empty( $options['page'] ) ? intval( $options['page'] ) : 1; 219 | $last_page = $query->max_num_pages; 220 | $in_widget = ! empty( $options['widget_id'] ); 221 | $GLOBALS['in_widget'] = $in_widget; 222 | 223 | ob_start(); 224 | echo '