| Server IP : 172.67.159.97 / Your IP : 216.73.216.111 Web Server : nginx/1.24.0 System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/rebeccaone.com/wp-content/plugins/loginpress/include/ |
Upload File : |
<?php
/**
* LoginPress Utilities
*
* @package loginpress
* @since 6.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Generate UTM link for LoginPress Pro upgrade.
*
* @since 6.0.0
*
* @param string $link Base URL.
* @param string $source UTM source parameter.
* @param string $medium UTM medium parameter.
* @param string $campaign UTM campaign parameter.
* @param string $term UTM term parameter.
* @param string $content UTM content parameter.
*
* @return string
*/
function loginpress_utm_link( $link, $source = 'loginpress-lite', $medium = '', $campaign = 'pro-upgrade', $term = '', $content = '' ) {
// Manually construct the URL to ensure correct parameter order.
$params = array();
// Add parameters in the correct order: utm_source, utm_medium, utm_campaign, utm_content, utm_term.
$params[] = 'utm_source=' . rawurlencode( $source );
$params[] = 'utm_medium=' . rawurlencode( $medium );
$params[] = 'utm_campaign=' . rawurlencode( $campaign );
if ( ! empty( $content ) ) {
$params[] = 'utm_content=' . rawurlencode( $content );
}
if ( ! empty( $term ) ) {
$params[] = 'utm_term=' . rawurlencode( $term );
}
$separator = strpos( $link, '?' ) !== false ? '&' : '?';
return $link . $separator . implode( '&', $params );
}
/**
* Generate upgrade link for LoginPress Pro.
*
* @since 6.0.0
*
* @param string $medium UTM medium parameter.
* @param string $content UTM content parameter.
*
* @return string
*/
function loginpress_admin_upgrade_link( $medium = 'link', $content = '' ) {
$url = 'https://loginpress.pro/pricing/';
// Don't add content for admin-menu as it will be added dynamically by loginpress_adjust_pro_menu_item.
if ( 'settings-tab' !== $medium && 'admin-menu' !== $medium ) {
$current_screen = get_current_screen();
if ( $current_screen ) {
$content = $content ? $content . ' - ' . $current_screen->base : $current_screen->base;
}
}
// Add view parameter if available (not for admin-menu).
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for UTM tracking purposes.
if ( 'admin-menu' !== $medium && isset( $_GET['view'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for UTM tracking purposes.
$content = $content ? $content . ': ' . sanitize_key( $_GET['view'] ) : sanitize_key( $_GET['view'] );
}
// Add tab parameter if available (not for admin-menu).
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for UTM tracking purposes.
if ( 'admin-menu' !== $medium && isset( $_GET['tab'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for UTM tracking purposes.
$content = $content ? $content . ': ' . sanitize_key( $_GET['tab'] ) : sanitize_key( $_GET['tab'] );
}
$source = 'loginpress-lite';
$campaign = 'pro-upgrade';
$term = '';
/**
* Filter the upgrade link medium parameter.
*
* @since 6.0.0
*
* @param string $medium UTM medium parameter.
*/
$medium = apply_filters( 'loginpress_upgrade_link_medium', $medium );
// Build the upgrade link from the (possibly filtered) medium.
$upgrade = loginpress_utm_link( $url, $source, $medium, $campaign, $term, $content );
/**
* Filter the upgrade link.
*
* Allows plugins to modify the final URL or append tracking/affiliate parameters.
*
* @since 6.0.0
*
* @param string $upgrade Upgrade link.
*/
return apply_filters( 'loginpress_upgrade_link', $upgrade );
}
/**
* Check if LoginPress Pro is active.
*
* @since 6.0.0
*
* @return bool
*/
function loginpress_is_pro() {
return class_exists( 'LoginPress_Pro' ) || defined( 'LOGINPRESS_PRO_VERSION' );
}
/**
* Maximum session expiration time in minutes for the settings field.
*
* @since 6.2.3
*
* @return int Non-negative minute cap (default 43200 = 30 days).
*/
function loginpress_session_expiration_max() {
/**
* Filter the maximum session expiration time in minutes.
*
* @since 6.2.3
*
* @param int $max Maximum minutes. Default 43200 (30 days).
*/
$max = absint( apply_filters( 'loginpress_session_expiration_max', 43200 ) );
return max( 0, $max );
}