Plugin Directory

Changeset 1817209

Timestamp:
02/07/2018 10:32:47 AM (6 years ago)
Author:
pauldewouters
Message:

Preparing for 1.5 release

Location:
comment-popularity/trunk
Files:
4 added
17 edited

Legend:

Unmodified
Added
Removed
  • comment-popularity/trunk/CONTRIBUTING.md

    r1728064 r1817209  
    1717Obviously you'll need contributor access to the WordPress.org repository.
    1818
    19 - Run `grunt bumpto:[patch|minor|major]` ( changes version number in plugin and readme )
    20 - Run `grunt makepot` and commit if necessary
    21 - Run `git changelog` ( requires git-extras ) and copy changelog.md to the README.txt
    22 - Run `grunt wp_readme_to_markdown`
    23 - Run `grunt shell`
    24 - Run `git push && git push --tags`
    25 - Run `grunt copy:build`
    26 - Test plugin from build
    27 - Run `grunt wp_deploy`
    28 - Delete build folder ( `grunt clean:build` )
     19Install and run [the deployment script as per instructions](https://github.com/GaryJones/wordpress-plugin-svn-deploy)
    2920
    3021Available Grunt tasks
     
    3223
    3324Linting: `grunt lint`
    34 Minifying: `grunt minify`
     25Minifying JS: `grunt minify`
     26Minify CSS: `cssmin`
  • comment-popularity/trunk/Gruntfile.js

    r1728064 r1817209  
    2929            modules: {
    3030                files: {
    31                     'assets/js/modules/growl/javascripts/jquery.growl.min.js': ['assets/js/modules/growl/javascripts/jquery.growl.js']
     31                    'growl/javascripts/jquery.growl.js']
    3232                }
    3333            },
    3434            plugin: {
    3535                files: {
    36                     'assets/js/voting.min.js': ['assets/js/voting.js']
     36                    'js/voting.js']
    3737                }
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
    3848            }
    3949        },
     
    6474            }
    6575        },
    66 
    67         shell: {
    68             commit: {
    69                 command: 'git add . --all && git commit -m "Version <%= pkg.version %>"'
    70             },
    71             tag: {
    72                 command: 'git tag -a <%= pkg.version %> -m "Version <%= pkg.version %>"'
    73             }
    74         },
    75 
    76         copy: {
    77             build: {
    78                 files: [
    79                     {
    80                         expand: true,
    81                         cwd: '.',
    82                         src: [
    83                             '**/*',
    84                             '!**/.{svn,git,bowerrc,jshintrc,travis.yml,gitignore}/**',
    85                             '!**/.DS_Store/**',
    86                             '!**composer{.json,.lock}**',
    87                             '!**{phpcompatinfo,package}.json**',
    88                             '!**Gruntfile.js**',
    89                             '!**{changelog,CONTRIBUTING,README}.md**',
    90                             '!**phpunit**',
    91                             '!**/node_modules/**',
    92                             '!**/wp-assets/**',
    93                             '!**/tests/**',
    94                             '!**/build/**',
    95                             '!**/bin/**',
    96                             '!**/docs/**',
    97                             '!**phpdoc.xml**',
    98                             '!**/inc/lib/twig/twig/{test,doc}/**'
    99                         ],
    100                         dest: 'build'
    101                     }
    102                 ]
    103             }
    104         },
    105 
    106         clean:{
    107             build: {
    108                 src: [ 'build' ]
    109             }
    110         },
    111 
    112         replace: {
    113             classVersion: {
    114                 src: [
    115                     'inc/class-comment-popularity.php'
    116                 ],
    117                 overwrite: true,
    118                 replacements: [ {
    119                     from: /^const HMN_CP_PLUGIN_VERSION = '.*';$/m,
    120                     to: "const HMN_CP_PLUGIN_VERSION '<%= pkg.version %>';"
    121                 } ]
    122             },
    123             pluginsVersion: {
    124                 src: [
    125                     'comment-popularity.php'
    126                 ],
    127                 overwrite: true,
    128                 replacements: [ {
    129                     from: /^Version: .*$/m,
    130                     to: 'Version: <%= pkg.version %>'
    131                 } ]
    132             },
    133             readmeVersion: {
    134                 src: [
    135                     'README.txt'
    136                 ],
    137                 overwrite: true,
    138                 replacements: [ {
    139                     from: /^Stable tag: .*$/m,
    140                     to: 'Stable tag: <%= pkg.version %>'
    141                 } ]
    142             }
    143         },
    144 
    145         bump: {
    146             options: {
    147                 files: [ 'package.json' ],
    148                 updateConfigs: [ 'pkg' ],
    149                 commit: false
    150             }
    151         },
    152 
    153         other: {
    154             changelog: 'changelog.md'
    155         },
    156 
    157         // Creates an MD version of the README file
    158         wp_readme_to_markdown: {
    159             your_target: {
    160                 files: {
    161                     'README.md': 'README.txt'
    162                 }
    163             }
    164         },
    165 
    166         // Deploys a new version to the svn WordPress.org repo.
    167         wp_deploy: {
    168             deploy: {
    169                 options: {
    170                     plugin_slug: 'comment-popularity',
    171                     svn_user: 'pauldewouters',
    172                     build_dir: 'build',
    173                     assets_dir: 'wp-assets'
    174                 }
    175             }
    176         }
    177 
    17876    });
    17977
     
    18179    grunt.registerTask('lint', ['newer:jshint:grunt','newer:jshint:plugin']);
    18280
    183     // Top level function to build a new release
    184     grunt.registerTask( 'release', function( releaseType ) {
    185         if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
    186             grunt.fail.fatal( 'Please specify the release type (e.g., "grunt release:patch")' );
    187         } else {
    188             // Check to make sure the log exists
    189             grunt.task.run( 'log:' + releaseType );
    190 
    191             // Bump the version numbers
    192             grunt.task.run( 'bumpto:' + releaseType );
    193 
    194             // Create the .pot file
    195             grunt.task.run( 'makepot' );
    196 
    197             // Build the SASS and scripts
    198             grunt.task.run( 'default' );
    199 
    200             // Zip it up
    201             grunt.task.run( 'package' );
    202 
    203             // Commit and tag version update
    204             //grunt.task.run( 'shell:commit' );
    205             //grunt.task.run( 'shell:tag' );
    206         }
    207     } );
    208 
    20981    // Default task(s).
    210     grunt.registerTask( 'default', [ 'minify', 'uglify' ] );
    211 
    212     // Bump the version to the specified value; e.g., "grunt bumpto:patch"
    213     grunt.registerTask( 'bumpto', function( releaseType ) {
    214         if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
    215             grunt.fail.fatal( 'Please specify the bump type (e.g., "grunt bumpto:patch")' );
    216         } else {
    217             grunt.task.run( 'bump-only:' + releaseType );
    218 
    219             // Update the version numbers
    220             grunt.task.run( 'replace' );
    221         }
    222     } );
    223 
    224     // Prompt for the changelog
    225     grunt.registerTask( 'log', function( releaseType ) {
    226         var semver = require( 'semver' ),
    227             changelog,
    228             newVersion = semver.inc( grunt.config.get( 'pkg' ).version, releaseType),
    229             regex = new RegExp( '^## ' + newVersion, 'gm' ); // Match the version number (e.g., "# 1.2.3")
    230 
    231         if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
    232             grunt.log.writeln().fail( 'Please choose a valid version type (minor, major, or patch)' );
    233         } else {
    234             // Get the new version
    235             changelog = grunt.file.read( grunt.config.get( 'other' ).changelog );
    236 
    237             if ( changelog.match( regex ) ) {
    238                 grunt.log.ok( 'v' + newVersion + ' changlelog entry found' );
    239             } else {
    240                 grunt.fail.fatal( 'Please enter a changelog entry for v' + newVersion );
    241             }
    242         }
    243     } );
    244 
    245     // Package a new release
    246     grunt.registerTask( 'package', [
    247         'copy:build',
    248         'compress:build',
    249         'clean:build'
    250     ] );
     82    grunt.registerTask( 'default', [ 'minify', 'uglify', 'cssmin' ] );
    25183};
  • comment-popularity/trunk/README.txt

    r1740346 r1817209  
    33Contributors: pauldewouters,mattheu,humanmade,cfo-publishing
    44Tags: comments,vote,upvote,karma,widget
    5 Requires at least: 3.9
    6 Tested up to: 4.8.1
    7 Stable tag: 1.4.3.3
     5Requires at least: .9
     6Tested up to: 4.
     7Stable tag: 1.
    88Requires PHP: 5.3.2
    99License: GPLv2 or later
     
    131131
    132132== Changelog ==
     133
     134
     135
     136
     137
    133138
    134139= 1.4.3.3 =
     
    371376* Add readme to markdown task
    372377* Documentation for how to remove the built in comment template
    373  
     378
    374379= 1.0.1 =
    375380
  • comment-popularity/trunk/admin/class-comment-popularity-admin.php

    r1396469 r1817209  
    3232    public static function get_instance() {
    3333
    34         if ( ! self::$instance instanceof HMN_Comment_Popularity_Admin ) {
    35             self::$instance = new HMN_Comment_Popularity_Admin();
     34        if ( ! self::$instance instanceof ) {
     35            self::$instance = new ();
    3636
    3737        }
     
    108108        $current_karma = get_user_option( 'hmn_user_karma', $user->ID );
    109109
    110         $user_karma = ( empty( $current_karma ) ) ? $default_karma : $current_karma;
     110        $user_karma = ) ? $default_karma : $current_karma;
    111111
    112112        $user_expert_status = get_user_option( 'hmn_user_expert_status', $user->ID );
     
    185185        $comment = get_comment( $comment_ID );
    186186
    187         echo intval( $comment->comment_karma );
     187        echo ;
    188188    }
    189189
     
    218218        }
    219219
    220         $user_karma = get_user_option( 'hmn_user_karma', $user_id );
    221 
    222         return $user_karma;
    223 
     220        return get_user_option( 'hmn_user_karma', $user_id );
    224221    }
    225222
  • comment-popularity/trunk/comment-popularity.php

    r1740346 r1817209  
    44Plugin URI: https://github.com/humanmade/comment-popularity
    55Description: Allow visitors to vote on comments.
    6 Version: 1.4.3.3
     6Version: 1.
    77Author: Human Made Limited
    88Author URI: http://humanmade.co.uk
  • comment-popularity/trunk/composer.json

    r1728064 r1817209  
    2222    },
    2323    "require": {
    24         "twig/twig": "1.*"
     24        "twig/twig": ".*"
    2525    },
    2626    "require-dev": {
  • comment-popularity/trunk/composer.lock

    r1731502 r1817209  
    55        "This file is @generated automatically"
    66    ],
    7     "content-hash": "95b7890e4ce1f78b4d9074cc281a4bb6",
     7    "content-hash": "",
    88    "packages": [
    99        {
    10             "name": "twig/twig",
    11             "version": "v1.34.4",
     10            "name": "g",
     11            "version": "v1.",
    1212            "source": {
    1313                "type": "git",
    14                 "url": "https://github.com/twigphp/Twig.git",
    15                 "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee"
     14                "url": "https://github.com/g.git",
     15                "reference": ""
    1616            },
    1717            "dist": {
    1818                "type": "zip",
    19                 "url": "https://api.github.com/repos/twigphp/Twig/zipball/f878bab48edb66ad9c6ed626bf817f60c6c096ee",
    20                 "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee",
     19                "url": "https://api.github.com/repos/",
     20                "reference": "",
    2121                "shasum": ""
    2222            },
    2323            "require": {
    2424                "php": ">=5.3.3"
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
    2585            },
    2686            "require-dev": {
     
    3292            "extra": {
    3393                "branch-alias": {
    34                     "dev-master": "1.34-dev"
     94                    "dev-master": "4-dev"
    3595                }
    3696            },
     
    70130                "templating"
    71131            ],
    72             "time": "2017-07-04T13:19:31+00:00"
     132            "time": "2017-0:31+00:00"
    73133        }
    74134    ],
     
    76136        {
    77137            "name": "squizlabs/php_codesniffer",
    78             "version": "3.0.2",
     138            "version": "3..2",
    79139            "source": {
    80140                "type": "git",
    81141                "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
    82                 "reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51"
     142                "reference": "1"
    83143            },
    84144            "dist": {
    85145                "type": "zip",
    86                 "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/c7594a88ae75401e8f8d0bd4deb8431b39045c51",
    87                 "reference": "c7594a88ae75401e8f8d0bd4deb8431b39045c51",
     146                "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1",
     147                "reference": "1",
    88148                "shasum": ""
    89149            },
     
    95155            },
    96156            "require-dev": {
    97                 "phpunit/phpunit": "~4.0"
     157                "phpunit/phpunit": ".0"
    98158            },
    99159            "bin": [
     
    123183                "standards"
    124184            ],
    125             "time": "2017-07-18T01:12:32+00:00"
     185            "time": "2017-+00:00"
    126186        }
    127187    ],
  • comment-popularity/trunk/inc/class-comment-popularity.php

    r1740346 r1817209  
    1010     * Plugin version number.
    1111     */
    12     const HMN_CP_PLUGIN_VERSION = '1.4.3.3';
     12    const HMN_CP_PLUGIN_VERSION = '1.';
    1313
    1414    /**
     
    2020     *
    2121     */
    22     const HMN_CP_REQUIRED_WP_VERSION = '3.8.4';
     22    const HMN_CP_REQUIRED_WP_VERSION = '';
    2323
    2424    /**
     
    6363    public static function get_instance() {
    6464
    65         if ( ! self::$instance instanceof HMN_Comment_Popularity ) {
    66             self::$instance = new HMN_Comment_Popularity();
     65        if ( ! self::$instance instanceof ) {
     66            self::$instance = new ();
    6767
    6868        }
     
    107107     * @param HMN_CP_Visitor $visitor
    108108     */
    109     public function set_visitor( $visitor ) {
     109    public function set_visitor( $visitor ) {
    110110        $this->visitor = $visitor;
    111111    }
     
    197197        global $wp_version;
    198198
    199         if ( version_compare( $wp_version, self::HMN_CP_REQUIRED_WP_VERSION, '<' ) ) {
    200 
    201             if ( current_user_can( 'activate_plugins' ) ) {
    202 
    203                 deactivate_plugins( plugin_basename( __FILE__ ) );
    204                 wp_die( sprintf( __( 'This plugin requires WordPress version %s. Sorry about that.', 'comment-popularity' ), self::HMN_CP_REQUIRED_WP_VERSION ), 'Comment Popularity', array( 'back_link' => true ) );
    205 
    206             }
    207 
     199        if ( ! current_user_can( 'activate_plugins' ) || version_compare( $wp_version, self::HMN_CP_REQUIRED_WP_VERSION, '<' ) ) {
     200            deactivate_plugins( plugin_basename( __FILE__ ) );
     201            /* translators: the plugin version number */
     202            wp_die( sprintf( __( 'This plugin requires WordPress version %s. Sorry about that.', 'comment-popularity' ), self::HMN_CP_REQUIRED_WP_VERSION ), 'Comment Popularity', array( 'back_link' => true ) );
    208203        }
    209204
     
    222217            if ( ! empty( $role_obj ) ) {
    223218
    224                 if ( in_array( 'manage_user_karma_settings', $role_obj->capabilities ) ) {
     219                if ( in_array( 'manage_user_karma_settings', $role_obj->capabilities ) ) {
    225220                    $role_obj->remove_cap( 'manage_user_karma_settings' );
    226221                }
    227222
    228                 if ( in_array( 'vote_on_comments', $role_obj->capabilities ) ) {
     223                if ( in_array( 'vote_on_comments', $role_obj->capabilities ) ) {
    229224                    $role_obj->remove_cap( 'vote_on_comments' );
    230225                }
    231 
    232226            }
    233 
    234227        }
    235228
     
    290283    public function enqueue_scripts() {
    291284
    292         wp_enqueue_style( 'growl', plugins_url( '../js/modules/growl/stylesheets/jquery.growl.min.css', __FILE__ ), array(), self::HMN_CP_PLUGIN_VERSION );
    293 
    294         wp_enqueue_script( 'growl', plugins_url( '../js/modules/growl/javascripts/jquery.growl.min.js', __FILE__ ), array( 'jquery' ), self::HMN_CP_PLUGIN_VERSION, true );
     285        wp_enqueue_style( 'growl', plugins_url( '../s/jquery.growl.min.css', __FILE__ ), array(), self::HMN_CP_PLUGIN_VERSION );
     286
     287        wp_enqueue_script( 'growl', plugins_url( '../js/jquery.growl.min.js', __FILE__ ), array( 'jquery' ), self::HMN_CP_PLUGIN_VERSION, true );
    295288
    296289        $js_file = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? '../js/voting.js' : '../js/voting.min.js';
     
    298291            'jquery',
    299292            'underscore',
    300             'growl'
     293            'growl'
    301294        ), self::HMN_CP_PLUGIN_VERSION );
    302295
     
    321314        global $post;
    322315
    323         if ( ! ( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
     316        if ( ! ( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
    324317
    325318            return;
     
    339332     * @param $depth
    340333     */
    341     function comment_callback( $comment, $args, $depth ) {
     334    function comment_callback( $comment, $args, $depth ) {
    342335
    343336        include apply_filters( 'hmn_cp_single_comment_template_path', plugin_dir_path( __FILE__ ) . 'templates/comment.php' );
     
    348341     * Renders the HTML for voting on comments
    349342     *
    350      * @param $comment_id
     343     * @param
    351344     */
    352345    public function render_ui( $comment_id ) {
     
    370363            'comment_weight'    => $this->get_comment_weight( $comment_id ),
    371364            'enable_voting'     => $this->visitor_can_vote(),
    372             'vote_type'         => in_array( $comment_id, array_keys( $comment_ids_voted_on ) ) ? $comment_ids_voted_on[ $comment_id ] : '',
     365            'vote_type'         => ) ? $comment_ids_voted_on[ $comment_id ] : '',
    373366        );
    374367
     
    382375
    383376        // Visitor can vote if guest voting is enabled, if user is logged in and has correct permission
    384         return ( ! is_null( $this->visitor ) ) && ( $this->is_guest_voting_allowed() || ( is_user_logged_in() && current_user_can( 'vote_on_comments' ) ) );
     377        return ( ) && ( $this->is_guest_voting_allowed() || ( is_user_logged_in() && current_user_can( 'vote_on_comments' ) ) );
    385378    }
    386379
     
    478471     * @return string
    479472     */
    480     public function get_comments_sorted_by_weight( $html = false, $args = array() ) {
     473    public function get_comments_sorted_by_weight( $html = false, ) {
    481474
    482475        // WP_Comment_Query arguments
     
    603596
    604597        $result = $this->is_vote_valid( $comment_id, $labels, $vote );
    605         if (  is_array( $result ) ) {
     598        if ( y( $result ) ) {
    606599            return $this->send_error( $result['error_code'], $result['error_msg'], $comment_id );
    607600        }
     
    646639
    647640    /**
    648      * @return array|bool
     641     * Verify if vote is valid.
     642     *
     643     * @param int    $comment_id The comment ID.
     644     * @param array  $labels The voting labels.
     645     * @param string $action What voting action.
     646     *
     647     * @return array
    649648     */
    650649    protected function is_vote_valid( $comment_id, $labels, $action ) {
    651         $user_can_vote = $this->get_visitor()->is_vote_valid( $comment_id, $labels[ $vote ] );
     650        $user_can_vote = $this->get_visitor()->is_vote_valid( $comment_id, $labels[ $ ] );
    652651        if ( is_wp_error( $user_can_vote ) ) {
    653652
    654653            return array(
    655                 'error_code' => $error->get_error_code(),
    656                 'error_msg'  => $error->get_error_message( $error_code ),
     654                'error_code' => $->get_error_code(),
     655                'error_msg'  => $),
    657656            );
    658657        }
     
    670669        }
    671670
    672         return true;
     671        return ;
    673672    }
    674673
  • comment-popularity/trunk/inc/class-visitor.php

    r1731502 r1817209  
    33/**
    44 * Class HMN_CP_Visitor
     5
    56 * @package CommentPopularity
    67 */
    78/**
    89 * Class HMN_CP_Visitor
     10
    911 * @package CommentPopularity
    1012 */
    1113abstract class HMN_CP_Visitor {
    1214
     15
     16
     17
     18
     19
    1320    protected $visitor_id;
    1421
     
    2229    /**
    2330     * Creates a new HMN_CP_Visitor object.
     31
     32
    2433     */
    2534    public function __construct( $visitor_id ) {
    26 
    2735        $this->visitor_id = $visitor_id;
    28 
    29         $this->interval = apply_filters( 'hmn_cp_interval', 15 * MINUTE_IN_SECONDS );
    30 
    31     }
    32 
    33     /**
    34      * @return mixed
    35      */
    36     abstract function log_vote( $comment_id, $action );
    37 
    38     abstract function is_vote_valid( $comment_id, $action = '' );
     36        $this->interval   = apply_filters( 'hmn_cp_interval', 15 * MINUTE_IN_SECONDS );
     37    }
     38
     39    /**
     40     * @return mixed
     41     */
     42    abstract public function log_vote( $comment_id, $action );
     43
     44    abstract public function is_vote_valid( $comment_id, $action = '' );
    3945
    4046    /**
     
    8692
    8793        setcookie( 'hmn_cp_visitor', $this->visitor_id, $expiry, COOKIEPATH, COOKIE_DOMAIN, $secure );
    88         if ( SITECOOKIEPATH != COOKIEPATH ) {
     94        if ( SITECOOKIEPATH != COOKIEPATH ) {
    8995            setcookie( 'hmn_cp_visitor', $this->visitor_id, $expiry, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
    9096        }
     
    9399        $_COOKIE['hmn_cp_visitor'] = $this->visitor_id;
    94100
    95         $this->cookie = $_COOKIE['hmn_cp_visitor'];
     101        $this->cookie = ;
    96102    }
    97103
     
    116122        $logged_votes = $this->retrieve_logged_votes();
    117123
    118         $logged_votes[ 'comment_id_' . $comment_id ]['vote_time'] = current_time( 'timestamp' );
     124        $logged_votes[ 'comment_id_' . $comment_id ]['vote_time'] = current_time( 'timestamp' );
    119125        $logged_votes[ 'comment_id_' . $comment_id ]['last_action'] = $action;
    120126
     
    181187
    182188        if ( is_multisite() ) {
    183             $blog_id = get_current_blog_id();
    184             $logged_votes = get_blog_option( $blog_id, 'hmn_cp_guests_logged_votes' );
     189            $blog_id = get_current_blog_id();
     190            $logged_votes = get_blog_option( $blog_id, 'hmn_cp_guests_logged_votes' );
    185191            $logged_votes[ $this->visitor_id ] = $votes;
    186192            update_blog_option( $blog_id, 'hmn_cp_guests_logged_votes', $logged_votes );
     
    194200     * Determine if the guest visitor can vote.
    195201     *
    196      * @param        $comment_id
     202     * @param     $comment_id
    197203     * @param string $action
    198204     *
     
    210216/**
    211217 * Class HMN_CP_Visitor_Member
     218
    212219 * @package CommentPopularity
    213220 */
     
    231238
    232239        if ( $comment->user_id && ( $this->get_id() === (int) $comment->user_id ) ) {
     240
    233241            return new \WP_Error( 'upvote_own_comment', sprintf( __( 'You cannot %s your own comments.', 'comment-popularity' ), $action ) );
    234242        }
     
    254262
    255263        $comments_voted_on = $this->retrieve_logged_votes();
    256 
    257         $comments_voted_on[ 'comment_id_' . $comment_id ]['vote_time'] = current_time( 'timestamp' );
     264        $comments_voted_on[ 'comment_id_' . $comment_id ]['vote_time']   = current_time( 'timestamp' );
    258265        $comments_voted_on[ 'comment_id_' . $comment_id ]['last_action'] = $action;
    259266
  • comment-popularity/trunk/inc/helpers.php

    r1090392 r1817209  
    3131        $author_karma = $hmn_cp_obj->get_comment_author_karma( get_comment_author_email( get_comment_ID() ) );
    3232
    33         if ( isset( $author_karma ) ) {
     33        if ( ) {
    3434            echo '<small class="user-karma">(User Karma: ' . esc_html( $author_karma ) . ')</small>';
    3535        }
     
    4444 * @param array $args
    4545 */
    46 function hmn_cp_the_sorted_comments( $args = array() ) {
     46function hmn_cp_the_sorted_comments( ) {
    4747
    4848    if ( class_exists( 'CommentPopularity\HMN_Comment_Popularity' ) ) {
  • comment-popularity/trunk/inc/templates/comment.php

    r1396469 r1817209  
    44$GLOBALS['comment'] = $comment;
    55
    6 if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
     6if ( 'pingback' ==== $comment->comment_type ) : ?>
    77
    88<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
     
    1818            <?php $hmn_cp_plugin = HMN_Comment_Popularity::get_instance(); $hmn_cp_plugin->render_ui( get_comment_ID() ); ?>
    1919            <?php // Avatar
    20             if ( 0 != $args['avatar_size'] ) :
     20            if ( 0 != $args['avatar_size'] ) :
    2121            echo get_avatar( $comment, $args['avatar_size'] );
    2222            endif;
  • comment-popularity/trunk/inc/templates/comments.php

    r976435 r1817209  
    6161    <?php endif; ?>
    6262
    63     <?php if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
     63    <?php if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
    6464        <p class="no-comments">
    65             <?php _e( 'Comments are closed.', 'comment-popularity' ); ?>
     65            <?php _e( 'Comments are closed.', 'comment-popularity' ); ?>
    6666        </p>
    6767    <?php endif; ?>
  • comment-popularity/trunk/inc/widgets/class-widget-most-voted.php

    r976435 r1817209  
    8888        $output = '';
    8989
    90         $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Most voted Comments', 'comment-popularity' );
     90        $title = ) ? $instance['title'] : __( 'Most voted Comments', 'comment-popularity' );
    9191
    9292        /** This filter is documented in wp-includes/default-widgets.php */
    9393        $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    9494
    95         $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
     95        $number = ) ? absint( $instance['number'] ) : 5;
    9696        if ( ! $number ) {
    9797            $number = 5;
    9898        }
    99        
     99
    100100        $hmn_cp_plugin = HMN_Comment_Popularity::get_instance();
    101101        $comments = $hmn_cp_plugin->get_comments_sorted_by_weight( false, array( 'number' => $number, 'echo' => false ) );
  • comment-popularity/trunk/inc/widgets/experts/class-widget-experts.php

    r1396469 r1817209  
    179179
    180180        // Display the admin form
    181         include( plugin_dir_path( __FILE__ ) . 'views/admin.php' );
     181        include . 'views/admin.php' );
    182182
    183183    } // end form
    184184
    185     protected function get_experts( $args = array() ) {
     185    /**
     186     * @param array $args
     187     *
     188     * @return mixed
     189     */
     190    protected function get_experts() {
    186191
    187192        /* Get the experts list. */
    188         $args = array (
     193        $args = array(
    189194            'number'         => '5',
    190195            'meta_query'     => array(
  • comment-popularity/trunk/js/voting.min.js

    r1737755 r1817209  
    1 !function(a){"use strict";a(function(){var b=!1;a("div.comment-weight-container").on("click","span > a",_.throttle(function(c){c.preventDefault();var d=0,e=a(this).data("commentId"),f=a(this).closest("span").attr("class");if("upvote"!==f&&a(this).hasClass("vote-up")?d="upvote":"downvote"!==f&&a(this).hasClass("vote-down")?d="downvote":("downvote"===f&&a(this).hasClass("vote-down")||"upvote"===f&&a(this).hasClass("vote-up"))&&(d="undo"),!1===b){b=!0;var g=a.post(comment_popularity.ajaxurl,{action:"comment_vote_callback",vote:d,comment_id:e,hmn_vote_nonce:comment_popularity.hmn_vote_nonce});g.done(function(c){var d=a("#comment-weight-value-"+c.data.comment_id);if(c.success===!1)a.growl.error({message:c.data.error_message});else{if(d.text(c.data.weight),d.closest(".comment-weight-container ").children().removeClass(),"undo"!==c.data.vote_type)switch(d.addClass(c.data.vote_type),c.data.vote_type){case"upvote":d.prev().addClass(c.data.vote_type);break;case"downvote":d.next().addClass(c.data.vote_type)}a.growl.notice({message:c.data.success_message})}b=!1})}},500))})}(jQuery);
     1!function(},500))})}(jQuery);
  • comment-popularity/trunk/package.json

    r1728064 r1817209  
    44  "description": "Adds comment upvoting.",
    55  "main": "index.js",
    6   "scripts": {
    7     "test": "echo \"Error: no test specified\" && exit 1"
    8   },
    96  "repository": {
    107    "type": "git",
     
    2320  "homepage": "https://github.com/humanmade/comment-popularity",
    2421  "devDependencies": {
    25     "grunt": "^0.4.5",
    26     "grunt-bump": "0.0.15",
    27     "grunt-contrib-clean": "^0.6.0",
    28     "grunt-contrib-compress": "^0.10.0",
    29     "grunt-contrib-copy": "^0.5.0",
    30     "grunt-contrib-jshint": "^0.10.0",
    31     "grunt-contrib-uglify": "^0.5.1",
    32     "grunt-newer": "^0.7.0",
    33     "grunt-shell": "^0.7.0",
    34     "grunt-text-replace": "^0.3.12",
    35     "grunt-wp-deploy": "^0.5.0",
    36     "grunt-wp-i18n": "^0.4.6",
     22    "grunt": "^1.0.0",
     23    "grunt-contrib-cssmin": "^2.2.1",
     24    "grunt-contrib-jshint": "^1.1.0",
     25    "grunt-contrib-uglify": "^3.3.0",
     26    "grunt-newer": "^1.3.0",
     27    "grunt-wp-i18n": "^1.0.1",
    3728    "grunt-wp-readme-to-markdown": "^0.8.0",
    38     "install": "^0.1.7",
    39     "load-grunt-tasks": "^0.6.0",
    40     "npm": "^1.4.21",
    41     "semver": "^3.0.1"
     29    "
     30  ,
     31 
     32    ""
    4233  }
    4334}
  • comment-popularity/trunk/tests/test-comment-popularity.php

    r1728064 r1817209  
    2626        $this->plugin = HMN_Comment_Popularity::get_instance();
    2727
    28         $this->plugin->activate();
     28        $this->pluginactivate();
    2929
    3030        $this->test_voter_id = $this->factory->user->create(
Note: See TracChangeset for help on using the changeset viewer.