PluginProbe
Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More / 1.0.8
Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More v1.0.8
trunk 1.0.0 1.0.1 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
search-replace-wpcode / includes / lite / admin / notices.php

notices.php in Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More 1.0.8, at includes/lite/admin/notices.php

105 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Lite-specific admin notices.
4 */
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 add_action( 'wsrw_admin_page', 'wsrw_maybe_add_lite_top_bar_notice', 4 );
11 add_action( 'wsrw_admin_page_content_wsrw-search-replace', 'wsrw_upsell_notice', 250 );
12
13 /**
14 * Add a notice to consider more features with offer.
15 *
16 * @return void
17 */
18 function wsrw_maybe_add_lite_top_bar_notice() {
19
20 // Only add this to the WSRW pages.
21 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
22 $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
23
24 if ( ! $page || 0 !== strpos( $page, 'wsrw' ) ) {
25 return;
26 }
27
28 $screen = get_current_screen();
29
30 $upgrade_url = wsrw_utm_url(
31 'https://wpcode.com/srlite/',
32 'top-notice',
33 $screen
34 );
35
36 WSRW_Notice::top(
37 sprintf(
38 // Translators: %1$s and %2$s add a link to the upgrade page. %3$s and %4$s make the text bold.
39 __( '%3$sYou\'re using Search & Replace Everything Lite%4$s. To unlock more features consider %1$supgrading to Pro%2$s.', 'search-replace-wpcode' ),
40 '<a href="' . $upgrade_url . '" target="_blank" rel="noopener noreferrer">',
41 '</a>',
42 '<strong>',
43 '</strong>'
44 ),
45 array(
46 'dismiss' => WSRW_Notice::DISMISS_USER,
47 'slug' => 'consider-upgrading',
48 )
49 );
50 }
51
52 /**
53 * Show a notice with more features at the bottom of the main page.
54 *
55 * @return void
56 */
57 function wsrw_upsell_notice( $page_instance ) {
58
59 $view = $page_instance->view;
60 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
61 if ( 'search_replace' !== $view && ! isset( $_GET['media_id'] ) ) {
62 return;
63 }
64
65 $html = '<h3>' . esc_html__( 'Get Search & Replace Everything Pro and Unlock all the Powerful Features', 'search-replace-wpcode' ) . '</h3>';
66 $html .= '<div class="wsrw-features-list">';
67 $html .= '<ul>';
68 $html .= '<li>' . esc_html__( 'Replace any text with confidence knowing you can 1-click undo.', 'search-replace-wpcode' ) . '</li>';
69 $html .= '<li>' . esc_html__( 'Save time by replacing images directly from the Gutenberg Editor.', 'search-replace-wpcode' ) . '</li>';
70 $html .= '<li>' . esc_html__( 'Scan your website for unused media files and safely delete them.', 'search-replace-wpcode' ) . '</li>';
71 $html .= '</ul>';
72 $html .= '<ul>';
73 $html .= '<li>' . esc_html__( 'Replace with precision by being able to choose which results to skip.', 'search-replace-wpcode' ) . '</li>';
74 $html .= '<li>' . esc_html__( 'Track back results by viewing the full context of search results.', 'search-replace-wpcode' ) . '</li>';
75 $html .= '<li>' . esc_html__( 'Replace images with different extensions across your whole website.', 'search-replace-wpcode' ) . '</li>';
76 $html .= '</ul>';
77 $html .= '</div>';
78 $html .= sprintf(
79 '<p><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a></p>',
80 wsrw_utm_url( 'https://wpcode.com/srlite/', 'upsell-notice', $view ),
81 esc_html__( 'Get Search & Replace Everything Pro Today and Unlock all the Powerful Features »', 'search-replace-wpcode' )
82 );
83 $html .= '<p>';
84 $html .= sprintf(
85 // Translators: Placeholders make the text bold.
86 esc_html__( '%1$sBonus:%2$s Search & Replace Everything Lite users get %3$s$30 off regular price%4$s, automatically applied at checkout', 'search-replace-wpcode' ),
87 '<strong>',
88 '</strong>',
89 '<strong style="color:#59A56D;">',
90 '</strong>'
91 );
92 $html .= '</p>';
93
94 // Add our custom notice for this page.
95 WSRW_Notice::info(
96 $html,
97 array(
98 'slug' => 'wsrw-snippets',
99 'dismiss' => WSRW_Notice::DISMISS_USER,
100 )
101 );
102 // Display notice we just added so that scripts are loaded.
103 wsrw_main()->notice->display();
104 }
105