1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace WC_POS\Admin;
13
14 class Plugins {
15
16 public function __construct() {
17 add_filter( 'plugin_action_links_'. \WC_POS\PLUGIN_FILE, array ( $this, 'plugin_action_links' ) );
18 add_action( 'in_plugin_update_message-' . \WC_POS\PLUGIN_FILE, array ( $this, 'plugin_update_message' ), 10, 2 );
19 }
20
21 22 23 24 25
26 public function plugin_action_links( $links ){
27 return array(
28 'settings' => '<a href="'. admin_url( 'admin.php?page=wc_pos_settings' ) .'">'. __( 'Settings' ) .'</a>'
29 ) + $links;
30 }
31
32 33 34 35 36
37 public function plugin_update_message( $currentPluginMetadata, $newPluginMetadata ){
38 if (isset($newPluginMetadata->upgrade_notice) && strlen(trim($newPluginMetadata->upgrade_notice)) > 0){
39 echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>'. __( 'Important:' ) . '</strong> ';
40 echo esc_html($newPluginMetadata->upgrade_notice), '</p>';
41 }
42 }
43
44 }