Changeset 3089953
- Timestamp:
- 05/21/2024 07:35:14 AM (19 months ago)
- Location:
- duplicate-me/trunk
- Files:
-
- 3 edited
-
admin/class-duplicate-me-admin.php (modified) (10 diffs)
-
duplicate-me.php (modified) (8 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
duplicate-me/trunk/admin/class-duplicate-me-admin.php
r3025760 r3089953 1 1 <?php 2 2 3 // Exit if accessed directly. 3 /** 4 * Exit if accessed directly. 5 * 6 * @package Duplicate Me 7 */ 8 4 9 if ( ! defined( 'ABSPATH' ) ) { 5 10 exit; 6 11 } 7 12 8 /* 13 /** 9 14 * Function creates post duplicate as a draft and redirects then to the edit post screen 10 11 * @package Duplicate Me12 * @since 1.1.015 * 16 * @package Duplicate Me 17 * @since 3.0.0 13 18 */ 14 19 function duplicate_me_post_as_draft() { … … 43 48 /* if post data exists, create the post duplicate */ 44 49 45 if ( isset( $post ) && $post != null) {50 if ( isset( $post ) && null !== $post ) { 46 51 47 52 /* New post data array */ … … 70 75 * get all current post terms ad set them to the new post draft 71 76 */ 72 $taxonomies = get_object_taxonomies( $post->post_type ); // returns array of taxonomy names for post type , ex array("category", "post_tag");77 $taxonomies = get_object_taxonomies( $post->post_type ); // returns array of taxonomy names for post type. 73 78 foreach ( $taxonomies as $taxonomy ) { 74 79 $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) ); … … 80 85 */ 81 86 $post_meta_infos = $wpdb->get_results( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id" ); 82 if ( count( $post_meta_infos ) != 0 ) {87 if ( count( $post_meta_infos ) !== 0 ) { 83 88 $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) "; 84 89 foreach ( $post_meta_infos as $meta_info ) { … … 104 109 } 105 110 111 /** 112 * Duplicate post as draft 113 */ 106 114 function duplicate_me_page_as_draft() { 107 115 global $wpdb; … … 132 140 133 141 /* if post data exists, create the post duplicate */ 134 if ( isset( $post ) && $post != null) {142 if ( isset( $post ) && null !== $post ) { 135 143 136 144 /* new post data array */ … … 159 167 * get all current post terms ad set them to the new post draft 160 168 */ 161 $taxonomies = get_object_taxonomies( $post->post_type ); // returns array of taxonomy names for post type , ex array("category", "post_tag");169 $taxonomies = get_object_taxonomies( $post->post_type ); // returns array of taxonomy names for post type. 162 170 foreach ( $taxonomies as $taxonomy ) { 163 171 $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) ); … … 192 200 } 193 201 } 194 /* 195 * Add the duplicate link to action list for post_row_actions 202 203 /** 204 * Redirect to the edit post screen for the new draft 205 * 206 * @param array $actions An array of row action links. Default empty. 207 * @param WP_Post $post The post object. 208 * @return array Modified array of row action links. 196 209 */ 197 210 function duplicate_me_post_link( $actions, $post ) { … … 202 215 } 203 216 204 /* 217 /** 205 218 * Add the duplicate link to action list for post_row_actions 219 * 220 * @param array $actions An array of row action links. Default empty. 221 * @param WP_Post $post The post object. 206 222 */ 207 223 function duplicate_me_page_link( $actions, $post ) { … … 211 227 return $actions; 212 228 } 213 // add action to perform clone to post 229 // add action to perform clone to post. 214 230 add_action( 'admin_action_duplicate_me_post_as_draft', 'duplicate_me_post_as_draft' ); 215 // add action to perform clone to page 231 // add action to perform clone to page. 216 232 add_action( 'admin_action_duplicate_me_page_as_draft', 'duplicate_me_page_as_draft' ); 217 // add action to add option to dupl ciate post233 // add action to add option to duplicate post. 218 234 add_filter( 'post_row_actions', 'duplicate_me_post_link', 10, 2 ); 219 // add action to add option to dupl ciate page235 // add action to add option to duplicate page. 220 236 add_filter( 'page_row_actions', 'duplicate_me_page_link', 10, 2 ); -
duplicate-me/trunk/duplicate-me.php
r3025760 r3089953 9 9 * 10 10 * @package Duplicate_Page_Post_Custom_Post_Type 11 * @since 1.0.0 12 */ 13 14 /** 15 * Basic plugin definitions 16 * 17 * @package Duplicate Me 18 * @since 1.0.0 11 * @since 3.0.0 19 12 */ 20 13 … … 39 32 } 40 33 if ( ! defined( 'DUPL_ME_ADMIN_DIR' ) ) { 41 define( 'DUPL_ME_ADMIN_DIR', DUPL_ME_DIR . '//admin' ); // plugin admin dir 34 define( 'DUPL_ME_ADMIN_DIR', DUPL_ME_DIR . '//admin' ); // plugin admin dir. 42 35 } 43 36 if ( ! defined( 'DUPL_ME_BASENAME' ) ) { … … 55 48 * 56 49 * @package Duplicate Me 57 * @since 1.0.050 * @since 3.0.0 58 51 */ 59 52 load_plugin_textdomain( 'DUPL_ME', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); … … 65 58 * 66 59 * @package Duplicate Me 67 * @since 1.0.060 * @since 3.0.0 68 61 */ 69 register_activation_hook( __FILE__, ' DUPL_ME_install' );62 register_activation_hook( __FILE__, 'dupl_me_install' ); 70 63 71 64 /** … … 75 68 * 76 69 * @package Duplicate Me 77 * @since 1.1.070 * @since 3.0.0 78 71 */ 79 register_deactivation_hook( __FILE__, ' DUPL_ME_uninstall' );72 register_deactivation_hook( __FILE__, 'dupl_me_uninstall' ); 80 73 81 74 /** … … 86 79 * 87 80 * @package Duplicate Me 88 * @since 1.0.081 * @since 3.0.0 89 82 */ 90 function DUPL_ME_install() {83 function dupl_me_install() { 91 84 92 85 global $wpdb; … … 100 93 * 101 94 * @package Duplicate Me 102 * @since 1.0.095 * @since 3.0.0 103 96 */ 104 function DUPL_ME_uninstall() {97 function dupl_me_uninstall() { 105 98 106 99 global $wpdb; … … 112 105 * 113 106 * @package Duplicate Me 114 * @since 1.0.0107 * @since 3.0.0 115 108 */ 116 109 -
duplicate-me/trunk/readme.txt
r3025760 r3089953 4 4 Tags: Duplicate Page, Duplciate Post, clone page, clone post, clone data 5 5 Requires at least: 3.8 6 Tested up to: 6. 4.26 Tested up to: 6.5.3 7 7 Requires PHP: 5.2.4 8 8 Stable tag: 3.2.0
Note: See TracChangeset
for help on using the changeset viewer.