Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/popup-bu.../com/classes
File: Actions.php
<?php
[0] Fix | Delete
namespace sgpb;
[1] Fix | Delete
use \WP_Query;
[2] Fix | Delete
use \SgpbPopupConfig;
[3] Fix | Delete
use \SgpbDataConfig;
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
class Actions
[7] Fix | Delete
{
[8] Fix | Delete
public $customPostTypeObj;
[9] Fix | Delete
public $insideShortcodes;
[10] Fix | Delete
public $mediaButton = false;
[11] Fix | Delete
[12] Fix | Delete
public function __construct()
[13] Fix | Delete
{
[14] Fix | Delete
$this->init();
[15] Fix | Delete
}
[16] Fix | Delete
[17] Fix | Delete
public function init()
[18] Fix | Delete
{
[19] Fix | Delete
add_action('init', array($this, 'wpInit'), 100);
[20] Fix | Delete
add_action('init', array($this, 'callUnsubcribeUserByEmail'), 9999);
[21] Fix | Delete
add_action('admin_init', array($this, 'postTypeInit'), 9999);
[22] Fix | Delete
if (method_exists('sgpb\AdminHelper', 'updatesInit') && !has_action('admin_init', array( 'sgpb\AdminHelper', 'updatesInit'))){
[23] Fix | Delete
add_action('admin_init', array( 'sgpb\AdminHelper', 'updatesInit'), 9999);
[24] Fix | Delete
}
[25] Fix | Delete
add_action('admin_menu', array($this, 'addSubMenu'));
[26] Fix | Delete
add_action('admin_menu', array($this, 'supportLinks'), 999);
[27] Fix | Delete
add_action('admin_head', array($this, 'showPreviewButtonAfterPopupPublish'));
[28] Fix | Delete
add_action('admin_head', array($this, 'custom_admin_js'));
[29] Fix | Delete
add_action('admin_enqueue_scripts', array($this, 'adminLoadPopups'));
[30] Fix | Delete
add_action('admin_action_popupSaveAsNew', array($this, 'popupSaveAsNew'));
[31] Fix | Delete
add_action('admin_post_csv_file', array($this, 'getSubscribersCsvFile'));
[32] Fix | Delete
add_action('admin_post_sgpb_system_info', array($this, 'getSystemInfoFile'));
[33] Fix | Delete
add_action('admin_post_sgpbSaveSettings', array($this, 'saveSettings'), 10, 1);
[34] Fix | Delete
add_action('admin_init', array($this, 'userRolesCaps'));
[35] Fix | Delete
add_action('admin_notices', array($this, 'pluginNotices'));
[36] Fix | Delete
add_action('admin_init', array($this, 'pluginLoaded'));
[37] Fix | Delete
add_action('transition_post_status', array($this, 'deletePopup'), 100, 3);
[38] Fix | Delete
// activate extensions
[39] Fix | Delete
add_action('wp_before_admin_bar_render', array($this, 'pluginActivated'), 10, 2);
[40] Fix | Delete
add_action('admin_head', array($this, 'hidePageBuilderEditButtons'));
[41] Fix | Delete
add_action('admin_head', array($this, 'hidePublishingActions'));
[42] Fix | Delete
add_action('add_meta_boxes', array($this, 'popupMetaboxes'), 100);
[43] Fix | Delete
add_filter('post_updated_messages', array($this, 'popupPublishedMessage'), 1, 1);
[44] Fix | Delete
add_action('before_delete_post', array($this, 'deleteSubscribersWithPopup'), 1, 1);
[45] Fix | Delete
add_action('sgpb_duplicate_post', array($this, 'popupCopyPostMetaInfo'), 10, 2);
[46] Fix | Delete
add_filter('get_sample_permalink_html', array($this, 'removePostPermalink'), 1, 1);
[47] Fix | Delete
add_action('manage_'.SG_POPUP_POST_TYPE.'_posts_custom_column' , array($this, 'popupsTableColumnsValues'), 10, 2);
[48] Fix | Delete
add_action('media_buttons', array($this, 'popupMediaButton'));
[49] Fix | Delete
add_filter('mce_external_plugins', array($this, 'editorButton'), 1, 1);
[50] Fix | Delete
add_action('admin_enqueue_scripts', array('sgpb\Style', 'enqueueStyles'));
[51] Fix | Delete
add_action('admin_enqueue_scripts', array('sgpb\Javascript', 'enqueueScripts'));
[52] Fix | Delete
// this action for popup options saving and popup builder classes save ex from post and page
[53] Fix | Delete
add_action('save_post', array($this, 'savePost'), 100, 3);
[54] Fix | Delete
add_action('wp_enqueue_scripts', array($this, 'enqueuePopupBuilderScripts'));
[55] Fix | Delete
add_filter('sgpbOtherConditions', array($this ,'conditionsSatisfy'), 11, 1);
[56] Fix | Delete
add_shortcode('sg_popup', array($this, 'sgpbPopupShortcode'));
[57] Fix | Delete
add_filter('cron_schedules', array($this, 'cronAddMinutes'), 10, 1);
[58] Fix | Delete
add_action('sgpb_send_newsletter', array($this, 'newsletterSendEmail'), 10, 1);
[59] Fix | Delete
// add_action('sgpbGetBannerContentOnce', array($this, 'getBannerContent'), 10, 1);
[60] Fix | Delete
add_action('plugins_loaded', array($this, 'loadTextDomain'));
[61] Fix | Delete
// for change admin popup list order
[62] Fix | Delete
add_action('pre_get_posts', array($this, 'preGetPosts'));
[63] Fix | Delete
add_action('template_redirect', array($this, 'redirectFromPopupPage'));
[64] Fix | Delete
add_filter('views_edit-popupbuilder', array($this, 'mainActionButtons'), 10, 1);
[65] Fix | Delete
add_action('wpml_loaded', array($this, 'wpmlRelatedActions'));
[66] Fix | Delete
add_action('the_post', array($this, 'postExcludeFromPopupsList'));
[67] Fix | Delete
[68] Fix | Delete
add_filter('get_user_option_screen_layout_'.SG_POPUP_POST_TYPE, array($this, 'screenLayoutSetOneColumn'));
[69] Fix | Delete
[70] Fix | Delete
add_filter( 'upload_mimes', array($this, 'popupbuilder_allow_csv_mime_types') );
[71] Fix | Delete
add_action( 'plugins_loaded' , array($this, 'popupbuilder_contrucst') );
[72] Fix | Delete
}
[73] Fix | Delete
public function popupbuilder_contrucst()
[74] Fix | Delete
{
[75] Fix | Delete
new SGPBFeedback();
[76] Fix | Delete
new SGPBReports();
[77] Fix | Delete
new SGPBMenu();
[78] Fix | Delete
new Ajax();
[79] Fix | Delete
}
[80] Fix | Delete
public function popupbuilder_allow_csv_mime_types( $mimes ) {
[81] Fix | Delete
$mimes['csv'] = 'text/csv';
[82] Fix | Delete
unset( $mimes['exe'] );
[83] Fix | Delete
return $mimes;
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
public function custom_admin_js()
[87] Fix | Delete
{
[88] Fix | Delete
$currentPostType = AdminHelper::getCurrentPostType();
[89] Fix | Delete
if(!empty($currentPostType) && ($currentPostType == SG_POPUP_POST_TYPE || $currentPostType == SG_POPUP_AUTORESPONDER_POST_TYPE || $currentPostType == SG_POPUP_TEMPLATE_POST_TYPE)) {
[90] Fix | Delete
wp_register_script( 'sgpb-actions-js-footer', '', array("jquery"), SGPB_POPUP_VERSION, true );
[91] Fix | Delete
wp_enqueue_script( 'sgpb-actions-js-footer' );
[92] Fix | Delete
wp_add_inline_script( 'sgpb-actions-js-footer', "jQuery(document).ready(function ($) {
[93] Fix | Delete
const myForm = $('.post-type-popupbuilder #posts-filter, .post-type-sgpbtemplate #posts-filter, .post-type-sgpbtemplate #posts-filter');
[94] Fix | Delete
myForm.addClass('sgpb-table');
[95] Fix | Delete
const searchValue = $('.post-type-popupbuilder #post-search-input, .post-type-sgpbtemplate #posts-filter, .post-type-sgpbautoresponder #posts-filter').val();
[96] Fix | Delete
$('.post-type-popupbuilder #posts-filter .tablenav.top .tablenav-pages, .post-type-sgpbtemplate #posts-filter .tablenav.top .tablenav-pages, .post-type-sgpbautoresponder #posts-filter .tablenav.top .tablenav-pages').append($('.subsubsub').addClass('show'));
[97] Fix | Delete
myForm.append($('.post-type-popupbuilder #posts-filter .tablenav.bottom .tablenav-pages:not(.no-pages, .one-page) .pagination-links, .post-type-sgpbtemplate #posts-filter .tablenav.bottom .tablenav-pages:not(.no-pages, .one-page) .pagination-links, .post-type-sgpbautoresponder #posts-filter .tablenav.bottom .tablenav-pages:not(.no-pages, .one-page) .pagination-links'));
[98] Fix | Delete
$('#sgpbSearchInPosts').val(searchValue);
[99] Fix | Delete
$('#sgpbSearchInPosts').keyup('enter', function (e) {
[100] Fix | Delete
if (e.key === 'Enter') {
[101] Fix | Delete
$('.post-type-popupbuilder #post-search-input, .post-type-sgpbtemplate #post-search-input, .post-type-sgpbautoresponder #post-search-input').val(this.value);
[102] Fix | Delete
$(myForm).submit();
[103] Fix | Delete
}
[104] Fix | Delete
});
[105] Fix | Delete
$('#sgpbSearchInPostsSubmit').on('click', function () {
[106] Fix | Delete
$('.post-type-popupbuilder #post-search-input, .post-type-sgpbtemplate #post-search-input, .post-type-sgpbautoresponder #post-search-input').val($('#sgpbSearchInPosts').val());
[107] Fix | Delete
$(myForm).submit();
[108] Fix | Delete
})
[109] Fix | Delete
});");
[110] Fix | Delete
}
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
public function screenLayoutSetOneColumn()
[114] Fix | Delete
{
[115] Fix | Delete
return 1;
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
public function wpmlRelatedActions()
[119] Fix | Delete
{
[120] Fix | Delete
// The actions below will be executed right after WPML is fully configured and loaded.
[121] Fix | Delete
add_action('admin_head', array($this, 'removeUnneededMetaboxesFromPopups'), 10);
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
public function removeUnneededMetaboxesFromPopups()
[125] Fix | Delete
{
[126] Fix | Delete
if (isset($_GET['post_type']) && sanitize_text_field($_GET['post_type']) == SG_POPUP_POST_TYPE) {
[127] Fix | Delete
$exlcudeTrPopupTypes = array(
[128] Fix | Delete
'image',
[129] Fix | Delete
'video',
[130] Fix | Delete
'iframe',
[131] Fix | Delete
'recentSales',
[132] Fix | Delete
'pdf'
[133] Fix | Delete
);
[134] Fix | Delete
$exlcudeTrPopupTypes = apply_filters('sgpbNoMcePopupTypes', $exlcudeTrPopupTypes);
[135] Fix | Delete
if (isset($_GET['sgpb_type']) && in_array(sanitize_text_field($_GET['sgpb_type']), $exlcudeTrPopupTypes)) {
[136] Fix | Delete
remove_meta_box('icl_div', SG_POPUP_POST_TYPE, 'side');
[137] Fix | Delete
}
[138] Fix | Delete
}
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
public function deletePopup($newStatus, $oldStatus, $post)
[142] Fix | Delete
{
[143] Fix | Delete
$currentPostType = AdminHelper::getCurrentPostType();
[144] Fix | Delete
[145] Fix | Delete
if (!empty($currentPostType) && $currentPostType == SG_POPUP_POST_TYPE) {
[146] Fix | Delete
Functions::clearAllTransients();
[147] Fix | Delete
}
[148] Fix | Delete
}
[149] Fix | Delete
[150] Fix | Delete
public function showPreviewButtonAfterPopupPublish()
[151] Fix | Delete
{
[152] Fix | Delete
$currentPostType = AdminHelper::getCurrentPostType();
[153] Fix | Delete
if (!empty($currentPostType) && ($currentPostType == SG_POPUP_POST_TYPE || $currentPostType == SG_POPUP_AUTORESPONDER_POST_TYPE || $currentPostType == SG_POPUP_TEMPLATE_POST_TYPE)) {
[154] Fix | Delete
$styles = '<style>
[155] Fix | Delete
.post-type-popupbuilder #save-post,
[156] Fix | Delete
.post-type-sgpbtemplate #save-post,
[157] Fix | Delete
.post-type-sgpbautoresponder #save-post
[158] Fix | Delete
{
[159] Fix | Delete
display:none !important;
[160] Fix | Delete
}
[161] Fix | Delete
.post-type-popupbuilder .subsubsub,
[162] Fix | Delete
.post-type-sgpbtemplate .subsubsub,
[163] Fix | Delete
.post-type-sgpbautoresponder .subsubsub
[164] Fix | Delete
{
[165] Fix | Delete
display:none !important;
[166] Fix | Delete
}
[167] Fix | Delete
.post-type-popupbuilder .subsubsub.show,
[168] Fix | Delete
.post-type-sgpbtemplate .subsubsub.show,
[169] Fix | Delete
.post-type-sgpbautoresponder .subsubsub.show
[170] Fix | Delete
{
[171] Fix | Delete
display:block !important;
[172] Fix | Delete
}
[173] Fix | Delete
.post-type-popupbuilder .search-box,
[174] Fix | Delete
.post-type-sgpbtemplate .search-box,
[175] Fix | Delete
.post-type-sgpbautoresponder .search-box
[176] Fix | Delete
{
[177] Fix | Delete
display:none !important;
[178] Fix | Delete
}
[179] Fix | Delete
.post-type-popupbuilder .search-box.show,
[180] Fix | Delete
.post-type-sgpbtemplate .search-box.show,
[181] Fix | Delete
.post-type-sgpbautoresponder .search-box.show
[182] Fix | Delete
{
[183] Fix | Delete
display:block !important;
[184] Fix | Delete
}
[185] Fix | Delete
.post-type-popupbuilder .tablenav-pages.no-pages,
[186] Fix | Delete
.post-type-sgpbtemplate .tablenav-pages.no-pages,
[187] Fix | Delete
.post-type-sgpbautoresponder .tablenav-pages.no-pages
[188] Fix | Delete
{
[189] Fix | Delete
display: block;
[190] Fix | Delete
}
[191] Fix | Delete
.post-type-popupbuilder .tablenav-pages *:not(.subsubsub, .subsubsub *),
[192] Fix | Delete
.post-type-sgpbtemplate .tablenav-pages *:not(.subsubsub, .subsubsub *),
[193] Fix | Delete
.post-type-sgpbautoresponder .tablenav-pages *:not(.subsubsub, .subsubsub *),
[194] Fix | Delete
.post-type-popupbuilder .tablenav-pages.no-pages *:not(.subsubsub, .subsubsub *),
[195] Fix | Delete
.post-type-sgpbtemplate .tablenav-pages.no-pages *:not(.subsubsub, .subsubsub *),
[196] Fix | Delete
.post-type-sgpbautoresponder .tablenav-pages.no-pages *:not(.subsubsub, .subsubsub *),
[197] Fix | Delete
.post-type-popupbuilder .tablenav-pages.one-page *:not(.subsubsub, .subsubsub *),
[198] Fix | Delete
.post-type-sgpbtemplate .tablenav-pages.one-page *:not(.subsubsub, .subsubsub *),
[199] Fix | Delete
.post-type-sgpbautoresponder .tablenav-pages.one-page *:not(.subsubsub, .subsubsub *)
[200] Fix | Delete
{
[201] Fix | Delete
display: none;
[202] Fix | Delete
}
[203] Fix | Delete
</style>';
[204] Fix | Delete
echo wp_kses($styles, AdminHelper::allowed_html_tags());
[205] Fix | Delete
}
[206] Fix | Delete
}
[207] Fix | Delete
[208] Fix | Delete
public function inactiveExtensionNotice()
[209] Fix | Delete
{
[210] Fix | Delete
$screen = '';
[211] Fix | Delete
$dontShowLicenseBanner = get_option('sgpb-hide-license-notice-banner');
[212] Fix | Delete
if ($dontShowLicenseBanner) {
[213] Fix | Delete
return $screen;
[214] Fix | Delete
}
[215] Fix | Delete
$inactive = AdminHelper::getOption('SGPB_INACTIVE_EXTENSIONS');
[216] Fix | Delete
$hasInactiveExtensions = AdminHelper::hasInactiveExtensions();
[217] Fix | Delete
if (!$inactive) {
[218] Fix | Delete
AdminHelper::updateOption('SGPB_INACTIVE_EXTENSIONS', 1);
[219] Fix | Delete
if ($hasInactiveExtensions) {
[220] Fix | Delete
AdminHelper::updateOption('SGPB_INACTIVE_EXTENSIONS', 'inactive');
[221] Fix | Delete
$inactive = 'inactive';
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
}
[225] Fix | Delete
$licenseSectionUrl = menu_page_url(SGPB_POPUP_LICENSE, false);
[226] Fix | Delete
$partOfContent = '<br><br><a href="'.esc_url($licenseSectionUrl).'">'.__('Follow the link', 'popup-builder').'</a> '.__('to finalize the activation.', 'popup-builder');
[227] Fix | Delete
if (function_exists('get_current_screen')) {
[228] Fix | Delete
$screen = get_current_screen();
[229] Fix | Delete
$screenId = $screen->id;
[230] Fix | Delete
if ($screenId == SGPB_POPUP_LICENSE_SCREEN) {
[231] Fix | Delete
$partOfContent = '';
[232] Fix | Delete
}
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
if ($hasInactiveExtensions && $inactive == 'inactive') {
[236] Fix | Delete
$content = '';
[237] Fix | Delete
ob_start();
[238] Fix | Delete
?>
[239] Fix | Delete
<div id="welcome-panel" class="update-nag sgpb-extensions-notices sgpb-license-notice">
[240] Fix | Delete
<div class="welcome-panel-content">
[241] Fix | Delete
<b><?php esc_html_e('Thank you for choosing our plugin!', 'popup-builder') ?></b>
[242] Fix | Delete
<br>
[243] Fix | Delete
<br>
[244] Fix | Delete
<b><?php esc_html_e('You have activated Popup Builder extension(s). Please, don\'t forget to activate the license key(s) as well.', 'popup-builder') ?></b>
[245] Fix | Delete
<b><?php echo wp_kses($partOfContent, AdminHelper::allowed_html_tags()); ?></b>
[246] Fix | Delete
</div>
[247] Fix | Delete
<button type="button" class="notice-dismiss" onclick="jQuery('.sgpb-license-notice').remove();"><span class="screen-reader-text"><?php esc_html_e('Dismiss this notice.', 'popup-builder') ?></span></button>
[248] Fix | Delete
<span class="sgpb-dont-show-again-license-notice"><?php esc_html_e('Don\'t show again.', 'popup-builder'); ?></span>
[249] Fix | Delete
</div>
[250] Fix | Delete
<?php
[251] Fix | Delete
$content = ob_get_clean();
[252] Fix | Delete
[253] Fix | Delete
echo wp_kses($content, AdminHelper::allowed_html_tags());
[254] Fix | Delete
return true;
[255] Fix | Delete
}
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
public function hidePublishingActions() {
[259] Fix | Delete
$currentPostType = AdminHelper::getCurrentPostType();
[260] Fix | Delete
if (empty($currentPostType) || $currentPostType != SG_POPUP_POST_TYPE) {
[261] Fix | Delete
return false;
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
$styles = '<style>
[265] Fix | Delete
#misc-publishing-actions .edit-post-status,
[266] Fix | Delete
#misc-publishing-actions .edit-timestamp,
[267] Fix | Delete
#misc-publishing-actions .edit-visibility {
[268] Fix | Delete
display:none !important;
[269] Fix | Delete
}
[270] Fix | Delete
</style>';
[271] Fix | Delete
echo wp_kses($styles, AdminHelper::allowed_html_tags());
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
public function hidePageBuilderEditButtons($postId = 0, $post = array())
[275] Fix | Delete
{
[276] Fix | Delete
$currentPostType = AdminHelper::getCurrentPostType();
[277] Fix | Delete
if (empty($currentPostType) || $currentPostType != SG_POPUP_POST_TYPE) {
[278] Fix | Delete
return false;
[279] Fix | Delete
}
[280] Fix | Delete
$excludedPopupTypesFromPageBuildersFunctionality = array(
[281] Fix | Delete
'image'
[282] Fix | Delete
);
[283] Fix | Delete
[284] Fix | Delete
$excludedPopupTypesFromPageBuildersFunctionality = apply_filters('sgpbHidePageBuilderEditButtons', $excludedPopupTypesFromPageBuildersFunctionality);
[285] Fix | Delete
[286] Fix | Delete
$popupType = AdminHelper::getCurrentPopupType();
[287] Fix | Delete
if (in_array($popupType, $excludedPopupTypesFromPageBuildersFunctionality)) {
[288] Fix | Delete
$style = '<style>
[289] Fix | Delete
#elementor-switch-mode, #elementor-editor {
[290] Fix | Delete
display:none !important;
[291] Fix | Delete
}
[292] Fix | Delete
</style>';
[293] Fix | Delete
echo wp_kses($style, AdminHelper::allowed_html_tags());
[294] Fix | Delete
}
[295] Fix | Delete
}
[296] Fix | Delete
[297] Fix | Delete
public function getBannerContent()
[298] Fix | Delete
{
[299] Fix | Delete
// right metabox banner content
[300] Fix | Delete
$metaboxBannerContent = AdminHelper::getFileFromURL(SGPB_METABOX_BANNER_CRON_TEXT_URL);
[301] Fix | Delete
update_option('sgpb-metabox-banner-remote-get', $metaboxBannerContent);
[302] Fix | Delete
[303] Fix | Delete
return true;
[304] Fix | Delete
}
[305] Fix | Delete
[306] Fix | Delete
public function wpInit()
[307] Fix | Delete
{
[308] Fix | Delete
if (isset($_GET['sgpb_type'])) {
[309] Fix | Delete
$_GET['sgpb_type'] = sanitize_text_field($_GET['sgpb_type']);
[310] Fix | Delete
$fields = array(
[311] Fix | Delete
'image',
[312] Fix | Delete
'html',
[313] Fix | Delete
'fblike',
[314] Fix | Delete
'shortcode',
[315] Fix | Delete
'iframe',
[316] Fix | Delete
'advancedClosing',
[317] Fix | Delete
'advancedTargeting',
[318] Fix | Delete
'ageVerification',
[319] Fix | Delete
'analytics',
[320] Fix | Delete
'gamification',
[321] Fix | Delete
'geoTargeting',
[322] Fix | Delete
'inactivity',
[323] Fix | Delete
'login',
[324] Fix | Delete
'registration',
[325] Fix | Delete
'scroll',
[326] Fix | Delete
'pdf',
[327] Fix | Delete
'pushNotification',
[328] Fix | Delete
'recentSales',
[329] Fix | Delete
'video',
[330] Fix | Delete
'ageRestriction',
[331] Fix | Delete
'social',
[332] Fix | Delete
'video',
[333] Fix | Delete
'subscription',
[334] Fix | Delete
'countdown',
[335] Fix | Delete
'contactForm',
[336] Fix | Delete
'mailchimp',
[337] Fix | Delete
'aweber',
[338] Fix | Delete
);
[339] Fix | Delete
if (!in_array($_GET['sgpb_type'], $fields)){
[340] Fix | Delete
wp_redirect(get_home_url());
[341] Fix | Delete
exit();
[342] Fix | Delete
}
[343] Fix | Delete
}
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
public function mainActionButtons($views)
[347] Fix | Delete
{
[348] Fix | Delete
require_once(SG_POPUP_VIEWS_PATH.'mainActionButtons.php');
[349] Fix | Delete
[350] Fix | Delete
return $views;
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
/**
[354] Fix | Delete
* Loads the plugin language files
[355] Fix | Delete
*/
[356] Fix | Delete
public function loadTextDomain()
[357] Fix | Delete
{
[358] Fix | Delete
$popupBuilderLangDir = SG_POPUP_BUILDER_PATH.'/languages/';
[359] Fix | Delete
$popupBuilderLangDir = apply_filters('popupBuilderLanguagesDirectory', $popupBuilderLangDir);
[360] Fix | Delete
[361] Fix | Delete
$locale = apply_filters('sgpbPluginLocale', get_locale(), SG_POPUP_TEXT_DOMAIN);
[362] Fix | Delete
$mofile = sprintf('%1$s-%2$s.mo', 'popup-builder', $locale);
[363] Fix | Delete
[364] Fix | Delete
$mofileLocal = $popupBuilderLangDir.$mofile;
[365] Fix | Delete
[366] Fix | Delete
if (file_exists($mofileLocal)) {
[367] Fix | Delete
// Look in local /wp-content/plugins/popup-builder/languages/ folder
[368] Fix | Delete
load_textdomain(SG_POPUP_TEXT_DOMAIN, $mofileLocal);
[369] Fix | Delete
}
[370] Fix | Delete
else {
[371] Fix | Delete
// Load the default language files
[372] Fix | Delete
load_plugin_textdomain(SG_POPUP_TEXT_DOMAIN, false, $popupBuilderLangDir);
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
public function redirectFromPopupPage()
[378] Fix | Delete
{
[379] Fix | Delete
global $post;
[380] Fix | Delete
$currentPostType = '';
[381] Fix | Delete
[382] Fix | Delete
if (is_object($post)) {
[383] Fix | Delete
$currentPostType = @$post->post_type;
[384] Fix | Delete
}
[385] Fix | Delete
// in some themes global $post returns null
[386] Fix | Delete
if (empty($currentPostType)) {
[387] Fix | Delete
global $post_type;
[388] Fix | Delete
$currentPostType = $post_type;
[389] Fix | Delete
}
[390] Fix | Delete
// for editing popup content via page builders on backend
[391] Fix | Delete
if (!isset($_GET) || empty($_GET)) {
[392] Fix | Delete
if (!is_admin() && SG_POPUP_POST_TYPE == $currentPostType && !is_preview()) {
[393] Fix | Delete
// it's for seo optimization
[394] Fix | Delete
status_header(301);
[395] Fix | Delete
$homeURL = home_url();
[396] Fix | Delete
wp_redirect($homeURL);
[397] Fix | Delete
exit();
[398] Fix | Delete
}
[399] Fix | Delete
}
[400] Fix | Delete
}
[401] Fix | Delete
[402] Fix | Delete
public function preGetPosts($query)
[403] Fix | Delete
{
[404] Fix | Delete
if (!is_admin() || !isset($_GET['post_type']) || sanitize_text_field($_GET['post_type']) != SG_POPUP_POST_TYPE) {
[405] Fix | Delete
return false;
[406] Fix | Delete
}
[407] Fix | Delete
[408] Fix | Delete
// change default order by id and desc
[409] Fix | Delete
if (!isset($_GET['orderby'])) {
[410] Fix | Delete
$query->set('orderby', 'ID');
[411] Fix | Delete
$query->set('order', 'desc');
[412] Fix | Delete
}
[413] Fix | Delete
$query = apply_filters('sgpbPreGetPosts', $query);
[414] Fix | Delete
[415] Fix | Delete
return true;
[416] Fix | Delete
}
[417] Fix | Delete
[418] Fix | Delete
public function pluginNotices()
[419] Fix | Delete
{
[420] Fix | Delete
[421] Fix | Delete
if (function_exists('get_current_screen')) {
[422] Fix | Delete
$screen = get_current_screen();
[423] Fix | Delete
$screenId = $screen->id;
[424] Fix | Delete
if ($screenId == 'edit-popupbuilder') {
[425] Fix | Delete
$notificationsObj = new SGPBNotificationCenter();
[426] Fix | Delete
echo wp_kses($notificationsObj->displayNotifications(), AdminHelper::allowed_html_tags());
[427] Fix | Delete
}
[428] Fix | Delete
}
[429] Fix | Delete
$extensions = AdminHelper::getAllActiveExtensions();
[430] Fix | Delete
$updated = get_option('sgpb_extensions_updated');
[431] Fix | Delete
[432] Fix | Delete
$content = '';
[433] Fix | Delete
$scan_spam_code = AdminHelper::sgpbScanCustomJsProblem();
[434] Fix | Delete
if( $scan_spam_code !== false )
[435] Fix | Delete
{
[436] Fix | Delete
$content.= AdminHelper::renderAlertCustomJsProblem( $scan_spam_code['marked_code'] );
[437] Fix | Delete
}
[438] Fix | Delete
else
[439] Fix | Delete
{
[440] Fix | Delete
if (get_option('sgpb-disable-custom-js')) {
[441] Fix | Delete
$content.= AdminHelper::renderAlertEnableCustomJS();
[442] Fix | Delete
}
[443] Fix | Delete
}
[444] Fix | Delete
[445] Fix | Delete
// if popup builder has the old version
[446] Fix | Delete
if (!get_option('SGPB_POPUP_VERSION')) {
[447] Fix | Delete
echo wp_kses( $content, AdminHelper::allowed_html_tags() );
[448] Fix | Delete
return true;
[449] Fix | Delete
}
[450] Fix | Delete
$alertProblem = get_option('sgpb_alert_problems');
[451] Fix | Delete
// for old users show alert about problems
[452] Fix | Delete
if (!$alertProblem) {
[453] Fix | Delete
echo wp_kses(AdminHelper::renderAlertProblem(), AdminHelper::allowed_html_tags());
[454] Fix | Delete
}
[455] Fix | Delete
// Don't show the banner if there's not any extension of Popup Builder or if the user has clicked "don't show"
[456] Fix | Delete
if (empty($extensions) || $updated) {
[457] Fix | Delete
return $content;
[458] Fix | Delete
}
[459] Fix | Delete
ob_start();
[460] Fix | Delete
?>
[461] Fix | Delete
<div id="welcome-panel" class="update-nag sgpb-extensions-notices">
[462] Fix | Delete
<div class="welcome-panel-content">
[463] Fix | Delete
<?php echo wp_kses(AdminHelper::renderExtensionsContent(), AdminHelper::allowed_html_tags()); ?>
[464] Fix | Delete
</div>
[465] Fix | Delete
</div>
[466] Fix | Delete
<?php
[467] Fix | Delete
$content .= ob_get_clean();
[468] Fix | Delete
echo wp_kses($content, AdminHelper::allowed_html_tags());
[469] Fix | Delete
return true;
[470] Fix | Delete
}
[471] Fix | Delete
[472] Fix | Delete
private function registerImporter()
[473] Fix | Delete
{
[474] Fix | Delete
require_once SG_POPUP_LIBS_PATH.'Importer.php';
[475] Fix | Delete
$importer = new WP_Import();
[476] Fix | Delete
register_importer(SG_POPUP_POST_TYPE, SG_POPUP_POST_TYPE, __('Importer', 'popup-builder'), array($importer, 'dispatch'));
[477] Fix | Delete
}
[478] Fix | Delete
[479] Fix | Delete
public function pluginLoaded()
[480] Fix | Delete
{
[481] Fix | Delete
$this->registerImporter();
[482] Fix | Delete
$versionPopup = get_option('SGPB_POPUP_VERSION');
[483] Fix | Delete
$convert = get_option('sgpbConvertToNewVersion');
[484] Fix | Delete
$unsubscribeColumnFixed = get_option('sgpbUnsubscribeColumnFixed');
[485] Fix | Delete
AdminHelper::makeRegisteredPluginsStaticPathsToDynamic();
[486] Fix | Delete
[487] Fix | Delete
if (!$unsubscribeColumnFixed) {
[488] Fix | Delete
AdminHelper::addUnsubscribeColumn();
[489] Fix | Delete
update_option('sgpbUnsubscribeColumnFixed', 1);
[490] Fix | Delete
delete_option('sgpbUnsubscribeColumn');
[491] Fix | Delete
}
[492] Fix | Delete
[493] Fix | Delete
if ($versionPopup && !$convert) {
[494] Fix | Delete
update_option('sgpbConvertToNewVersion', 1);
[495] Fix | Delete
ConvertToNewVersion::convert();
[496] Fix | Delete
Installer::registerPlugin();
[497] Fix | Delete
}
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function