| @@ 349-403 (lines=55) @@ | ||
| 346 | ||
| 347 | $url = @parse_url( $value ); |
|
| 348 | ||
| 349 | if ( empty( $url ) || count( $url ) < 2 ) |
|
| 350 | $value = ''; |
|
| 351 | else { |
|
| 352 | $defaults = array( |
|
| 353 | 'scheme' => 'http', |
|
| 354 | 'host' => '', |
|
| 355 | 'path' => '/', |
|
| 356 | 'query' => '', |
|
| 357 | 'fragment' => '' |
|
| 358 | ); |
|
| 359 | ||
| 360 | $url = array_merge( $defaults, $url ); |
|
| 361 | ||
| 362 | if ( 'normal' == pods_var( self::$type . '_format', $options ) ) |
|
| 363 | $value = $this->build_url( $url ); |
|
| 364 | elseif ( 'no-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 365 | if ( 0 === strpos( $url[ 'host' ], 'www.' ) ) |
|
| 366 | $url[ 'host' ] = substr( $url[ 'host' ], 4 ); |
|
| 367 | ||
| 368 | $value = $this->build_url( $url ); |
|
| 369 | } |
|
| 370 | elseif ( 'force-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 371 | if ( false !== strpos( $url[ 'host' ], '.' ) && false === strpos( $url[ 'host' ], '.', 1 ) ) |
|
| 372 | $url[ 'host' ] = 'www.' . $url[ 'host' ]; |
|
| 373 | ||
| 374 | $value = $this->build_url( $url ); |
|
| 375 | } |
|
| 376 | elseif ( 'no-http' == pods_var( self::$type . '_format', $options ) ) { |
|
| 377 | $value = $this->build_url( $url ); |
|
| 378 | $value = str_replace( trim( $url[ 'scheme' ] . '://', ':' ), '', $value ); |
|
| 379 | ||
| 380 | if ( '/' == $url[ 'path' ] ) |
|
| 381 | $value = trim( $value, '/' ); |
|
| 382 | } |
|
| 383 | elseif ( 'no-http-no-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 384 | if ( 0 === strpos( $url[ 'host' ], 'www.' ) ) |
|
| 385 | $url[ 'host' ] = substr( $url[ 'host' ], 4 ); |
|
| 386 | ||
| 387 | $value = $this->build_url( $url ); |
|
| 388 | $value = str_replace( trim( $url[ 'scheme' ] . '://', ':' ), '', $value ); |
|
| 389 | ||
| 390 | if ( '/' == $url[ 'path' ] ) |
|
| 391 | $value = trim( $value, '/' ); |
|
| 392 | } |
|
| 393 | elseif ( 'no-http-force-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 394 | if ( false !== strpos( $url[ 'host' ], '.' ) && false === strpos( $url[ 'host' ], '.', 1 ) ) |
|
| 395 | $url[ 'host' ] = 'www.' . $url[ 'host' ]; |
|
| 396 | ||
| 397 | $value = $this->build_url( $url ); |
|
| 398 | $value = str_replace( trim( $url[ 'scheme' ] . '://', ':' ), '', $value ); |
|
| 399 | ||
| 400 | if ( '/' == $url[ 'path' ] ) |
|
| 401 | $value = trim( $value, '/' ); |
|
| 402 | } |
|
| 403 | } |
|
| 404 | } else { |
|
| 405 | $value = $this->strip_html( $value, $options ); |
|
| 406 | } |
|
| @@ 268-322 (lines=55) @@ | ||
| 265 | ||
| 266 | $url = @parse_url( $value ); |
|
| 267 | ||
| 268 | if ( empty( $url ) || count( $url ) < 2 ) |
|
| 269 | $value = ''; |
|
| 270 | else { |
|
| 271 | $defaults = array( |
|
| 272 | 'scheme' => 'http', |
|
| 273 | 'host' => '', |
|
| 274 | 'path' => '/', |
|
| 275 | 'query' => '', |
|
| 276 | 'fragment' => '' |
|
| 277 | ); |
|
| 278 | ||
| 279 | $url = array_merge( $defaults, $url ); |
|
| 280 | ||
| 281 | if ( 'normal' == pods_var( self::$type . '_format', $options ) ) |
|
| 282 | $value = $this->build_url( $url ); |
|
| 283 | elseif ( 'no-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 284 | if ( 0 === strpos( $url[ 'host' ], 'www.' ) ) |
|
| 285 | $url[ 'host' ] = substr( $url[ 'host' ], 4 ); |
|
| 286 | ||
| 287 | $value = $this->build_url( $url ); |
|
| 288 | } |
|
| 289 | elseif ( 'force-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 290 | if ( false !== strpos( $url[ 'host' ], '.' ) && false === strpos( $url[ 'host' ], '.', 1 ) ) |
|
| 291 | $url[ 'host' ] = 'www.' . $url[ 'host' ]; |
|
| 292 | ||
| 293 | $value = $this->build_url( $url ); |
|
| 294 | } |
|
| 295 | elseif ( 'no-http' == pods_var( self::$type . '_format', $options ) ) { |
|
| 296 | $value = $this->build_url( $url ); |
|
| 297 | $value = str_replace( trim( $url[ 'scheme' ] . '://', ':' ), '', $value ); |
|
| 298 | ||
| 299 | if ( '/' == $url[ 'path' ] ) |
|
| 300 | $value = trim( $value, '/' ); |
|
| 301 | } |
|
| 302 | elseif ( 'no-http-no-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 303 | if ( 0 === strpos( $url[ 'host' ], 'www.' ) ) |
|
| 304 | $url[ 'host' ] = substr( $url[ 'host' ], 4 ); |
|
| 305 | ||
| 306 | $value = $this->build_url( $url ); |
|
| 307 | $value = str_replace( trim( $url[ 'scheme' ] . '://', ':' ), '', $value ); |
|
| 308 | ||
| 309 | if ( '/' == $url[ 'path' ] ) |
|
| 310 | $value = trim( $value, '/' ); |
|
| 311 | } |
|
| 312 | elseif ( 'no-http-force-www' == pods_var( self::$type . '_format', $options ) ) { |
|
| 313 | if ( false !== strpos( $url[ 'host' ], '.' ) && false === strpos( $url[ 'host' ], '.', 1 ) ) |
|
| 314 | $url[ 'host' ] = 'www.' . $url[ 'host' ]; |
|
| 315 | ||
| 316 | $value = $this->build_url( $url ); |
|
| 317 | $value = str_replace( trim( $url[ 'scheme' ] . '://', ':' ), '', $value ); |
|
| 318 | ||
| 319 | if ( '/' == $url[ 'path' ] ) |
|
| 320 | $value = trim( $value, '/' ); |
|
| 321 | } |
|
| 322 | } |
|
| 323 | ||
| 324 | $length = (int) pods_var( self::$type . '_max_length', $options, 255 ); |
|
| 325 | ||