Changeset 2185939
- Timestamp:
- 11/05/2019 06:30:24 AM (6 years ago)
- Location:
- comment-limiter/trunk
- Files:
-
- 6 edited
-
README.md (modified) (1 diff)
-
comment-limiter.php (modified) (3 diffs)
-
includes/class-comment-limiter-config.php (modified) (9 diffs)
-
includes/class-comment-limiter-deactivator.php (modified) (4 diffs)
-
includes/class-comment-limiter-settings.php (modified) (10 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
comment-limiter/trunk/README.md
r1645992 r2185939 23 23 ## Changelog 24 24 25 #### 1.3 26 * Minimum characters number by default changed 27 * Standarized code improved 28 * Spelling issue resolved 29 * GPL plugin version updated 30 31 #### 1.2 32 * New Update 33 34 #### 1.1 35 * Moved menu under top-level Comments dashboard menu 36 * Tested on WordPress 4.9 for compatibility 37 25 38 #### 1.0 26 39 * Plugin released -
comment-limiter/trunk/comment-limiter.php
r1762330 r2185939 3 3 Plugin Name: Comment Limiter 4 4 Description: A simple plugin that limit the maximum and minimum of characters allowed in a post comment 5 Version: 1. 25 Version: 1.3 6 6 Author: Anass Rahou 7 7 Author URI: https://wpbody.com/ 8 License: GPL 28 License: GPL v2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 Text Domain: comment-limiter … … 12 12 */ 13 13 14 if ( ! defined( 'ABSPATH' ) ) { 15 exit; 14 defined( 'ABSPATH' ) || exit; 15 16 if( ! defined( 'CL_VERSION' ) ) { 17 define( 'CL_VERSION', '1.3' ); 16 18 } 17 19 18 define( 'CL_VERSION', '1.2' ); 20 if ( ! defined( 'CL_PLUGIN_PATH' ) ) { 21 define( 'CL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); 22 } 19 23 20 require_once plugin_dir_path( __FILE__ ) . '/includes/class-comment-limiter-i18n.php';21 require_once plugin_dir_path( __FILE__ ) . '/includes/class-comment-limiter-config.php';22 require_once plugin_dir_path( __FILE__ ) . '/includes/class-comment-limiter-settings.php';23 require_once plugin_dir_path( __FILE__ ) . '/includes/class-comment-limiter-deactivator.php';24 require_once CL_PLUGIN_PATH . 'includes/class-comment-limiter-i18n.php'; 25 require_once CL_PLUGIN_PATH . 'includes/class-comment-limiter-config.php'; 26 require_once CL_PLUGIN_PATH . 'includes/class-comment-limiter-settings.php'; 27 require_once CL_PLUGIN_PATH . 'includes/class-comment-limiter-deactivator.php'; 24 28 25 29 … … 39 43 */ 40 44 function cl_filter_plugin_action_links( $plugin_actions, $plugin_file ) { 41 45 42 46 $new_actions = array(); 43 44 if ( basename( dirname( __FILE__ ) ) . '/comment-limiter.php' === $plugin_file ) {47 48 if ( basename( CL_PLUGIN_PATH ) . 'comment-limiter.php' === $plugin_file ) { 45 49 $new_actions['cl_settings'] = sprintf( __( '<a href="%s">Settings</a>', 'comment-limiter' ), esc_url( admin_url( 'options-general.php?page=comment-limiter' ) ) ); 46 50 } 47 51 48 52 return array_merge( $new_actions, $plugin_actions ); 49 53 } -
comment-limiter/trunk/includes/class-comment-limiter-config.php
r1762296 r2185939 3 3 * If accessed directly, then exit. 4 4 */ 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; 7 } 5 defined( 'ABSPATH' ) || exit; 6 8 7 9 8 /** … … 11 10 */ 12 11 if ( ! class_exists( 'Comment_Limiter_Config' ) ) { 13 12 14 13 /** 15 14 * Configuration class. … … 20 19 /** 21 20 * Property instance. 22 * 21 * 23 22 * @var object 24 23 */ … … 27 26 /** 28 27 * Handles default values. 29 * 28 * 30 29 * @var array 31 30 */ … … 42 41 ), 43 42 'minimum_characters' => array( 44 'default' => 320,43 'default' => 10, 45 44 ), 46 45 'enable_admin_feature' => array( … … 52 51 /** 53 52 * Return only default values. 54 * 53 * 55 54 * @return array default values 56 55 */ … … 58 57 59 58 $defaults = array(); 60 foreach ( $this->defaults as $key => $default) {61 $defaults[ $key ] = $default[ 'default'];59 foreach ( $this->defaults as $key => $default ) { 60 $defaults[ $key ] = $default[ 'default' ]; 62 61 } 63 62 … … 67 66 /** 68 67 * Parse default values. 69 * 68 * 70 69 * @return array default values parsed 71 70 */ … … 79 78 /** 80 79 * Instance class object. 81 * 80 * 82 81 * @return object 83 82 */ -
comment-limiter/trunk/includes/class-comment-limiter-deactivator.php
r1645992 r2185939 3 3 * If accessed directly, then exit 4 4 */ 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; 7 } 5 defined( 'ABSPATH' ) || exit; 8 6 9 7 /** … … 20 18 /** 21 19 * Property instance 22 * 20 * 23 21 * @var object 24 22 */ … … 57 55 /** 58 56 * Unregister setting method. 59 * 57 * 60 58 * @since 1.0 61 59 * @return void 62 60 */ 63 61 public function deactivate_comment_limiter() { 64 62 65 63 unregister_setting( 66 64 'comment_limiter_group', … … 76 74 */ 77 75 public static function factory() { 78 76 79 77 if ( ! self::$_instance ) { 80 78 self::$_instance = new self(); -
comment-limiter/trunk/includes/class-comment-limiter-settings.php
r1762296 r2185939 3 3 * If accessed directly, then exit 4 4 */ 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; 7 } 5 defined( 'ABSPATH' ) || exit; 6 8 7 9 8 /** … … 11 10 */ 12 11 if ( ! class_exists( 'Comment_Limiter' ) ) { 13 12 14 13 /** 15 14 * Class that holds Comment Limiter settings … … 19 18 /** 20 19 * Property instance 21 * 20 * 22 21 * @since 1.0 23 22 * @var object … … 40 39 */ 41 40 public $defaults = array(); 42 41 43 42 /** 44 43 * Constructor … … 126 125 </form> 127 126 </div> 128 <?php 127 <?php 129 128 } 130 129 … … 175 174 176 175 add_settings_field( 177 'enable_admin_feature', 178 __( 'Apply Settings to Admins', 'comment-limiter' ), 179 array( $this, 'comment_limiter_dropdown' ), 176 'enable_admin_feature', 177 __( 'Apply Settings to Admins', 'comment-limiter' ), 178 array( $this, 'comment_limiter_dropdown' ), 180 179 'comment-limiter-admin', 181 180 'comment_limiter_section' , … … 200 199 if ( $input['maximum_characters'] <= $input['minimum_characters'] ) { 201 200 add_settings_error( 'comment-limiter-messages', 'invalid-values', __( 'Invalid lengths. Please insert logical values.', 'comment-limiter' ) ); 202 201 203 202 return $output; 204 203 } 205 204 206 205 if ( isset( $input['maximum_characters'] ) ) { 207 206 $output['maximum_characters'] = sanitize_text_field( absint( $input['maximum_characters'] ) ); … … 288 287 <input type="number" name="comment_limiter_settings[maximum_characters]" id="maximum_characters" class="regular-text" value="<?php esc_html_e( $config['maximum_characters'], 'comment-limiter' ); ?>" /> 289 288 <span class="description"><?php esc_html_e( 'Accepts only numbers', 'comment-limiter' ); ?></span> 290 <p class="description"><?php esc_html_e( 'If the user inserts a comment that is fewer than the number selected above, then, itwill receives an advice message to extend his comment.', 'comment-limiter' ); ?></p>289 <p class="description"><?php esc_html_e( 'If the user inserts a comment that is lower than the number selected above, then, he will receives an advice message to extend his comment.', 'comment-limiter' ); ?></p> 291 290 <?php 292 291 } … … 299 298 */ 300 299 public function minimum_characters_callback() { 301 300 302 301 $config = Comment_Limiter_Config::factory()->get(); 303 302 … … 305 304 <input type="number" name="comment_limiter_settings[minimum_characters]" id="minimum_characters" class="regular-text" value="<?php esc_html_e( $config['minimum_characters'], 'comment-limiter' ); ?>" /> 306 305 <span class="description"><?php esc_html_e( 'Accepts only numbers', 'comment-limiter' ); ?></span> 307 <p class="description"><?php esc_html_e( 'If the user inserts a comment that is larger than the number selected above, then, it will receives an advice message to minimize his comment.', 'comment-limiter' ); ?></p>306 <p class="description"><?php esc_html_e( 'If the user inserts a comment that is greater than the number selected above, then, he will receives an advice message to abbreviate his comment.', 'comment-limiter' ); ?></p> 308 307 <?php 309 308 } -
comment-limiter/trunk/readme.txt
r1762330 r2185939 3 3 Tags: comment, length, limit, maximum, comment length, minimum comment, comment characters 4 4 Requires at least: 4.0 5 Tested up to: 4.96 Stable tag: 1. 25 Tested up to: 5.2.4 6 Stable tag: 1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 32 32 == Changelog == 33 33 34 = 1.3 = 35 * Standarized code improved 36 * Spelling issue resolved 37 * GPL plugin version updated 38 34 39 = 1.2 = 35 40 * New Update
Note: See TracChangeset
for help on using the changeset viewer.