PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 2.1.3
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v2.1.3
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / WordPress / PluginService.php
PluginService.php
101 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package SureCartAppCore
4 * @author SureCart <support@surecart.com>
5 * @copyright SureCart
6 * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
7 * @link https://surecart.com
8 */
9
10 namespace SureCart\WordPress;
11
12 use SureCartCore\Application\Application;
13
14 /**
15 * Main communication channel with the theme.
16 */
17 class PluginService {
18 /**
19 * Application instance.
20 *
21 * @var Application
22 */
23 protected $app = null;
24
25 /**
26 * Constructor.
27 *
28 * @param Application $app
29 */
30 public function __construct( $app ) {
31 $this->app = $app;
32 }
33
34 /**
35 * Get the plugin version
36 *
37 * @return string
38 */
39 public function version() {
40 // Load version from plugin data.
41 if ( ! \function_exists( 'get_plugin_data' ) ) {
42 require_once \ABSPATH . 'wp-admin/includes/plugin.php';
43 }
44
45 return \get_plugin_data( SURECART_PLUGIN_FILE, false, false )['Version'];
46 }
47
48 /**
49 * Has the plugin version changed?
50 *
51 * @return boolean
52 */
53 public function versionChanged() {
54 return version_compare( $this->version(), get_option( 'surecart_migration_version', '0.0.0' ), '!=' );
55 }
56
57 /**
58 * Shortcute to \SureCart\Account\AccountService
59 *
60 * @return \SureCart\Account\AccountService
61 */
62 public function account() {
63 return $this->app->reolve( 'surecart.account' );
64 }
65
66 /**
67 * Shortcut to \SureCart\Install\InstallService.
68 *
69 * @return \SureCart\Install\InstallService
70 */
71 public function install() {
72 return $this->app->resolve( 'surecart.install' );
73 }
74
75 /**
76 * Shortcut to \SureCart\WordPress\Pages\PageService.
77 *
78 * @return \SureCart\WordPress\Pages\PageService
79 */
80 public function pages() {
81 return $this->app->resolve( 'surecart.pages' );
82 }
83 /**
84 * Shortcut to \SureCart\WordPress\Pages\PageService.
85 *
86 * @return \SureCart\WordPress\Pages\PageService
87 */
88 public function activation() {
89 return $this->app->resolve( 'surecart.activation' );
90 }
91
92 /**
93 * Shortcut to \SureCart\WordPress\Pages\PageService.
94 *
95 * @return \SureCart\Permissions\RolesService;
96 */
97 public function roles() {
98 return $this->app->resolve( 'surecart.permissions.roles' );
99 }
100 }
101