??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/sendmaxagency.com/wp-content/plugins/surerank/inc/functions/utils.php
⬅ Kembali
<?php
/**
* Utils.
*
* Utils module class for handling utils functions.
*
* @package SureRank\Inc\Functions;
* @since 1.5.0
*/
namespace SureRank\Inc\Functions;
use SureRank\Inc\Traits\Get_Instance;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Utils class
*
* Main module class for utils functions.
*/
class Utils {
use Get_Instance;
/**
* Convert absolute URL to relative path.
*
* Removes the home URL and trailing slashes from the given URL.
*
* @param string $url Full URL.
* @return string Relative path without leading/trailing slashes.
* @since 1.5.0
*/
public static function get_relative_url( $url ) {
$home_url = trailingslashit( home_url() );
$relative = str_replace( $home_url, '', trailingslashit( $url ) );
return rtrim( $relative, '/' );
}
/**
* Build a surerank.com URL with standard UTM tracking parameters.
*
* If the URL already contains any UTM parameter it is returned unchanged.
* Asset URLs (wp-content/uploads) are also returned unchanged.
* The URL is normalised to HTTPS before appending parameters.
*
* Standard UTM set:
* utm_source = surerank_plugin
* utm_medium = wordpress_plugin
* utm_campaign = <surface> (e.g. 'admin_dashboard', 'sitemap')
* utm_content = <context> (e.g. 'help_link', 'support_link')
*
* @since 1.7.4
* @param string $url Base surerank.com URL.
* @param string $campaign UTM campaign value (surface identifier).
* @param string $content UTM content value (CTA / context identifier).
* @return string Raw (unescaped) URL with UTM parameters appended. Callers
* must apply esc_url() when outputting in HTML attributes.
*/
public static function get_utm_url( $url, $campaign, $content ) {
// Guard: return empty string for a missing URL.
if ( empty( $url ) ) {
return '';
}
// Normalize to https.
$url = (string) preg_replace( '#^http://#i', 'https://', $url );
// Leave asset URLs untouched.
if ( strpos( $url, '/wp-content/uploads' ) !== false ) {
return esc_url_raw( $url );
}
// Leave URLs that already carry any UTM parameter untouched.
if ( strpos( $url, 'utm_source' ) !== false || strpos( $url, 'utm_medium' ) !== false ) {
return esc_url_raw( $url );
}
return esc_url_raw(
add_query_arg(
[
'utm_source' => 'surerank_plugin',
'utm_medium' => 'wordpress_plugin',
'utm_campaign' => sanitize_key( $campaign ),
'utm_content' => sanitize_key( $content ),
],
$url
)
);
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 api-utils.php
php
6.6 KB
2026-06-26 15:48
🐘 cache.php
php
18.6 KB
2026-06-26 15:48
🐘 compat.php
php
7.5 KB
2026-06-26 15:48
🐘 cron.php
php
3.3 KB
2026-06-26 15:48
🐘 defaults.php
php
14.2 KB
2026-06-26 15:48
🐘 get.php
php
6.8 KB
2026-06-26 15:48
🐘 helper.php
php
22.1 KB
2026-06-26 15:48
🐘 modified-date-lock.php
php
2.5 KB
2026-06-26 15:48
🐘 requests.php
php
1.9 KB
2026-06-26 15:48
🐘 rest-observation.php
php
2.8 KB
2026-06-26 15:48
🐘 sanitize.php
php
5 KB
2026-06-26 15:48
🐘 send-json.php
php
1.3 KB
2026-06-26 15:48
🐘 settings.php
php
24.2 KB
2026-06-26 15:48
🐘 update.php
php
4.2 KB
2026-06-26 15:48
🐘 utils.php
php
2.5 KB
2026-06-26 15:48
🐘 validate.php
php
2.3 KB
2026-06-26 15:48
🐘 variables.php
php
3.7 KB
2026-06-26 15:48