PluginProbe ʕ •ᴥ•ʔ
WP Chat App / 3.8.2
WP Chat App v3.8.2
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
Support 2 months ago Cross.php 2 months ago Fallback.php 2 months ago Fields.php 2 months ago Helper.php 2 months ago I18n.php 2 months ago Plugin.php 2 months ago Popup.php 2 months ago PostType.php 2 months ago Review.php 2 months ago Settings.php 2 months ago Shortcode.php 2 months ago Upgrade.php 2 months 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