Controls
1 month ago
Tabs
1 month ago
CTF_Db.php
1 month ago
CTF_Feed_Builder.php
1 month ago
CTF_Feed_Saver.php
1 month ago
CTF_Feed_Saver_Manager.php
1 month ago
CTF_Post_Set.php
1 month ago
CTF_Theme_CSS.php
1 month ago
CTF_Tooltip_Wizard.php
1 month ago
SB_Builder_Customizer.php
1 month ago
CTF_Tooltip_Wizard.php
140 lines
| 1 | <?php |
| 2 | /** |
| 3 | * SBI Tooltip Wizard |
| 4 | * |
| 5 | * |
| 6 | * @since 2.0 |
| 7 | */ |
| 8 | namespace TwitterFeed\Builder; |
| 9 | |
| 10 | class CTF_Tooltip_Wizard { |
| 11 | |
| 12 | /** |
| 13 | * Constructor. |
| 14 | * |
| 15 | * @since 2.0 |
| 16 | */ |
| 17 | function __construct(){ |
| 18 | $this->init(); |
| 19 | } |
| 20 | |
| 21 | |
| 22 | /** |
| 23 | * Initialize class. |
| 24 | * |
| 25 | * @since 2.0 |
| 26 | */ |
| 27 | public function init() { |
| 28 | /* |
| 29 | if ( |
| 30 | ! wpforms_is_admin_page( 'builder' ) && |
| 31 | ! wp_doing_ajax() && |
| 32 | ! $this->is_form_embed_page() |
| 33 | ) { |
| 34 | return; |
| 35 | } |
| 36 | */ |
| 37 | |
| 38 | $this->hooks(); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Register hooks. |
| 43 | * |
| 44 | * @since 2.0 |
| 45 | */ |
| 46 | public function hooks() { |
| 47 | add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] ); |
| 48 | add_action( 'admin_footer', [ $this, 'output' ] ); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * Enqueue assets. |
| 54 | * |
| 55 | * @since 2.0 |
| 56 | */ |
| 57 | public function enqueues() { |
| 58 | |
| 59 | wp_enqueue_style( |
| 60 | 'ctf_tooltipster', |
| 61 | CTF_PLUGIN_URL . 'admin/builder/assets/css/tooltipster.css', |
| 62 | null, |
| 63 | CTF_VERSION |
| 64 | ); |
| 65 | |
| 66 | wp_enqueue_script( |
| 67 | 'ctf_tooltipster', |
| 68 | CTF_PLUGIN_URL . 'admin/builder/assets/js/jquery.tooltipster.min.js', |
| 69 | [ 'jquery' ], |
| 70 | CTF_VERSION, |
| 71 | true |
| 72 | ); |
| 73 | |
| 74 | wp_enqueue_script( |
| 75 | 'ctf-admin-tooltip-wizard', |
| 76 | CTF_PLUGIN_URL . 'admin/builder/assets/js/tooltip-wizard.js', |
| 77 | [ 'jquery' ], |
| 78 | CTF_VERSION |
| 79 | ); |
| 80 | |
| 81 | $wp_localize_data = []; |
| 82 | if( $this->check_gutenberg_wizard() ){ |
| 83 | $wp_localize_data['ctf_wizard_gutenberg'] = true; |
| 84 | } |
| 85 | |
| 86 | wp_localize_script( |
| 87 | 'ctf-admin-tooltip-wizard', |
| 88 | 'ctf_admin_tooltip_wizard', |
| 89 | $wp_localize_data |
| 90 | ); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Output HTML. |
| 95 | * |
| 96 | * @since 2.0 |
| 97 | */ |
| 98 | public function output() { |
| 99 | if( $this->check_gutenberg_wizard() ){ |
| 100 | $this->gutenberg_tooltip_output(); |
| 101 | } |
| 102 | |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Gutenberg Tooltip Output HTML. |
| 107 | * |
| 108 | * @since 2.0 |
| 109 | */ |
| 110 | public function check_gutenberg_wizard() { |
| 111 | global $pagenow; |
| 112 | return ( ( $pagenow == 'post.php' ) || (get_post_type() == 'page') ) |
| 113 | && ! empty( $_GET['ctf_wizard'] ); |
| 114 | } |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * Gutenberg Tooltip Output HTML. |
| 119 | * |
| 120 | * @since 2.0 |
| 121 | */ |
| 122 | public function gutenberg_tooltip_output() { |
| 123 | ?> |
| 124 | <div id="ctf-gutenberg-tooltip-content"> |
| 125 | <div class="ctf-tlp-wizard-cls ctf-tlp-wizard-close"></div> |
| 126 | <div class="ctf-tlp-wizard-content"> |
| 127 | <strong class="ctf-tooltip-wizard-head"><?php echo __('Add a Block','custom-twitter-feeds') ?></strong> |
| 128 | <p class="ctf-tooltip-wizard-txt"><?php echo __('Click the plus button, search for Custom Twitter Feed','custom-twitter-feeds'); ?> |
| 129 | <br/><?php echo __('Feed, and click the block to embed it.','custom-twitter-feeds') ?> <a href="https://smashballoon.com/doc/wordpress-5-block-page-editor-gutenberg/?twitter&utm_campaign=twitter-free&utm_source=settings&utm_medium=docs" rel="noopener" target="_blank" rel="nofollow noopener"><?php echo __('Learn More','custom-twitter-feeds') ?></a></p> |
| 130 | <div class="ctf-tooltip-wizard-actions"> |
| 131 | <button class="ctf-tlp-wizard-close"><?php echo __('Done','custom-twitter-feeds') ?></button> |
| 132 | </div> |
| 133 | </div> |
| 134 | </div> |
| 135 | <?php |
| 136 | } |
| 137 | |
| 138 | |
| 139 | } |
| 140 |