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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/poptin
File: poptin.php
)
[500] Fix | Delete
));
[501] Fix | Delete
}
[502] Fix | Delete
[503] Fix | Delete
/**
[504] Fix | Delete
* Scope: Public
[505] Fix | Delete
* Function: add_poptin_id
[506] Fix | Delete
* Description: AJAX wrapper for adding Poptin ID, only used when user enters the Poptin ID manually.
[507] Fix | Delete
* Parameters: None
[508] Fix | Delete
*/
[509] Fix | Delete
function add_poptin_id()
[510] Fix | Delete
{
[511] Fix | Delete
if (!current_user_can('manage_options')) {
[512] Fix | Delete
die('You now allowed to do this.');
[513] Fix | Delete
}
[514] Fix | Delete
if (!isset($_POST['data']['nonce']) || !wp_verify_nonce($_POST['data']['nonce'], "ppFormIdRegister")) {
[515] Fix | Delete
die('You now allowed to do this.');
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
if (isset($_POST['data']) && isset($_POST['data']['poptin_id'])) {
[519] Fix | Delete
$id = $_POST['data']['poptin_id'];
[520] Fix | Delete
update_option('poptin_id', $id);
[521] Fix | Delete
poptin_clear_all_caches();
[522] Fix | Delete
die(json_encode(
[523] Fix | Delete
array(
[524] Fix | Delete
'success' => true,
[525] Fix | Delete
'message' => 'Database updated successfully.'
[526] Fix | Delete
)
[527] Fix | Delete
));
[528] Fix | Delete
} else {
[529] Fix | Delete
die(json_encode(
[530] Fix | Delete
array(
[531] Fix | Delete
'success' => false,
[532] Fix | Delete
'message' => 'Wrong id.'
[533] Fix | Delete
)
[534] Fix | Delete
));
[535] Fix | Delete
}
[536] Fix | Delete
}
[537] Fix | Delete
[538] Fix | Delete
[539] Fix | Delete
/**
[540] Fix | Delete
*
[541] Fix | Delete
*
[542] Fix | Delete
* Scope: Private
[543] Fix | Delete
* Function: poptin_middleware_registration_curl
[544] Fix | Delete
* Description:
[545] Fix | Delete
* Arguments:
[546] Fix | Delete
* Return: JSON Response
[547] Fix | Delete
*
[548] Fix | Delete
*
[549] Fix | Delete
**/
[550] Fix | Delete
private function poptin_middleware_registration_curl($first_name, $last_name, $domain, $email)
[551] Fix | Delete
{
[552] Fix | Delete
/*
[553] Fix | Delete
* Because Wordpress doesn't provide one
[554] Fix | Delete
* We will rely on the Middleware's Country Code for this one
[555] Fix | Delete
* Overriding Country Code
[556] Fix | Delete
*/
[557] Fix | Delete
/*
[558] Fix | Delete
* Not sending First + Last Name as per Gal Dubinski
[559] Fix | Delete
* first_name => $first_name,
[560] Fix | Delete
last_name => $last_name,
[561] Fix | Delete
*/
[562] Fix | Delete
$curl_URL = POPTIN_MARKETPLACE_REGISTER_URL;
[563] Fix | Delete
$curl_post_array = array(
[564] Fix | Delete
'domain' => $domain,
[565] Fix | Delete
'marketplace' => POPTIN_MARKETPLACE,
[566] Fix | Delete
'email' => $email
[567] Fix | Delete
);
[568] Fix | Delete
[569] Fix | Delete
$curl_options = $this->generate_curl_options($curl_URL, $curl_post_array);
[570] Fix | Delete
$curl = curl_init();
[571] Fix | Delete
curl_setopt_array($curl, $curl_options);
[572] Fix | Delete
$response = curl_exec($curl);
[573] Fix | Delete
$err = curl_error($curl);
[574] Fix | Delete
curl_close($curl);
[575] Fix | Delete
$response_return_array = array();
[576] Fix | Delete
if ($err) {
[577] Fix | Delete
$response_return_array['success'] = false;
[578] Fix | Delete
$response_return_array['message'] = "Internal error occurred. Please try again later.";
[579] Fix | Delete
echo json_encode($response_return_array);
[580] Fix | Delete
exit(0);
[581] Fix | Delete
} else {
[582] Fix | Delete
$response_array = json_decode($response);
[583] Fix | Delete
if ($response_array->success) {
[584] Fix | Delete
$response_return_array['success'] = true;
[585] Fix | Delete
$response_return_array['message'] = "Registration successful";
[586] Fix | Delete
$response_return_array['js_client_id'] = $response_array->client_id;
[587] Fix | Delete
$response_return_array['user_token'] = $response_array->token;
[588] Fix | Delete
[589] Fix | Delete
[590] Fix | Delete
/**
[591] Fix | Delete
* On Success
[592] Fix | Delete
* We setup the update options
[593] Fix | Delete
*/
[594] Fix | Delete
update_option("poptin_id", $response_array->client_id);
[595] Fix | Delete
update_option("poptin_user_id", $response_array->user_id);
[596] Fix | Delete
update_option("poptin_marketplace_token", $response_array->token);
[597] Fix | Delete
update_option("poptin_marketplace_email_id", $email);
[598] Fix | Delete
poptin_clear_all_caches();
[599] Fix | Delete
echo json_encode($response_return_array);
[600] Fix | Delete
exit(0);
[601] Fix | Delete
} else {
[602] Fix | Delete
$response_return_array['success'] = false;
[603] Fix | Delete
$response_return_array['message'] = $response_array->message;
[604] Fix | Delete
echo json_encode($response_return_array);
[605] Fix | Delete
exit(0);
[606] Fix | Delete
}
[607] Fix | Delete
}
[608] Fix | Delete
}
[609] Fix | Delete
[610] Fix | Delete
/**
[611] Fix | Delete
* Scope: Private
[612] Fix | Delete
* Function: generate_curl_options
[613] Fix | Delete
* Description: This is Utility Function generates the POST cURL calls options.
[614] Fix | Delete
* Have placed a function to ensure it remains generic and updates do not require many changes.
[615] Fix | Delete
* Uses the CA Cert certificate.
[616] Fix | Delete
* Return: Array | Options Array for cURL Post method call.
[617] Fix | Delete
**/
[618] Fix | Delete
private function generate_curl_options($curl_URL, $curl_post_array)
[619] Fix | Delete
{
[620] Fix | Delete
$curl_options_array = array(
[621] Fix | Delete
CURLOPT_URL => $curl_URL,
[622] Fix | Delete
CURLOPT_RETURNTRANSFER => true,
[623] Fix | Delete
CURLOPT_ENCODING => "",
[624] Fix | Delete
CURLOPT_MAXREDIRS => 20,
[625] Fix | Delete
CURLOPT_TIMEOUT => 120,
[626] Fix | Delete
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
[627] Fix | Delete
CURLOPT_CUSTOMREQUEST => "POST",
[628] Fix | Delete
CURLOPT_POSTFIELDS => $curl_post_array,
[629] Fix | Delete
CURLOPT_CAINFO => POPTIN_CACERT_PATH
[630] Fix | Delete
);
[631] Fix | Delete
return $curl_options_array;
[632] Fix | Delete
}
[633] Fix | Delete
}
[634] Fix | Delete
[635] Fix | Delete
/**
[636] Fix | Delete
* Scope: Public
[637] Fix | Delete
* Function: poptin_shortcode
[638] Fix | Delete
* Description: Converts the content value to poptin div.
[639] Fix | Delete
* [poptin-embed 123456789] => <div class='poptin-123456789'></div>
[640] Fix | Delete
* Return: Echo of generated <div></div>
[641] Fix | Delete
**/
[642] Fix | Delete
function poptin_shortcode($arguments)
[643] Fix | Delete
{
[644] Fix | Delete
if(isset($arguments[0]) && !empty($arguments[0])) {
[645] Fix | Delete
$poptin_div_id = $arguments[0];
[646] Fix | Delete
return "<div class='poptin-'".esc_attr($poptin_div_id)."'></div>";
[647] Fix | Delete
}
[648] Fix | Delete
}
[649] Fix | Delete
// add_shortcode('poptin-embed', 'poptin_shortcode');
[650] Fix | Delete
[651] Fix | Delete
/**
[652] Fix | Delete
* Scope: Public
[653] Fix | Delete
* Function: poptin_shortcode_form
[654] Fix | Delete
* Description: Converts the content value to poptin form.
[655] Fix | Delete
* [poptin-form 123456789] => <div class="poptin-embedded" data-id="123456789"></div>
[656] Fix | Delete
* Return: Echo of generated <div></div>
[657] Fix | Delete
**/
[658] Fix | Delete
function poptin_shortcode_form($arguments)
[659] Fix | Delete
{
[660] Fix | Delete
if(isset($arguments[0]) && !empty($arguments[0])) {
[661] Fix | Delete
$poptin_div_id = $arguments[0];
[662] Fix | Delete
return "<div class='poptin-embedded' data-id='" . esc_attr($poptin_div_id) . "'></div>";
[663] Fix | Delete
}
[664] Fix | Delete
}
[665] Fix | Delete
add_shortcode('poptin-form', 'poptin_shortcode_form');
[666] Fix | Delete
[667] Fix | Delete
/**
[668] Fix | Delete
* Scope: Public
[669] Fix | Delete
* Function: async_scripts
[670] Fix | Delete
* Description: Async URL for changes from asyncload to async='async'
[671] Fix | Delete
* Return: Async URL
[672] Fix | Delete
**/
[673] Fix | Delete
function async_scripts($url)
[674] Fix | Delete
{
[675] Fix | Delete
if (strpos($url, '#asyncload') === false)
[676] Fix | Delete
return $url;
[677] Fix | Delete
else if (is_admin())
[678] Fix | Delete
return str_replace('#asyncload', '', $url);
[679] Fix | Delete
else
[680] Fix | Delete
return str_replace('#asyncload', '', $url) . "' async='async";
[681] Fix | Delete
}
[682] Fix | Delete
[683] Fix | Delete
/**
[684] Fix | Delete
* Scope: Public
[685] Fix | Delete
* Function: poptin_plugin_redirect
[686] Fix | Delete
* Description: Called via admin_init action in Constructor
[687] Fix | Delete
* Will redirect to the plugin page if the poptin_plugin_redirection is setup.
[688] Fix | Delete
* Once redirection is pushed, the key is removed.
[689] Fix | Delete
* Return: void
[690] Fix | Delete
**/
[691] Fix | Delete
function poptin_plugin_redirect()
[692] Fix | Delete
{
[693] Fix | Delete
if (!defined("DOING_AJAX") && get_option('poptin_plugin_redirection', false)) {
[694] Fix | Delete
delete_option('poptin_plugin_redirection');
[695] Fix | Delete
exit(wp_redirect("admin.php?page=Poptin"));
[696] Fix | Delete
}
[697] Fix | Delete
}
[698] Fix | Delete
[699] Fix | Delete
[700] Fix | Delete
/**
[701] Fix | Delete
* Scope: Public
[702] Fix | Delete
* Function: poptin_activation_hook
[703] Fix | Delete
* Description: On installation of the plugin this will be called.
[704] Fix | Delete
* We want to setup/update poptin related options at this time.
[705] Fix | Delete
* Options to change to blank
[706] Fix | Delete
* - poptin_id [Poptin ID used for JS injection]
[707] Fix | Delete
* - poptin_marketplace_token [Poptin Marketplace Token | Generated at the time of registration from the plugin ONLY]
[708] Fix | Delete
* - poptin_marketplace_email_id [Poptin Marketplace Email ID | used at the time of registration from the plugin ONLY]
[709] Fix | Delete
* Return: void
[710] Fix | Delete
**/
[711] Fix | Delete
function poptin_activation_hook()
[712] Fix | Delete
{
[713] Fix | Delete
/**
[714] Fix | Delete
* We want these three options to be blank on activation/installation of the plugin
[715] Fix | Delete
*/
[716] Fix | Delete
add_option('poptin_id', '', '', 'yes');
[717] Fix | Delete
add_option("poptin_marketplace_token", "", '', 'yes');
[718] Fix | Delete
add_option("poptin_marketplace_email_id", "", '', 'yes');
[719] Fix | Delete
add_option("poptin_user_id", "", '', 'yes');
[720] Fix | Delete
[721] Fix | Delete
/**
[722] Fix | Delete
* We want to take the user to the Plugin Page on installation.
[723] Fix | Delete
* Hence setting up a temporary redirection key.
[724] Fix | Delete
* It gets removed as soon as it's called for the first time.
[725] Fix | Delete
* Ussage at : poptin_plugin_redirect, and called with admin_init
[726] Fix | Delete
*/
[727] Fix | Delete
if(!defined("DOING_AJAX")) {
[728] Fix | Delete
add_option('poptin_plugin_redirection', true);
[729] Fix | Delete
}
[730] Fix | Delete
}
[731] Fix | Delete
[732] Fix | Delete
[733] Fix | Delete
/**
[734] Fix | Delete
* Scope: Public
[735] Fix | Delete
* Function: poptin_decativation_hook
[736] Fix | Delete
* Description: On deactivation of the plugin this will be called.
[737] Fix | Delete
* We want to delete poptin related options at this time.
[738] Fix | Delete
* Options to change to remove
[739] Fix | Delete
* - poptin_id [Poptin ID used for JS injection]
[740] Fix | Delete
* - poptin_marketplace_token [Poptin Marketplace Token | Generated at the time of registration from the plugin ONLY]
[741] Fix | Delete
* - poptin_marketplace_email_id [Poptin Marketplace Email ID | used at the time of registration from the plugin ONLY]
[742] Fix | Delete
* Return: void
[743] Fix | Delete
**/
[744] Fix | Delete
function poptin_deactivation_hook()
[745] Fix | Delete
{
[746] Fix | Delete
delete_option('poptin_id');
[747] Fix | Delete
delete_option('poptin_marketplace_token');
[748] Fix | Delete
delete_option('poptin_marketplace_email_id');
[749] Fix | Delete
delete_option('poptin_user_id');
[750] Fix | Delete
[751] Fix | Delete
/**
[752] Fix | Delete
* If At all this was not removed already
[753] Fix | Delete
*/
[754] Fix | Delete
delete_option('poptin_plugin_redirection');
[755] Fix | Delete
poptin_clear_all_caches();
[756] Fix | Delete
}
[757] Fix | Delete
[758] Fix | Delete
/**
[759] Fix | Delete
* Scope: Public
[760] Fix | Delete
* Function: poptin_clear_all_caches
[761] Fix | Delete
* Description: Clears caches from below plugins if any
[762] Fix | Delete
* - W3Total Cache
[763] Fix | Delete
* - SuperCache
[764] Fix | Delete
* - WPFastestCache
[765] Fix | Delete
* - WP Engine
[766] Fix | Delete
* Return: void
[767] Fix | Delete
**/
[768] Fix | Delete
function poptin_clear_all_caches()
[769] Fix | Delete
{
[770] Fix | Delete
try {
[771] Fix | Delete
global $wp_fastest_cache;
[772] Fix | Delete
// if W3 Total Cache is being used, clear the cache
[773] Fix | Delete
if (function_exists('w3tc_flush_all')) {
[774] Fix | Delete
w3tc_flush_all();
[775] Fix | Delete
}
[776] Fix | Delete
/* if WP Super Cache is being used, clear the cache */
[777] Fix | Delete
if (function_exists('wp_cache_clean_cache')) {
[778] Fix | Delete
global $file_prefix, $supercachedir;
[779] Fix | Delete
if (empty($supercachedir) && function_exists('get_supercache_dir')) {
[780] Fix | Delete
$supercachedir = get_supercache_dir();
[781] Fix | Delete
}
[782] Fix | Delete
wp_cache_clean_cache($file_prefix);
[783] Fix | Delete
}
[784] Fix | Delete
[785] Fix | Delete
if (class_exists('WpeCommon')) {
[786] Fix | Delete
//be extra careful, just in case 3rd party changes things on us
[787] Fix | Delete
if (method_exists('WpeCommon', 'purge_memcached')) {
[788] Fix | Delete
//WpeCommon::purge_memcached();
[789] Fix | Delete
}
[790] Fix | Delete
if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
[791] Fix | Delete
//WpeCommon::clear_maxcdn_cache();
[792] Fix | Delete
}
[793] Fix | Delete
if (method_exists('WpeCommon', 'purge_varnish_cache')) {
[794] Fix | Delete
//WpeCommon::purge_varnish_cache();
[795] Fix | Delete
}
[796] Fix | Delete
}
[797] Fix | Delete
[798] Fix | Delete
if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
[799] Fix | Delete
$wp_fastest_cache->deleteCache();
[800] Fix | Delete
}
[801] Fix | Delete
if (function_exists('rocket_clean_domain')) {
[802] Fix | Delete
rocket_clean_domain();
[803] Fix | Delete
// Preload cache.
[804] Fix | Delete
if (function_exists('run_rocket_sitemap_preload')) {
[805] Fix | Delete
run_rocket_sitemap_preload();
[806] Fix | Delete
}
[807] Fix | Delete
}
[808] Fix | Delete
[809] Fix | Delete
if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) {
[810] Fix | Delete
autoptimizeCache::clearall();
[811] Fix | Delete
}
[812] Fix | Delete
[813] Fix | Delete
if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) {
[814] Fix | Delete
LiteSpeed_Cache_API::purge_all();
[815] Fix | Delete
}
[816] Fix | Delete
[817] Fix | Delete
if (class_exists('\Hummingbird\Core\Utils')) {
[818] Fix | Delete
[819] Fix | Delete
$modules = Utils::get_active_cache_modules();
[820] Fix | Delete
foreach ($modules as $module => $name) {
[821] Fix | Delete
$mod = Utils::get_module($module);
[822] Fix | Delete
[823] Fix | Delete
if ($mod->is_active()) {
[824] Fix | Delete
if ('minify' === $module) {
[825] Fix | Delete
$mod->clear_files();
[826] Fix | Delete
} else {
[827] Fix | Delete
$mod->clear_cache();
[828] Fix | Delete
}
[829] Fix | Delete
}
[830] Fix | Delete
}
[831] Fix | Delete
}
[832] Fix | Delete
} catch (Exception $e) {
[833] Fix | Delete
return 1;
[834] Fix | Delete
}
[835] Fix | Delete
}
[836] Fix | Delete
$poptinBase = new POPTIN_Plugin_Base();
[837] Fix | Delete
?>
[838] Fix | Delete
[839] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function