PluginProbe
WowOptin: Next-Gen Popup Maker – Create Stunning Popups and Optins for Lead Generation / trunk
WowOptin: Next-Gen Popup Maker – Create Stunning Popups and Optins for Lead Generation vtrunk
1.4.48 1.4.47 1.4.46 1.4.45 1.4.44 1.4.43 1.4.42 1.4.41 1.4.40 1.4.39 1.4.38 1.4.37 1.4.36 1.1.2 1.2.0 1.2.1 1.2.2 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 64 releases
optin / includes / utils / class-plugin-actions.php

class-plugin-actions.php in WowOptin: Next-Gen Popup Maker – Create Stunning Popups and Optins for Lead Generation trunk, at includes/utils/class-plugin-actions.php

87 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore
2
3 namespace OPTN\Includes\Utils;
4
5 use OPTN\Includes\Notice\Notice;
6 use OPTN\Includes\Xpo;
7
8 defined( 'ABSPATH' ) || exit;
9
10 /**
11 * Plugin Actions
12 */
13 class PluginActions {
14
15 /**
16 * Constructor
17 */
18 public function __construct() {
19 add_filter( 'plugin_action_links_' . OPTN_BASE, array( $this, 'plugin_action_links_callback' ) );
20 add_filter( 'plugin_row_meta', array( $this, 'plugin_settings_meta' ), 10, 2 );
21 }
22
23 /**
24 * Adds quick action links below the plugin name.
25 *
26 * @param array $links Default plugin action links.
27 * @return array Modified plugin action links.
28 */
29 public function plugin_action_links_callback( $links ) {
30
31 $setting_link = array();
32 $setting_link['optn_options'] = '<a href="' . esc_url( admin_url( 'admin.php?page=wowoptin-optins' ) ) . '">' . esc_html__( 'Optins', 'optin' ) . '</a>';
33
34 $upgrade_link = array();
35
36 // Free user or expired license user.
37 if ( ! defined( 'OPTN_PRO_VERSION' ) || Xpo::is_lc_expired() ) {
38
39 $license_key = Utils::get_license_key() ?? '';
40
41 if ( Xpo::is_lc_expired() ) {
42 $text = esc_html__( 'Renew License', 'optin' );
43 $url = Xpo::get_renew_link();
44 } else {
45
46 $text = esc_html__( 'Upgrade to Pro', 'optin' );
47 $url = Xpo::generate_utm_link();
48
49 // A live promo overrides the evergreen link. The promo data
50 // lives in includes/notice/promos/plugin-meta.php; with nothing
51 // live we keep the "Upgrade to Pro" link built above.
52 $promo = Notice::get_active_promo( 'plugin-meta' );
53 if ( $promo ) {
54 $text = $promo['text'];
55 $url = $promo['url'];
56 }
57 }
58
59 $link_color = Notice::config()['brand_color'];
60
61 $upgrade_link['optn_pro'] = '<a style="color: ' . esc_attr( $link_color ) . '; font-weight: bold;" target="_blank" href="' . esc_url( $url ) . '">' . esc_html( $text ) . '</a>';
62 }
63
64 return array_merge( $setting_link, $links, $upgrade_link );
65 }
66
67 /**
68 * Adds extra links to the plugin row meta on the plugins page.
69 *
70 * @param array $links Existing plugin meta links.
71 * @param string $file Plugin file path.
72 * @return array Modified plugin meta links.
73 */
74 public function plugin_settings_meta( $links, $file ) {
75 if ( strpos( $file, 'optin.php' ) !== false ) {
76 $new_links = array(
77
78 'optn_docs' => '<a target="_blank" href="https://wowoptin.com/docs/">' . esc_html__( 'Docs', 'optin' ) . '</a>',
79
80 'optn_support' => '<a href="https://www.wpxpo.com/contact/" target="_blank">' . esc_html__( 'Support', 'optin' ) . '</a>',
81 );
82 $links = array_merge( $links, $new_links );
83 }
84 return $links;
85 }
86 }
87