default sentinel used to detect "new key absent". $opts = array( 'racn_ghost_rest', 'racn_ghost_hover', 'racn_export_format', 'racn_licence' ); foreach ( $opts as $new ) { $old = 'rccn_' . substr( $new, 5 ); if ( false === get_option( $new, false ) ) { $old_val = get_option( $old, false ); if ( false !== $old_val ) { update_option( $new, $old_val ); } } } // Transient: tier cache (racn_tier_cache <- rccn_tier_cache). if ( false === get_transient( 'racn_tier_cache' ) ) { $old_tier = get_transient( 'rccn_tier_cache' ); if ( false !== $old_tier ) { set_transient( 'racn_tier_cache', $old_tier, HOUR_IN_SECONDS * 6 ); } } update_option( 'racn_prefix_migrated', 1 ); } add_action( 'plugins_loaded', 'racn_migrate_prefixed_data' ); /** * Normalise a site URL for binding: strip scheme + trailing slash so http/https and * slash variants of the same install compare equal (the classic verification bug). * * @param string $url * @return string */ function racn_normalise_site_url( $url ) { return untrailingslashit( preg_replace( '#^https?://#i', '', (string) $url ) ); } /** * The active tier: 'free' | 'pro'. * * @return string */ function racn_tier() { // 1. Admin bypass — RACN_ADMIN_PRO grants Pro to logged-in admins on any site. For the // owner's own use where entering a licence is unnecessary; visitors and non-admins // are unaffected. No licence engine required, so it is safe in the free build. if ( defined( 'RACN_ADMIN_PRO' ) && RACN_ADMIN_PRO && function_exists( 'current_user_can' ) && current_user_can( 'manage_options' ) ) { return 'pro'; } // 2. Developer bypass — supplied ONLY by the Pro distribution (pro/dev-bypass.php). The // free build ships no such function, so this is inert there. if ( function_exists( 'racn_dev_bypass_tier' ) ) { $dev = racn_dev_bypass_tier(); if ( '' !== $dev ) { return $dev; } } // 3. Real licence — validated ONLY by the Pro distribution (pro/dev-bypass.php). Cached // 6h. Absent in the free build → tier stays 'free'. if ( function_exists( 'racn_validate_licence' ) ) { $cached = get_transient( 'racn_tier_cache' ); if ( false !== $cached ) return $cached; $tier = racn_validate_licence() ?: 'free'; set_transient( 'racn_tier_cache', $tier, HOUR_IN_SECONDS * 6 ); return $tier; } return 'free'; }