| 1 |
<?php |
| 2 |
|
| 3 |
function acym_route($url, $xhtml = true, $ssl = null) |
| 4 |
{ |
| 5 |
return acym_baseURI().$url; |
| 6 |
} |
| 7 |
|
| 8 |
function acym_addPageParam($url, $ajax = false, $front = false) |
| 9 |
{ |
| 10 |
preg_match('#^([a-z]+)(?:[^a-z]|$)#Uis', $url, $ctrl); |
| 11 |
|
| 12 |
if ($front) { |
| 13 |
$link = 'index.php?page='.ACYM_COMPONENT.'_front&ctrl='.$url; |
| 14 |
if ($ajax) $link .= '&'.acym_noTemplate(); |
| 15 |
} else { |
| 16 |
$link = 'admin.php?page='.ACYM_COMPONENT.'_'.$ctrl[1].'&ctrl='.$url; |
| 17 |
if ($ajax) { |
| 18 |
$link .= '&action='.ACYM_COMPONENT.'_router&'.acym_noTemplate(); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
return $link; |
| 23 |
} |
| 24 |
|
| 25 |
function acym_baseURI($pathonly = false) |
| 26 |
{ |
| 27 |
if (acym_isAdmin()) { |
| 28 |
return admin_url(); |
| 29 |
} |
| 30 |
|
| 31 |
return acym_rootURI(); |
| 32 |
} |
| 33 |
|
| 34 |
function acym_rootURI($pathonly = false, $path = 'siteurl') |
| 35 |
{ |
| 36 |
$rootURI = rtrim(site_url(), '/').'/'; |
| 37 |
|
| 38 |
if (!acym_isAdmin()) { |
| 39 |
$wpmlSiteUrl = apply_filters('wpml_home_url', $rootURI); |
| 40 |
if ($wpmlSiteUrl !== $rootURI) { |
| 41 |
$rootURI = rtrim($wpmlSiteUrl, '/').'/'; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
if (defined('CONTENT_DIR') && substr($rootURI, -3) === 'wp/') { |
| 46 |
$rootURI = substr($rootURI, 0, -3); |
| 47 |
} |
| 48 |
|
| 49 |
return $rootURI; |
| 50 |
} |
| 51 |
|
| 52 |
function acym_completeLink($link, $popup = false, $redirect = false, $forceNoPopup = false) |
| 53 |
{ |
| 54 |
if (($popup || acym_isNoTemplate()) && $forceNoPopup == false) { |
| 55 |
$link .= '&'.acym_noTemplate(); |
| 56 |
} |
| 57 |
|
| 58 |
$link = acym_addPageParam($link); |
| 59 |
|
| 60 |
return acym_route($link); |
| 61 |
} |
| 62 |
|
| 63 |
function acym_prepareAjaxURL($url) |
| 64 |
{ |
| 65 |
return htmlspecialchars_decode(acym_route(acym_addPageParam($url, true))); |
| 66 |
} |
| 67 |
|
| 68 |
function acym_frontendLink($link, $complete = true, $sef = true) |
| 69 |
{ |
| 70 |
return acym_rootURI().acym_addPageParam($link, true, true); |
| 71 |
} |
| 72 |
|
| 73 |
function acym_getMenu() |
| 74 |
{ |
| 75 |
return get_post(); |
| 76 |
} |
| 77 |
|