Changeset 2248703
- Timestamp:
- 02/22/2020 12:20:21 PM (6 years ago)
- Location:
- duplicate-wp-page-post/trunk
- Files:
-
- 3 edited
-
duplicate-wp-page-post-setting.php (modified) (1 diff)
-
duplicate-wp-page-post.php (modified) (11 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
duplicate-wp-page-post/trunk/duplicate-wp-page-post-setting.php
r2186878 r2248703 19 19 else{ dpp_wpp_page::dp_redirect('options-general.php?page=dpp_page_settings&instruct=2'); }endif; 20 20 if(!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'); 23 27 elseif(!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'); 26 34 endif; 27 35 //$dpp_post_status = array('draft'); -
duplicate-wp-page-post/trunk/duplicate-wp-page-post.php
r2224626 r2248703 6 6 Author: Arjun Thakur 7 7 Author URI: https://profiles.wordpress.org/arjunthakur#content-plugins 8 Version: 2.5. 68 Version: 2.5.7 9 9 License: GPLv2 or later 10 10 Text Domain: dpp_wpp_page … … 41 41 $defaultsettings = array('dpp_post_status' => 'draft', 42 42 'dpp_post_redirect' => 'to_list', 43 'dpp_post_suffix' => '', 43 44 'dpp_posteditor' => 'classic', 44 'dpp_post_suffix' => '',45 45 'dpp_post_link_title' => '', ); 46 46 $opt = get_option('dpp_wpp_page_options'); … … 70 70 /*Important function*/ 71 71 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')) { 73 79 global $wpdb; 74 80 75 81 /*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'] ); 79 85 80 86 $opt = get_option('dpp_wpp_page_options'); … … 84 90 $redirectit = !empty($opt['dpp_post_redirect']) ? $opt['dpp_post_redirect'] : 'to_list'; 85 91 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']))) { 87 94 wp_die('No post!'); 88 95 } … … 90 97 91 98 /* Get post id */ 92 $post_id = (isset($get_copy) ? $get_copy : $post_copy );99 //$post_id = (isset($get_copy) ? $get_copy : $post_copy ); 93 100 94 101 $post = get_post( $post_id ); … … 105 112 'post_content' => (isset($opt['dpp_posteditor']) && $opt['dpp_posteditor'] == 'gutenberg') ? wp_slash($post->post_content) : $post->post_content, 106 113 'post_excerpt' => $post->post_excerpt, 107 'post_name' => $post->post_name,114 //'post_name' => $post->post_name, 108 115 'post_parent' => $post->post_parent, 109 116 'post_password' => $post->post_password, … … 147 154 wp_die('Error! Post creation failed: ' . $post_id); 148 155 } 156 } else { 157 wp_die('Security check issue, Please try again.'); 158 } 149 159 } 160 150 161 151 162 /*Add link to action*/ … … 156 167 $post_status = !empty($opt['dpp_post_status']) ? $opt['dpp_post_status'] : 'draft'; 157 168 if (current_user_can('edit_posts')) { 158 $actions['dpp'] = '<a href="admin.php?action=dt_dpp_post_as_draft&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&post='.$post->ID.'&nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="Clone this as '.$post_status.'" rel="permalink">'.$link_title.'</a>'; 159 170 } 160 171 return $actions; … … 165 176 $opt = get_option('dpp_wpp_page_options'); 166 177 $link_title = !empty($opt['dpp_post_link_title']) ? $opt['dpp_post_link_title'] : 'Duplicate'; 178 global $post; 167 179 $opt = get_option('dpp_wpp_page_options'); 168 180 $post_status = !empty($opt['dpp_post_status']) ? $opt['dpp_post_status'] : 'draft'; 169 global $post;170 181 $html = '<div id="major-publishing-actions">'; 171 182 $html .= '<div id="export-action">'; 172 $html .= '<a href="admin.php?action=dt_dpp_post_as_draft&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&post='.$post->ID.'&nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="Duplicate this as '.$post_status.'" rel="permalink">'.$link_title.'</a>'; 173 184 $html .= '</div>'; 174 185 $html .= '</div>'; … … 187 198 ?> 188 199 <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 );?>"; 190 203 var dpp_posttitle = "Duplicate this as <?php echo $post_status; ?>"; 191 204 var dpp_duplicatelink = '<div class="link_gutenberg">'; 192 dpp_duplicatelink += '<a href="admin.php?action=dt_dpp_post_as_draft&post='+dpp_postid +'" title="'+dpp_posttitle+'">Duplicate</a>';205 dpp_duplicatelink += '<a href="admin.php?action=dt_dpp_post_as_draft&post='+dpp_postid'&nonce='+dtnonce+'" title="'+dpp_posttitle+'">Duplicate</a>'; 193 206 dpp_duplicatelink += '</div>'; 194 207 jQuery('.edit-post-post-status').append(dpp_duplicatelink); … … 216 229 'id' => 'dpp_this', 217 230 'title' => __("Clone this as ".$post_status."", 'dpp_wpp_page'), 218 'href' => admin_url().'admin.php?action=dt_dpp_post_as_draft&post=' . $post->ID219 ) );231 'href' => admin_url().'admin.php?action=dt_dpp_post_as_draft&post='.$post->ID.'&nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ) 232 )); 220 233 } 221 234 } -
duplicate-wp-page-post/trunk/readme.txt
r2224626 r2248703 5 5 Tested up to: 5.3.2 6 6 Requires PHP: 5.2.4 7 Stable tag: 2.5. 68 Version: 2.5. 67 Stable tag: 2.5.7 8 Version: 2.5.7 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.