| 1 |
<?php |
| 2 |
/** |
| 3 |
* Integration with Wpmet's shared UtilityPackage (cross-promotion admin menu) |
| 4 |
* |
| 5 |
* @package TableKit |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace TableBuilder\Libs; |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
use TableBuilderScopedDeps\Wpmet\UtilityPackage; |
| 13 |
|
| 14 |
/** |
| 15 |
* Registers the Wpmet cross-promotion admin menu. |
| 16 |
*/ |
| 17 |
class UtilityPackages { |
| 18 |
|
| 19 |
|
| 20 |
use \TableBuilder\Traits\Singleton; |
| 21 |
|
| 22 |
/** |
| 23 |
* UtilityPackages class constructor. |
| 24 |
* |
| 25 |
* Wires up the same Wpmet shared widgets GutenKit uses |
| 26 |
* (see gutenkit-blocks-addon/includes/Libs/UtilityPackages.php): |
| 27 |
* cross-promotion menu, dismissible Notice AJAX handler, the |
| 28 |
* Stories dashboard widget, the Banner ("jhanda") admin notice, |
| 29 |
* and the "ask for rating" prompt. |
| 30 |
* |
| 31 |
* @return void |
| 32 |
*/ |
| 33 |
public function __construct() { |
| 34 |
add_action( 'init', array( $this, 'register_cross_promotion_menu' ) ); |
| 35 |
|
| 36 |
// Powers the dismiss button on Banner/Notice widgets below. |
| 37 |
UtilityPackage\Notice\Notice::init(); |
| 38 |
|
| 39 |
// Show Wpmet stories widget in the Dashboard. |
| 40 |
UtilityPackage\Stories\Stories::instance( 'table-builder-block' ) |
| 41 |
->set_plugin( 'TableKit', 'https://wpmet.com/plugin/table-builder-block/' ) |
| 42 |
->set_api_url( 'https://api.wpmet.com/public/stories/' ) |
| 43 |
->call(); |
| 44 |
|
| 45 |
// Show Wpmet banner (codename: jhanda) on TableKit's own admin screens. |
| 46 |
UtilityPackage\Banner\Banner::instance( 'table-builder-block' ) |
| 47 |
->set_api_url( 'https://api.wpmet.com/public/jhanda' ) |
| 48 |
->set_plugin_screens( 'toplevel_page_tablebuilder' ) |
| 49 |
->call(); |
| 50 |
|
| 51 |
// Ask for a WordPress.org rating after the plugin has been in use for a while. |
| 52 |
UtilityPackage\Rating\Rating::instance( 'table-builder-block' ) |
| 53 |
->set_plugin_logo( 'https://ps.w.org/table-builder-block/assets/icon-128x128.png' ) |
| 54 |
->set_plugin( 'TableKit', 'https://wordpress.org/support/plugin/table-builder-block/reviews/#new-post' ) |
| 55 |
->set_allowed_screens( 'toplevel_page_tablebuilder' ) |
| 56 |
->set_priority( 30 ) |
| 57 |
->set_first_appear_day( 7 ) |
| 58 |
->set_condition( true ) |
| 59 |
->set_support_url( 'https://wpmet.com/support-ticket-form/' ) |
| 60 |
->call(); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Registers the "Our Plugins" cross-promotion submenu, listing Wpmet's |
| 65 |
* other plugins. Hooked to "init" (rather than passed as an inline |
| 66 |
* closure) so it stays removable via remove_action() if ever needed. |
| 67 |
* |
| 68 |
* @return void |
| 69 |
*/ |
| 70 |
public function register_cross_promotion_menu() { |
| 71 |
UtilityPackage\Plugins\Plugins::instance()->init( 'table-builder-block' ) |
| 72 |
->set_parent_menu_slug( 'tablebuilder' ) |
| 73 |
->set_submenu_name( |
| 74 |
esc_html__( 'Our Plugins', 'table-builder-block' ) |
| 75 |
) |
| 76 |
->set_section_title( |
| 77 |
esc_html__( 'Take Your WordPress Website To Next Level!', 'table-builder-block' ) |
| 78 |
) |
| 79 |
->set_section_description( |
| 80 |
esc_html__( 'Our diverse range of plugins has every solution for WordPress, Gutenberg, Elementor, and WooCommerce.', 'table-builder-block' ) |
| 81 |
) |
| 82 |
->set_items_per_row( 4 ) |
| 83 |
->set_plugins( |
| 84 |
array( |
| 85 |
'elementskit-lite/elementskit-lite.php' => array( |
| 86 |
'name' => esc_html__( 'ElementsKit', 'table-builder-block' ), |
| 87 |
'url' => 'https://wordpress.org/plugins/elementskit-lite/', |
| 88 |
'icon' => 'https://ps.w.org/elementskit-lite/assets/icon-256x256.gif?rev=2518175', |
| 89 |
'desc' => esc_html__( 'All-in-one Elementor addon trusted by 1 Million+ users, makes your website builder process easier with ultimate freedom.', 'table-builder-block' ), |
| 90 |
'docs' => 'https://wpmet.com/docs/elementskit/', |
| 91 |
), |
| 92 |
'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => array( |
| 93 |
'name' => esc_html__( 'GutenKit', 'table-builder-block' ), |
| 94 |
'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/', |
| 95 |
'icon' => 'https://ps.w.org/gutenkit-blocks-addon/assets/icon-256x256.gif?rev=2518175', |
| 96 |
'desc' => esc_html__( 'Page Builder Blocks, Patterns, and Templates for Gutenberg Block Editor.', 'table-builder-block' ), |
| 97 |
'docs' => 'https://wpmet.com/docs/gutenkit/', |
| 98 |
), |
| 99 |
'popup-builder-block/popup-builder-block.php' => array( |
| 100 |
'name' => esc_html__( 'PopupKit', 'table-builder-block' ), |
| 101 |
'url' => 'https://wordpress.org/plugins/popup-builder-block/', |
| 102 |
'icon' => 'https://ps.w.org/popup-builder-block/assets/icon-128x128.png?rev=3330842', |
| 103 |
'desc' => esc_html__( 'Create stunning popups with ease using our drag-and-drop builder, pre-designed templates, and advanced targeting options.', 'table-builder-block' ), |
| 104 |
'docs' => 'https://wpmet.com/doc/popupkit/', |
| 105 |
), |
| 106 |
'getgenie/getgenie.php' => array( |
| 107 |
'name' => esc_html__( 'GetGenie AI', 'table-builder-block' ), |
| 108 |
'url' => 'https://wordpress.org/plugins/getgenie/', |
| 109 |
'icon' => 'https://ps.w.org/getgenie/assets/icon-256x256.gif?rev=2798355', |
| 110 |
'desc' => esc_html__( 'Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', 'table-builder-block' ), |
| 111 |
'docs' => 'https://getgenie.ai/docs/', |
| 112 |
), |
| 113 |
'shopengine/shopengine.php' => array( |
| 114 |
'name' => esc_html__( 'ShopEngine', 'table-builder-block' ), |
| 115 |
'url' => 'https://wordpress.org/plugins/shopengine/', |
| 116 |
'icon' => 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', |
| 117 |
'desc' => esc_html__( 'Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.', 'table-builder-block' ), |
| 118 |
'docs' => 'https://wpmet.com/doc/shopengine/', |
| 119 |
), |
| 120 |
'metform/metform.php' => array( |
| 121 |
'name' => esc_html__( 'MetForm', 'table-builder-block' ), |
| 122 |
'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 123 |
'icon' => 'https://ps.w.org/metform/assets/icon-256x256.png?rev=2544152', |
| 124 |
'desc' => esc_html__( 'Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more - smoother, faster, and better!', 'table-builder-block' ), |
| 125 |
'docs' => 'https://wpmet.com/doc/metform/', |
| 126 |
), |
| 127 |
'emailkit/EmailKit.php' => array( |
| 128 |
'name' => esc_html__( 'EmailKit', 'table-builder-block' ), |
| 129 |
'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 130 |
'icon' => 'https://ps.w.org/emailkit/assets/icon-256x256.png?rev=3003571', |
| 131 |
'desc' => esc_html__( 'Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'table-builder-block' ), |
| 132 |
'docs' => 'https://wpmet.com/doc/emailkit/', |
| 133 |
), |
| 134 |
'wp-social/wp-social.php' => array( |
| 135 |
'name' => esc_html__( 'WP Social', 'table-builder-block' ), |
| 136 |
'url' => 'https://wordpress.org/plugins/wp-social/', |
| 137 |
'icon' => 'https://ps.w.org/wp-social/assets/icon-256x256.png?rev=2544214', |
| 138 |
'desc' => esc_html__( 'Add social share, login, and engagement counter - unified solution for all social media with tons of different styles for your website.', 'table-builder-block' ), |
| 139 |
'docs' => 'https://wpmet.com/doc/wp-social/', |
| 140 |
), |
| 141 |
'wp-ultimate-review/wp-ultimate-review.php' => array( |
| 142 |
'name' => esc_html__( 'WP Ultimate Review', 'table-builder-block' ), |
| 143 |
'url' => 'https://wordpress.org/plugins/wp-ultimate-review/', |
| 144 |
'icon' => 'https://ps.w.org/wp-ultimate-review/assets/icon-256x256.png?rev=2544187', |
| 145 |
'desc' => esc_html__( 'Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.', 'table-builder-block' ), |
| 146 |
'docs' => 'https://wpmet.com/doc/wp-ultimate-review/', |
| 147 |
), |
| 148 |
'wp-fundraising-donation/wp-fundraising.php' => array( |
| 149 |
'name' => esc_html__( 'FundEngine', 'table-builder-block' ), |
| 150 |
'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/', |
| 151 |
'icon' => 'https://ps.w.org/wp-fundraising-donation/assets/icon-256x256.png?rev=2544150', |
| 152 |
'desc' => esc_html__( 'Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', 'table-builder-block' ), |
| 153 |
'docs' => 'https://wpmet.com/doc/fundengine/', |
| 154 |
), |
| 155 |
'blocks-for-shopengine/shopengine-gutenberg-addon.php' => array( |
| 156 |
'name' => esc_html__( 'Blocks for ShopEngine', 'table-builder-block' ), |
| 157 |
'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/', |
| 158 |
'icon' => 'https://ps.w.org/blocks-for-shopengine/assets/icon-256x256.gif?rev=2702483', |
| 159 |
'desc' => esc_html__( 'All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'table-builder-block' ), |
| 160 |
'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/', |
| 161 |
), |
| 162 |
'genie-image-ai/genie-image-ai.php' => array( |
| 163 |
'name' => esc_html__( 'Genie Image', 'table-builder-block' ), |
| 164 |
'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 165 |
'icon' => 'https://ps.w.org/genie-image-ai/assets/icon-256x256.png?rev=2977297', |
| 166 |
'desc' => esc_html__( 'AI-powered text-to-image generator for WordPress with OpenAI\'s DALL-E 2 technology to generate high-quality images in one click.', 'table-builder-block' ), |
| 167 |
'docs' => 'https://getgenie.ai/docs/', |
| 168 |
), |
| 169 |
) |
| 170 |
) |
| 171 |
->call(); |
| 172 |
} |
| 173 |
} |
| 174 |
|