Passed
Push — master ( 4cac9e...052e2f )
by Chris
02:15
created

eduadmin-wp-klarna-checkout.php (11 issues)

Labels
Severity
1
<?php
2
defined( 'ABSPATH' ) || die( 'This plugin must be run within the scope of WordPress.' );
3
4
/*
5
 * Plugin Name: EduAdmin Booking - Klarna Checkout-plugin
6
 * Plugin URI:  https://www.eduadmin.se
7
 * Description: Plugin to EduAdmin Booking to enable Klarna Checkout-integration
8
 * Version:     1.0.0
9
 * GitHub Plugin Uri: https://github.com/MultinetInteractive/eduadmin-wp-klarna-checkout
10
 * Requires at least: 3.0
11
 * Tested up to: 4.9
12
 * Author: Chris Gårdenberg, MultiNet Interactive AB
13
 * Author URI: https://www.multinet.com
14
 * License: GPL3
15
 * Text Domain: eduadmin-wp-klarna-checkout
16
 */
17
/*
18
	EduAdmin Booking plugin
19
	Copyright (C) 2015-2017 Chris Gårdenberg, MultiNet Interactive AB
20
	This program is free software: you can redistribute it and/or modify
21
	it under the terms of the GNU General Public License as published by
22
	the Free Software Foundation, either version 3 of the License, or
23
	(at your option) any later version.
24
	This program is distributed in the hope that it will be useful,
25
	but WITHOUT ANY WARRANTY; without even the implied warranty of
26
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
	GNU General Public License for more details.
28
	You should have received a copy of the GNU General Public License
29
	along with this program. If not, see <http://www.gnu.org/licenses/>.
30
 */
31
32
add_action( 'admin_init', function () {
0 ignored issues
show
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
/** @scrutinizer ignore-call */ 
33
add_action( 'admin_init', function () {
Loading history...
33
	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
0 ignored issues
show
The function current_user_can was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
	if ( is_admin() && /** @scrutinizer ignore-call */ current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
Loading history...
The function is_admin was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
	if ( /** @scrutinizer ignore-call */ is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
Loading history...
The function is_plugin_active was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
	if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! /** @scrutinizer ignore-call */ is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
Loading history...
34
		add_action( 'admin_notices', function () {
0 ignored issues
show
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
		/** @scrutinizer ignore-call */ 
35
  add_action( 'admin_notices', function () {
Loading history...
35
			?>
36
            <div class="error">
37
                <p><?php esc_html_e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-wp-klarna-checkout' ); ?></p>
0 ignored issues
show
The function esc_html_e was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
                <p><?php /** @scrutinizer ignore-call */ esc_html_e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-wp-klarna-checkout' ); ?></p>
Loading history...
38
            </div>
39
			<?php
40
		} );
41
		deactivate_plugins( plugin_basename( __FILE__ ) );
0 ignored issues
show
The function plugin_basename was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
		deactivate_plugins( /** @scrutinizer ignore-call */ plugin_basename( __FILE__ ) );
Loading history...
The function deactivate_plugins was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
		/** @scrutinizer ignore-call */ 
42
  deactivate_plugins( plugin_basename( __FILE__ ) );
Loading history...
42
		if ( isset( $_GET['activate'] ) ) {
43
			unset( $_GET['activate'] );
44
		}
45
	}
46
} );
47
48
if ( ! class_exists( 'EDU_KlarnaCheckout_Loader' ) ) {
49
	final class EDU_KlarnaCheckout_Loader {
50
		public function __construct() {
51
			add_action( 'plugins_loaded', array( $this, 'init' ) );
0 ignored issues
show
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
			/** @scrutinizer ignore-call */ 
52
   add_action( 'plugins_loaded', array( $this, 'init' ) );
Loading history...
52
		}
53
54
		public function init() {
55
			if ( class_exists( 'EDU_Integration' ) ) {
56
				require_once __DIR__ . '/class-edu-klarnacheckout.php';
57
58
				add_filter( 'edu_integrations', array( $this, 'add_integration' ) );
0 ignored issues
show
The function add_filter was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
				/** @scrutinizer ignore-call */ 
59
    add_filter( 'edu_integrations', array( $this, 'add_integration' ) );
Loading history...
59
			}
60
		}
61
62
		public function add_integration( $integrations ) {
63
			$integrations[] = 'EDU_KlarnaCheckout';
64
65
			return $integrations;
66
		}
67
	}
68
69
	$edu_klarnacheckout_loader = new EDU_KlarnaCheckout_Loader();
0 ignored issues
show
The type EDU_KlarnaCheckout_Loader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
70
}
71