How to incorporate CFAKismet with MachBlog
There was a post today in the Mach II forums on how to incorporate CFAkismet into Mach blog. I looked at Kismet and found it pretty neat and went on to obtain an API Key. And then it was getting the CFAkismet.cfc readjusted to akismetService.cfc and akismetListener.cfc. I used a Mach II Listener for incorporating Akismet into Mach Blog I followed the path of captcha that is used in comments. Kismet has not been incorporated with trackbacks but it can be with minimal effort and I will be doing that soon as well. The trackback submission event, the trackbackListener and the trackback form needs to be modified. Everything else stays the same. God I love frameworks !!!!
Here is the process
1. Modify the machii.xml.cfm file in your config folder. Add the following properties
<!-- CFKISMET-->
<property name="useAkismet" value="true"/> <!-- this can be changed to false if you dont want to use Akismet-->
<property name="akismetAPIKey" value="YOUR API KEY HERE"/>
Add the following listeners
<listener name="akismetListener" type="machblog.org.machblog.listeners.akismetListener"/>
Modify the processCommentForm as follows
<event-handler event="processCommentForm" access="public">
<event-bean name="comment" type="machblog.org.machblog.beans.Comment" fields="commentId,entryId,name,email,url,comment,isSubscribed,subscriberEmailSent" />
<notify listener="captchaListener" method="validateCaptcha"/>
<notify listener="akismetListener" method="isCommentSpam"/>
<notify listener="commentListener" method="processCommentForm"/>
</event-handler>
One thing you need to make sure is that your blogUrl property in your config file is in the correct format as is required by AKismet (with the http and all)
<property name="blogUrl" value="http://www.premsweb.com/blogpro" />
Otherwise the API Key verification will fail. If you look into the services.xml file you will notice that exisiting properties in the machii config file is used as properties for the akismetService bean which is why the blogUrl parameter is important. 2. Modify the services.xml file in your config folder. Add the following lines
<!-- AKismet -->
<bean id="akismetService" class="machblog.org.machblog.utils.akismet.akismetService">
<property name="ApplicationName"><value>{appName}</value></property>
<property name="BlogURL"><value>{blogURL}</value></property> <property name="Key"><value>{akismetAPIKey}</value></property>
</bean>
3. Download two files akismetListener and akismetService from here
Put the akismet folder in the zip file along with akismetService.cfc (modified from CFAkismet.cfc) to machblog/org/machblog/utils
Put the akismetListner in with the rest of the listeners at machblog/org/machblog/listeners
4. Modify the main_en_US.properties file in machblog/i18n/ folder (the others can be modified as well but unfortunately english is the only language that I know). Add the following lines
akismetAPIFail=CFAkismet: You have not defined an API Key. Make sure you've called the setKey() method with a valid key. You can get an Akismet key at http://wordpress.com/api-keys/
akismetBlogFail=CFAkismet: You have not defined your blog URL. Make sure you've called the setBlogURL() method with your blog URL.
akismetAppFail=CFAkismet: You have not set the application name and version calling Akismet. Make sure you've called the setApplicationName() method with your app name and version, such as 'ThisApp/1.1.10'
akismetSpam=CFAkismet: This comment has been failed the spam test by AKismet
5. Modify the CommentsListener.cfc as follows (find the matching code and replace it - search for useCaptcha and you should find it)
<cfif getProperty("useCaptcha") AND arguments.event.isArgDefined("captchaMessage")>
<cfset success = false />
<cfset message = getProperty("resourceBundleService").getResourceBundle().getResource("captchafail") />
<cfelseif getProperty("useAkismet") AND arguments.event.isArgDefined("akismetMessage")>
<cfset success = false />
<cfset message = event.getArg("akismetMessage") />
<cfelse>
<cfset getCommentService().createComment(comment) />
<cfset message = getProperty("resourceBundleService").getResourceBundle().getResource("commentactionsuccessful") />
6. Modify the comments.cfm file in whatever skin you are using , preferably all so that nothing breaks when you change skins. What we are doing is adding a hidden form field to the form so that the required parameter "PermaLink" can be passed into AKismet. You can put this line anywhere between the the <form> and </form> tags
<input type="hidden" name="PermaLink" value="/index.cfm?#getProperty('eventParameter')#=showEntry&entryId=#event.getArg('entryId')#">
Thanks to Peter Farrell and Matt Woodward, coz I followed the captcha code to incorporate Akismet into Mach Blog. Also thanks to Brandon Harper for the original CFAkismet.
f you are running multiple blogs on the same machine please make sure that you update everything accordingly. I have setup my server to run multiple blogs, where my mappings are such that my skins are always taken from the blog directory and the core code is in a machblog folder in the root directory. So in that scenario any upgrade to the config file and the skins file needs to be done in the blog directory and the core file updates (akismetListener, commentListener, akismetService, and main_en_US) needs to be done in the machblog directory under the root.
There was a post today in the Mach II forums on how to incorporate CFAkismet into Mach blog. I looked at Kismet and found it pretty neat and went on to obtain an API Key. And then it was getting the CFAkismet.cfc readjusted to akismetService.cfc and akismetListener.cfc. I used a Mach II Listener for incorporating Akismet into Mach Blog I followed the path of captcha that is used in comments. Kismet has not been incorporated with trackbacks but it can be with minimal effort and I will be doing that soon as well. The trackback submission event, the trackbackListener and the trackback form needs to be modified. Everything else stays the same. God I love frameworks !!!!
Here is the process
1. Modify the machii.xml.cfm file in your config folder. Add the following properties
<!-- CFKISMET-->
<property name="useAkismet" value="true"/> <!-- this can be changed to false if you dont want to use Akismet-->
<property name="akismetAPIKey" value="YOUR API KEY HERE"/>
Add the following listeners
<listener name="akismetListener" type="machblog.org.machblog.listeners.akismetListener"/>
Modify the processCommentForm as follows
<event-handler event="processCommentForm" access="public">
<event-bean name="comment" type="machblog.org.machblog.beans.Comment" fields="commentId,entryId,name,email,url,comment,isSubscribed,subscriberEmailSent" />
<notify listener="captchaListener" method="validateCaptcha"/>
<notify listener="akismetListener" method="isCommentSpam"/>
<notify listener="commentListener" method="processCommentForm"/>
</event-handler>
One thing you need to make sure is that your blogUrl property in your config file is in the correct format as is required by AKismet (with the http and all)
<property name="blogUrl" value="http://www.premsweb.com/blogpro" />
2. Modify the services.xml file in your config folder. Add the following lines
<!-- AKismet -->
<bean id="akismetService" class="machblog.org.machblog.utils.akismet.akismetService">
<property name="ApplicationName"><value>{appName}</value></property>
<property name="BlogURL"><value>{blogURL}</value></property> <property name="Key"><value>{akismetAPIKey}</value></property>
</bean>
3. Download two files akismetListener and akismetService from here
Put the akismet folder in the zip file along with akismetService.cfc (modified from CFAkismet.cfc) to machblog/org/machblog/utils
Put the akismetListner in with the rest of the listeners at machblog/org/machblog/listeners
4. Modify the main_en_US.properties file in machblog/i18n/ folder (the others can be modified as well but unfortunately english is the only language that I know). Add the following lines
akismetAPIFail=CFAkismet: You have not defined an API Key. Make sure you've called the setKey() method with a valid key. You can get an Akismet key at http://wordpress.com/api-keys/
akismetBlogFail=CFAkismet: You have not defined your blog URL. Make sure you've called the setBlogURL() method with your blog URL.
akismetAppFail=CFAkismet: You have not set the application name and version calling Akismet. Make sure you've called the setApplicationName() method with your app name and version, such as 'ThisApp/1.1.10'
akismetSpam=CFAkismet: This comment has been failed the spam test by AKismet
5. Modify the CommentsListener.cfc as follows (find the matching code and replace it - search for useCaptcha and you should find it)
<cfif getProperty("useCaptcha") AND arguments.event.isArgDefined("captchaMessage")>
<cfset success = false />
<cfset message = getProperty("resourceBundleService").getResourceBundle().getResource("captchafail") />
<cfelseif getProperty("useAkismet") AND arguments.event.isArgDefined("akismetMessage")>
<cfset success = false />
<cfset message = event.getArg("akismetMessage") />
<cfelse>
<cfset getCommentService().createComment(comment) />
<cfset message = getProperty("resourceBundleService").getResourceBundle().getResource("commentactionsuccessful") />
6. Modify the comments.cfm file in whatever skin you are using , preferably all so that nothing breaks when you change skins. What we are doing is adding a hidden form field to the form so that the required parameter "PermaLink" can be passed into AKismet. You can put this line anywhere between the the <form> and </form> tags
<input type="hidden" name="PermaLink" value="/index.cfm?#getProperty('eventParameter')#=showEntry&entryId=#event.getArg('entryId')#">
Thanks to Peter Farrell and Matt Woodward, coz I followed the captcha code to incorporate Akismet into Mach Blog. Also thanks to Brandon Harper for the original CFAkismet.
f you are running multiple blogs on the same machine please make sure that you update everything accordingly. I have setup my server to run multiple blogs, where my mappings are such that my skins are always taken from the blog directory and the core code is in a machblog folder in the root directory. So in that scenario any upgrade to the config file and the skins file needs to be done in the blog directory and the core file updates (akismetListener, commentListener, akismetService, and main_en_US) needs to be done in the machblog directory under the root.
Successful testing with both Captcha and Kismet.
Thanks! Send me your Amazon Wishlist and I'll buy you a book or something :-)
However, replica hangbags that replica hangbags option is replica handbags no longer replica handbags on the table replica handbags
for the replica handbags Red Sox.
you can search replica watches on the internet