Changeset 3386144
- Timestamp:
- 10/29/2025 03:34:59 AM (5 months ago)
- Location:
- wp-duplicate-page/trunk
- Files:
-
- 9 edited
-
assets/css/admin-setting.css (modified) (1 diff)
-
assets/js/admin-setting.js (modified) (1 diff)
-
includes/Classes/ButtonDuplicate.php (modified) (7 diffs)
-
includes/Classes/CreateDuplicate.php (modified) (2 diffs)
-
includes/Helper/Utils.php (modified) (1 diff)
-
includes/Page/Settings.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
views/pages/html-settings.php (modified) (1 diff)
-
wp-duplicate-page.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-duplicate-page/trunk/assets/css/admin-setting.css
r2919487 r3386144 1 1 .settings_page_njt-duplicate-settings .wrap { 2 margin: 0;2 margin: 0; 3 3 } 4 4 .settings_page_njt-duplicate-settings #wpbody-content { 5 padding: 0;6 overflow-x: hidden !important;7 min-height: calc(100vh - 32px);5 padding: 0; 6 overflow-x: hidden !important; 7 min-height: calc(100vh - 32px); 8 8 } 9 9 @media (min-width: 783px) { 10 .settings_page_njt-duplicate-settings #wpbody-content {11 padding-left: 0;12 }10 .settings_page_njt-duplicate-settings #wpbody-content { 11 padding-left: 0; 12 } 13 13 } 14 14 :root { 15 --large-gap: 40px;16 --main-gap: 24px;15 --large-gap: 40px; 16 --main-gap: 24px; 17 17 } 18 18 @media (max-width: 960px) { 19 :root {20 --large-gap: 24px;21 }19 :root { 20 --large-gap: 24px; 21 } 22 22 } 23 23 @media (max-width: 782px) { 24 :root {25 --large-gap: 16px;26 --main-gap: 16px;27 }24 :root { 25 --large-gap: 16px; 26 --main-gap: 16px; 27 } 28 28 } 29 29 @keyframes loading-fade { 30 0% {31 opacity: 0.7;32 }33 50% {34 opacity: 1;35 }36 to {37 opacity: 0.7;38 }30 0% { 31 opacity: 0.7; 32 } 33 50% { 34 opacity: 1; 35 } 36 to { 37 opacity: 0.7; 38 } 39 39 } 40 40 .njt-duplicate-layout * { 41 box-sizing: border-box;41 box-sizing: border-box; 42 42 } 43 43 .njt-duplicate-layout-primary { 44 margin: 40px 0 0 40px;45 margin: 40px 0 0 var(--large-gap);44 margin: 40px 0 0 40px; 45 margin: 40px 0 0 var(--large-gap); 46 46 } 47 47 @media (min-width: 961px) { 48 .njt-duplicate-layout-primary {49 margin-top: 40px;50 }48 .njt-duplicate-layout-primary { 49 margin-top: 40px; 50 } 51 51 } 52 52 @media (max-width: 782px) { 53 .njt-duplicate-layout-primary {54 margin-top: 30px;55 }53 .njt-duplicate-layout-primary { 54 margin-top: 30px; 55 } 56 56 } 57 57 .njt-duplicate-layout .njt-duplicate-layout-main { 58 padding-right: 40px;59 padding-right: var(--large-gap);60 max-width: 100%;58 padding-right: 40px; 59 padding-right: var(--large-gap); 60 max-width: 100%; 61 61 } 62 62 .njt-duplicate-settings { 63 max-width: 1032px;64 margin: 0 auto;63 max-width: 1032px; 64 margin: 0 auto; 65 65 } 66 66 .njt-duplicate-settings .njt-duplicate-card { 67 margin-bottom: 50px; 68 background: #fff; 69 border-radius: 3px; 70 box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12); 71 transition: box-shadow 0.2s cubic-bezier(0.4, 1, 0.4, 1); 67 margin-bottom: 50px; 68 background: #fff; 69 border-radius: 3px; 70 box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 71 0 1px 3px 0 rgba(0, 0, 0, 0.12); 72 transition: box-shadow 0.2s cubic-bezier(0.4, 1, 0.4, 1); 72 73 } 73 74 .njt-duplicate-settings .njt-duplicate-card-header { 74 padding: 5px 24px;75 border-bottom: 1px solid #e2e4e7;75 padding: 5px 24px; 76 border-bottom: 1px solid #e2e4e7; 76 77 } 77 78 .njt-duplicate-settings .njt-duplicate-card-title { 78 font-size: 20px;79 line-height: 10px;80 font-weight: 400;79 font-size: 20px; 80 line-height: 10px; 81 font-weight: 400; 81 82 } 82 83 .njt-duplicate-settings .njt-duplicate-card-description { 83 font-size: 14px;84 line-height: 20px;85 font-weight: 400;86 margin-top: 4px;84 font-size: 14px; 85 line-height: 20px; 86 font-weight: 400; 87 margin-top: 4px; 87 88 } 88 89 .njt-duplicate-settings .njt-duplicate-card .njt-duplicate-card-body { 89 padding: 16px 24px;90 padding: 16px 24px; 90 91 } 91 92 .njt-duplicate-control { 92 display: flex; 93 margin-bottom: 25px; 94 } 93 display: flex; 94 margin-bottom: 25px; 95 } 96 .njt-duplicate-control:last-of-type, 97 .njt-duplicate-control:last-of-type .njt-duplicate-base-control { 98 margin-bottom: 0; 99 } 100 95 101 @media (max-width: 782px) { 96 .njt-duplicate-base-control .njt-duplicate-base-control-field .njt-duplicate-select-control-input { 97 font-size: 16px; 98 } 102 .njt-duplicate-base-control 103 .njt-duplicate-base-control-field 104 .njt-duplicate-select-control-input { 105 font-size: 16px; 106 } 99 107 } 100 108 .njt-duplicate-base-control { 101 font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif; 109 font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans, 110 Ubuntu, Cantarell, Helvetica Neue, sans-serif; 111 font-size: 13px; 112 margin-bottom: 16px; 113 } 114 115 .njt-duplicate-base-control .njt-duplicate-base-control-field { 116 margin-bottom: 8px; 117 } 118 .njt-duplicate-control .njt-duplicate-base-control-label { 119 flex-basis: 150px; 120 margin-right: 40px; 121 min-width: 140px; 122 cursor: auto; 123 } 124 @media (max-width: 600px) { 125 .njt-duplicate-control .njt-duplicate-base-control-label { 126 min-width: 110px; 127 } 128 } 129 .njt-duplicate-control .njt-duplicate-text { 130 line-height: 30px; 131 } 132 .njt-duplicate-base-control .njt-duplicate-base-control-help { 133 margin-top: -8px; 134 font-style: italic; 135 } 136 .njt-duplicate-base-control 137 .njt-duplicate-base-control-help 138 .njt-duplicate-default-text { 139 font-weight: 700; 140 } 141 142 .njt-duplicate-text-control-input, 143 .njt-duplicate-text-control-input[type="text"] { 144 width: 100%; 145 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 146 Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 147 padding: 6px 8px; 148 box-shadow: 0 0 0 transparent; 149 transition: box-shadow 0.1s linear; 150 border-radius: 2px; 151 border: 1px solid #757575; 152 font-size: 16px; 153 line-height: normal; 154 } 155 @media (min-width: 600px) { 156 .njt-duplicate-text-control-input, 157 .njt-duplicate-text-control-input[type="text"] { 102 158 font-size: 13px; 103 margin-bottom: 16px;104 }105 106 .njt-duplicate-base-control .njt-duplicate-base-control-field {107 margin-bottom: 8px;108 }109 .njt-duplicate-control .njt-duplicate-base-control-label {110 margin-right: 40px;111 min-width: 140px;112 cursor: auto;113 }114 @media (max-width: 600px) {115 .njt-duplicate-control .njt-duplicate-base-control-label {116 min-width: 110px;117 }118 }119 .njt-duplicate-control .njt-duplicate-text {120 line-height: 30px;121 }122 .njt-duplicate-base-control .njt-duplicate-base-control-help {123 margin-top: -8px;124 font-style: italic;125 }126 .njt-duplicate-base-control .njt-duplicate-base-control-help .njt-duplicate-default-text {127 font-weight: 700;128 }129 130 .njt-duplicate-text-control-input, .njt-duplicate-text-control-input[type="text"] {131 width: 100%;132 font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;133 padding: 6px 8px;134 box-shadow: 0 0 0 transparent;135 transition: box-shadow 0.1s linear;136 border-radius: 2px;137 border: 1px solid #757575;138 font-size: 16px;139 159 line-height: normal; 140 } 141 @media (min-width: 600px) { 142 .njt-duplicate-text-control-input, .njt-duplicate-text-control-input[type="text"] { 143 font-size: 13px; 144 line-height: normal; 145 } 160 } 146 161 } 147 162 148 163 /* Style Checkbox */ 149 164 .njt-duplicate-checkbox-control-input-container { 150 position: relative; 151 display: inline-block; 152 margin-right: 12px; 153 vertical-align: middle; 165 position: relative; 166 display: inline-block; 167 margin-right: 12px; 168 vertical-align: middle; 169 width: 18px; 170 height: 18px; 171 } 172 .njt-duplicate-checkbox-control-input[type="checkbox"] { 173 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 174 Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 175 border: 1px solid #7e8993; 176 border-radius: 2px; 177 background: #fff; 178 color: #555; 179 clear: none; 180 cursor: pointer; 181 display: inline-block; 182 line-height: 0; 183 margin: 0 4px 0 0; 184 outline: 0; 185 padding: 0 !important; 186 text-align: center; 187 vertical-align: top; 188 width: 18px; 189 height: 18px; 190 -webkit-appearance: none; 191 box-shadow: 0 0 0 transparent; 192 transition: border-color 0.1s ease-in-out; 193 } 194 .njt-duplicate-checkbox-control-input[type="checkbox"]:focus { 195 border-color: #5b9dd9; 196 box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #007cba; 197 outline: 2px solid transparent; 198 } 199 .njt-duplicate-checkbox-control-input[type="checkbox"]:checked { 200 background: #007cba; 201 border-color: #007cba; 202 } 203 .njt-duplicate-checkbox-control-input[type="checkbox"]:checked::-ms-check { 204 opacity: 0; 205 } 206 .njt-duplicate-checkbox-control-input[type="checkbox"]:focus:checked { 207 border: none; 208 } 209 .njt-duplicate-checkbox-control-input[type="checkbox"]:checked:before { 210 content: none; 211 } 212 @media (min-width: 600px) { 213 .njt-duplicate-checkbox-control-input-container { 154 214 width: 18px; 155 215 height: 18px; 156 } 157 .njt-duplicate-checkbox-control-input[type="checkbox"] { 158 font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; 159 border: 1px solid #7e8993; 160 border-radius: 2px; 161 background: #fff; 162 color: #555; 163 clear: none; 164 cursor: pointer; 165 display: inline-block; 166 line-height: 0; 167 margin: 0 4px 0 0; 168 outline: 0; 169 padding: 0 !important; 170 text-align: center; 171 vertical-align: top; 172 width: 18px; 173 height: 18px; 174 -webkit-appearance: none; 175 box-shadow: 0 0 0 transparent; 176 transition: border-color 0.1s ease-in-out; 177 } 178 .njt-duplicate-checkbox-control-input[type="checkbox"]:focus { 179 border-color: #5b9dd9; 180 box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #007CBA; 181 outline: 2px solid transparent; 182 } 183 .njt-duplicate-checkbox-control-input[type="checkbox"]:checked { 184 background: #007CBA; 185 border-color: #007CBA; 186 } 187 .njt-duplicate-checkbox-control-input[type="checkbox"]:checked::-ms-check { 188 opacity: 0; 189 } 190 .njt-duplicate-checkbox-control-input[type="checkbox"]:focus:checked { 191 border: none; 192 } 193 .njt-duplicate-checkbox-control-input[type="checkbox"]:checked:before { 194 content: none; 195 } 196 @media (min-width: 600px) { 197 .njt-duplicate-checkbox-control-input-container { 198 width: 18px; 199 height: 18px; 200 } 216 } 201 217 } 202 218 svg.njt-duplicate-checkbox-control-checked { 203 fill: #fff;204 cursor: pointer;205 position: absolute;206 left: 0;207 top: 0;208 width: 18px;209 height: 18px;210 -webkit-user-select: none;211 -ms-user-select: none;212 user-select: none;213 pointer-events: none;219 fill: #fff; 220 cursor: pointer; 221 position: absolute; 222 left: 0; 223 top: 0; 224 width: 18px; 225 height: 18px; 226 -webkit-user-select: none; 227 -ms-user-select: none; 228 user-select: none; 229 pointer-events: none; 214 230 } 215 231 svg { 216 fill: currentColor;217 outline: none;232 fill: currentColor; 233 outline: none; 218 234 } 219 235 .njt-duplicate-checkbox-control-label { 220 vertical-align: middle;236 vertical-align: middle; 221 237 } 222 238 223 239 .njt-duplicate-button.is-primary { 224 white-space: nowrap;225 background: #007CBA;226 border-color: #007CBA;227 color: #fff;228 text-decoration: none;229 text-shadow: none;240 white-space: nowrap; 241 background: #007cba; 242 border-color: #007cba; 243 color: #fff; 244 text-decoration: none; 245 text-shadow: none; 230 246 } 231 247 /* CSS button */ 232 248 .njt-duplicate-button { 233 display: inline-flex;234 text-decoration: none;235 font-size: 13px;236 margin: 0;237 border: 0;238 cursor: pointer;239 -webkit-appearance: none;240 background: none;241 transition: box-shadow 0.1s linear;242 height: 36px;243 align-items: center;244 box-sizing: border-box;245 padding: 6px 12px;246 border-radius: 2px;247 color: #1e1e1e;249 display: inline-flex; 250 text-decoration: none; 251 font-size: 13px; 252 margin: 0; 253 border: 0; 254 cursor: pointer; 255 -webkit-appearance: none; 256 background: none; 257 transition: box-shadow 0.1s linear; 258 height: 36px; 259 align-items: center; 260 box-sizing: border-box; 261 padding: 6px 12px; 262 border-radius: 2px; 263 color: #1e1e1e; 248 264 } 249 265 .njt-duplicate-button.is-primary:focus:enabled, 250 266 .njt-duplicate-button.is-primary:hover { 251 background: #0078a7;252 border-color: #0078a7;253 color: #fff;267 background: #0078a7; 268 border-color: #0078a7; 269 color: #fff; 254 270 } 255 271 .njt-duplicate-button.is-primary:focus:not(:disabled) { 256 box-shadow: inset 0 0 0 1px #fff, 0 0 0 1.5px #007cba;257 box-shadow: inset 0 0 0 1px #fff,0 0 0 1.5px #0078a7;258 outline: 1px solid transparent;272 box-shadow: inset 0 0 0 1px #fff, 0 0 0 1.5px #007cba; 273 box-shadow: inset 0 0 0 1px #fff, 0 0 0 1.5px #0078a7; 274 outline: 1px solid transparent; 259 275 } 260 276 .njt-duplicate-button.is-primary:active:not(:disabled) { 261 background: #005a87;262 border-color: #005a87;263 color: #fff;277 background: #005a87; 278 border-color: #005a87; 279 color: #fff; 264 280 } 265 281 .njt-duplicate-button.is-primary:hover:not(:disabled) { 266 background: #006ba1;267 color: #fff;282 background: #006ba1; 283 color: #fff; 268 284 } 269 285 .njt-duplicate-button:not([aria-disabled="true"]):active { 270 color: inherit;286 color: inherit; 271 287 } 272 288 .njt-duplicate-button:focus:not(:disabled) { 273 box-shadow: 0 0 0 1.5px #007cba;274 outline: 1px solid transparent;289 box-shadow: 0 0 0 1.5px #007cba; 290 outline: 1px solid transparent; 275 291 } 276 292 .njt-duplicate-button.is-busy:focus:not(:disabled) { 277 color: #fff; 278 background-size: 100px 100%; 279 background-image: linear-gradient(-45deg,#007cba 33%,#005a87 0,#005a87 70%,#007cba 0); 280 border-color: #007cba; 281 animation: NjtButtonBusy 2.5s linear infinite; 282 opacity: 1; 293 color: #fff; 294 background-size: 100px 100%; 295 background-image: linear-gradient( 296 -45deg, 297 #007cba 33%, 298 #005a87 0, 299 #005a87 70%, 300 #007cba 0 301 ); 302 border-color: #007cba; 303 animation: NjtButtonBusy 2.5s linear infinite; 304 opacity: 1; 283 305 } 284 306 /* CSS Notification */ 285 307 .njt-duplicate-notification { 286 font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans,287 Ubuntu, Cantarell, Helvetica Neue, sans-serif;288 font-size: 13px;289 background-color: #32373C;290 border-radius: 4px;291 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);292 color: #fff;293 padding: 16px 24px;294 width: fit-content;295 max-width: 600px;296 box-sizing: border-box;297 cursor: pointer;298 animation: NslideUp 0.5s both linear;299 position: fixed;300 bottom: 20px;301 left: 50%;302 z-index: 20;308 font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans, 309 Ubuntu, Cantarell, Helvetica Neue, sans-serif; 310 font-size: 13px; 311 background-color: #32373c; 312 border-radius: 4px; 313 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); 314 color: #fff; 315 padding: 16px 24px; 316 width: fit-content; 317 max-width: 600px; 318 box-sizing: border-box; 319 cursor: pointer; 320 animation: NslideUp 0.5s both linear; 321 position: fixed; 322 bottom: 20px; 323 left: 50%; 324 z-index: 20; 303 325 } 304 326 @keyframes NslideUp { 305 from {306 opacity: 0;307 transform: translate3d(0, 50%, 0);308 }309 to {310 opacity: 1;311 transform: translate3d(0, 0, 0);312 }327 from { 328 opacity: 0; 329 transform: translate3d(0, 50%, 0); 330 } 331 to { 332 opacity: 1; 333 transform: translate3d(0, 0, 0); 334 } 313 335 } 314 336 @keyframes NslideDown { 315 from {316 opacity: 1;317 transform: translate3d(0, 0, 0);318 }319 to {320 opacity: 0;321 transform: translate3d(0, 50%, 0);322 }323 } 324 325 @keyframes NjtButtonBusy {326 0% {327 background-position:200px 0;328 }337 from { 338 opacity: 1; 339 transform: translate3d(0, 0, 0); 340 } 341 to { 342 opacity: 0; 343 transform: translate3d(0, 50%, 0); 344 } 345 } 346 347 @keyframes NjtButtonBusy { 348 0% { 349 background-position: 200px 0; 350 } 329 351 } 330 352 .njt-duplicate-notification .NslideDown { 331 animation: NslideDown 0.5s both linear;353 animation: NslideDown 0.5s both linear; 332 354 } 333 355 334 356 .njt-duplicate-notification-content { 335 display: flex;336 align-items: center;357 display: flex; 358 align-items: center; 337 359 } 338 360 339 361 .njt-duplicate-notification-success-message { 340 background: #00a42a; 341 border-radius: 50%; 342 margin-right: 10px; 343 padding: 2px; 344 height: 20px; 345 width: 20px; 346 } 362 background: #00a42a; 363 border-radius: 50%; 364 margin-right: 10px; 365 padding: 2px; 366 height: 20px; 367 width: 20px; 368 } 369 370 /* Toggle Switch Styles */ 371 .njt-duplicate-toggle-control { 372 position: relative; 373 display: inline-block; 374 width: 36px; 375 height: 16px; 376 } 377 378 .njt-duplicate-toggle-control-input { 379 opacity: 0; 380 width: 0; 381 height: 0; 382 } 383 384 .njt-duplicate-toggle-control-label { 385 position: absolute; 386 cursor: pointer; 387 top: 0; 388 left: 0; 389 right: 0; 390 bottom: 0; 391 background-color: #ccc; 392 transition: 0.4s; 393 border-radius: 24px; 394 } 395 396 .njt-duplicate-toggle-control-label:before { 397 position: absolute; 398 content: ""; 399 height: 12px; 400 width: 12px; 401 left: 2px; 402 bottom: 2px; 403 background-color: white; 404 transition: 0.4s; 405 border-radius: 50%; 406 box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); 407 } 408 409 .njt-duplicate-toggle-control-input:checked 410 + .njt-duplicate-toggle-control-label { 411 background-color: #007cba; 412 } 413 414 .njt-duplicate-toggle-control-input:checked 415 + .njt-duplicate-toggle-control-label:before { 416 transform: translateX(20px); 417 } 418 419 .njt-duplicate-toggle-control-switch { 420 display: none; 421 } -
wp-duplicate-page/trunk/assets/js/admin-setting.js
r2919487 r3386144 1 jQuery(document).ready(function ($){2 $( "#wpfooter #footer-thankyou").html(window.njt_duplicate_page.footerText);3 $( "#njt_duplicate_setting_form" ).submit(function(e) {1 jQuery(document).ready(function ($) { 2 $("#wpfooter #footer-thankyou").html(window.njt_duplicate_page.footerText); 3 $("#njt_duplicate_setting_form").submit(function (e) { 4 4 e.preventDefault(); 5 5 jQuery(".njt-duplicate-button.is-primary").addClass("is-busy"); 6 6 var njtDuplicateRoles = []; 7 7 var njtDuplicatePostTypes = []; 8 var njtDuplicateTextLink = 'Duplicate'; 8 var njtDuplicateTextLink = "Duplicate"; 9 var njtDuplicateRedirect = "0"; 9 10 var formValue = $(this).serializeArray(); 10 $.each(formValue, function (index, field) {11 if (field.name == 'njt_duplicate_roles[]') {11 $.each(formValue, function (index, field) { 12 if (field.name == "njt_duplicate_roles[]") { 12 13 njtDuplicateRoles.push(field.value); 13 14 } 14 if (field.name == 'njt_duplicate_post_types[]') {15 if (field.name == "njt_duplicate_post_types[]") { 15 16 njtDuplicatePostTypes.push(field.value); 16 17 } 17 if (field.name == 'njt_duplicate_text_link') {18 if (field.name == "njt_duplicate_text_link") { 18 19 njtDuplicateTextLink = field.value; 19 20 } 20 21 if (field.name == "njt_duplicate_redirect") { 22 njtDuplicateRedirect = field.value; 23 } 21 24 }); 22 25 23 26 $.ajax({ 24 27 url: window.njt_duplicate_page.ajaxUrl, 25 type: 'POST',28 type: "POST", 26 29 data: { 27 action : 'njt_duplicate_page_settings',28 njtDuplicateNonce : window.njt_duplicate_page.ajaxNonce,29 njtDuplicateRoles : njtDuplicateRoles,30 action: "njt_duplicate_page_settings", 31 njtDuplicateNonce: window.njt_duplicate_page.ajaxNonce, 32 njtDuplicateRoles: njtDuplicateRoles, 30 33 njtDuplicatePostTypes: njtDuplicatePostTypes, 31 njtDuplicateTextLink: njtDuplicateTextLink 34 njtDuplicateTextLink: njtDuplicateTextLink, 35 njtDuplicateRedirect: njtDuplicateRedirect, 32 36 }, 33 error: function () {34 njtDuplicateNotification( 'Errors', 'njt-duplicate-layout');37 error: function () { 38 njtDuplicateNotification("Errors", "njt-duplicate-layout"); 35 39 jQuery(".njt-duplicate-button.is-primary").removeClass("is-busy"); 36 40 }, 37 success: function () {38 njtDuplicateNotification( 'Settings saved.', 'njt-duplicate-layout');41 success: function () { 42 njtDuplicateNotification("Settings saved.", "njt-duplicate-layout"); 39 43 jQuery(".njt-duplicate-button.is-primary").removeClass("is-busy"); 40 }, 41 });44 }, 45 }); 42 46 }); 43 47 }); 44 48 function njtDuplicateNotification(messages, containerClass) { 45 let notifyHtml =46 '<div class="njt-duplicate-notification"><div class="njt-duplicate-notification-content"><div class="njt-duplicate-notification-success-message"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><g data-name="Layer 2"><g data-name="checkmark"><rect width="24" height="24" opacity="0" /><path d="M9.86 18a1 1 0 0 1-.73-.32l-4.86-5.17a1 1 0 1 1 1.46-1.37l4.12 4.39 8.41-9.2a1 1 0 1 1 1.48 1.34l-9.14 10a1 1 0 0 1-.73.33z" /></g></g></svg></div>' +47 messages +48 "</div></div>";49 jQuery("." + containerClass).after(notifyHtml);50 setTimeout(function() {51 jQuery(".njt-duplicate-notification").addClass("NslideDown");52 setTimeout(function() {53 jQuery(".njt-duplicate-notification").remove();54 }, 1000);55 }, 1500);49 let notifyHtml = 50 '<div class="njt-duplicate-notification"><div class="njt-duplicate-notification-content"><div class="njt-duplicate-notification-success-message"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#fff"><g data-name="Layer 2"><g data-name="checkmark"><rect width="24" height="24" opacity="0" /><path d="M9.86 18a1 1 0 0 1-.73-.32l-4.86-5.17a1 1 0 1 1 1.46-1.37l4.12 4.39 8.41-9.2a1 1 0 1 1 1.48 1.34l-9.14 10a1 1 0 0 1-.73.33z" /></g></g></svg></div>' + 51 messages + 52 "</div></div>"; 53 jQuery("." + containerClass).after(notifyHtml); 54 setTimeout(function () { 55 jQuery(".njt-duplicate-notification").addClass("NslideDown"); 56 setTimeout(function () { 57 jQuery(".njt-duplicate-notification").remove(); 58 }, 1000); 59 }, 1500); 56 60 } 57 -
wp-duplicate-page/trunk/includes/Classes/ButtonDuplicate.php
r3202058 r3386144 55 55 if ( 'wp_duplicate_page_bulk_action' === $action ) { 56 56 // Get the original post 57 $counter = 0; 57 $counter = 0; 58 $lastNewPostId = null; 58 59 if ( is_array( $postIds ) ) { 59 60 foreach ( $postIds as $postId ) { … … 64 65 $createDuplicate = CreateDuplicate::getInstance(); 65 66 $newPostId = $createDuplicate->createDuplicate( $post ); 67 $lastNewPostId = $newPostId; // Store the last created post ID 66 68 ++$counter; 67 69 … … 71 73 } 72 74 } 75 76 // Check if redirect to edit page is enabled and we have a last created post 77 $redirectToEdit = get_option( 'njt_duplicate_redirect', true ); 78 if ( $redirectToEdit && $lastNewPostId && $counter === 1 ) { 79 // Only redirect to edit page if we duplicated exactly one item 80 $editUrl = get_edit_post_link( $lastNewPostId, 'raw' ); 81 if ( $editUrl ) { 82 wp_safe_redirect( $editUrl ); 83 exit; 84 } 85 } 86 73 87 return add_query_arg( 'bulk_cloned', $counter, $redirect ); 74 88 } … … 78 92 public function duplicateBulkHandleHPOS( $redirect, $action, $ids ) { 79 93 if ( 'wp_duplicate_page_bulk_action' === $action ) { 80 $counter = 0; 94 $counter = 0; 95 $lastNewOrderId = null; 81 96 if ( is_array( $ids ) ) { 82 97 foreach ( $ids as $orderId ) { … … 85 100 $createDuplicate = CreateDuplicate::getInstance(); 86 101 $newOrderId = $createDuplicate->createDuplicateOrderHPOS( $order ); 102 $lastNewOrderId = $newOrderId; // Store the last created order ID 87 103 ++$counter; 88 104 } else { … … 91 107 } 92 108 } 109 110 // Check if redirect to edit page is enabled and we have a last created order 111 $redirectToEdit = get_option( 'njt_duplicate_redirect', true ); 112 if ( $redirectToEdit && $lastNewOrderId && $counter === 1 ) { 113 // Only redirect to edit page if we duplicated exactly one item 114 $editUrl = get_edit_post_link( $lastNewOrderId, 'raw' ); 115 if ( $editUrl ) { 116 wp_safe_redirect( $editUrl ); 117 exit; 118 } 119 } 120 93 121 return add_query_arg( 'bulk_cloned', $counter, $redirect ); 94 122 } … … 158 186 $createDuplicate = CreateDuplicate::getInstance(); 159 187 $newPostId = $createDuplicate->createDuplicate( $post ); 160 $redirect = wp_get_referer(); 188 189 // Check if redirect to edit page is enabled 190 $redirectToEdit = get_option( 'njt_duplicate_redirect', true ); 191 192 if ( $redirectToEdit && $newPostId ) { 193 // Redirect to the edit page of the newly created duplicate 194 $editUrl = get_edit_post_link( $newPostId, 'raw' ); 195 if ( $editUrl ) { 196 wp_safe_redirect( $editUrl ); 197 exit; 198 } 199 } 200 201 // Fallback to original redirect logic if redirect to edit is disabled or failed 202 $redirect = wp_get_referer(); 161 203 if ( ! $redirect || 162 204 strpos( $redirect, 'post.php' ) !== false || -
wp-duplicate-page/trunk/includes/Classes/CreateDuplicate.php
r3214636 r3386144 92 92 'status' => 'pending', 93 93 'currency' => $originalOrder->get_currency(), 94 'created_via' => $originalOrder->get_created_via(),94 'created_via' => $originalOrder->get_created_via(), 95 95 'billing' => $originalOrder->get_address( 'billing' ), 96 96 'shipping' => $originalOrder->get_address( 'shipping' ), … … 100 100 101 101 foreach ( $originalOrder->get_meta_data() as $meta ) { 102 if ( Utils::excludeMetaKey( $meta->key ) ) { 103 continue; 104 } 102 105 $order->update_meta_data( $meta->key, $meta->value ); 103 106 } -
wp-duplicate-page/trunk/includes/Helper/Utils.php
r2743200 r3386144 17 17 return in_array( $postType, $duplicatePostTypes ); 18 18 } 19 20 //Not duplicate meta key 21 public static function excludeMetaKey( $key ) { 22 $exclude_meta_key = apply_filters( 23 'wp_duplicate_page_exclude_meta_key', 24 array( 25 '_order_number', 26 ) 27 ); 28 29 return in_array( $key, $exclude_meta_key ); 30 } 19 31 } 20 -
wp-duplicate-page/trunk/includes/Page/Settings.php
r3056519 r3386144 99 99 $postTypes = isset( $_POST['njtDuplicatePostTypes'] ) ? $this->sanitizeTextOrArrayField( (array) $_POST['njtDuplicatePostTypes'] ) : array(); 100 100 $textLink = isset( $_POST['njtDuplicateTextLink'] ) ? $this->sanitizeTextOrArrayField( $_POST['njtDuplicateTextLink'] ) : ''; 101 $redirect = isset( $_POST['njtDuplicateRedirect'] ) ? $this->sanitizeTextOrArrayField( $_POST['njtDuplicateRedirect'] ) : '1'; 101 102 102 103 update_option( 'njt_duplicate_roles', $roles ); 103 104 update_option( 'njt_duplicate_post_types', $postTypes ); 104 105 update_option( 'njt_duplicate_text_link', $textLink ); 106 update_option( 'njt_duplicate_redirect', $redirect ); 105 107 global $wp_roles; 106 108 $roles = $wp_roles->get_names(); -
wp-duplicate-page/trunk/readme.txt
r3379122 r3386144 6 6 Requires PHP: 5.3 7 7 Tested up to: 6.8 8 Stable tag: 1. 68 Stable tag: 1.7 9 9 License: GPL-2.0+ 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 80 80 == Changelog == 81 81 82 = Oct 29, 2025 - Version 1.7 = 83 - Added: Copy directly from post edit 84 82 85 = Dec 30, 2024 - Version 1.6 = 83 86 - Fixed: created_via metadata duplicated -
wp-duplicate-page/trunk/views/pages/html-settings.php
r3056519 r3386144 105 105 </div> 106 106 </div> 107 108 <?php /* Layout for redirect edit page after duplicate */ ?> 109 <div class="njt-duplicate-control"> 110 <label class="njt-duplicate-base-control-label"><?php echo esc_html( __( 'Redirect After Duplicate', 'wp-duplicate-page' ) ); ?></label> 111 <div class="njt-duplicate-base-control"> 112 <div class="njt-duplicate-base-control-field"> 113 <div class="njt-duplicate-toggle-control"> 114 <input 115 type="checkbox" 116 id="njt-duplicate-redirect-toggle" 117 name="njt_duplicate_redirect" 118 class="njt-duplicate-toggle-control-input" 119 value="1" 120 <?php 121 $redirectEnabled = get_option( 'njt_duplicate_redirect', true ); 122 if ( $redirectEnabled ) { 123 echo 'checked="checked"'; 124 } 125 ?> 126 /> 127 <label for="njt-duplicate-redirect-toggle" class="njt-duplicate-toggle-control-label"> 128 <span class="njt-duplicate-toggle-control-switch"></span> 129 </label> 130 </div> 131 </div> 132 <p class="njt-duplicate-base-control-help"><?php echo esc_html( __( 'Redirect to the edit page after duplicating a post/page.', 'wp-duplicate-page' ) ); ?></p> 133 </div> 134 </div> 135 107 136 <p class="submit"> 108 137 <input -
wp-duplicate-page/trunk/wp-duplicate-page.php
r3379122 r3386144 2 2 /** 3 3 * Plugin Name: WP Duplicate Page 4 * Plugin URI: https://ninjateam.org /wp-duplicate-page/4 * Plugin URI: https://ninjateam.org 5 5 * Description: Duplicate Posts, Pages and Custom Post Types. 6 * Version: 1. 66 * Version: 1.7 7 7 * Author: NinjaTeam 8 8 * Author URI: https://ninjateam.org … … 17 17 defined( 'ABSPATH' ) || exit; 18 18 19 define( 'NJT_DUPLICATE_VERSION', '1. 6' );19 define( 'NJT_DUPLICATE_VERSION', '1.7' ); 20 20 define( 'NJT_DUPLICATE_DOMAIN', 'wp-duplicate-page' ); 21 21
Note: See TracChangeset
for help on using the changeset viewer.