Completed
Push — master ( b33229...9c0c61 )
by Sébastien
02:44
created
wc-satt-stt.php 2 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -20,152 +20,152 @@
 block discarded – undo
20 20
 if ( ! defined('ABSPATH') ) exit; // Exit if accessed directly.
21 21
 
22 22
 if ( ! class_exists( 'WCSATT_STT' ) ) {
23
-	class WCSATT_STT {
24
-
25
-		/* Plugin version. */
26
-		const VERSION = '1.0.0';
27
-
28
-		/* Required WC version. */
29
-		const REQ_WC_VERSION = '2.3.0';
30
-
31
-		/* Required WCSATT version */
32
-		const REQ_WCSATT_VERSION = '1.1.0';
33
-
34
-		/* Text domain. */
35
-		const TEXT_DOMAIN = 'wc-satt-stt';
36
-
37
-		/**
38
-		 * @var WCSATT_STT - the single instance of the class.
39
-		 *
40
-		 * @since 1.0.0
41
-		 */
42
-		protected static $_instance = null;
43
-
44
-		/**
45
-		 * Main WCSATT_STT Instance.
46
-		 *
47
-		 * Ensures only one instance of WCSATT_STT is loaded or can be loaded.
48
-		 *
49
-		 * @static
50
-		 * @see WCSATT_STT()
51
-		 * @return WCSATT_STT - Main instance
52
-		 * @since 1.0.0
53
-		 */
54
-		public static function instance() {
55
-			if ( is_null( self::$_instance ) ) {
56
-				self::$_instance = new self();
57
-			}
58
-			return self::$_instance;
59
-		}
60
-
61
-		/**
62
-		 * Cloning is forbidden.
63
-		 *
64
-		 * @since 1.0.0
65
-		 */
66
-		public function __clone() {
67
-			_doing_it_wrong( __FUNCTION__, __( 'Foul!' ), '1.0.0' );
68
-		}
69
-
70
-		/**
71
-		 * Unserializing instances of this class is forbidden.
72
-		 *
73
-		 * @since 1.0.0
74
-		 */
75
-		public function __wakeup() {
76
-			_doing_it_wrong( __FUNCTION__, __( 'Foul!' ), '1.0.0' );
77
-		}
78
-
79
-		/**
80
-		 * Load the plugin.
81
-		 */
82
-		public function __construct() {
83
-			add_action( 'plugins_loaded', array( $this, 'load_plugin' ) );
84
-			add_action( 'init', array( $this, 'init_plugin' ) );
85
-			add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_links' ), 10, 4 );
86
-		}
87
-
88
-		public function plugin_path() {
89
-			return untrailingslashit( plugin_dir_path( __FILE__ ) );
90
-		} // END plugin_path()
91
-
92
-		/*
23
+    class WCSATT_STT {
24
+
25
+        /* Plugin version. */
26
+        const VERSION = '1.0.0';
27
+
28
+        /* Required WC version. */
29
+        const REQ_WC_VERSION = '2.3.0';
30
+
31
+        /* Required WCSATT version */
32
+        const REQ_WCSATT_VERSION = '1.1.0';
33
+
34
+        /* Text domain. */
35
+        const TEXT_DOMAIN = 'wc-satt-stt';
36
+
37
+        /**
38
+         * @var WCSATT_STT - the single instance of the class.
39
+         *
40
+         * @since 1.0.0
41
+         */
42
+        protected static $_instance = null;
43
+
44
+        /**
45
+         * Main WCSATT_STT Instance.
46
+         *
47
+         * Ensures only one instance of WCSATT_STT is loaded or can be loaded.
48
+         *
49
+         * @static
50
+         * @see WCSATT_STT()
51
+         * @return WCSATT_STT - Main instance
52
+         * @since 1.0.0
53
+         */
54
+        public static function instance() {
55
+            if ( is_null( self::$_instance ) ) {
56
+                self::$_instance = new self();
57
+            }
58
+            return self::$_instance;
59
+        }
60
+
61
+        /**
62
+         * Cloning is forbidden.
63
+         *
64
+         * @since 1.0.0
65
+         */
66
+        public function __clone() {
67
+            _doing_it_wrong( __FUNCTION__, __( 'Foul!' ), '1.0.0' );
68
+        }
69
+
70
+        /**
71
+         * Unserializing instances of this class is forbidden.
72
+         *
73
+         * @since 1.0.0
74
+         */
75
+        public function __wakeup() {
76
+            _doing_it_wrong( __FUNCTION__, __( 'Foul!' ), '1.0.0' );
77
+        }
78
+
79
+        /**
80
+         * Load the plugin.
81
+         */
82
+        public function __construct() {
83
+            add_action( 'plugins_loaded', array( $this, 'load_plugin' ) );
84
+            add_action( 'init', array( $this, 'init_plugin' ) );
85
+            add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_links' ), 10, 4 );
86
+        }
87
+
88
+        public function plugin_path() {
89
+            return untrailingslashit( plugin_dir_path( __FILE__ ) );
90
+        } // END plugin_path()
91
+
92
+        /*
93 93
 		 * Check requirements on activation.
94 94
 		 *
95 95
 		 * @global $woocommerce
96 96
 		 */
97
-		public function load_plugin() {
98
-			global $woocommerce;
99
-
100
-			// Check that the required WooCommerce is running.
101
-			if ( version_compare( $woocommerce->version, self::REQ_WC_VERSION, '<' ) ) {
102
-				add_action( 'admin_notices', array( $this, 'wcsatt_stt_wc_admin_notice' ) );
103
-				return false;
104
-			}
105
-
106
-			// Checks that WooCommerce Subscribe All the Things is running or is less than the required version.
107
-			if ( ! class_exists( 'WCS_ATT' ) || version_compare( WCS_ATT::VERSION, self::REQ_WCSATT_VERSION, '<' ) ) {
108
-				add_action( 'admin_notices', array( $this, 'wcsatt_stt_admin_notice' ) );
109
-				return false;
110
-			}
111
-
112
-			require_once( 'includes/class-wcsatt-stt-cart.php' );
113
-			require_once( 'includes/class-wcsatt-stt-display.php' );
114
-
115
-			// Admin includes
116
-			if ( is_admin() ) {
117
-				require_once( 'includes/admin/class-wcsatt-stt-admin.php' );
118
-			}
119
-
120
-		} // END load_plugin()
121
-
122
-		/**
123
-		 * Display a warning message if minimum version of WooCommerce check fails.
124
-		 *
125
-		 * @return void
126
-		 */
127
-		public function wcsatt_stt_wc_admin_notice() {
128
-			echo '<div class="error"><p>' . sprintf( __( '%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt' ), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce', self::REQ_WC_VERSION ) . '</p></div>';
129
-		} // END wcsatt_stt_wc_admin_notice()
130
-
131
-		/**
132
-		 * Display a warning message if minimum version of WooCommerce Subscribe All the Things check fails.
133
-		 *
134
-		 * @return void
135
-		 */
136
-		public function wcsatt_stt_admin_notice() {
137
-			echo '<div class="error"><p>' . sprintf( __( '%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt' ), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce Subscribe All the Things', self::REQ_WCSATT_VERSION ) . '</p></div>';
138
-		} // END wcsatt_stt_admin_notice()
139
-
140
-		/**
141
-		 * Initialize the plugin if ready.
142
-		 *
143
-		 * @return void
144
-		 */
145
-		public function init_plugin() {
146
-			// Load text domain.
147
-			load_plugin_textdomain( 'wc-satt-stt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
148
-		} // END init_plugin()
149
-
150
-		/**
151
-		 * Show row meta on the plugin screen.
152
-		 *
153
-		 * @param  mixed $links Plugin Row Meta
154
-		 * @param  mixed $file  Plugin Base file
155
-		 * @param  array $data  Plugin Data
156
-		 * @return array
157
-		 */
158
-		public function plugin_meta_links( $links, $file, $data, $status ) {
159
-			if ( $file == plugin_basename( __FILE__ ) ) {
160
-				$author1 = '<a href="' . $data[ 'AuthorURI' ] . '">' . $data[ 'Author' ] . '</a>';
161
-				$author2 = '<a href="http://www.subscriptiongroup.co.uk/">Subscription Group Limited</a>';
162
-				$links[ 1 ] = sprintf( __( 'By %s', self::TEXT_DOMAIN ), sprintf( __( '%s and %s', self::TEXT_DOMAIN ), $author1, $author2 ) );
163
-			}
164
-
165
-			return $links;
166
-		} // END plugin_meta_links()
167
-
168
-	} // END class
97
+        public function load_plugin() {
98
+            global $woocommerce;
99
+
100
+            // Check that the required WooCommerce is running.
101
+            if ( version_compare( $woocommerce->version, self::REQ_WC_VERSION, '<' ) ) {
102
+                add_action( 'admin_notices', array( $this, 'wcsatt_stt_wc_admin_notice' ) );
103
+                return false;
104
+            }
105
+
106
+            // Checks that WooCommerce Subscribe All the Things is running or is less than the required version.
107
+            if ( ! class_exists( 'WCS_ATT' ) || version_compare( WCS_ATT::VERSION, self::REQ_WCSATT_VERSION, '<' ) ) {
108
+                add_action( 'admin_notices', array( $this, 'wcsatt_stt_admin_notice' ) );
109
+                return false;
110
+            }
111
+
112
+            require_once( 'includes/class-wcsatt-stt-cart.php' );
113
+            require_once( 'includes/class-wcsatt-stt-display.php' );
114
+
115
+            // Admin includes
116
+            if ( is_admin() ) {
117
+                require_once( 'includes/admin/class-wcsatt-stt-admin.php' );
118
+            }
119
+
120
+        } // END load_plugin()
121
+
122
+        /**
123
+         * Display a warning message if minimum version of WooCommerce check fails.
124
+         *
125
+         * @return void
126
+         */
127
+        public function wcsatt_stt_wc_admin_notice() {
128
+            echo '<div class="error"><p>' . sprintf( __( '%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt' ), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce', self::REQ_WC_VERSION ) . '</p></div>';
129
+        } // END wcsatt_stt_wc_admin_notice()
130
+
131
+        /**
132
+         * Display a warning message if minimum version of WooCommerce Subscribe All the Things check fails.
133
+         *
134
+         * @return void
135
+         */
136
+        public function wcsatt_stt_admin_notice() {
137
+            echo '<div class="error"><p>' . sprintf( __( '%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt' ), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce Subscribe All the Things', self::REQ_WCSATT_VERSION ) . '</p></div>';
138
+        } // END wcsatt_stt_admin_notice()
139
+
140
+        /**
141
+         * Initialize the plugin if ready.
142
+         *
143
+         * @return void
144
+         */
145
+        public function init_plugin() {
146
+            // Load text domain.
147
+            load_plugin_textdomain( 'wc-satt-stt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
148
+        } // END init_plugin()
149
+
150
+        /**
151
+         * Show row meta on the plugin screen.
152
+         *
153
+         * @param  mixed $links Plugin Row Meta
154
+         * @param  mixed $file  Plugin Base file
155
+         * @param  array $data  Plugin Data
156
+         * @return array
157
+         */
158
+        public function plugin_meta_links( $links, $file, $data, $status ) {
159
+            if ( $file == plugin_basename( __FILE__ ) ) {
160
+                $author1 = '<a href="' . $data[ 'AuthorURI' ] . '">' . $data[ 'Author' ] . '</a>';
161
+                $author2 = '<a href="http://www.subscriptiongroup.co.uk/">Subscription Group Limited</a>';
162
+                $links[ 1 ] = sprintf( __( 'By %s', self::TEXT_DOMAIN ), sprintf( __( '%s and %s', self::TEXT_DOMAIN ), $author1, $author2 ) );
163
+            }
164
+
165
+            return $links;
166
+        } // END plugin_meta_links()
167
+
168
+    } // END class
169 169
 
170 170
 } // END if class exists
171 171
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
  * License: GNU General Public License v3.0
18 18
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
19 19
  */
20
-if ( ! defined('ABSPATH') ) exit; // Exit if accessed directly.
20
+if (!defined('ABSPATH')) exit; // Exit if accessed directly.
21 21
 
22
-if ( ! class_exists( 'WCSATT_STT' ) ) {
22
+if (!class_exists('WCSATT_STT')) {
23 23
 	class WCSATT_STT {
24 24
 
25 25
 		/* Plugin version. */
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		 * @since 1.0.0
53 53
 		 */
54 54
 		public static function instance() {
55
-			if ( is_null( self::$_instance ) ) {
55
+			if (is_null(self::$_instance)) {
56 56
 				self::$_instance = new self();
57 57
 			}
58 58
 			return self::$_instance;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		 * @since 1.0.0
65 65
 		 */
66 66
 		public function __clone() {
67
-			_doing_it_wrong( __FUNCTION__, __( 'Foul!' ), '1.0.0' );
67
+			_doing_it_wrong(__FUNCTION__, __('Foul!'), '1.0.0');
68 68
 		}
69 69
 
70 70
 		/**
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 		 * @since 1.0.0
74 74
 		 */
75 75
 		public function __wakeup() {
76
-			_doing_it_wrong( __FUNCTION__, __( 'Foul!' ), '1.0.0' );
76
+			_doing_it_wrong(__FUNCTION__, __('Foul!'), '1.0.0');
77 77
 		}
78 78
 
79 79
 		/**
80 80
 		 * Load the plugin.
81 81
 		 */
82 82
 		public function __construct() {
83
-			add_action( 'plugins_loaded', array( $this, 'load_plugin' ) );
84
-			add_action( 'init', array( $this, 'init_plugin' ) );
85
-			add_filter( 'plugin_row_meta', array( $this, 'plugin_meta_links' ), 10, 4 );
83
+			add_action('plugins_loaded', array($this, 'load_plugin'));
84
+			add_action('init', array($this, 'init_plugin'));
85
+			add_filter('plugin_row_meta', array($this, 'plugin_meta_links'), 10, 4);
86 86
 		}
87 87
 
88 88
 		public function plugin_path() {
89
-			return untrailingslashit( plugin_dir_path( __FILE__ ) );
89
+			return untrailingslashit(plugin_dir_path(__FILE__));
90 90
 		} // END plugin_path()
91 91
 
92 92
 		/*
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
 			global $woocommerce;
99 99
 
100 100
 			// Check that the required WooCommerce is running.
101
-			if ( version_compare( $woocommerce->version, self::REQ_WC_VERSION, '<' ) ) {
102
-				add_action( 'admin_notices', array( $this, 'wcsatt_stt_wc_admin_notice' ) );
101
+			if (version_compare($woocommerce->version, self::REQ_WC_VERSION, '<')) {
102
+				add_action('admin_notices', array($this, 'wcsatt_stt_wc_admin_notice'));
103 103
 				return false;
104 104
 			}
105 105
 
106 106
 			// Checks that WooCommerce Subscribe All the Things is running or is less than the required version.
107
-			if ( ! class_exists( 'WCS_ATT' ) || version_compare( WCS_ATT::VERSION, self::REQ_WCSATT_VERSION, '<' ) ) {
108
-				add_action( 'admin_notices', array( $this, 'wcsatt_stt_admin_notice' ) );
107
+			if (!class_exists('WCS_ATT') || version_compare(WCS_ATT::VERSION, self::REQ_WCSATT_VERSION, '<')) {
108
+				add_action('admin_notices', array($this, 'wcsatt_stt_admin_notice'));
109 109
 				return false;
110 110
 			}
111 111
 
112
-			require_once( 'includes/class-wcsatt-stt-cart.php' );
113
-			require_once( 'includes/class-wcsatt-stt-display.php' );
112
+			require_once('includes/class-wcsatt-stt-cart.php');
113
+			require_once('includes/class-wcsatt-stt-display.php');
114 114
 
115 115
 			// Admin includes
116
-			if ( is_admin() ) {
117
-				require_once( 'includes/admin/class-wcsatt-stt-admin.php' );
116
+			if (is_admin()) {
117
+				require_once('includes/admin/class-wcsatt-stt-admin.php');
118 118
 			}
119 119
 
120 120
 		} // END load_plugin()
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		 * @return void
126 126
 		 */
127 127
 		public function wcsatt_stt_wc_admin_notice() {
128
-			echo '<div class="error"><p>' . sprintf( __( '%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt' ), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce', self::REQ_WC_VERSION ) . '</p></div>';
128
+			echo '<div class="error"><p>'.sprintf(__('%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt'), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce', self::REQ_WC_VERSION).'</p></div>';
129 129
 		} // END wcsatt_stt_wc_admin_notice()
130 130
 
131 131
 		/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		 * @return void
135 135
 		 */
136 136
 		public function wcsatt_stt_admin_notice() {
137
-			echo '<div class="error"><p>' . sprintf( __( '%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt' ), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce Subscribe All the Things', self::REQ_WCSATT_VERSION ) . '</p></div>';
137
+			echo '<div class="error"><p>'.sprintf(__('%1$s requires at least %2$s v%3$s in order to function. Please upgrade %2$s.', 'wc-satt-stt'), 'WooCommerce Subscribe All the Things: Sign-up and Trial Add-on', 'WooCommerce Subscribe All the Things', self::REQ_WCSATT_VERSION).'</p></div>';
138 138
 		} // END wcsatt_stt_admin_notice()
139 139
 
140 140
 		/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		 */
145 145
 		public function init_plugin() {
146 146
 			// Load text domain.
147
-			load_plugin_textdomain( 'wc-satt-stt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
147
+			load_plugin_textdomain('wc-satt-stt', false, dirname(plugin_basename(__FILE__)).'/languages/');
148 148
 		} // END init_plugin()
149 149
 
150 150
 		/**
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 		 * @param  array $data  Plugin Data
156 156
 		 * @return array
157 157
 		 */
158
-		public function plugin_meta_links( $links, $file, $data, $status ) {
159
-			if ( $file == plugin_basename( __FILE__ ) ) {
160
-				$author1 = '<a href="' . $data[ 'AuthorURI' ] . '">' . $data[ 'Author' ] . '</a>';
158
+		public function plugin_meta_links($links, $file, $data, $status) {
159
+			if ($file == plugin_basename(__FILE__)) {
160
+				$author1 = '<a href="'.$data['AuthorURI'].'">'.$data['Author'].'</a>';
161 161
 				$author2 = '<a href="http://www.subscriptiongroup.co.uk/">Subscription Group Limited</a>';
162
-				$links[ 1 ] = sprintf( __( 'By %s', self::TEXT_DOMAIN ), sprintf( __( '%s and %s', self::TEXT_DOMAIN ), $author1, $author2 ) );
162
+				$links[1] = sprintf(__('By %s', self::TEXT_DOMAIN), sprintf(__('%s and %s', self::TEXT_DOMAIN), $author1, $author2));
163 163
 			}
164 164
 
165 165
 			return $links;
Please login to merge, or discard this patch.