Plugin Directory

Changeset 3089953


Ignore:
Timestamp:
05/21/2024 07:35:14 AM (19 months ago)
Author:
viitorcloudvc
Message:

Fix warnings and add doc comment also tested with the latest WordPress Version

Location:
duplicate-me/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • duplicate-me/trunk/admin/class-duplicate-me-admin.php

    r3025760 r3089953  
    11<?php
    22
    3 // Exit if accessed directly.
     3/**
     4 * Exit if accessed directly.
     5 *
     6 * @package Duplicate Me
     7 */
     8
    49if ( ! defined( 'ABSPATH' ) ) {
    510    exit;
    611}
    712
    8 /*
     13/**
    914 * Function creates post duplicate as a draft and redirects then to the edit post screen
    10 
    11 * @package Duplicate Me
    12      * @since 1.1.0
     15 *
     16 * @package Duplicate Me
     17 * @since 3.0.0
    1318 */
    1419function duplicate_me_post_as_draft() {
     
    4348    /* if post data exists, create the post duplicate */
    4449
    45     if ( isset( $post ) && $post != null ) {
     50    if ( isset( $post ) && null !== $post ) {
    4651
    4752        /* New post data array */
     
    7075         * get all current post terms ad set them to the new post draft
    7176         */
    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.
    7378        foreach ( $taxonomies as $taxonomy ) {
    7479            $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
     
    8085         */
    8186        $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 ) {
    8388            $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
    8489            foreach ( $post_meta_infos as $meta_info ) {
     
    104109}
    105110
     111/**
     112 * Duplicate post as draft
     113 */
    106114function duplicate_me_page_as_draft() {
    107115    global $wpdb;
     
    132140
    133141    /* if post data exists, create the post duplicate */
    134     if ( isset( $post ) && $post != null ) {
     142    if ( isset( $post ) && null !== $post ) {
    135143
    136144        /* new post data array */
     
    159167         * get all current post terms ad set them to the new post draft
    160168         */
    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.
    162170        foreach ( $taxonomies as $taxonomy ) {
    163171            $post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
     
    192200    }
    193201}
    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.
    196209 */
    197210function duplicate_me_post_link( $actions, $post ) {
     
    202215}
    203216
    204 /*
     217/**
    205218 * 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.
    206222 */
    207223function duplicate_me_page_link( $actions, $post ) {
     
    211227    return $actions;
    212228}
    213     // add action to perform clone to post
     229    // add action to perform clone to post.
    214230    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.
    216232    add_action( 'admin_action_duplicate_me_page_as_draft', 'duplicate_me_page_as_draft' );
    217     // add action to add option to duplciate post
     233    // add action to add option to duplicate post.
    218234    add_filter( 'post_row_actions', 'duplicate_me_post_link', 10, 2 );
    219     // add action to add option to duplciate page
     235    // add action to add option to duplicate page.
    220236    add_filter( 'page_row_actions', 'duplicate_me_page_link', 10, 2 );
  • duplicate-me/trunk/duplicate-me.php

    r3025760 r3089953  
    99 *
    1010 * @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
    1912 */
    2013
     
    3932}
    4033if ( ! 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.
    4235}
    4336if ( ! defined( 'DUPL_ME_BASENAME' ) ) {
     
    5548 *
    5649 * @package Duplicate Me
    57  * @since 1.0.0
     50 * @since 3.0.0
    5851 */
    5952load_plugin_textdomain( 'DUPL_ME', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     
    6558 *
    6659 * @package Duplicate Me
    67  * @since 1.0.0
     60 * @since 3.0.0
    6861 */
    69 register_activation_hook( __FILE__, 'DUPL_ME_install' );
     62register_activation_hook( __FILE__, 'dupl_me_install' );
    7063
    7164/**
     
    7568 *
    7669 * @package Duplicate Me
    77  * @since 1.1.0
     70 * @since 3.0.0
    7871 */
    79 register_deactivation_hook( __FILE__, 'DUPL_ME_uninstall' );
     72register_deactivation_hook( __FILE__, 'dupl_me_uninstall' );
    8073
    8174/**
     
    8679 *
    8780 * @package Duplicate Me
    88  * @since 1.0.0
     81 * @since 3.0.0
    8982 */
    90 function DUPL_ME_install() {
     83function dupl_me_install() {
    9184
    9285    global $wpdb;
     
    10093 *
    10194 * @package Duplicate Me
    102  * @since 1.0.0
     95 * @since 3.0.0
    10396 */
    104 function DUPL_ME_uninstall() {
     97function dupl_me_uninstall() {
    10598
    10699    global $wpdb;
     
    112105 *
    113106 * @package Duplicate Me
    114  * @since 1.0.0
     107 * @since 3.0.0
    115108 */
    116109
  • duplicate-me/trunk/readme.txt

    r3025760 r3089953  
    44Tags: Duplicate Page, Duplciate Post, clone page, clone post, clone data
    55Requires at least: 3.8
    6 Tested up to: 6.4.2
     6Tested up to: 6.5.3
    77Requires PHP: 5.2.4
    88Stable tag: 3.2.0
Note: See TracChangeset for help on using the changeset viewer.