PluginProbe
Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More / 1.0.8
Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More v1.0.8
trunk 1.0.0 1.0.1 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
search-replace-wpcode / includes / helpers.php

helpers.php in Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More 1.0.8, at includes/helpers.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Helper functions.
4 *
5 * @package Search_Replace_WPCode
6 */
7
8 /**
9 * Get a URL with UTM parameters.
10 *
11 * @param string $url The URL to add the params to.
12 * @param string $medium The marketing medium.
13 * @param string $campaign The campaign.
14 * @param string $ad_content The utm_content param.
15 *
16 * @return string
17 */
18 function wsrw_utm_url( $url, $medium = '', $campaign = '', $ad_content = '' ) {
19 $args = array(
20 'utm_source' => class_exists( 'WSRW_License' ) ? 'wsrwpro' : 'wsrwlite',
21 'utm_medium' => sanitize_key( $medium ),
22 'utm_campaign' => sanitize_key( $campaign ),
23 );
24
25 if ( ! empty( $ad_content ) ) {
26 $args['utm_content'] = sanitize_key( $ad_content );
27 }
28
29 return add_query_arg(
30 $args,
31 $url
32 );
33 }
34
35
36 /**
37 * Check WP version and include the compatible upgrader skin.
38 */
39 function wsrw_require_upgrader() {
40
41 global $wp_version;
42
43 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
44
45 // WP 5.3 changes the upgrader skin.
46 if ( version_compare( $wp_version, '5.3', '<' ) ) {
47 require_once WSRW_PLUGIN_PATH . 'includes/admin/class-wsrw-skin-legacy.php';
48 } else {
49 require_once WSRW_PLUGIN_PATH . 'includes/admin/class-wsrw-skin.php';
50 }
51 }
52