Plugin Directory

Changeset 3394773


Ignore:
Timestamp:
11/13/2025 05:39:48 AM (4 weeks ago)
Author:
ninjateam
Message:

WP Duplicate Page 1.8

Location:
wp-duplicate-page/trunk
Files:
5 added
8 edited

Legend:

Unmodified
Added
Removed
  • wp-duplicate-page/trunk/assets/css/admin-setting.css

    r3386144 r3394773  
    117117}
    118118.njt-duplicate-control .njt-duplicate-base-control-label {
    119   flex-basis: 150px;
     119  flex-basis: 200px;
    120120  margin-right: 40px;
    121   min-width: 140px;
     121  min-width: 180px;
    122122  cursor: auto;
    123123}
     
    420420  display: none;
    421421}
     422.njt-duplicate-wrap,
     423.njt-duplicate-wrap * {
     424  box-sizing: border-box;
     425}
     426/* Header */
     427.njt-duplicate-top-header {
     428  display: flex;
     429  justify-content: space-between;
     430  align-items: center;
     431  padding: 0;
     432  background: #fff;
     433  border-bottom: 1px solid #e6e8eb;
     434  margin: -10px -20px 10px -22px;
     435}
     436
     437.njt-duplicate-header-left {
     438  display: flex;
     439  align-items: center;
     440  gap: 12px;
     441}
     442
     443.njt-duplicate-header-logo img {
     444  height: 60px;
     445  width: auto;
     446  display: block;
     447}
     448
     449.njt-duplicate-top-header h1.njt-duplicate-header-title {
     450  font-size: 20px;
     451  font-weight: 500;
     452  color: #1d2327;
     453  margin: 0;
     454  padding: 0;
     455  line-height: normal;
     456}
     457
     458.njt-duplicate-header-actions {
     459  display: flex;
     460  gap: 16px;
     461  align-items: center;
     462  padding-right: 20px;
     463}
     464
     465@media only screen and (max-width: 768px) {
     466  .njt-duplicate-top-header h1.njt-duplicate-header-title {
     467    font-size: 16px;
     468  }
     469}
     470
     471@media only screen and (max-width: 568px) {
     472  .njt-duplicate-top-header {
     473    padding: 10px 15px;
     474  }
     475
     476  .njt-duplicate-header-left {
     477    gap: 8px;
     478  }
     479
     480  .njt-duplicate-header-logo img {
     481    height: 28px;
     482  }
     483
     484  .njt-duplicate-header-title {
     485    font-size: 14px;
     486  }
     487
     488  .njt-duplicate-header-actions {
     489    gap: 12px;
     490  }
     491}
     492/* Button */
     493.njt-duplicate-btn {
     494  display: inline-flex;
     495  align-items: center;
     496  justify-content: center;
     497  white-space: nowrap;
     498  border-radius: 6px;
     499  font-size: 13px;
     500  font-weight: 500;
     501  height: 32px;
     502  padding: 0 12px;
     503  border: 1px solid #e2e8f0;
     504  background-color: #fff;
     505  transition: all 0.15s ease;
     506  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
     507  cursor: pointer;
     508}
     509.njt-duplicate-btn.fixed-width {
     510  width: 42px;
     511  height: 36px;
     512}
     513.njt-duplicate-btn svg {
     514  width: 16px;
     515  height: 16px;
     516  padding: 0;
     517}
     518
     519.njt-duplicate-btn,
     520.njt-duplicate-btn:hover {
     521  color: #0f172a;
     522  text-decoration: none;
     523}
     524
     525.njt-duplicate-btn:hover {
     526  background-color: #f5f5f5;
     527  border-color: #cbd5e1;
     528}
     529
     530.njt-duplicate-btn:focus {
     531  outline: 2px solid transparent;
     532  outline-offset: 2px;
     533  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
     534}
     535
     536.njt-duplicate-btn:active {
     537  transform: scale(0.98);
     538}
     539
     540.njt-duplicate-btn-xs {
     541  height: 22px;
     542  padding: 0 6px;
     543  line-height: 22px;
     544  font-size: 10px;
     545}
     546
     547.njt-duplicate-btn-sm {
     548  height: 28px;
     549  font-size: 12px;
     550  padding: 0 10px;
     551}
     552
     553.njt-duplicate-btn-lg {
     554  height: 40px;
     555  font-size: 14px;
     556  padding: 0 16px;
     557}
     558
     559@media only screen and (max-width: 768px) {
     560  .njt-duplicate-btn {
     561    font-size: 12px;
     562    height: 28px;
     563    padding: 0 10px;
     564  }
     565}
     566
     567@media only screen and (max-width: 568px) {
     568  .njt-duplicate-btn {
     569    font-size: 11px;
     570    height: 26px;
     571    padding: 0 8px;
     572  }
     573}
     574/* Footer */
     575.njt-duplicate-footer {
     576  position: fixed;
     577  bottom: 0;
     578  right: 0;
     579  background-color: #f5f5f5;
     580  padding: 4px 10px;
     581  z-index: 9999;
     582  left: auto;
     583  border-top: 1px solid #ddd;
     584  width: calc(100% - 160px);
     585  display: flex;
     586  justify-content: space-between;
     587  font-size: 12px;
     588}
     589.njt-duplicate-footer-breadcrumb {
     590  display: flex;
     591  gap: 5px;
     592  align-items: center;
     593}
     594.njt-duplicate-footer-breadcrumb svg {
     595  vertical-align: middle;
     596}
     597.njt-duplicate-footer-breadcrumb span.njt-duplicate-footer-breadcrumb-item {
     598  color: #737373;
     599  text-decoration: none;
     600}
     601
     602.njt-duplicate-footer-breadcrumb span a:hover {
     603  color: #0073aa;
     604  text-decoration: none;
     605}
     606.njt-duplicate-footer-review-text a {
     607  color: #0073aa;
     608  text-decoration: none;
     609}
     610
     611.njt-duplicate-footer-review-text a:hover {
     612  color: #00a0d2;
     613  text-decoration: none;
     614}
     615
     616/* Responsive */
     617@media only screen and (max-width: 782px) {
     618  .njt-duplicate-footer {
     619    width: 100%;
     620  }
     621}
     622
     623@media only screen and (min-width: 783px) and (max-width: 960px) {
     624  .njt-duplicate-footer {
     625    width: calc(100% - 36px);
     626  }
     627}
     628
     629/* Tooltip Styles */
     630.njt-duplicate-header-link {
     631  position: relative;
     632}
     633
     634.njt-duplicate-tooltip {
     635  position: absolute;
     636  background-color: #000;
     637  color: #fff;
     638  padding: 8px 12px;
     639  border-radius: 4px;
     640  font-size: 12px;
     641  white-space: nowrap;
     642  z-index: 10000;
     643  pointer-events: none;
     644  opacity: 0;
     645  visibility: hidden;
     646  transition: opacity 0.2s ease, visibility 0.2s ease;
     647  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
     648    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
     649}
     650
     651.njt-duplicate-tooltip.show {
     652  opacity: 1;
     653  visibility: visible;
     654}
     655
     656/* Tooltip arrow - bottom position */
     657.njt-duplicate-tooltip[data-place="bottom"] {
     658  top: calc(100% + 8px);
     659  left: 50%;
     660  transform: translateX(-50%);
     661}
     662
     663.njt-duplicate-tooltip[data-place="bottom"]::before {
     664  content: "";
     665  position: absolute;
     666  bottom: 100%;
     667  left: 50%;
     668  transform: translateX(-50%);
     669  border: 6px solid transparent;
     670  border-bottom-color: #000;
     671}
     672
     673/* Tooltip arrow - top position */
     674.njt-duplicate-tooltip[data-place="top"] {
     675  bottom: calc(100% + 8px);
     676  left: 50%;
     677  transform: translateX(-50%);
     678}
     679
     680.njt-duplicate-tooltip[data-place="top"]::before {
     681  content: "";
     682  position: absolute;
     683  top: 100%;
     684  left: 50%;
     685  transform: translateX(-50%);
     686  border: 6px solid transparent;
     687  border-top-color: #000;
     688}
     689
     690/* Tooltip arrow - left position */
     691.njt-duplicate-tooltip[data-place="left"] {
     692  right: calc(100% + 8px);
     693  top: 50%;
     694  transform: translateY(-50%);
     695}
     696
     697.njt-duplicate-tooltip[data-place="left"]::before {
     698  content: "";
     699  position: absolute;
     700  left: 100%;
     701  top: 50%;
     702  transform: translateY(-50%);
     703  border: 6px solid transparent;
     704  border-left-color: #000;
     705}
     706
     707/* Tooltip arrow - right position */
     708.njt-duplicate-tooltip[data-place="right"] {
     709  left: calc(100% + 8px);
     710  top: 50%;
     711  transform: translateY(-50%);
     712}
     713
     714.njt-duplicate-tooltip[data-place="right"]::before {
     715  content: "";
     716  position: absolute;
     717  right: 100%;
     718  top: 50%;
     719  transform: translateY(-50%);
     720  border: 6px solid transparent;
     721  border-right-color: #000;
     722}
  • wp-duplicate-page/trunk/assets/js/admin-setting.js

    r3386144 r3394773  
    11jQuery(document).ready(function ($) {
    2   $("#wpfooter #footer-thankyou").html(window.njt_duplicate_page.footerText);
    32  $("#njt_duplicate_setting_form").submit(function (e) {
    43    e.preventDefault();
     
    76    var njtDuplicatePostTypes = [];
    87    var njtDuplicateTextLink = "Duplicate";
    9     var njtDuplicateRedirect = "0";
     8    var njtDuplicateInEditor = "0";
    109    var formValue = $(this).serializeArray();
    1110    $.each(formValue, function (index, field) {
     
    1918        njtDuplicateTextLink = field.value;
    2019      }
    21       if (field.name == "njt_duplicate_redirect") {
    22         njtDuplicateRedirect = field.value;
     20      if (field.name == "njt_duplicate_in_editor") {
     21        njtDuplicateInEditor = field.value;
    2322      }
    2423    });
     
    3332        njtDuplicatePostTypes: njtDuplicatePostTypes,
    3433        njtDuplicateTextLink: njtDuplicateTextLink,
    35         njtDuplicateRedirect: njtDuplicateRedirect,
     34        njtDuplicateInEditor: njtDuplicateInEditor,
    3635      },
    3736      error: function () {
     
    4342        jQuery(".njt-duplicate-button.is-primary").removeClass("is-busy");
    4443      },
     44    });
     45  });
     46  $(".njt-duplicate-footer-review-text-link").click(function () {
     47    $.ajax({
     48      url: window.njt_duplicate_page.ajaxUrl,
     49      type: "POST",
     50      data: {
     51        action: "njt_duplicate_page_track_review",
     52        njtDuplicateNonce: window.njt_duplicate_page.ajaxNonce,
     53      },
     54    });
     55    $(".njt-duplicate-footer-not-reviewed-text").hide();
     56    $(".njt-duplicate-footer-reviewed-text").show();
     57  });
     58
     59  // Tooltip functionality
     60  $(".njt-duplicate-header-link[data-tooltip-content]").each(function () {
     61    var $link = $(this);
     62    var tooltipContent = $link.attr("data-tooltip-content");
     63    var tooltipPlace = $link.attr("data-tooltip-place") || "bottom";
     64
     65    // Create tooltip element
     66    var $tooltip = $(
     67      '<div class="njt-duplicate-tooltip" data-place="' +
     68        tooltipPlace +
     69        '">' +
     70        tooltipContent +
     71        "</div>"
     72    );
     73    $link.append($tooltip);
     74
     75    // Show tooltip on hover
     76    $link.on("mouseenter", function () {
     77      $tooltip.addClass("show");
     78    });
     79
     80    // Hide tooltip on mouse leave
     81    $link.on("mouseleave", function () {
     82      $tooltip.removeClass("show");
    4583    });
    4684  });
  • wp-duplicate-page/trunk/includes/Classes/ButtonDuplicate.php

    r3386144 r3394773  
    5555        if ( 'wp_duplicate_page_bulk_action' === $action ) {
    5656            // Get the original post
    57             $counter       = 0;
    58             $lastNewPostId = null;
     57            $counter = 0;
    5958            if ( is_array( $postIds ) ) {
    6059                foreach ( $postIds as $postId ) {
     
    6564                        $createDuplicate = CreateDuplicate::getInstance();
    6665                        $newPostId       = $createDuplicate->createDuplicate( $post );
    67                         $lastNewPostId   = $newPostId; // Store the last created post ID
    6866                        ++$counter;
    6967
     
    7169                        wp_die( esc_html__( 'Copy creation failed, could not find original:', 'wp-duplicate-page' ) . ' ' . htmlspecialchars( $postId ) );
    7270                    }
    73                 }
    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;
    8471                }
    8572            }
     
    9279    public function duplicateBulkHandleHPOS( $redirect, $action, $ids ) {
    9380        if ( 'wp_duplicate_page_bulk_action' === $action ) {
    94             $counter        = 0;
    95             $lastNewOrderId = null;
     81            $counter = 0;
    9682            if ( is_array( $ids ) ) {
    9783                foreach ( $ids as $orderId ) {
     
    10086                        $createDuplicate = CreateDuplicate::getInstance();
    10187                        $newOrderId      = $createDuplicate->createDuplicateOrderHPOS( $order );
    102                         $lastNewOrderId  = $newOrderId; // Store the last created order ID
    10388                        ++$counter;
    10489                    } else {
    10590                        wp_die( esc_html__( 'Copy creation failed, could not find original:', 'wp-duplicate-page' ) . ' ' . htmlspecialchars( $orderId ) );
    10691                    }
    107                 }
    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;
    11892                }
    11993            }
     
    129103            $actions['njt_duplicate_page'] = sprintf(
    130104                '<a href="%s" rel="bookmark" aria-label="%s">%s</a>',
    131                 $this->getDuplicateLink( $post->ID ),
     105                Utils::getDuplicateLink( $post->ID ),
    132106                esc_attr( __( 'Duplicate', 'wp-duplicate-page' ) ),
    133107                /* translators: %s: Button Duplicate text. */
     
    137111        }
    138112        return $actions;
    139     }
    140 
    141     public function getDuplicateLink( $postId = 0 ) {
    142 
    143         if ( ! Utils::isCurrentUserAllowedToCopy() ) {
    144             return;
    145         }
    146 
    147         if ( ! $post = get_post( $postId ) ) {
    148             return;
    149         }
    150 
    151         if ( ! Utils::checkPostTypeDuplicate( $post->post_type ) ) {
    152             return;
    153         }
    154 
    155         $action_name = 'njt_duplicate_page_save_as_new_post';
    156         $action      = '?action=' . $action_name . '&amp;post=' . $post->ID;
    157         $postType    = get_post_type_object( $post->post_type );
    158 
    159         if ( ! $postType ) {
    160             return;
    161         }
    162 
    163         return wp_nonce_url( admin_url( 'admin.php' . $action ), 'njt-duplicate-page_' . $post->ID );
    164113    }
    165114
     
    177126        $postId = ( isset( $_GET['post'] ) ? sanitize_text_field( $_GET['post'] ) : sanitize_text_field( $_POST['post'] ) );
    178127
     128        $redirectToEdit = isset( $_GET['redirect'] ) ? sanitize_text_field( $_GET['redirect'] ) : '';
     129
    179130        check_admin_referer( 'njt-duplicate-page_' . $postId );
    180131
     
    187138            $newPostId       = $createDuplicate->createDuplicate( $post );
    188139
    189             // Check if redirect to edit page is enabled
    190             $redirectToEdit = get_option( 'njt_duplicate_redirect', true );
    191 
    192             if ( $redirectToEdit && $newPostId ) {
     140            if ( ! empty( $redirectToEdit ) && $newPostId ) {
    193141                // Redirect to the edit page of the newly created duplicate
    194142                $editUrl = get_edit_post_link( $newPostId, 'raw' );
     
    197145                    exit;
    198146                }
     147            } else {
     148                $redirect = wp_get_referer();
    199149            }
    200150
    201             // Fallback to original redirect logic if redirect to edit is disabled or failed
    202             $redirect = wp_get_referer();
    203151            if ( ! $redirect ||
    204152                strpos( $redirect, 'post.php' ) !== false ||
  • wp-duplicate-page/trunk/includes/Helper/Utils.php

    r3386144 r3394773  
    2929        return in_array( $key, $exclude_meta_key );
    3030    }
     31
     32    public static function getDuplicateLink( $postId = 0, $inEditor = false ) {
     33
     34        if ( ! self::isCurrentUserAllowedToCopy() ) {
     35            return;
     36        }
     37
     38        if ( ! $post = get_post( $postId ) ) {
     39            return;
     40        }
     41
     42        if ( ! self::checkPostTypeDuplicate( $post->post_type ) ) {
     43            return;
     44        }
     45
     46        $action_name = 'njt_duplicate_page_save_as_new_post';
     47        $action      = '?action=' . $action_name . '&amp;post=' . $post->ID . ( $inEditor ? '&redirect=new_draft' : '' );
     48        $postType    = get_post_type_object( $post->post_type );
     49
     50        if ( ! $postType ) {
     51            return;
     52        }
     53
     54        return wp_nonce_url( admin_url( 'admin.php' . $action ), 'njt-duplicate-page_' . $post->ID );
     55    }
    3156}
  • wp-duplicate-page/trunk/includes/Page/Settings.php

    r3386144 r3394773  
    33
    44use NjtDuplicate\Classes\ButtonDuplicate;
     5use NjtDuplicate\Classes\EditorDuplicate;
    56
    67defined( 'ABSPATH' ) || exit;
     
    2627        add_filter( 'plugin_action_links_' . NJT_DUPLICATE_PLUGIN_NAME, array( $this, 'addActionLinks' ) );
    2728        add_action( 'wp_ajax_njt_duplicate_page_settings', array( $this, 'saveSettings' ) );
    28         add_action( 'wp_ajax_nopriv_njt_duplicate_page_settings', array( $this, 'saveSettings' ) );
     29        add_action( 'wp_ajax_njt_duplicate_page_track_review', array( $this, 'trackReview' ) );
    2930        // Add button link to post, page, post type
    3031        ButtonDuplicate::getInstance();
     32        $duplicateInEditor = get_option( 'njt_duplicate_in_editor', true );
     33        if ( $duplicateInEditor ) {
     34            EditorDuplicate::getInstance();
     35        }
    3136    }
    3237
     
    9196    }
    9297
     98    function trackReview() {
     99        if ( ! current_user_can( 'manage_options' ) ) {
     100            return;
     101        }
     102        if ( ! isset( $_POST['njtDuplicateNonce'] ) || ! wp_verify_nonce( $_POST['njtDuplicateNonce'], 'wp_rest' ) ) {
     103            return;
     104        }
     105        update_option( 'njt_duplicate_reviewed', '1' );
     106        wp_die();
     107    }
     108
    93109    function saveSettings() {
     110        if ( ! current_user_can( 'manage_options' ) ) {
     111            return;
     112        }
    94113        if ( ! isset( $_POST['njtDuplicateNonce'] ) || ! wp_verify_nonce( $_POST['njtDuplicateNonce'], 'wp_rest' ) ) {
    95114            return;
    96115        }
    97116
    98         $roles     = isset( $_POST['njtDuplicateRoles'] ) ? $this->sanitizeTextOrArrayField( (array) $_POST['njtDuplicateRoles'] ) : array();
    99         $postTypes = isset( $_POST['njtDuplicatePostTypes'] ) ? $this->sanitizeTextOrArrayField( (array) $_POST['njtDuplicatePostTypes'] ) : array();
    100         $textLink  = isset( $_POST['njtDuplicateTextLink'] ) ? $this->sanitizeTextOrArrayField( $_POST['njtDuplicateTextLink'] ) : '';
    101         $redirect  = isset( $_POST['njtDuplicateRedirect'] ) ? $this->sanitizeTextOrArrayField( $_POST['njtDuplicateRedirect'] ) : '1';
     117        $roles           = isset( $_POST['njtDuplicateRoles'] ) ? $this->sanitizeTextOrArrayField( (array) $_POST['njtDuplicateRoles'] ) : array();
     118        $postTypes       = isset( $_POST['njtDuplicatePostTypes'] ) ? $this->sanitizeTextOrArrayField( (array) $_POST['njtDuplicatePostTypes'] ) : array();
     119        $textLink        = isset( $_POST['njtDuplicateTextLink'] ) ? $this->sanitizeTextOrArrayField( $_POST['njtDuplicateTextLink'] ) : '';
     120        $editorDuplicate = isset( $_POST['njtDuplicateInEditor'] ) ? $this->sanitizeTextOrArrayField( $_POST['njtDuplicateInEditor'] ) : '1';
    102121
    103122        update_option( 'njt_duplicate_roles', $roles );
    104123        update_option( 'njt_duplicate_post_types', $postTypes );
    105124        update_option( 'njt_duplicate_text_link', $textLink );
    106         update_option( 'njt_duplicate_redirect', $redirect );
     125        update_option( 'njt_duplicate_in_editor', $editorDuplicate );
    107126        global $wp_roles;
    108127        $roles              = $wp_roles->get_names();
  • wp-duplicate-page/trunk/readme.txt

    r3386144 r3394773  
    66Requires PHP: 5.3
    77Tested up to: 6.8
    8 Stable tag: 1.7
     8Stable tag: 1.8
    99License: GPL-2.0+
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    8080== Changelog ==
    8181
     82= Nov 13, 2025 - Version 1.8 =
     83- Added: Duplicate button in Editor
     84- Improved: Security
     85- Improved: UI
     86- Fixed: Small CSS issue
     87
    8288= Oct 29, 2025 - Version 1.7 =
    8389- Added: Copy directly from post edit
  • wp-duplicate-page/trunk/views/pages/html-settings.php

    r3386144 r3394773  
    33use NjtDuplicate\Helper\Utils;
    44?>
    5 <div class="wrap">
     5<div class="wrap njt-duplicate-wrap">
     6    <div class="njt-duplicate-top-header">
     7        <div class="njt-duplicate-header-left">
     8        <div class="njt-duplicate-header-logo">
     9            <img src="<?php echo NJT_DUPLICATE_PLUGIN_URL; ?>/assets/images/wp-duplicate-page.png" alt="WP Duplicate Page">
     10        </div>
     11        <h1 class="njt-duplicate-header-title">WP Duplicate Page</h1>
     12        <a class="njt-duplicate-btn njt-duplicate-btn-xs" href="https://ninjateam.org" target="_blank" rel="noopener noreferrer">by NinjaTeam</a>
     13        </div>
     14        <div class="njt-duplicate-header-actions">
     15        <a data-tooltip-content="<?php echo esc_html( __( 'Chat with support', 'wp-duplicate-page' ) ); ?>" data-tooltip-place="bottom" href="https://ninjateam.org/support/" target="_blank" rel="noopener noreferrer" class="njt-duplicate-header-link njt-duplicate-btn fixed-width">
     16            <svg viewBox="0 0 18 18" data-icon="headset" width="17" height="17" fill="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="text-[#1D2327]">
     17            <path d="M2.81663 14.1416H2.54167C1.275 14.1416 0.25 13.1166 0.25 11.8499V9.76658C0.25 8.49992 1.275 7.47492 2.54167 7.47492H2.81663C4.0833 7.47492 5.1083 8.49992 5.1083 9.76658V11.8499C5.1083 13.1082 4.0833 14.1416 2.81663 14.1416ZM2.54167 8.72492C1.96667 8.72492 1.5 9.19158 1.5 9.76658V11.8499C1.5 12.4249 1.96667 12.8916 2.54167 12.8916H2.81663C3.39163 12.8916 3.8583 12.4249 3.8583 11.8499V9.76658C3.8583 9.19158 3.39163 8.72492 2.81663 8.72492H2.54167Z"></path>
     18            <path d="M15.3165 8.72483C14.9748 8.72483 14.6915 8.4415 14.6915 8.09983V7.19981C14.6915 4.05814 12.1416 1.50814 8.99992 1.50814C5.85824 1.50814 3.30827 4.05814 3.30827 7.19981V8.09983C3.30827 8.4415 3.02494 8.72483 2.68327 8.72483C2.34161 8.72483 2.05827 8.4415 2.05827 8.09983V7.19981C2.05827 3.37481 5.17491 0.258142 8.99992 0.258142C12.8249 0.258142 15.9415 3.37481 15.9415 7.19981V8.09983C15.9415 8.4415 15.6665 8.72483 15.3165 8.72483Z"></path>
     19            <path d="M10.8002 17.7498H9.90009C9.55842 17.7498 9.27509 17.4664 9.27509 17.1248C9.27509 16.7831 9.55842 16.4998 9.90009 16.4998H10.8002C12.6418 16.4998 14.2501 15.1914 14.6084 13.3831C14.6751 13.0414 15.0084 12.8248 15.3418 12.8914C15.6751 12.9581 15.9001 13.2914 15.8334 13.6248C15.3584 16.0164 13.2418 17.7498 10.8002 17.7498Z"></path>
     20            <path d="M15.4583 14.1416H15.1833C13.9166 14.1416 12.8916 13.1166 12.8916 11.8499V9.76658C12.8916 8.49992 13.9166 7.47492 15.1833 7.47492H15.4583C16.7249 7.47492 17.7499 8.49992 17.7499 9.76658V11.8499C17.7499 13.1082 16.7249 14.1416 15.4583 14.1416ZM15.1833 8.72492C14.6083 8.72492 14.1416 9.19158 14.1416 9.76658V11.8499C14.1416 12.4249 14.6083 12.8916 15.1833 12.8916H15.4583C16.0333 12.8916 16.4999 12.4249 16.4999 11.8499V9.76658C16.4999 9.19158 16.0333 8.72492 15.4583 8.72492H15.1833Z"></path>
     21            </svg>
     22        </a>
     23        <a data-tooltip-content="<?php echo esc_html( __( 'Details', 'wp-duplicate-page' ) ); ?>" data-tooltip-place="bottom" href="https://ninjateam.org/wp-duplicate-page/" target="_blank" rel="noopener noreferrer" class="njt-duplicate-header-link njt-duplicate-btn fixed-width">
     24            <svg viewBox="0 0 18 18" data-icon="document" width="18" height="18" fill="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="text-[#1D2327]">
     25            <path d="M12.3333 17.9583H5.66667C2.625 17.9583 0.875 16.2083 0.875 13.1667V4.83333C0.875 1.79167 2.625 0.041666 5.66667 0.041666H12.3333C15.375 0.041666 17.125 1.79167 17.125 4.83333V13.1667C17.125 16.2083 15.375 17.9583 12.3333 17.9583ZM5.66667 1.29167C3.28333 1.29167 2.125 2.45 2.125 4.83333V13.1667C2.125 15.55 3.28333 16.7083 5.66667 16.7083H12.3333C14.7167 16.7083 15.875 15.55 15.875 13.1667V4.83333C15.875 2.45 14.7167 1.29167 12.3333 1.29167H5.66667Z"></path>
     26            <path d="M14.4167 6.70833H12.75C11.4833 6.70833 10.4583 5.68333 10.4583 4.41667V2.75C10.4583 2.40833 10.7417 2.125 11.0833 2.125C11.425 2.125 11.7083 2.40833 11.7083 2.75V4.41667C11.7083 4.99167 12.175 5.45833 12.75 5.45833H14.4167C14.7583 5.45833 15.0417 5.74167 15.0417 6.08333C15.0417 6.425 14.7583 6.70833 14.4167 6.70833Z"></path>
     27            <path d="M9 10.4583H5.66666C5.325 10.4583 5.04166 10.175 5.04166 9.83333C5.04166 9.49167 5.325 9.20833 5.66666 9.20833H9C9.34166 9.20833 9.625 9.49167 9.625 9.83333C9.625 10.175 9.34166 10.4583 9 10.4583Z"></path>
     28            <path d="M12.3333 13.7917H5.66666C5.325 13.7917 5.04166 13.5083 5.04166 13.1667C5.04166 12.825 5.325 12.5417 5.66666 12.5417H12.3333C12.675 12.5417 12.9583 12.825 12.9583 13.1667C12.9583 13.5083 12.675 13.7917 12.3333 13.7917Z"></path>
     29            </svg>
     30        </a>
     31        </div>
     32    </div><!--/.njt-duplicate-top-header-->
    633    <div id="njt-duplicate-root">
    734        <div class="njt-duplicate-layout">
     
    106133                                    </div>
    107134
    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>
     135                                    <?php /* Layout for duplicate in editor */ ?>
     136                                    <div class="njt-duplicate-control">
     137                                        <label class="njt-duplicate-base-control-label"><?php echo esc_html( __( 'Show Duplicate button in Editor', 'wp-duplicate-page' ) ); ?></label>
    111138                                        <div class="njt-duplicate-base-control">
    112139                                            <div class="njt-duplicate-base-control-field">
     
    114141                                                    <input
    115142                                                        type="checkbox"
    116                                                         id="njt-duplicate-redirect-toggle"
    117                                                         name="njt_duplicate_redirect"
     143                                                        id="njt-duplicate-in-editor-toggle"
     144                                                        name="njt_duplicate_in_editor"
    118145                                                        class="njt-duplicate-toggle-control-input"
    119146                                                        value="1"
    120147                                                        <?php
    121                                                         $redirectEnabled = get_option( 'njt_duplicate_redirect', true );
    122                                                         if ( $redirectEnabled ) {
     148                                                        $duplicateInEditor = get_option( 'njt_duplicate_in_editor', true );
     149                                                        if ( $duplicateInEditor ) {
    123150                                                            echo 'checked="checked"';
    124151                                                        }
    125152                                                        ?>
    126153                                                    />
    127                                                     <label for="njt-duplicate-redirect-toggle" class="njt-duplicate-toggle-control-label">
     154                                                    <label for="njt-duplicate-in-editor-toggle" class="njt-duplicate-toggle-control-label">
    128155                                                        <span class="njt-duplicate-toggle-control-switch"></span>
    129156                                                    </label>
    130157                                                </div>
    131158                                            </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>
    133159                                        </div>
    134160                                    </div>
     
    149175        </div>
    150176    </div>
     177    <div id="njt-duplicate-footer" class="njt-duplicate-footer">
     178        <div class="njt-duplicate-footer-breadcrumb">
     179            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false">
     180                <path fill="#fff" d="M24 4.050000000000001A19.95 19.95 0 1 0 24 43.95A19.95 19.95 0 1 0 24 4.050000000000001Z"></path>
     181                <path fill="#01579b" d="M8.001,24c0,6.336,3.68,11.806,9.018,14.4L9.385,17.488C8.498,19.479,8.001,21.676,8.001,24z M34.804,23.194c0-1.977-1.063-3.35-1.67-4.412c-0.813-1.329-1.576-2.437-1.576-3.752c0-1.465,1.471-2.84,3.041-2.84 c0.071,0,0.135,0.006,0.206,0.008C31.961,9.584,28.168,8,24.001,8c-5.389,0-10.153,2.666-13.052,6.749 c0.228,0.074,0.307,0.039,0.611,0.039c1.669,0,4.264-0.2,4.264-0.2c0.86-0.057,0.965,1.212,0.099,1.316c0,0-0.864,0.105-1.828,0.152 l5.931,17.778l3.5-10.501l-2.603-7.248c-0.861-0.046-1.679-0.152-1.679-0.152c-0.862-0.056-0.762-1.375,0.098-1.316 c0,0,2.648,0.2,4.217,0.2c1.675,0,4.264-0.2,4.264-0.2c0.861-0.057,0.965,1.212,0.104,1.316c0,0-0.87,0.105-1.832,0.152l5.891,17.61 l1.599-5.326C34.399,26.289,34.804,24.569,34.804,23.194z M24.281,25.396l-4.8,13.952c1.436,0.426,2.95,0.652,4.52,0.652 c1.861,0,3.649-0.324,5.316-0.907c-0.04-0.071-0.085-0.143-0.118-0.22L24.281,25.396z M38.043,16.318 c0.071,0.51,0.108,1.059,0.108,1.645c0,1.628-0.306,3.451-1.219,5.737l-4.885,14.135C36.805,35.063,40,29.902,40,24 C40,21.219,39.289,18.604,38.043,16.318z"></path>
     182                <path fill="#01579b" d="M4,24c0,11.024,8.97,20,19.999,20C35.03,44,44,35.024,44,24S35.03,4,24,4S4,12.976,4,24z M5.995,24 c0-9.924,8.074-17.999,18.004-17.999S42.005,14.076,42.005,24S33.929,42.001,24,42.001C14.072,42.001,5.995,33.924,5.995,24z"></path>
     183            </svg>
     184            <span class="njt-duplicate-footer-breadcrumb-item">Settings</span>
     185            <span class="njt-duplicate-footer-breadcrumb-separator">&gt;</span>
     186            <span class="njt-duplicate-footer-breadcrumb-active">Duplicate Page</span>
     187        </div>
     188        <div class="njt-duplicate-footer-review-text">
     189            <?php
     190            $reviewed     = get_option( 'njt_duplicate_reviewed', '0' ) === '1';
     191            $reviewedText = 'Thank you for using WP Duplicate Page from <a href="https://ninjateam.org/" target="_blank">NinjaTeam</a>';
     192            if ( ! $reviewed ) {
     193                echo '<span class="njt-duplicate-footer-not-reviewed-text">We need your support to keep updating and improving the plugin. Please, <a class="njt-duplicate-footer-review-text-link" target="_blank" href="https://wordpress.org/support/plugin/wp-duplicate-page/reviews/?filter=5/#new-post/">help us by leaving a good review</a> :) Thanks!</span>';
     194                printf( '<span class="njt-duplicate-footer-reviewed-text" style="display: none;">%s</span>', $reviewedText );
     195            } else {
     196                printf( '<span class="njt-duplicate-footer-reviewed-text">%s</span>', $reviewedText );
     197            }
     198            ?>
     199        </div>
     200    </div><!--/.njt-duplicate-footer-->
    151201</div>
  • wp-duplicate-page/trunk/wp-duplicate-page.php

    r3386144 r3394773  
    22/**
    33 * Plugin Name: WP Duplicate Page
    4  * Plugin URI: https://ninjateam.org
     4 * Plugin URI: https://ninjateam.org/wp-duplicate-page/
    55 * Description: Duplicate Posts, Pages and Custom Post Types.
    6  * Version: 1.7
     6 * Version: 1.8
    77 * Author: NinjaTeam
    88 * Author URI: https://ninjateam.org
     
    1717defined( 'ABSPATH' ) || exit;
    1818
    19 define( 'NJT_DUPLICATE_VERSION', '1.7' );
     19define( 'NJT_DUPLICATE_VERSION', '1.8' );
    2020define( 'NJT_DUPLICATE_DOMAIN', 'wp-duplicate-page' );
    2121
Note: See TracChangeset for help on using the changeset viewer.