These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | defined( 'ABSPATH' ) or die( 'This plugin must be run within the scope of WordPress.' ); |
||
3 | |||
4 | /* |
||
5 | * Plugin Name: EduAdmin Booking - SVEA Webpay-plugin |
||
6 | * Plugin URI: http://www.eduadmin.se |
||
7 | * Description: EduAdmin plugin to allow visitors to book courses at your website |
||
8 | * Tags: booking, participants, courses, events, eduadmin, lega online |
||
9 | * Version: 2.1.0 |
||
10 | * GitHub Plugin URI: multinetinteractive/eduadmin-wordpress-sveawebpay |
||
11 | * GitHub Plugin URI: https://github.com/multinetinteractive/eduadmin-wordpress-sveawebpay |
||
12 | * Requires at least: 5.0 |
||
13 | * Tested up to: 5.7 |
||
14 | * Author: Chris Gårdenberg, MultiNet Interactive AB |
||
15 | * Author URI: http://www.multinet.se |
||
16 | * License: GPL3 |
||
17 | * Text Domain: eduadmin-sveawebpay |
||
18 | * Domain Path: /languages/ |
||
19 | */ |
||
20 | /* |
||
21 | EduAdmin Booking plugin |
||
22 | Copyright (C) 2015-2021 Chris Gårdenberg, MultiNet Interactive AB |
||
23 | |||
24 | This program is free software: you can redistribute it and/or modify |
||
25 | it under the terms of the GNU General Public License as published by |
||
26 | the Free Software Foundation, either version 3 of the License, or |
||
27 | (at your option) any later version. |
||
28 | |||
29 | This program is distributed in the hope that it will be useful, |
||
30 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
32 | GNU General Public License for more details. |
||
33 | |||
34 | You should have received a copy of the GNU General Public License |
||
35 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
36 | */ |
||
37 | |||
38 | add_action( 'admin_init', 'checkForEduAdminPlugin' ); |
||
39 | View Code Duplication | function checkForEduAdminPlugin() { |
|
0 ignored issues
–
show
|
|||
40 | if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
||
41 | add_action( 'admin_notices', function () { |
||
42 | ?> |
||
43 | <div class="error"> |
||
44 | <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p> |
||
45 | </div><?php |
||
46 | } ); |
||
47 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
||
48 | |||
49 | if ( isset( $_GET['activate'] ) ) { |
||
50 | unset( $_GET['activate'] ); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 | |||
55 | View Code Duplication | if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ): |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
56 | |||
57 | final class EDU_SveaWebPay_Loader { |
||
58 | public function __construct() { |
||
59 | add_action( 'plugins_loaded', array( $this, 'init' ) ); |
||
60 | } |
||
61 | |||
62 | public function init() { |
||
63 | if ( class_exists( 'EDU_Integration' ) ) { |
||
64 | require_once( __DIR__ . '/vendor/autoload.php' ); // Load dependencies |
||
65 | require_once( __DIR__ . '/class/class-edu-sveawebpay.php' ); |
||
66 | |||
67 | add_filter( 'edu_integrations', array( $this, 'add_integration' ) ); |
||
68 | } |
||
69 | } |
||
70 | |||
71 | public function add_integration( $integrations ) { |
||
72 | $integrations[] = 'EDU_SveaWebPay'; |
||
73 | |||
74 | return $integrations; |
||
75 | } |
||
76 | } |
||
77 | |||
78 | $edu_sveawebpay_loader = new EDU_SveaWebPay_Loader( __FILE__ ); |
||
0 ignored issues
–
show
The call to
EDU_SveaWebPay_Loader::__construct() has too many arguments starting with __FILE__ .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the
Loading history...
|
|||
79 | endif; |
||
80 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.