| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mimradmin/www/wp-content/plugins/1elementor-pro/modules/mega-menu/traits/ |
Upload File : |
<?php
namespace ElementorPro\Modules\MegaMenu\Traits;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
trait Url_Helper_Trait {
public function parse_url( $url ) {
$link_array = wp_parse_url( $url );
return [
'host' => ! empty( $link_array['host'] ) ? str_replace( 'www.', '', $link_array['host'] ) : '',
'path' => ! empty( $link_array['path'] ) ? trim( $link_array['path'], '/' ) : '',
'query' => ! empty( $link_array['query'] ) ? $link_array['query'] : '',
];
}
public function get_permalink_for_current_page() {
if ( ! is_front_page() && is_home() ) {
return get_post_type_archive_link( 'post' );
} elseif ( is_front_page() && is_home() ) {
return home_url();
} elseif ( is_year() ) {
return get_year_link( get_query_var( 'year' ) );
} elseif ( is_month() ) {
return get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
} elseif ( is_day() ) {
return get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
} elseif ( is_category() || is_tag() || is_tax() ) {
$queried_object = get_queried_object();
return get_term_link( $queried_object->term_id, $queried_object->taxonomy );
} elseif ( is_author() ) {
return get_author_posts_url( get_the_author_meta( 'ID' ) );
} elseif ( is_search() ) {
return get_search_link();
} elseif ( is_archive() ) {
return get_post_type_archive_link( get_post_type() );
}
return ! ( empty( get_the_permalink() ) ) ? get_the_permalink() : '';
}
}