PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.5.6.3
JetFormBuilder — Dynamic Blocks Form Builder v3.5.6.3
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / user-journey / tools.php
jetformbuilder / modules / user-journey Last commit date
admin 1 year ago models 1 year ago query-views 1 year ago rest-endpoints 1 year ago tab-handlers 1 year ago module.php 1 year ago tools.php 1 year ago user-journey-rest-controller.php 1 year ago
tools.php
59 lines
1 <?php
2
3
4 namespace JFB_Modules\User_Journey;
5
6 // If this file is called directly, abort.
7 if ( ! defined( 'WPINC' ) ) {
8 die;
9 }
10
11 /**
12 * Tools for User Journey Module
13 *
14 * This file provides utility functions for the User Journey module.
15 */
16 class Tools {
17 /**
18 * Retrieves WordPress page data by URL.
19 *
20 * @param string $url The URL to retrieve data for.
21 *
22 * @return array|false An array of page data or false if not found.
23 */
24 public static function get_wp_page_data_by_url( string $url ) {
25 if ( function_exists( 'wc_get_page_id' ) && function_exists( 'get_permalink' ) ) {
26 $shop_page_id = wc_get_page_id( 'shop' );
27 $shop_url = get_permalink( $shop_page_id );
28 $shop_url_path = wp_parse_url( $shop_url, PHP_URL_PATH );
29
30 if ( $shop_url_path === $url ) {
31 return array(
32 'ID' => $shop_page_id,
33 'title' => get_the_title( $shop_page_id ),
34 'permalink' => $shop_url,
35 );
36 }
37 }
38
39 if ( '/' === $url ) {
40 $post_id = get_option( 'page_on_front' );
41 } else {
42 $post_id = url_to_postid( $url );
43 }
44
45 if ( ! $post_id ) {
46 return false;
47 }
48
49 $title = get_the_title( $post_id );
50 $permalink = get_permalink( $post_id );
51
52 return array(
53 'ID' => $post_id,
54 'title' => $title,
55 'permalink' => $permalink,
56 );
57 }
58 }
59