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/Admin/Admin_Controller.php +19 -10 1.3.61.4.13 View file →
@@ -1,11 +1,12 @@
1 1 <?php
2 2 namespace Barn2\Plugin\Posts_Table_Search_Sort\Admin;
3 3
4 -use Barn2\PTS_Lib\Util,
5 - Barn2\PTS_Lib\Plugin\Plugin,
6 - Barn2\PTS_Lib\Registerable,
7 - Barn2\PTS_Lib\Service;
4 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Util;
5 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Plugin\Plugin;
6 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Registerable;
7 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Service\Standard_Service;
8 +use Barn2\Plugin\Posts_Table_Search_Sort\Dependencies\Lib\Service\Service_Container;
8 9
9 10 /**
10 11 * Handles general admin functions, such as adding links to our settings page in the Plugins menu.
11 12 *
@@ -13,19 +14,23 @@
13 14 * @author Barn2 Plugins <support@barn2.com>
14 15 * @license GPL-3.0
15 16 * @copyright Barn2 Media Ltd
16 17 */
17 -class Admin_Controller implements Registerable, Service {
18 +class Admin_Controller implements Registerable, Standard_Service {
18 19
20 + use Service_Container;
21 +
19 22 private $plugin;
20 23 private $settings_page;
21 24
22 25 public function __construct( Plugin $plugin ) {
23 26 $this->plugin = $plugin;
24 - $this->settings_page = new Settings_Page( $plugin );
27 + // $this->settings_page = new Settings_Page( $plugin );
25 28 }
26 29
27 30 public function register() {
31 + $this->register_services();
32 + $this->start_all_services();
28 33 // Extra links on Plugins page
29 34 add_filter( 'plugin_action_links_' . $this->plugin->get_basename(), [ $this, 'add_settings_link' ] );
30 35 add_filter( 'plugin_row_meta', [ $this, 'add_pro_version_link' ], 10, 2 );
31 36
@@ -31,9 +36,9 @@
31 36
32 37 // Admin scripts
33 38 add_action( 'admin_enqueue_scripts', [ $this, 'settings_page_scripts' ] );
34 39
35 - $this->settings_page->register();
40 + // $this->settings_page->register();
36 41 }
37 42
38 43 public function add_settings_link( $links ) {
39 44 array_unshift(
@@ -39,9 +44,9 @@
39 44 array_unshift(
40 45 $links,
41 46 sprintf(
42 47 '<a href="%1$s">%2$s</a>',
43 - esc_url( admin_url( 'options-general.php?page=' . Settings_Page::MENU_SLUG ) ),
48 + esc_url( $this->plugin->get_settings_page_url() ),
44 49 esc_html__( 'Settings', 'posts-data-table' )
45 50 )
46 51 );
47 52 return $links;
@@ -50,9 +55,9 @@
50 55 public function add_pro_version_link( $links, $file ) {
51 56 if ( $file === $this->plugin->get_basename() ) {
52 57 $links[] = sprintf(
53 58 '<a href="%1$s" target="_blank"><strong>%2$s</strong></a>',
54 - esc_url( 'https://barn2.com/wordpress-plugins/posts-table-pro/' ),
59 + esc_url( 'https://barn2.com/wordpress-plugins/posts-table-pro/?utm_source=settings&utm_medium=settings&utm_campaign=settingsinline&utm_content=ptss-ptp' ),
55 60 esc_html__( 'Pro Version', 'posts-data-table' )
56 61 );
57 62 }
58 63
@@ -58,12 +63,16 @@
58 63
59 64 return $links;
60 65 }
61 66
67 + public function add_services() {
68 + $this->add_service( 'settings_page', new Settings_Page( $this->plugin ) );
69 + }
70 +
62 71 public function settings_page_scripts( $hook ) {
63 72 if ( 'settings_page_posts_table_search_sort' === $hook ) {
64 73 $suffix = Util::get_script_suffix();
65 - wp_enqueue_style( 'ptss-admin', plugins_url( "assets/css/admin/posts-data-table-admin{$suffix}.css", $this->plugin->get_file() ), [], $this->plugin->get_version() );
74 + wp_enqueue_style( 'ptss-admin', plugins_url( "assets/css/admin/posts-data-table-admin.css", $this->plugin->get_file() ), [], $this->plugin->get_version() );
66 75 }
67 76 }
68 77
69 78 }