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