Plugin Directory

Changeset 2248703


Ignore:
Timestamp:
02/22/2020 12:20:21 PM (6 years ago)
Author:
arjunthakur
Message:

general WP Update

Location:
duplicate-wp-page-post/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • duplicate-wp-page-post/trunk/duplicate-wp-page-post-setting.php

    r2186878 r2248703  
    1919        else{ dpp_wpp_page::dp_redirect('options-general.php?page=dpp_page_settings&instruct=2'); }endif;
    2020if(!empty($instruct) && $instruct == 1):
    21   _e( '<div class="updated settings-error dpp_pluginnotice is-dismissible" id="setting-error-settings_updated">
    22 <p><strong>Changes saved.</strong></p><button class="notice-ignore" type="button"><span class="screen-reader-text">Ignore this notice.</span></button></div>', 'dpp_wpp_page');
     21  _e( '<div id="message" class="updated notice notice-success is-dismissible">
     22          <p>Changes Saved!</p>
     23          <button type="button" class="notice-dismiss">
     24             <span class="screen-reader-text">Ignore this notice.</span>
     25          </button>
     26       </div>', 'dpp_wpp_page');   
    2327elseif(!empty($instruct) && $instruct == 2):
    24   _e( '<div class="error settings-error dpp_pluginnotice is-dismissible" id="setting-error-settings_updated">
    25 <p><strong>Changes not saved.</strong></p><button class="notice-ignore" type="button"><span class="screen-reader-text">Ignore this notice.</span></button></div>', 'dpp_wpp_page');
     28  _e( '<div id="message" class="error notice notice-error is-dismissible">
     29          <p>Changes not saved!</p>
     30          <button type="button" class="notice-dismiss">
     31             <span class="screen-reader-text">Ignore this notice.</span>
     32          </button>
     33       </div>', 'dpp_wpp_page');
    2634endif;
    2735//$dpp_post_status = array('draft');
  • duplicate-wp-page-post/trunk/duplicate-wp-page-post.php

    r2224626 r2248703  
    66Author: Arjun Thakur
    77Author URI: https://profiles.wordpress.org/arjunthakur#content-plugins
    8 Version: 2.5.6
     8Version: 2.5.7
    99License: GPLv2 or later
    1010Text Domain: dpp_wpp_page
     
    4141        $defaultsettings = array('dpp_post_status'      => 'draft',
    4242                                  'dpp_post_redirect'   => 'to_list',
     43                                  'dpp_post_suffix'     => '',
    4344                                  'dpp_posteditor'      => 'classic',
    44                                   'dpp_post_suffix'     => '',
    4545                                  'dpp_post_link_title' => '', );
    4646        $opt = get_option('dpp_wpp_page_options');
     
    7070    /*Important function*/
    7171     public function dt_dpp_post_as_draft()
    72         {
     72        {   
     73         
     74              $nonce = $_REQUEST['nonce'];
     75              $post_id = (isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post']));
     76         
     77         
     78              if(wp_verify_nonce( $nonce, 'dt-duplicate-page-'.$post_id) && current_user_can('edit_posts')) {
    7379              global $wpdb;
    7480   
    7581              /*sanitize_GET POST REQUEST*/
    76               $post_copy = sanitize_text_field( $_POST["post"] );
    77               $get_copy = sanitize_text_field( $_GET['post'] );
    78               $request_copy = sanitize_text_field( $_REQUEST['action'] );
     82              //$post_copy = sanitize_text_field( $_POST["post"] );
     83              //$get_copy = sanitize_text_field( $_GET['post'] );
     84              //$request_copy = sanitize_text_field( $_REQUEST['action'] );
    7985 
    8086              $opt = get_option('dpp_wpp_page_options');
     
    8490              $redirectit = !empty($opt['dpp_post_redirect']) ? $opt['dpp_post_redirect'] : 'to_list';
    8591
    86                 if (! ( isset( $get_copy ) || isset( $post_copy ) || ( isset($request_copy) && 'dt_dpp_post_as_draft' == $request_copy ) ) ) {
     92                //if (! ( isset( $get_copy ) || isset( $post_copy ) || ( isset($request_copy) && 'dt_dpp_post_as_draft' == $request_copy ) ) ) {
     93                if (!(isset($_GET['post']) || isset($_POST['post']) || (isset($_REQUEST['action']) && 'dt_dpp_post_as_draft' == $_REQUEST['action']))) {
    8794                wp_die('No post!');
    8895                }
     
    9097   
    9198                /* Get post id */
    92                 $post_id = (isset($get_copy) ? $get_copy : $post_copy );
     99                //$post_id = (isset($get_copy) ? $get_copy : $post_copy );
    93100
    94101                $post = get_post( $post_id );
     
    105112                    'post_content' => (isset($opt['dpp_posteditor']) && $opt['dpp_posteditor'] == 'gutenberg') ? wp_slash($post->post_content) : $post->post_content,
    106113                    'post_excerpt' => $post->post_excerpt,
    107                     'post_name' => $post->post_name,
     114                    //'post_name' => $post->post_name,
    108115                    'post_parent' => $post->post_parent,
    109116                    'post_password' => $post->post_password,
     
    147154                     wp_die('Error! Post creation failed: ' . $post_id);
    148155                     }
     156              }  else {
     157                    wp_die('Security check issue, Please try again.');
     158                   }
    149159       }
     160   
    150161
    151162    /*Add link to action*/
     
    156167      $post_status = !empty($opt['dpp_post_status']) ? $opt['dpp_post_status'] : 'draft';
    157168      if (current_user_can('edit_posts')) {
    158          $actions['dpp'] = '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID . '" title="Clone this as '.$post_status.'" rel="permalink">'.$link_title.'</a>';
     169         $actions['dpp'] = '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post='.$post->ID.'&amp;nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="Clone this as '.$post_status.'" rel="permalink">'.$link_title.'</a>';
    159170          }
    160171          return $actions;
     
    165176       $opt = get_option('dpp_wpp_page_options');
    166177       $link_title = !empty($opt['dpp_post_link_title']) ? $opt['dpp_post_link_title'] : 'Duplicate';
     178       global $post;
    167179       $opt = get_option('dpp_wpp_page_options');
    168180       $post_status = !empty($opt['dpp_post_status']) ? $opt['dpp_post_status'] : 'draft';
    169        global $post;
    170181       $html  = '<div id="major-publishing-actions">';
    171182       $html .= '<div id="export-action">';
    172        $html .= '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID . '" title="Duplicate this as '.$post_status.'" rel="permalink">'.$link_title.'</a>';
     183       $html .= '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post='.$post->ID.'&amp;nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="Duplicate this as '.$post_status.'" rel="permalink">'.$link_title.'</a>';
    173184       $html .= '</div>';
    174185       $html .= '</div>';
     
    187198                    ?>
    188199             <style> .link_gutenberg {text-align: center; margin-top: 15px;} .link_gutenberg a {text-decoration: none; display: block; height: 40px; line-height: 28px; padding: 3px 12px 2px; background: #0073AA; border-radius: 3px; border-width: 1px; border-style: solid; color: #ffffff; font-size: 16px; } .link_gutenberg a:hover { background: #23282D; border-color: #23282D; }</style>       
    189              <script>jQuery(window).load(function(e){var dpp_postid = "<?php echo $post->ID; ?>";
     200             <script>jQuery(window).load(function(e){
     201                var dpp_postid = "<?php echo $post->ID; ?>";
     202                var dtnonce = "<?php echo wp_create_nonce( 'dt-duplicate-page-'.$post->ID );?>";
    190203                var dpp_posttitle = "Duplicate this as <?php echo $post_status; ?>";
    191204                var dpp_duplicatelink = '<div class="link_gutenberg">';
    192                     dpp_duplicatelink += '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post='+dpp_postid+'" title="'+dpp_posttitle+'">Duplicate</a>';
     205                    dpp_duplicatelink += '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post='+dpp_postid'&amp;nonce='+dtnonce+'" title="'+dpp_posttitle+'">Duplicate</a>';
    193206                    dpp_duplicatelink += '</div>';
    194207                jQuery('.edit-post-post-status').append(dpp_duplicatelink);
     
    216229            'id' => 'dpp_this',
    217230            'title' => __("Clone this as ".$post_status."", 'dpp_wpp_page'),
    218             'href' => admin_url().'admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID
    219           ) );
     231            'href' => admin_url().'admin.php?action=dt_dpp_post_as_draft&amp;post='.$post->ID.'&amp;nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID )
     232          ));
    220233      }
    221234    }
  • duplicate-wp-page-post/trunk/readme.txt

    r2224626 r2248703  
    55Tested up to: 5.3.2
    66Requires PHP: 5.2.4
    7 Stable tag: 2.5.6
    8 Version: 2.5.6
     7Stable tag: 2.5.7
     8Version: 2.5.7
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.