Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated folder structure #52

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/CF7_AntiSpam_Admin_Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use CF7_AntiSpam\Core\CF7_AntiSpam;
use CF7_AntiSpam\Core\CF7_AntiSpam_Filters;
use CF7_AntiSpam\Core\CF7_AntiSpam_Flamingo;
use CF7_AntiSpam\Core\CF7_AntiSpam_Uninstaller;
use CF7_AntiSpam\Engine\CF7_AntiSpam_Uninstaller;

/**
* The plugin admin tools
Expand Down
19 changes: 6 additions & 13 deletions cf7-antispam.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
*/

/* If this file is called directly, abort. */

use CF7_AntiSpam\Core\CF7_AntiSpam;
use CF7_AntiSpam\Core\CF7_AntiSpam_Activator;
use CF7_AntiSpam\Core\CF7_AntiSpam_Deactivator;
use CF7_AntiSpam\Core\CF7_AntiSpam_Uninstaller;

if ( ! defined( 'WPINC' ) ) {
die;
}
Expand Down Expand Up @@ -74,7 +68,7 @@
* The code that runs during plugin activation.
*/
function activate_cf7_antispam( $network_wide ) {
CF7_AntiSpam_Activator::on_activate( $network_wide );
\CF7_AntiSpam\Engine\CF7_AntiSpam_Activator::on_activate( $network_wide );
}
register_activation_hook( CF7ANTISPAM_PLUGIN, 'activate_cf7_antispam' );

