: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'America/Guatemala' => '(GMT-06:00) Guatemala',
'America/Managua' => '(GMT-06:00) Managua',
'America/Mexico_City' => '(GMT-06:00) Central Time - Mexico City',
'America/Regina' => '(GMT-06:00) Central Time - Regina',
'America/Tegucigalpa' => '(GMT-06:00) Central Time - Tegucigalpa',
'America/Winnipeg' => '(GMT-06:00) Central Time - Winnipeg',
'Pacific/Easter' => '(GMT-06:00) Easter Island',
'Pacific/Galapagos' => '(GMT-06:00) Galapagos',
'America/Bogota' => '(GMT-05:00) Bogota',
'America/Cayman' => '(GMT-05:00) Cayman',
'America/Guayaquil' => '(GMT-05:00) Guayaquil',
'America/Havana' => '(GMT-05:00) Havana',
'America/Iqaluit' => '(GMT-05:00) Eastern Time - Iqaluit',
'America/Jamaica' => '(GMT-05:00) Jamaica',
'America/Lima' => '(GMT-05:00) Lima',
'America/Montreal' => '(GMT-05:00) Eastern Time - Montreal',
'America/Nassau' => '(GMT-05:00) Nassau',
'America/New_York' => '(GMT-05:00) Eastern Time',
'America/Panama' => '(GMT-05:00) Panama',
'America/Port-au-Prince' => '(GMT-05:00) Port-au-Prince',
'America/Rio_Branco' => '(GMT-05:00) Rio Branco',
'America/Toronto' => '(GMT-05:00) Eastern Time - Toronto',
'America/Caracas' => '(GMT-04:30) Caracas',
'America/Antigua' => '(GMT-04:00) Antigua',
'America/Asuncion' => '(GMT-04:00) Asuncion',
'America/Barbados' => '(GMT-04:00) Barbados',
'America/Boa_Vista' => '(GMT-04:00) Boa Vista',
'America/Campo_Grande' => '(GMT-04:00) Campo Grande',
'America/Cuiaba' => '(GMT-04:00) Cuiaba',
'America/Curacao' => '(GMT-04:00) Curacao',
'America/Grand_Turk' => '(GMT-04:00) Grand Turk',
'America/Guyana' => '(GMT-04:00) Guyana',
'America/Halifax' => '(GMT-04:00) Atlantic Time - Halifax',
'America/La_Paz' => '(GMT-04:00) La Paz',
'America/Manaus' => '(GMT-04:00) Manaus',
'America/Martinique' => '(GMT-04:00) Martinique',
'America/Port_of_Spain' => '(GMT-04:00) Port of Spain',
'America/Porto_Velho' => '(GMT-04:00) Porto Velho',
'America/Puerto_Rico' => '(GMT-04:00) Puerto Rico',
'America/Santiago' => '(GMT-04:00) Santiago',
'America/Santo_Domingo' => '(GMT-04:00) Santo Domingo',
'America/Thule' => '(GMT-04:00) Thule',
'Antarctica/Palmer' => '(GMT-04:00) Palmer',
'Atlantic/Bermuda' => '(GMT-04:00) Bermuda',
'America/St_Johns' => '(GMT-03:30) Newfoundland Time - St. Johns',
'America/Araguaina' => '(GMT-03:00) Araguaina',
'America/Argentina/Buenos_Aires' => '(GMT-03:00) Buenos Aires',
'America/Bahia' => '(GMT-03:00) Salvador',
'America/Belem' => '(GMT-03:00) Belem',
'America/Cayenne' => '(GMT-03:00) Cayenne',
'America/Fortaleza' => '(GMT-03:00) Fortaleza',
'America/Godthab' => '(GMT-03:00) Godthab',
'America/Maceio' => '(GMT-03:00) Maceio',
'America/Miquelon' => '(GMT-03:00) Miquelon',
'America/Montevideo' => '(GMT-03:00) Montevideo',
'America/Paramaribo' => '(GMT-03:00) Paramaribo',
'America/Recife' => '(GMT-03:00) Recife',
'America/Sao_Paulo' => '(GMT-03:00) Sao Paulo',
'Antarctica/Rothera' => '(GMT-03:00) Rothera',
'Atlantic/Stanley' => '(GMT-03:00) Stanley',
'America/Noronha' => '(GMT-02:00) Noronha',
'Atlantic/South_Georgia' => '(GMT-02:00) South Georgia',
'America/Scoresbysund' => '(GMT-01:00) Scoresbysund',
'Atlantic/Azores' => '(GMT-01:00) Azores',
'Atlantic/Cape_Verde' => '(GMT-01:00) Cape Verde',
'Africa/Abidjan' => '(GMT+00:00) Abidjan',
'Africa/Accra' => '(GMT+00:00) Accra',
'Africa/Bissau' => '(GMT+00:00) Bissau',
'Africa/Casablanca' => '(GMT+00:00) Casablanca',
'Africa/El_Aaiun' => '(GMT+00:00) El Aaiun',
'Africa/Monrovia' => '(GMT+00:00) Monrovia',
'America/Danmarkshavn' => '(GMT+00:00) Danmarkshavn',
'Atlantic/Canary' => '(GMT+00:00) Canary Islands',
'Atlantic/Faroe' => '(GMT+00:00) Faeroe',
'Atlantic/Reykjavik' => '(GMT+00:00) Reykjavik',
'Etc/GMT' => '(GMT+00:00) GMT (no daylight saving)',
'Europe/Dublin' => '(GMT+00:00) Dublin',
'Europe/Lisbon' => '(GMT+00:00) Lisbon',
'Europe/London' => '(GMT+00:00) London',
'Africa/Algiers' => '(GMT+01:00) Algiers',
'Africa/Ceuta' => '(GMT+01:00) Ceuta',
'Africa/Lagos' => '(GMT+01:00) Lagos',
'Africa/Ndjamena' => '(GMT+01:00) Ndjamena',
'Africa/Tunis' => '(GMT+01:00) Tunis',
'Africa/Windhoek' => '(GMT+01:00) Windhoek',
'Europe/Amsterdam' => '(GMT+01:00) Amsterdam',
'Europe/Andorra' => '(GMT+01:00) Andorra',
'Europe/Belgrade' => '(GMT+01:00) Central European Time - Belgrade',
'Europe/Berlin' => '(GMT+01:00) Berlin',
'Europe/Brussels' => '(GMT+01:00) Brussels',
'Europe/Budapest' => '(GMT+01:00) Budapest',
'Europe/Copenhagen' => '(GMT+01:00) Copenhagen',
'Europe/Gibraltar' => '(GMT+01:00) Gibraltar',
'Europe/Luxembourg' => '(GMT+01:00) Luxembourg',
'Europe/Madrid' => '(GMT+01:00) Madrid',
'Europe/Malta' => '(GMT+01:00) Malta',
'Europe/Monaco' => '(GMT+01:00) Monaco',
'Europe/Oslo' => '(GMT+01:00) Oslo',
'Europe/Paris' => '(GMT+01:00) Paris',
'Europe/Prague' => '(GMT+01:00) Central European Time - Prague',
'Europe/Rome' => '(GMT+01:00) Rome',
'Europe/Stockholm' => '(GMT+01:00) Stockholm',
'Europe/Tirane' => '(GMT+01:00) Tirane',
'Europe/Vienna' => '(GMT+01:00) Vienna',
'Europe/Warsaw' => '(GMT+01:00) Warsaw',
'Europe/Zurich' => '(GMT+01:00) Zurich',
'Africa/Cairo' => '(GMT+02:00) Cairo',
'Africa/Johannesburg' => '(GMT+02:00) Johannesburg',
'Africa/Maputo' => '(GMT+02:00) Maputo',
'Africa/Tripoli' => '(GMT+02:00) Tripoli',
'Asia/Amman' => '(GMT+02:00) Amman',
'Asia/Beirut' => '(GMT+02:00) Beirut',
'Asia/Damascus' => '(GMT+02:00) Damascus',
'Asia/Gaza' => '(GMT+02:00) Gaza',
'Asia/Jerusalem' => '(GMT+02:00) Jerusalem',
'Asia/Nicosia' => '(GMT+02:00) Nicosia',
'Europe/Athens' => '(GMT+02:00) Athens',
'Europe/Bucharest' => '(GMT+02:00) Bucharest',
'Europe/Chisinau' => '(GMT+02:00) Chisinau',
'Europe/Helsinki' => '(GMT+02:00) Helsinki',
'Europe/Istanbul' => '(GMT+02:00) Istanbul',
'Europe/Kaliningrad' => '(GMT+02:00) Moscow-01 - Kaliningrad',
'Europe/Kiev' => '(GMT+02:00) Kiev',
'Europe/Riga' => '(GMT+02:00) Riga',
'Europe/Sofia' => '(GMT+02:00) Sofia',
'Europe/Tallinn' => '(GMT+02:00) Tallinn',
'Europe/Vilnius' => '(GMT+02:00) Vilnius',
'Africa/Addis_Ababa' => '(GMT+03:00) Addis Ababa',
'Africa/Asmara' => '(GMT+03:00) Asmera',
'Africa/Dar_es_Salaam' => '(GMT+03:00) Dar es Salaam',
'Africa/Djibouti' => '(GMT+03:00) Djibouti',
'Africa/Kampala' => '(GMT+03:00) Kampala',
'Africa/Khartoum' => '(GMT+03:00) Khartoum',
'Africa/Mogadishu' => '(GMT+03:00) Mogadishu',
'Africa/Nairobi' => '(GMT+03:00) Nairobi',
'Antarctica/Syowa' => '(GMT+03:00) Syowa',
'Asia/Aden' => '(GMT+03:00) Aden',
'Asia/Baghdad' => '(GMT+03:00) Baghdad',
'Asia/Bahrain' => '(GMT+03:00) Bahrain',
'Asia/Kuwait' => '(GMT+03:00) Kuwait',
'Asia/Qatar' => '(GMT+03:00) Qatar',
'Asia/Riyadh' => '(GMT+03:00) Riyadh',
'Europe/Minsk' => '(GMT+03:00) Minsk',
'Europe/Moscow' => '(GMT+03:00) Moscow+00',
'Indian/Antananarivo' => '(GMT+03:00) Antananarivo',
'Indian/Comoro' => '(GMT+03:00) Comoro',
'Indian/Mayotte' => '(GMT+03:00) Mayotte',
'Asia/Tehran' => '(GMT+03:30) Tehran',
'Asia/Baku' => '(GMT+04:00) Baku',
'Asia/Dubai' => '(GMT+04:00) Dubai',
'Asia/Muscat' => '(GMT+04:00) Muscat',
'Asia/Tbilisi' => '(GMT+04:00) Tbilisi',
'Asia/Yerevan' => '(GMT+04:00) Yerevan',
'Europe/Samara' => '(GMT+04:00) Moscow+00 - Samara',
'Indian/Mahe' => '(GMT+04:00) Mahe',
'Indian/Mauritius' => '(GMT+04:00) Mauritius',
'Indian/Reunion' => '(GMT+04:00) Reunion',
'Asia/Kabul' => '(GMT+04:30) Kabul',
'Antarctica/Mawson' => '(GMT+05:00) Mawson',
'Asia/Aqtau' => '(GMT+05:00) Aqtau',
'Asia/Aqtobe' => '(GMT+05:00) Aqtobe',
'Asia/Ashgabat' => '(GMT+05:00) Ashgabat',
'Asia/Dushanbe' => '(GMT+05:00) Dushanbe',
'Asia/Karachi' => '(GMT+05:00) Karachi',
'Asia/Tashkent' => '(GMT+05:00) Tashkent',
'Asia/Yekaterinburg' => '(GMT+05:00) Moscow+02 - Yekaterinburg',
'Indian/Kerguelen' => '(GMT+05:00) Kerguelen',
'Indian/Maldives' => '(GMT+05:00) Maldives',
'Asia/Calcutta' => '(GMT+05:30) India Standard Time',
'Asia/Colombo' => '(GMT+05:30) Colombo',
'Asia/Katmandu' => '(GMT+05:45) Katmandu',
'Antarctica/Vostok' => '(GMT+06:00) Vostok',
'Asia/Almaty' => '(GMT+06:00) Almaty',
'Asia/Bishkek' => '(GMT+06:00) Bishkek',
'Asia/Dhaka' => '(GMT+06:00) Dhaka',
'Asia/Omsk' => '(GMT+06:00) Moscow+03 - Omsk, Novosibirsk',
'Asia/Thimphu' => '(GMT+06:00) Thimphu',
'Indian/Chagos' => '(GMT+06:00) Chagos',
'Asia/Rangoon' => '(GMT+06:30) Rangoon',
'Indian/Cocos' => '(GMT+06:30) Cocos',
'Antarctica/Davis' => '(GMT+07:00) Davis',
'Asia/Bangkok' => '(GMT+07:00) Bangkok',
'Asia/Hovd' => '(GMT+07:00) Hovd',
'Asia/Jakarta' => '(GMT+07:00) Jakarta',
'Asia/Krasnoyarsk' => '(GMT+07:00) Moscow+04 - Krasnoyarsk',
'Asia/Saigon' => '(GMT+07:00) Hanoi',
'Indian/Christmas' => '(GMT+07:00) Christmas',
'Antarctica/Casey' => '(GMT+08:00) Casey',
'Asia/Brunei' => '(GMT+08:00) Brunei',
'Asia/Choibalsan' => '(GMT+08:00) Choibalsan',
'Asia/Hong_Kong' => '(GMT+08:00) Hong Kong',
'Asia/Irkutsk' => '(GMT+08:00) Moscow+05 - Irkutsk',
'Asia/Kuala_Lumpur' => '(GMT+08:00) Kuala Lumpur',
'Asia/Macau' => '(GMT+08:00) Macau',
'Asia/Makassar' => '(GMT+08:00) Makassar',
'Asia/Manila' => '(GMT+08:00) Manila',
'Asia/Shanghai' => '(GMT+08:00) China Time - Beijing',
'Asia/Singapore' => '(GMT+08:00) Singapore',
'Asia/Taipei' => '(GMT+08:00) Taipei',
'Asia/Ulaanbaatar' => '(GMT+08:00) Ulaanbaatar',
'Australia/Perth' => '(GMT+08:00) Western Time - Perth',
'Asia/Dili' => '(GMT+09:00) Dili',
'Asia/Jayapura' => '(GMT+09:00) Jayapura',
'Asia/Pyongyang' => '(GMT+09:00) Pyongyang',
'Asia/Seoul' => '(GMT+09:00) Seoul',
'Asia/Tokyo' => '(GMT+09:00) Tokyo',
'Asia/Yakutsk' => '(GMT+09:00) Moscow+06 - Yakutsk',
'Pacific/Palau' => '(GMT+09:00) Palau',
'Australia/Adelaide' => '(GMT+09:30) Central Time - Adelaide',
'Australia/Darwin' => '(GMT+09:30) Central Time - Darwin',
'Antarctica/DumontDUrville' => '(GMT+10:00) Dumont D\'Urville',
'Asia/Magadan' => '(GMT+10:00) Moscow+08 - Magadan',
'Asia/Vladivostok' => '(GMT+10:00) Moscow+07 - Yuzhno-Sakhalinsk',
'Australia/Brisbane' => '(GMT+10:00) Eastern Time - Brisbane',
'Australia/Hobart' => '(GMT+10:00) Eastern Time - Hobart',
'Australia/Sydney' => '(GMT+10:00) Eastern Time - Melbourne, Sydney',
'Pacific/Chuuk' => '(GMT+10:00) Truk',
'Pacific/Guam' => '(GMT+10:00) Guam',
'Pacific/Port_Moresby' => '(GMT+10:00) Port Moresby',
'Pacific/Saipan' => '(GMT+10:00) Saipan',
'Pacific/Efate' => '(GMT+11:00) Efate',
'Pacific/Guadalcanal' => '(GMT+11:00) Guadalcanal',
'Pacific/Kosrae' => '(GMT+11:00) Kosrae',
'Pacific/Noumea' => '(GMT+11:00) Noumea',
'Pacific/Pohnpei' => '(GMT+11:00) Ponape',
'Pacific/Norfolk' => '(GMT+11:30) Norfolk',
'Asia/Kamchatka' => '(GMT+12:00) Moscow+08 - Petropavlovsk-Kamchatskiy',
'Pacific/Auckland' => '(GMT+12:00) Auckland',
'Pacific/Fiji' => '(GMT+12:00) Fiji',
'Pacific/Funafuti' => '(GMT+12:00) Funafuti',
'Pacific/Kwajalein' => '(GMT+12:00) Kwajalein',
'Pacific/Majuro' => '(GMT+12:00) Majuro',
'Pacific/Nauru' => '(GMT+12:00) Nauru',
'Pacific/Tarawa' => '(GMT+12:00) Tarawa',
'Pacific/Wake' => '(GMT+12:00) Wake',
'Pacific/Wallis' => '(GMT+12:00) Wallis',
'Pacific/Apia' => '(GMT+13:00) Apia',
'Pacific/Enderbury' => '(GMT+13:00) Enderbury',
'Pacific/Fakaofo' => '(GMT+13:00) Fakaofo',
'Pacific/Tongatapu' => '(GMT+13:00) Tongatapu',
'Pacific/Kiritimati' => '(GMT+14:00) Kiritimati'
public static function getJsLocalizedData()
'imageSupportAlertMessage' => __('Only image files supported', 'popup-builder'),
'pdfSupportAlertMessage' => __('Only pdf files supported', 'popup-builder'),
'areYouSure' => __('Are you sure?', 'popup-builder'),
'addButtonSpinner' => __('L', 'popup-builder'),
'audioSupportAlertMessage' => __('Only audio files supported (e.g.: mp3, wav, m4a, ogg)', 'popup-builder'),
'publishPopupBeforeElementor' => __('Please, publish the popup before starting to use Elementor with it!', 'popup-builder'),
'publishPopupBeforeDivi' => __('Please, publish the popup before starting to use Divi Builder with it!', 'popup-builder'),
'closeButtonAltText' => __('Close', 'popup-builder')
public static function getCurrentDateTime()
return gmdate('Y-m-d H:i', strtotime(' +1 day'));
public static function getDefaultTimezone()
$timezone = get_option('timezone_string');
$timezone = 'America/New_York';
// We will keep this class to make sure all Popup Extension Add-ons are still working fine.
// In the future, we will remove it when you update all code in Add-ons to use NEW class above.
public static $customPostType;
public static $allCustomPosts = array();
public static function getPostTypeData($args = array())
$query = self::getQueryDataByArgs($args);
foreach ($query->posts as $post) {
$posts[$post->ID] = $post->post_title;
public static function getQueryDataByArgs($args = array())
'post_status' => 'publish',
'suppress_filters' => false,
$args = wp_parse_args($args, $defaultArgs);
$query = new WP_Query($args);
* this method is used for to get all other post types
* that may created by another plugins or theme or website owner!
* example: download from EDD, product from Woocommerce!
public static function getAllCustomPosts()
$allCustomPosts = get_post_types($args);
if (isset($allCustomPosts[SG_POPUP_POST_TYPE])) {
unset($allCustomPosts[SG_POPUP_POST_TYPE]);
self::$allCustomPosts = $allCustomPosts;
return $allCustomPosts; // TODO check for usages and remove this line
public static function addFilters()
self::addPostTypeToFilters();
private static function addPostTypeToFilters()
self::getAllCustomPosts();
add_filter('sgPopupTargetParams', array(__CLASS__, 'addPopupTargetParams'), 1, 1);
add_filter('sgPopupTargetData', array(__CLASS__, 'addPopupTargetData'), 1, 1);
add_filter('sgPopupTargetTypes', array(__CLASS__, 'addPopupTargetTypes'), 1, 1);
add_filter('sgPopupTargetAttrs', array(__CLASS__, 'addPopupTargetAttrs'), 1, 1);
add_filter('sgPopupPageTemplates', array(__CLASS__, 'addPopupPageTemplates'), 1, 1);
add_filter('sgPopupTargetPostType', array(__CLASS__, 'getAllCustomPostTypes'), 1, 1);
add_filter('sgPopupTargetPageType', array(__CLASS__, 'getPageTypes'), 1, 1);
public static function addPopupTargetParams($targetParams)
$allCustomPostTypes = self::$allCustomPosts;
// for conditions, to exclude other post types, tags etc.
if (isset($targetParams['select_role'])) {
foreach ($allCustomPostTypes as $customPostType) {
$targetParams[$customPostType] = array(
$customPostType.'_all' => 'All '.ucfirst($customPostType).'s',
$customPostType.'_archive' => 'Archives '.ucfirst($customPostType).'s',
$customPostType.'_selected' => 'Select '.ucfirst($customPostType).'s',
$customPostType.'_categories' => 'Select '.ucfirst($customPostType).' categories'
public static function addPopupTargetData($targetData)
$allCustomPostTypes = self::$allCustomPosts;
foreach ($allCustomPostTypes as $customPostType) {
$targetData[$customPostType.'_all'] = null;
$targetData[$customPostType.'_selected'] = '';
$targetData[$customPostType.'_categories'] = self::getCustomPostCategories($customPostType);
public static function getCustomPostCategories($postTypeName)
$taxonomyObjects = get_object_taxonomies($postTypeName);
if ($postTypeName == 'product') {
$taxonomyObjects = array('product_cat');
$categories = self::getPostsAllCategories($postTypeName, $taxonomyObjects);
public static function addPopupTargetTypes($targetTypes)
$allCustomPostTypes = self::$allCustomPosts;
foreach ($allCustomPostTypes as $customPostType) {
$targetTypes[$customPostType.'_selected'] = 'select';
$targetTypes[$customPostType.'_categories'] = 'select';
public static function addPopupTargetAttrs($targetAttrs)
$allCustomPostTypes = self::$allCustomPosts;
foreach ($allCustomPostTypes as $customPostType) {
$targetAttrs[$customPostType.'_selected']['htmlAttrs'] = array('class' => 'js-sg-select2 js-select-ajax', 'data-select-class' => 'js-select-ajax', 'data-select-type' => 'ajax', 'data-value-param' => $customPostType, 'multiple' => 'multiple');
$targetAttrs[$customPostType.'_selected']['infoAttrs'] = array('label' => __('Select ', 'popup-builder').$customPostType);
$targetAttrs[$customPostType.'_categories']['htmlAttrs'] = array('class' => 'js-sg-select2 js-select-ajax', 'data-select-class' => 'js-select-ajax', 'isNotPostType' => true, 'data-value-param' => $customPostType, 'multiple' => 'multiple');
$targetAttrs[$customPostType.'_categories']['infoAttrs'] = array('label' => __('Select ', 'popup-builder').$customPostType.' categories');
public static function addPopupPageTemplates($templates)
$pageTemplates = self::getPageTemplates();
$pageTemplates += $templates;
public static function getAllCustomPostTypes()
$allCustomPosts = get_post_types($args);
if (!empty($allCustomPosts[SG_POPUP_POST_TYPE])) {
unset($allCustomPosts[SG_POPUP_POST_TYPE]);
public static function getPostsAllCategories($postType = 'post', $taxonomies = array(), $search_text = '')
'taxonomy' => $taxonomies,
'name__like' => $search_text
$supportedTaxonomies = array('category');
if (!empty($taxonomies)) {
$supportedTaxonomies = $taxonomies;
foreach ($cats as $cat) {
if (isset($cat->taxonomy)) {
if (!in_array($cat->taxonomy, $supportedTaxonomies)) {
$catsParams[$id] = $name;
public static function getPageTypes()
$postTypes['is_home_page'] = __('Home Page', 'popup-builder');
$postTypes['is_home'] = __('Posts Page', 'popup-builder');
$postTypes['is_search'] = __('Search Pages', 'popup-builder');
$postTypes['is_404'] = __('404 Pages', 'popup-builder');
if (function_exists('is_shop')) {
$postTypes['is_shop'] = __('Shop Page', 'popup-builder');
if (function_exists('is_archive')) {
$postTypes['is_archive'] = __('Archive Page', 'popup-builder');
public static function getPageTemplates()