-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_core.php
More file actions
42 lines (36 loc) · 1.51 KB
/
_core.php
File metadata and controls
42 lines (36 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// Max Base
// https://github.com/BaseMax/API-Sarrafchi
require "phpedb.php";
date_default_timezone_set('Asia/Tehran');
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
$db=new database();
$config = require "_config.php";
$db->db=$config["db_name"];
$db->connect($config["db_host"], $config["db_user"], $config["db_pass"]);
function strWordCut($string, $length) {
$str_len = mb_strlen($string);
$string = strip_tags($string);
if($str_len > $length) {
$stringCut = mb_substr($string, 0, $length-15);
$string = $stringCut.'.....' . mb_substr($string, $str_len-10, $str_len-1);
}
return $string;
}
function convert2english($string) {
$newNumbers = range(0, 9);
// 1. Persian HTML decimal
$persianDecimal = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
// 2. Arabic HTML decimal
$arabicDecimal = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩');
// 3. Arabic Numeric
$arabic = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩');
// 4. Persian Numeric
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$string = str_replace($persianDecimal, $newNumbers, $string);
$string = str_replace($arabicDecimal, $newNumbers, $string);
$string = str_replace($arabic, $newNumbers, $string);
return str_replace($persian, $newNumbers, $string);
}