<?php
namespace JFB_Modules\User_Journey;
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Tools for User Journey Module
*
* This file provides utility functions for the User Journey module.
*/
class Tools {
/**
* Retrieves WordPress page data by URL.
*
* @param string $url The URL to retrieve data for.
*
* @return array|false An array of page data or false if not found.
*/
public static function get_wp_page_data_by_url( string $url ) {
if ( function_exists( 'wc_get_page_id' ) && function_exists( 'get_permalink' ) ) {
$shop_page_id = wc_get_page_id( 'shop' );
$shop_url = get_permalink( $shop_page_id );
$shop_url_path = wp_parse_url( $shop_url, PHP_URL_PATH );
if ( $shop_url_path === $url ) {
return array(
'ID' => $shop_page_id,
'title' => get_the_title( $shop_page_id ),
'permalink' => $shop_url,
);
}
}
if ( '/' === $url ) {
$post_id = get_option( 'page_on_front' );
} else {
$post_id = url_to_postid( $url );
}
if ( ! $post_id ) {
return false;
}
$title = get_the_title( $post_id );
$permalink = get_permalink( $post_id );
return array(
'ID' => $post_id,
'title' => $title,
'permalink' => $permalink,
);
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| admin/ | 2026-07-21 14:14 | 9.03 KB | 76129f60960:kunden | dxwrx-r--r | |
| models/ | 2026-07-21 14:14 | 847 B | 76129f60960:kunden | dxwrx-r--r | |
| query-views/ | 2026-07-21 14:14 | 1.84 KB | 76129f60960:kunden | dxwrx-r--r | |
| rest-endpoints/ | 2026-07-21 14:14 | 1.59 KB | 76129f60960:kunden | dxwrx-r--r | |
| tab-handlers/ | 2026-07-21 14:14 | 1.13 KB | 76129f60960:kunden | dxwrx-r--r | |
| module.php | 2026-07-21 14:14 | 17.96 KB | 76129f60960:kunden | -xw-x----- | |
| tools.php | 2026-07-21 14:14 | 1.27 KB | 76129f60960:kunden | -xw-x----- | |
| user-journey-rest-controller.php | 2026-07-21 14:14 | 441 B | 76129f60960:kunden | -xw-x----- | |