PluginProbe ʕ •ᴥ•ʔ
WP Chat App / 3.6.8
WP Chat App v3.6.8
3.8.1 3.8.2 trunk 2.6 3.4 3.4.1 3.4.2 3.4.4 3.4.5 3.4.6 3.5 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0
wp-whatsapp / includes / Shortcode.php
wp-whatsapp / includes Last commit date
Recommended 1 year ago Support 1 year ago Cross.php 1 year ago Fallback.php 1 year ago Fields.php 1 year ago Helper.php 1 year ago I18n.php 1 year ago Plugin.php 1 year ago Popup.php 1 year ago PostType.php 1 year ago Review.php 1 year ago Settings.php 1 year ago Shortcode.php 1 year ago Upgrade.php 1 year ago
Shortcode.php
49 lines
1 <?php
2 namespace NTA_WhatsApp;
3
4 use NTA_WhatsApp\Fields;
5
6 defined( 'ABSPATH' ) || exit;
7 class Shortcode {
8
9 protected static $instance = null;
10 protected $accountID;
11
12 public static function getInstance() {
13 if ( null === self::$instance ) {
14 self::$instance = new self();
15 self::$instance->doHooks();
16 }
17 return self::$instance;
18 }
19
20 private function doHooks() {
21 add_shortcode( 'njwa_button', array( $this, 'button_shortcode' ) );
22 }
23
24 public function button_shortcode( $id ) {
25 extract( $id );
26 $displayOption = Fields::getWidgetDisplay();
27 $stylesOption = Fields::getWidgetStyles();
28 $analyticsOption = Fields::getAnalyticsSetting();
29
30 $script = array(
31 'name' => get_the_title( $id ),
32 'info' => get_post_meta( $id, 'nta_wa_account_info', true ),
33 'styles' => Fields::getButtonStyles( $id ),
34 'avatar' => get_the_post_thumbnail_url( $id ),
35 'options' => array(
36 'display' => $displayOption,
37 'styles' => $stylesOption,
38 'analytics' => $analyticsOption,
39 ),
40 'gdprStatus' => Helper::checkGDPR( $stylesOption ),
41 'defaultAvatar' => NTA_WHATSAPP_PLUGIN_URL . 'assets/img/whatsapp_logo.svg',
42 );
43
44 $content = '<div class="nta_wa_button" data-id="' . esc_attr( $id ) . '" data-info="' . esc_attr( wp_json_encode( $script ) ) . '"></div>';
45
46 return $content;
47 }
48 }
49