function fbmcc_inject_messenger()

in fb-messenger-customer-chat.php [141:168]


  function fbmcc_inject_messenger() {
    if( !get_option( 'fbmcc_pageID' ) ||
        get_option( 'fbmcc_pageID' ) == '' ) {
      return;
    }

    if( $this->fbmcc_should_display() ) {
      $genCode = "";
      $genCode .= "
        <div id='fb-root'></div>
          <script>(function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            js = d.createElement(s); js.id = id;
            js.src = 'https://connect.facebook.net/".fbmcc_sanitize_locale(get_option( 'fbmcc_locale' ))."/sdk/xfbml.customerchat.js#xfbml=1&version=v6.0&autoLogAppEvents=1';
            fjs.parentNode.insertBefore(js, fjs);
          }(document, 'script', 'facebook-jssdk'));</script>
          <div class='fb-customerchat'
            attribution='wordpress'
            attribution_version='1.8'
            page_id=".fbmcc_sanitize_page_id(get_option( 'fbmcc_pageID' ))."
          >
        </div>
        ";
    } else {
      $genCode = "<!-- fbmcc-config-disabled -->\n";
    }
    _e($genCode);
  }