PluginProbe
Posts Table with Search & Sort / 1.2
Posts Table with Search & Sort v1.2
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 1.3.8 All 39 releases
posts-data-table / includes / admin / class-admin-controller.php

class-admin-controller.php in Posts Table with Search & Sort 1.2, at includes/admin/class-admin-controller.php

57 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Barn2\Plugin\Posts_Table_Search_Sort;
4
5 // Prevent direct file access
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 use Barn2\Lib\Util;
11
12 /**
13 * Handles general admin functions, such as adding links to our settings page in the Plugins menu.
14 *
15 * @author Barn2 Media <info@barn2.co.uk>
16 * @license GPL-3.0
17 * @copyright Barn2 Media Ltd
18 */
19 class Admin_Controller implements \Barn2\Lib\Attachable {
20
21 private $settings_page;
22
23 public function __construct() {
24 $this->settings_page = new Admin_Settings_Page();
25 }
26
27 public function attach() {
28 // Extra links on Plugins page
29 add_filter( 'plugin_action_links_' . PTSS_PLUGIN_BASENAME, array( $this, 'add_settings_link' ) );
30 add_filter( 'plugin_row_meta', array( $this, 'add_pro_version_link' ), 10, 2 );
31
32 add_action( 'admin_enqueue_scripts', array( $this, 'settings_page_scripts' ) );
33
34 $this->settings_page->attach();
35 }
36
37 public function add_settings_link( $links ) {
38 array_unshift( $links, sprintf( '<a href="%1$s">%2$s</a>', esc_url( admin_url( 'options-general.php?page=' . Admin_Settings_Page::MENU_SLUG ) ), esc_html__( 'Settings', 'posts-data-table' ) ) );
39 return $links;
40 }
41
42 public function add_pro_version_link( $links, $file ) {
43 if ( PTSS_PLUGIN_BASENAME == $file ) {
44 $links[] = sprintf( '<a href="%1$s" target="_blank"><strong>%2$s</strong></a>', esc_url( 'https://barn2.co.uk/wordpress-plugins/posts-table-pro/' ), esc_html__( 'Pro Version', 'posts-data-table' ) );
45 }
46
47 return $links;
48 }
49
50 public function settings_page_scripts( $hook ) {
51 if ( 'settings_page_posts_table_search_sort' === $hook ) {
52 $suffix = Util::get_script_suffix();
53 wp_enqueue_style( 'ptss-admin', plugins_url( "assets/css/admin/posts-data-table-admin{$suffix}.css", Plugin::FILE ), array(), Plugin::VERSION );
54 }
55 }
56 }
57