PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.3.3
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.3.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
103 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 * Plugin service.
4 *
5 * @package SureCartAppCore
6 * @author SureCart <support@surecart.com>
7 * @copyright SureCart
8 * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
9 * @link https://surecart.com
10 */
11
12 namespace SureCart\WordPress;
13
14 use SureCartCore\Application\Application;
15
16 /**
17 * Main communication channel with the theme.
18 */
19 class PluginService {
20 /**
21 * Application instance.
22 *
23 * @var Application
24 */
25 protected $app = null;
26
27 /**
28 * Constructor.
29 *
30 * @param Application $app Application instance.
31 */
32 public function __construct( $app ) {
33 $this->app = $app;
34 }
35
36 /**
37 * Get the plugin version
38 *
39 * @return string
40 */
41 public function version() {
42 // Load version from plugin data.
43 if ( ! \function_exists( 'get_plugin_data' ) ) {
44 require_once \ABSPATH . 'wp-admin/includes/plugin.php';
45 }
46
47 return \get_plugin_data( SURECART_PLUGIN_FILE, false, false )['Version'];
48 }
49
50 /**
51 * Has the plugin version changed?
52 *
53 * @return boolean
54 */
55 public function versionChanged() {
56 return version_compare( $this->version(), get_option( 'surecart_migration_version', '0.0.0' ), '!=' );
57 }
58
59 /**
60 * Shortcute to \SureCart\Account\AccountService
61 *
62 * @return \SureCart\Account\AccountService
63 */
64 public function account() {
65 return $this->app->resolve( 'surecart.account' );
66 }
67
68 /**
69 * Shortcut to \SureCart\Install\InstallService.
70 *
71 * @return \SureCart\Install\InstallService
72 */
73 public function install() {
74 return $this->app->resolve( 'surecart.install' );
75 }
76
77 /**
78 * Shortcut to \SureCart\WordPress\Pages\PageService.
79 *
80 * @return \SureCart\WordPress\Pages\PageService
81 */
82 public function pages() {
83 return $this->app->resolve( 'surecart.pages' );
84 }
85 /**
86 * Shortcut to \SureCart\WordPress\Pages\PageService.
87 *
88 * @return \SureCart\WordPress\Pages\PageService
89 */
90 public function activation() {
91 return $this->app->resolve( 'surecart.activation' );
92 }
93
94 /**
95 * Shortcut to \SureCart\WordPress\Pages\PageService.
96 *
97 * @return \SureCart\Permissions\RolesService;
98 */
99 public function roles() {
100 return $this->app->resolve( 'surecart.permissions.roles' );
101 }
102 }
103