Admin
1 month ago
Builder
6 days ago
Customizer
6 days ago
Exceptions
6 months ago
Helpers
2 months ago
Integrations
6 days ago
Migrations
3 years ago
ReviewAlerts
3 weeks ago
Services
6 days ago
Settings
6 days ago
Support
3 months ago
Traits
1 month ago
UsageTracking
6 days ago
Utils
2 months ago
AuthorizationStatusCheck.php
1 month ago
BusinessDataCache.php
6 months ago
Clear_Cache.php
3 months ago
Container.php
6 months ago
DisplayElements.php
2 months ago
Email_Notification.php
6 months ago
Error_Reporter.php
3 months ago
Feed.php
3 weeks ago
FeedCache.php
5 months ago
FeedCacheUpdater.php
3 months ago
FeedDisplay.php
1 month ago
Feed_Locator.php
6 months ago
Parser.php
3 weeks ago
PostAggregator.php
2 months ago
RemoteRequest.php
6 days ago
SBR_Education.php
3 months ago
SBR_Schema_Service.php
3 weeks ago
SBR_Settings.php
6 months ago
ServiceContainer.php
6 days ago
SinglePostCache.php
3 weeks ago
TemplateRenderer.php
6 months ago
Tooltip_Wizard.php
1 month ago
Util.php
6 days ago
Tooltip_Wizard.php
148 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * SBR Tooltip Wizard |
| 5 | * |
| 6 | * @since 1.0 |
| 7 | */ |
| 8 | |
| 9 | namespace SmashBalloon\Reviews\Common; |
| 10 | |
| 11 | if (! defined('ABSPATH')) { |
| 12 | exit; |
| 13 | } |
| 14 | |
| 15 | use Smashballoon\Stubs\Services\ServiceProvider; |
| 16 | |
| 17 | class Tooltip_Wizard extends ServiceProvider |
| 18 | { |
| 19 | public function register() |
| 20 | { |
| 21 | $this->init(); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Initialize class. |
| 26 | * |
| 27 | * @since 1.0 |
| 28 | */ |
| 29 | public function init() |
| 30 | { |
| 31 | |
| 32 | $this->hooks(); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Register hooks. |
| 37 | * |
| 38 | * @since 1.0 |
| 39 | */ |
| 40 | public function hooks() |
| 41 | { |
| 42 | add_action('admin_enqueue_scripts', [$this, 'enqueues']); |
| 43 | add_action('admin_footer', [$this, 'output']); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | * Enqueue assets. |
| 49 | * |
| 50 | * @since 1.0 |
| 51 | */ |
| 52 | public function enqueues() |
| 53 | { |
| 54 | |
| 55 | wp_enqueue_style( |
| 56 | 'sbr-tooltipster-css', |
| 57 | SBR_PLUGIN_URL . 'assets/admin/css/tooltipster.css', |
| 58 | null, |
| 59 | SBRVER |
| 60 | ); |
| 61 | |
| 62 | wp_enqueue_script( |
| 63 | 'sbr-tooltipster-js', |
| 64 | SBR_PLUGIN_URL . 'assets/admin/js/jquery.tooltipster.min.js', |
| 65 | ['jquery'], |
| 66 | SBRVER, |
| 67 | true |
| 68 | ); |
| 69 | |
| 70 | wp_enqueue_script( |
| 71 | 'sbr-admin-tooltip-wizard', |
| 72 | SBR_PLUGIN_URL . 'assets/admin/js/tooltip-wizard.js', |
| 73 | ['jquery'], |
| 74 | SBRVER |
| 75 | ); |
| 76 | |
| 77 | $wp_localize_data = []; |
| 78 | if ($this->check_gutenberg_wizard()) { |
| 79 | $wp_localize_data['sbr_wizard_gutenberg'] = true; |
| 80 | } |
| 81 | |
| 82 | wp_localize_script( |
| 83 | 'sbr-admin-tooltip-wizard', |
| 84 | 'sbr_admin_tooltip_wizard', |
| 85 | $wp_localize_data |
| 86 | ); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Output HTML. |
| 91 | * |
| 92 | * @since 1.0 |
| 93 | */ |
| 94 | public function output() |
| 95 | { |
| 96 | if ($this->check_gutenberg_wizard()) { |
| 97 | $this->gutenberg_tooltip_output(); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Gutenberg Tooltip Output HTML. |
| 103 | * |
| 104 | * @since 1.0 |
| 105 | */ |
| 106 | public function check_gutenberg_wizard() |
| 107 | { |
| 108 | global $pagenow; |
| 109 | return (($pagenow == 'post.php') || (get_post_type() == 'page')) |
| 110 | && !empty($_GET['sbr_wizard']); |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /** |
| 115 | * Gutenberg Tooltip Output HTML. |
| 116 | * |
| 117 | * @since 1.0 |
| 118 | */ |
| 119 | public function gutenberg_tooltip_output() |
| 120 | { |
| 121 | ?> |
| 122 | <div id="sbr-gutenberg-tooltip-content"> |
| 123 | <button type="button" class="sbr-tlp-wizard-cls sbr-tlp-wizard-close" aria-label="<?php echo esc_attr__('Close', 'reviews-feed'); ?>"></button> |
| 124 | <div class="sbr-tlp-wizard-content"> |
| 125 | <strong class="sbr-tooltip-wizard-head"> |
| 126 | <?php echo esc_html__('Add a Block', 'reviews-feed') ?> |
| 127 | </strong> |
| 128 | <p class="sbr-tooltip-wizard-txt"> |
| 129 | <?php echo esc_html__('Click the plus button, search for Reviews Feed', 'reviews-feed'); ?> |
| 130 | <br /> |
| 131 | <?php echo esc_html__('and click the block to embed it.', 'reviews-feed') ?> <a |
| 132 | href="https://smashballoon.com/doc/wordpress-5-block-page-editor-gutenberg/?facebook&utm_campaign=reviews-free&utm_source=settings&utm_medium=docs" rel="noopener" |
| 133 | target="_blank"> |
| 134 | <?php echo esc_html__('Learn More', 'reviews-feed') ?> |
| 135 | </a> |
| 136 | </p> |
| 137 | <div class="sbr-tooltip-wizard-actions"> |
| 138 | <button class="sbr-tlp-wizard-close"> |
| 139 | <?php echo esc_html__('Done', 'reviews-feed') ?> |
| 140 | </button> |
| 141 | </div> |
| 142 | </div> |
| 143 | </div> |
| 144 | <?php |
| 145 | } |
| 146 | |
| 147 | |
| 148 | } |