PluginProbe
Email Log / 2.63
Email Log v2.63
2.63 2.4.8 2.4.9 2.6 2.61 2.62 trunk 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.8.1 0.9 0.9.1 0.9.2 1.1 1.5 1.5.1 1.5.2 1.5.3 1.5.4 All 61 releases
email-log / include / Core / UI / Component / AdminUIEnhancer.php

AdminUIEnhancer.php in Email Log 2.63, at include/Core/UI/Component/AdminUIEnhancer.php

97 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace EmailLog\Core\UI\Component;
2
3 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
4
5 /**
6 * Enhance Admin UI and add links about EmailLog in the following places.
7 * - Plugin List page.
8 * - Footer for all EmailLog pages.
9 *
10 * @since 2.0.0
11 */
12 class AdminUIEnhancer {
13
14 /**
15 * Plugin file name.
16 *
17 * @var string
18 */
19 protected $plugin_file;
20
21 /**
22 * Plugin basename.
23 *
24 * @var string
25 */
26 protected $plugin_basename;
27
28 /**
29 * Initialize the component and store the plugin basename.
30 *
31 * @param string|null $file Plugin file.
32 */
33 public function __construct( $file = null ) {
34 if ( null === $file ) {
35 $email_log = email_log();
36 $file = $email_log->get_plugin_file();
37 }
38
39 $this->plugin_file = $file;
40 $this->plugin_basename = plugin_basename( $file );
41 }
42
43 /**
44 * Setup hooks.
45 *
46 *
47 */
48 public function load() {
49 add_filter( 'plugin_action_links_' . $this->plugin_basename, array( $this, 'insert_view_logs_link' ) );
50
51 add_action( 'el_admin_footer', array( $this, 'hook_footer_links' ) );
52 }
53
54 /**
55 * Add link to 'View logs' page in plugin listing page.
56 *
57 * @since 2.3.0 Added Settings link.
58 *
59 * @param array $links List of links.
60 *
61 * @return array Modified list of links.
62 */
63 public function insert_view_logs_link( $links ) {
64 $view_logs_link = '<a href="admin.php?page=email-log">' . __( 'View Logs', 'email-log' ) . '</a>';
65 $pro_link = '<a href="admin.php?page=email-log#open-pro-dialog"><b>' . __( 'Get PRO', 'email-log' ) . '</b></a>';
66
67 array_unshift( $links, $view_logs_link );
68 $links[] = $pro_link;
69
70 return $links;
71 }
72
73 /**
74 * Hook Footer links.
75 */
76 public function hook_footer_links() {
77 //add_action( 'in_admin_footer', array( $this, 'add_credit_links' ) );
78 }
79
80 /**
81 * Adds Footer links.
82 *
83 * @since Genesis
84 * @see Function relied on
85 * @link http://striderweb.com/nerdaphernalia/2008/06/give-your-wordpress-plugin-credit/
86 */
87 public function add_credit_links() {
88 $plugin_data = get_plugin_data( $this->plugin_file );
89 \EmailLog\Core\EmailLog::wp_kses_wf(sprintf(
90 '%1$s ' . __( 'plugin', 'email-log' ) . ' | ' . __( 'Version', 'email-log' ) . ' %2$s | ' . __( 'by', 'email-log' ) . ' %3$s <br />',
91 $plugin_data['Title'],
92 $plugin_data['Version'],
93 $plugin_data['Author']
94 ));
95 }
96 }
97