^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$test this pattern on regexr: https://regexr.com/4inht
regex pattern to match RFC 2397 data URL
| <?php | |
| $countryCodes = [ | |
| [ | |
| 'abbr' => 'AD', | |
| 'name' => 'ANDORRA', | |
| 'code' => '376', | |
| 'pattern' => '' | |
| ], | |
| [ |
| { | |
| "version": "1.0", | |
| "time": "12398421321", | |
| "blocks": [ | |
| { | |
| "type": "p", | |
| "data": { | |
| "text": "mahdi khanzadi" | |
| }, | |
| "styles": { |
| <?php | |
| /** | |
| PHP array_splice doesn't use associative replacement keys, so i wrote the below method to do that. | |
| */ | |
| function array_splice_assoc(array &$original, int $offset, int $length = 0, $replacement = null) { | |
| $slice = array_slice($original, 0, $offset, true); | |
| if (!is_null($replacement)) { | |
| // cast to array |
^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$test this pattern on regexr: https://regexr.com/4inht
regex pattern to match RFC 2397 data URL
| // add some prototypes | |
| String.prototype.limit = function(length = 150, tail = '...') { | |
| return this.substr(0, length) + (this.length > length ? tail : ''); | |
| }; | |
| // how to use: | |
| 'this is an string'.limit(5); | |
| // or it can be like the below | |
| let name = 'this is my name'; |
| //use jquery and sweetAlert2 | |
| $(document).ready(function() { | |
| $("form input[name~=_method][value~=DELETE]").closest('form').submit(function(event) { | |
| event.preventDefault(); | |
| var form = $(this); //wrap this in jQuery | |
| swal({ | |
| title: "are you sure?", | |
| text: "do you realy want to delete this item?", | |
| type: "warning", | |
| showCancelButton: true, |
| <?php | |
| error_reporting(E_ALL); | |
| ini_set('display_errors',1); | |
| set_time_limit(0); | |
| function download ($file_source, $file_target) { | |
| echo 'starting'; | |
| $rh = fopen($file_source, 'rb'); | |
| $wh = fopen($file_target, 'w+b'); | |
| if (!$rh || !$wh) { |
| { | |
| "icons": [ | |
| "fa fa-glass", | |
| "fa fa-music", | |
| "fa fa-search", | |
| "fa fa-envelope-o", | |
| "fa fa-heart", | |
| "fa fa-star", | |
| "fa fa-star-o", | |
| "fa fa-user", |
| <?php | |
| if(!function_exists('fileUpload')){ | |
| /** | |
| * upload files (single and multiple) | |
| * | |
| * @param \Illuminate\Http\Request $request | |
| * @param $inputName | |
| * @param string $disk | |
| * @return array|mixed |