github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

felixge / debuggable-scraps

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 60
    • 10
  • Source
  • Commits
  • Network (10)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (3)
    • devel
    • gh-pages
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

MIT licensed code without warranty ; ) — Read more

  cancel

http://www.debuggable.com/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Caching the returned value for even faster future lookups 
josegonzalez (author)
Tue Feb 09 01:04:32 -0800 2010
Felix Geisendörfer (committer)
Tue Feb 09 01:18:27 -0800 2010
commit  5d79cc93bd35125eef52244f41c9c966dae43dd9
tree    77ce062a67a0d5f47f0b1aa69e5368ba59a7f246
parent  3fbfca1bd3205e78aac80414bb8e8556a40496ae
debuggable-scraps / cakephp / datasources / akismet
name age
history
message
..
file akismet_source.php Mon Sep 01 07:14:30 -0700 2008 Typo fix [Felix Geisendörfer]
file readme.textile Mon Sep 01 05:53:36 -0700 2008 Initial release of Akismet datasource [Felix Geisendörfer]
cakephp/datasources/akismet/readme.textile

CakePHP Amazon Associates Data Source

A CakePHP datasource for interacting with the Akismet spam protection API.

If you don’t have an Akismet API key you can get one here: Get Akismet API key

Usage / Docs

1. Copy akismet_source.php to app/models/datasources/
2. Open your app/config/database.php and add the following:


var $akismet = array(
	'datasource' => 'akismet',
	'blog' => 'http://your-website-url.com',
	'key' => 'your-api-key-here',
	'map' => array(
		'comment_author' => 'author_name',
		'comment_author_email' => 'author_email',
		'comment_author_url' => 'author_url',
		'user_ip' => 'author_ip',
		'user_agent' => 'author_agent',
		'comment_type' => 'type',
		'comment_content' => 'text',
	)
);

The map key above tells the API what model fields of yours map to what fields the API expects to receive. If you use this API with multiple models you can dynamically pass different maps upon each request, or perform the normalization yourself before passing your data to the datasource.

3. Add this validation logic to your Comment model:


class Comment extends AppModel{
	var $validate = array(
		'text' => array(
			array(
				'rule' => array('notSpam'),
				'message' => 'This comment appears to be spam. Please contact us if the problem persists.',
				'required' => true,
			),
		),
	);

	function notSpam($fields) {
		$akismet = ConnectionManager::getDataSource('akismet');
		return !$akismet->isSpam($this->data['Comment'], Post::url($this->data['Comment']['post_id']));
	}

}

Known Bugs

None

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server