PluginProbe
Posts Table with Search & Sort / 1.4.11
Posts Table with Search & Sort v1.4.11
1.4.13 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2 1.3 1.3.1 1.3.1-v2 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 40 releases
← All changes | src/Plugin.php +21 -50 1.3.61.4.11 View file →
@@ -1,12 +1,11 @@
1 1 <?php
2 2
3 3 namespace Barn2\Plugin\Posts_Table_Search_Sort;
4 4
5 -use Barn2\PTS_Lib\Plugin\Simple_Plugin;
6 -use Barn2\PTS_Lib\Registerable;
7 -use Barn2\PTS_Lib\Service_Provider;
8 -use Barn2\PTS_Lib\Util;
5 +use Barn2\Plugin\Posts_Table_Search_Sort\Admin\Settings_Page;
6 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Plugin\Simple_Plugin;
7 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Util;
9 8
10 9 /**
11 10 * The main plugin class.
12 11 *
@@ -14,20 +13,16 @@
14 13 * @author Barn2 Plugins <support@barn2.com>
15 14 * @license GPL-3.0
16 15 * @copyright Barn2 Media Ltd
17 16 */
18 -class Plugin extends Simple_Plugin implements Registerable, Service_Provider {
17 +class Plugin extends Simple_Plugin {
19 18
20 19 const NAME = 'Posts Table with Search and Sort';
21 20 const ITEM_ID = 8006;
22 21
23 - /**
24 - * @var array $services
25 - */
26 - private $services;
27 22
28 23 /**
29 - * Constructs and initalizes an EDD VAT plugin instance.
24 + * Constructs and initializes posts table plugin instance.
30 25 *
31 26 * @param string $file The main plugin __FILE__
32 27 * @param string $version The current plugin version
33 28 */
@@ -33,55 +28,31 @@
33 28 */
34 29 public function __construct( $file = null, $version = '1.0' ) {
35 30 parent::__construct(
36 31 [
37 - 'id' => self::ITEM_ID,
38 - 'name' => self::NAME,
39 - 'version' => $version,
40 - 'file' => $file
32 + 'id' => self::ITEM_ID,
33 + 'name' => self::NAME,
34 + 'version' => $version,
35 + 'file' => $file,
36 + 'documentation_path' => '/kb-categories/posts-table-search-sort-free-kb/',
37 + 'settings_path' => 'options-general.php?page=' . Settings_Page::MENU_SLUG
41 38 ]
42 39 );
43 -
44 - include_once plugin_dir_path( $file ) . 'src/deprecated.php';
45 -
46 - // Services
47 - $this->services['shortcode'] = new Table_Shortcode();
48 - $this->services['scripts'] = new Frontend_Scripts( $this );
49 -
50 - // Admin only services
51 - if ( Util::is_admin() ) {
52 - $this->services['admin'] = new Admin\Admin_Controller( $this );
53 - }
54 40 }
55 41
56 - public function register() {
57 - add_action( 'plugins_loaded', [ $this, 'maybe_load_plugin' ] );
58 - }
59 -
42 +
60 43 public function maybe_load_plugin() {
61 44 // Don't load plugin if Pro version active
62 - if ( class_exists( '\Posts_Table_Pro_Plugin' ) ) {
63 - return;
45 + if ( ! Util::is_barn2_plugin_active('\\Barn2\\Plugin\\Posts_Table_Pro\\ptp') ) {
46 + add_action('after_setup_theme', [$this, 'start_standard_services']);
64 47 }
65 -
66 - add_action( 'init', [ $this, 'load_textdomain' ] );
67 -
68 - Util::register_services( $this->services );
69 48 }
70 -
71 - public function load_textdomain() {
72 - load_plugin_textdomain( 'posts-data-table', false, $this->get_slug() . '/languages' );
73 - }
74 -
75 - public function get_service( $id ) {
76 - if ( isset( $this->services[ $id ] ) ) {
77 - return $this->services[ $id ];
78 - }
79 -
80 - return null;
81 - }
82 -
83 - public function get_services() {
84 - return $this->services;
49 +
50 + public function add_services() {
51 + $this->add_service( 'plugin_setup', new Plugin_Setup( $this->get_file(), $this ), true );
52 + $this->add_service( 'shortcode', new Table_Shortcode() );
53 + $this->add_service( 'scripts', new Frontend_Scripts( $this ) );
54 + $this->add_service( 'setup_wizard', new Admin\Wizard\Setup_Wizard( $this ) );
55 + $this->add_service( 'admin', new Admin\Admin_Controller( $this ) );
85 56 }
86 57
87 58 }