Completed
Push — master ( f30c53...683bf9 )
by Dan
04:58
created

printcenter.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 30 and the first side effect is on line 18.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Plugin Name:     PrintCenter
4
 * Plugin URI:      http://customerprintcenter.com
5
 * Description:     Provides the server components for the Customer Print Center aspect of Grow Thrive Print
6
 * Version:         0.0.1
7
 * Author:          Daniel J Griffiths
8
 * Author URI:      http://section214.com
9
 * Text Domain:     printcenter
10
 *
11
 * @package         PrintCenter
12
 * @author          Daniel J Griffiths <[email protected]>
13
 */
14
15
16
// Exit if accessed directly
17
if( ! defined( 'ABSPATH' ) ) {
18
	exit;
19
}
20
21
22
if( ! class_exists( 'PrintCenter' ) ) {
23
24
25
	/**
26
	 * Main PrintCenter class
27
	 *
28
	 * @since       1.0.0
29
	 */
30
	class PrintCenter {
31
32
33
		/**
34
		 * @access      private
35
		 * @since       1.0.0
36
		 * @var         PrintCenter $instance The one true PrintCenter
37
		 */
38
		private static $instance;
39
40
41
		/**
42
		 * @access      public
43
		 * @since       1.0.0
44
		 * @var         object $loader The PrintCenter loader object
45
		 */
46
		public $loader;
47
48
49
		/**
50
		 * Get active instance
51
		 *
52
		 * @access      public
53
		 * @since       1.0.0
54
		 * @return      self::$instance The one true PrintCenter
0 ignored issues
show
The doc-type self::$instance could not be parsed: Unknown type name "self::$instance" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
55
		 */
56 1
		public static function instance() {
57 1
			if( ! isset( self::$instance ) && ! ( self::$instance instanceof PrintCenter ) ) {
58
				self::$instance = new PrintCenter();
59
60
				// Bootstrap the plugin
61
				if( ! class_exists( 'PrintCenter_Loader' ) ) {
62
					require_once 'includes/class.loader.php';
63
				}
64
				self::$instance->loader = new PrintCenter_Loader( __FILE__ );
65
            }
66
67 1
			return self::$instance;
68
		}
69
	}
70
}
71
72
73
/**
74
 * The main function responsible for returning the one true PrintCenter
75
 * instance to functions everywhere
76
 *
77
 * @since       1.0.0
78
 * @return      PrintCenter The one true PrintCenter
79
 */
80
function PrintCenter() {
81 1
	return PrintCenter::instance();
82
}
83
add_action( 'plugins_loaded', 'printcenter', 9 );