Changeset 1817209
- Timestamp:
- 02/07/2018 10:32:47 AM (6 years ago)
- Location:
- comment-popularity/trunk
- Files:
-
- 4 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
comment-popularity/trunk/CONTRIBUTING.md
r1728064 r1817209 17 17 Obviously you'll need contributor access to the WordPress.org repository. 18 18 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` ) 19 Install and run [the deployment script as per instructions](https://github.com/GaryJones/wordpress-plugin-svn-deploy) 29 20 30 21 Available Grunt tasks … … 32 23 33 24 Linting: `grunt lint` 34 Minifying: `grunt minify` 25 Minifying JS: `grunt minify` 26 Minify CSS: `cssmin` -
comment-popularity/trunk/Gruntfile.js
r1728064 r1817209 29 29 modules: { 30 30 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'] 32 32 } 33 33 }, 34 34 plugin: { 35 35 files: { 36 ' assets/js/voting.min.js': ['assets/js/voting.js']36 'js/voting.js'] 37 37 } 38 39 40 41 42 43 44 45 46 47 38 48 } 39 49 }, … … 64 74 } 65 75 }, 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: false150 }151 },152 153 other: {154 changelog: 'changelog.md'155 },156 157 // Creates an MD version of the README file158 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 178 76 }); 179 77 … … 181 79 grunt.registerTask('lint', ['newer:jshint:grunt','newer:jshint:plugin']); 182 80 183 // Top level function to build a new release184 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 exists189 grunt.task.run( 'log:' + releaseType );190 191 // Bump the version numbers192 grunt.task.run( 'bumpto:' + releaseType );193 194 // Create the .pot file195 grunt.task.run( 'makepot' );196 197 // Build the SASS and scripts198 grunt.task.run( 'default' );199 200 // Zip it up201 grunt.task.run( 'package' );202 203 // Commit and tag version update204 //grunt.task.run( 'shell:commit' );205 //grunt.task.run( 'shell:tag' );206 }207 } );208 209 81 // 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' ] ); 251 83 }; -
comment-popularity/trunk/README.txt
r1740346 r1817209 3 3 Contributors: pauldewouters,mattheu,humanmade,cfo-publishing 4 4 Tags: comments,vote,upvote,karma,widget 5 Requires at least: 3.96 Tested up to: 4. 8.17 Stable tag: 1. 4.3.35 Requires at least: .9 6 Tested up to: 4. 7 Stable tag: 1. 8 8 Requires PHP: 5.3.2 9 9 License: GPLv2 or later … … 131 131 132 132 == Changelog == 133 134 135 136 137 133 138 134 139 = 1.4.3.3 = … … 371 376 * Add readme to markdown task 372 377 * Documentation for how to remove the built in comment template 373 378 374 379 = 1.0.1 = 375 380 -
comment-popularity/trunk/admin/class-comment-popularity-admin.php
r1396469 r1817209 32 32 public static function get_instance() { 33 33 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 (); 36 36 37 37 } … … 108 108 $current_karma = get_user_option( 'hmn_user_karma', $user->ID ); 109 109 110 $user_karma = ( empty( $current_karma )) ? $default_karma : $current_karma;110 $user_karma = ) ? $default_karma : $current_karma; 111 111 112 112 $user_expert_status = get_user_option( 'hmn_user_expert_status', $user->ID ); … … 185 185 $comment = get_comment( $comment_ID ); 186 186 187 echo intval( $comment->comment_karma );187 echo ; 188 188 } 189 189 … … 218 218 } 219 219 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 ); 224 221 } 225 222 -
comment-popularity/trunk/comment-popularity.php
r1740346 r1817209 4 4 Plugin URI: https://github.com/humanmade/comment-popularity 5 5 Description: Allow visitors to vote on comments. 6 Version: 1. 4.3.36 Version: 1. 7 7 Author: Human Made Limited 8 8 Author URI: http://humanmade.co.uk -
comment-popularity/trunk/composer.json
r1728064 r1817209 22 22 }, 23 23 "require": { 24 "twig/twig": " 1.*"24 "twig/twig": ".*" 25 25 }, 26 26 "require-dev": { -
comment-popularity/trunk/composer.lock
r1731502 r1817209 5 5 "This file is @generated automatically" 6 6 ], 7 "content-hash": " 95b7890e4ce1f78b4d9074cc281a4bb6",7 "content-hash": "", 8 8 "packages": [ 9 9 { 10 "name": " twig/twig",11 "version": "v1. 34.4",10 "name": "g", 11 "version": "v1.", 12 12 "source": { 13 13 "type": "git", 14 "url": "https://github.com/ twigphp/Twig.git",15 "reference": " f878bab48edb66ad9c6ed626bf817f60c6c096ee"14 "url": "https://github.com/g.git", 15 "reference": "" 16 16 }, 17 17 "dist": { 18 18 "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": "", 21 21 "shasum": "" 22 22 }, 23 23 "require": { 24 24 "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 25 85 }, 26 86 "require-dev": { … … 32 92 "extra": { 33 93 "branch-alias": { 34 "dev-master": " 1.34-dev"94 "dev-master": "4-dev" 35 95 } 36 96 }, … … 70 130 "templating" 71 131 ], 72 "time": "2017-0 7-04T13:19:31+00:00"132 "time": "2017-0:31+00:00" 73 133 } 74 134 ], … … 76 136 { 77 137 "name": "squizlabs/php_codesniffer", 78 "version": "3. 0.2",138 "version": "3..2", 79 139 "source": { 80 140 "type": "git", 81 141 "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", 82 "reference": " c7594a88ae75401e8f8d0bd4deb8431b39045c51"142 "reference": "1" 83 143 }, 84 144 "dist": { 85 145 "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", 88 148 "shasum": "" 89 149 }, … … 95 155 }, 96 156 "require-dev": { 97 "phpunit/phpunit": " ~4.0"157 "phpunit/phpunit": ".0" 98 158 }, 99 159 "bin": [ … … 123 183 "standards" 124 184 ], 125 "time": "2017- 07-18T01:12:32+00:00"185 "time": "2017-+00:00" 126 186 } 127 187 ], -
comment-popularity/trunk/inc/class-comment-popularity.php
r1740346 r1817209 10 10 * Plugin version number. 11 11 */ 12 const HMN_CP_PLUGIN_VERSION = '1. 4.3.3';12 const HMN_CP_PLUGIN_VERSION = '1.'; 13 13 14 14 /** … … 20 20 * 21 21 */ 22 const HMN_CP_REQUIRED_WP_VERSION = ' 3.8.4';22 const HMN_CP_REQUIRED_WP_VERSION = ''; 23 23 24 24 /** … … 63 63 public static function get_instance() { 64 64 65 if ( ! self::$instance instanceof HMN_Comment_Popularity) {66 self::$instance = new HMN_Comment_Popularity();65 if ( ! self::$instance instanceof ) { 66 self::$instance = new (); 67 67 68 68 } … … 107 107 * @param HMN_CP_Visitor $visitor 108 108 */ 109 public function set_visitor( $visitor ) {109 public function set_visitor( $visitor ) { 110 110 $this->visitor = $visitor; 111 111 } … … 197 197 global $wp_version; 198 198 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 ) ); 208 203 } 209 204 … … 222 217 if ( ! empty( $role_obj ) ) { 223 218 224 if ( in_array( 'manage_user_karma_settings', $role_obj->capabilities ) ) {219 if ( in_array( 'manage_user_karma_settings', $role_obj->capabilities ) ) { 225 220 $role_obj->remove_cap( 'manage_user_karma_settings' ); 226 221 } 227 222 228 if ( in_array( 'vote_on_comments', $role_obj->capabilities ) ) {223 if ( in_array( 'vote_on_comments', $role_obj->capabilities ) ) { 229 224 $role_obj->remove_cap( 'vote_on_comments' ); 230 225 } 231 232 226 } 233 234 227 } 235 228 … … 290 283 public function enqueue_scripts() { 291 284 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 ); 295 288 296 289 $js_file = ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? '../js/voting.js' : '../js/voting.min.js'; … … 298 291 'jquery', 299 292 'underscore', 300 'growl' 293 'growl' 301 294 ), self::HMN_CP_PLUGIN_VERSION ); 302 295 … … 321 314 global $post; 322 315 323 if ( ! ( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {316 if ( ! ( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) { 324 317 325 318 return; … … 339 332 * @param $depth 340 333 */ 341 function comment_callback( $comment, $args, $depth ) {334 function comment_callback( $comment, $args, $depth ) { 342 335 343 336 include apply_filters( 'hmn_cp_single_comment_template_path', plugin_dir_path( __FILE__ ) . 'templates/comment.php' ); … … 348 341 * Renders the HTML for voting on comments 349 342 * 350 * @param $comment_id343 * @param 351 344 */ 352 345 public function render_ui( $comment_id ) { … … 370 363 'comment_weight' => $this->get_comment_weight( $comment_id ), 371 364 '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 ] : '', 373 366 ); 374 367 … … 382 375 383 376 // 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' ) ) ); 385 378 } 386 379 … … 478 471 * @return string 479 472 */ 480 public function get_comments_sorted_by_weight( $html = false, $args = array()) {473 public function get_comments_sorted_by_weight( $html = false, ) { 481 474 482 475 // WP_Comment_Query arguments … … 603 596 604 597 $result = $this->is_vote_valid( $comment_id, $labels, $vote ); 605 if ( is_array( $result ) ) {598 if ( y( $result ) ) { 606 599 return $this->send_error( $result['error_code'], $result['error_msg'], $comment_id ); 607 600 } … … 646 639 647 640 /** 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 649 648 */ 650 649 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[ $ ] ); 652 651 if ( is_wp_error( $user_can_vote ) ) { 653 652 654 653 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' => $), 657 656 ); 658 657 } … … 670 669 } 671 670 672 return true;671 return ; 673 672 } 674 673 -
comment-popularity/trunk/inc/class-visitor.php
r1731502 r1817209 3 3 /** 4 4 * Class HMN_CP_Visitor 5 5 6 * @package CommentPopularity 6 7 */ 7 8 /** 8 9 * Class HMN_CP_Visitor 10 9 11 * @package CommentPopularity 10 12 */ 11 13 abstract class HMN_CP_Visitor { 12 14 15 16 17 18 19 13 20 protected $visitor_id; 14 21 … … 22 29 /** 23 30 * Creates a new HMN_CP_Visitor object. 31 32 24 33 */ 25 34 public function __construct( $visitor_id ) { 26 27 35 $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 = '' ); 39 45 40 46 /** … … 86 92 87 93 setcookie( 'hmn_cp_visitor', $this->visitor_id, $expiry, COOKIEPATH, COOKIE_DOMAIN, $secure ); 88 if ( SITECOOKIEPATH != COOKIEPATH ) {94 if ( SITECOOKIEPATH != COOKIEPATH ) { 89 95 setcookie( 'hmn_cp_visitor', $this->visitor_id, $expiry, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); 90 96 } … … 93 99 $_COOKIE['hmn_cp_visitor'] = $this->visitor_id; 94 100 95 $this->cookie = $_COOKIE['hmn_cp_visitor'];101 $this->cookie = ; 96 102 } 97 103 … … 116 122 $logged_votes = $this->retrieve_logged_votes(); 117 123 118 $logged_votes[ 'comment_id_' . $comment_id ]['vote_time'] = current_time( 'timestamp' );124 $logged_votes[ 'comment_id_' . $comment_id ]['vote_time'] = current_time( 'timestamp' ); 119 125 $logged_votes[ 'comment_id_' . $comment_id ]['last_action'] = $action; 120 126 … … 181 187 182 188 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' ); 185 191 $logged_votes[ $this->visitor_id ] = $votes; 186 192 update_blog_option( $blog_id, 'hmn_cp_guests_logged_votes', $logged_votes ); … … 194 200 * Determine if the guest visitor can vote. 195 201 * 196 * @param 202 * @param $comment_id 197 203 * @param string $action 198 204 * … … 210 216 /** 211 217 * Class HMN_CP_Visitor_Member 218 212 219 * @package CommentPopularity 213 220 */ … … 231 238 232 239 if ( $comment->user_id && ( $this->get_id() === (int) $comment->user_id ) ) { 240 233 241 return new \WP_Error( 'upvote_own_comment', sprintf( __( 'You cannot %s your own comments.', 'comment-popularity' ), $action ) ); 234 242 } … … 254 262 255 263 $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' ); 258 265 $comments_voted_on[ 'comment_id_' . $comment_id ]['last_action'] = $action; 259 266 -
comment-popularity/trunk/inc/helpers.php
r1090392 r1817209 31 31 $author_karma = $hmn_cp_obj->get_comment_author_karma( get_comment_author_email( get_comment_ID() ) ); 32 32 33 if ( isset( $author_karma )) {33 if ( ) { 34 34 echo '<small class="user-karma">(User Karma: ' . esc_html( $author_karma ) . ')</small>'; 35 35 } … … 44 44 * @param array $args 45 45 */ 46 function hmn_cp_the_sorted_comments( $args = array()) {46 function hmn_cp_the_sorted_comments( ) { 47 47 48 48 if ( class_exists( 'CommentPopularity\HMN_Comment_Popularity' ) ) { -
comment-popularity/trunk/inc/templates/comment.php
r1396469 r1817209 4 4 $GLOBALS['comment'] = $comment; 5 5 6 if ( 'pingback' == $comment->comment_type || 'trackback'== $comment->comment_type ) : ?>6 if ( 'pingback' ==== $comment->comment_type ) : ?> 7 7 8 8 <li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>> … … 18 18 <?php $hmn_cp_plugin = HMN_Comment_Popularity::get_instance(); $hmn_cp_plugin->render_ui( get_comment_ID() ); ?> 19 19 <?php // Avatar 20 if ( 0 != $args['avatar_size'] ) :20 if ( 0 != $args['avatar_size'] ) : 21 21 echo get_avatar( $comment, $args['avatar_size'] ); 22 22 endif; -
comment-popularity/trunk/inc/templates/comments.php
r976435 r1817209 61 61 <?php endif; ?> 62 62 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' ) ) : ?> 64 64 <p class="no-comments"> 65 <?php _e( 'Comments are closed.', 'comment-popularity' ); ?>65 <?php _e( 'Comments are closed.', 'comment-popularity' ); ?> 66 66 </p> 67 67 <?php endif; ?> -
comment-popularity/trunk/inc/widgets/class-widget-most-voted.php
r976435 r1817209 88 88 $output = ''; 89 89 90 $title = ( ! empty( $instance['title'] )) ? $instance['title'] : __( 'Most voted Comments', 'comment-popularity' );90 $title = ) ? $instance['title'] : __( 'Most voted Comments', 'comment-popularity' ); 91 91 92 92 /** This filter is documented in wp-includes/default-widgets.php */ 93 93 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 94 94 95 $number = ( ! empty( $instance['number'] )) ? absint( $instance['number'] ) : 5;95 $number = ) ? absint( $instance['number'] ) : 5; 96 96 if ( ! $number ) { 97 97 $number = 5; 98 98 } 99 99 100 100 $hmn_cp_plugin = HMN_Comment_Popularity::get_instance(); 101 101 $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 179 179 180 180 // Display the admin form 181 include ( plugin_dir_path( __FILE__ ). 'views/admin.php' );181 include . 'views/admin.php' ); 182 182 183 183 } // end form 184 184 185 protected function get_experts( $args = array() ) { 185 /** 186 * @param array $args 187 * 188 * @return mixed 189 */ 190 protected function get_experts() { 186 191 187 192 /* Get the experts list. */ 188 $args = array 193 $args = array( 189 194 'number' => '5', 190 195 '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 4 4 "description": "Adds comment upvoting.", 5 5 "main": "index.js", 6 "scripts": {7 "test": "echo \"Error: no test specified\" && exit 1"8 },9 6 "repository": { 10 7 "type": "git", … … 23 20 "homepage": "https://github.com/humanmade/comment-popularity", 24 21 "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", 37 28 "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 "" 42 33 } 43 34 } -
comment-popularity/trunk/tests/test-comment-popularity.php
r1728064 r1817209 26 26 $this->plugin = HMN_Comment_Popularity::get_instance(); 27 27 28 $this->plugin ->activate();28 $this->pluginactivate(); 29 29 30 30 $this->test_voter_id = $this->factory->user->create(
Note: See TracChangeset
for help on using the changeset viewer.