クラス
Utils
ソース ソース
ファイル: src/Utils.php
class Utils
{
/**
* Loads theme CSS and common CSS
*
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @return void
*/
public static function loadCommonCss() {
Theme::enqueueThemeCss();
wp_enqueue_style(
'wcexwl-common',
WCEXWL_PLUGIN_URL . '/src/Styles/common.css',
[],
WCEXWL_VERSION
);
}
/**
* Returns `true` if the current page is the wishlist page, `false` otherwise
*
* If calling from a theme file, use wcexwl_api_is_wishlist_page() instead.
*
* @important
* @author Evan D Shaw <evandanielshaw@gmail.com>
* @param string $link
* @return bool
*/
public static function isWishlistPage($link) {
$search = ['page_id=' . WCEXWL_POST_ID, '/' . WCEXWL_PAGE_SLUG];
$flag = false;
foreach ($search as $value) {
if (false !== strpos($link, $value)) {
if ($value == ('page_id=' . WCEXWL_POST_ID)) {
$parts = parse_url($link);
parse_str($parts['query'], $query);
if ($query['page_id'] == WCEXWL_POST_ID) {
$flag = true;
}
} else {
$flag = true;
}
}
}
return $flag;
}
}
- isWishlistPage — Returns `true` if the current page is the wishlist page, `false` otherwise
- loadCommonCss — Loads theme CSS and common CSS