Version Description
- Feature: Set recipe author
- Improvement: Sanitize metadata before outputting
- Fix: Warning when adding comments as a subscriber
- Fix: Compatibility issue with Jetpack
- Fix: Prevent infinite shortcode loop
Download this release
Release Info
Developer | BrechtVds |
Plugin | WP Recipe Maker |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.5.0
- assets/css/admin/addons.min.css +1 -0
- assets/css/admin/addons.scss +26 -0
- assets/css/admin/comments.min.css +1 -1
- assets/css/admin/faq.min.css +1 -1
- assets/css/admin/import.min.css +1 -1
- assets/css/admin/modal.min.css +1 -1
- assets/css/admin/modal.scss +1 -0
- assets/css/admin/modal/_container.scss +1 -0
- assets/css/admin/modal/_form.scss +60 -0
- assets/css/admin/modal/_recipe-details.scss +3 -54
- assets/css/admin/settings.min.css +1 -1
- assets/css/public/public.min.css +1 -1
- assets/icons/chef-hat.svg +5 -0
- assets/icons/close.svg +5 -0
- assets/icons/pause.svg +4 -0
- assets/icons/play.svg +4 -0
- assets/js/admin/recipe-form.js +34 -19
- assets/js/admin/recipe-snippets.js +0 -2
- assets/js/admin/rich-editor.js +93 -0
- assets/js/public/print.js +6 -3
- includes/admin/class-wprm-import-manager.php +1 -1
- includes/admin/class-wprm-recipe-sanitizer.php +29 -1
- includes/admin/class-wprm-recipe-saver.php +2 -0
- includes/admin/import/class-wprm-import-easyrecipe.php +9 -0
- includes/admin/menu/class-wprm-admin-menu-addons.php +60 -0
- includes/admin/menu/class-wprm-admin-menu-faq.php +1 -1
- includes/admin/modal/class-wprm-modal.php +7 -2
- includes/class-wp-recipe-maker.php +15 -11
- includes/public/class-wprm-addons.php +41 -0
- includes/public/class-wprm-api.php +7 -5
- includes/public/class-wprm-comment-rating.php +14 -10
- includes/public/class-wprm-fallback-recipe.php +2 -1
- includes/public/class-wprm-metadata.php +67 -7
- includes/public/class-wprm-print.php +9 -1
- includes/public/class-wprm-recipe.php +51 -1
- includes/public/class-wprm-settings.php +45 -6
- includes/public/class-wprm-shortcode.php +72 -0
- includes/public/class-wprm-template-helper.php +43 -0
- includes/public/class-wprm-template-manager.php +3 -0
- readme.txt +13 -9
- templates/admin/menu/addons.php +31 -0
- templates/admin/menu/faq/welcome.php +0 -1
- templates/admin/menu/faq/whats_new.php +9 -0
- templates/admin/modal/shortcode-preview.php +1 -1
- templates/admin/modal/tabs/recipe-details.php +24 -11
- templates/admin/modal/tabs/recipe-notes.php +2 -2
- templates/admin/settings.php +39 -0
- templates/admin/settings/appearance.php +84 -0
- templates/admin/settings/settings.php +0 -87
- templates/recipe/clean-print-with-image/clean-print-with-image.min.css +1 -1
- templates/recipe/clean-print-with-image/clean-print-with-image.php +6 -3
- templates/recipe/clean-print/clean-print.min.css +1 -1
- templates/recipe/clean-print/clean-print.php +6 -3
- templates/recipe/simple/simple.min.css +1 -1
- templates/recipe/simple/simple.php +7 -4
- templates/recipe/tastefully-simple/tastefully-simple.min.css +1 -1
- templates/recipe/tastefully-simple/tastefully-simple.php +7 -4
- vendor/rangy/rangy-core.js +11 -0
- wp-recipe-maker.php +2 -2
assets/css/admin/addons.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.wprm-addons p{max-width:650px}.wprm-addons ul{list-style-type:square}.wprm-addons .wprm-drip-form{margin:20px 0}.wprm-addons .wprm-drip-form input{width:100%;max-width:400px;margin:10px 0}.wprm-addons .wprm-drip-form input[type=submit]{max-width:250px;margin-bottom:0}.wprm-addons .wprm-drip-form .wprm-disclaimer{font-size:.8em}
|
assets/css/admin/addons.scss
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wprm-addons {
|
2 |
+
p {
|
3 |
+
max-width: 650px;
|
4 |
+
}
|
5 |
+
|
6 |
+
ul {
|
7 |
+
list-style-type: square;
|
8 |
+
}
|
9 |
+
|
10 |
+
.wprm-drip-form {
|
11 |
+
margin: 20px 0;
|
12 |
+
input {
|
13 |
+
width: 100%;
|
14 |
+
max-width: 400px;
|
15 |
+
margin: 10px 0;
|
16 |
+
|
17 |
+
&[type=submit] {
|
18 |
+
max-width: 250px;
|
19 |
+
margin-bottom: 0;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
.wprm-disclaimer {
|
23 |
+
font-size: 0.8em;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
assets/css/admin/comments.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.comment-form-wprm-rating label{display:none}.comment-form-wprm-rating .wprm-rating-star{cursor:pointer}.comment-form-wprm-rating .wprm-rating-star svg{vertical-align:middle;width:16px;height:16px;margin:0}.comment-form-wprm-rating .wprm-rating-star.rated svg polygon{fill
|
1 |
+
.comment-form-wprm-rating label{display:none}.comment-form-wprm-rating .wprm-rating-star{cursor:pointer}.comment-form-wprm-rating .wprm-rating-star svg{vertical-align:middle;width:16px;height:16px;margin:0}.comment-form-wprm-rating .wprm-rating-star.rated svg polygon{fill:#000}
|
assets/css/admin/faq.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-faq p{max-width:650px}.wprm-faq ul{list-style-type:square}.wprm-faq .wprm-drip-form{margin:20px 0}.wprm-faq .wprm-drip-form input{width:100%;max-width:400px;margin:10px 0}.wprm-faq .wprm-drip-form input[type=submit]{max-width:250px;margin-bottom:0}.wprm-faq .wprm-drip-form .wprm-disclaimer{font-size
|
1 |
+
.wprm-faq p{max-width:650px}.wprm-faq ul{list-style-type:square}.wprm-faq .wprm-drip-form{margin:20px 0}.wprm-faq .wprm-drip-form input{width:100%;max-width:400px;margin:10px 0}.wprm-faq .wprm-drip-form input[type=submit]{max-width:250px;margin-bottom:0}.wprm-faq .wprm-drip-form .wprm-disclaimer{font-size:.8em}.wprm-badge{background:url(../../images/icon-128x128.png) center 20px no-repeat #fff;-webkit-background-size:128px 128px;background-size:128px 128px;color:#333;font-size:14px;text-align:center;font-weight:600;margin:5px 0 0;padding-top:155px;height:25px;display:inline-block;width:150px;text-rendering:optimizeLegibility;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.2);box-shadow:0 1px 3px rgba(0,0,0,.2)}.about-wrap .wprm-badge{position:absolute;top:0;right:0}@media only screen and (max-width:500px){.about-wrap .wprm-badge{position:relative;margin-bottom:1.5em;width:100%}}
|
assets/css/admin/import.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-import p{max-width:600px}.wprm-import .wprm-import-error{max-width:600px;border:1px solid
|
1 |
+
.wprm-import p{max-width:600px}.wprm-import .wprm-import-error{max-width:600px;border:1px solid #8b0000;background-color:#ff9f9f;padding:10px}.wprm-import .wprm-import-recipes{width:100%}.wprm-import .wprm-import-recipes td:nth-child(1){width:2%}
|
assets/css/admin/modal.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.select2_wprm-container{z-index:100075}.select2_wprm-container.select2_wprm-container--focus .select2_wprm-selection{border-color:#5b9dd9}.select2_wprm-container li{margin:0}.select2_wprm-container .select2_wprm-selection{border-color:#ddd}.medium-editor-toolbar{z-index:100080}.medium-editor-element{border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.07);box-shadow:inset 0 1px 2px rgba(0,0,0,0.07);min-height:68px;padding:3px 5px}.medium-editor-element:focus{border-color:#5b9dd9;-webkit-box-shadow:0 0 2px rgba(30,140,190,0.8);box-shadow:0 0 2px rgba(30,140,190,0.8)}.medium-editor-element:after{font-style:normal;color:#999;opacity:0.5;font-size:14px;line-height:28px}.medium-editor-element p:first-child{margin-top:0}.medium-editor-element p:last-child{margin-bottom:0}.wprm-modal-hint{max-width:400px}.wprm-modal-hint .wprm-modal-hint-header{font-weight:bold;font-variant:small-caps}.wprm-modal-hint .wprm-modal-hint-text{font-style:italic}.wprm-modal-container{display:none}.wprm-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:0.7;z-index:100000}.wprm-modal{position:fixed;top:30px;left:30px;right:30px;bottom:30px;z-index:100050}.wprm-modal *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wprm-modal-close{position:absolute;top:0;right:0;width:50px;height:50px;padding:0;z-index:1000;-webkit-transition:color 0.1s ease-in-out,background 0.1s ease-in-out;transition:color 0.1s ease-in-out,background 0.1s ease-in-out}.wprm-modal-close .wprm-modal-icon:before{content:"\f158";font:400 20px/1 dashicons;speak:none;vertical-align:middle;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#666}.wprm-modal-content{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto;min-height:300px;-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.7);box-shadow:0 5px 15px rgba(0,0,0,0.7);background:#fcfcfc;-webkit-font-smoothing:subpixel-antialiased}.wprm-modal-content ::-webkit-input-placeholder{color:#999;opacity:0.5}.wprm-modal-content :-moz-placeholder{color:#999;opacity:0.5}.wprm-modal-content ::-moz-placeholder{color:#999;opacity:0.5}.wprm-modal-content :-ms-input-placeholder{color:#999;opacity:0.5}.wprm-frame{overflow:hidden;right:0}.wprm-frame,.wprm-frame-menu{position:absolute;left:0;bottom:0;top:0}.wprm-frame-menu{width:200px;z-index:150}.wprm-frame-title .dashicons,.wprm-frame.hide-router .wprm-frame-router{display:none}.wprm-frame-title{top:0;height:50px}.wprm-frame-router,.wprm-frame-title{z-index:200;left:200px;position:absolute;right:0}.wprm-menu-item{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.wprm-menu{position:absolute;left:0;margin:0;padding:10px 0;border-right-width:1px;border-right-style:solid;border-right-color:#ccc;user-select:none}.wprm-menu,.wprm-sidebar{top:0;bottom:0;background:#f3f3f3;right:0}.wprm-menu .active,.wprm-menu .active:hover{color:#23282d;font-weight:700}.wprm-menu>a{display:block;position:relative;padding:8px 20px;margin:0;color:#0073aa}.wprm-menu>a,.wprm-router>a{line-height:18px;font-size:14px;text-decoration:none}.wprm-frame a{border-bottom:none;color:#0073aa}.wprm-frame .hidden{display:none}.wprm-menu .separator{height:0;margin:12px 20px;padding:0;border-top:1px solid #ddd}.wprm-frame-title h1{padding:0 16px;font-size:22px;line-height:50px;margin:0}.wprm-frame-router{top:50px;height:36px}.wprm-router{position:relative;padding:0 6px;margin:0;clear:both;user-select:none}.wprm-router:not(.active){display:none}.wprm-router>a{position:relative;float:left;padding:8px 10px 9px;margin:0;height:18px}.wprm-router a{-webkit-transition:none;transition:none}.wprm-router>a:last-child{border-right:0}.wprm-router .active,.wprm-router>a.active:last-child{margin:-1px -1px 0;background:#fff;border:1px solid #ddd;border-bottom:none}.wprm-router .active,.wprm-router .active:hover{color:#32373c}.wprm-frame-content{position:absolute;top:84px;left:200px;right:0;bottom:61px;height:auto;width:auto;margin:0;overflow:auto;background:#fff;border-top:1px solid #ddd;border-bottom:1px solid #ddd}.wprm-frame-content-tab{margin:20px}.wprm-frame-content-tab:not(.active){display:none}.wprm-frame-toolbar{position:absolute;left:200px;right:0;bottom:0;height:60px;z-index:100}.wprm-toolbar{position:absolute;top:0;left:0;right:0;z-index:100;height:60px;padding:0 16px;border:0 solid #ddd;overflow:hidden}.wprm-modal-content .wprm-toolbar-primary.search-form{width:33%}.wprm-toolbar-primary{float:right;height:100%}.wprm-modal-content .wprm-toolbar-primary .wprm-button{float:right}.wprm-toolbar-primary>.wprm-button,.wprm-toolbar-primary>.wprm-button-group{margin-left:10px;float:left;margin-top:15px}@media only screen and (max-width: 900px){.wprm-frame:not(.hide-menu) .wprm-frame-title .dashicons{display:inline-block;line-height:50px}.wprm-frame:not(.hide-menu) .wprm-frame-menu{position:static;width:0}.wprm-frame:not(.hide-menu) .wprm-frame-title{left:0}.wprm-frame:not(.hide-menu) .wprm-frame-content,.wprm-frame:not(.hide-menu) .wprm-frame-router,.wprm-frame:not(.hide-menu) .wprm-frame-title,.wprm-frame:not(.hide-menu) .wprm-frame-toolbar{left:0}.wprm-frame:not(.hide-menu) .wprm-menu.visible{left:0}.wprm-frame:not(.hide-menu) .wprm-menu{width:auto;max-width:80%;overflow:auto;z-index:2000;top:50px;left:-300px;right:auto;bottom:auto;padding:5px 0;border:1px solid #ccc}.wprm-frame:not(.hide-menu) .wprm-menu>a.active{display:none}.wprm-frame:not(.hide-menu) .wprm-menu>a{padding:12px 16px;font-size:16px}.wprm-frame:not(.hide-menu) .wprm-menu .separator{margin:5px 10px}.wprm-frame:not(.hide-menu) .wprm-frame-title h1{color:#0073aa;line-height:3;font-size:18px;float:left;cursor:pointer}}@media only screen and (max-width: 640px), screen and (max-height: 400px){.wprm-modal{position:fixed;top:0;left:0;right:0;bottom:0}.wprm-modal .wprm-frame-title{height:40px}}@media only screen and (max-width: 480px){.wprm-frame:not(.hide-menu) .wprm-frame-title .dashicons{line-height:40px}.wprm-frame-router,.wprm-frame:not(.hide-menu) .wprm-menu{top:40px}.wprm-frame:not(.hide-menu) .wprm-frame-title h1,.wprm-modal .wprm-frame-title h1{font-size:18px;line-height:40px}.wprm-frame-content{top:74px}}.wprm-recipe-details-form,.wprm-recipe-notes-form{max-width:600px}.wprm-recipe-details-form .wprm-recipe-details-form-container,.wprm-recipe-details-form .wprm-recipe-notes-form-container,.wprm-recipe-notes-form .wprm-recipe-details-form-container,.wprm-recipe-notes-form .wprm-recipe-notes-form-container{margin-bottom:15px;vertical-align:top}.wprm-recipe-details-form .wprm-recipe-details-form-container-halfs,.wprm-recipe-notes-form .wprm-recipe-details-form-container-halfs{display:inline-block;width:50%}.wprm-recipe-details-form .wprm-recipe-details-form-container-thirds,.wprm-recipe-notes-form .wprm-recipe-details-form-container-thirds{display:inline-block;width:33.3%}.wprm-recipe-details-form label,.wprm-recipe-notes-form label{display:block;font-weight:bold;margin-bottom:5px}.wprm-recipe-details-form input,.wprm-recipe-notes-form input{margin:0;width:100%;max-width:120px;height:34px;line-height:34px}.wprm-recipe-details-form input#wprm-recipe-name,.wprm-recipe-notes-form input#wprm-recipe-name{max-width:450px}.wprm-recipe-details-form input[type="number"],.wprm-recipe-notes-form input[type="number"]{max-width:50px}.wprm-recipe-details-form input#wprm-recipe-calories,.wprm-recipe-notes-form input#wprm-recipe-calories{max-width:70px}.wprm-recipe-details-form input.select2_wprm-search__field,.wprm-recipe-notes-form input.select2_wprm-search__field{height:18px;line-height:18px}.wprm-recipe-details-form select,.wprm-recipe-notes-form select{width:100%}.wprm-recipe-details-form textarea,.wprm-recipe-notes-form textarea{width:100%;resize:vertical}.wprm-recipe-details-form .wprm-recipe-image-preview,.wprm-recipe-notes-form .wprm-recipe-image-preview{float:right;max-width:100px}.wprm-recipe-details-form .wprm-recipe-image-preview img,.wprm-recipe-notes-form .wprm-recipe-image-preview img{max-width:100%;height:auto}.wprm-recipe-details-form .wprm-recipe-summary-container,.wprm-recipe-notes-form .wprm-recipe-summary-container{clear:both}@media only screen and (max-width: 480px){.wprm-recipe-details-form .wprm-recipe-details-form-container-halfs,.wprm-recipe-details-form .wprm-recipe-details-form-container-thirds{display:block;width:100%}.wprm-recipe-details-form .wprm-recipe-image-preview{float:none;margin:10px auto}}.wprm-recipe-ingredients-form,.wprm-recipe-instructions-form{max-width:750px;margin-bottom:15px}.wprm-recipe-ingredients-form input,.wprm-recipe-instructions-form input{margin:0;width:100%;height:34px;line-height:34px}.wprm-recipe-ingredients-form textarea,.wprm-recipe-instructions-form textarea{width:100%;resize:vertical}.wprm-recipe-ingredients-form ::-webkit-input-placeholder,.wprm-recipe-instructions-form ::-webkit-input-placeholder{color:#999;opacity:0.5}.wprm-recipe-ingredients-form :-moz-placeholder,.wprm-recipe-instructions-form :-moz-placeholder{color:#999;opacity:0.5}.wprm-recipe-ingredients-form ::-moz-placeholder,.wprm-recipe-instructions-form ::-moz-placeholder{color:#999;opacity:0.5}.wprm-recipe-ingredients-form :-ms-input-placeholder,.wprm-recipe-instructions-form :-ms-input-placeholder{color:#999;opacity:0.5}.wprm-recipe-ingredients-form table,.wprm-recipe-instructions-form table{width:100%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th,.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th{text-align:left}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(1),.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(6),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(1),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(6){width:5%;text-align:center}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(2),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(2){width:10%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(3),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(3){width:15%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(4),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(4){width:40%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(5),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(5){width:25%}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th,.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th{text-align:left}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(1),.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(4),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(1),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(4){width:5%;text-align:center}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(2),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(2){width:65%}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(3),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(3){width:25%}.wprm-recipe-ingredients-form table .wprm-recipe-ingredients-placeholder,.wprm-recipe-ingredients-form table .wprm-recipe-instructions-placeholder,.wprm-recipe-instructions-form table .wprm-recipe-ingredients-placeholder,.wprm-recipe-instructions-form table .wprm-recipe-instructions-placeholder{display:none}.wprm-recipe-ingredients-form table td,.wprm-recipe-instructions-form table td{text-align:left;vertical-align:top}.wprm-recipe-ingredients-form table td:first-child,.wprm-recipe-ingredients-form table td:last-child,.wprm-recipe-instructions-form table td:first-child,.wprm-recipe-instructions-form table td:last-child{text-align:center;vertical-align:middle}.wprm-recipe-ingredients-form .ui-sortable-helper,.wprm-recipe-instructions-form .ui-sortable-helper{display:table}.wprm-recipe-ingredients-form .ui-sortable-helper .wprm-recipe-instruction-text,.wprm-recipe-instructions-form .ui-sortable-helper .wprm-recipe-instruction-text{min-width:200px}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-sort,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-sort{cursor:move}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-delete,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-delete{cursor:pointer}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-delete,.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-sort,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-delete,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-sort{color:#999;opacity:0.5}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-delete:hover,.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-sort:hover,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-delete:hover,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-sort:hover{color:#444;opacity:1}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-actions,.wprm-recipe-ingredients-form .wprm-recipe-instructions-actions,.wprm-recipe-instructions-form .wprm-recipe-ingredients-actions,.wprm-recipe-instructions-form .wprm-recipe-instructions-actions{margin:10px}.wprm-recipe-ingredients-form .wprm-recipe-image-preview,.wprm-recipe-instructions-form .wprm-recipe-image-preview{max-width:75px}.wprm-recipe-ingredients-form .wprm-recipe-image-preview img,.wprm-recipe-instructions-form .wprm-recipe-image-preview img{max-width:100%;height:auto}.wprm-shortcode-builder .wprm-shortcode-builder-container{margin-bottom:15px;vertical-align:top}.wprm-shortcode-builder .wprm-shortcode-builder-container-halfs{display:inline-block;width:50%}.wprm-shortcode-builder .wprm-shortcode-builder-container-thirds{display:inline-block;width:33.3%}.wprm-shortcode-builder label{display:block;font-weight:bold;margin-bottom:5px}.wprm-shortcode-builder .wprm-shortcode-builder-helper{margin-left:5px;font-size:0.8em;font-style:italic}.wprm-shortcode-builder input{margin:0;width:100%;max-width:250px;height:34px;line-height:34px}.wprm-shortcode-builder input.select2_wprm-search__field{height:18px;line-height:18px}.wprm-shortcode-builder select{width:250px}
|
1 |
+
.wprm-frame-title .dashicons,.wprm-frame.hide-router .wprm-frame-router,.wprm-modal-container{display:none}.select2_wprm-container{z-index:100075}.select2_wprm-container.select2_wprm-container--focus .select2_wprm-selection{border-color:#5b9dd9}.select2_wprm-container li{margin:0}.select2_wprm-container .select2_wprm-selection{border-color:#ddd}.medium-editor-toolbar{z-index:100080}.medium-editor-element{border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07);min-height:68px;padding:3px 5px}.medium-editor-element:focus{border-color:#5b9dd9;-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);box-shadow:0 0 2px rgba(30,140,190,.8)}.medium-editor-element:after{font-style:normal;color:#999;opacity:.5;font-size:14px;line-height:28px}.medium-editor-element p:first-child{margin-top:0}.medium-editor-element p:last-child{margin-bottom:0}.wprm-modal-hint{max-width:400px;margin-bottom:20px}.wprm-modal-hint .wprm-modal-hint-header{font-weight:700;font-variant:small-caps}.wprm-modal-hint .wprm-modal-hint-text{font-style:italic}.wprm-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:100000}.wprm-modal{position:fixed;top:30px;left:30px;right:30px;bottom:30px;z-index:100050}.wprm-modal *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wprm-modal-close{position:absolute;top:0;right:0;width:50px;height:50px;padding:0;z-index:1000;-webkit-transition:color .1s ease-in-out,background .1s ease-in-out;transition:color .1s ease-in-out,background .1s ease-in-out}.wprm-modal-close .wprm-modal-icon:before{content:"\f158";font:400 20px/1 dashicons;speak:none;vertical-align:middle;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#666}.wprm-modal-content{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto;min-height:300px;-webkit-box-shadow:0 5px 15px rgba(0,0,0,.7);box-shadow:0 5px 15px rgba(0,0,0,.7);background:#fcfcfc;-webkit-font-smoothing:subpixel-antialiased}.wprm-modal-content ::-webkit-input-placeholder{color:#999;opacity:.5}.wprm-modal-content :-moz-placeholder{color:#999;opacity:.5}.wprm-modal-content ::-moz-placeholder{color:#999;opacity:.5}.wprm-modal-content :-ms-input-placeholder{color:#999;opacity:.5}.wprm-frame{overflow:hidden;right:0}.wprm-frame,.wprm-frame-menu{position:absolute;left:0;bottom:0;top:0}.wprm-frame-menu{width:200px;z-index:150}.wprm-frame-title{top:0;height:50px}.wprm-frame-router,.wprm-frame-title{z-index:200;left:200px;position:absolute;right:0}.wprm-menu-item{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.wprm-menu{position:absolute;left:0;margin:0;padding:10px 0;border-right-width:1px;border-right-style:solid;border-right-color:#ccc;user-select:none}.wprm-menu,.wprm-sidebar{top:0;bottom:0;background:#f3f3f3;right:0}.wprm-menu .active,.wprm-menu .active:hover{color:#23282d;font-weight:700}.wprm-menu>a{display:block;position:relative;padding:8px 20px;margin:0;color:#0073aa}.wprm-frame .hidden,.wprm-frame-content-tab:not(.active),.wprm-router:not(.active){display:none}.wprm-menu>a,.wprm-router>a{line-height:18px;font-size:14px;text-decoration:none}.wprm-frame a{border-bottom:none;color:#0073aa}.wprm-menu .separator{height:0;margin:12px 20px;padding:0;border-top:1px solid #ddd}.wprm-frame-title h1{padding:0 16px;font-size:22px;line-height:50px;margin:0}.wprm-frame-router{top:50px;height:36px}.wprm-router{position:relative;padding:0 6px;margin:0;clear:both;user-select:none}.wprm-router>a{position:relative;float:left;padding:8px 10px 9px;margin:0;height:18px}.wprm-router a{-webkit-transition:none;transition:none}.wprm-router>a:last-child{border-right:0}.wprm-router .active,.wprm-router>a.active:last-child{margin:-1px -1px 0;background:#fff;border:1px solid #ddd;border-bottom:none}.wprm-router .active,.wprm-router .active:hover{color:#32373c}.wprm-frame-content{position:absolute;top:84px;left:200px;right:0;bottom:61px;height:auto;width:auto;margin:0;overflow:auto;background:#fff;border-top:1px solid #ddd;border-bottom:1px solid #ddd}.wprm-frame-toolbar,.wprm-toolbar{position:absolute;right:0;z-index:100;height:60px}.wprm-frame-content-tab{margin:20px}.wprm-frame-toolbar{left:200px;bottom:0}.wprm-toolbar{top:0;left:0;padding:0 16px;border:0 solid #ddd;overflow:hidden}.wprm-modal-content .wprm-toolbar-primary.search-form{width:33%}.wprm-toolbar-primary{float:right;height:100%}.wprm-modal-content .wprm-toolbar-primary .wprm-button{float:right}.wprm-toolbar-primary>.wprm-button,.wprm-toolbar-primary>.wprm-button-group{margin-left:10px;float:left;margin-top:15px}@media only screen and (max-width:900px){.wprm-frame:not(.hide-menu) .wprm-frame-title .dashicons{display:inline-block;line-height:50px}.wprm-frame:not(.hide-menu) .wprm-frame-menu{position:static;width:0}.wprm-frame:not(.hide-menu) .wprm-frame-content,.wprm-frame:not(.hide-menu) .wprm-frame-router,.wprm-frame:not(.hide-menu) .wprm-frame-title,.wprm-frame:not(.hide-menu) .wprm-frame-toolbar,.wprm-frame:not(.hide-menu) .wprm-menu.visible{left:0}.wprm-frame:not(.hide-menu) .wprm-menu{width:auto;max-width:80%;overflow:auto;z-index:2000;top:50px;left:-300px;right:auto;bottom:auto;padding:5px 0;border:1px solid #ccc}.wprm-frame:not(.hide-menu) .wprm-menu>a.active{display:none}.wprm-frame:not(.hide-menu) .wprm-menu>a{padding:12px 16px;font-size:16px}.wprm-frame:not(.hide-menu) .wprm-menu .separator{margin:5px 10px}.wprm-frame:not(.hide-menu) .wprm-frame-title h1{color:#0073aa;line-height:3;font-size:18px;float:left;cursor:pointer}}@media only screen and (max-width:640px),screen and (max-height:400px){.wprm-modal{position:fixed;top:0;left:0;right:0;bottom:0}.wprm-modal .wprm-frame-title{height:40px}}@media only screen and (max-width:480px){.wprm-frame:not(.hide-menu) .wprm-frame-title .dashicons{line-height:40px}.wprm-frame-router,.wprm-frame:not(.hide-menu) .wprm-menu{top:40px}.wprm-frame:not(.hide-menu) .wprm-frame-title h1,.wprm-modal .wprm-frame-title h1{font-size:18px;line-height:40px}.wprm-frame-content{top:74px}}.wprm-recipe-form{max-width:600px}.wprm-recipe-form .wprm-recipe-form-container{margin-bottom:15px;vertical-align:top}.wprm-recipe-form .wprm-recipe-form-container-halfs{display:inline-block;width:50%}.wprm-recipe-form .wprm-recipe-form-container-thirds{display:inline-block;width:33.3%}.wprm-recipe-form label{display:block;font-weight:700;margin-bottom:5px}.wprm-recipe-form input{margin:0;width:100%;max-width:120px;height:34px;line-height:34px}.wprm-recipe-form input[type=number]{max-width:50px}.wprm-recipe-form input.select2_wprm-search__field{height:18px;line-height:18px}.wprm-recipe-form select{width:100%}.wprm-recipe-form textarea{width:100%;resize:vertical}.wprm-recipe-details-form input#wprm-recipe-name{max-width:450px}.wprm-recipe-details-form input#wprm-recipe-author-name{max-width:none}.wprm-recipe-details-form input#wprm-recipe-calories{max-width:70px}.wprm-recipe-details-form .wprm-recipe-image-preview{float:right;max-width:100px}.wprm-recipe-details-form .wprm-recipe-image-preview img{max-width:100%;height:auto}.wprm-recipe-details-form .wprm-recipe-summary-container{clear:both}@media only screen and (max-width:480px){.wprm-recipe-form .wprm-recipe-form-container-halfs,.wprm-recipe-form .wprm-recipe-form-container-thirds{display:block;width:100%}.wprm-recipe-details-form .wprm-recipe-image-preview{float:none;margin:10px auto}}.wprm-recipe-ingredients-form,.wprm-recipe-instructions-form{max-width:750px;margin-bottom:15px}.wprm-recipe-ingredients-form input,.wprm-recipe-instructions-form input{margin:0;width:100%;height:34px;line-height:34px}.wprm-recipe-ingredients-form textarea,.wprm-recipe-instructions-form textarea{width:100%;resize:vertical}.wprm-recipe-ingredients-form ::-webkit-input-placeholder,.wprm-recipe-instructions-form ::-webkit-input-placeholder{color:#999;opacity:.5}.wprm-recipe-ingredients-form :-moz-placeholder,.wprm-recipe-instructions-form :-moz-placeholder{color:#999;opacity:.5}.wprm-recipe-ingredients-form ::-moz-placeholder,.wprm-recipe-instructions-form ::-moz-placeholder{color:#999;opacity:.5}.wprm-recipe-ingredients-form :-ms-input-placeholder,.wprm-recipe-instructions-form :-ms-input-placeholder{color:#999;opacity:.5}.wprm-recipe-ingredients-form table,.wprm-recipe-instructions-form table{width:100%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th,.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th{text-align:left}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(1),.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(6),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(1),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(6){width:5%;text-align:center}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(2),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(2){width:10%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(3),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(3){width:15%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(4),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(4){width:40%}.wprm-recipe-ingredients-form table.wprm-recipe-ingredients-container th:nth-child(5),.wprm-recipe-instructions-form table.wprm-recipe-ingredients-container th:nth-child(5){width:25%}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th,.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th{text-align:left}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(1),.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(4),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(1),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(4){width:5%;text-align:center}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(2),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(2){width:65%}.wprm-recipe-ingredients-form table.wprm-recipe-instructions-container th:nth-child(3),.wprm-recipe-instructions-form table.wprm-recipe-instructions-container th:nth-child(3){width:25%}.wprm-recipe-ingredients-form table .wprm-recipe-ingredients-placeholder,.wprm-recipe-ingredients-form table .wprm-recipe-instructions-placeholder,.wprm-recipe-instructions-form table .wprm-recipe-ingredients-placeholder,.wprm-recipe-instructions-form table .wprm-recipe-instructions-placeholder{display:none}.wprm-recipe-ingredients-form table td,.wprm-recipe-instructions-form table td{text-align:left;vertical-align:top}.wprm-recipe-ingredients-form table td:first-child,.wprm-recipe-ingredients-form table td:last-child,.wprm-recipe-instructions-form table td:first-child,.wprm-recipe-instructions-form table td:last-child{text-align:center;vertical-align:middle}.wprm-recipe-ingredients-form .ui-sortable-helper,.wprm-recipe-instructions-form .ui-sortable-helper{display:table}.wprm-recipe-ingredients-form .ui-sortable-helper .wprm-recipe-instruction-text,.wprm-recipe-instructions-form .ui-sortable-helper .wprm-recipe-instruction-text{min-width:200px}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-sort,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-sort{cursor:move}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-delete,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-delete{cursor:pointer}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-delete,.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-sort,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-delete,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-sort{color:#999;opacity:.5}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-delete:hover,.wprm-recipe-ingredients-form .wprm-recipe-ingredients-instructions-sort:hover,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-delete:hover,.wprm-recipe-instructions-form .wprm-recipe-ingredients-instructions-sort:hover{color:#444;opacity:1}.wprm-recipe-ingredients-form .wprm-recipe-ingredients-actions,.wprm-recipe-ingredients-form .wprm-recipe-instructions-actions,.wprm-recipe-instructions-form .wprm-recipe-ingredients-actions,.wprm-recipe-instructions-form .wprm-recipe-instructions-actions{margin:10px}.wprm-recipe-ingredients-form .wprm-recipe-image-preview,.wprm-recipe-instructions-form .wprm-recipe-image-preview{max-width:75px}.wprm-recipe-ingredients-form .wprm-recipe-image-preview img,.wprm-recipe-instructions-form .wprm-recipe-image-preview img{max-width:100%;height:auto}.wprm-shortcode-builder .wprm-shortcode-builder-container{margin-bottom:15px;vertical-align:top}.wprm-shortcode-builder .wprm-shortcode-builder-container-halfs{display:inline-block;width:50%}.wprm-shortcode-builder .wprm-shortcode-builder-container-thirds{display:inline-block;width:33.3%}.wprm-shortcode-builder label{display:block;font-weight:700;margin-bottom:5px}.wprm-shortcode-builder .wprm-shortcode-builder-helper{margin-left:5px;font-size:.8em;font-style:italic}.wprm-shortcode-builder input{margin:0;width:100%;max-width:250px;height:34px;line-height:34px}.wprm-shortcode-builder input.select2_wprm-search__field{height:18px;line-height:18px}.wprm-shortcode-builder select{width:250px}
|
assets/css/admin/modal.scss
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
@import "modal/container";
|
|
|
2 |
@import "modal/recipe-details";
|
3 |
@import "modal/recipe-ingredients";
|
4 |
@import "modal/shortcode-builder";
|
1 |
@import "modal/container";
|
2 |
+
@import "modal/form";
|
3 |
@import "modal/recipe-details";
|
4 |
@import "modal/recipe-ingredients";
|
5 |
@import "modal/shortcode-builder";
|
assets/css/admin/modal/_container.scss
CHANGED
@@ -52,6 +52,7 @@
|
|
52 |
|
53 |
.wprm-modal-hint {
|
54 |
max-width: 400px;
|
|
|
55 |
|
56 |
.wprm-modal-hint-header {
|
57 |
font-weight: bold;
|
52 |
|
53 |
.wprm-modal-hint {
|
54 |
max-width: 400px;
|
55 |
+
margin-bottom: 20px;
|
56 |
|
57 |
.wprm-modal-hint-header {
|
58 |
font-weight: bold;
|
assets/css/admin/modal/_form.scss
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// main: ../modal.scss
|
2 |
+
.wprm-recipe-form {
|
3 |
+
max-width: 600px;
|
4 |
+
|
5 |
+
.wprm-recipe-form-container {
|
6 |
+
margin-bottom: 15px;
|
7 |
+
vertical-align: top;
|
8 |
+
}
|
9 |
+
|
10 |
+
.wprm-recipe-form-container-halfs {
|
11 |
+
display: inline-block;
|
12 |
+
width: 50%;
|
13 |
+
}
|
14 |
+
|
15 |
+
.wprm-recipe-form-container-thirds {
|
16 |
+
display: inline-block;
|
17 |
+
width: 33.3%;
|
18 |
+
}
|
19 |
+
|
20 |
+
label {
|
21 |
+
display: block;
|
22 |
+
font-weight: bold;
|
23 |
+
margin-bottom: 5px;
|
24 |
+
}
|
25 |
+
|
26 |
+
input {
|
27 |
+
margin: 0;
|
28 |
+
width: 100%;
|
29 |
+
max-width: 120px;
|
30 |
+
height: 34px;
|
31 |
+
line-height: 34px;
|
32 |
+
|
33 |
+
&[type="number"] {
|
34 |
+
max-width: 50px;
|
35 |
+
}
|
36 |
+
|
37 |
+
&.select2_wprm-search__field {
|
38 |
+
height: 18px;
|
39 |
+
line-height: 18px;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
select {
|
44 |
+
width: 100%;
|
45 |
+
}
|
46 |
+
|
47 |
+
textarea {
|
48 |
+
width: 100%;
|
49 |
+
resize: vertical;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
@media only screen and (max-width: 480px) {
|
53 |
+
.wprm-recipe-form {
|
54 |
+
.wprm-recipe-form-container-halfs,
|
55 |
+
.wprm-recipe-form-container-thirds {
|
56 |
+
display: block;
|
57 |
+
width: 100%;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
assets/css/admin/modal/_recipe-details.scss
CHANGED
@@ -1,62 +1,17 @@
|
|
1 |
// main: ../modal.scss
|
2 |
-
.wprm-recipe-details-form
|
3 |
-
.wprm-recipe-notes-form {
|
4 |
-
max-width: 600px;
|
5 |
-
|
6 |
-
.wprm-recipe-details-form-container,
|
7 |
-
.wprm-recipe-notes-form-container {
|
8 |
-
margin-bottom: 15px;
|
9 |
-
vertical-align: top;
|
10 |
-
}
|
11 |
-
|
12 |
-
.wprm-recipe-details-form-container-halfs {
|
13 |
-
display: inline-block;
|
14 |
-
width: 50%;
|
15 |
-
}
|
16 |
-
|
17 |
-
.wprm-recipe-details-form-container-thirds {
|
18 |
-
display: inline-block;
|
19 |
-
width: 33.3%;
|
20 |
-
}
|
21 |
-
|
22 |
-
label {
|
23 |
-
display: block;
|
24 |
-
font-weight: bold;
|
25 |
-
margin-bottom: 5px;
|
26 |
-
}
|
27 |
-
|
28 |
input {
|
29 |
-
margin: 0;
|
30 |
-
width: 100%;
|
31 |
-
max-width: 120px;
|
32 |
-
height: 34px;
|
33 |
-
line-height: 34px;
|
34 |
-
|
35 |
&#wprm-recipe-name {
|
36 |
max-width: 450px;
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
max-width:
|
41 |
}
|
42 |
|
43 |
&#wprm-recipe-calories {
|
44 |
max-width: 70px;
|
45 |
}
|
46 |
-
|
47 |
-
&.select2_wprm-search__field {
|
48 |
-
height: 18px;
|
49 |
-
line-height: 18px;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
select {
|
54 |
-
width: 100%;
|
55 |
-
}
|
56 |
-
|
57 |
-
textarea {
|
58 |
-
width: 100%;
|
59 |
-
resize: vertical;
|
60 |
}
|
61 |
|
62 |
.wprm-recipe-image-preview {
|
@@ -75,12 +30,6 @@
|
|
75 |
}
|
76 |
@media only screen and (max-width: 480px) {
|
77 |
.wprm-recipe-details-form {
|
78 |
-
.wprm-recipe-details-form-container-halfs,
|
79 |
-
.wprm-recipe-details-form-container-thirds {
|
80 |
-
display: block;
|
81 |
-
width: 100%;
|
82 |
-
}
|
83 |
-
|
84 |
.wprm-recipe-image-preview {
|
85 |
float: none;
|
86 |
margin: 10px auto;
|
1 |
// main: ../modal.scss
|
2 |
+
.wprm-recipe-details-form {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
input {
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
&#wprm-recipe-name {
|
5 |
max-width: 450px;
|
6 |
}
|
7 |
|
8 |
+
&#wprm-recipe-author-name {
|
9 |
+
max-width: none;
|
10 |
}
|
11 |
|
12 |
&#wprm-recipe-calories {
|
13 |
max-width: 70px;
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
|
17 |
.wprm-recipe-image-preview {
|
30 |
}
|
31 |
@media only screen and (max-width: 480px) {
|
32 |
.wprm-recipe-details-form {
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
.wprm-recipe-image-preview {
|
34 |
float: none;
|
35 |
margin: 10px auto;
|
assets/css/admin/settings.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-settings select{min-width:200px}.wprm-settings .select2_wprm-container{z-index:99000}.wprm-settings .template-preview-container .template-preview{float:left;text-align:center;width:250px;height:230px;overflow:hidden;margin:5px}.wprm-settings .template-preview-container .template-name{font-weight:
|
1 |
+
.wprm-settings select{min-width:200px}.wprm-settings .select2_wprm-container{z-index:99000}.wprm-settings .template-preview-container .template-preview{float:left;text-align:center;width:250px;height:230px;overflow:hidden;margin:5px}.wprm-settings .template-preview-container .template-name{font-weight:700;line-height:30px}.wprm-settings .template-preview-container .template-screenshot{width:250px}.wprm-settings .template-preview-container .template-no-screenshot{width:250px;height:200px;line-height:200px;border:1px dashed #999;box-sizing:border-box}
|
assets/css/public/public.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.comment-form-wprm-rating{display:none}.comment-form-wprm-rating .wprm-rating-star{cursor:pointer}.wprm-rating-star svg{vertical-align:middle;width:16px;height:16px;margin:0}.wprm-rating-star.rated svg polygon{fill
|
1 |
+
.comment-form-wprm-rating{display:none}.comment-form-wprm-rating .wprm-rating-star{cursor:pointer}.wprm-rating-star svg{vertical-align:middle;width:16px;height:16px;margin:0}.wprm-rating-star.rated svg polygon{fill:#000}
|
assets/icons/chef-hat.svg
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 24 24"><g >
|
2 |
+
<path data-color="color-2" fill="#343434" d="M13,21h-2H5v2c0,0.6,0.4,1,1,1h12c0.6,0,1-0.4,1-1v-2H13z"/>
|
3 |
+
<path fill="#343434" d="M18,4c-0.1,0-0.2,0-0.3,0c-0.8-2.3-3-4-5.7-4S7.2,1.7,6.3,4C6.2,4,6.1,4,6,4c-3.3,0-6,2.7-6,6
|
4 |
+
c0,3,2.2,5.4,5,5.9V19h6v-4h2v4h6v-3.1c2.8-0.5,5-2.9,5-5.9C24,6.7,21.3,4,18,4z"/>
|
5 |
+
</g></svg>
|
assets/icons/close.svg
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g >
|
2 |
+
<path fill="#fffefe" d="M22.7,4.3l-3-3c-0.4-0.4-1-0.4-1.4,0L12,7.6L5.7,1.3c-0.4-0.4-1-0.4-1.4,0l-3,3c-0.4,0.4-0.4,1,0,1.4L7.6,12
|
3 |
+
l-6.3,6.3c-0.4,0.4-0.4,1,0,1.4l3,3c0.4,0.4,1,0.4,1.4,0l6.3-6.3l6.3,6.3c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3l3-3
|
4 |
+
c0.4-0.4,0.4-1,0-1.4L16.4,12l6.3-6.3C23.1,5.3,23.1,4.7,22.7,4.3z"/>
|
5 |
+
</g></svg>
|
assets/icons/pause.svg
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g >
|
2 |
+
<path fill="#fffefe" d="M9,2H4C3.4,2,3,2.4,3,3v18c0,0.6,0.4,1,1,1h5c0.6,0,1-0.4,1-1V3C10,2.4,9.6,2,9,2z"/>
|
3 |
+
<path fill="#fffefe" d="M20,2h-5c-0.6,0-1,0.4-1,1v18c0,0.6,0.4,1,1,1h5c0.6,0,1-0.4,1-1V3C21,2.4,20.6,2,20,2z"/>
|
4 |
+
</g></svg>
|
assets/icons/play.svg
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"><g >
|
2 |
+
<path fill="#fffefe" d="M6.6,2.2C6.3,2,5.9,1.9,5.6,2.1C5.2,2.3,5,2.6,5,3v18c0,0.4,0.2,0.7,0.6,0.9C5.7,22,5.8,22,6,22
|
3 |
+
c0.2,0,0.4-0.1,0.6-0.2l12-9c0.3-0.2,0.4-0.5,0.4-0.8s-0.1-0.6-0.4-0.8L6.6,2.2z"/>
|
4 |
+
</g></svg>
|
assets/js/admin/recipe-form.js
CHANGED
@@ -9,6 +9,9 @@ wprm_admin.set_recipe = function(args) {
|
|
9 |
|
10 |
wprm_admin.editing_recipe = recipe_id;
|
11 |
wprm_admin.clear_recipe_fields();
|
|
|
|
|
|
|
12 |
|
13 |
if (recipe_id !== 0) {
|
14 |
var button = jQuery('.wprm-button-action');
|
@@ -29,6 +32,9 @@ wprm_admin.set_recipe = function(args) {
|
|
29 |
|
30 |
if (out.success) {
|
31 |
wprm_admin.set_recipe_fields(out.data.recipe);
|
|
|
|
|
|
|
32 |
}
|
33 |
}, 'json');
|
34 |
}
|
@@ -39,6 +45,8 @@ wprm_admin.clear_recipe_fields = function() {
|
|
39 |
wprm_admin.remove_media_image(jQuery('.wprm-recipe-image-container'));
|
40 |
jQuery('#wprm-recipe-name').val('');
|
41 |
wprm_admin.rich_editor.resetContent(''); // Recipe summary
|
|
|
|
|
42 |
jQuery('#wprm-recipe-servings').val('');
|
43 |
jQuery('#wprm-recipe-servings-unit').val('');
|
44 |
jQuery('#wprm-recipe-calories').val('');
|
@@ -74,8 +82,11 @@ wprm_admin.set_recipe_fields = function(recipe) {
|
|
74 |
wprm_admin.rich_editor.setContent(recipe.summary);
|
75 |
jQuery('#wprm-recipe-servings-unit').val(recipe.servings_unit);
|
76 |
|
|
|
|
|
|
|
77 |
var servings = parseInt(recipe.servings) > 0 ? parseInt(recipe.servings) : '',
|
78 |
-
calories = recipe.nutrition.calories ?
|
79 |
prep_time = parseInt(recipe.prep_time) > 0 ? parseInt(recipe.prep_time) : '',
|
80 |
cook_time = parseInt(recipe.cook_time) > 0 ? parseInt(recipe.cook_time) : '',
|
81 |
total_time = parseInt(recipe.total_time) > 0 ? parseInt(recipe.total_time) : '';
|
@@ -147,24 +158,6 @@ wprm_admin.set_recipe_tags = function(recipe, tag) {
|
|
147 |
select.val(term_ids).trigger('change');
|
148 |
};
|
149 |
|
150 |
-
wprm_admin.rich_editor = false;
|
151 |
-
wprm_admin.init_rich_editor = function() {
|
152 |
-
if (wprm_admin.rich_editor) {
|
153 |
-
wprm_admin.rich_editor.addElements('.wprm-rich-editor');
|
154 |
-
} else {
|
155 |
-
wprm_admin.rich_editor = new MediumEditor('.wprm-rich-editor', {
|
156 |
-
autoLink: true,
|
157 |
-
imageDragging: false,
|
158 |
-
toolbar: {
|
159 |
-
buttons: ['bold', 'italic', 'underline', {
|
160 |
-
name: 'anchor',
|
161 |
-
contentDefault: '<span class="dashicons dashicons-admin-links"></span>'
|
162 |
-
}]
|
163 |
-
}
|
164 |
-
});
|
165 |
-
}
|
166 |
-
};
|
167 |
-
|
168 |
wprm_admin.select_media_image = function(container) {
|
169 |
// Create a new media frame (don't reuse because we have multiple different inputs)
|
170 |
var frame = wp.media({
|
@@ -286,6 +279,8 @@ wprm_admin.insert_update_recipe = function(button) {
|
|
286 |
image_id: jQuery('#wprm-recipe-image-id').val(),
|
287 |
name: jQuery('#wprm-recipe-name').val(),
|
288 |
summary: jQuery('#wprm-recipe-summary').val(),
|
|
|
|
|
289 |
servings: jQuery('#wprm-recipe-servings').val(),
|
290 |
servings_unit: jQuery('#wprm-recipe-servings-unit').val(),
|
291 |
prep_time: jQuery('#wprm-recipe-prep-time').val(),
|
@@ -371,6 +366,11 @@ wprm_admin.insert_update_recipe = function(button) {
|
|
371 |
recipe.notes = jQuery('#wprm_recipe_notes').val();
|
372 |
}
|
373 |
|
|
|
|
|
|
|
|
|
|
|
374 |
// Ajax call to recipe saver
|
375 |
var data = {
|
376 |
action: 'wprm_save_recipe',
|
@@ -411,6 +411,21 @@ jQuery(document).ready(function($) {
|
|
411 |
// Initialize rich editor
|
412 |
wprm_admin.init_rich_editor();
|
413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
// Recipe Times
|
415 |
jQuery('.wprm-recipe-time').on('keyup change', function() {
|
416 |
var container = jQuery(this),
|
9 |
|
10 |
wprm_admin.editing_recipe = recipe_id;
|
11 |
wprm_admin.clear_recipe_fields();
|
12 |
+
if(typeof wprmp_admin !== 'undefined') {
|
13 |
+
wprmp_admin.clear_recipe_fields();
|
14 |
+
}
|
15 |
|
16 |
if (recipe_id !== 0) {
|
17 |
var button = jQuery('.wprm-button-action');
|
32 |
|
33 |
if (out.success) {
|
34 |
wprm_admin.set_recipe_fields(out.data.recipe);
|
35 |
+
if(typeof wprmp_admin !== 'undefined') {
|
36 |
+
wprmp_admin.set_recipe_fields(out.data.recipe);
|
37 |
+
}
|
38 |
}
|
39 |
}, 'json');
|
40 |
}
|
45 |
wprm_admin.remove_media_image(jQuery('.wprm-recipe-image-container'));
|
46 |
jQuery('#wprm-recipe-name').val('');
|
47 |
wprm_admin.rich_editor.resetContent(''); // Recipe summary
|
48 |
+
jQuery('#wprm-recipe-author-display').val('disabled').change();
|
49 |
+
jQuery('#wprm-recipe-author-name').val('');
|
50 |
jQuery('#wprm-recipe-servings').val('');
|
51 |
jQuery('#wprm-recipe-servings-unit').val('');
|
52 |
jQuery('#wprm-recipe-calories').val('');
|
82 |
wprm_admin.rich_editor.setContent(recipe.summary);
|
83 |
jQuery('#wprm-recipe-servings-unit').val(recipe.servings_unit);
|
84 |
|
85 |
+
jQuery('#wprm-recipe-author-display').val(recipe.author_display).change();
|
86 |
+
jQuery('#wprm-recipe-author-name').val(recipe.author_name);
|
87 |
+
|
88 |
var servings = parseInt(recipe.servings) > 0 ? parseInt(recipe.servings) : '',
|
89 |
+
calories = recipe.nutrition.calories ? parseFloat(recipe.nutrition.calories) : '',
|
90 |
prep_time = parseInt(recipe.prep_time) > 0 ? parseInt(recipe.prep_time) : '',
|
91 |
cook_time = parseInt(recipe.cook_time) > 0 ? parseInt(recipe.cook_time) : '',
|
92 |
total_time = parseInt(recipe.total_time) > 0 ? parseInt(recipe.total_time) : '';
|
158 |
select.val(term_ids).trigger('change');
|
159 |
};
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
wprm_admin.select_media_image = function(container) {
|
162 |
// Create a new media frame (don't reuse because we have multiple different inputs)
|
163 |
var frame = wp.media({
|
279 |
image_id: jQuery('#wprm-recipe-image-id').val(),
|
280 |
name: jQuery('#wprm-recipe-name').val(),
|
281 |
summary: jQuery('#wprm-recipe-summary').val(),
|
282 |
+
author_display: jQuery('#wprm-recipe-author-display').val(),
|
283 |
+
author_name: jQuery('#wprm-recipe-author-name').val(),
|
284 |
servings: jQuery('#wprm-recipe-servings').val(),
|
285 |
servings_unit: jQuery('#wprm-recipe-servings-unit').val(),
|
286 |
prep_time: jQuery('#wprm-recipe-prep-time').val(),
|
366 |
recipe.notes = jQuery('#wprm_recipe_notes').val();
|
367 |
}
|
368 |
|
369 |
+
// Add any Premium fields
|
370 |
+
if(typeof wprmp_admin !== 'undefined') {
|
371 |
+
recipe = wprmp_admin.insert_update_recipe(recipe);
|
372 |
+
}
|
373 |
+
|
374 |
// Ajax call to recipe saver
|
375 |
var data = {
|
376 |
action: 'wprm_save_recipe',
|
411 |
// Initialize rich editor
|
412 |
wprm_admin.init_rich_editor();
|
413 |
|
414 |
+
// Author
|
415 |
+
jQuery('#wprm-recipe-author-display').select2_wprm({
|
416 |
+
width: '95%'
|
417 |
+
});
|
418 |
+
|
419 |
+
jQuery(document).on('change', '#wprm-recipe-author-display', function() {
|
420 |
+
var author_display = jQuery(this).val();
|
421 |
+
if(author_display == 'custom') {
|
422 |
+
jQuery('#wprm-recipe-author-name-container').show();
|
423 |
+
} else {
|
424 |
+
jQuery('#wprm-recipe-author-name-container').hide();
|
425 |
+
}
|
426 |
+
});
|
427 |
+
jQuery('#wprm-recipe-author-display').change();
|
428 |
+
|
429 |
// Recipe Times
|
430 |
jQuery('.wprm-recipe-time').on('keyup change', function() {
|
431 |
var container = jQuery(this),
|
assets/js/admin/recipe-snippets.js
CHANGED
@@ -28,8 +28,6 @@ wprm_admin.insert_print_recipe = function(button) {
|
|
28 |
shortcode += ' id="' + id + '"';
|
29 |
}
|
30 |
|
31 |
-
console.log(text);
|
32 |
-
|
33 |
if (text) {
|
34 |
shortcode += ' text="' + text + '"';
|
35 |
}
|
28 |
shortcode += ' id="' + id + '"';
|
29 |
}
|
30 |
|
|
|
|
|
31 |
if (text) {
|
32 |
shortcode += ' text="' + text + '"';
|
33 |
}
|
assets/js/admin/rich-editor.js
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var wprm_admin = wprm_admin || {};
|
2 |
+
|
3 |
+
wprm_admin.rich_editor = false;
|
4 |
+
wprm_admin.init_rich_editor = function() {
|
5 |
+
if (wprm_admin.rich_editor) {
|
6 |
+
wprm_admin.rich_editor.addElements('.wprm-rich-editor');
|
7 |
+
} else {
|
8 |
+
var args = {
|
9 |
+
autoLink: true,
|
10 |
+
imageDragging: false,
|
11 |
+
toolbar: {
|
12 |
+
buttons: ['bold', 'italic', 'underline', {
|
13 |
+
name: 'anchor',
|
14 |
+
contentDefault: '<span class="dashicons dashicons-admin-links"></span>'
|
15 |
+
}]
|
16 |
+
},
|
17 |
+
extensions: {}
|
18 |
+
};
|
19 |
+
|
20 |
+
if(wprm_modal.addons.premium) {
|
21 |
+
args.toolbar.buttons.push('adjustable_servings');
|
22 |
+
args.toolbar.buttons.push('timer');
|
23 |
+
args.extensions.adjustable_servings = new wprm_admin.rich_editor_adjustable_servings();
|
24 |
+
args.extensions.timer = new wprm_admin.rich_editor_timer();
|
25 |
+
}
|
26 |
+
|
27 |
+
wprm_admin.rich_editor = new MediumEditor('.wprm-rich-editor', args);
|
28 |
+
}
|
29 |
+
};
|
30 |
+
|
31 |
+
rangy.init();
|
32 |
+
|
33 |
+
wprm_admin.rich_editor_adjustable_servings = MediumEditor.Extension.extend({
|
34 |
+
name: 'adjustable_servings',
|
35 |
+
init: function () {
|
36 |
+
this.button = this.document.createElement('button');
|
37 |
+
this.button.classList.add('medium-editor-action');
|
38 |
+
this.button.innerHTML = '<b>Adjustable</b>';
|
39 |
+
this.button.title = 'Adjustable Quantity';
|
40 |
+
|
41 |
+
this.on(this.button, 'click', this.handleClick.bind(this));
|
42 |
+
},
|
43 |
+
getButton: function () {
|
44 |
+
return this.button;
|
45 |
+
},
|
46 |
+
handleClick: function (event) {
|
47 |
+
var selection = rangy.getSelection(),
|
48 |
+
range = selection.getRangeAt(0),
|
49 |
+
original_range = range.cloneRange(),
|
50 |
+
end_range = range.cloneRange(),
|
51 |
+
text = range.getDocument().createTextNode('[adjustable]'),
|
52 |
+
end_text = range.getDocument().createTextNode('[/adjustable]');
|
53 |
+
|
54 |
+
end_range.collapse(false);
|
55 |
+
end_range.insertNode(end_text);
|
56 |
+
end_range.detach();
|
57 |
+
range.setEndAfter(end_text);
|
58 |
+
|
59 |
+
range.insertNode(text);
|
60 |
+
rangy.getSelection().setSingleRange(original_range);
|
61 |
+
}
|
62 |
+
});
|
63 |
+
|
64 |
+
wprm_admin.rich_editor_timer = MediumEditor.Extension.extend({
|
65 |
+
name: 'timer',
|
66 |
+
init: function () {
|
67 |
+
this.button = this.document.createElement('button');
|
68 |
+
this.button.classList.add('medium-editor-action');
|
69 |
+
this.button.innerHTML = '<b>Timer</b>';
|
70 |
+
this.button.title = 'Timer';
|
71 |
+
|
72 |
+
this.on(this.button, 'click', this.handleClick.bind(this));
|
73 |
+
},
|
74 |
+
getButton: function () {
|
75 |
+
return this.button;
|
76 |
+
},
|
77 |
+
handleClick: function (event) {
|
78 |
+
var selection = rangy.getSelection(),
|
79 |
+
range = selection.getRangeAt(0),
|
80 |
+
original_range = range.cloneRange(),
|
81 |
+
end_range = range.cloneRange(),
|
82 |
+
text = range.getDocument().createTextNode('[timer minutes=0]'),
|
83 |
+
end_text = range.getDocument().createTextNode('[/timer]');
|
84 |
+
|
85 |
+
end_range.collapse(false);
|
86 |
+
end_range.insertNode(end_text);
|
87 |
+
end_range.detach();
|
88 |
+
range.setEndAfter(end_text);
|
89 |
+
|
90 |
+
range.insertNode(text);
|
91 |
+
rangy.getSelection().setSingleRange(original_range);
|
92 |
+
}
|
93 |
+
});
|
assets/js/public/print.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
var wprm = wprm || {};
|
2 |
|
3 |
-
wprm.print_recipe = function(recipe_id) {
|
4 |
var print_window = window.open(wprm_public.home_url + 'wprm_print/' + recipe_id, '_blank');
|
5 |
print_window.onload = function() {
|
6 |
print_window.focus();
|
7 |
print_window.document.title = document.title;
|
8 |
print_window.history.pushState('', 'Print Recipe', location.href.replace(location.hash,""));
|
|
|
9 |
print_window.print();
|
10 |
};
|
11 |
};
|
@@ -14,8 +15,10 @@ jQuery(document).ready(function($) {
|
|
14 |
jQuery('.wprm-recipe-print').on('click', function(e) {
|
15 |
e.preventDefault();
|
16 |
|
17 |
-
var
|
18 |
-
|
|
|
|
|
19 |
});
|
20 |
jQuery('.wprm-print-recipe-shortcode').on('click', function(e) {
|
21 |
e.preventDefault();
|
1 |
var wprm = wprm || {};
|
2 |
|
3 |
+
wprm.print_recipe = function(recipe_id, servings = false) {
|
4 |
var print_window = window.open(wprm_public.home_url + 'wprm_print/' + recipe_id, '_blank');
|
5 |
print_window.onload = function() {
|
6 |
print_window.focus();
|
7 |
print_window.document.title = document.title;
|
8 |
print_window.history.pushState('', 'Print Recipe', location.href.replace(location.hash,""));
|
9 |
+
print_window.wprm.set_print_servings(servings);
|
10 |
print_window.print();
|
11 |
};
|
12 |
};
|
15 |
jQuery('.wprm-recipe-print').on('click', function(e) {
|
16 |
e.preventDefault();
|
17 |
|
18 |
+
var recipe = jQuery(this).parents('.wprm-recipe-container'),
|
19 |
+
servings = parseInt(recipe.find('.wprm-recipe-servings').text()),
|
20 |
+
recipe_id = recipe.data('recipe-id');
|
21 |
+
wprm.print_recipe(recipe_id, servings);
|
22 |
});
|
23 |
jQuery('.wprm-print-recipe-shortcode').on('click', function(e) {
|
24 |
e.preventDefault();
|
includes/admin/class-wprm-import-manager.php
CHANGED
@@ -36,7 +36,7 @@ class WPRM_Import_Manager {
|
|
36 |
public static function init() {
|
37 |
self::load_importers();
|
38 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
|
39 |
-
add_action( 'admin_menu', array( __CLASS__, 'add_submenu_page' ) );
|
40 |
add_action( 'admin_post_wprm_import_recipes', array( __CLASS__, 'form_import_recipes' ) );
|
41 |
add_action( 'admin_post_wprm_check_imported_recipes', array( __CLASS__, 'form_check_imported_recipes' ) );
|
42 |
}
|
36 |
public static function init() {
|
37 |
self::load_importers();
|
38 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
|
39 |
+
add_action( 'admin_menu', array( __CLASS__, 'add_submenu_page' ), 16 );
|
40 |
add_action( 'admin_post_wprm_import_recipes', array( __CLASS__, 'form_import_recipes' ) );
|
41 |
add_action( 'admin_post_wprm_check_imported_recipes', array( __CLASS__, 'form_check_imported_recipes' ) );
|
42 |
}
|
includes/admin/class-wprm-recipe-sanitizer.php
CHANGED
@@ -31,6 +31,7 @@ class WPRM_Recipe_Sanitizer {
|
|
31 |
// Text fields.
|
32 |
$sanitized_recipe['name'] = isset( $recipe['name'] ) ? sanitize_text_field( $recipe['name'] ) : '';
|
33 |
$sanitized_recipe['summary'] = isset( $recipe['summary'] ) ? wp_kses_post( $recipe['summary'] ) : '';
|
|
|
34 |
$sanitized_recipe['servings_unit'] = isset( $recipe['servings_unit'] ) ? sanitize_text_field( $recipe['servings_unit'] ) : '';
|
35 |
$sanitized_recipe['notes'] = isset( $recipe['notes'] ) ? wp_kses_post( $recipe['notes'] ) : '';
|
36 |
|
@@ -41,6 +42,10 @@ class WPRM_Recipe_Sanitizer {
|
|
41 |
$sanitized_recipe['cook_time'] = isset( $recipe['cook_time'] ) ? intval( $recipe['cook_time'] ) : 0;
|
42 |
$sanitized_recipe['total_time'] = isset( $recipe['total_time'] ) ? intval( $recipe['total_time'] ) : 0;
|
43 |
|
|
|
|
|
|
|
|
|
44 |
// Recipe Tags.
|
45 |
$sanitized_recipe['tags'] = array();
|
46 |
$sanitized_recipe['tags']['course'] = isset( $recipe['tags'] ) && isset( $recipe['tags']['course'] ) && $recipe['tags']['course'] ? array_map( array( __CLASS__, 'sanitize_tags' ), $recipe['tags']['course'] ) : array();
|
@@ -133,7 +138,30 @@ class WPRM_Recipe_Sanitizer {
|
|
133 |
$sanitized_recipe['nutrition'] = array();
|
134 |
|
135 |
if ( isset( $recipe['nutrition'] ) ) {
|
136 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
// Other fields.
|
31 |
// Text fields.
|
32 |
$sanitized_recipe['name'] = isset( $recipe['name'] ) ? sanitize_text_field( $recipe['name'] ) : '';
|
33 |
$sanitized_recipe['summary'] = isset( $recipe['summary'] ) ? wp_kses_post( $recipe['summary'] ) : '';
|
34 |
+
$sanitized_recipe['author_name'] = isset( $recipe['author_name'] ) ? sanitize_text_field( $recipe['author_name'] ) : '';
|
35 |
$sanitized_recipe['servings_unit'] = isset( $recipe['servings_unit'] ) ? sanitize_text_field( $recipe['servings_unit'] ) : '';
|
36 |
$sanitized_recipe['notes'] = isset( $recipe['notes'] ) ? wp_kses_post( $recipe['notes'] ) : '';
|
37 |
|
42 |
$sanitized_recipe['cook_time'] = isset( $recipe['cook_time'] ) ? intval( $recipe['cook_time'] ) : 0;
|
43 |
$sanitized_recipe['total_time'] = isset( $recipe['total_time'] ) ? intval( $recipe['total_time'] ) : 0;
|
44 |
|
45 |
+
// Limited options fields.
|
46 |
+
$options = array( 'disabled', 'post_author', 'custom' );
|
47 |
+
$sanitized_recipe['author_display'] = isset( $recipe['author_display'] ) && in_array( $recipe['author_display'], $options, true ) ? sanitize_key( $recipe['author_display'] ) : $options[0];
|
48 |
+
|
49 |
// Recipe Tags.
|
50 |
$sanitized_recipe['tags'] = array();
|
51 |
$sanitized_recipe['tags']['course'] = isset( $recipe['tags'] ) && isset( $recipe['tags']['course'] ) && $recipe['tags']['course'] ? array_map( array( __CLASS__, 'sanitize_tags' ), $recipe['tags']['course'] ) : array();
|
138 |
$sanitized_recipe['nutrition'] = array();
|
139 |
|
140 |
if ( isset( $recipe['nutrition'] ) ) {
|
141 |
+
$nutrition_fields = array(
|
142 |
+
'serving_size',
|
143 |
+
'calories',
|
144 |
+
'carbohydrates',
|
145 |
+
'protein',
|
146 |
+
'fat',
|
147 |
+
'saturated_fat',
|
148 |
+
'polyunsaturated_fat',
|
149 |
+
'monounsaturated_fat',
|
150 |
+
'trans_fat',
|
151 |
+
'cholesterol',
|
152 |
+
'sodium',
|
153 |
+
'potassium',
|
154 |
+
'fiber',
|
155 |
+
'sugar',
|
156 |
+
'vitamin_a',
|
157 |
+
'vitamin_c',
|
158 |
+
'calcium',
|
159 |
+
'iron',
|
160 |
+
);
|
161 |
+
|
162 |
+
foreach ( $nutrition_fields as $field ) {
|
163 |
+
$sanitized_recipe['nutrition'][ $field ] = isset( $recipe['nutrition'][ $field ] ) && '' !== trim( $recipe['nutrition'][ $field ] ) ? str_replace( ',', '.', $recipe['nutrition'][ $field ] ) : false;
|
164 |
+
}
|
165 |
}
|
166 |
|
167 |
// Other fields.
|
includes/admin/class-wprm-recipe-saver.php
CHANGED
@@ -114,6 +114,8 @@ class WPRM_Recipe_Saver {
|
|
114 |
wp_set_object_terms( $id, $ingredient_ids, 'wprm_ingredient', false );
|
115 |
|
116 |
// Meta Fields.
|
|
|
|
|
117 |
update_post_meta( $id, 'wprm_servings', $recipe['servings'] );
|
118 |
update_post_meta( $id, 'wprm_servings_unit', $recipe['servings_unit'] );
|
119 |
update_post_meta( $id, 'wprm_prep_time', $recipe['prep_time'] );
|
114 |
wp_set_object_terms( $id, $ingredient_ids, 'wprm_ingredient', false );
|
115 |
|
116 |
// Meta Fields.
|
117 |
+
update_post_meta( $id, 'wprm_author_display', $recipe['author_display'] );
|
118 |
+
update_post_meta( $id, 'wprm_author_name', $recipe['author_name'] );
|
119 |
update_post_meta( $id, 'wprm_servings', $recipe['servings'] );
|
120 |
update_post_meta( $id, 'wprm_servings_unit', $recipe['servings_unit'] );
|
121 |
update_post_meta( $id, 'wprm_prep_time', $recipe['prep_time'] );
|
includes/admin/import/class-wprm-import-easyrecipe.php
CHANGED
@@ -165,6 +165,15 @@ class WPRM_Import_Easyrecipe extends WPRM_Import {
|
|
165 |
$wprm_field = is_object( $easyrecipe_field ) ? $this->replace_easyrecipe_tags( $easyrecipe_field->plaintext, true ) : '';
|
166 |
$recipe['notes'] = $wprm_field;
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
// Servings.
|
169 |
$servings = $recipe_html->find( 'span[class=yield]', 0 );
|
170 |
$easyrecipe_servings = is_object( $servings ) ? trim( $servings->plaintext ) : '';
|
165 |
$wprm_field = is_object( $easyrecipe_field ) ? $this->replace_easyrecipe_tags( $easyrecipe_field->plaintext, true ) : '';
|
166 |
$recipe['notes'] = $wprm_field;
|
167 |
|
168 |
+
// Author.
|
169 |
+
$easyrecipe_field = $recipe_html->find( 'span[class=author]', 0 );
|
170 |
+
$wprm_field = is_object( $easyrecipe_field ) ? $this->replace_easyrecipe_tags( $easyrecipe_field->plaintext, true ) : '';
|
171 |
+
$recipe['author_name'] = $wprm_field;
|
172 |
+
|
173 |
+
if ( '' !== trim( $recipe['author_name'] ) ) {
|
174 |
+
$recipe['author_display'] = 'custom';
|
175 |
+
}
|
176 |
+
|
177 |
// Servings.
|
178 |
$servings = $recipe_html->find( 'span[class=yield]', 0 );
|
179 |
$easyrecipe_servings = is_object( $servings ) ? trim( $servings->plaintext ) : '';
|
includes/admin/menu/class-wprm-admin-menu-addons.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Show Addons page in the backend menu.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 1.5.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/includes/admin
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Show Addons page in the backend menu.
|
14 |
+
*
|
15 |
+
* @since 1.5.0
|
16 |
+
* @package WP_Recipe_Maker
|
17 |
+
* @subpackage WP_Recipe_Maker/includes/admin
|
18 |
+
* @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
|
19 |
+
*/
|
20 |
+
class WPRM_Admin_Menu_Addons {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Register actions and filters.
|
24 |
+
*
|
25 |
+
* @since 1.5.0
|
26 |
+
*/
|
27 |
+
public static function init() {
|
28 |
+
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
|
29 |
+
add_action( 'admin_menu', array( __CLASS__, 'add_submenu_page' ), 19 );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Enqueue stylesheets and scripts.
|
34 |
+
*
|
35 |
+
* @since 1.5.0
|
36 |
+
*/
|
37 |
+
public static function enqueue() {
|
38 |
+
wp_enqueue_style( 'wprm-addons', WPRM_URL . 'assets/css/admin/addons.min.css', array(), WPRM_VERSION, 'all' );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Add the FAQ & Support submenu to the WPRM menu.
|
43 |
+
*
|
44 |
+
* @since 1.5.0
|
45 |
+
*/
|
46 |
+
public static function add_submenu_page() {
|
47 |
+
add_submenu_page( 'wprecipemaker', __( 'Add-Ons', 'wp-recipe-maker' ), __( 'Add-Ons', 'wp-recipe-maker' ), 'manage_options', 'wprm_addons', array( __CLASS__, 'page_template' ) );
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get the template for this submenu.
|
52 |
+
*
|
53 |
+
* @since 1.5.0
|
54 |
+
*/
|
55 |
+
public static function page_template() {
|
56 |
+
require_once( WPRM_DIR . 'templates/admin/menu/addons.php' );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
WPRM_Admin_Menu_Addons::init();
|
includes/admin/menu/class-wprm-admin-menu-faq.php
CHANGED
@@ -73,7 +73,7 @@ class WPRM_Admin_Menu_Faq {
|
|
73 |
* @since 1.0.0
|
74 |
*/
|
75 |
public static function add_submenu_page() {
|
76 |
-
add_submenu_page( 'wprecipemaker', 'FAQ & Support', 'FAQ & Support', 'manage_options', 'wprecipemaker', array( __CLASS__, 'page_template' ) );
|
77 |
}
|
78 |
|
79 |
/**
|
73 |
* @since 1.0.0
|
74 |
*/
|
75 |
public static function add_submenu_page() {
|
76 |
+
add_submenu_page( 'wprecipemaker', __( 'FAQ & Support', 'wp-recipe-maker' ), __( 'FAQ & Support', 'wp-recipe-maker' ), 'manage_options', 'wprecipemaker', array( __CLASS__, 'page_template' ) );
|
77 |
}
|
78 |
|
79 |
/**
|
includes/admin/modal/class-wprm-modal.php
CHANGED
@@ -42,10 +42,12 @@ class WPRM_Modal {
|
|
42 |
wp_enqueue_style( 'wprm-select2', WPRM_URL . 'vendor/select2/css/select2.min.css', array(), WPRM_VERSION, 'all' );
|
43 |
wp_enqueue_style( 'wprm-modal', WPRM_URL . 'assets/css/admin/modal.min.css', array(), WPRM_VERSION, 'all' );
|
44 |
|
45 |
-
wp_enqueue_script( '
|
|
|
|
|
46 |
wp_enqueue_script( 'wprm-select2', WPRM_URL . 'vendor/select2/js/select2.min.js', array( 'jquery' ), WPRM_VERSION, true );
|
47 |
wp_enqueue_script( 'wprm-modal', WPRM_URL . 'assets/js/admin/modal.js', array( 'jquery' ), WPRM_VERSION, true );
|
48 |
-
wp_enqueue_script( 'wprm-recipe-form', WPRM_URL . 'assets/js/admin/recipe-form.js', array( 'jquery', 'jquery-ui-sortable', 'wprm-modal', '
|
49 |
wp_enqueue_script( 'wprm-recipe-snippets', WPRM_URL . 'assets/js/admin/recipe-snippets.js', array( 'jquery', 'wprm-modal' ), WPRM_VERSION, true );
|
50 |
|
51 |
wp_localize_script( 'wprm-modal', 'wprm_modal', array(
|
@@ -58,6 +60,9 @@ class WPRM_Modal {
|
|
58 |
'media_button' => __( 'Use Image', 'wp-recipe-maker' ),
|
59 |
'shortcode_remove' => __( 'Are you sure you want to remove this recipe?', 'wp-recipe-maker' ),
|
60 |
),
|
|
|
|
|
|
|
61 |
));
|
62 |
}
|
63 |
|
42 |
wp_enqueue_style( 'wprm-select2', WPRM_URL . 'vendor/select2/css/select2.min.css', array(), WPRM_VERSION, 'all' );
|
43 |
wp_enqueue_style( 'wprm-modal', WPRM_URL . 'assets/css/admin/modal.min.css', array(), WPRM_VERSION, 'all' );
|
44 |
|
45 |
+
wp_enqueue_script( 'medium-editor', WPRM_URL . 'vendor/medium-editor/js/medium-editor.min.js', array( 'jquery' ), WPRM_VERSION, true );
|
46 |
+
wp_enqueue_script( 'rangy', WPRM_URL . 'vendor/rangy/rangy-core.js', array(), WPRM_VERSION, true );
|
47 |
+
wp_enqueue_script( 'wprm-rich-editor', WPRM_URL . 'assets/js/admin/rich-editor.js', array( 'jquery', 'medium-editor', 'rangy' ), WPRM_VERSION, true );
|
48 |
wp_enqueue_script( 'wprm-select2', WPRM_URL . 'vendor/select2/js/select2.min.js', array( 'jquery' ), WPRM_VERSION, true );
|
49 |
wp_enqueue_script( 'wprm-modal', WPRM_URL . 'assets/js/admin/modal.js', array( 'jquery' ), WPRM_VERSION, true );
|
50 |
+
wp_enqueue_script( 'wprm-recipe-form', WPRM_URL . 'assets/js/admin/recipe-form.js', array( 'jquery', 'jquery-ui-sortable', 'wprm-modal', 'medium-editor', 'wprm-select2' ), WPRM_VERSION, true );
|
51 |
wp_enqueue_script( 'wprm-recipe-snippets', WPRM_URL . 'assets/js/admin/recipe-snippets.js', array( 'jquery', 'wprm-modal' ), WPRM_VERSION, true );
|
52 |
|
53 |
wp_localize_script( 'wprm-modal', 'wprm_modal', array(
|
60 |
'media_button' => __( 'Use Image', 'wp-recipe-maker' ),
|
61 |
'shortcode_remove' => __( 'Are you sure you want to remove this recipe?', 'wp-recipe-maker' ),
|
62 |
),
|
63 |
+
'addons' => array(
|
64 |
+
'premium' => WPRM_Addons::is_active( 'premium' ),
|
65 |
+
),
|
66 |
));
|
67 |
}
|
68 |
|
includes/class-wp-recipe-maker.php
CHANGED
@@ -26,25 +26,26 @@
|
|
26 |
class WP_Recipe_Maker {
|
27 |
|
28 |
/**
|
29 |
-
*
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
-
*
|
40 |
*
|
41 |
* @since 1.0.0
|
42 |
*/
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
define( 'WPRM_URL', plugin_dir_url( dirname( __FILE__ ) ) );
|
48 |
}
|
49 |
|
50 |
/**
|
@@ -57,6 +58,7 @@ class WP_Recipe_Maker {
|
|
57 |
require_once( WPRM_DIR . 'includes/class-wprm-i18n.php' );
|
58 |
|
59 |
// Public.
|
|
|
60 |
require_once( WPRM_DIR . 'includes/public/class-wprm-api.php' );
|
61 |
require_once( WPRM_DIR . 'includes/public/class-wprm-comment-rating.php' );
|
62 |
require_once( WPRM_DIR . 'includes/public/class-wprm-fallback-recipe.php' );
|
@@ -68,6 +70,7 @@ class WP_Recipe_Maker {
|
|
68 |
require_once( WPRM_DIR . 'includes/public/class-wprm-settings.php' );
|
69 |
require_once( WPRM_DIR . 'includes/public/class-wprm-shortcode.php' );
|
70 |
require_once( WPRM_DIR . 'includes/public/class-wprm-taxonomies.php' );
|
|
|
71 |
require_once( WPRM_DIR . 'includes/public/class-wprm-template-manager.php' );
|
72 |
|
73 |
// Admin.
|
@@ -76,10 +79,11 @@ class WP_Recipe_Maker {
|
|
76 |
require_once( WPRM_DIR . 'includes/admin/import/class-wprm-import.php' );
|
77 |
|
78 |
// Menu.
|
|
|
79 |
require_once( WPRM_DIR . 'includes/admin/menu/class-wprm-admin-menu-faq.php' );
|
80 |
require_once( WPRM_DIR . 'includes/admin/menu/class-wprm-admin-menu.php' );
|
81 |
|
82 |
-
//
|
83 |
require_once( WPRM_DIR . 'includes/admin/modal/class-wprm-button.php' );
|
84 |
require_once( WPRM_DIR . 'includes/admin/modal/class-wprm-modal.php' );
|
85 |
require_once( WPRM_DIR . 'includes/admin/modal/class-wprm-shortcode-preview.php' );
|
26 |
class WP_Recipe_Maker {
|
27 |
|
28 |
/**
|
29 |
+
* Define any constants to be used in the plugin.
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
+
private function define_constants() {
|
34 |
+
define( 'WPRM_VERSION', '1.5.0' );
|
35 |
+
define( 'WPRM_POST_TYPE', 'wprm_recipe' );
|
36 |
+
define( 'WPRM_DIR', plugin_dir_path( dirname( __FILE__ ) ) );
|
37 |
+
define( 'WPRM_URL', plugin_dir_url( dirname( __FILE__ ) ) );
|
38 |
}
|
39 |
|
40 |
/**
|
41 |
+
* Make sure all is set up for the plugin to load.
|
42 |
*
|
43 |
* @since 1.0.0
|
44 |
*/
|
45 |
+
public function __construct() {
|
46 |
+
$this->define_constants();
|
47 |
+
$this->load_dependencies();
|
48 |
+
do_action( 'wprm_init' );
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
58 |
require_once( WPRM_DIR . 'includes/class-wprm-i18n.php' );
|
59 |
|
60 |
// Public.
|
61 |
+
require_once( WPRM_DIR . 'includes/public/class-wprm-addons.php' );
|
62 |
require_once( WPRM_DIR . 'includes/public/class-wprm-api.php' );
|
63 |
require_once( WPRM_DIR . 'includes/public/class-wprm-comment-rating.php' );
|
64 |
require_once( WPRM_DIR . 'includes/public/class-wprm-fallback-recipe.php' );
|
70 |
require_once( WPRM_DIR . 'includes/public/class-wprm-settings.php' );
|
71 |
require_once( WPRM_DIR . 'includes/public/class-wprm-shortcode.php' );
|
72 |
require_once( WPRM_DIR . 'includes/public/class-wprm-taxonomies.php' );
|
73 |
+
require_once( WPRM_DIR . 'includes/public/class-wprm-template-helper.php' );
|
74 |
require_once( WPRM_DIR . 'includes/public/class-wprm-template-manager.php' );
|
75 |
|
76 |
// Admin.
|
79 |
require_once( WPRM_DIR . 'includes/admin/import/class-wprm-import.php' );
|
80 |
|
81 |
// Menu.
|
82 |
+
require_once( WPRM_DIR . 'includes/admin/menu/class-wprm-admin-menu-addons.php' );
|
83 |
require_once( WPRM_DIR . 'includes/admin/menu/class-wprm-admin-menu-faq.php' );
|
84 |
require_once( WPRM_DIR . 'includes/admin/menu/class-wprm-admin-menu.php' );
|
85 |
|
86 |
+
// Modal.
|
87 |
require_once( WPRM_DIR . 'includes/admin/modal/class-wprm-button.php' );
|
88 |
require_once( WPRM_DIR . 'includes/admin/modal/class-wprm-modal.php' );
|
89 |
require_once( WPRM_DIR . 'includes/admin/modal/class-wprm-shortcode-preview.php' );
|
includes/public/class-wprm-addons.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Provide information about WP Recipe Maker addons.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 1.5.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/includes/public
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Provide information about WP Recipe Maker addons.
|
14 |
+
*
|
15 |
+
* @since 1.5.0
|
16 |
+
* @package WP_Recipe_Maker
|
17 |
+
* @subpackage WP_Recipe_Maker/includes/public
|
18 |
+
* @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
|
19 |
+
*/
|
20 |
+
class WPRM_Addons {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Register actions and filters.
|
24 |
+
*
|
25 |
+
* @since 1.5.0
|
26 |
+
*/
|
27 |
+
public static function init() {
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Check if a particular addon is active.
|
32 |
+
*
|
33 |
+
* @since 1.5.0
|
34 |
+
* @param mixed $addon Addon to check.
|
35 |
+
*/
|
36 |
+
public static function is_active( $addon ) {
|
37 |
+
return apply_filters( 'wprm_addon_active', false, $addon );
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
WPRM_Addons::init();
|
includes/public/class-wprm-api.php
CHANGED
@@ -35,11 +35,13 @@ class WPRM_Api {
|
|
35 |
* @since 1.4.0
|
36 |
*/
|
37 |
public static function api_register_recipe_data() {
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
}
|
44 |
|
45 |
/**
|
35 |
* @since 1.4.0
|
36 |
*/
|
37 |
public static function api_register_recipe_data() {
|
38 |
+
if ( function_exists( 'register_rest_field' ) ) { // Prevent issue with Jetpack.
|
39 |
+
register_rest_field( WPRM_POST_TYPE, 'recipe', array(
|
40 |
+
'get_callback' => array( __CLASS__, 'api_get_recipe_data' ),
|
41 |
+
'update_callback' => null,
|
42 |
+
'schema' => null,
|
43 |
+
));
|
44 |
+
}
|
45 |
}
|
46 |
|
47 |
/**
|
includes/public/class-wprm-comment-rating.php
CHANGED
@@ -66,18 +66,22 @@ class WPRM_Comment_Rating {
|
|
66 |
* @param mixed $text Comment text.
|
67 |
* @param object $comment Comment object.
|
68 |
*/
|
69 |
-
public static function add_stars_to_comment( $text, $comment ) {
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
-
return $
|
81 |
}
|
82 |
|
83 |
/**
|
66 |
* @param mixed $text Comment text.
|
67 |
* @param object $comment Comment object.
|
68 |
*/
|
69 |
+
public static function add_stars_to_comment( $text, $comment = null ) {
|
70 |
+
if ( null !== $comment ) {
|
71 |
+
$rating = intval( get_comment_meta( $comment->comment_ID, 'wprm-comment-rating', true ) );
|
72 |
+
|
73 |
+
$rating_html = '';
|
74 |
+
if ( $rating ) {
|
75 |
+
ob_start();
|
76 |
+
require( WPRM_DIR . 'templates/public/comment-rating.php' );
|
77 |
+
$rating_html = ob_get_contents();
|
78 |
+
ob_end_clean();
|
79 |
+
}
|
80 |
+
|
81 |
+
$text = $rating_html . $text;
|
82 |
}
|
83 |
|
84 |
+
return $text;
|
85 |
}
|
86 |
|
87 |
/**
|
includes/public/class-wprm-fallback-recipe.php
CHANGED
@@ -83,7 +83,8 @@ class WPRM_Fallback_Recipe {
|
|
83 |
* Get fallback HTML for a specific recipe.
|
84 |
*
|
85 |
* @since 1.0.0
|
86 |
-
* @param
|
|
|
87 |
*/
|
88 |
public static function get_fallback_recipe( $recipe_id, $args = array() ) {
|
89 |
$recipe = WPRM_Recipe_Manager::get_recipe( $recipe_id );
|
83 |
* Get fallback HTML for a specific recipe.
|
84 |
*
|
85 |
* @since 1.0.0
|
86 |
+
* @param int $recipe_id ID of the recipe we want to get the fallback HTML for.
|
87 |
+
* @param array $args Shortcode arguments to pass along in the fallback recipe.
|
88 |
*/
|
89 |
public static function get_fallback_recipe( $recipe_id, $args = array() ) {
|
90 |
$recipe = WPRM_Recipe_Manager::get_recipe( $recipe_id );
|
includes/public/class-wprm-metadata.php
CHANGED
@@ -34,10 +34,28 @@ class WPRM_Metadata {
|
|
34 |
* @param object $recipe Recipe to get the metadata for.
|
35 |
*/
|
36 |
public static function get_metadata_output( $recipe ) {
|
37 |
-
$metadata = self::get_metadata( $recipe );
|
38 |
return '<script type="application/ld+json">' . wp_json_encode( $metadata ) . '</script>';
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* Get the metadata for a recipe.
|
43 |
*
|
@@ -52,7 +70,7 @@ class WPRM_Metadata {
|
|
52 |
'name' => $recipe->name(),
|
53 |
'author' => array(
|
54 |
'@type' => 'Person',
|
55 |
-
'name' => $recipe->
|
56 |
),
|
57 |
'datePublished' => $recipe->date(),
|
58 |
'image' => $recipe->image_url( 'full' ),
|
@@ -115,12 +133,54 @@ class WPRM_Metadata {
|
|
115 |
}
|
116 |
|
117 |
// Nutrition.
|
118 |
-
$
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
'@type' => 'NutritionInformation',
|
122 |
-
|
123 |
-
);
|
124 |
}
|
125 |
|
126 |
// Rating.
|
34 |
* @param object $recipe Recipe to get the metadata for.
|
35 |
*/
|
36 |
public static function get_metadata_output( $recipe ) {
|
37 |
+
$metadata = self::sanitize_metadata( self::get_metadata( $recipe ) );
|
38 |
return '<script type="application/ld+json">' . wp_json_encode( $metadata ) . '</script>';
|
39 |
}
|
40 |
|
41 |
+
/**
|
42 |
+
* Santize metadata before outputting.
|
43 |
+
*
|
44 |
+
* @since 1.5.0
|
45 |
+
* @param mixed $metadata Metadata to sanitize.
|
46 |
+
*/
|
47 |
+
public static function sanitize_metadata( $metadata ) {
|
48 |
+
$sanitized = array();
|
49 |
+
if ( is_array( $metadata ) ) {
|
50 |
+
foreach ( $metadata as $key => $value ) {
|
51 |
+
$sanitized[ $key ] = self::sanitize_metadata( $value );
|
52 |
+
}
|
53 |
+
} else {
|
54 |
+
$sanitized = strip_shortcodes( wp_strip_all_tags( $metadata ) );
|
55 |
+
}
|
56 |
+
return $sanitized;
|
57 |
+
}
|
58 |
+
|
59 |
/**
|
60 |
* Get the metadata for a recipe.
|
61 |
*
|
70 |
'name' => $recipe->name(),
|
71 |
'author' => array(
|
72 |
'@type' => 'Person',
|
73 |
+
'name' => $recipe->author_meta(),
|
74 |
),
|
75 |
'datePublished' => $recipe->date(),
|
76 |
'image' => $recipe->image_url( 'full' ),
|
133 |
}
|
134 |
|
135 |
// Nutrition.
|
136 |
+
$nutrition_mapping = array(
|
137 |
+
'serving_size' => 'servingSize',
|
138 |
+
'calories' => 'calories',
|
139 |
+
'fat' => 'fatContent',
|
140 |
+
'saturated_fat' => 'saturatedFatContent',
|
141 |
+
'unsaturated_fat' => 'unsaturatedFatContent',
|
142 |
+
'trans_fat' => 'transFatContent',
|
143 |
+
'carbohydrates' => 'carbohydrateContent',
|
144 |
+
'sugar' => 'sugarContent',
|
145 |
+
'fiber' => 'fiberContent',
|
146 |
+
'protein' => 'proteinContent',
|
147 |
+
'cholesterol' => 'cholesterolContent',
|
148 |
+
'sodium' => 'sodiumContent',
|
149 |
+
);
|
150 |
+
$nutrition_metadata = array();
|
151 |
+
$nutrition = $recipe->nutrition();
|
152 |
+
|
153 |
+
// Calculate unsaturated fat.
|
154 |
+
if ( isset( $nutrition['polyunsaturated_fat'] ) && isset( $nutrition['monounsaturated_fat'] ) ) {
|
155 |
+
$nutrition['unsaturated_fat'] = $nutrition['polyunsaturated_fat'] + $nutrition['monounsaturated_fat'];
|
156 |
+
} elseif ( isset( $nutrition['polyunsaturated_fat'] ) ) {
|
157 |
+
$nutrition['unsaturated_fat'] = $nutrition['polyunsaturated_fat'];
|
158 |
+
} elseif ( isset( $nutrition['monounsaturated_fat'] ) ) {
|
159 |
+
$nutrition['unsaturated_fat'] = $nutrition['monounsaturated_fat'];
|
160 |
+
}
|
161 |
+
|
162 |
+
foreach ( $nutrition as $field => $value ) {
|
163 |
+
if ( array_key_exists( $field, $nutrition_mapping ) ) {
|
164 |
+
$unit = esc_html__( 'g', 'wp-recipe-maker' );
|
165 |
+
|
166 |
+
if ( 'calories' === $field ) {
|
167 |
+
$unit = esc_html__( 'kcal', 'wp-recipe-maker' );
|
168 |
+
} elseif ( 'cholesterol' === $field || 'sodium' === $field ) {
|
169 |
+
$unit = esc_html__( 'mg', 'wp-recipe-maker' );
|
170 |
+
}
|
171 |
+
|
172 |
+
$nutrition_metadata[ $nutrition_mapping[ $field ] ] = $value . ' ' . $unit;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
if ( count( $nutrition_metadata ) > 0 ) {
|
177 |
+
if ( ! isset( $nutrition_metadata['servingSize'] ) ) {
|
178 |
+
$nutrition_metadata['servingSize'] = esc_html__( '1 serving', 'wp-recipe-maker' );
|
179 |
+
}
|
180 |
+
|
181 |
+
$metadata['nutrition'] = array_merge( array(
|
182 |
'@type' => 'NutritionInformation',
|
183 |
+
), $nutrition_metadata );
|
|
|
184 |
}
|
185 |
|
186 |
// Rating.
|
includes/public/class-wprm-print.php
CHANGED
@@ -60,11 +60,19 @@ class WPRM_Print {
|
|
60 |
|
61 |
$styles = WPRM_Template_Manager::get_template_styles( $recipe, 'print' );
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
// Fix for IE.
|
64 |
header( 'HTTP/1.1 200 OK' );
|
65 |
|
66 |
$charset = get_bloginfo( 'charset' );
|
67 |
-
$print_html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '" />' . $styles . '</head><body class="wprm-print">';
|
68 |
$print_html .= WPRM_Template_Manager::get_template( $recipe, 'print' );
|
69 |
$print_html .= '</body></html>';
|
70 |
echo $print_html;
|
60 |
|
61 |
$styles = WPRM_Template_Manager::get_template_styles( $recipe, 'print' );
|
62 |
|
63 |
+
$scripts = '';
|
64 |
+
if ( WPRM_Addons::is_active( 'premium' ) ) {
|
65 |
+
$scripts .= '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>';
|
66 |
+
$scripts .= '<script src="' . WPRMP_URL . 'assets/js/public/servings-changer.js"></script>';
|
67 |
+
} else {
|
68 |
+
$scripts .= '<script>wprm = {}; wprm.set_print_servings = function(servings) {};</script>';
|
69 |
+
}
|
70 |
+
|
71 |
// Fix for IE.
|
72 |
header( 'HTTP/1.1 200 OK' );
|
73 |
|
74 |
$charset = get_bloginfo( 'charset' );
|
75 |
+
$print_html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '" />' . $styles . $scripts . '</head><body class="wprm-print">';
|
76 |
$print_html .= WPRM_Template_Manager::get_template( $recipe, 'print' );
|
77 |
$print_html .= '</body></html>';
|
78 |
echo $print_html;
|
includes/public/class-wprm-recipe.php
CHANGED
@@ -64,6 +64,8 @@ class WPRM_Recipe {
|
|
64 |
$recipe['name'] = $this->name();
|
65 |
$recipe['summary'] = $this->summary();
|
66 |
|
|
|
|
|
67 |
$recipe['servings'] = $this->servings();
|
68 |
$recipe['servings_unit'] = $this->servings_unit();
|
69 |
$recipe['prep_time'] = $this->prep_time();
|
@@ -112,6 +114,54 @@ class WPRM_Recipe {
|
|
112 |
* @since 1.0.0
|
113 |
*/
|
114 |
public function author() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
$author_id = $this->post->post_author;
|
116 |
|
117 |
if ( $author_id ) {
|
@@ -238,7 +288,7 @@ class WPRM_Recipe {
|
|
238 |
}
|
239 |
|
240 |
if ( $rating['count'] > 0 ) {
|
241 |
-
$rating['average'] = ceil( $rating['total'] / $rating['count'] * 100) / 100;
|
242 |
}
|
243 |
|
244 |
return $rating;
|
64 |
$recipe['name'] = $this->name();
|
65 |
$recipe['summary'] = $this->summary();
|
66 |
|
67 |
+
$recipe['author_display'] = $this->author_display();
|
68 |
+
$recipe['author_name'] = $this->custom_author_name();
|
69 |
$recipe['servings'] = $this->servings();
|
70 |
$recipe['servings_unit'] = $this->servings_unit();
|
71 |
$recipe['prep_time'] = $this->prep_time();
|
114 |
* @since 1.0.0
|
115 |
*/
|
116 |
public function author() {
|
117 |
+
switch ( $this->author_display() ) {
|
118 |
+
case 'post_author':
|
119 |
+
return $this->post_author_name();
|
120 |
+
case 'custom':
|
121 |
+
return $this->custom_author_name();
|
122 |
+
default:
|
123 |
+
return '';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Get the recipe author display option.
|
129 |
+
*
|
130 |
+
* @since 1.5.0
|
131 |
+
*/
|
132 |
+
public function author_display() {
|
133 |
+
return $this->meta( 'wprm_author_display', 'disabled' );
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Get the recipe author to use in the metadata.
|
138 |
+
*
|
139 |
+
* @since 1.5.0
|
140 |
+
*/
|
141 |
+
public function author_meta() {
|
142 |
+
switch ( $this->author_display() ) {
|
143 |
+
case 'custom':
|
144 |
+
return $this->custom_author_name();
|
145 |
+
default:
|
146 |
+
return $this->post_author_name();
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Get the recipe custom author name.
|
152 |
+
*
|
153 |
+
* @since 1.5.0
|
154 |
+
*/
|
155 |
+
public function custom_author_name() {
|
156 |
+
return $this->meta( 'wprm_author_name', '' );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Get the recipe post author name.
|
161 |
+
*
|
162 |
+
* @since 1.5.0
|
163 |
+
*/
|
164 |
+
public function post_author_name() {
|
165 |
$author_id = $this->post->post_author;
|
166 |
|
167 |
if ( $author_id ) {
|
288 |
}
|
289 |
|
290 |
if ( $rating['count'] > 0 ) {
|
291 |
+
$rating['average'] = ceil( $rating['total'] / $rating['count'] * 100 ) / 100;
|
292 |
}
|
293 |
|
294 |
return $rating;
|
includes/public/class-wprm-settings.php
CHANGED
@@ -47,7 +47,9 @@ class WPRM_Settings {
|
|
47 |
public static function init() {
|
48 |
add_action( 'admin_menu', array( __CLASS__, 'add_submenu_page' ), 20 );
|
49 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
|
50 |
-
add_action( '
|
|
|
|
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -70,13 +72,25 @@ class WPRM_Settings {
|
|
70 |
add_submenu_page( 'wprecipemaker', __( 'WPRM Settings', 'wp-recipe-maker' ), __( 'Settings', 'wp-recipe-maker' ), 'manage_options', 'wprm_settings', array( __CLASS__, 'settings_page_template' ) );
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
/**
|
74 |
* Get the template for the settings page.
|
75 |
*
|
76 |
* @since 1.2.0
|
77 |
*/
|
78 |
public static function settings_page_template() {
|
79 |
-
require_once( WPRM_DIR . 'templates/admin/settings
|
80 |
}
|
81 |
|
82 |
/**
|
@@ -91,7 +105,7 @@ class WPRM_Settings {
|
|
91 |
if ( isset( $settings[ $setting ] ) ) {
|
92 |
return $settings[ $setting ];
|
93 |
} else {
|
94 |
-
$defaults = self
|
95 |
if ( isset( $defaults[ $setting ] ) ) {
|
96 |
return $defaults[ $setting ];
|
97 |
} else {
|
@@ -100,6 +114,15 @@ class WPRM_Settings {
|
|
100 |
}
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/**
|
104 |
* Get all the settings.
|
105 |
*
|
@@ -123,6 +146,23 @@ class WPRM_Settings {
|
|
123 |
self::$settings = get_option( 'wprm_settings', array() );
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
/**
|
127 |
* Save the settings.
|
128 |
*
|
@@ -133,7 +173,7 @@ class WPRM_Settings {
|
|
133 |
$default_recipe_template = isset( $_POST['default_recipe_template'] ) ? sanitize_title( wp_unslash( $_POST['default_recipe_template'] ) ) : ''; // Input var okay.
|
134 |
$default_print_template = isset( $_POST['default_print_template'] ) ? sanitize_title( wp_unslash( $_POST['default_print_template'] ) ) : ''; // Input var okay.
|
135 |
|
136 |
-
$settings =
|
137 |
|
138 |
if ( $default_recipe_template ) {
|
139 |
$settings['default_recipe_template'] = $default_recipe_template;
|
@@ -143,8 +183,7 @@ class WPRM_Settings {
|
|
143 |
$settings['default_print_template'] = $default_print_template;
|
144 |
}
|
145 |
|
146 |
-
|
147 |
-
self::$settings = $settings;
|
148 |
}
|
149 |
wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings' ) );
|
150 |
exit();
|
47 |
public static function init() {
|
48 |
add_action( 'admin_menu', array( __CLASS__, 'add_submenu_page' ), 20 );
|
49 |
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue' ) );
|
50 |
+
add_action( 'admin_post_wprm_settings_appearance', array( __CLASS__, 'form_save_settings' ) );
|
51 |
+
|
52 |
+
add_action( 'wprm_settings_page', array( __CLASS__, 'settings_page' ) );
|
53 |
}
|
54 |
|
55 |
/**
|
72 |
add_submenu_page( 'wprecipemaker', __( 'WPRM Settings', 'wp-recipe-maker' ), __( 'Settings', 'wp-recipe-maker' ), 'manage_options', 'wprm_settings', array( __CLASS__, 'settings_page_template' ) );
|
73 |
}
|
74 |
|
75 |
+
/**
|
76 |
+
* Settings page to output.
|
77 |
+
*
|
78 |
+
* @since 1.5.0
|
79 |
+
* @param mixed $sub Sub settings page to display.
|
80 |
+
*/
|
81 |
+
public static function settings_page( $sub ) {
|
82 |
+
if ( 'appearance' === $sub ) {
|
83 |
+
require_once( WPRM_DIR . 'templates/admin/settings/appearance.php' );
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
/**
|
88 |
* Get the template for the settings page.
|
89 |
*
|
90 |
* @since 1.2.0
|
91 |
*/
|
92 |
public static function settings_page_template() {
|
93 |
+
require_once( WPRM_DIR . 'templates/admin/settings.php' );
|
94 |
}
|
95 |
|
96 |
/**
|
105 |
if ( isset( $settings[ $setting ] ) ) {
|
106 |
return $settings[ $setting ];
|
107 |
} else {
|
108 |
+
$defaults = self::get_defaults();
|
109 |
if ( isset( $defaults[ $setting ] ) ) {
|
110 |
return $defaults[ $setting ];
|
111 |
} else {
|
114 |
}
|
115 |
}
|
116 |
|
117 |
+
/**
|
118 |
+
* Get the default settings.
|
119 |
+
*
|
120 |
+
* @since 1.5.0
|
121 |
+
*/
|
122 |
+
public static function get_defaults() {
|
123 |
+
return apply_filters( 'wprm_settings_defaults', self::$defaults );
|
124 |
+
}
|
125 |
+
|
126 |
/**
|
127 |
* Get all the settings.
|
128 |
*
|
146 |
self::$settings = get_option( 'wprm_settings', array() );
|
147 |
}
|
148 |
|
149 |
+
/**
|
150 |
+
* Update the plugin settings.
|
151 |
+
*
|
152 |
+
* @since 1.5.0
|
153 |
+
* @param array $settings_to_update Settings to update.
|
154 |
+
*/
|
155 |
+
public static function update_settings( $settings_to_update ) {
|
156 |
+
$settings = self::get_settings();
|
157 |
+
|
158 |
+
if ( is_array( $settings_to_update ) ) {
|
159 |
+
$settings = array_merge( $settings, $settings_to_update );
|
160 |
+
}
|
161 |
+
|
162 |
+
update_option( 'wprm_settings', $settings );
|
163 |
+
self::$settings = $settings;
|
164 |
+
}
|
165 |
+
|
166 |
/**
|
167 |
* Save the settings.
|
168 |
*
|
173 |
$default_recipe_template = isset( $_POST['default_recipe_template'] ) ? sanitize_title( wp_unslash( $_POST['default_recipe_template'] ) ) : ''; // Input var okay.
|
174 |
$default_print_template = isset( $_POST['default_print_template'] ) ? sanitize_title( wp_unslash( $_POST['default_print_template'] ) ) : ''; // Input var okay.
|
175 |
|
176 |
+
$settings = array();
|
177 |
|
178 |
if ( $default_recipe_template ) {
|
179 |
$settings['default_recipe_template'] = $default_recipe_template;
|
183 |
$settings['default_print_template'] = $default_print_template;
|
184 |
}
|
185 |
|
186 |
+
self::update_settings( $settings );
|
|
|
187 |
}
|
188 |
wp_safe_redirect( admin_url( 'admin.php?page=wprm_settings' ) );
|
189 |
exit();
|
includes/public/class-wprm-shortcode.php
CHANGED
@@ -28,6 +28,9 @@ class WPRM_Shortcode {
|
|
28 |
add_shortcode( 'wprm-recipe', array( __CLASS__, 'recipe_shortcode' ) );
|
29 |
add_shortcode( 'wprm-recipe-jump', array( __CLASS__, 'jump_to_recipe_shortcode' ) );
|
30 |
add_shortcode( 'wprm-recipe-print', array( __CLASS__, 'print_recipe_shortcode' ) );
|
|
|
|
|
|
|
31 |
|
32 |
add_filter( 'content_edit_pre', array( __CLASS__, 'replace_wpultimaterecipe_shortcode' ) );
|
33 |
|
@@ -176,6 +179,75 @@ class WPRM_Shortcode {
|
|
176 |
return '';
|
177 |
}
|
178 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
|
181 |
WPRM_Shortcode::init();
|
28 |
add_shortcode( 'wprm-recipe', array( __CLASS__, 'recipe_shortcode' ) );
|
29 |
add_shortcode( 'wprm-recipe-jump', array( __CLASS__, 'jump_to_recipe_shortcode' ) );
|
30 |
add_shortcode( 'wprm-recipe-print', array( __CLASS__, 'print_recipe_shortcode' ) );
|
31 |
+
add_shortcode( 'wprm-nutrition-label', array( __CLASS__, 'nutrition_label_shortcode' ) );
|
32 |
+
add_shortcode( 'adjustable', array( __CLASS__, 'adjustable_shortcode' ) );
|
33 |
+
add_shortcode( 'timer', array( __CLASS__, 'timer_shortcode' ) );
|
34 |
|
35 |
add_filter( 'content_edit_pre', array( __CLASS__, 'replace_wpultimaterecipe_shortcode' ) );
|
36 |
|
179 |
return '';
|
180 |
}
|
181 |
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Output for the nutrition label shortcode.
|
185 |
+
*
|
186 |
+
* @since 1.5.0
|
187 |
+
* @param array $atts Options passed along with the shortcode.
|
188 |
+
*/
|
189 |
+
public static function nutrition_label_shortcode( $atts ) {
|
190 |
+
$atts = shortcode_atts( array(
|
191 |
+
'id' => '0',
|
192 |
+
), $atts, 'wprm_nutrition_label' );
|
193 |
+
|
194 |
+
$recipe_id = intval( $atts['id'] );
|
195 |
+
|
196 |
+
// Get first recipe in post content if no ID is set.
|
197 |
+
if ( ! $recipe_id ) {
|
198 |
+
$parent_post = get_post();
|
199 |
+
$recipes = WPRM_Recipe_Manager::get_recipe_ids_from_content( $parent_post->post_content );
|
200 |
+
|
201 |
+
if ( isset( $recipes[0] ) ) {
|
202 |
+
$recipe_id = $recipes[0];
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( $recipe_id && WPRM_Addons::is_active( 'premium' ) ) {
|
207 |
+
$recipe = WPRM_Recipe_Manager::get_recipe( $recipe_id );
|
208 |
+
return WPRMP_Nutrition_Label::nutrition_label( $recipe );
|
209 |
+
} else {
|
210 |
+
return '';
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Output for the adjustable shortcode.
|
216 |
+
*
|
217 |
+
* @since 1.5.0
|
218 |
+
* @param array $atts Shortcode attributes.
|
219 |
+
* @param mixed $content Content in between the shortcodes.
|
220 |
+
*/
|
221 |
+
public static function adjustable_shortcode( $atts, $content ) {
|
222 |
+
return '<span class="wprm-dynamic-quantity">' . $content . '</span>';
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Output for the timer shortcode.
|
227 |
+
*
|
228 |
+
* @since 1.5.0
|
229 |
+
* @param array $atts Shortcode attributes.
|
230 |
+
* @param mixed $content Content in between the shortcodes.
|
231 |
+
*/
|
232 |
+
public static function timer_shortcode( $atts, $content ) {
|
233 |
+
$atts = shortcode_atts( array(
|
234 |
+
'seconds' => '0',
|
235 |
+
'minutes' => '0',
|
236 |
+
'hours' => '0',
|
237 |
+
), $atts, 'wprm_timer' );
|
238 |
+
|
239 |
+
$seconds = intval( $atts['seconds'] );
|
240 |
+
$minutes = intval( $atts['minutes'] );
|
241 |
+
$hours = intval( $atts['hours'] );
|
242 |
+
|
243 |
+
$seconds = $seconds + (60 * $minutes) + (60 * 60 * $hours);
|
244 |
+
|
245 |
+
if ( $seconds > 0 ) {
|
246 |
+
return '<span class="wprm-timer" data-seconds="' . esc_attr( $seconds ) . '">' . $content . '</span>';
|
247 |
+
} else {
|
248 |
+
return $content;
|
249 |
+
}
|
250 |
+
}
|
251 |
}
|
252 |
|
253 |
WPRM_Shortcode::init();
|
includes/public/class-wprm-template-helper.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Providing helper functions to use in the recipe template.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 1.5.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/includes/public
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Providing helper functions to use in the recipe template.
|
14 |
+
*
|
15 |
+
* @since 1.5.0
|
16 |
+
* @package WP_Recipe_Maker
|
17 |
+
* @subpackage WP_Recipe_Maker/includes/public
|
18 |
+
* @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
|
19 |
+
*/
|
20 |
+
class WPRM_Template_Helper {
|
21 |
+
/**
|
22 |
+
* Display the ingredient name with or without link.
|
23 |
+
*
|
24 |
+
* @since 1.5.0
|
25 |
+
* @param array $ingredient Ingredient to display.
|
26 |
+
* @param boolean $show_link Wether to display the ingredient link if present.
|
27 |
+
*/
|
28 |
+
public static function ingredient_name( $ingredient, $show_link = false ) {
|
29 |
+
$name = $ingredient['name'];
|
30 |
+
$show_link = WPRM_Addons::is_active( 'premium' ) ? $show_link : false;
|
31 |
+
|
32 |
+
$link = $show_link ? get_term_meta( $ingredient['id'], 'wprmp_ingredient_link', true ) : false;
|
33 |
+
|
34 |
+
if ( $link ) {
|
35 |
+
$target = WPRM_Settings::get( 'ingredient_links_open_in_new_tab' ) ? ' target="_blank"' : '';
|
36 |
+
$nofollow = WPRM_Settings::get( 'ingredient_links_use_nofollow' ) ? ' rel="nofollow"' : '';
|
37 |
+
|
38 |
+
return '<a href="' . $link . '"' . $target . $nofollow . '>' . $name . '</a>';
|
39 |
+
} else {
|
40 |
+
return $name;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
includes/public/class-wprm-template-manager.php
CHANGED
@@ -76,6 +76,9 @@ class WPRM_Template_Manager {
|
|
76 |
$template = ob_get_contents();
|
77 |
ob_end_clean();
|
78 |
|
|
|
|
|
|
|
79 |
return do_shortcode( $template );
|
80 |
}
|
81 |
|
76 |
$template = ob_get_contents();
|
77 |
ob_end_clean();
|
78 |
|
79 |
+
// Prevent infinite shortcode loop.
|
80 |
+
$template = preg_replace( "/\[wprm-recipe\s+id=\"?'?" . $recipe->id() . "\"?'?\]/im", '', $template );
|
81 |
+
|
82 |
return do_shortcode( $template );
|
83 |
}
|
84 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: BrechtVds
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QG7KZMGFU325Y
|
4 |
Tags: recipe, recipes, ingredients, food, cooking, seo, schema.org, json-ld
|
5 |
-
Requires at least: 4.
|
6 |
-
Tested up to: 4.6
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -35,13 +35,7 @@ Currently using another recipe plugin? No problem! You can easily migrate all yo
|
|
35 |
* WP Ultimate Recipe
|
36 |
* (More coming soon!)
|
37 |
|
38 |
-
This plugin is in active development
|
39 |
-
|
40 |
-
* Adjustable servings
|
41 |
-
* More recipe templates
|
42 |
-
* Template customization options
|
43 |
-
|
44 |
-
Feel free to contact us with any feature requests or ideas.
|
45 |
|
46 |
== Installation ==
|
47 |
|
@@ -75,6 +69,13 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 1.4.0 =
|
79 |
* Feature: Access recipes though REST API
|
80 |
* Feature: Choose specific recipe template in shortcode
|
@@ -120,6 +121,9 @@ Yes! We pride ourselves on offering awesome support and almost always answer sup
|
|
120 |
|
121 |
== Upgrade notice ==
|
122 |
|
|
|
|
|
|
|
123 |
= 1.4.0 =
|
124 |
A few important bug fixes and improvements
|
125 |
|
2 |
Contributors: BrechtVds
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QG7KZMGFU325Y
|
4 |
Tags: recipe, recipes, ingredients, food, cooking, seo, schema.org, json-ld
|
5 |
+
Requires at least: 4.4
|
6 |
+
Tested up to: 4.6.1
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
35 |
* WP Ultimate Recipe
|
36 |
* (More coming soon!)
|
37 |
|
38 |
+
This plugin is in active development. Feel free to contact us with any feature requests or ideas.
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
== Installation ==
|
41 |
|
69 |
|
70 |
== Changelog ==
|
71 |
|
72 |
+
= 1.5.0 =
|
73 |
+
* Feature: Set recipe author
|
74 |
+
* Improvement: Sanitize metadata before outputting
|
75 |
+
* Fix: Warning when adding comments as a subscriber
|
76 |
+
* Fix: Compatibility issue with Jetpack
|
77 |
+
* Fix: Prevent infinite shortcode loop
|
78 |
+
|
79 |
= 1.4.0 =
|
80 |
* Feature: Access recipes though REST API
|
81 |
* Feature: Choose specific recipe template in shortcode
|
121 |
|
122 |
== Upgrade notice ==
|
123 |
|
124 |
+
= 1.5.0 =
|
125 |
+
Fixed a few issues and added the recipe author field.
|
126 |
+
|
127 |
= 1.4.0 =
|
128 |
A few important bug fixes and improvements
|
129 |
|
templates/admin/menu/addons.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Template for the addons page.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 1.5.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/templates/admin/menu
|
10 |
+
*/
|
11 |
+
|
12 |
+
?>
|
13 |
+
|
14 |
+
<div class="wrap wprm-addons">
|
15 |
+
<h1><?php echo esc_html_e( 'Add-Ons', 'wp-recipe-maker' ); ?></h1>
|
16 |
+
<p>We're working very hard to release <strong>Premium add-ons that will extend the functionality</strong> of WP Recipe Maker.</p>
|
17 |
+
<p>Sign up using the form below to get notified as soon as add-ons are available.</p>
|
18 |
+
<?php
|
19 |
+
$current_user = wp_get_current_user();
|
20 |
+
$email = $current_user->user_email;
|
21 |
+
?>
|
22 |
+
<form action="https://www.getdrip.com/forms/2300696/submissions" method="post" class="wprm-drip-form" data-drip-embedded-form="2300696" target="_blank">
|
23 |
+
<div>
|
24 |
+
<label for="fields[email]">Email Address</label><br />
|
25 |
+
<input type="email" id="fields[email]" name="fields[email]" value="<?php echo esc_attr( $email ); ?>" />
|
26 |
+
</div>
|
27 |
+
<div>
|
28 |
+
<input type="submit" name="submit" value="Let me know when it's ready!" class="button button-primary" data-drip-attribute="sign-up-button" />
|
29 |
+
</div>
|
30 |
+
</form>
|
31 |
+
</div>
|
templates/admin/menu/faq/welcome.php
CHANGED
@@ -37,6 +37,5 @@ $website = get_site_url();
|
|
37 |
</div>
|
38 |
<div>
|
39 |
<input type="submit" name="submit" value="I want you to promote my website!" class="button button-primary" data-drip-attribute="sign-up-button" />
|
40 |
-
<p class="wprm-disclaimer">Make sure to confirm that you want this by clicking the link in the email!</p>
|
41 |
</div>
|
42 |
</form>
|
37 |
</div>
|
38 |
<div>
|
39 |
<input type="submit" name="submit" value="I want you to promote my website!" class="button button-primary" data-drip-attribute="sign-up-button" />
|
|
|
40 |
</div>
|
41 |
</form>
|
templates/admin/menu/faq/whats_new.php
CHANGED
@@ -12,6 +12,15 @@
|
|
12 |
?>
|
13 |
|
14 |
<h3>Latest Update (<?php echo esc_html( $version ); ?>)</h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
<ul>
|
16 |
<li>Feature: Access recipes though REST API</li>
|
17 |
<li>Feature: Choose specific recipe template in shortcode</li>
|
12 |
?>
|
13 |
|
14 |
<h3>Latest Update (<?php echo esc_html( $version ); ?>)</h3>
|
15 |
+
<ul>
|
16 |
+
<li>Feature: Set recipe author</li>
|
17 |
+
<li>Improvement: Sanitize metadata before outputting</li>
|
18 |
+
<li>Fix: Warning when adding comments as a subscriber</li>
|
19 |
+
<li>Fix: Compatibility issue with Jetpack</li>
|
20 |
+
<li>Fix: Prevent infinite shortcode loop</li>
|
21 |
+
</ul>
|
22 |
+
|
23 |
+
<h3>1.4.0</h3>
|
24 |
<ul>
|
25 |
<li>Feature: Access recipes though REST API</li>
|
26 |
<li>Feature: Choose specific recipe template in shortcode</li>
|
templates/admin/modal/shortcode-preview.php
CHANGED
@@ -17,5 +17,5 @@ if ( $image ) :
|
|
17 |
<span contentEditable="false" style="display: inline-block; float: left; margin: 0 10px 10px 0;"><?php echo wp_kses_post( $image ); ?></span>
|
18 |
<?php endif; // Image. ?>
|
19 |
<span contentEditable="false" style="display: inline-block; margin-bottom: 10px;"><?php echo esc_html( $recipe->name() ); ?></span>
|
20 |
-
<span contentEditable="false" style="display: block; margin-bottom: 10px;"><?php echo esc_html( wp_strip_all_tags( $recipe->summary() ) ); ?></span>
|
21 |
<span contentEditable="false" style="display: block; clear: both; height: 1px; line-height: 1px;"> </span>
|
17 |
<span contentEditable="false" style="display: inline-block; float: left; margin: 0 10px 10px 0;"><?php echo wp_kses_post( $image ); ?></span>
|
18 |
<?php endif; // Image. ?>
|
19 |
<span contentEditable="false" style="display: inline-block; margin-bottom: 10px;"><?php echo esc_html( $recipe->name() ); ?></span>
|
20 |
+
<span contentEditable="false" style="display: block; margin-bottom: 10px;"><?php echo esc_html( strip_shortcodes( wp_strip_all_tags( $recipe->summary() ) ) ); ?></span>
|
21 |
<span contentEditable="false" style="display: block; clear: both; height: 1px; line-height: 1px;"> </span>
|
templates/admin/modal/tabs/recipe-details.php
CHANGED
@@ -11,41 +11,54 @@
|
|
11 |
|
12 |
?>
|
13 |
|
14 |
-
<div class="wprm-recipe-details-form">
|
15 |
-
<div class="wprm-recipe-
|
16 |
<label for="wprm-recipe-image-id"><?php esc_html_e( 'Image', 'wp-recipe-maker' ); ?></label>
|
17 |
<button type="button" class="button wprm-recipe-image-add"><?php esc_html_e( 'Add Image', 'wp-recipe-maker' ); ?></button>
|
18 |
<button type="button" class="button wprm-recipe-image-remove hidden"><?php esc_html_e( 'Remove Image', 'wp-recipe-maker' ); ?></button>
|
19 |
<input type="hidden" id="wprm-recipe-image-id" />
|
20 |
<div class="wprm-recipe-image-preview"></div>
|
21 |
</div>
|
22 |
-
<div class="wprm-recipe-
|
23 |
<label for="wprm-recipe-name"><?php esc_html_e( 'Name', 'wp-recipe-maker' ); ?></label>
|
24 |
<input type="text" id="wprm-recipe-name" placeholder="<?php esc_attr_e( 'Recipe Name', 'wp-recipe-maker' ); ?>" />
|
25 |
</div>
|
26 |
-
<div class="wprm-recipe-
|
27 |
<label for="wprm-recipe-summary"><?php esc_html_e( 'Summary', 'wp-recipe-maker' ); ?></label>
|
28 |
<textarea id="wprm-recipe-summary" class="wprm-rich-editor" rows="4"></textarea>
|
29 |
</div>
|
30 |
-
<div class="wprm-recipe-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
<label for="wprm-recipe-servings"><?php esc_html_e( 'Servings', 'wp-recipe-maker' ); ?></label>
|
32 |
<input type="number" id="wprm-recipe-servings" placeholder="4" /> <input type="text" id="wprm-recipe-servings-unit" placeholder="<?php esc_attr_e( 'people', 'wp-recipe-maker' ); ?>" />
|
33 |
</div>
|
34 |
-
|
|
|
35 |
<label for="wprm-recipe-calories"><?php esc_html_e( 'Calories', 'wp-recipe-maker' ); ?></label>
|
36 |
<input type="number" id="wprm-recipe-calories" placeholder="280" /> <?php esc_html_e( 'kcal', 'wp-recipe-maker' ); ?>
|
37 |
</div>
|
38 |
-
|
|
|
39 |
<label for="wprm-recipe-prep-time"><?php esc_html_e( 'Prep Time', 'wp-recipe-maker' ); ?></label>
|
40 |
<input type="number" id="wprm-recipe-prep-time" class="wprm-recipe-time" placeholder="10" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
|
41 |
-
</div><div class="wprm-recipe-
|
42 |
<label for="wprm-recipe-cook-time"><?php esc_html_e( 'Cook Time', 'wp-recipe-maker' ); ?></label>
|
43 |
<input type="number" id="wprm-recipe-cook-time" class="wprm-recipe-time" placeholder="20" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
|
44 |
-
</div><div class="wprm-recipe-
|
45 |
<label for="wprm-recipe-total-time"><?php esc_html_e( 'Total Time', 'wp-recipe-maker' ); ?></label>
|
46 |
<input type="number" id="wprm-recipe-total-time" class="wprm-recipe-time" placeholder="30" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
|
47 |
</div>
|
48 |
-
<div class="wprm-recipe-
|
49 |
<label for="wprm-recipe-tag-course"><?php esc_html_e( 'Course', 'wp-recipe-maker' ); ?></label>
|
50 |
<select id="wprm-recipe-tag-course" class="wprm-recipe-tags" multiple>
|
51 |
<?php
|
@@ -59,7 +72,7 @@
|
|
59 |
}
|
60 |
?>
|
61 |
</select>
|
62 |
-
</div><div class="wprm-recipe-
|
63 |
<label for="wprm-recipe-tag-cuisine"><?php esc_html_e( 'Cuisine', 'wp-recipe-maker' ); ?></label>
|
64 |
<select id="wprm-recipe-tag-cuisine" class="wprm-recipe-tags" multiple>
|
65 |
<?php
|
11 |
|
12 |
?>
|
13 |
|
14 |
+
<div class="wprm-recipe-form wprm-recipe-details-form">
|
15 |
+
<div class="wprm-recipe-form-container wprm-recipe-image-container">
|
16 |
<label for="wprm-recipe-image-id"><?php esc_html_e( 'Image', 'wp-recipe-maker' ); ?></label>
|
17 |
<button type="button" class="button wprm-recipe-image-add"><?php esc_html_e( 'Add Image', 'wp-recipe-maker' ); ?></button>
|
18 |
<button type="button" class="button wprm-recipe-image-remove hidden"><?php esc_html_e( 'Remove Image', 'wp-recipe-maker' ); ?></button>
|
19 |
<input type="hidden" id="wprm-recipe-image-id" />
|
20 |
<div class="wprm-recipe-image-preview"></div>
|
21 |
</div>
|
22 |
+
<div class="wprm-recipe-form-container">
|
23 |
<label for="wprm-recipe-name"><?php esc_html_e( 'Name', 'wp-recipe-maker' ); ?></label>
|
24 |
<input type="text" id="wprm-recipe-name" placeholder="<?php esc_attr_e( 'Recipe Name', 'wp-recipe-maker' ); ?>" />
|
25 |
</div>
|
26 |
+
<div class="wprm-recipe-form-container wprm-recipe-summary-container">
|
27 |
<label for="wprm-recipe-summary"><?php esc_html_e( 'Summary', 'wp-recipe-maker' ); ?></label>
|
28 |
<textarea id="wprm-recipe-summary" class="wprm-rich-editor" rows="4"></textarea>
|
29 |
</div>
|
30 |
+
<div class="wprm-recipe-form-container wprm-recipe-form-container-halfs">
|
31 |
+
<label for="wprm-recipe-author-display"><?php esc_html_e( 'Author', 'wp-recipe-maker' ); ?></label>
|
32 |
+
<select id="wprm-recipe-author-display">
|
33 |
+
<option value="disabled"><?php esc_html_e( "Don't show", 'wp-recipe-maker' ); ?></option>
|
34 |
+
<option value="post_author"><?php esc_html_e( 'Name of post author', 'wp-recipe-maker' ); ?></option>
|
35 |
+
<option value="custom"><?php esc_html_e( 'Custom author name', 'wp-recipe-maker' ); ?></option>
|
36 |
+
</select>
|
37 |
+
</div><div class="wprm-recipe-form-container wprm-recipe-form-container-halfs" id="wprm-recipe-author-name-container">
|
38 |
+
<label for="wprm-recipe-author-name"><?php esc_html_e( 'Custom Author Name', 'wp-recipe-maker' ); ?></label>
|
39 |
+
<input type="text" id="wprm-recipe-author-name" placeholder="<?php esc_attr_e( 'Author Name', 'wp-recipe-maker' ); ?>" />
|
40 |
+
</div>
|
41 |
+
<div class="wprm-recipe-form-container">
|
42 |
<label for="wprm-recipe-servings"><?php esc_html_e( 'Servings', 'wp-recipe-maker' ); ?></label>
|
43 |
<input type="number" id="wprm-recipe-servings" placeholder="4" /> <input type="text" id="wprm-recipe-servings-unit" placeholder="<?php esc_attr_e( 'people', 'wp-recipe-maker' ); ?>" />
|
44 |
</div>
|
45 |
+
<?php if ( ! WPRM_Addons::is_active( 'premium' ) ) : ?>
|
46 |
+
<div class="wprm-recipe-form-container">
|
47 |
<label for="wprm-recipe-calories"><?php esc_html_e( 'Calories', 'wp-recipe-maker' ); ?></label>
|
48 |
<input type="number" id="wprm-recipe-calories" placeholder="280" /> <?php esc_html_e( 'kcal', 'wp-recipe-maker' ); ?>
|
49 |
</div>
|
50 |
+
<?php endif; // Calories. ?>
|
51 |
+
<div class="wprm-recipe-form-container wprm-recipe-form-container-thirds">
|
52 |
<label for="wprm-recipe-prep-time"><?php esc_html_e( 'Prep Time', 'wp-recipe-maker' ); ?></label>
|
53 |
<input type="number" id="wprm-recipe-prep-time" class="wprm-recipe-time" placeholder="10" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
|
54 |
+
</div><div class="wprm-recipe-form-container wprm-recipe-form-container-thirds">
|
55 |
<label for="wprm-recipe-cook-time"><?php esc_html_e( 'Cook Time', 'wp-recipe-maker' ); ?></label>
|
56 |
<input type="number" id="wprm-recipe-cook-time" class="wprm-recipe-time" placeholder="20" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
|
57 |
+
</div><div class="wprm-recipe-form-container wprm-recipe-form-container-thirds">
|
58 |
<label for="wprm-recipe-total-time"><?php esc_html_e( 'Total Time', 'wp-recipe-maker' ); ?></label>
|
59 |
<input type="number" id="wprm-recipe-total-time" class="wprm-recipe-time" placeholder="30" /> <?php esc_html_e( 'minutes', 'wp-recipe-maker' ); ?>
|
60 |
</div>
|
61 |
+
<div class="wprm-recipe-form-container wprm-recipe-form-container-halfs">
|
62 |
<label for="wprm-recipe-tag-course"><?php esc_html_e( 'Course', 'wp-recipe-maker' ); ?></label>
|
63 |
<select id="wprm-recipe-tag-course" class="wprm-recipe-tags" multiple>
|
64 |
<?php
|
72 |
}
|
73 |
?>
|
74 |
</select>
|
75 |
+
</div><div class="wprm-recipe-form-container wprm-recipe-form-container-halfs">
|
76 |
<label for="wprm-recipe-tag-cuisine"><?php esc_html_e( 'Cuisine', 'wp-recipe-maker' ); ?></label>
|
77 |
<select id="wprm-recipe-tag-cuisine" class="wprm-recipe-tags" multiple>
|
78 |
<?php
|
templates/admin/modal/tabs/recipe-notes.php
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
|
12 |
?>
|
13 |
|
14 |
-
<div class="wprm-recipe-notes-form">
|
15 |
-
<div class="wprm-recipe-
|
16 |
<label for="wprm-recipe-notes"><?php esc_html_e( 'Notes', 'wp-recipe-maker' ); ?></label>
|
17 |
<?php
|
18 |
$editor_settings = array(
|
11 |
|
12 |
?>
|
13 |
|
14 |
+
<div class="wprm-recipe-form wprm-recipe-notes-form">
|
15 |
+
<div class="wprm-recipe-form-container">
|
16 |
<label for="wprm-recipe-notes"><?php esc_html_e( 'Notes', 'wp-recipe-maker' ); ?></label>
|
17 |
<?php
|
18 |
$editor_settings = array(
|
templates/admin/settings.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Template for recipe settings page.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 1.0.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/templates/admin
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Subpage.
|
13 |
+
$sub = isset( $_GET['sub'] ) ? sanitize_key( wp_unslash( $_GET['sub'] ) ) : ''; // Input var okay.
|
14 |
+
|
15 |
+
$tabs = apply_filters( 'wprm_settings_tabs', array(
|
16 |
+
'appearance' => __( 'Appearance', 'wp-recipe-maker' ),
|
17 |
+
) );
|
18 |
+
|
19 |
+
if ( ! array_key_exists( $sub, $tabs ) ) {
|
20 |
+
$sub = 'appearance';
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
|
24 |
+
<div class="wrap wprm-settings">
|
25 |
+
<h1><?php esc_html_e( 'WP Recipe Maker Settings', 'wp-recipe-maker' ); ?></h1>
|
26 |
+
|
27 |
+
<h2 class="nav-tab-wrapper">
|
28 |
+
<?php
|
29 |
+
foreach ( $tabs as $tab => $label ) {
|
30 |
+
$url = add_query_arg( 'sub', $tab, admin_url( 'admin.php?page=wprm_settings' ) );
|
31 |
+
$active = $sub === $tab ? ' nav-tab-active' : '';
|
32 |
+
|
33 |
+
echo '<a href="' . esc_url( $url ) . '" class="nav-tab' . esc_attr( $active ) . '">' . esc_html( $label ) . '</a>';
|
34 |
+
}
|
35 |
+
?>
|
36 |
+
</h2>
|
37 |
+
|
38 |
+
<?php do_action( 'wprm_settings_page', $sub ); ?>
|
39 |
+
</div>
|
templates/admin/settings/appearance.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Template for the appearance settings sub page.
|
4 |
+
*
|
5 |
+
* @link http://bootstrapped.ventures
|
6 |
+
* @since 1.0.0
|
7 |
+
*
|
8 |
+
* @package WP_Recipe_Maker
|
9 |
+
* @subpackage WP_Recipe_Maker/templates/admin/settings
|
10 |
+
*/
|
11 |
+
|
12 |
+
?>
|
13 |
+
|
14 |
+
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
|
15 |
+
<input type="hidden" name="action" value="wprm_settings_appearance">
|
16 |
+
<?php wp_nonce_field( 'wprm_settings', 'wprm_settings', false ); ?>
|
17 |
+
<h2 class="title"><?php esc_html_e( 'Recipe Template', 'wp-recipe-maker' ); ?></h2>
|
18 |
+
<p>
|
19 |
+
<?php esc_html_e( 'Change the look of recipes on your website.', 'wp-recipe-maker' ); ?>
|
20 |
+
</p>
|
21 |
+
<?php
|
22 |
+
$templates = WPRM_Template_Manager::get_templates();
|
23 |
+
?>
|
24 |
+
<table class="form-table">
|
25 |
+
<tbody>
|
26 |
+
<tr>
|
27 |
+
<th scope="row">
|
28 |
+
<label for="default_recipe_template"><?php esc_html_e( 'Default Recipe Template', 'wp-recipe-maker' ); ?></label>
|
29 |
+
</th>
|
30 |
+
<td>
|
31 |
+
<select id="default_recipe_template" name="default_recipe_template">
|
32 |
+
<?php
|
33 |
+
$setting = WPRM_Settings::get( 'default_recipe_template' );
|
34 |
+
foreach ( $templates as $template ) {
|
35 |
+
$selected = $setting === $template['slug'] ? ' selected="selected"' : '';
|
36 |
+
echo '<option value="' . esc_attr( $template['slug'] ) . '"' . esc_attr( $selected ) . '>' . esc_html( $template['name'] ) . '</option>';
|
37 |
+
}
|
38 |
+
?>
|
39 |
+
</select>
|
40 |
+
<p class="description" id="tagline-default_recipe_template">
|
41 |
+
<?php esc_html_e( 'The default template to use for recipes on your website.', 'wp-recipe-maker' ); ?>
|
42 |
+
</p>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<tr>
|
46 |
+
<th scope="row">
|
47 |
+
<label for="default_print_template"><?php esc_html_e( 'Default Print Template', 'wp-recipe-maker' ); ?></label>
|
48 |
+
</th>
|
49 |
+
<td>
|
50 |
+
<select id="default_print_template" name="default_print_template">
|
51 |
+
<?php
|
52 |
+
$setting = WPRM_Settings::get( 'default_print_template' );
|
53 |
+
foreach ( $templates as $template ) {
|
54 |
+
$selected = $setting === $template['slug'] ? ' selected="selected"' : '';
|
55 |
+
echo '<option value="' . esc_attr( $template['slug'] ) . '"' . esc_attr( $selected ) . '>' . esc_html( $template['name'] ) . '</option>';
|
56 |
+
}
|
57 |
+
?>
|
58 |
+
</select>
|
59 |
+
<p class="description" id="tagline-default_print_template">
|
60 |
+
<?php esc_html_e( 'The default template to use when printing a recipe.', 'wp-recipe-maker' ); ?>
|
61 |
+
</p>
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
<tr>
|
65 |
+
<td colspan="2" class="template-preview-container">
|
66 |
+
<?php
|
67 |
+
foreach ( $templates as $template ) {
|
68 |
+
echo '<div class="template-preview">';
|
69 |
+
echo '<div class="template-name">' . esc_html( $template['name'] ) . '</div>';
|
70 |
+
if ( $template['screenshot'] ) {
|
71 |
+
$image_url = $template['url'] . '/' . $template['slug'] . '.' . $template['screenshot'];
|
72 |
+
echo '<img src="' . esc_url( $image_url ) . '" class="template-screenshot" width="250" />';
|
73 |
+
} else {
|
74 |
+
echo '<div class="template-no-screenshot">' . esc_html__( 'No Screenshot', 'wp-recipe-maker' ) . '</div>';
|
75 |
+
}
|
76 |
+
echo '</div>';
|
77 |
+
}
|
78 |
+
?>
|
79 |
+
</td>
|
80 |
+
</tr>
|
81 |
+
</tbody>
|
82 |
+
</table>
|
83 |
+
<?php submit_button( __( 'Save Changes', 'wp-recipe-maker' ) ); ?>
|
84 |
+
</form>
|
templates/admin/settings/settings.php
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Template for recipe settings page.
|
4 |
-
*
|
5 |
-
* @link http://bootstrapped.ventures
|
6 |
-
* @since 1.0.0
|
7 |
-
*
|
8 |
-
* @package WP_Recipe_Maker
|
9 |
-
* @subpackage WP_Recipe_Maker/templates/admin/settings
|
10 |
-
*/
|
11 |
-
|
12 |
-
?>
|
13 |
-
|
14 |
-
<div class="wrap wprm-settings">
|
15 |
-
<h1><?php esc_html_e( 'WP Recipe Maker Settings', 'wp-recipe-maker' ); ?></h1>
|
16 |
-
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
|
17 |
-
<input type="hidden" name="action" value="wprm_settings">
|
18 |
-
<?php wp_nonce_field( 'wprm_settings', 'wprm_settings', false ); ?>
|
19 |
-
<h2 class="title"><?php esc_html_e( 'Recipe Template', 'wp-recipe-maker' ); ?></h2>
|
20 |
-
<p>
|
21 |
-
<?php esc_html_e( 'Change the look of recipes on your website.', 'wp-recipe-maker' ); ?>
|
22 |
-
</p>
|
23 |
-
<?php
|
24 |
-
$templates = WPRM_Template_Manager::get_templates();
|
25 |
-
?>
|
26 |
-
<table class="form-table">
|
27 |
-
<tbody>
|
28 |
-
<tr>
|
29 |
-
<th scope="row">
|
30 |
-
<label for="default_recipe_template"><?php esc_html_e( 'Default Recipe Template', 'wp-recipe-maker' ); ?></label>
|
31 |
-
</th>
|
32 |
-
<td>
|
33 |
-
<select id="default_recipe_template" name="default_recipe_template">
|
34 |
-
<?php
|
35 |
-
$setting = WPRM_Settings::get( 'default_recipe_template' );
|
36 |
-
foreach ( $templates as $template ) {
|
37 |
-
$selected = $setting === $template['slug'] ? ' selected="selected"' : '';
|
38 |
-
echo '<option value="' . esc_attr( $template['slug'] ) . '"' . esc_attr( $selected ) . '>' . esc_html( $template['name'] ) . '</option>';
|
39 |
-
}
|
40 |
-
?>
|
41 |
-
</select>
|
42 |
-
<p class="description" id="tagline-default_recipe_template">
|
43 |
-
<?php esc_html_e( 'The default template to use for recipes on your website.', 'wp-recipe-maker' ); ?>
|
44 |
-
</p>
|
45 |
-
</td>
|
46 |
-
</tr>
|
47 |
-
<tr>
|
48 |
-
<th scope="row">
|
49 |
-
<label for="default_print_template"><?php esc_html_e( 'Default Print Template', 'wp-recipe-maker' ); ?></label>
|
50 |
-
</th>
|
51 |
-
<td>
|
52 |
-
<select id="default_print_template" name="default_print_template">
|
53 |
-
<?php
|
54 |
-
$setting = WPRM_Settings::get( 'default_print_template' );
|
55 |
-
foreach ( $templates as $template ) {
|
56 |
-
$selected = $setting === $template['slug'] ? ' selected="selected"' : '';
|
57 |
-
echo '<option value="' . esc_attr( $template['slug'] ) . '"' . esc_attr( $selected ) . '>' . esc_html( $template['name'] ) . '</option>';
|
58 |
-
}
|
59 |
-
?>
|
60 |
-
</select>
|
61 |
-
<p class="description" id="tagline-default_print_template">
|
62 |
-
<?php esc_html_e( 'The default template to use when printing a recipe.', 'wp-recipe-maker' ); ?>
|
63 |
-
</p>
|
64 |
-
</td>
|
65 |
-
</tr>
|
66 |
-
<tr>
|
67 |
-
<td colspan="2" class="template-preview-container">
|
68 |
-
<?php
|
69 |
-
foreach ( $templates as $template ) {
|
70 |
-
echo '<div class="template-preview">';
|
71 |
-
echo '<div class="template-name">' . esc_html( $template['name'] ) . '</div>';
|
72 |
-
if ( $template['screenshot'] ) {
|
73 |
-
$image_url = $template['url'] . '/' . $template['slug'] . '.' . $template['screenshot'];
|
74 |
-
echo '<img src="' . esc_url( $image_url ) . '" class="template-screenshot" width="250" />';
|
75 |
-
} else {
|
76 |
-
echo '<div class="template-no-screenshot">' . esc_html__( 'No Screenshot', 'wp-recipe-maker' ) . '</div>';
|
77 |
-
}
|
78 |
-
echo '</div>';
|
79 |
-
}
|
80 |
-
?>
|
81 |
-
</td>
|
82 |
-
</tr>
|
83 |
-
</tbody>
|
84 |
-
</table>
|
85 |
-
<?php submit_button( __( 'Save Changes', 'wp-recipe-maker' ) ); ?>
|
86 |
-
</form>
|
87 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/recipe/clean-print-with-image/clean-print-with-image.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-recipe-clean-print-with-image{font-size
|
1 |
+
.wprm-recipe-clean-print-with-image{font-size:.9em}.wprm-recipe-clean-print-with-image .wprm-recipe-image{float:left;margin:0 15px 15px 0}.wprm-recipe-clean-print-with-image h2.wprm-recipe-name,.wprm-recipe-clean-print-with-image h3.wprm-recipe-header,.wprm-recipe-clean-print-with-image h4.wprm-recipe-group-name{font-variant:normal;text-transform:none;letter-spacing:normal;margin:0}.wprm-recipe-clean-print-with-image h2.wprm-recipe-name{clear:none;font-size:1.8em}.wprm-recipe-clean-print-with-image .wprm-recipe-details-container,.wprm-recipe-clean-print-with-image .wprm-recipe-summary{margin-bottom:15px}.wprm-recipe-clean-print-with-image .wprm-recipe-details-name{display:inline-block;font-weight:700;min-width:130px}.wprm-recipe-clean-print-with-image .wprm-recipe-details-unit{font-size:.8em}.wprm-recipe-clean-print-with-image h3.wprm-recipe-header{margin-top:10px;font-size:1.2em}.wprm-recipe-clean-print-with-image ol,.wprm-recipe-clean-print-with-image ul{margin:0 0 8px}.wprm-recipe-clean-print-with-image ol li,.wprm-recipe-clean-print-with-image ul li{margin:0 0 0 32px}.wprm-recipe-clean-print-with-image h4.wprm-recipe-group-name{margin-top:5px!important;font-weight:300;font-size:1em}.wprm-recipe-clean-print-with-image .wprm-recipe-ingredient-notes{color:#999}.wprm-recipe-clean-print-with-image .wprm-recipe-instructions .wprm-recipe-instruction{margin-bottom:5px}.wprm-recipe-clean-print-with-image .wprm-recipe-instruction-text p{margin:0 0 5px}.wprm-recipe-clean-print-with-image .wprm-recipe-instruction-text p:last-of-type{margin-bottom:0}.wprm-print .wprm-recipe-clean-print-with-image{max-width:750px;margin:0 auto}
|
templates/recipe/clean-print-with-image/clean-print-with-image.php
CHANGED
@@ -77,6 +77,11 @@
|
|
77 |
<span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span>
|
78 |
</div>
|
79 |
<?php endif; // Calories. ?>
|
|
|
|
|
|
|
|
|
|
|
80 |
</div>
|
81 |
|
82 |
<?php
|
@@ -98,9 +103,7 @@
|
|
98 |
<?php if ( $ingredient['unit'] ) : ?>
|
99 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
100 |
<?php endif; // Ingredient unit. ?>
|
101 |
-
|
102 |
-
<span class="wprm-recipe-ingredient-name"><?php echo $ingredient['name']; ?></span>
|
103 |
-
<?php endif; // Ingredient name. ?>
|
104 |
<?php if ( $ingredient['notes'] ) : ?>
|
105 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
106 |
<?php endif; // Ingredient notes. ?>
|
77 |
<span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span>
|
78 |
</div>
|
79 |
<?php endif; // Calories. ?>
|
80 |
+
<?php if ( $recipe->author() ) : ?>
|
81 |
+
<div class="wprm-recipe-author-container">
|
82 |
+
<span class="wprm-recipe-details-name wprm-recipe-author-name"><?php _e( 'Author', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-author"><?php echo $recipe->author(); ?></span>
|
83 |
+
</div>
|
84 |
+
<?php endif; // Author. ?>
|
85 |
</div>
|
86 |
|
87 |
<?php
|
103 |
<?php if ( $ingredient['unit'] ) : ?>
|
104 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
105 |
<?php endif; // Ingredient unit. ?>
|
106 |
+
<span class="wprm-recipe-ingredient-name"><?php echo WPRM_Template_Helper::ingredient_name( $ingredient, false ); ?></span>
|
|
|
|
|
107 |
<?php if ( $ingredient['notes'] ) : ?>
|
108 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
109 |
<?php endif; // Ingredient notes. ?>
|
templates/recipe/clean-print/clean-print.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-recipe-clean-print{font-size
|
1 |
+
.wprm-recipe-clean-print{font-size:.9em}.wprm-recipe-clean-print h2.wprm-recipe-name,.wprm-recipe-clean-print h3.wprm-recipe-header,.wprm-recipe-clean-print h4.wprm-recipe-group-name{font-variant:normal;text-transform:none;letter-spacing:normal;margin:0}.wprm-recipe-clean-print h2.wprm-recipe-name{clear:none;font-size:1.8em}.wprm-recipe-clean-print .wprm-recipe-details-container,.wprm-recipe-clean-print .wprm-recipe-summary{margin-bottom:15px}.wprm-recipe-clean-print .wprm-recipe-details-name{display:inline-block;font-weight:700;min-width:130px}.wprm-recipe-clean-print .wprm-recipe-details-unit{font-size:.8em}.wprm-recipe-clean-print h3.wprm-recipe-header{margin-top:10px;font-size:1.2em}.wprm-recipe-clean-print ol,.wprm-recipe-clean-print ul{margin:0 0 8px}.wprm-recipe-clean-print ol li,.wprm-recipe-clean-print ul li{margin:0 0 0 32px}.wprm-recipe-clean-print h4.wprm-recipe-group-name{margin-top:5px!important;font-weight:300;font-size:1em}.wprm-recipe-clean-print .wprm-recipe-ingredient-notes{color:#999}.wprm-recipe-clean-print .wprm-recipe-instructions .wprm-recipe-instruction{margin-bottom:5px}.wprm-recipe-clean-print .wprm-recipe-instruction-text p{margin:0 0 5px}.wprm-recipe-clean-print .wprm-recipe-instruction-text p:last-of-type{margin-bottom:0}.wprm-print .wprm-recipe-clean-print{max-width:750px;margin:0 auto}
|
templates/recipe/clean-print/clean-print.php
CHANGED
@@ -76,6 +76,11 @@
|
|
76 |
<span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span>
|
77 |
</div>
|
78 |
<?php endif; // Calories. ?>
|
|
|
|
|
|
|
|
|
|
|
79 |
</div>
|
80 |
|
81 |
<?php
|
@@ -97,9 +102,7 @@
|
|
97 |
<?php if ( $ingredient['unit'] ) : ?>
|
98 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
99 |
<?php endif; // Ingredient unit. ?>
|
100 |
-
|
101 |
-
<span class="wprm-recipe-ingredient-name"><?php echo $ingredient['name']; ?></span>
|
102 |
-
<?php endif; // Ingredient name. ?>
|
103 |
<?php if ( $ingredient['notes'] ) : ?>
|
104 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
105 |
<?php endif; // Ingredient notes. ?>
|
76 |
<span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span>
|
77 |
</div>
|
78 |
<?php endif; // Calories. ?>
|
79 |
+
<?php if ( $recipe->author() ) : ?>
|
80 |
+
<div class="wprm-recipe-author-container">
|
81 |
+
<span class="wprm-recipe-details-name wprm-recipe-author-name"><?php _e( 'Author', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-author"><?php echo $recipe->author(); ?></span>
|
82 |
+
</div>
|
83 |
+
<?php endif; // Author. ?>
|
84 |
</div>
|
85 |
|
86 |
<?php
|
102 |
<?php if ( $ingredient['unit'] ) : ?>
|
103 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
104 |
<?php endif; // Ingredient unit. ?>
|
105 |
+
<span class="wprm-recipe-ingredient-name"><?php echo WPRM_Template_Helper::ingredient_name( $ingredient, false ); ?></span>
|
|
|
|
|
106 |
<?php if ( $ingredient['notes'] ) : ?>
|
107 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
108 |
<?php endif; // Ingredient notes. ?>
|
templates/recipe/simple/simple.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-recipe-simple{border-top:1px solid #
|
1 |
+
.wprm-recipe-simple{border-top:1px solid #aaa;background-color:#fafafa;padding:10px;margin:20px 0;font-size:.9em}.wprm-recipe-simple h2.wprm-recipe-name,.wprm-recipe-simple h3.wprm-recipe-header,.wprm-recipe-simple h4.wprm-recipe-group-name{font-variant:normal;text-transform:none;letter-spacing:normal;margin:0}.wprm-recipe-simple .wprm-recipe-image-container{float:right;text-align:center;margin:0 0 10px 10px}.wprm-recipe-simple .wprm-recipe-image-container .wprm-recipe-image{margin:0}.wprm-recipe-simple .wprm-recipe-image-container .wprm-recipe-rating{margin-bottom:5px}.wprm-recipe-simple .wprm-recipe-image-container .wprm-recipe-rating svg{vertical-align:middle;width:16px;height:16px;margin:0}.wprm-recipe-simple .wprm-recipe-image-container .wprm-recipe-rating .wprm-recipe-rating-details{font-size:.8em}.wprm-recipe-simple .wprm-recipe-image-container .wprm-recipe-print{font-size:.9em;cursor:pointer}.wprm-recipe-simple h2.wprm-recipe-name{clear:none;font-size:1.8em}.wprm-recipe-simple .wprm-recipe-details-container,.wprm-recipe-simple .wprm-recipe-summary{margin-bottom:15px}.wprm-recipe-simple .wprm-recipe-details-icon svg{vertical-align:middle;width:16px;height:16px}.wprm-recipe-simple .wprm-recipe-details-name{display:inline-block;font-weight:700;min-width:130px}.wprm-recipe-simple .wprm-recipe-details-unit{font-size:.8em}.wprm-recipe-simple h3.wprm-recipe-header{margin-top:10px;font-size:1.2em}.wprm-recipe-simple ol,.wprm-recipe-simple ul{margin:0 0 8px}.wprm-recipe-simple ol li,.wprm-recipe-simple ul li{margin:0 0 0 32px}.wprm-recipe-simple h4.wprm-recipe-group-name{margin-top:5px!important;font-weight:300;font-size:1em}.wprm-recipe-simple .wprm-recipe-ingredient-notes{color:#999}.wprm-recipe-simple .wprm-recipe-instructions .wprm-recipe-instruction{margin-bottom:5px}.wprm-recipe-simple .wprm-recipe-instruction-text p{margin:0 0 5px}.wprm-recipe-simple .wprm-recipe-instruction-text p:last-of-type{margin-bottom:0}.wprm-recipe-simple .wprm-recipe-instruction-image{margin:5px 0 15px}.wprm-print .wprm-recipe-simple{max-width:750px;margin:0 auto}.wprm-print .wprm-recipe-print{display:none}@media only screen and (max-width:640px){.wprm-recipe-simple .wprm-recipe-image-container{float:none}.wprm-recipe-simple .wprm-recipe-details-name{min-width:0}}
|
templates/recipe/simple/simple.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
// @codingStandardsIgnoreStart
|
13 |
?>
|
14 |
<div class="wprm-recipe wprm-recipe-simple" itemscope itemtype="http://schema.org/Recipe">
|
15 |
-
<meta itemprop="author" content="<?php echo $recipe->
|
16 |
<meta itemprop="datePublished" content="<?php echo $recipe->date(); ?>" />
|
17 |
<meta itemprop="image" content="<?php echo $recipe->image_url( 'full' ); ?>" />
|
18 |
<div class="wprm-recipe-image-container">
|
@@ -108,6 +108,11 @@
|
|
108 |
<span class="wprm-recipe-details-icon"><?php include( WPRM_DIR . 'assets/icons/battery.svg' ); ?></span> <span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span> <span itemprop="calories"><span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span></span>
|
109 |
</div>
|
110 |
<?php endif; // Calories. ?>
|
|
|
|
|
|
|
|
|
|
|
111 |
</div>
|
112 |
|
113 |
<?php
|
@@ -129,9 +134,7 @@
|
|
129 |
<?php if ( $ingredient['unit'] ) : ?>
|
130 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
131 |
<?php endif; // Ingredient unit. ?>
|
132 |
-
|
133 |
-
<span class="wprm-recipe-ingredient-name"><?php echo $ingredient['name']; ?></span>
|
134 |
-
<?php endif; // Ingredient name. ?>
|
135 |
<?php if ( $ingredient['notes'] ) : ?>
|
136 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
137 |
<?php endif; // Ingredient notes. ?>
|
12 |
// @codingStandardsIgnoreStart
|
13 |
?>
|
14 |
<div class="wprm-recipe wprm-recipe-simple" itemscope itemtype="http://schema.org/Recipe">
|
15 |
+
<meta itemprop="author" content="<?php echo $recipe->author_meta(); ?>" />
|
16 |
<meta itemprop="datePublished" content="<?php echo $recipe->date(); ?>" />
|
17 |
<meta itemprop="image" content="<?php echo $recipe->image_url( 'full' ); ?>" />
|
18 |
<div class="wprm-recipe-image-container">
|
108 |
<span class="wprm-recipe-details-icon"><?php include( WPRM_DIR . 'assets/icons/battery.svg' ); ?></span> <span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span> <span itemprop="calories"><span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span></span>
|
109 |
</div>
|
110 |
<?php endif; // Calories. ?>
|
111 |
+
<?php if ( $recipe->author() ) : ?>
|
112 |
+
<div class="wprm-recipe-author-container">
|
113 |
+
<span class="wprm-recipe-details-icon"><?php include( WPRM_DIR . 'assets/icons/chef-hat.svg' ); ?></span> <span class="wprm-recipe-details-name wprm-recipe-author-name"><?php _e( 'Author', 'wp-recipe-maker' ); ?></span> <span class="wprm-recipe-details wprm-recipe-author"><?php echo $recipe->author(); ?></span>
|
114 |
+
</div>
|
115 |
+
<?php endif; // Author. ?>
|
116 |
</div>
|
117 |
|
118 |
<?php
|
134 |
<?php if ( $ingredient['unit'] ) : ?>
|
135 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
136 |
<?php endif; // Ingredient unit. ?>
|
137 |
+
<span class="wprm-recipe-ingredient-name"><?php echo WPRM_Template_Helper::ingredient_name( $ingredient, true ); ?></span>
|
|
|
|
|
138 |
<?php if ( $ingredient['notes'] ) : ?>
|
139 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
140 |
<?php endif; // Ingredient notes. ?>
|
templates/recipe/tastefully-simple/tastefully-simple.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wprm-
|
1 |
+
.wprm-print .wprm-recipe-tastefully-simple,.wprm-recipe-container .wprm-recipe-tastefully-simple{font:12px Verdana,Arial,Geneva,sans-serif;border:1px dashed #666;color:#666;padding:10px;background:#FFF}.wprm-print .wprm-recipe-tastefully-simple div,.wprm-print .wprm-recipe-tastefully-simple li,.wprm-print .wprm-recipe-tastefully-simple ol,.wprm-print .wprm-recipe-tastefully-simple p,.wprm-print .wprm-recipe-tastefully-simple span,.wprm-print .wprm-recipe-tastefully-simple ul,.wprm-recipe-container .wprm-recipe-tastefully-simple div,.wprm-recipe-container .wprm-recipe-tastefully-simple li,.wprm-recipe-container .wprm-recipe-tastefully-simple ol,.wprm-recipe-container .wprm-recipe-tastefully-simple p,.wprm-recipe-container .wprm-recipe-tastefully-simple span,.wprm-recipe-container .wprm-recipe-tastefully-simple ul{margin:0;padding:0;line-height:inherit}.wprm-print .wprm-recipe-tastefully-simple svg,.wprm-recipe-container .wprm-recipe-tastefully-simple svg{vertical-align:middle;width:16px;height:16px;margin:0}.wprm-print .wprm-recipe-tastefully-simple .wprm-clear-left,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-clear-left{clear:left;line-height:0;height:0}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container{float:right;max-width:40%;text-align:right}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating{margin-bottom:5px}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating svg path,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating svg path{fill:#feb600}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating svg polygon,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating svg polygon{stroke:#feb600}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating .wprm-recipe-rating-details,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-rating .wprm-recipe-rating-details{font:10px "Trebuchet MS",Arial,Helvetica,sans-serif}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-buttons,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-buttons{margin-top:10px;text-align:center}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-buttons .wprm-recipe-print,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-image-container .wprm-recipe-buttons .wprm-recipe-print{color:#fff;background:#666;font-size:11px;cursor:pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:.4em 1em}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-name,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-name{font:150% Verdana,Geneva,sans-serif;margin-bottom:15px}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-times-container,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-times-container{border-top:1px dotted #666;border-bottom:1px dotted #666;width:60%;padding-top:5px;padding-bottom:5px;margin-bottom:10px}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container{width:33%;text-align:center;float:left;font-weight:700;border-left:1px solid #ccc}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container:first-child,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container:first-child{border-left:none}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container .wprm-recipe-time-header,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container .wprm-recipe-time-header{margin-bottom:4px}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container .wprm-recipe-time,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-times-container .wprm-recipe-time-container .wprm-recipe-time{font-size:10px;font-weight:400}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-details-container,.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-ingredients-container,.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-summary,.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-summary p,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-details-container,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-ingredients-container,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-summary,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-summary p{margin-bottom:10px}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-header,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-header{font-size:1.4em;font-weight:700;margin-top:1em;margin-bottom:1em}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-group-name,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-group-name{margin-top:3px;margin-bottom:3px;font-weight:700}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-ingredients li,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-ingredients li{list-style:disc inside;margin-left:10px;line-height:inherit;background:0 0}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-instructions li,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-instructions li{list-style:decimal;margin-left:30px;line-height:inherit;background:0 0}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-notes-container ul li,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-notes-container ul li{list-style:disc inside;margin-left:10px}.wprm-print .wprm-recipe-tastefully-simple .wprm-recipe-notes-container ol li,.wprm-recipe-container .wprm-recipe-tastefully-simple .wprm-recipe-notes-container ol li{list-style:decimal;margin-left:30px}.wprm-print .wprm-recipe-tastefully-simple{max-width:750px;margin:0 auto}.wprm-print .wprm-recipe-print{display:none}@media only screen and (max-width:480px){.wprm-recipe-tastefully-simple .wprm-recipe-image-container{float:none;width:100%;max-width:none}}
|
templates/recipe/tastefully-simple/tastefully-simple.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
// @codingStandardsIgnoreStart
|
13 |
?>
|
14 |
<div class="wprm-recipe wprm-recipe-tastefully-simple" itemscope itemtype="http://schema.org/Recipe">
|
15 |
-
<meta itemprop="author" content="<?php echo $recipe->
|
16 |
<meta itemprop="datePublished" content="<?php echo $recipe->date(); ?>" />
|
17 |
<meta itemprop="image" content="<?php echo $recipe->image_url( 'full' ); ?>" />
|
18 |
<div class="wprm-recipe-image-container">
|
@@ -112,6 +112,11 @@
|
|
112 |
<span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span>: <span itemprop="calories"><span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span></span>
|
113 |
</div>
|
114 |
<?php endif; // Calories. ?>
|
|
|
|
|
|
|
|
|
|
|
115 |
</div>
|
116 |
|
117 |
<?php
|
@@ -133,9 +138,7 @@
|
|
133 |
<?php if ( $ingredient['unit'] ) : ?>
|
134 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
135 |
<?php endif; // Ingredient unit. ?>
|
136 |
-
|
137 |
-
<span class="wprm-recipe-ingredient-name"><?php echo $ingredient['name']; ?></span>
|
138 |
-
<?php endif; // Ingredient name. ?>
|
139 |
<?php if ( $ingredient['notes'] ) : ?>
|
140 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
141 |
<?php endif; // Ingredient notes. ?>
|
12 |
// @codingStandardsIgnoreStart
|
13 |
?>
|
14 |
<div class="wprm-recipe wprm-recipe-tastefully-simple" itemscope itemtype="http://schema.org/Recipe">
|
15 |
+
<meta itemprop="author" content="<?php echo $recipe->author_meta(); ?>" />
|
16 |
<meta itemprop="datePublished" content="<?php echo $recipe->date(); ?>" />
|
17 |
<meta itemprop="image" content="<?php echo $recipe->image_url( 'full' ); ?>" />
|
18 |
<div class="wprm-recipe-image-container">
|
112 |
<span class="wprm-recipe-details-name wprm-recipe-calories-name"><?php _e( 'Calories', 'wp-recipe-maker' ); ?></span>: <span itemprop="calories"><span class="wprm-recipe-details wprm-recipe-calories"><?php echo $recipe->calories(); ?></span> <span class="wprm-recipe-details-unit wprm-recipe-calories-unit"><?php _e( 'kcal', 'wp-recipe-maker' ); ?></span></span>
|
113 |
</div>
|
114 |
<?php endif; // Calories. ?>
|
115 |
+
<?php if ( $recipe->author() ) : ?>
|
116 |
+
<div class="wprm-recipe-author-container">
|
117 |
+
<span class="wprm-recipe-details-name wprm-recipe-author-name"><?php _e( 'Author', 'wp-recipe-maker' ); ?></span>: <span class="wprm-recipe-details wprm-recipe-author"><?php echo $recipe->author(); ?></span>
|
118 |
+
</div>
|
119 |
+
<?php endif; // Author. ?>
|
120 |
</div>
|
121 |
|
122 |
<?php
|
138 |
<?php if ( $ingredient['unit'] ) : ?>
|
139 |
<span class="wprm-recipe-ingredient-unit"><?php echo $ingredient['unit']; ?></span>
|
140 |
<?php endif; // Ingredient unit. ?>
|
141 |
+
<span class="wprm-recipe-ingredient-name"><?php echo WPRM_Template_Helper::ingredient_name( $ingredient, true ); ?></span>
|
|
|
|
|
142 |
<?php if ( $ingredient['notes'] ) : ?>
|
143 |
<span class="wprm-recipe-ingredient-notes"><?php echo $ingredient['notes']; ?></span>
|
144 |
<?php endif; // Ingredient notes. ?>
|
vendor/rangy/rangy-core.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Rangy, a cross-browser JavaScript range and selection library
|
3 |
+
* https://github.com/timdown/rangy
|
4 |
+
*
|
5 |
+
* Copyright 2015, Tim Down
|
6 |
+
* Licensed under the MIT license.
|
7 |
+
* Version: 1.3.0
|
8 |
+
* Build date: 10 May 2015
|
9 |
+
*/
|
10 |
+
!function(e,t){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof module&&"object"==typeof exports?module.exports=e():t.rangy=e()}(function(){function e(e,t){var n=typeof e[t];return n==N||!(n!=C||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=C||!e[t])}function n(e,t){return typeof e[t]!=E}function r(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}function o(e){return e&&O(e,T)&&D(e,w)}function i(e){return t(e,"body")?e.body:e.getElementsByTagName("body")[0]}function a(t){typeof console!=E&&e(console,"log")&&console.log(t)}function s(e,t){b&&t?alert(e):a(e)}function c(e){I.initialized=!0,I.supported=!1,s("Rangy is not supported in this environment. Reason: "+e,I.config.alertOnFail)}function d(e){s("Rangy warning: "+e,I.config.alertOnWarn)}function f(e){return e.message||e.description||String(e)}function u(){if(b&&!I.initialized){var t,n=!1,r=!1;e(document,"createRange")&&(t=document.createRange(),O(t,y)&&D(t,S)&&(n=!0));var s=i(document);if(!s||"body"!=s.nodeName.toLowerCase())return void c("No body element found");if(s&&e(s,"createTextRange")&&(t=s.createTextRange(),o(t)&&(r=!0)),!n&&!r)return void c("Neither Range nor TextRange are available");I.initialized=!0,I.features={implementsDomRange:n,implementsTextRange:r};var d,u;for(var l in x)(d=x[l])instanceof p&&d.init(d,I);for(var h=0,g=M.length;g>h;++h)try{M[h](I)}catch(m){u="Rangy init listener threw an exception. Continuing. Detail: "+f(m),a(u)}}}function l(e,t,n){n&&(e+=" in module "+n.name),I.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function h(e,t,n,r){e[t]=function(){return l(t,n,r),e[n].apply(e,P.toArray(arguments))}}function g(e){e=e||window,u();for(var t=0,n=k.length;n>t;++t)k[t](e)}function p(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function m(e,t,n){var r=new p(e,t,function(t){if(!t.initialized){t.initialized=!0;try{n(I,t),t.supported=!0}catch(r){var o="Module '"+e+"' failed to load: "+f(r);a(o),r.stack&&a(r.stack)}}});return x[e]=r,r}function R(){}function v(){}var C="object",N="function",E="undefined",S=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],y=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],w=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],T=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"],O=r(e),_=r(t),D=r(n),A=[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,r=e.length;r>n;++n)t(e[n],n)},x={},b=typeof window!=E&&typeof document!=E,P={isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:O,areHostObjects:_,areHostProperties:D,isTextRange:o,getBody:i,forEach:A},I={version:"1.3.0",initialized:!1,isBrowser:b,supported:!0,util:P,features:{},modules:x,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof rangyAutoInitialize==E?!0:rangyAutoInitialize}};I.fail=c,I.warn=d;var B;({}).hasOwnProperty?(P.extend=B=function(e,t,n){var r,o;for(var i in t)t.hasOwnProperty(i)&&(r=e[i],o=t[i],n&&null!==r&&"object"==typeof r&&null!==o&&"object"==typeof o&&B(r,o,!0),e[i]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},P.createOptions=function(e,t){var n={};return B(n,t),e&&B(n,e),n}):c("hasOwnProperty not supported"),b||c("Rangy can only run in a browser"),function(){var e;if(b){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(r){}}e||(e=function(e){for(var t=[],n=0,r=e.length;r>n;++n)t[n]=e[n];return t}),P.toArray=e}();var H;b&&(e(document,"addEventListener")?H=function(e,t,n){e.addEventListener(t,n,!1)}:e(document,"attachEvent")?H=function(e,t,n){e.attachEvent("on"+t,n)}:c("Document does not have required addEventListener or attachEvent method"),P.addListener=H);var M=[];P.deprecationNotice=l,P.createAliasForDeprecatedMethod=h,I.init=u,I.addInitListener=function(e){I.initialized?e(I):M.push(e)};var k=[];I.addShimListener=function(e){k.push(e)},b&&(I.shim=I.createMissingNativeApi=g,h(I,"createMissingNativeApi","shim")),p.prototype={init:function(){for(var e,t,n=this.dependencies||[],r=0,o=n.length;o>r;++r){if(t=n[r],e=x[t],!(e&&e instanceof p))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){I.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){I.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in Rangy "+this.name+" module: "+e)}},I.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var r=m(e,n,t);I.initialized&&I.supported&&r.init()},I.createCoreModule=function(e,t,n){m(e,t,n)},I.RangePrototype=R,I.rangePrototype=new R,I.selectionPrototype=new v,I.createCoreModule("DomUtil",[],function(e,t){function n(e){var t;return typeof e.namespaceURI==b||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function r(e){var t=e.parentNode;return 1==t.nodeType?t:null}function o(e){for(var t=0;e=e.previousSibling;)++t;return t}function i(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}}function a(e,t){var n,r=[];for(n=e;n;n=n.parentNode)r.push(n);for(n=t;n;n=n.parentNode)if(M(r,n))return n;return null}function s(e,t,n){for(var r=n?t:t.parentNode;r;){if(r===e)return!0;r=r.parentNode}return!1}function c(e,t){return s(e,t,!0)}function d(e,t,n){for(var r,o=n?e:e.parentNode;o;){if(r=o.parentNode,r===t)return o;o=r}return null}function f(e){var t=e.nodeType;return 3==t||4==t||8==t}function u(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t}function l(e,t){var n=t.nextSibling,r=t.parentNode;return n?r.insertBefore(e,n):r.appendChild(e),e}function h(e,t,n){var r=e.cloneNode(!1);if(r.deleteData(0,t),e.deleteData(t,e.length-t),l(r,e),n)for(var i,a=0;i=n[a++];)i.node==e&&i.offset>t?(i.node=r,i.offset-=t):i.node==e.parentNode&&i.offset>o(e)&&++i.offset;return r}function g(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=b)return e.ownerDocument;if(typeof e.document!=b)return e.document;if(e.parentNode)return g(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var n=g(e);if(typeof n.defaultView!=b)return n.defaultView;if(typeof n.parentWindow!=b)return n.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=b)return e.contentDocument;if(typeof e.contentWindow!=b)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function R(e){if(typeof e.contentWindow!=b)return e.contentWindow;if(typeof e.contentDocument!=b)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")}function v(e){return e&&P.isHostMethod(e,"setTimeout")&&P.isHostObject(e,"document")}function C(e,t,n){var r;if(e?P.isHostProperty(e,"nodeType")?r=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):g(e):v(e)&&(r=e.document):r=document,!r)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return r}function N(e){for(var t;t=e.parentNode;)e=t;return e}function E(e,n,r,i){var s,c,f,u,l;if(e==r)return n===i?0:i>n?-1:1;if(s=d(r,e,!0))return n<=o(s)?-1:1;if(s=d(e,r,!0))return o(s)<i?-1:1;if(c=a(e,r),!c)throw new Error("comparePoints error: nodes have no common ancestor");if(f=e===c?c:d(e,c,!0),u=r===c?c:d(r,c,!0),f===u)throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(l=c.firstChild;l;){if(l===f)return-1;if(l===u)return 1;l=l.nextSibling}}function S(e){var t;try{return t=e.parentNode,!1}catch(n){return!0}}function y(e){if(!e)return"[No node]";if(k&&S(e))return"[Broken node]";if(f(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+o(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function w(e){for(var t,n=g(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function T(e,t,n){var r=I(e),o=e.createElement("div");o.contentEditable=""+!!n,t&&(o.innerHTML=t);var i=r.firstChild;return i?r.insertBefore(o,i):r.appendChild(o),o}function O(e){return e.parentNode.removeChild(e)}function _(e){this.root=e,this._next=e}function D(e){return new _(e)}function A(e,t){this.node=e,this.offset=t}function x(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var b="undefined",P=e.util,I=P.getBody;P.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),P.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var B=document.createElement("div");P.areHostMethods(B,["insertBefore","appendChild","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),P.isHostProperty(B,"innerHTML")||t.fail("Element is missing innerHTML property");var H=document.createTextNode("test");P.areHostMethods(H,["splitText","deleteData","insertData","appendData","cloneNode"]||!P.areHostObjects(B,["previousSibling","nextSibling","childNodes","parentNode"])||!P.areHostProperties(H,["data"]))||t.fail("Incomplete Text Node implementation");var M=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1},k=!1;!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br />",k=S(n),e.features.crashyTextNodes=k}();var L;typeof window.getComputedStyle!=b?L=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=b?L=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),_.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},A.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+y(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},x.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},x.prototype.toString=function(){return this.message},e.dom={arrayContains:M,isHtmlNamespace:n,parentElement:r,getNodeIndex:o,getNodeLength:i,getCommonAncestor:a,isAncestorOf:s,isOrIsAncestorOf:c,getClosestAncestorIn:d,isCharacterDataNode:f,isTextOrCommentNode:u,insertAfter:l,splitDataNode:h,getDocument:g,getWindow:p,getIframeWindow:R,getIframeDocument:m,getBody:I,isWindow:v,getContentDocument:C,getRootContainer:N,comparePoints:E,isBrokenNode:S,inspectNode:y,getComputedStyleProperty:L,createTestElement:T,removeNode:O,fragmentFromNodeChildren:w,createIterator:D,DomPosition:A},e.DOMException=x}),I.createCoreModule("DomRange",["DomUtil"],function(e){function t(e,t){return 3!=e.nodeType&&(F(e,t.startContainer)||F(e,t.endContainer))}function n(e){return e.document||j(e.startContainer)}function r(e){return Q(e.startContainer)}function o(e){return new M(e.parentNode,W(e))}function i(e){return new M(e.parentNode,W(e)+1)}function a(e,t,n){var r=11==e.nodeType?e.firstChild:e;return L(t)?n==t.length?B.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:U(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),r}function s(e,t,r){if(w(e),w(t),n(t)!=n(e))throw new k("WRONG_DOCUMENT_ERR");var o=z(e.startContainer,e.startOffset,t.endContainer,t.endOffset),i=z(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return r?0>=o&&i>=0:0>o&&i>0}function c(e){for(var t,r,o,i=n(e.range).createDocumentFragment();r=e.next();){if(t=e.isPartiallySelectedSubtree(),r=r.cloneNode(!t),t&&(o=e.getSubtreeIterator(),r.appendChild(c(o)),o.detach()),10==r.nodeType)throw new k("HIERARCHY_REQUEST_ERR");i.appendChild(r)}return i}function d(e,t,n){var r,o;n=n||{stop:!1};for(var i,a;i=e.next();)if(e.isPartiallySelectedSubtree()){if(t(i)===!1)return void(n.stop=!0);if(a=e.getSubtreeIterator(),d(a,t,n),a.detach(),n.stop)return}else for(r=B.createIterator(i);o=r.next();)if(t(o)===!1)return void(n.stop=!0)}function f(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),f(t),t.detach()):e.remove()}function u(e){for(var t,r,o=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),r=e.getSubtreeIterator(),t.appendChild(u(r)),r.detach()):e.remove(),10==t.nodeType)throw new k("HIERARCHY_REQUEST_ERR");o.appendChild(t)}return o}function l(e,t,n){var r,o=!(!t||!t.length),i=!!n;o&&(r=new RegExp("^("+t.join("|")+")$"));var a=[];return d(new g(e,!1),function(t){if(!(o&&!r.test(t.nodeType)||i&&!n(t))){var s=e.startContainer;if(t!=s||!L(s)||e.startOffset!=s.length){var c=e.endContainer;t==c&&L(c)&&0==e.endOffset||a.push(t)}}}),a}function h(e){var t="undefined"==typeof e.getName?"Range":e.getName();return"["+t+"("+B.inspectNode(e.startContainer)+":"+e.startOffset+", "+B.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function g(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L(this.sc)?V(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L(this.ec)?V(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function p(e){return function(t,n){for(var r,o=n?t:t.parentNode;o;){if(r=o.nodeType,Y(e,r))return o;o=o.parentNode}return null}}function m(e,t){if(rt(e,t))throw new k("INVALID_NODE_TYPE_ERR")}function R(e,t){if(!Y(t,e.nodeType))throw new k("INVALID_NODE_TYPE_ERR")}function v(e,t){if(0>t||t>(L(e)?e.length:e.childNodes.length))throw new k("INDEX_SIZE_ERR")}function C(e,t){if(tt(e,!0)!==tt(t,!0))throw new k("WRONG_DOCUMENT_ERR")}function N(e){if(nt(e,!0))throw new k("NO_MODIFICATION_ALLOWED_ERR")}function E(e,t){if(!e)throw new k(t)}function S(e,t){return t<=(L(e)?e.length:e.childNodes.length)}function y(e){return!!e.startContainer&&!!e.endContainer&&!(G&&(B.isBrokenNode(e.startContainer)||B.isBrokenNode(e.endContainer)))&&Q(e.startContainer)==Q(e.endContainer)&&S(e.startContainer,e.startOffset)&&S(e.endContainer,e.endOffset)}function w(e){if(!y(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}function T(e,t){w(e);var n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,a=n===o;L(o)&&i>0&&i<o.length&&U(o,i,t),L(n)&&r>0&&r<n.length&&(n=U(n,r,t),a?(i-=r,o=n):o==n.parentNode&&i>=W(n)&&i++,r=0),e.setStartAndEnd(n,r,o,i)}function O(e){w(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}function _(e){e.START_TO_START=dt,e.START_TO_END=ft,e.END_TO_END=ut,e.END_TO_START=lt,e.NODE_BEFORE=ht,e.NODE_AFTER=gt,e.NODE_BEFORE_AND_AFTER=pt,e.NODE_INSIDE=mt}function D(e){_(e),_(e.prototype)}function A(e,t){return function(){w(this);var n,r,o=this.startContainer,a=this.startOffset,s=this.commonAncestorContainer,c=new g(this,!0);o!==s&&(n=V(o,s,!0),r=i(n),o=r.node,a=r.offset),d(c,N),c.reset();var f=e(c);return c.detach(),t(this,o,a,o,a),f}}function x(n,r){function a(e,t){return function(n){R(n,Z),R(Q(n),$);var r=(e?o:i)(n);(t?s:c)(this,r.node,r.offset)}}function s(e,t,n){var o=e.endContainer,i=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((Q(t)!=Q(o)||1==z(t,n,o,i))&&(o=t,i=n),r(e,t,n,o,i))}function c(e,t,n){var o=e.startContainer,i=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((Q(t)!=Q(o)||-1==z(t,n,o,i))&&(o=t,i=n),r(e,o,i,t,n))}var d=function(){};d.prototype=e.rangePrototype,n.prototype=new d,H.extend(n.prototype,{setStart:function(e,t){m(e,!0),v(e,t),s(this,e,t)},setEnd:function(e,t){m(e,!0),v(e,t),c(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],n=e[1],o=t,i=n;switch(e.length){case 3:i=e[2];break;case 4:o=e[2],i=e[3]}r(this,t,n,o,i)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){w(this),e?r(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):r(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){m(e,!0),r(this,e,0,e,q(e))},selectNode:function(e){m(e,!1),R(e,Z);var t=o(e),n=i(e);r(this,t.node,t.offset,n.node,n.offset)},extractContents:A(u,r),deleteContents:A(f,r),canSurroundContents:function(){w(this),N(this.startContainer),N(this.endContainer);var e=new g(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},splitBoundaries:function(){T(this)},splitBoundariesPreservingPositions:function(e){T(this,e)},normalizeBoundaries:function(){w(this);var e,t=this.startContainer,n=this.startOffset,o=this.endContainer,i=this.endOffset,a=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(o=e,i=e.length,e.appendData(t.data),X(t))},s=function(e){var r=e.previousSibling;if(r&&r.nodeType==e.nodeType){t=e;var a=e.length;if(n=r.length,e.insertData(0,r.data),X(r),t==o)i+=n,o=t;else if(o==e.parentNode){var s=W(e);i==s?(o=e,i=a):i>s&&i--}}},c=!0;if(L(o))i==o.length?a(o):0==i&&(e=o.previousSibling,e&&e.nodeType==o.nodeType&&(i=e.length,t==o&&(c=!1),e.appendData(o.data),X(o),o=e));else{if(i>0){var d=o.childNodes[i-1];d&&L(d)&&a(d)}c=!this.collapsed}if(c){if(L(t))0==n?s(t):n==t.length&&(e=t.nextSibling,e&&e.nodeType==t.nodeType&&(o==e&&(o=t,i+=t.length),t.appendData(e.data),X(e)));else if(n<t.childNodes.length){var f=t.childNodes[n];f&&L(f)&&s(f)}}else t=o,n=i;r(this,t,n,o,i)},collapseToPoint:function(e,t){m(e,!0),v(e,t),this.setStartAndEnd(e,t)}}),D(n)}function b(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:B.getCommonAncestor(e.startContainer,e.endContainer)}function P(e,t,n,r,o){e.startContainer=t,e.startOffset=n,e.endContainer=r,e.endOffset=o,e.document=B.getDocument(t),b(e)}function I(e){this.startContainer=e,this.startOffset=0,this.endContainer=e,this.endOffset=0,this.document=e,b(this)}var B=e.dom,H=e.util,M=B.DomPosition,k=e.DOMException,L=B.isCharacterDataNode,W=B.getNodeIndex,F=B.isOrIsAncestorOf,j=B.getDocument,z=B.comparePoints,U=B.splitDataNode,V=B.getClosestAncestorIn,q=B.getNodeLength,Y=B.arrayContains,Q=B.getRootContainer,G=e.features.crashyTextNodes,X=B.removeNode;g.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,L(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!L(n)||n!==this.sc&&n!==this.ec?n.parentNode&&X(n):(e=n===this.sc?this.so:0,t=n===this.ec?this.eo:n.length,e!=t&&n.deleteData(e,t-e))},isPartiallySelectedSubtree:function(){var e=this._current;return t(e,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)e=this.range.cloneRange(),e.collapse(!1);else{e=new I(n(this.range));var t=this._current,r=t,o=0,i=t,a=q(t);F(t,this.sc)&&(r=this.sc,o=this.so),F(t,this.ec)&&(i=this.ec,a=this.eo),P(e,r,o,i,a)}return new g(e,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var Z=[1,3,4,5,7,8,10],$=[2,9,11],J=[5,6,10,12],K=[1,3,4,5,7,8,10,11],et=[1,3,4,5,7,8],tt=p([9,11]),nt=p(J),rt=p([6,10,12]),ot=document.createElement("style"),it=!1;try{ot.innerHTML="<b>x</b>",it=3==ot.firstChild.nodeType}catch(at){}e.features.htmlParsingConforms=it;var st=it?function(e){var t=this.startContainer,n=j(t);if(!t)throw new k("INVALID_STATE_ERR");var r=null;return 1==t.nodeType?r=t:L(t)&&(r=B.parentElement(t)),r=null===r||"HTML"==r.nodeName&&B.isHtmlNamespace(j(r).documentElement)&&B.isHtmlNamespace(r)?n.createElement("body"):r.cloneNode(!1),r.innerHTML=e,B.fragmentFromNodeChildren(r)}:function(e){var t=n(this),r=t.createElement("body");return r.innerHTML=e,B.fragmentFromNodeChildren(r)},ct=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],dt=0,ft=1,ut=2,lt=3,ht=0,gt=1,pt=2,mt=3;H.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){w(this),C(this.startContainer,t.startContainer);var n,r,o,i,a=e==lt||e==dt?"start":"end",s=e==ft||e==dt?"start":"end";return n=this[a+"Container"],r=this[a+"Offset"],o=t[s+"Container"],i=t[s+"Offset"],z(n,r,o,i)},insertNode:function(e){if(w(this),R(e,K),N(this.startContainer),F(e,this.startContainer))throw new k("HIERARCHY_REQUEST_ERR");var t=a(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){w(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var r=new g(this,!0);return e=c(r),r.detach(),e},canSurroundContents:function(){w(this),N(this.startContainer),N(this.endContainer);var e=new g(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(R(e,et),!this.canSurroundContents())throw new k("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);a(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){w(this);for(var e,t=new I(n(this)),r=ct.length;r--;)e=ct[r],t[e]=this[e];return t},toString:function(){w(this);var e=this.startContainer;if(e===this.endContainer&&L(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new g(this,!0);return d(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){w(this);var t=e.parentNode,n=W(e);if(!t)throw new k("NOT_FOUND_ERR");var r=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return 0>r?o>0?pt:ht:o>0?gt:mt},comparePoint:function(e,t){return w(this),E(e,"HIERARCHY_REQUEST_ERR"),C(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)<0?-1:z(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:st,toHtml:function(){return O(this)},intersectsNode:function(e,t){if(w(this),Q(e)!=r(this))return!1;var n=e.parentNode,o=W(e);if(!n)return!0;var i=z(n,o,this.endContainer,this.endOffset),a=z(n,o+1,this.startContainer,this.startOffset);return t?0>=i&&a>=0:0>i&&a>0},isPointInRange:function(e,t){return w(this),E(e,"HIERARCHY_REQUEST_ERR"),C(e,this.startContainer),z(e,t,this.startContainer,this.startOffset)>=0&&z(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return s(this,e,!1)},intersectsOrTouchesRange:function(e){return s(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=z(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=z(this.endContainer,this.endOffset,e.endContainer,e.endOffset),r=this.cloneRange();return-1==t&&r.setStart(e.startContainer,e.startOffset),1==n&&r.setEnd(e.endContainer,e.endOffset),r}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==z(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==z(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new k("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==mt},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,q(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var r=n.pop();return t.setEnd(r,r.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return w(this),l(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var r=n(this),o=e.createRange(r);t=t||B.getBody(r),o.selectNodeContents(t);var i=this.intersection(o),a=0,s=0;return i&&(o.setEnd(i.startContainer,i.startOffset),a=o.toString().length,s=a+i.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var r,o,i,a,s=[t],c=!1,d=!1;!d&&(r=s.pop());)if(3==r.nodeType)o=n+r.length,!c&&e.start>=n&&e.start<=o&&(this.setStart(r,e.start-n),c=!0),c&&e.end>=n&&e.end<=o&&(this.setEnd(r,e.end-n),d=!0),n=o;else for(a=r.childNodes,i=a.length;i--;)s.push(a[i])},getName:function(){return"DomRange"},equals:function(e){return I.rangesEqual(this,e)},isValid:function(){return y(this)},inspect:function(){return h(this)},detach:function(){}}),x(I,P),H.extend(I,{rangeProperties:ct,RangeIterator:g,copyComparisonConstants:D,createPrototypeRange:x,inspect:h,toHtml:O,getRangeDocument:n,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=I}),I.createCoreModule("WrappedRange",["DomRange"],function(e,t){var n,r,o=e.dom,i=e.util,a=o.DomPosition,s=e.DomRange,c=o.getBody,d=o.getContentDocument,f=o.isCharacterDataNode;if(e.features.implementsDomRange&&!function(){function r(e){for(var t,n=l.length;n--;)t=l[n],e[t]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}function a(e,t,n,r,o){var i=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==r||e.endOffset!=o,s=!e.equals(e.nativeRange);(i||a||s)&&(e.setEnd(r,o),e.setStart(t,n))}var f,u,l=s.rangeProperties;n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,r(this)},s.createPrototypeRange(n,a),f=n.prototype,f.selectNode=function(e){this.nativeRange.selectNode(e),r(this)},f.cloneContents=function(){return this.nativeRange.cloneContents()},f.surroundContents=function(e){this.nativeRange.surroundContents(e),r(this)},f.collapse=function(e){this.nativeRange.collapse(e),r(this)},f.cloneRange=function(){return new n(this.nativeRange.cloneRange())},f.refresh=function(){r(this)},f.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");c(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),f.setStart=function(e,t){this.nativeRange.setStart(e,t),r(this)},f.setEnd=function(e,t){this.nativeRange.setEnd(e,t),r(this)},u=function(e){return function(t){this.nativeRange[e](t),r(this)}}}catch(p){f.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}r(this)},f.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}r(this)},u=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(o){this.nativeRange[t](n),this.nativeRange[e](n)}r(this)}}}f.setStartBefore=u("setStartBefore","setEndBefore"),f.setStartAfter=u("setStartAfter","setEndAfter"),f.setEndBefore=u("setEndBefore","setStartBefore"),f.setEndAfter=u("setEndAfter","setStartAfter"),f.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var m=document.createRange();m.selectNodeContents(h),m.setEnd(h,4),m.setStart(h,2),f.compareBoundaryPoints=-1==g.compareBoundaryPoints(g.START_TO_END,m)&&1==g.compareBoundaryPoints(g.END_TO_START,m)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var R=document.createElement("div");R.innerHTML="123";var v=R.firstChild,C=c(document);C.appendChild(R),g.setStart(v,1),g.setEnd(v,2),g.deleteContents(),"13"==v.data&&(f.deleteContents=function(){this.nativeRange.deleteContents(),r(this)},f.extractContents=function(){var e=this.nativeRange.extractContents();return r(this),e}),C.removeChild(R),C=null,i.isHostMethod(g,"createContextualFragment")&&(f.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),c(document).removeChild(h),f.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return e=d(e,t,"createNativeRange"),e.createRange()}}(),e.features.implementsTextRange){var u=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var r=n.parentElement();n=e.duplicate(),n.collapse(!1);var i=n.parentElement(),a=r==i?r:o.getCommonAncestor(r,i);return a==t?a:o.getCommonAncestor(t,a)},l=function(e){return 0==e.compareEndPoints("StartToEnd",e)},h=function(e,t,n,r,i){var s=e.duplicate();s.collapse(n);var c=s.parentElement();if(o.isOrIsAncestorOf(t,c)||(c=t),!c.canHaveHTML){var d=new a(c.parentNode,o.getNodeIndex(c));return{boundaryPosition:d,nodeInfo:{nodeIndex:d.offset,containerElement:d.node}}}var u=o.getDocument(c).createElement("span");u.parentNode&&o.removeNode(u);for(var l,h,g,p,m,R=n?"StartToStart":"StartToEnd",v=i&&i.containerElement==c?i.nodeIndex:0,C=c.childNodes.length,N=C,E=N;;){if(E==C?c.appendChild(u):c.insertBefore(u,c.childNodes[E]),s.moveToElementText(u),l=s.compareEndPoints(R,e),0==l||v==N)break;if(-1==l){if(N==v+1)break;v=E}else N=N==v+1?v:E;E=Math.floor((v+N)/2),c.removeChild(u)}if(m=u.nextSibling,-1==l&&m&&f(m)){s.setEndPoint(n?"EndToStart":"EndToEnd",e);var S;if(/[\r\n]/.test(m.data)){var y=s.duplicate(),w=y.text.replace(/\r\n/g,"\r").length;for(S=y.moveStart("character",w);-1==(l=y.compareEndPoints("StartToEnd",y));)S++,y.moveStart("character",1)}else S=s.text.length;p=new a(m,S)}else h=(r||!n)&&u.previousSibling,g=(r||n)&&u.nextSibling,p=g&&f(g)?new a(g,0):h&&f(h)?new a(h,h.data.length):new a(c,o.getNodeIndex(u));return o.removeNode(u),{boundaryPosition:p,nodeInfo:{nodeIndex:E,containerElement:c}}},g=function(e,t){var n,r,i,a,s=e.offset,d=o.getDocument(e.node),u=c(d).createTextRange(),l=f(e.node);return l?(n=e.node,r=n.parentNode):(a=e.node.childNodes,n=s<a.length?a[s]:null,r=e.node),i=d.createElement("span"),i.innerHTML="&#feff;",n?r.insertBefore(i,n):r.appendChild(i),u.moveToElementText(i),u.collapse(!t),r.removeChild(i),l&&u[t?"moveStart":"moveEnd"]("character",s),u};r=function(e){this.textRange=e,this.refresh()},r.prototype=new s(document),r.prototype.refresh=function(){var e,t,n,r=u(this.textRange);
|
11 |
+
l(this.textRange)?t=e=h(this.textRange,r,!0,!0).boundaryPosition:(n=h(this.textRange,r,!0,!1),e=n.boundaryPosition,t=h(this.textRange,r,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},r.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(r);var p=function(e){if(e.collapsed)return g(new a(e.startContainer,e.startOffset),!0);var t=g(new a(e.startContainer,e.startOffset),!0),n=g(new a(e.endContainer,e.endOffset),!1),r=c(s.getRangeDocument(e)).createTextRange();return r.setEndPoint("StartToStart",t),r.setEndPoint("EndToEnd",n),r};if(r.rangeToTextRange=p,r.prototype.toTextRange=function(){return p(this)},e.WrappedTextRange=r,!e.features.implementsDomRange||e.config.preferTextRange){var m=function(e){return e("return this;")()}(Function);"undefined"==typeof m.Range&&(m.Range=r),e.createNativeRange=function(e){return e=d(e,t,"createNativeRange"),c(e).createTextRange()},e.WrappedRange=r}}e.createRange=function(n){return n=d(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createRangyRange=function(e){return e=d(e,t,"createRangyRange"),new s(e)},i.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),i.createAliasForDeprecatedMethod(e,"createIframeRangyRange","createRangyRange"),e.addShimListener(function(t){var n=t.document;"undefined"==typeof n.createRange&&(n.createRange=function(){return e.createRange(n)}),n=t=null})}),I.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],function(e,t){function n(e){return"string"==typeof e?/^backward(s)?$/i.test(e):!!e}function r(e,n){if(e){if(D.isWindow(e))return e;if(e instanceof R)return e.win;var r=D.getContentDocument(e,t,n);return D.getWindow(r)}return window}function o(e){return r(e,"getWinSelection").getSelection()}function i(e){return r(e,"getDocSelection").document.selection}function a(e){var t=!1;return e.anchorNode&&(t=1==D.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}function s(e,t,n){var r=n?"end":"start",o=n?"start":"end";e.anchorNode=t[r+"Container"],e.anchorOffset=t[r+"Offset"],e.focusNode=t[o+"Container"],e.focusOffset=t[o+"Offset"]}function c(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function d(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function f(t){var n;return t instanceof b?(n=e.createNativeRange(t.getDocument()),n.setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof P?n=t.nativeRange:H.implementsDomRange&&t instanceof D.getWindow(t.startContainer).Range&&(n=t),n}function u(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;n>t;++t)if(!D.isAncestorOf(e[0],e[t]))return!1;return!0}function l(e){var n=e.getNodes();if(!u(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function h(e){return!!e&&"undefined"!=typeof e.text}function g(e,t){var n=new P(t);e._ranges=[n],s(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed}function p(t){if(t._ranges.length=0,"None"==t.docSelection.type)d(t);else{var n=t.docSelection.createRange();if(h(n))g(t,n);else{t.rangeCount=n.length;for(var r,o=k(n.item(0)),i=0;i<t.rangeCount;++i)r=e.createRange(o),r.selectNode(n.item(i)),t._ranges.push(r);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,s(t,t._ranges[t.rangeCount-1],!1)}}}function m(e,n){for(var r=e.docSelection.createRange(),o=l(n),i=k(r.item(0)),a=L(i).createControlRange(),s=0,c=r.length;c>s;++s)a.add(r.item(s));try{a.add(o)}catch(d){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),p(e)}function R(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function v(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset=e.focusOffset=0,e.detached=!0}function C(e,t){for(var n,r,o=tt.length;o--;)if(n=tt[o],r=n.selection,"deleteAll"==t)v(r);else if(n.win==e)return"delete"==t?(tt.splice(o,1),!0):r;return"deleteAll"==t&&(tt.length=0),null}function N(e,n){for(var r,o=k(n[0].startContainer),i=L(o).createControlRange(),a=0,s=n.length;s>a;++a){r=l(n[a]);try{i.add(r)}catch(c){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}i.select(),p(e)}function E(e,t){if(e.win.document!=k(t))throw new I("WRONG_DOCUMENT_ERR")}function S(t){return function(n,r){var o;this.rangeCount?(o=this.getRangeAt(0),o["set"+(t?"Start":"End")](n,r)):(o=e.createRange(this.win.document),o.setStartAndEnd(n,r)),this.setSingleRange(o,this.isBackward())}}function y(e){var t=[],n=new B(e.anchorNode,e.anchorOffset),r=new B(e.focusNode,e.focusOffset),o="function"==typeof e.getName?e.getName():"Selection";if("undefined"!=typeof e.rangeCount)for(var i=0,a=e.rangeCount;a>i;++i)t[i]=b.inspect(e.getRangeAt(i));return"["+o+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+r.inspect()+"]"}e.config.checkSelectionRanges=!0;var w,T,O="boolean",_="number",D=e.dom,A=e.util,x=A.isHostMethod,b=e.DomRange,P=e.WrappedRange,I=e.DOMException,B=D.DomPosition,H=e.features,M="Control",k=D.getDocument,L=D.getBody,W=b.rangesEqual,F=x(window,"getSelection"),j=A.isHostObject(document,"selection");H.implementsWinGetSelection=F,H.implementsDocSelection=j;var z=j&&(!F||e.config.preferTextRange);if(z)w=i,e.isSelectionValid=function(e){var t=r(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||k(n.createRange().parentElement())==t};else{if(!F)return t.fail("Neither document.selection or window.getSelection() detected."),!1;w=o,e.isSelectionValid=function(){return!0}}e.getNativeSelection=w;var U=w();if(!U)return t.fail("Native selection was null (possibly issue 138?)"),!1;var V=e.createNativeRange(document),q=L(document),Y=A.areHostProperties(U,["anchorNode","focusNode","anchorOffset","focusOffset"]);H.selectionHasAnchorAndFocus=Y;var Q=x(U,"extend");H.selectionHasExtend=Q;var G=typeof U.rangeCount==_;H.selectionHasRangeCount=G;var X=!1,Z=!0,$=Q?function(t,n){var r=b.getRangeDocument(n),o=e.createRange(r);o.collapseToPoint(n.endContainer,n.endOffset),t.addRange(f(o)),t.extend(n.startContainer,n.startOffset)}:null;A.areHostMethods(U,["addRange","getRangeAt","removeAllRanges"])&&typeof U.rangeCount==_&&H.implementsDomRange&&!function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,r=n>1,o=[],i=a(t),s=0;n>s;++s)o[s]=t.getRangeAt(s);var c=D.createTestElement(document,"",!1),d=c.appendChild(document.createTextNode(" ")),f=document.createRange();if(f.setStart(d,1),f.collapse(!0),t.removeAllRanges(),t.addRange(f),Z=1==t.rangeCount,t.removeAllRanges(),!r){var u=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(u&&parseInt(u[1])>=36)X=!1;else{var l=f.cloneRange();f.setStart(d,0),l.setEnd(d,3),l.setStart(d,2),t.addRange(f),t.addRange(l),X=2==t.rangeCount}}for(D.removeNode(c),t.removeAllRanges(),s=0;n>s;++s)0==s&&i?$?$(t,o[s]):(e.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(o[s])):t.addRange(o[s])}}(),H.selectionSupportsMultipleRanges=X,H.collapsedNonEditableSelectionsSupported=Z;var J,K=!1;q&&x(q,"createControlRange")&&(J=q.createControlRange(),A.areHostProperties(J,["item","add"])&&(K=!0)),H.implementsControlRange=K,T=Y?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return e.rangeCount?e.getRangeAt(e.rangeCount-1).collapsed:!1};var et;x(U,"getRangeAt")?et=function(e,t){try{return e.getRangeAt(t)}catch(n){return null}}:Y&&(et=function(t){var n=k(t.anchorNode),r=e.createRange(n);return r.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),r.collapsed!==this.isCollapsed&&r.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),r}),R.prototype=e.selectionPrototype;var tt=[],nt=function(e){if(e&&e instanceof R)return e.refresh(),e;e=r(e,"getNativeSelection");var t=C(e),n=w(e),o=j?i(e):null;return t?(t.nativeSelection=n,t.docSelection=o,t.refresh()):(t=new R(n,o,e),tt.push({win:e,selection:t})),t};e.getSelection=nt,A.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var rt=R.prototype;if(!z&&Y&&A.areHostMethods(U,["removeAllRanges","addRange"])){rt.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),d(this)};var ot=function(e,t){$(e.nativeSelection,t),e.refresh()};rt.addRange=G?function(t,r){if(K&&j&&this.docSelection.type==M)m(this,t);else if(n(r)&&Q)ot(this,t);else{var o;X?o=this.rangeCount:(this.removeAllRanges(),o=0);var i=f(t).cloneRange();try{this.nativeSelection.addRange(i)}catch(a){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==o+1){if(e.config.checkSelectionRanges){var c=et(this.nativeSelection,this.rangeCount-1);c&&!W(c,t)&&(t=new P(c))}this._ranges[this.rangeCount-1]=t,s(this,t,st(this.nativeSelection)),this.isCollapsed=T(this)}else this.refresh()}}:function(e,t){n(t)&&Q?ot(this,e):(this.nativeSelection.addRange(f(e)),this.refresh())},rt.setRanges=function(e){if(K&&j&&e.length>1)N(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;n>t;++t)this.addRange(e[t])}}}else{if(!(x(U,"empty")&&x(V,"select")&&K&&z))return t.fail("No means of selecting a Range or TextRange was found"),!1;rt.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=k(this.anchorNode);else if(this.docSelection.type==M){var t=this.docSelection.createRange();t.length&&(e=k(t.item(0)))}if(e){var n=L(e).createTextRange();n.select(),this.docSelection.empty()}}}catch(r){}d(this)},rt.addRange=function(t){this.docSelection.type==M?m(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,s(this,t,!1))},rt.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?N(this,e):t&&this.addRange(e[0])}}rt.getRangeAt=function(e){if(0>e||e>=this.rangeCount)throw new I("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()};var it;if(z)it=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=L(t.win.document).createTextRange(),n.collapse(!0)),t.docSelection.type==M?p(t):h(n)?g(t,n):d(t)};else if(x(U,"getRangeAt")&&typeof U.rangeCount==_)it=function(t){if(K&&j&&t.docSelection.type==M)p(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,r=t.rangeCount;r>n;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));s(t,t._ranges[t.rangeCount-1],st(t.nativeSelection)),t.isCollapsed=T(t)}else d(t)};else{if(!Y||typeof U.isCollapsed!=O||typeof V.collapsed!=O||!H.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;it=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=et(n,0),e._ranges=[t],e.rangeCount=1,c(e),e.isCollapsed=T(e)):d(e)}}rt.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,r=this.anchorOffset;if(it(this),e){var o=t.length;if(o!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=r)return!0;for(;o--;)if(!W(t[o],this._ranges[o]))return!0;return!1}};var at=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var r=0,o=n.length;o>r;++r)W(t,n[r])||e.addRange(n[r]);e.rangeCount||d(e)};rt.removeRange=K&&j?function(e){if(this.docSelection.type==M){for(var t,n=this.docSelection.createRange(),r=l(e),o=k(n.item(0)),i=L(o).createControlRange(),a=!1,s=0,c=n.length;c>s;++s)t=n.item(s),t!==r||a?i.add(n.item(s)):a=!0;i.select(),p(this)}else at(this,e)}:function(e){at(this,e)};var st;!z&&Y&&H.implementsDomRange?(st=a,rt.isBackward=function(){return st(this)}):st=rt.isBackward=function(){return!1},rt.isBackwards=rt.isBackward,rt.toString=function(){for(var e=[],t=0,n=this.rangeCount;n>t;++t)e[t]=""+this._ranges[t];return e.join("")},rt.collapse=function(t,n){E(this,t);var r=e.createRange(t);r.collapseToPoint(t,n),this.setSingleRange(r),this.isCollapsed=!0},rt.collapseToStart=function(){if(!this.rangeCount)throw new I("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},rt.collapseToEnd=function(){if(!this.rangeCount)throw new I("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},rt.selectAllChildren=function(t){E(this,t);var n=e.createRange(t);n.selectNodeContents(t),this.setSingleRange(n)},rt.deleteFromDocument=function(){if(K&&j&&this.docSelection.type==M){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),D.removeNode(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var r=0,o=n.length;o>r;++r)n[r].deleteContents();this.addRange(n[o-1])}}},rt.eachRange=function(e,t){for(var n=0,r=this._ranges.length;r>n;++n)if(e(this.getRangeAt(n)))return t},rt.getAllRanges=function(){var e=[];return this.eachRange(function(t){e.push(t)}),e},rt.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},rt.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange(function(r){n.push(r[e].apply(r,t||[]))}),n},rt.setStart=S(!0),rt.setEnd=S(!1),e.rangePrototype.select=function(e){nt(this.getDocument()).setSingleRange(this,e)},rt.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange(function(n){e(n),t.push(n)}),this.removeAllRanges(),n&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)},rt.containsNode=function(e,t){return this.eachRange(function(n){return n.containsNode(e,t)},!0)||!1},rt.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},rt.moveToBookmark=function(t){for(var n,r,o=[],i=0;n=t.rangeBookmarks[i++];)r=e.createRange(this.win),r.moveToBookmark(n),o.push(r);t.backward?this.setSingleRange(o[0],"backward"):this.setRanges(o)},rt.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},rt.restoreRanges=function(e){this.removeAllRanges();for(var t,n=0;t=e.ranges[n];++n)this.addRange(t,e.backward&&0==n)},rt.toHtml=function(){var e=[];return this.eachRange(function(t){e.push(b.toHtml(t))}),e.join("")},H.implementsTextRange&&(rt.getNativeTextRange=function(){var n;if(n=this.docSelection){var r=n.createRange();if(h(r))return r;throw t.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),rt.getName=function(){return"WrappedSelection"},rt.inspect=function(){return y(this)},rt.detach=function(){C(this.win,"delete"),v(this)},R.detachAll=function(){C(null,"deleteAll")},R.inspect=y,R.isDirectionBackward=n,e.Selection=R,e.selectionPrototype=rt,e.addShimListener(function(e){"undefined"==typeof e.getSelection&&(e.getSelection=function(){return nt(e)}),e=null})});var L=!1,W=function(){L||(L=!0,!I.initialized&&I.config.autoInitialize&&u())};return b&&("complete"==document.readyState?W():(e(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",W,!1),H(window,"load",W))),I},this);
|
wp-recipe-maker.php
CHANGED
@@ -13,9 +13,9 @@
|
|
13 |
*
|
14 |
* @wordpress-plugin
|
15 |
* Plugin Name: WP Recipe Maker
|
16 |
-
* Plugin URI: http://bootstrapped.ventures/
|
17 |
* Description: The easy and user-friendly recipe plugin for everyone. Automatic JSON-LD metadata for better SEO will get you more visitors!
|
18 |
-
* Version: 1.
|
19 |
* Author: Bootstrapped Ventures
|
20 |
* Author URI: http://bootstrapped.ventures/
|
21 |
* License: GPL-2.0+
|
13 |
*
|
14 |
* @wordpress-plugin
|
15 |
* Plugin Name: WP Recipe Maker
|
16 |
+
* Plugin URI: http://bootstrapped.ventures/wp-recipe-maker/
|
17 |
* Description: The easy and user-friendly recipe plugin for everyone. Automatic JSON-LD metadata for better SEO will get you more visitors!
|
18 |
+
* Version: 1.5.0
|
19 |
* Author: Bootstrapped Ventures
|
20 |
* Author URI: http://bootstrapped.ventures/
|
21 |
* License: GPL-2.0+
|