Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/hostinge.../includes
File: Helper.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Hostinger;
[2] Fix | Delete
[3] Fix | Delete
defined( 'ABSPATH' ) || exit;
[4] Fix | Delete
[5] Fix | Delete
class Helper {
[6] Fix | Delete
public const HOSTINGER_FREE_SUBDOMAIN_URL = 'hostingersite.com';
[7] Fix | Delete
public const HOSTINGER_PAGE = '/wp-admin/admin.php?page=hostinger';
[8] Fix | Delete
public const CLIENT_WOO_COMPLETED_ACTIONS = 'woocommerce_task_list_tracked_completed_tasks';
[9] Fix | Delete
private const PROMOTIONAL_LINKS = array(
[10] Fix | Delete
'fr_FR' => 'https://www.hostinger.fr/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[11] Fix | Delete
'es_ES' => 'https://www.hostinger.es/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[12] Fix | Delete
'ar' => 'https://www.hostinger.ae/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[13] Fix | Delete
'zh_CN' => 'https://www.hostinger.com.hk/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[14] Fix | Delete
'id_ID' => 'https://www.hostinger.co.id/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[15] Fix | Delete
'lt_LT' => 'https://www.hostinger.lt/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[16] Fix | Delete
'pt_PT' => 'https://www.hostinger.pt/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[17] Fix | Delete
'uk' => 'https://www.hostinger.com.ua/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[18] Fix | Delete
'tr_TR' => 'https://www.hostinger.com.tr/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[19] Fix | Delete
'en_US' => 'https://www.hostinger.com/cpanel-login?r=%2Fjump-to%2Fnew-panel%2Fsection%2Freferrals&utm_source=Banner&utm_medium=HostingerWPplugin',
[20] Fix | Delete
);
[21] Fix | Delete
[22] Fix | Delete
private const HPANEL_DOMAIN_URL = 'https://hpanel.hostinger.com/websites/';
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
*
[26] Fix | Delete
* Check if plugin is active
[27] Fix | Delete
*
[28] Fix | Delete
* @since 1.0.0
[29] Fix | Delete
* @access public
[30] Fix | Delete
*/
[31] Fix | Delete
public static function is_plugin_active( $plugin_slug ): bool {
[32] Fix | Delete
$active_plugins = (array) get_option( 'active_plugins', array() );
[33] Fix | Delete
foreach ( $active_plugins as $active_plugin ) {
[34] Fix | Delete
if ( strpos( $active_plugin, $plugin_slug . '.php' ) !== false ) {
[35] Fix | Delete
return true;
[36] Fix | Delete
}
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
return false;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function is_preview_domain( $headers = null ): bool {
[43] Fix | Delete
// @codeCoverageIgnoreStart
[44] Fix | Delete
if ( $headers === null && function_exists( 'getallheaders' ) ) {
[45] Fix | Delete
$headers = getallheaders();
[46] Fix | Delete
}
[47] Fix | Delete
// @codeCoverageIgnoreEnd
[48] Fix | Delete
if ( isset( $headers['X-Preview-Indicator'] ) && $headers['X-Preview-Indicator'] ) {
[49] Fix | Delete
return true;
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
return false;
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
public static function woocommerce_onboarding_choice(): bool {
[56] Fix | Delete
return (bool) get_option( 'hostinger_woo_onboarding_choice', false );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
public static function generate_bypass_code( $length ) {
[60] Fix | Delete
$characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
[61] Fix | Delete
$code = '';
[62] Fix | Delete
$max_index = strlen( $characters ) - 1;
[63] Fix | Delete
[64] Fix | Delete
for ( $i = 0; $i < $length; $i++ ) {
[65] Fix | Delete
$random_index = wp_rand( 0, $max_index );
[66] Fix | Delete
$code .= $characters[ $random_index ];
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
return $code;
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
public function should_plugin_split_notice_shown() {
[73] Fix | Delete
$plugin_split_notice_hidden = get_transient( 'hts_plugin_split_notice_hidden' );
[74] Fix | Delete
[75] Fix | Delete
if ( $plugin_split_notice_hidden !== false ) {
[76] Fix | Delete
return false;
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
if ( ! version_compare( HOSTINGER_VERSION, '3.0.0', '>=' ) ) {
[80] Fix | Delete
return false;
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
if ( is_plugin_active( 'hostinger-easy-onboarding/hostinger-easy-onboarding.php' ) ) {
[84] Fix | Delete
return false;
[85] Fix | Delete
}
[86] Fix | Delete
[87] Fix | Delete
return true;
[88] Fix | Delete
}
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
$hostinger_helper = new Helper();
[92] Fix | Delete
[93] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function