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/clone/wp-conte.../plugins/poptin
File: poptin.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
Plugin Name: Poptin
[2] Fix | Delete
Contributors: galdub, tomeraharon
[3] Fix | Delete
Description: Use Poptin to get more leads, sales, and email subscribers. Create targeted beautiful pop ups and forms in less than 2 minutes with ease.
[4] Fix | Delete
Version: 1.3.2
[5] Fix | Delete
Author: Poptin
[6] Fix | Delete
Author URI: https://www.poptin.com
[7] Fix | Delete
Text Domain: poptin
[8] Fix | Delete
Domain Path: /lang
[9] Fix | Delete
License: GPL2
[10] Fix | Delete
*/
[11] Fix | Delete
[12] Fix | Delete
// Prevent direct file access
[13] Fix | Delete
use Hummingbird\Core\Utils;
[14] Fix | Delete
[15] Fix | Delete
if (!defined('ABSPATH')) {
[16] Fix | Delete
exit;
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
define('POPTIN_VERSION', '1.3.2');
[20] Fix | Delete
define('POPTIN_PATH', dirname(__FILE__));
[21] Fix | Delete
define('POPTIN_PATH_INCLUDES', dirname(__FILE__) . '/inc');
[22] Fix | Delete
define('POPTIN_FOLDER', basename(POPTIN_PATH));
[23] Fix | Delete
define('POPTIN_URL', plugins_url() . '/' . POPTIN_FOLDER);
[24] Fix | Delete
define('POPTIN_URL_INCLUDES', POPTIN_URL . '/inc');
[25] Fix | Delete
[26] Fix | Delete
define('POPTIN_ID', get_option('poptin_id'));
[27] Fix | Delete
define('POPTIN_USER_ID', get_option('poptin_user_id'));
[28] Fix | Delete
define('POPTIN_MARKETPLACE_TOKEN', get_option('poptin_marketplace_token'));
[29] Fix | Delete
define('POPTIN_MARKETPLACE_EMAIL_ID', get_option('poptin_marketplace_email_id'));
[30] Fix | Delete
define('POPTIN_FRONT_SITE', 'https://www.poptin.com');
[31] Fix | Delete
[32] Fix | Delete
define('POPTIN_MARKETPLACE', 'Wrdprs');
[33] Fix | Delete
define('POPTIN_MARKETPLACE_LOGIN_URL', 'https://app.popt.in/api/marketplace/auth');
[34] Fix | Delete
define('POPTIN_MARKETPLACE_REGISTER_URL', 'https://app.popt.in/api/marketplace/register');
[35] Fix | Delete
define('POPTIN_CACERT_PATH', POPTIN_PATH . "/assets/ca-cert/cacert-2017-06-07.pem");
[36] Fix | Delete
[37] Fix | Delete
[38] Fix | Delete
if (is_admin()) {
[39] Fix | Delete
include_once "class-affiliate.php";
[40] Fix | Delete
}
[41] Fix | Delete
class POPTIN_Plugin_Base
[42] Fix | Delete
{
[43] Fix | Delete
public function __construct()
[44] Fix | Delete
{
[45] Fix | Delete
/**
[46] Fix | Delete
* Activation Hook
[47] Fix | Delete
* Deactivation Hook
[48] Fix | Delete
*/
[49] Fix | Delete
register_activation_hook(__FILE__, 'poptin_activation_hook');
[50] Fix | Delete
register_deactivation_hook(__FILE__, 'poptin_deactivation_hook');
[51] Fix | Delete
[52] Fix | Delete
add_action('admin_enqueue_scripts', array($this, 'poptin_add_admin_javascript'));
[53] Fix | Delete
add_action('admin_enqueue_scripts', array($this, 'poptin_add_admin_css'));
[54] Fix | Delete
// register admin pages for the plugin
[55] Fix | Delete
add_action('admin_menu', array($this, 'poptin_admin_pages_callback'));
[56] Fix | Delete
[57] Fix | Delete
// Translation-ready
[58] Fix | Delete
add_action('plugins_loaded', array($this, 'poptin_add_textdomain'));
[59] Fix | Delete
[60] Fix | Delete
$poptinidcheck = get_option('poptin_id', (isset($myOption_def) ? $myOption_def : false));
[61] Fix | Delete
if ($poptinidcheck) {
[62] Fix | Delete
$poptinid = get_option('poptin_id');
[63] Fix | Delete
if (strlen($poptinid) != 13) {
[64] Fix | Delete
update_option('poptin_id', '');
[65] Fix | Delete
} else {
[66] Fix | Delete
add_action('wp_head', array($this, 'poptin_add_script_frontend'));
[67] Fix | Delete
}
[68] Fix | Delete
}
[69] Fix | Delete
// Add actions for storing value and fetching URL
[70] Fix | Delete
// use the wp_ajax_nopriv_ hook for non-logged users (handle guest actions)
[71] Fix | Delete
[72] Fix | Delete
/**
[73] Fix | Delete
* AJAX Calls registration
[74] Fix | Delete
* Action => name followed after wp_ajax
[75] Fix | Delete
*/
[76] Fix | Delete
add_action('wp_ajax_poptin_register', array($this, 'poptin_marketplace_registration'));
[77] Fix | Delete
add_action('wp_ajax_poptin_logmein', array($this, 'poptin_markplace_login'));
[78] Fix | Delete
add_action('wp_ajax_delete-id', array($this, 'delete_poptin_id'));
[79] Fix | Delete
add_action('wp_ajax_add-id', array($this, 'add_poptin_id'));
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
*
[83] Fix | Delete
* Admin Initialization calls registration
[84] Fix | Delete
* We need this to send user to Poptin's Admin page on activation
[85] Fix | Delete
*
[86] Fix | Delete
*/
[87] Fix | Delete
add_action('admin_init', 'poptin_plugin_redirect');
[88] Fix | Delete
add_filter('admin_footer_text', array($this, 'replace_footer_text'));
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
*
[92] Fix | Delete
* Admin Initialization calls registration
[93] Fix | Delete
* We need this to send user to Poptin's Admin page on activation
[94] Fix | Delete
*
[95] Fix | Delete
*/
[96] Fix | Delete
if (isset($_GET['poptin_logmein'])) {
[97] Fix | Delete
if (!function_exists('is_user_logged_in')) {
[98] Fix | Delete
require_once(ABSPATH . "wp-includes/pluggable.php");
[99] Fix | Delete
}
[100] Fix | Delete
if (is_user_logged_in()) {
[101] Fix | Delete
if (current_user_can('administrator')) {
[102] Fix | Delete
$after_registration = '';
[103] Fix | Delete
if (isset($_GET['after_registration'])) {
[104] Fix | Delete
$after_registration = $_GET['after_registration'];
[105] Fix | Delete
}
[106] Fix | Delete
$this->poptin_markplace_login_direct($after_registration);
[107] Fix | Delete
} else {
[108] Fix | Delete
echo '<style>html {background: #f1f1f1;}body{margin:0;padding:0;}h1 {background: #fff;font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;padding: 1em 2em;-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);text-align:center;color: #666;font-size: 24px;margin: 30px auto 0;padding:20px;display:table;border-radius:5px}</style>';
[109] Fix | Delete
echo '<h1>Please login as administrator</h1>';
[110] Fix | Delete
die();
[111] Fix | Delete
}
[112] Fix | Delete
} else {
[113] Fix | Delete
wp_redirect(wp_login_url());
[114] Fix | Delete
}
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* Clean Up Of the URL
[119] Fix | Delete
* Not sure why is this here
[120] Fix | Delete
*/
[121] Fix | Delete
add_filter('clean_url', 'async_scripts', 11, 1);
[122] Fix | Delete
[123] Fix | Delete
add_action('admin_footer', array($this, 'deactivate_modal'));
[124] Fix | Delete
add_action('wp_ajax_poptin_plugin_deactivate', array($this, 'poptin_plugin_deactivate'));
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* Retrieve the original footer text
[129] Fix | Delete
*
[130] Fix | Delete
* @return string
[131] Fix | Delete
*/
[132] Fix | Delete
private function get_original_text()
[133] Fix | Delete
{
[134] Fix | Delete
global $wp_version;
[135] Fix | Delete
[136] Fix | Delete
/* The way of determining the default footer text was changed in 3.9 */
[137] Fix | Delete
if (version_compare($wp_version, '3.9', '<')) {
[138] Fix | Delete
$text = __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.');
[139] Fix | Delete
} else {
[140] Fix | Delete
/* translators: %s: https://wordpress.org/ */
[141] Fix | Delete
$text = sprintf(__('Thank you for creating with <a href="%s">WordPress</a>.'), __('https://wordpress.org/'));
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
return $text;
[145] Fix | Delete
}
[146] Fix | Delete
/**
[147] Fix | Delete
* Replace the admin footer text
[148] Fix | Delete
*
[149] Fix | Delete
* @param string $footer_text The current footer text
[150] Fix | Delete
*
[151] Fix | Delete
* @return string The new footer text
[152] Fix | Delete
*/
[153] Fix | Delete
function replace_footer_text($footer_text)
[154] Fix | Delete
{
[155] Fix | Delete
return str_replace($this->get_original_text(), '', $footer_text);
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
public function poptin_plugin_deactivate()
[159] Fix | Delete
{
[160] Fix | Delete
if (current_user_can('manage_options')) {
[161] Fix | Delete
$postData = $_POST;
[162] Fix | Delete
$errorCounter = 0;
[163] Fix | Delete
$response = array();
[164] Fix | Delete
$response['status'] = 0;
[165] Fix | Delete
$response['message'] = "";
[166] Fix | Delete
$response['valid'] = 1;
[167] Fix | Delete
$reason = filter_input(INPUT_POST, 'reason');
[168] Fix | Delete
$nonce = filter_input(INPUT_POST, 'nonce');
[169] Fix | Delete
if (empty($reason)) {
[170] Fix | Delete
$errorCounter++;
[171] Fix | Delete
$response['message'] = "Please provide reason";
[172] Fix | Delete
} else if (empty($nonce)) {
[173] Fix | Delete
$response['message'] = esc_html__("Your request is not valid", 'poptin');
[174] Fix | Delete
$errorCounter++;
[175] Fix | Delete
$response['valid'] = 0;
[176] Fix | Delete
} else {
[177] Fix | Delete
if (!wp_verify_nonce($nonce, 'poptin_deactivate_nonce')) {
[178] Fix | Delete
$response['message'] = esc_html__("Your request is not valid", 'poptin');
[179] Fix | Delete
$errorCounter++;
[180] Fix | Delete
$response['valid'] = 0;
[181] Fix | Delete
}
[182] Fix | Delete
}
[183] Fix | Delete
if ($errorCounter == 0) {
[184] Fix | Delete
global $current_user;
[185] Fix | Delete
$email = "none@none.none";
[186] Fix | Delete
if (isset($postData['email_id']) && !empty($postData['email_id']) && filter_var($postData['email_id'], FILTER_VALIDATE_EMAIL)) {
[187] Fix | Delete
$email = $postData['email_id'];
[188] Fix | Delete
}
[189] Fix | Delete
$domain = site_url();
[190] Fix | Delete
$user_name = $current_user->first_name . " " . $current_user->last_name;
[191] Fix | Delete
$subject = "Poptin was removed from {$domain}";
[192] Fix | Delete
$headers = "MIME-Version: 1.0\r\n";
[193] Fix | Delete
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
[194] Fix | Delete
$headers .= 'From: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
[195] Fix | Delete
$headers .= 'Reply-To: ' . $user_name . ' <' . $email . '>' . PHP_EOL;
[196] Fix | Delete
$headers .= 'X-Mailer: PHP/' . phpversion();
[197] Fix | Delete
ob_start();
[198] Fix | Delete
?>
[199] Fix | Delete
<table border="0" cellspacing="0" cellpadding="5">
[200] Fix | Delete
<tr>
[201] Fix | Delete
<th>Plugin</th>
[202] Fix | Delete
<td>Poptin</td>
[203] Fix | Delete
</tr>
[204] Fix | Delete
<tr>
[205] Fix | Delete
<th>Plugin Version</th>
[206] Fix | Delete
<td><?php echo esc_attr(POPTIN_VERSION) ?></td>
[207] Fix | Delete
</tr>
[208] Fix | Delete
<tr>
[209] Fix | Delete
<th>Domain</th>
[210] Fix | Delete
<td><?php echo esc_url($domain) ?></td>
[211] Fix | Delete
</tr>
[212] Fix | Delete
<tr>
[213] Fix | Delete
<th>Email</th>
[214] Fix | Delete
<td><?php echo esc_attr($email) ?></td>
[215] Fix | Delete
</tr>
[216] Fix | Delete
<tr>
[217] Fix | Delete
<th>Reason</th>
[218] Fix | Delete
<td><?php echo nl2br(esc_attr($reason)) ?></td>
[219] Fix | Delete
</tr>
[220] Fix | Delete
<tr>
[221] Fix | Delete
<th>WordPress Version</th>
[222] Fix | Delete
<td><?php echo esc_attr(get_bloginfo('version')) ?></td>
[223] Fix | Delete
</tr>
[224] Fix | Delete
<tr>
[225] Fix | Delete
<th>PHP Version</th>
[226] Fix | Delete
<td><?php echo esc_attr(PHP_VERSION) ?></td>
[227] Fix | Delete
</tr>
[228] Fix | Delete
</table>
[229] Fix | Delete
<?php
[230] Fix | Delete
$content = ob_get_clean();
[231] Fix | Delete
$email_id = "contact@poptin.on.crisp.email";
[232] Fix | Delete
wp_mail($email_id, $subject, $content, $headers);
[233] Fix | Delete
$response['status'] = 1;
[234] Fix | Delete
}
[235] Fix | Delete
echo json_encode($response);
[236] Fix | Delete
wp_die();
[237] Fix | Delete
}
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
public function deactivate_modal()
[241] Fix | Delete
{
[242] Fix | Delete
if (current_user_can('manage_options')) {
[243] Fix | Delete
global $pagenow;
[244] Fix | Delete
[245] Fix | Delete
if ('plugins.php' !== $pagenow) {
[246] Fix | Delete
return;
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
include 'deactivate-form.php';
[250] Fix | Delete
}
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
/**
[254] Fix | Delete
*
[255] Fix | Delete
*
[256] Fix | Delete
* Scope: Private
[257] Fix | Delete
* Function: poptin_marketplace_registration
[258] Fix | Delete
* Description: Will be called via the Admin Page AJAX
[259] Fix | Delete
* Will be checked with WP nounce.
[260] Fix | Delete
* If the verification is OK, we go ahead and create the account.
[261] Fix | Delete
* Email Address - Would be pre-filled in the form in the Admin Page.
[262] Fix | Delete
* User wants, can change the email id.
[263] Fix | Delete
* We store the registration email ID, to ensure that we do not have issues in future.
[264] Fix | Delete
* Basic wrapper function to the poptin_middleware_registration_curl
[265] Fix | Delete
* Responds in JSON from the cURL call.
[266] Fix | Delete
* Parameters: email (argument)
[267] Fix | Delete
* domain - retrieved from the Wordpress base.
[268] Fix | Delete
* first_name - derived from the nice_name of the existing logged in user.
[269] Fix | Delete
* last_name - derived from the nice_name of the existing logged in user.
[270] Fix | Delete
* Return: Return response is derived directly from the chain function poptin_middleware_registration_curl
[271] Fix | Delete
*
[272] Fix | Delete
*
[273] Fix | Delete
*/
[274] Fix | Delete
function poptin_marketplace_registration()
[275] Fix | Delete
{
[276] Fix | Delete
if (!current_user_can('manage_options')) {
[277] Fix | Delete
die('You are now allowed to do this.');
[278] Fix | Delete
}
[279] Fix | Delete
[280] Fix | Delete
$email = sanitize_email($_POST['email']);
[281] Fix | Delete
/**
[282] Fix | Delete
*
[283] Fix | Delete
* We check the sanitization here again for the email id.
[284] Fix | Delete
* This is for AJAX call, hence the double check is required.
[285] Fix | Delete
* If this is okay, we go ahead and send the data poptin_marketplace_registration function.
[286] Fix | Delete
*
[287] Fix | Delete
*/
[288] Fix | Delete
if ($email) {
[289] Fix | Delete
} else {
[290] Fix | Delete
$return_array = array();
[291] Fix | Delete
$return_array['success'] = false;
[292] Fix | Delete
$return_array['message'] = 'Invalid Email Address found.';
[293] Fix | Delete
echo json_encode($return_array);
[294] Fix | Delete
exit(0);
[295] Fix | Delete
}
[296] Fix | Delete
[297] Fix | Delete
if (check_ajax_referer('poptin-fe-register', 'security')) {
[298] Fix | Delete
$domain = site_url();
[299] Fix | Delete
if (!function_exists('wp_get_current_user')) {
[300] Fix | Delete
require_once(ABSPATH . "wp-includes/pluggable.php");
[301] Fix | Delete
}
[302] Fix | Delete
$user_data = wp_get_current_user();
[303] Fix | Delete
$user_nice_name = $user_data->data->user_nicename;
[304] Fix | Delete
$user_nice_name_array = explode(" ", $user_nice_name);
[305] Fix | Delete
$first_name = $user_nice_name_array[0];
[306] Fix | Delete
$last_name = "";
[307] Fix | Delete
if (isset($user_nice_name_array[1])) {
[308] Fix | Delete
$last_name = $user_nice_name_array[1];
[309] Fix | Delete
} else {
[310] Fix | Delete
$last_name = $user_nice_name_array[0];
[311] Fix | Delete
}
[312] Fix | Delete
$this->poptin_middleware_registration_curl($first_name, $last_name, $domain, $email);
[313] Fix | Delete
} else {
[314] Fix | Delete
$return_array = array();
[315] Fix | Delete
$return_array['success'] = false;
[316] Fix | Delete
$return_array['message'] = 'Invalid request. Please refresh & try again.';
[317] Fix | Delete
echo json_encode($return_array);
[318] Fix | Delete
exit(0);
[319] Fix | Delete
}
[320] Fix | Delete
}
[321] Fix | Delete
[322] Fix | Delete
[323] Fix | Delete
[324] Fix | Delete
/**
[325] Fix | Delete
*
[326] Fix | Delete
*
[327] Fix | Delete
* Scope: Private
[328] Fix | Delete
* Function: poptin_markplace_login_direct
[329] Fix | Delete
* Description: Based on the Options stored in the WP database
[330] Fix | Delete
* We make request to the marketplace api for login
[331] Fix | Delete
* In simpler terms this is a wrapper function for making AJAX call -> to cURL call -> to respond back.
[332] Fix | Delete
* Parameters: POST Data NOT required
[333] Fix | Delete
* - token [Generated at the time of registration from the marketplace API ONLY]
[334] Fix | Delete
* - email [Email ID used at the time of registration from the marketplace API ONLY]
[335] Fix | Delete
* Return: login_url - if it went successful
[336] Fix | Delete
* success - true/false
[337] Fix | Delete
*
[338] Fix | Delete
*
[339] Fix | Delete
*/
[340] Fix | Delete
function poptin_markplace_login_direct($after_registration = '')
[341] Fix | Delete
{
[342] Fix | Delete
$token = POPTIN_MARKETPLACE_TOKEN;
[343] Fix | Delete
$user_id = POPTIN_USER_ID;
[344] Fix | Delete
$curl_URL = POPTIN_MARKETPLACE_LOGIN_URL;
[345] Fix | Delete
$curl_post_array = array(
[346] Fix | Delete
'token' => $token,
[347] Fix | Delete
'user_id' => $user_id
[348] Fix | Delete
);
[349] Fix | Delete
$curl_options = $this->generate_curl_options($curl_URL, $curl_post_array);
[350] Fix | Delete
$curl = curl_init();
[351] Fix | Delete
curl_setopt_array($curl, $curl_options);
[352] Fix | Delete
$response = curl_exec($curl);
[353] Fix | Delete
$err = curl_error($curl);
[354] Fix | Delete
curl_close($curl);
[355] Fix | Delete
$response_return_array = array();
[356] Fix | Delete
if ($err) {
[357] Fix | Delete
$response_return_array['success'] = false;
[358] Fix | Delete
echo json_encode($response_return_array);
[359] Fix | Delete
exit(0);
[360] Fix | Delete
} else {
[361] Fix | Delete
$response_array = json_decode($response);
[362] Fix | Delete
if ($response_array->success) {
[363] Fix | Delete
$login_url = $response_array->login_url;
[364] Fix | Delete
// If user just registered
[365] Fix | Delete
if ($after_registration != '') {
[366] Fix | Delete
$login_url .= '&utm_source=wordpress';
[367] Fix | Delete
}
[368] Fix | Delete
header("Location: " . $login_url);
[369] Fix | Delete
exit(0);
[370] Fix | Delete
} else {
[371] Fix | Delete
exit(wp_redirect("admin.php?page=Poptin"));
[372] Fix | Delete
}
[373] Fix | Delete
}
[374] Fix | Delete
exit(wp_redirect("admin.php?page=Poptin"));
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
[378] Fix | Delete
/**
[379] Fix | Delete
* Scope: Public
[380] Fix | Delete
* Function: poptin_add_admin_javascript
[381] Fix | Delete
* Description: Will be called via the Admin Page AJAX
[382] Fix | Delete
* Will be checked with WP nounce.
[383] Fix | Delete
* If the verification is OK, we go ahead and create the account.
[384] Fix | Delete
* Email Address - Would be pre-filled in the form in the Admin Page.
[385] Fix | Delete
* User wants, can change the email id.
[386] Fix | Delete
* We store the registration email ID, to ensure that we do not have issues in future.
[387] Fix | Delete
* Basic wrapper function to the poptin_middleware_registration_curl
[388] Fix | Delete
* Responds in JSON from the cURL call.
[389] Fix | Delete
* Parameters: email (argument)
[390] Fix | Delete
* domain - retrieved from the Wordpress base.
[391] Fix | Delete
* first_name - derived from the nice_name of the existing logged in user.
[392] Fix | Delete
* last_name - derived from the nice_name of the existing logged in user.
[393] Fix | Delete
* Return: Return response is derived directly from the chain function poptin_middleware_registration_curl
[394] Fix | Delete
*/
[395] Fix | Delete
public function poptin_add_admin_javascript($hook)
[396] Fix | Delete
{
[397] Fix | Delete
if ('toplevel_page_Poptin' === $hook) {
[398] Fix | Delete
wp_enqueue_script('jquery');
[399] Fix | Delete
wp_register_script('poptin-admin', plugins_url('assets/js/poptin-admin.js', __FILE__), array('jquery'), '1.0.6', true);
[400] Fix | Delete
wp_enqueue_script('poptin-admin');
[401] Fix | Delete
wp_register_script('bootstrap-modal', plugins_url('assets/js/bootstrap.min.js', __FILE__), array('jquery'), '1.0', true);
[402] Fix | Delete
wp_enqueue_script('bootstrap-modal');
[403] Fix | Delete
}
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
[407] Fix | Delete
[408] Fix | Delete
/**
[409] Fix | Delete
* Scope: Public
[410] Fix | Delete
* Function: poptin_add_script_frontend
[411] Fix | Delete
* Description: Will add the Poptin JS code to the system.
[412] Fix | Delete
* Parameters: None
[413] Fix | Delete
*/
[414] Fix | Delete
public function poptin_add_script_frontend()
[415] Fix | Delete
{
[416] Fix | Delete
echo "<script id='pixel-script-poptin' src='https://cdn.popt.in/pixel.js?id=" . POPTIN_ID . "' async='true'></script> ";
[417] Fix | Delete
}
[418] Fix | Delete
[419] Fix | Delete
/**
[420] Fix | Delete
* Scope: Public
[421] Fix | Delete
* Function: poptin_add_admin_css
[422] Fix | Delete
* Description: Will add the backend CSS required for the display of poptin settings page.
[423] Fix | Delete
* Parameters: hook | Not used.
[424] Fix | Delete
*/
[425] Fix | Delete
public function poptin_add_admin_css($hook)
[426] Fix | Delete
{
[427] Fix | Delete
if ('toplevel_page_Poptin' === $hook) {
[428] Fix | Delete
wp_register_style('poptin-admin', plugins_url('assets/css/poptin-admin.css', __FILE__), array(), '1.1');
[429] Fix | Delete
wp_enqueue_style('poptin-admin');
[430] Fix | Delete
wp_register_style('bootstrap-modal-css', plugins_url('assets/css/bootstrap.min.css', __FILE__), array(), '1.0');
[431] Fix | Delete
wp_enqueue_style('bootstrap-modal-css');
[432] Fix | Delete
}
[433] Fix | Delete
}
[434] Fix | Delete
[435] Fix | Delete
/**
[436] Fix | Delete
* Scope: Public
[437] Fix | Delete
* Function: poptin_admin_pages_callback
[438] Fix | Delete
* Description: Will add the Poptin Page into the Menu System of Wordpress
[439] Fix | Delete
* Parameters: None
[440] Fix | Delete
*/
[441] Fix | Delete
public function poptin_admin_pages_callback()
[442] Fix | Delete
{
[443] Fix | Delete
//$this->check_if_poptin_is_connected();
[444] Fix | Delete
add_menu_page(__("Poptin", 'ppbase'), __("Poptin", 'ppbase'), 'manage_options', 'Poptin', array($this, 'poptin_admin_view'), POPTIN_URL . '/assets/images/menu-icon.png');
[445] Fix | Delete
}
[446] Fix | Delete
[447] Fix | Delete
[448] Fix | Delete
/**
[449] Fix | Delete
* Scope: Public
[450] Fix | Delete
* Function: poptin_admin_view
[451] Fix | Delete
* Description: The URL link is added to render the view setup as per the function
[452] Fix | Delete
* Parameters: None
[453] Fix | Delete
*/
[454] Fix | Delete
public function poptin_admin_view()
[455] Fix | Delete
{
[456] Fix | Delete
include_once(POPTIN_PATH . '/views/poptin_admin_view.php');
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
[460] Fix | Delete
/**
[461] Fix | Delete
* Scope: Public
[462] Fix | Delete
* Function: poptin_add_textdomain
[463] Fix | Delete
* Description: --
[464] Fix | Delete
* Parameters: None
[465] Fix | Delete
*/
[466] Fix | Delete
public function poptin_add_textdomain()
[467] Fix | Delete
{
[468] Fix | Delete
load_plugin_textdomain('poptin', false, dirname(plugin_basename(__FILE__)) . '/lang/');
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
[472] Fix | Delete
[473] Fix | Delete
/**
[474] Fix | Delete
* Scope: Public
[475] Fix | Delete
* Function: delete_poptin_id
[476] Fix | Delete
* Description: AJAX wrapper for removing Poptin ID
[477] Fix | Delete
* Parameters: None
[478] Fix | Delete
*/
[479] Fix | Delete
function delete_poptin_id()
[480] Fix | Delete
{
[481] Fix | Delete
if (!current_user_can('manage_options')) {
[482] Fix | Delete
die('You now allowed to do this.');
[483] Fix | Delete
}
[484] Fix | Delete
[485] Fix | Delete
[486] Fix | Delete
if (!isset($_POST['data']['nonce']) || !wp_verify_nonce($_POST['data']['nonce'], "ppFormIdDeactivate")) {
[487] Fix | Delete
die('You now allowed to do this.');
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
update_option('poptin_id', '');
[491] Fix | Delete
update_option('poptin_marketplace_token', '');
[492] Fix | Delete
update_option('poptin_marketplace_email_id', '');
[493] Fix | Delete
update_option('poptin_user_id', '');
[494] Fix | Delete
poptin_clear_all_caches();
[495] Fix | Delete
die(json_encode(
[496] Fix | Delete
array(
[497] Fix | Delete
'success' => true,
[498] Fix | Delete
'message' => 'Database updated successfully.'
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function