PluginProbe
Depicter — Popup & Slider Builder / 1.2.0
Depicter — Popup & Slider Builder v1.2.0
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / averta / core / src / Utility / URL.php

URL.php in Depicter — Popup & Slider Builder 1.2.0, at vendor/averta/core/src/Utility/URL.php

29 lines 673 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Averta\Core\Utility;
3
4 class URL
5 {
6 /**
7 * Remove query args from url
8 *
9 * @param string $url
10 * @param array $args
11 * @return string
12 */
13 public static function removeQueryArg( $url, $args = [] ){
14
15 if ( is_array( $args ) ) {
16 foreach ( $args as $arg ) {
17 $pattern = "/(?:&|(\?))$arg=[^&]*(?(1)&|)?/";
18 $url = preg_replace( $pattern, '', $url);
19 }
20 } else {
21 $pattern = "/(?:&|(\?))$args=[^&]*(?(1)&|)?/";
22 $url = preg_replace( $pattern, '', $url);
23 }
24
25 $url = rtrim( $url, '?' );
26 return rtrim( $url, '&' );
27 }
28 }
29