You are here

public static function DatexArgHandlerTrait::translate in Datex 8

5 calls to DatexArgHandlerTrait::translate()
DatexArgHandlerTrait::query in src/Plugin/views/argument/DatexArgHandlerTrait.php
DatexViewsDate::opBetween in src/Plugin/views/filter/DatexViewsDate.php
Filters by operator between.
DatexViewsDate::opSimple in src/Plugin/views/filter/DatexViewsDate.php
@inheritDoc
DatexViewsDateTime::opBetween in src/Plugin/views/filter/DatexViewsDateTime.php
Override parent method, which deals with dates as integers.
DatexViewsDateTime::opSimple in src/Plugin/views/filter/DatexViewsDateTime.php
@inheritDoc

File

src/Plugin/views/argument/DatexArgHandlerTrait.php, line 20

Class

DatexArgHandlerTrait

Namespace

Drupal\datex\Plugin\views\argument

Code

public static function translate($v) {
  $pass_0 = [
    'ﻯ' => 'ی',
    'ﻱ' => 'ی',
    '٠' => '0',
    '۱' => '1',
    '۲' => '2',
    '۳' => '3',
    '۴' => '4',
    '۵' => '5',
    '۶' => '6',
    '۷' => '7',
    '۸' => '8',
    '۹' => '9',
    '١' => '1',
    '٢' => '2',
    '٣' => '3',
    '٤' => '4',
    '٥' => '5',
    '٦' => '6',
    '٧' => '7',
    '٨' => '8',
    '٩' => '9',
  ];
  $pass_1 = [
    'امروز' => 'today',
    'دیروز' => '-1 day',
    'فردا' => '+1 day',
    'پیش' => 'ago',
    'قبل' => 'last',
    'بعد' => 'later',
    'بعدی' => 'next',
    'ثانیه' => 'second',
    'دقیقه' => 'minute',
    'ساعت' => 'hour',
    'روز' => 'day',
    'ماه' => 'month',
    'سال' => 'year',
    'هفته' => 'week',
  ];
  $v = trim($v);
  $v = strtr($v, $pass_0);
  $v = strtr($v, $pass_1);
  return $v;
}