Issues (206)

Plugin/Loader.php (15 issues)

1
<?php
2
namespace NirjharLo\Cgss;
3
4
if ( ! defined( 'ABSPATH' ) ) exit;
5
6
7
use \NirjharLo\Cgss\Lib\Script;
0 ignored issues
show
The type \NirjharLo\Cgss\Lib\Script 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...
8
9
use \NirjharLo\Cgss\Lib\Action\Scan;
0 ignored issues
show
The type \NirjharLo\Cgss\Lib\Action\Scan 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...
10
use \NirjharLo\Cgss\Lib\Action\Insight;
0 ignored issues
show
The type \NirjharLo\Cgss\Lib\Action\Insight 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...
11
12
use \NirjharLo\Cgss\Models\Insight as InsightModel;
0 ignored issues
show
The type \NirjharLo\Cgss\Models\Insight 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...
13
14
use \NirjharLo\Cgss\Src\Db;
0 ignored issues
show
The type \NirjharLo\Cgss\Src\Db 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...
15
use \NirjharLo\Cgss\Src\Install;
0 ignored issues
show
The type \NirjharLo\Cgss\Src\Install 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...
16
use \NirjharLo\Cgss\Src\Settings;
0 ignored issues
show
The type \NirjharLo\Cgss\Src\Settings 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...
17
18
19
final class Loader {
20
21
	/**
22
	 * Plugin Instance.
23
	 *
24
	 * @var PLUGIN_BUILD the PLUGIN Instance
0 ignored issues
show
The type NirjharLo\Cgss\PLUGIN_BUILD 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...
25
	 */
26
	protected static $instance;
27
28
29
	/**
30
	 * Main Plugin Instance.
31
	 *
32
	 * @return PLUGIN_BUILD
33
	 */
34
	public static function instance() {
35
36
		if ( is_null( self::$instance ) ) {
37
			self::$instance = new self();
38
			self::$instance->init();
39
		}
40
41
		return self::$instance;
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::instance also could return the type NirjharLo\Cgss\Loader which is incompatible with the documented return type NirjharLo\Cgss\PLUGIN_BUILD.
Loading history...
42
	}
43
44
	public function installation() {
45
46
			$install = new Install();
47
			$install->textDomin = 'cgss';
48
			$install->phpVerAllowed = '5.4';
49
			$install->pluginPageLinks = array(
50
											array(
51
												'slug' => home_url().'/wp-admin/admin.php?page=seo-scan',
0 ignored issues
show
The function home_url 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
												'slug' => /** @scrutinizer ignore-call */ home_url().'/wp-admin/admin.php?page=seo-scan',
Loading history...
52
												'label' => __( 'Dashboard', 'cgss' )
0 ignored issues
show
The function __ 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

52
												'label' => /** @scrutinizer ignore-call */ __( 'Dashboard', 'cgss' )
Loading history...
53
											),
54
										);
55
			$install->execute();
56
	}
57
58
59
	public function db_install() {
60
61
			$db = new Db();
62
			$db->table = 'cgss_insight';
63
			$db->sql = "ID mediumint(9) NOT NULL AUTO_INCREMENT,
64
						item varchar(256) NOT NULL,
65
						remark varchar(512) NOT NULL,
66
						UNIQUE KEY ID (ID)";
67
			$db->build();
68
69
			$insert_data = $this->insert_prelim_data();
70
	}
71
72
73
	public function db_uninstall() {
74
75
		$tableName = 'cgss_insight';
76
77
		global $wpdb;
78
		$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}$tableName" );
79
	}
80
81
82
        public function insert_prelim_data() {
83
84
                $model = new InsightModel();
85
86
                if ($model->count() === 0) {
87
88
                $init_insight = array(
89
                                __('Score','cgss'),
0 ignored issues
show
The function __ 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

89
                                /** @scrutinizer ignore-call */ 
90
                                __('Score','cgss'),
Loading history...
90
                                __('Snippet','cgss'),
91
                                __('Text','cgss'),
92
                                __('Links','cgss'),
93
                                __('Keywords','cgss'),
94
                                __('Images','cgss'),
95
                                __('Responsive','cgss'),
96
                                __('Speed','cgss'),
97
                                __('Social','cgss')
98
                        );
99
                $no_data = __( 'No scan reports are available yet', 'cgss' );
100
                foreach ($init_insight as $key => $value) {
101
                        $model->insert($value, $no_data, $key + 1);
102
                }
103
                }
104
        }
105
106
107
	//Include scripts
108
	public function scripts() {
109
110
		new Script();
111
	}
112
113
114
115
	//Include settings pages
116
	public function settings() {
117
118
		new Settings();
119
	}
120
121
122
123
	// Add custom insight action
124
	public function insight() {
125
126
		new Insight();
127
	}
128
129
130
131
	// Add custom insight action
132
	public function scan() {
133
134
		new Scan();
135
	}
136
137
138
	public function init() {
139
140
		register_activation_hook( CGSS_FILE, array( $this, 'db_install' ) );
0 ignored issues
show
The function register_activation_hook 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

140
		/** @scrutinizer ignore-call */ 
141
  register_activation_hook( CGSS_FILE, array( $this, 'db_install' ) );
Loading history...
141
		register_uninstall_hook( CGSS_FILE, array( 'BUILD', 'db_uninstall' ) ); //$this won't work here.
0 ignored issues
show
The function register_uninstall_hook 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

141
		/** @scrutinizer ignore-call */ 
142
  register_uninstall_hook( CGSS_FILE, array( 'BUILD', 'db_uninstall' ) ); //$this won't work here.
Loading history...
142
143
		add_action('init', array($this, 'installation'));
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

143
		/** @scrutinizer ignore-call */ 
144
  add_action('init', array($this, 'installation'));
Loading history...
144
145
		$this->scripts();
146
		$this->settings();
147
148
		// Add custom actions, defined in settings
149
		add_action( 'cgss_scan', array( $this, 'scan' ) );
150
		add_action( 'cgss_fetch_insight', array( $this, 'insight' ) );
151
	}
152
} ?>
153