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 | |
class AncientFileFilter extends \FilterIterator { | |
protected $DaysOld = 7; | |
public function __construct($dir,$days=null) { | |
// is the specified directory valid? | |
if(!is_string($dir) || !is_dir($dir) || !is_readable($dir)) |
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 | |
class AncientFileFilter extends \FilterIterator { | |
protected $DaysOld = 7; | |
public function __construct($dir,$days=null) { | |
// is the specified directory valid? | |
if(!is_string($dir) || !is_dir($dir) || !is_readable($dir)) |
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 | |
$dirname = dirname(__FILE__); | |
$paths = array( | |
"{$dirname}/controllers", | |
"{$dirname}/models", | |
"{$dirname}/views" | |
); | |
set_include_path(get_include_path().PATH_SEPARATOR.implode(PATH_SEPARATOR,$paths)); |
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 | |
/* | |
protected function ReturnFileProperties($File) | |
{ | |
if($Fileprops = new Imagick($File)) | |
{ | |
$FileProps = array(); | |
$FileProps['MimeType'] = "IMAGE/".$Fileprops->getImageFormat(); | |
$FileProps['FileSize'] = $Fileprops->getImageLength(); |
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 | |
class BobTest { | |
public function PublicMethod() { return; } | |
protected function ProtectedMethod() { return; } | |
private function PrivateMethod() { return; } | |
public function TestCallables() { | |
echo "testing myself...", PHP_EOL; |
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 | |
// set an exception handler so that we can render nice errors when bad thigns | |
// happen instead of spaming the user with garbage. | |
set_exception_handler(function($e){ | |
echo 'somebody derped in the waterhole'; | |
// your framework logging utility to log this | |
// ... |
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 | |
// set an exception handler so that we can render nice errors when bad thigns | |
// happen instead of spaming the user with garbage. | |
set_exception_handler(function(){ | |
echo 'somebody derped in the waterhole'; | |
// your framework logging utility to log this | |
// ... |
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 | |
class ImageFilterIterator extends FilterIterator { | |
public function accept() { | |
if(preg_match('/^(?:gif|jpe?g|png)$/i',$this->getExtension())) { | |
return true; | |
} else { | |
return false; | |
} |
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 | |
$path = dirname(__FILE__); | |
foreach(new ImageFilterIterator(new FilesystemIterator($path)) as $image) { | |
echo $image, PHP_EOL; | |
} |
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 | |
class ImageFilterIterator extends FilterIterator { | |
// overwriting the constructor to automagically create an inner iterator | |
// to surf the file system when given a path name. | |
public function __construct($path) { | |
parent::__construct(new FilesystemIterator($path)); | |
return; |