The Authorize.net CIM PHP Class allows you to interact with the Authorize.Net Customer Information Manager (CIM), which can be used to store your customers’ sensitive payment information on secure servers, simplifying payments for returning customers and recurring transactions. It can also help you to comply with the Payment Card Industry (PCI) Data Security Standard, since customer data is no longer stored locally. It is an ideal tool for businesses that need to securely save customer data and provide convenience for their customers.
This is a derivative work of the class created by Ray Solomon/Josh (Version 1.3). I needed the extraOptions functionality for Authorize.net’s FDS (Fraud Detection Suite), but was unable to get in contact with either authors to see if any updates were coming down the pipe.
Download Version 1.3.1
Updated: June 24, 2009
Files included:
- authorizenet.cim.class.php
- examples.php
- LICENSE.txt
Tags: PHP · PHP Authorize.net CIM API Class
February 3rd, 2009 · 2 Comments
Just thought I’d leave a quick note to myself about validation errors not showing up when I use read() after a save() or saveAll(). The key is to use a conditional for the read() or I believe using find() work as well.
Won’t show validation errors:
if (!empty($this->data)) {
if ($this->User->saveAll($this->data, array('validate'=>'first'))) {
$this->Session->setFlash('User saved');
} else {
$this->Session->setFlash('User not saved.');
}
}
$this->data = $this->User->read(null, $id);
Will show validation errors:
if (!empty($this->data)) {
if ($this->User->saveAll($this->data, array('validate'=>'first'))) {
$this->Session->setFlash('User saved');
} else {
$this->Session->setFlash('User not saved.');
}
} else {
$this->data = $this->User->read(null, $id);
}
Tags: CakePHP · PHP
I’ve noticed on many occasions that I’ll start a project with a Subversion repo and immediately add/commit all the files included with Cake’s nightly build including the tmp/ directory. If you’ve ever done this, you’ll know it’s kind of a pain always having those cache/log files showing up when you commit. So, for my benefit, I’m posting these few lines of code in order for me to refer to later.
From the app/ directory:
svn export tmp tmpBAK
svn rm --force tmp
svn ci -m 'Removing directory "tmp".'
mv tmpBAK tmp
svn propset svn:ignore 'tmp' .
svn ci -m 'Ignoring "tmp" directory.'
Tags: CakePHP · PHP · Subversion
In moving some legecy sites over to CakePHP, I’ve come across some situations where I need to the Auth component to ‘hash’ the password differently. For example, just a straight md5() of the password.
To accomplish this, you need to empty your Security.salt variable in /app/config/core.php (Not positive what all this will affect):
Configure::write('Security.salt', '');
and change the hash method of the Security class (I did this in app_controller.php):
function beforeFilter(){
Security::setHash('md5');
}
Tags: CakePHP
Twhirl is an Adobe Air based Twitter client, and one of my favorites for use on my Dell Latitude D630 running Ubuntu Hardy Heron. For instructions on how to install Air, click here. Then, download/install Twhirl from here. Total install time is 5-10 minutes.
Tags: Twitter · Ubuntu
It took a little bit of work for me to get my Dell bluetooth mouse and keyboard working with my new work laptop (Dell D630), but in the end it was pretty easy.
First, make sure gnome-bluetooth and bluez-gnome are installed in Synaptic. Then, in a terminal type “sudo hidd –search” and click the little bluetooth button on the underside of the mouse/keyboard.
Tags: Dell · Ubuntu
March 24th, 2008 · 1 Comment
The first step in getting a Google map on your site is to get the latitude and longitude coordinates of all the points you want to show. I get my coordinates using geocoding in the Google Maps API. In order to use the Google Maps API, you must sign up for a free key here.
Once you have your key, it’s as simple as:
// Desired address
$address = "http://maps.google.com/maps/geo?q="
.urlencode($data['address'])
.",+".urlencode($data['city'])
.",+".urlencode($data['state'])
.",+".urlencode($data['zip'])
."&output=xml&key=".$_SESSION['GOOGLE_KEY'];
// Retrieve the URL contents
$page = file_get_contents($address);
// Parse the returned XML file
$xml = new SimpleXMLElement($page);
// Parse the coordinate string
list($longitude, $latitude, $altitude) = explode(",", $xml->Response->Placemark->Point->coordinates);
We now have $longitude/$latitude, which we will need for rendering our map.
Notes:
- I used to get the coordinates inside of my map generation, but sometimes the map would finish rendering before all the coordinates had been downloaded, so I suggest you get all your coordinates before you render your map.
- My example makes use of SimpleXMLElement() which I believe is a PHP5 and above only function. If you use PHP4 or below, you will have to parse the xml some other way.
- You don’t need the altitude for map generation, but they give it to us anyway.
Tags: Google · PHP
I had a problem where I was defining javascript variables from php variables, and the php variables had multiple lines.
So, a function like this:
function SomeFunction() {
var variable = "<?php echo $variable; ?>";
}
was creating this:
function SomeFunction() {
var variable = "The first row.
The second row.
The third row
";
}
The fix was to replace all the ‘\n’ with ‘\\n’, so the literal string ‘\n’ is output instead of an actual line break.
Like so:
var variable = "<?php echo str_replace('\n', '\\n', $variable); ?>
Tags: Javascript · PHP
I just ran into a situation today that required me to have access to more than one form field when doing an ajax request within my CakePHP application. Basically, when someone is typing an address, I want to check Google’s Geocode API for a latitude and longitude coordinate.
The important part is the ‘with’ option:
'with'=>'Form.serializeElements($("CommunityForm").getElements())'
My example:
echo $ajax->observeField('CommunityAddress', array('with'=>'Form.serializeElements( $("CommunityForm").getElements() )','url'=>'geocode','update'=>'geocode'"));
- The data being passed can be accessed in $this->params
- This solution requires the Prototype javascript library.
Tags: CakePHP
January 17th, 2008 · 3 Comments
find ./ -name ".svn" | xargs rm -Rf
source: http://www.rickhurst.co.uk/category/linux/
Tags: Uncategorized