This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| search_files('/home/gabi/test/', '.png'); | |
| function search_files($dir, $extension) { | |
| $extension_length = strlen($extension); | |
| $rit = new RecursiveDirectoryIterator($dir); | |
| foreach(new RecursiveIteratorIterator($rit) as $file) { | |
| if(strcasecmp(substr($file, -$extension_length), $extension) == 0) { | |
| echo "$file\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function curl_download($Url){ | |
| // is cURL installed yet? | |
| if (!function_exists('curl_init')){ | |
| die('Sorry cURL is not installed!'); | |
| } | |
| // OK cool - then let's create a new cURL resource handle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function save() | |
| { | |
| // | |
| // Find the root ID of the category to make selecting much easier | |
| // | |
| // Get all categories | |
| $all_categories = $this->all_categories(); | |
| $parent_id = $this->get_parent_id(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function recursive_delete($dir) { | |
| $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST); | |
| foreach ($iterator as $file) { | |
| $path = $file->__toString(); | |
| if($file->isDir()) { | |
| rmdir($path); | |
| } else { | |
| unlink($path); | |
| } | |
| } |