| @@ -2143,8 +2143,29 @@ | ||
| 2143 | 2143 | return defined( 'SRFM_PRO_VER' ); |
| 2144 | 2144 | } |
| 2145 | 2145 | |
| 2146 | 2146 | /** |
| 2147 | + * Whether SureForms promotional content should be hidden. | |
| 2148 | + * | |
| 2149 | + * Covers review requests, cross-sell banners and announcements. The free | |
| 2150 | + * plugin never hides them on its own; SureForms Pro's Distraction Free mode | |
| 2151 | + * turns this on through the filter. | |
| 2152 | + * | |
| 2153 | + * @since 2.12.8 | |
| 2154 | + * @return bool | |
| 2155 | + */ | |
| 2156 | + public static function hide_promotions() { | |
| 2157 | + /** | |
| 2158 | + * Filter whether SureForms hides its promotional content in wp-admin. | |
| 2159 | + * | |
| 2160 | + * @since 2.12.8 | |
| 2161 | + * | |
| 2162 | + * @param bool $hide Default false. | |
| 2163 | + */ | |
| 2164 | + return (bool) apply_filters( 'srfm_hide_promotions', false ); | |
| 2165 | + } | |
| 2166 | + | |
| 2167 | + /** | |
| 2147 | 2168 | * Verifies the request by checking the nonce and user capabilities. |
| 2148 | 2169 | * |
| 2149 | 2170 | * @param string $request_type The type of request, either 'rest' or 'ajax'. |
| 2150 | 2171 | * @param string $nonce_action The action name for the nonce. |
| @@ -2238,22 +2259,27 @@ | ||
| 2238 | 2259 | * Falls back to the general guide rather than returning nothing, so the notice |
| 2239 | 2260 | * always has somewhere to send them. |
| 2240 | 2261 | * |
| 2241 | 2262 | * @since 2.12.7 |
| 2263 | + * @param string $medium Placement the link is rendered in, used as utm_medium. | |
| 2264 | + * Two surfaces show this guide -- the dashboard notice and | |
| 2265 | + * the onboarding step -- and a shared value would make the | |
| 2266 | + * two indistinguishable in reporting, which is the whole | |
| 2267 | + * point of the attribution. | |
| 2242 | 2268 | * @return string Absolute documentation URL. |
| 2243 | 2269 | */ |
| 2244 | - public static function get_caching_plugin_doc_url() { | |
| 2270 | + public static function get_caching_plugin_doc_url( $medium = 'form_checks_notice' ) { | |
| 2245 | 2271 | $entry = self::get_active_caching_plugin_entry(); |
| 2246 | 2272 | $slug = null === $entry || '' === $entry[1] ? 'how-to-set-up-sureforms-with-caching-plugins' : $entry[1]; |
| 2247 | 2273 | |
| 2248 | 2274 | // Through the central builder rather than hardcoding the domain, so the |
| 2249 | 2275 | // link carries the same UTM attribution as every other doc link and a |
| 2250 | - // domain change is one edit. utm_content is the slug, so the notice can be | |
| 2276 | + // domain change is one edit. utm_content is the slug, so the caller can be | |
| 2251 | 2277 | // told which guide people actually open. |
| 2252 | 2278 | return self::get_sureforms_website_url( |
| 2253 | 2279 | 'docs/' . $slug . '/', |
| 2254 | 2280 | [ |
| 2255 | - 'utm_medium' => 'form_checks_notice', | |
| 2281 | + 'utm_medium' => self::get_string_value( $medium ), | |
| 2256 | 2282 | 'utm_content' => $slug, |
| 2257 | 2283 | ] |
| 2258 | 2284 | ); |
| 2259 | 2285 | } |