-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomment-limiter.php
More file actions
62 lines (49 loc) · 1.44 KB
/
Copy pathcomment-limiter.php
File metadata and controls
62 lines (49 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
<?php
/*
Plugin Name: Comment Limiter
Description: Limit the minimum and maximum number of characters allowed in post comments.
Version: 2.3.6
Author: Anass Rahou
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: comment-limiter
Domain Path: /languages
*/
defined( 'ABSPATH' ) || exit;
if( ! defined( 'CL_VERSION' ) ) {
define( 'CL_VERSION', '2.3.6' );
}
if ( ! defined( 'CL_PLUGIN_PATH' ) ) {
define( 'CL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
}
$files = [
'includes/class-comment-limiter-i18n.php',
'includes/class-comment-limiter-config.php',
'includes/class-comment-limiter-settings.php'
];
foreach ( $files as $file ) {
$path = CL_PLUGIN_PATH . $file;
if ( file_exists( $path ) ) {
require_once $path;
}
}
Comment_Limiter_i18n::factory();
Comment_Limiter_Config::factory();
Comment_Limiter_Settings::factory();
/**
* Add settings link to plugin actions
*
* @param array $plugin_actions
* @param string $plugin_file
* @since 1.0
* @return array
*/
function cl_filter_plugin_action_links( $plugin_actions ) {
$plugin_actions['cl_settings'] = sprintf(
'<a href="%s">%s</a>',
esc_url( admin_url( 'edit-comments.php?page=comment-limiter' ) ),
esc_html__( 'Settings', 'comment-limiter' )
);
return $plugin_actions;
}
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'cl_filter_plugin_action_links' );