Skip to content

Commit 25df385

Browse files
committed
OOPs implementation
1 parent c338685 commit 25df385

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+5767
-3419
lines changed

README.md

Lines changed: 84 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,84 @@
1-
# Auto-Close Comments, Pingbacks and Trackbacks
2-
3-
![Auto-Close](https://raw.githubusercontent.com/WebberZone/autoclose/master/wporg-assets/banner-1544x500.png)
4-
5-
[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/autoclose.svg?style=flat-square)](https://wordpress.org/plugins/autoclose/)
6-
[![License](https://img.shields.io/badge/license-GPL_v2%2B-orange.svg?style=flat-square)](https://opensource.org/licenses/GPL-2.0)
7-
[![WordPress Tested](https://img.shields.io/wordpress/v/autoclose.svg?style=flat-square)](https://wordpress.org/plugins/autoclose/)
8-
[![Required PHP](https://img.shields.io/wordpress/plugin/required-php/autoclose?style=flat-square)](https://wordpress.org/plugins/autoclose/)
9-
[![Active installs](https://img.shields.io/wordpress/plugin/installs/autoclose?style=flat-square)](https://wordpress.org/plugins/autoclose/)
10-
11-
__Requires:__ 5.6
12-
13-
__Tested up to:__ 6.0
14-
15-
__License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
16-
17-
__Plugin page:__ [Auto-Close Comments, Pingbacks and Trackbacks](https://webberzone.com/plugins/autoclose/) | [WordPress.org plugin page](https://wordpress.org/plugins/autoclose/)
18-
19-
Close comments, pingbacks and trackbacks on your WordPress posts automatically at intervals set by you
20-
21-
## Description
22-
23-
Spammers target old posts in a hope that you won't notice the comments on them. Why not stop them in their tracks by just shutting off comments and pingbacks? [Auto-Close Comments, Pingbacks and Trackbacks](https://webberzone.com/plugins/autoclose/) let's you automatically close comments, pingbacks and trackbacks on your posts, pages and custom post types.
24-
25-
You can also choose to keep comments / pingbacks / trackbacks open on certain posts, page or custom post types. Just enter a comma-separated list of post IDs in the Settings page.
26-
27-
An extra feature is the ability delete post revisions or limit their number.
28-
29-
### Key features
30-
31-
* Close (or open) comments on posts, pages, attachments and even Custom Post Types!
32-
* Close (or open) pingbacks and trackbacks as well across all post types. You can also choose to delete them
33-
* Schedule a cron job to automatically close comments, pingbacks and trackbacks daily
34-
* Delete all post revisions or limit the number of revisions by post type
35-
36-
## Screenshots
37-
38-
![General Options](https://raw.github.com/ajaydsouza/autoclose/master/wporg-assets/screenshot-1.png)
39-
_Auto-Close Comments, Pingbacks and Trackbacks - General Options_
40-
41-
For more screenshots visit the [WordPress plugin page](https://wordpress.org/plugins/autoclose/screenshots/).
42-
43-
## Installation
44-
45-
### WordPress install
46-
47-
1. Navigate to Plugins within your WordPress Admin Area
48-
49-
2. Click "Add new" and in the search box enter "autoclose"
50-
51-
3. Find the plugin in the list (usually the first result) and click "Install Now"
52-
53-
### Manual install
54-
55-
1. Download the plugin
56-
57-
2. Extract the contents of autoclose.zip to wp-content/plugins/ folder. You should get a folder called autoclose
58-
59-
3. Activate the Plugin in WP-Admin
60-
61-
4. Goto __Settings » Auto-Close__ to configure
62-
63-
## Frequently Asked Questions
64-
65-
Check out the [FAQ on the plugin page](https://wordpress.org/plugins/autoclose/faq/).
66-
67-
If your question isn't listed there, please create a new post at the [WordPress.org support forum](https://wordpress.org/support/plugin/autoclose). It is the fastest way to get support as I monitor the forums regularly. I also provide [premium _paid_ support via email](https://webberzone.com/support/).
68-
69-
## About this repository
70-
71-
This GitHub repository always holds the latest development version of the plugin. If you're looking for an official WordPress release, you can find this on the [WordPress.org repository](https://wordpress.org/plugins/autoclose). In addition to stable releases, latest beta versions are made available under [releases](https://github.com/ajaydsouza/autoclose/releases).
1+
# Auto-Close Comments, Pingbacks and Trackbacks
2+
3+
![Auto-Close](https://raw.githubusercontent.com/WebberZone/autoclose/master/wporg-assets/banner-1544x500.png)
4+
5+
[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/autoclose.svg?style=flat-square)](https://wordpress.org/plugins/autoclose/) [![License](https://img.shields.io/badge/license-GPL_v2%2B-orange.svg?style=flat-square)](https://opensource.org/licenses/GPL-2.0) [![WordPress Tested](https://img.shields.io/wordpress/v/autoclose.svg?style=flat-square)](https://wordpress.org/plugins/autoclose/) [![Required PHP](https://img.shields.io/wordpress/plugin/required-php/autoclose?style=flat-square)](https://wordpress.org/plugins/autoclose/) [![Active installs](https://img.shields.io/wordpress/plugin/installs/autoclose?style=flat-square)](https://wordpress.org/plugins/autoclose/)
6+
7+
_Requires:_ 6.3
8+
_Tested up to:_ 6.8
9+
_License:_ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
10+
_Plugin page:_ [Auto-Close Comments, Pingbacks and Trackbacks](https://webberzone.com/plugins/autoclose/) | [WordPress.org plugin page](https://wordpress.org/plugins/autoclose/)
11+
12+
---
13+
14+
## Table of Contents
15+
16+
- [Overview](#overview)
17+
- [Features](#features)
18+
- [Contributing](#contributing)
19+
- [For Users](#for-users)
20+
- [Screenshots](#screenshots)
21+
- [Changelog](#changelog)
22+
- [License](#license)
23+
24+
---
25+
26+
## Overview
27+
28+
_Auto-Close_ is a WordPress plugin that _automatically closes comments, pingbacks, and trackbacks_ on posts, pages, and custom post types after a configurable period. It helps reduce spam and lets you manage post revisions easily.
29+
30+
- _OOP & Namespaced:_ All code under `WebberZone\AutoClose`, following WordPress PHP coding standards.
31+
- _Extensible:_ Modular structure for easy maintenance and extension.
32+
- _WP Cron:_ Schedules automatic closing based on user-defined intervals.
33+
34+
---
35+
36+
## Features
37+
38+
- _Automatically close_ comments, pingbacks, and trackbacks on posts, pages, and custom post types
39+
- _Open or close_ comments/pingbacks/trackbacks selectively by post ID
40+
- _Schedule_ automatic closing using WordPress cron
41+
- _Delete or limit_ post revisions by type
42+
- _Manual tools_ for opening/closing and deleting
43+
- _Admin interface_ with settings and tools tabs
44+
- _Extensible, OOP, and namespaced_ codebase
45+
46+
---
47+
48+
## Contributing
49+
50+
We welcome contributions! Please:
51+
52+
- Fork the repository and create your branch from `main`.
53+
- Follow the code style and structure above.
54+
- Open issues for bugs, feature requests, or questions.
55+
- See [CONTRIBUTING.md](CONTRIBUTING.md) if available.
56+
57+
---
58+
59+
## For Users
60+
61+
See [readme.txt](./readme.txt) or the [WordPress.org plugin page](https://wordpress.org/plugins/autoclose/) for installation, features, screenshots, and FAQ. This `README.md` is intended for developers and contributors.
62+
63+
---
64+
65+
## Screenshots
66+
67+
![General Options](https://raw.github.com/ajaydsouza/autoclose/master/wporg-assets/screenshot-1.png)
68+
> Auto-Close Comments, Pingbacks and Trackbacks - General Options
69+
70+
More screenshots: [WordPress plugin page](https://wordpress.org/plugins/autoclose/screenshots/)
71+
72+
---
73+
74+
## Changelog
75+
76+
See [releases](https://github.com/WebberZone/autoclose/releases) for the latest changes and beta versions.
77+
78+
---
79+
80+
## License
81+
82+
GPL v2 or later.
83+
84+
---

autoclose.php

Lines changed: 23 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,31 @@
44
*
55
* Automatically close Comments, Pingbacks and Trackbacks. Manage and delete revisions.
66
*
7-
* @package AutoClose
8-
* @author Ajay D'Souza
9-
* @license GPL-2.0+
10-
* @link https://webberzone.com/
11-
* @copyright 2008-2022 Ajay D'Souza
7+
* @package AutoClose
8+
* @author Ajay D'Souza
9+
* @license GPL-2.0+
10+
* @link https://webberzone.com
11+
* @copyright 2008-2025 Ajay D'Souza
1212
*
1313
* @wordpress-plugin
1414
* Plugin Name: Auto-Close Comments, Pingbacks and Trackbacks
1515
* Plugin URI: https://webberzone.com/plugins/autoclose/
1616
* Description: Automatically close Comments, Pingbacks and Trackbacks. Manage and delete revisions.
17-
* Version: 2.3.0-beta1
17+
* Version: 3.0.0-beta1
1818
* Author: Ajay D'Souza
19-
* Author URI: https://webberzone.com/
19+
* Author URI: https://webberzone.com
2020
* Text Domain: autoclose
2121
* License: GPL-2.0+
2222
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
2323
* Domain Path: /languages
24-
* GitHub Plugin URI: https://github.com/ajaydsouza/autoclose/
24+
* GitHub Plugin URI: https://github.com/WebberZone/autoclose/
2525
*/
2626

27-
// If this file is called directly, then abort execution.
27+
// If this file is called directly, abort.
2828
if ( ! defined( 'WPINC' ) ) {
2929
die( "Aren't you supposed to come here via WP-Admin?" );
3030
}
3131

32-
3332
/**
3433
* Holds the AutoClose plugin version
3534
*
@@ -38,7 +37,7 @@
3837
* @var string Plugin version
3938
*/
4039
if ( ! defined( 'ACC_PLUGIN_VERSION' ) ) {
41-
define( 'ACC_PLUGIN_VERSION', '2.3.0-beta1' );
40+
define( 'ACC_PLUGIN_VERSION', '3.0.0' );
4241
}
4342

4443
/**
@@ -74,84 +73,23 @@
7473
define( 'ACC_PLUGIN_FILE', __FILE__ );
7574
}
7675

77-
/*
78-
*---------------------------------------------------------------------------*
79-
* AutoClose modules
80-
*---------------------------------------------------------------------------*
81-
*/
82-
83-
require_once ACC_PLUGIN_DIR . 'includes/admin/class-settings-api.php';
84-
require_once ACC_PLUGIN_DIR . 'includes/admin/class-autoclose-settings.php';
85-
require_once ACC_PLUGIN_DIR . 'includes/admin/options-api.php';
86-
require_once ACC_PLUGIN_DIR . 'includes/activation.php';
87-
require_once ACC_PLUGIN_DIR . 'includes/main.php';
88-
require_once ACC_PLUGIN_DIR . 'includes/comments.php';
89-
require_once ACC_PLUGIN_DIR . 'includes/revisions.php';
90-
require_once ACC_PLUGIN_DIR . 'includes/cron.php';
91-
require_once ACC_PLUGIN_DIR . 'includes/l10n.php';
92-
require_once ACC_PLUGIN_DIR . 'includes/helpers.php';
93-
94-
95-
/*
96-
*---------------------------------------------------------------------------*
97-
* Dashboard and Administrative Functionality
98-
*---------------------------------------------------------------------------*
99-
*/
100-
101-
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
102-
103-
require_once ACC_PLUGIN_DIR . 'includes/admin/tools-page.php';
104-
105-
}
106-
107-
/*
108-
*---------------------------------------------------------------------------*
109-
* Deprecated functions
110-
*---------------------------------------------------------------------------*
111-
*/
76+
// Include the autoloader.
77+
require_once ACC_PLUGIN_DIR . 'includes/class-autoloader.php';
11278

113-
require_once ACC_PLUGIN_DIR . 'includes/deprecated.php';
79+
// Backward compatibility - Include functions for backward compatibility.
80+
require_once ACC_PLUGIN_DIR . 'includes/backward-compatibility.php';
11481

82+
// Activation and deactivation hooks.
83+
register_activation_hook( __FILE__, array( 'WebberZone\\AutoClose\\AutoClose', 'activate' ) );
84+
register_deactivation_hook( __FILE__, array( 'WebberZone\\AutoClose\\AutoClose', 'deactivate' ) );
11585

11686
/**
117-
* Get Settings.
118-
*
119-
* Retrieves all plugin settings
87+
* Initialize the plugin.
12088
*
121-
* @since 2.0.0
122-
* @return array AutoClose settings
123-
*/
124-
function acc_get_settings() {
125-
126-
$settings = get_option( 'acc_settings' );
127-
128-
/**
129-
* Settings array
130-
*
131-
* Retrieves all plugin settings
132-
*
133-
* @since 2.0.0
134-
* @param array $settings Settings array
135-
*/
136-
return apply_filters( 'acc_get_settings', $settings );
137-
}
138-
139-
/**
140-
* Global variable holding the current settings for AutoClose
141-
*
142-
* @since 2.0.0
143-
*
144-
* @var array
145-
*/
146-
global $acc_settings;
147-
$acc_settings = acc_get_settings();
148-
149-
/**
150-
* Register settings function
151-
*
152-
* @since 2.0.0
89+
* @since 3.0.0
15390
*/
154-
function acc_register_settings() {
155-
AutoClose_Settings::get_instance();
91+
function acc_init() {
92+
$autoclose = WebberZone\AutoClose\AutoClose::get_instance();
93+
$autoclose->run();
15694
}
157-
add_action( 'admin_menu', 'acc_register_settings', 999 );
95+
add_action( 'plugins_loaded', 'acc_init' );

changelog.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
This file contains the old changelog entries. You can always find the latest entries in the readme.txt
22

3+
= 2.2.0 =
4+
Release post: https://webberzone.com/blog/auto-close-v2-2-0/
5+
6+
* Enhancements:
7+
* The comment count for the post will be updated when deleting Pingbacks/Trackbacks
8+
* Settings page now uses the latest version of the WebberZone Settings_API class
9+
10+
= 2.1.0 =
11+
Release post: https://webberzone.com/blog/auto-close-v2-1-0/
12+
13+
* Features:
14+
* New revisions tab with settings to control the number of revisions by post type
15+
* New button in Tools page to delete all revisions
16+
17+
= 2.0.0 =
18+
* Features:
19+
* New Tools page with several buttons to open, close and delete comments, pingbacks and trackbacks. You can find the link in the Settings page under the main header
20+
* New button to delete all pingbacks and trackbacks in the Tools page
21+
* Activating the plugin on Multisite should upgrade settings from v1.x
22+
* Uninstalling the plugin on Multisite will delete the settings from all sites
23+
* Enhancements:
24+
* Migrated options to the Settings API
25+
* Modifications:
26+
* Main plugin file has been renamed to autoclose.php
27+
* Cron hook renamed from `ald_acc_hook` to `acc_cron_hook`
28+
329
= 1.6 =
430
* Fixed: Bug where comments on attachments did not get closed
531
* Fixed: JavaScript bug when saving options in Admin area

includes/activation.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)