: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* detect and include popup styles to the admin pages
public static function enqueueStyles($hook)
$popupType = AdminHelper::getCurrentPopupType();
$currentPostType = AdminHelper::getCurrentPostType();
if($hook == SG_POPUP_POST_TYPE.'_page_'.SG_POPUP_POST_TYPE) {
else if (($hook == 'post-new.php' || $hook == 'post.php') && $currentPostType == SG_POPUP_POST_TYPE) {
else if ($hook == 'edit.php' && !empty($currentPostType) && $currentPostType == SG_POPUP_POST_TYPE) {
$pageName = 'popupspage';
else if ($hook == SG_POPUP_POST_TYPE.'_page_'.SG_POPUP_SUBSCRIBERS_PAGE) {
$pageName = SG_POPUP_SUBSCRIBERS_PAGE;
$registeredPlugins = AdminHelper::getOption(SGPB_POPUP_BUILDER_REGISTERED_PLUGINS);
if (!$registeredPlugins) {
$registeredPlugins = json_decode($registeredPlugins, true);
if (empty($registeredPlugins)) {
foreach ($registeredPlugins as $pluginName => $pluginData) {
if (!is_plugin_active($pluginName)) {
if (empty($pluginData['classPath']) || empty($pluginData['className'])) {
$classPath = $pluginData['classPath'];
$classPath = SG_POPUP_PLUGIN_PATH.$classPath;
if (!file_exists($classPath)) {
require_once($classPath);
if (!class_exists($pluginData['className'])) {
$classObj = new $pluginData['className']();
if (!$classObj instanceof \SgpbIPopupExtension) {
'popupType' => $popupType
$styleData = $classObj->getStyles($pageName , $args);
if (!empty($styleData['cssFiles'])) {
foreach ($styles as $style) {
if (empty($style['cssFiles'])) {
foreach ($style['cssFiles'] as $cssFile) {
if (empty($cssFile['folderUrl'])) {
ScriptsIncluder::enqueueStyle($cssFile['filename']);
$dirUrl = $cssFile['folderUrl'];
$dep = (!empty($cssFile['dep'])) ? $cssFile['dep'] : '';
$ver = (!empty($cssFile['ver'])) ? $cssFile['ver'] : '';
$inFooter = (!empty($cssFile['inFooter'])) ? $cssFile['inFooter'] : '';;
ScriptsIncluder::registerStyle($cssFile['filename'], array(
ScriptsIncluder::enqueueStyle($cssFile['filename']);
if ($hook == SG_POPUP_POST_TYPE.'_page_'.SG_POPUP_POST_TYPE) {
ScriptsIncluder::enqueueStyle('popupAdminStyles.css');