Skip to content

Instantly share code, notes, and snippets.

View pamjadz's full-sized avatar

Pouriya Amjadzadeh pamjadz

View GitHub Profile
@pamjadz
pamjadz / iranian_phonenumber_sanitize.php
Last active November 5, 2022 15:39
اعتبارسنجی شماره تلفن همراه ایران
function sanitize_irphone($number){
$newNumbers = range(0, 9);
$char_arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
$number = str_replace($char_arabic, $newNumbers, $number);
$char_persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
$number = str_replace($char_persian, $newNumbers, $number);
$number = '0'.preg_replace('/^(?:98|\+98|0098|0)?9/i', '9', $number);
return $number;
}
@pamjadz
pamjadz / Arvand-logos.html
Created October 17, 2022 09:39
Arvand Logos SVG
<!--Logo Shape-->
<svg width="32" height="29" viewBox="0 0 685 620" fill="currentColor"><path d="M 358.72 0.00 L 380.39 0.00 C 401.16 2.14 421.64 8.40 439.32 19.67 C 456.05 30.16 470.37 44.48 480.69 61.32 C 484.22 67.21 487.40 73.31 490.78 79.29 C 550.48 186.88 610.18 294.47 669.87 402.07 C 673.59 408.83 677.71 415.47 680.01 422.90 C 683.44 434.44 684.11 446.52 685.00 458.46 L 685.00 462.53 C 684.20 475.33 683.00 488.17 679.51 500.57 C 670.89 533.27 651.70 563.12 625.25 584.25 C 596.91 607.11 560.44 619.80 524.00 619.03 C 504.26 619.20 484.59 614.96 466.29 607.68 C 453.35 602.17 440.20 595.97 430.28 585.73 C 361.12 519.54 291.85 453.47 222.66 387.32 C 196.37 363.76 156.24 357.99 124.02 372.03 C 101.73 381.46 83.44 399.81 74.08 422.13 C 64.83 443.72 64.04 468.82 72.01 490.92 C 78.88 510.56 92.53 527.71 110.06 538.90 C 124.01 547.88 140.35 552.98 156.89 553.86 C 191.80 555.62 226.72 536.28 243.63 505.67 C 248.97 497.09 250.44 486.19 258.18 479.17 C 268.19 469.21 284.75 467.09 297.03 473.99 C 307.11 479.43 313.8
@pamjadz
pamjadz / twilio-WPSMS.php
Created October 2, 2022 15:59
Twilio Wordpress Send SMS API
function twilioSendSMS($params = [], $endpoint = 'Messages.json'){
$sid = 'SID HERE';
$token = 'TOKEN HERE';
$request = wp_remote_get("https://api.twilio.com/2010-04-01/Accounts/{$sid}/{$endpoint}", [
'headers' => [
'Authorization' => 'Basic ' . base64_encode($sid . ':' . $token),
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
],
'body' => $params
]);