PluginProbe ʕ •ᴥ•ʔ
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager / 2.3.6
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager v2.3.6
2.3.6 trunk 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.5.0 1.6.0 1.6.1 1.6.2 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.2 2.0.3 2.0.4 2.0.4.1 2.0.4.2 2.0.4.3 2.0.4.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.2 2.1.3 2.1.3.1 2.1.4 2.1.4.1 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3.1 2.2.4 2.2.4.1 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.2.1 2.3.3 2.3.4 2.3.5
insert-headers-and-footers / includes / lite / class-wpcode-admin-bar-info-lite.php
insert-headers-and-footers / includes / lite Last commit date
admin 9 months ago auto-insert 1 year ago conditional-logic 1 year ago class-wpcode-admin-bar-info-lite.php 2 years ago class-wpcode-smart-tags-lite.php 1 year ago loader.php 1 year ago
class-wpcode-admin-bar-info-lite.php
100 lines
1 <?php
2 /**
3 * WPCode_Admin_Bar_Info_Lite class.
4 *
5 * @package WPCode
6 */
7
8 /**
9 * Class WPCode_Admin_Bar_Info_Lite.
10 *
11 * @extends WPCode_Admin_Bar_Info
12 */
13 class WPCode_Admin_Bar_Info_Lite extends WPCode_Admin_Bar_Info {
14
15 /**
16 * Add the WPCode info to the admin bar.
17 *
18 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
19 */
20 public function add_admin_bar_info( $wp_admin_bar ) {
21 parent::add_admin_bar_info( $wp_admin_bar );
22
23 // Only show this on pages where the page scripts is an option.
24 if ( is_singular() ) {
25 $wp_admin_bar->add_menu(
26 array(
27 'id' => 'wpcode-page-scripts',
28 'parent' => 'wpcode-admin-bar-info',
29 'title' => esc_html__( 'Page Scripts', 'insert-headers-and-footers' ) . $this->get_pro_indicator(),
30 'meta' => array(
31 'class' => 'wpcode-admin-bar-has-upsell-submenu',
32 ),
33 )
34 );
35 $wp_admin_bar->add_menu(
36 array(
37 'id' => 'wpcode-page-scripts-upgrade',
38 'parent' => 'wpcode-page-scripts',
39 'meta' => array(
40 'class' => 'wpcode-admin-bar-upsell-submenu',
41 'html' => $this->get_upsell_markup(),
42 ),
43 )
44 );
45 }
46 }
47
48 /**
49 * Get the pro indicator.
50 *
51 * @return string
52 */
53 public function get_pro_indicator() {
54 return ' <span class="wpcode-pro-indicator">PRO</span>';
55 }
56
57 /**
58 * Add upgrade link to the admin bar.
59 *
60 * @param WP_Admin_Bar $wp_admin_bar The admin bar instance.
61 *
62 * @return void
63 */
64 public function add_admin_bar_quick_links( $wp_admin_bar ) {
65 parent::add_admin_bar_quick_links( $wp_admin_bar );
66
67 $wp_admin_bar->add_menu(
68 array(
69 'id' => 'wpcode-upgrade',
70 'parent' => 'wpcode-admin-bar-info',
71 'title' => esc_html__( 'Upgrade to Pro', 'insert-headers-and-footers' ),
72 'meta' => array(
73 'class' => 'wpcode-admin-bar-info-submenu',
74 'target' => '_blank',
75 'rel' => 'noopener noreferrer',
76 ),
77 'href' => wpcode_utm_url( 'https://wpcode.com/lite/', 'admin-bar', 'upgrade-to-pro' ),
78 )
79 );
80 }
81
82 /**
83 * Get the upsell markup.
84 *
85 * @return string
86 */
87 public function get_upsell_markup() {
88
89 $html = '<div class="wpcode-admin-bar-submenu-upsell">';
90
91 $html .= '<span class="wpcode-heading">' . esc_html__( 'Page Scripts is a Pro Feature', 'insert-headers-and-footers' ) . '</span>';
92 $html .= '<p>' . esc_html__( 'While you can always use global snippets, in the PRO version you can easily add page-specific scripts and snippets directly from the post edit screen.', 'insert-headers-and-footers' ) . '</p>';
93 $html .= '<a class="wpcode-button" href="' . esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'admin-bar', 'page-scripts' ) ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Upgrade to Pro and Unlock Page Scripts', 'insert-headers-and-footers' ) . '</a>';
94
95 $html .= '</div>';
96
97 return $html;
98 }
99
100 }