| @@ 281-304 (lines=24) @@ | ||
| 278 | public function regex ( $value = null, $name = null, $options = null, $pod = null, $id = null ) { |
|
| 279 | global $wp_locale; |
|
| 280 | ||
| 281 | if ( '9.999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 282 | $thousands = '.'; |
|
| 283 | $dot = ','; |
|
| 284 | } |
|
| 285 | elseif ( '9,999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 286 | $thousands = ','; |
|
| 287 | $dot = '.'; |
|
| 288 | } |
|
| 289 | elseif ( '9 999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 290 | $thousands = ' '; |
|
| 291 | $dot = ','; |
|
| 292 | } |
|
| 293 | elseif ( '9999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 294 | $thousands = ''; |
|
| 295 | $dot = '.'; |
|
| 296 | } |
|
| 297 | elseif ( '9999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 298 | $thousands = ''; |
|
| 299 | $dot = ','; |
|
| 300 | } |
|
| 301 | else { |
|
| 302 | $thousands = html_entity_decode( $wp_locale->number_format['thousands_sep'] ); |
|
| 303 | $dot = $wp_locale->number_format[ 'decimal_point' ]; |
|
| 304 | } |
|
| 305 | ||
| 306 | return '\-*[0-9\\' . implode( '\\', array_filter( array( $dot, $thousands ) ) ) . ']+'; |
|
| 307 | } |
|
| @@ 326-349 (lines=24) @@ | ||
| 323 | public function validate ( $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { |
|
| 324 | global $wp_locale; |
|
| 325 | ||
| 326 | if ( '9.999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 327 | $thousands = '.'; |
|
| 328 | $dot = ','; |
|
| 329 | } |
|
| 330 | elseif ( '9,999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 331 | $thousands = ','; |
|
| 332 | $dot = '.'; |
|
| 333 | } |
|
| 334 | elseif ( '9 999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 335 | $thousands = ' '; |
|
| 336 | $dot = ','; |
|
| 337 | } |
|
| 338 | elseif ( '9999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 339 | $thousands = ','; |
|
| 340 | $dot = '.'; |
|
| 341 | } |
|
| 342 | elseif ( '9999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 343 | $thousands = '.'; |
|
| 344 | $dot = ','; |
|
| 345 | } |
|
| 346 | else { |
|
| 347 | $thousands = html_entity_decode( $wp_locale->number_format['thousands_sep'] ); |
|
| 348 | $dot = $wp_locale->number_format[ 'decimal_point' ]; |
|
| 349 | } |
|
| 350 | ||
| 351 | $check = str_replace( |
|
| 352 | array( $thousands, $dot, html_entity_decode($thousands) ), |
|
| @@ 385-408 (lines=24) @@ | ||
| 382 | public function pre_save ( $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) { |
|
| 383 | global $wp_locale; |
|
| 384 | ||
| 385 | if ( '9.999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 386 | $thousands = '.'; |
|
| 387 | $dot = ','; |
|
| 388 | } |
|
| 389 | elseif ( '9,999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 390 | $thousands = ','; |
|
| 391 | $dot = '.'; |
|
| 392 | } |
|
| 393 | elseif ( '9 999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 394 | $thousands = ' '; |
|
| 395 | $dot = ','; |
|
| 396 | } |
|
| 397 | elseif ( '9999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 398 | $thousands = ','; |
|
| 399 | $dot = '.'; |
|
| 400 | } |
|
| 401 | elseif ( '9999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 402 | $thousands = '.'; |
|
| 403 | $dot = ','; |
|
| 404 | } |
|
| 405 | else { |
|
| 406 | $thousands = html_entity_decode( $wp_locale->number_format['thousands_sep'] ); |
|
| 407 | $dot = $wp_locale->number_format[ 'decimal_point' ]; |
|
| 408 | } |
|
| 409 | ||
| 410 | $value = str_replace( array( $thousands, $dot ), array( '', '.' ), $value ); |
|
| 411 | $value = trim( $value ); |
|
| @@ 472-495 (lines=24) @@ | ||
| 469 | return null; |
|
| 470 | } |
|
| 471 | ||
| 472 | if ( '9.999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 473 | $thousands = '.'; |
|
| 474 | $dot = ','; |
|
| 475 | } |
|
| 476 | elseif ( '9,999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 477 | $thousands = ','; |
|
| 478 | $dot = '.'; |
|
| 479 | } |
|
| 480 | elseif ( '9 999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 481 | $thousands = ' '; |
|
| 482 | $dot = ','; |
|
| 483 | } |
|
| 484 | elseif ( '9999.99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 485 | $thousands = ''; |
|
| 486 | $dot = '.'; |
|
| 487 | } |
|
| 488 | elseif ( '9999,99' == pods_var( self::$type . '_format', $options ) ) { |
|
| 489 | $thousands = ''; |
|
| 490 | $dot = ','; |
|
| 491 | } |
|
| 492 | else { |
|
| 493 | $thousands = $wp_locale->number_format[ 'thousands_sep' ]; |
|
| 494 | $dot = $wp_locale->number_format[ 'decimal_point' ]; |
|
| 495 | } |
|
| 496 | ||
| 497 | $length = (int) pods_var( self::$type . '_max_length', $options, 12, null, true ); |
|
| 498 | ||