🔒 EXCLUSIVE: Changeset/ - High Quality

Changeset 1312268


Ignore:
Timestamp:
12/19/2015 10:12:48 AM (10 years ago)
Author:
desaiuditd
Message:

Update to commit 27915c7 from git@…:desaiuditd/watchman.git

Location:
watchman
Files:
27 added
5 edited

Legend:

Unmodified
Added
Removed
  • watchman/trunk/readme.md

    r1312071 r1312268  
    55
    66**Contributors:** [desaiuditd](https://profiles.wordpress.org/desaiuditd) 
    7 **Tags:** [revisions](https://wordpress.org/plugins/tags/revisions), [post](https://wordpress.org/plugins/tags/post), [page](https://wordpress.org/plugins/tags/page), [custom post types](https://wordpress.org/plugins/tags/custom post types), [WordPress](https://wordpress.org/plugins/tags/WordPress), [history](https://wordpress.org/plugins/tags/history
     7**Tags:** [revision](https://wordpress.org/plugins/tags/revision), [revisions](https://wordpress.org/plugins/tags/revisions), [post](https://wordpress.org/plugins/tags/post), [posts](https://wordpress.org/plugins/tags/posts), [page](https://wordpress.org/plugins/tags/page), [pages](https://wordpress.org/plugins/tags/pages), [custom post types](https://wordpress.org/plugins/tags/custom post types), [custom post type](https://wordpress.org/plugins/tags/custom post type), [WordPress](https://wordpress.org/plugins/tags/WordPress), [history](https://wordpress.org/plugins/tags/history), [track](https://wordpress.org/plugins/tags/track), [track post](https://wordpress.org/plugins/tags/track post), [track posts](https://wordpress.org/plugins/tags/track posts), [edit flow](https://wordpress.org/plugins/tags/edit flow
    88**Requires at least:** 3.6 
    99**Tested up to:** 4.4 
     
    6666
    6767Please visit [Watchman's Roadmap page](http://blog.incognitech.in/watchman/roadmap/ "Visit Watchman's Features page") to get some details about future releases.
     68### 0.7 ###
     69* Fixes #12 - Revision Limit for Individual Posts
     70* Fixes #14 - User can stop saving revisions for post type with number 0
     71
    6872### 0.6 December 18, 2015 ###
    6973* Fixes #6 - Track Post Status
    7074* Fixes #7 - Track Post Date
    71 * Fixes #13 - Stops unneccessary revisions getting created
     75* Fixes #13 - Stops unnecessary revisions getting created
    7276* Adds Settings link in Plugin Row Action
    7377* Fixes few Translation Strings
  • watchman/trunk/readme.txt

    r1312071 r1312268  
    22Contributors:      desaiuditd
    33Donate Link:       Paypal ID : [email protected]
    4 Tags:              revisions, post, page, custom post types, WordPress, history
     4Tags:              revision, revisions, post, posts, page, pages, custom post types, custom post type, WordPress, history, track, track post, track posts, edit flow
    55Requires at least: 3.6
    66Tested up to:      4.4
     
    7272Please visit [Watchman's Roadmap page](http://blog.incognitech.in/watchman/roadmap/ "Visit Watchman's Features page") to get some details about future releases.
    7373
     74= 0.7 =
     75* Fixes #12 - Revision Limit for Individual Posts
     76* Fixes #14 - User can stop saving revisions for post type with number 0
     77
    7478= 0.6 December 18, 2015 =
    7579* Fixes #6 - Track Post Status
    7680* Fixes #7 - Track Post Date
    77 * Fixes #13 - Stops unneccessary revisions getting created
     81* Fixes #13 - Stops unnecessary revisions getting created
    7882* Adds Settings link in Plugin Row Action
    7983* Fixes few Translation Strings
  • watchman/trunk/revision/class-wm-revision.php

    r1312071 r1312268  
    2929
    3030            /**
     31             * This hook filters the number of revisions to keep for a specific post.
     32             */
     33            add_filter( 'wp_revisions_to_keep', array( $this, 'filter_revisions_to_keep' ), 999, 2 );
     34
     35            /**
    3136             * This hooks gets fired once a revision is stored in WP_Post table in DB.
    3237             *
     
    5863             */
    5964            add_filter( 'wp_get_revision_ui_diff', array( $this, 'revision_ui_diff' ), 10, 3 );
     65        }
     66
     67        /**
     68         * @param $num
     69         * @param $post
     70         *
     71         * @return int
     72         * @since 0.1
     73         */
     74        function filter_revisions_to_keep( $num, $post ) {
     75
     76            // Check individual Post Limit
     77            $revision_limit = get_post_meta( $post->ID, WM_Admin::$wm_revision_limit_meta_key, true );
     78
     79            if ( '' !== $revision_limit ) {
     80
     81                if ( ! is_numeric( $revision_limit ) ) {
     82                    $num = - 1;
     83                } else {
     84                    $num = intval( $revision_limit );
     85                }
     86            } else {
     87
     88                $post_type = get_post_type( $post );
     89
     90                $revision_limit = get_option( WM_Settings::$revision_limit_key . $post_type, false );
     91
     92                if ( '' === $revision_limit || ! is_numeric( $revision_limit ) ) {
     93                    $num = - 1;
     94                } else {
     95                    $num = intval( $revision_limit );
     96                }
     97            }
     98
     99            return $num;
    60100        }
    61101
  • watchman/trunk/settings/class-wm-settings.php

    r1312071 r1312268  
    2727            add_action( 'admin_notices', array( $this, 'display_admin_notices' ) );
    2828
    29             add_filter( 'wp_revisions_to_keep', array( $this, 'filter_revisions_to_keep' ), 999, 2 );
    30 
    3129            add_filter( 'plugin_action_links_' . WM_BASE_PATH, array( $this, 'plugin_actions' ), 10, 4 );
    3230        }
     
    3735
    3836            return $actions;
    39         }
    40 
    41         function filter_revisions_to_keep( $num, $post ) {
    42 
    43             $post_type = get_post_type( $post );
    44 
    45             $revision = get_option( self::$revision_limit_key . $post_type, false );
    46 
    47             if ( empty( $revision ) || ! is_numeric( $revision ) ) {
    48                 $num = -1;
    49             } else {
    50                 $num = intval( $revision );
    51             }
    52 
    53             return $num;
    5437        }
    5538
     
    152135            if ( ! empty( $value ) && ! is_numeric( $value ) ) {
    153136                add_settings_error( $option, 'watchman_errors', sprintf( __( 'You need to fill numeric value for %s revision limit.', WM_TEXT_DOMAIN ), '<strong>' . $labels->name . '</strong>' ) );
    154             } else {
     137            } else if ( '' !== $value ) {
    155138                $value = absint( $value );
    156139            }
  • watchman/trunk/watchman.php

    r1312071 r1312268  
    44 * Plugin URI: http://blog.incognitech.in/watchman
    55 * Description: A WordPress plugin to track revisions of your posts, pages and custom posts
    6  * Version: 0.6
     6 * Version: 0.7
    77 * Author: desaiuditd
    88 * Author URI: http://blog.incognitech.in
     
    8686            // Defines WM_VERSION if it does not exits.
    8787            if ( ! defined( 'WM_VERSION' ) ) {
    88                 define( 'WM_VERSION', '0.6' );
     88                define( 'WM_VERSION', '0.7' );
    8989            }
    9090
     
    123123
    124124            new WM_Settings();
     125            new WM_Admin();
    125126            new WM_Revision();
    126127        }
Note: See TracChangeset for help on using the changeset viewer.