: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
require_once(dirname(__FILE__).'/SGPopup.php');
class FblikePopup extends SGPopup
public function getOptionValue($optionName, $forceDefaultValue = false)
return parent::getOptionValue($optionName, $forceDefaultValue);
public function getPopupTypeOptionsView()
'filePath' => SG_POPUP_TYPE_OPTIONS_PATH.'facebook.php',
'metaboxTitle' => __('Facebook Settings', 'popup-builder'),
'short_description' => 'Select your Facebook page URL for liking and sharing it'
private function getScripts()
/*get WordPress localization name*/
$locale = $this->getSiteLocale();
jQuery(window).on('sgpbDidOpen', function (e) {
var sgpbOldCB = window.fbAsyncInit;
window.fbAsyncInit = function () {
if (typeof sgpbOldCB === 'function') {
appId: <?php echo esc_html(SGPB_FACEBOOK_APP_ID);?>
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = '<?php echo esc_url('https://connect.facebook.net/'. esc_html( $locale ).'/all.js#xfbml=1&version=v2.11&appId='. esc_html(SGPB_FACEBOOK_APP_ID));?>';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
$scripts = ob_get_contents();
private function getButtonConfig($shareUrl, $layout, $shareButtonStatus)
<div class='sg-fb-buttons-wrapper sgpb-fb-wrapper-<?php echo esc_html( $layout );?>'>
data-href="<?php echo esc_url( $shareUrl ); ?>"
data-layout="<?php echo esc_attr( $layout ); ?>"
data-share="<?php echo esc_attr( $shareButtonStatus ); ?>">
$buttonConfig = ob_get_contents();
private function getFblikeContent()
$options = $this->getOptions();
$shareUrl = $options['sgpb-fblike-like-url'];
$layout = $options['sgpb-fblike-layout'];
$shareButtonStatus = true;
if (!empty($options['sgpb-fblike-dont-show-share-button'])) {
$shareButtonStatus = false;
$scripts = $this->getScripts();
$buttonConfig = $this->getButtonConfig($shareUrl, $layout, $shareButtonStatus);
<div id="sg-facebook-like">
<?php echo wp_kses_post($buttonConfig); ?>
echo $scripts; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$content = ob_get_contents();
public function getPopupTypeContent()
$fbLikeContent = $this->getFblikeContent();
$popupContent = $this->getContent();
$popupContent .= $fbLikeContent;
public function getExtraRenderOptions()