PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Core/wordpress/url.php +17 -4 10.11.1 → 11.1.0 View file →
@@ -1,6 +1,8 @@
1 1 <?php
2 2
3 +defined('ABSPATH') || die('Restricted Access');
4 +
3 5 function acym_route(string $url, bool $xhtml = true): string
4 6 {
5 7 return acym_baseURI().$url;
6 8 }
@@ -30,13 +32,15 @@
30 32
31 33 return acym_rootURI();
32 34 }
33 35
34 -function acym_rootURI(bool $pathonly = false, ?string $path = 'siteurl'): string
36 +function acym_rootURI(bool $pathonly = false, ?string $path = 'siteurl', bool $skipMultilingual = false): string
35 37 {
36 - $rootURI = rtrim(site_url(), '/').'/';
38 + $rootURI = rtrim($skipMultilingual ? get_option('siteurl') : site_url(), '/').'/';
37 39
38 - if (!acym_isAdmin()) {
40 + // For WPML
41 + if (!$skipMultilingual && !acym_isAdmin()) {
42 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML hook for integration.
39 43 $wpmlSiteUrl = apply_filters('wpml_home_url', $rootURI);
40 44 if ($wpmlSiteUrl !== $rootURI) {
41 45 $rootURI = rtrim($wpmlSiteUrl, '/').'/';
42 46 }
@@ -41,8 +45,9 @@
41 45 $rootURI = rtrim($wpmlSiteUrl, '/').'/';
42 46 }
43 47 }
44 48
49 + // For WordPress bedrock
45 50 if (defined('CONTENT_DIR') && substr($rootURI, -3) === 'wp/') {
46 51 $rootURI = substr($rootURI, 0, -3);
47 52 }
48 53
@@ -59,8 +64,11 @@
59 64
60 65 return acym_route($link);
61 66 }
62 67
68 +/**
69 + * If you use it to prepare a POST ajax, make sure you add the action and page parameters to the data passed, it's not taken into account if it's only in the URL
70 + */
63 71 function acym_prepareAjaxURL(string $url): string
64 72 {
65 73 return htmlspecialchars_decode(acym_route(acym_addPageParam($url, true)));
66 74 }
@@ -66,9 +74,9 @@
66 74 }
67 75
68 76 function acym_frontendLink(string $link, bool $complete = true, bool $sef = true): string
69 77 {
70 - return acym_rootURI().acym_addPageParam($link, true, true);
78 + return acym_rootURI(false, 'siteurl', true).acym_addPageParam($link, true, true);
71 79 }
72 80
73 81 function acym_backendLink(string $link): string
74 82 {
@@ -77,5 +85,10 @@
77 85
78 86 function acym_getMenu()
79 87 {
80 88 return get_post();
89 +}
90 +
91 +function acym_parseUrl(string $url)
92 +{
93 + return wp_parse_url($url);
81 94 }