Expand All @@ -88,7 +82,7 @@ function activate_cf7_antispam( $network_wide ) {
function on_create_blog( $blog_id ) {
if ( is_plugin_active_for_network( 'cf7-antispam/cf7-antispam.php' ) ) {
switch_to_blog( $blog_id );
CF7_AntiSpam_Activator::activate();
\CF7_AntiSpam\Engine\CF7_AntiSpam_Activator::activate();
restore_current_blog();
}
}
Expand All @@ -113,15 +107,15 @@ function on_delete_blog( $tables ) {
* The code that runs during plugin deactivation.
*/
function deactivate_cf7_antispam() {
CF7_AntiSpam_Deactivator::deactivate();
\CF7_AntiSpam\Engine\CF7_AntiSpam_Deactivator::deactivate();
}
register_deactivation_hook( CF7ANTISPAM_PLUGIN, 'deactivate_cf7_antispam' );

/**
* The code that runs during plugin un-installation.
*/
function uninstall_cf7_antispam() {
CF7_AntiSpam_Uninstaller::uninstall();
\CF7_AntiSpam\Engine\CF7_AntiSpam_Uninstaller::uninstall();
}
register_uninstall_hook( CF7ANTISPAM_PLUGIN, 'uninstall_cf7_antispam' );

Expand All @@ -132,11 +126,10 @@ function uninstall_cf7_antispam() {
*/

function cf7_antispam_register_service() {
require_once CF7ANTISPAM_PLUGIN_DIR . '/core/WPCF7_Service.php';
$integration = WPCF7_Integration::get_instance();
$integration->add_service(
'cf7-antispam',
\CF7_AntiSpam\Core\WPCF7_Antispam::get_instance()
\CF7_AntiSpam\Core\CF7_Antispam_Service::get_instance()
);

}
Expand All @@ -146,7 +139,7 @@ function cf7_antispam_register_service() {
function run_cf7a() {
$enabled = get_option( 'cf7a_options' );
if ( $enabled && ! empty( $enabled['cf7a_enable'] ) ) {
$cf7a = new CF7_AntiSpam();
$cf7a = new \CF7_AntiSpam\Core\CF7_AntiSpam();
$cf7a->run();
}
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"autoload": {
"psr-4": {
"CF7_AntiSpam\\Core\\": "core/",
"CF7_AntiSpam\\Engine\\": "engine/",
"CF7_AntiSpam\\Admin\\": "admin/"
}
},
Expand Down
41 changes: 1 addition & 40 deletions core/CF7_AntiSpam.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@

use CF7_AntiSpam\Admin\CF7_AntiSpam_Admin_Core;
use CF7_AntiSpam\Admin\CF7_AntiSpam_Admin_Tools;
use CF7_AntiSpam\Engine\CF7_AntiSpam_Activator;

use CF7_AntiSpam\Core\CF7_AntiSpam_i18n;
use CF7_AntiSpam\Core\CF7_AntiSpam_Loader;
use CF7_AntiSpam\Core\CF7_AntiSpam_Flamingo;
use CF7_AntiSpam\Core\CF7_AntiSpam_Frontend;
/**
* It sets the version, plugin name, and options. It loads
* the dependencies, sets the locale, updates the plugin, and loads the admin and frontend areas
Expand Down Expand Up @@ -136,42 +133,6 @@ protected function update() {
* It loads the plugin's dependencies
*/
private function load_dependencies() {

// **
// * The class responsible for orchestrating the actions and filters of the
// * core plugin.
// */
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-loader.php';
//
// **
// * The class responsible for defining internationalization functionality
// * of the plugin.
// */
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-i18n.php';
//
// **
// * The class responsible for defining frontend functionality
// * of the plugin.
// */
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-frontend.php';
//
// **
// * The classes responsible for defining antispam functionality and the related filters
// * of the plugin.
// */
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-antispam-filters.php';
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-antispam-geoip.php';
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-antispam-flamingo.php';
// require_once CF7ANTISPAM_PLUGIN_DIR . '/includes/cf7a-antispam-b8.php';
//
// **
// * The classes responsible for defining admin backend functionality
// */
// require_once CF7ANTISPAM_PLUGIN_DIR . '/admin/admin-customizations.php';
// require_once CF7ANTISPAM_PLUGIN_DIR . '/admin/admin-display.php';
// require_once CF7ANTISPAM_PLUGIN_DIR . '/admin/admin-tools.php';
// require_once CF7ANTISPAM_PLUGIN_DIR . '/admin/admin.php';

$this->loader = new CF7_AntiSpam_Loader();
}

Expand Down
1 change: 0 additions & 1 deletion core/CF7_AntiSpam_Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Exception;
use WPCF7_Submission;
use CF7_AntiSpam\Core\CF7_Antispam_Geoip;

/**
* A class that is used to filter out spam.
Expand Down
4 changes: 3 additions & 1 deletion core/WPCF7_Service.php → core/CF7_Antispam_Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ functionality. */
* This Extension represents the skeleton of the integration API
*/

class WPCF7_Antispam extends GlobalWPCF7_Service {
class CF7_Antispam_Service extends GlobalWPCF7_Service {


private static $instance;
Expand Down Expand Up @@ -114,6 +114,7 @@ public function icon() {
'overflow' => true,
),
'path' => array(
'stroke-width' => true,
'fill' => true,
'd' => true,
),
Expand All @@ -123,6 +124,7 @@ public function icon() {
'rx' => true,
'ry' => true,
'fill' => true,
'stroke-width' => true,
),
'g' => array(
'stroke' => true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace CF7_AntiSpam\Core;
namespace CF7_AntiSpam\Engine;

/**
* Fired during plugin activation.
Expand All @@ -12,7 +12,9 @@
* @subpackage CF7_AntiSpam/includes
* @author Codekraft Studio <[email protected]>
*/

use CF7_AntiSpam\Admin\CF7_AntiSpam_Admin_Tools;

/**
* It's a class that activates the plugin.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace CF7_AntiSpam\Core;
namespace CF7_AntiSpam\Engine;

/**
* Fired during deactivation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace CF7_AntiSpam\Core;
namespace CF7_AntiSpam\Engine;

/**
* Fired during Uninstall.
Expand Down Expand Up @@ -33,7 +33,7 @@ public static function cf7a_clean_blacklist() {
* It uninstalls the plugin, then reinstall it
*/
public static function cf7a_full_reset() {

self::uninstall( false );
CF7_AntiSpam_Activator::install();

Expand Down
Loading