cvs: pear /Services_Trackback/Services Trackback.php /Services_Trackback/Services/Trackback SpamCheck.php
| From: | Tobias Schlitt | Date: | Tue, 24 May 2005 11:25:49 +0000 |
| Subject: | cvs: pear /Services_Trackback/Services Trackback.php /Services_Trackback/Services/Trackback SpamCheck.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32097@lists.php.net to get a copy of this message | ||
toby Tue May 24 07:25:49 2005 EDT
Modified files:
/pear/Services_Trackback/Services Trackback.php
/pear/Services_Trackback/Services/Trackback SpamCheck.php
Log:
* More convenient factory implementation.
http://cvs.php.net/diff.php/pear/Services_Trackback/Services/Trackback.php?r1=1.12&r2=1.13&ty=u
Index: pear/Services_Trackback/Services/Trackback.php
diff -u pear/Services_Trackback/Services/Trackback.php:1.12
pear/Services_Trackback/Services/Trackback.php:1.13
--- pear/Services_Trackback/Services/Trackback.php:1.12 Mon May 23 17:36:04 2005
+++ pear/Services_Trackback/Services/Trackback.php Tue May 24 07:25:47 2005
@@ -21,7 +21,7 @@
* @author Tobias Schlitt <toby@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Trackback.php,v 1.12 2005/05/23 21:36:04 toby Exp $
+ * @version CVS: $Id: Trackback.php,v 1.13 2005/05/24 11:25:47 toby Exp $
* @link http://pear.php.net/package/Services_Trackback
* @since File available since Release 0.1.0
*/
@@ -568,12 +568,16 @@
*/
function &createSpamCheck($spamCheckType, $options = array(), $priority = 0)
{
- $filename = 'Services/Trackback/SpamCheck.php';
+ $filename = dirname(__FILE__).'/Trackback/SpamCheck.php';
$createfunc = array('Services_Trackback_SpamCheck', 'create');
// SpamCheck class already included?
if (!class_exists($createfunc[0])) {
- @include_once $filename;
+ if (!file_exists($filename)) {
+ return PEAR::raiseError('SpamCheck subclass not found. Broken
installation!');
+ } else {
+ include_once $filename;
+ }
}
// SpamCheck class successfully included?
http://cvs.php.net/diff.php/pear/Services_Trackback/Services/Trackback/SpamCheck.php?r1=1.7&r2=1.8&ty=u
Index: pear/Services_Trackback/Services/Trackback/SpamCheck.php
diff -u pear/Services_Trackback/Services/Trackback/SpamCheck.php:1.7
pear/Services_Trackback/Services/Trackback/SpamCheck.php:1.8
--- pear/Services_Trackback/Services/Trackback/SpamCheck.php:1.7 Mon May 23 17:36:05 2005
+++ pear/Services_Trackback/Services/Trackback/SpamCheck.php Tue May 24 07:25:49 2005
@@ -24,7 +24,7 @@
* @author Tobias Schlitt <toby@php.net>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: SpamCheck.php,v 1.7 2005/05/23 21:36:05 toby Exp $
+ * @version CVS: $Id: SpamCheck.php,v 1.8 2005/05/24 11:25:49 toby Exp $
* @link http://pear.php.net/package/Services_Trackback
* @since File available since Release 0.5.0
*/
@@ -99,13 +99,23 @@
function &create($type, $options = null)
{
$filename = 'Services/Trackback/SpamCheck/' . $type . '.php';
+ $filepathes[] = dirname(__FILE__).'/SpamCheck/'.$type.'.php';
+ $filepathes[] = dirname(__FILE__).'/'.$type.'.php';
$classname = 'Services_Trackback_SpamCheck_' . $type;
- @include_once $filename;
+ // Check if class already exists or is includeable
+ if (!class_exists($classname)) {
+ if (file_exists($filepathes[0]) || file_exists($filepathes[1])) {
+ include_once $filename;
+ }
+ }
+
+ // We now definitly have to have the class available else the spam check
+ // contained errors / is unavailable.
if (!class_exists($classname)) {
return PEAR::raiseError('SpamCheck ' . $type . ' not found.');
}
-
+
return new $classname(@$options);
}